From c1945ab12efcd9dd74900c5f1fc593f96f74d697 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Wed, 22 Sep 2021 12:49:29 -0400 Subject: [PATCH] fix donation --- main.bundle.js | 2 +- main.bundle.js.map | 2 +- src/Faction/ui/DonateOption.tsx | 1 + src/Faction/ui/FactionRoot.tsx | 10 ++-------- src/Faction/ui/Info.tsx | 12 +++++++++++- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/main.bundle.js b/main.bundle.js index fcc8c19d1..0bb44658a 100644 --- a/main.bundle.js +++ b/main.bundle.js @@ -16,5 +16,5 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */r.PARSE_OPTIONS={ecmaVersion:5,locations:!0},r.READONLY_DESCRIPTOR={configurable:!0,enumerable:!0,writable:!1},r.NONENUMERABLE_DESCRIPTOR={configurable:!0,enumerable:!1,writable:!0},r.READONLY_NONENUMERABLE_DESCRIPTOR={configurable:!0,enumerable:!1,writable:!1},r.VARIABLE_DESCRIPTOR={configurable:!1,enumerable:!0,writable:!0},r.STEP_ERROR={},r.SCOPE_REFERENCE={},r.VALUE_IN_DESCRIPTOR={},r.toStringCycles_=[],r.prototype.getErrorLineNumber=function(e){var t=this.sourceCode;if(null==e||null==e.start)return NaN;try{return((t=t.substring(0,e.start)).match(/\n/g)||[]).length+1-this.sourceCodeLineOffset}catch(e){return NaN}},r.prototype.getErrorLineNumberMessage=function(e){return isNaN(e)?" (Unknown line number)":e<=0?" (Error occurred in an imported function)":" (Line Number "+e+". This line number is probably incorrect if your script is importing any functions. This is being worked on)"},r.prototype.appendCode=function(e){var t=this.stateStack[0];if(!t||"Program"!==t.node.type)throw Error("Expecting original AST to start with a Program node.");if("string"==typeof e&&(e=n.b(e,r.PARSE_OPTIONS)),!e||"Program"!==e.type)throw Error("Expecting new AST to start with a Program node.");this.populateScope_(e,t.scope);for(var a,i=0;a=e.body[i];i++)t.node.body.push(a);t.done=!1},r.prototype.step=function(){var e=this.stateStack,t=e[e.length-1];if(!t)return!1;var a=t.node,n=a.type;if("Program"===n&&t.done)return!1;if(this.paused_)return!0;try{var i=this.stepFunctions_[n](e,t,a)}catch(e){if(e!==r.STEP_ERROR)throw e}return i&&e.push(i),!!a.end||this.step()},r.prototype.run=function(){for(;!this.paused_&&this.step(););return this.paused_},r.prototype.initGlobalScope=function(e){this.setProperty(e,"NaN",NaN,r.READONLY_DESCRIPTOR),this.setProperty(e,"Infinity",1/0,r.READONLY_DESCRIPTOR),this.setProperty(e,"undefined",void 0,r.READONLY_DESCRIPTOR),this.setProperty(e,"window",e,r.READONLY_DESCRIPTOR),this.setProperty(e,"this",e,r.READONLY_DESCRIPTOR),this.setProperty(e,"self",e),this.OBJECT_PROTO=new r.Object(null),this.FUNCTION_PROTO=new r.Object(this.OBJECT_PROTO),this.initFunction(e),this.initObject(e),e.proto=this.OBJECT_PROTO,this.setProperty(e,"constructor",this.OBJECT,r.NONENUMERABLE_DESCRIPTOR),this.initArray(e),this.initString(e),this.initBoolean(e),this.initNumber(e),this.initDate(e),this.initRegExp(e),this.initError(e),this.initMath(e),this.initJSON(e);var t=this,a=this.createNativeFunction((function(e){throw EvalError("Can't happen")}),!1);a.eval=!0,this.setProperty(e,"eval",a),this.setProperty(e,"parseInt",this.createNativeFunction(parseInt,!1)),this.setProperty(e,"parseFloat",this.createNativeFunction(parseFloat,!1)),this.setProperty(e,"isNaN",this.createNativeFunction(isNaN,!1)),this.setProperty(e,"isFinite",this.createNativeFunction(isFinite,!1));for(var n=[[escape,"escape"],[unescape,"unescape"],[decodeURI,"decodeURI"],[decodeURIComponent,"decodeURIComponent"],[encodeURI,"encodeURI"],[encodeURIComponent,"encodeURIComponent"]],i=0;i>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {","var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}","});","if (!Array.prototype.find) {","Object.defineProperty(Array.prototype, 'find', {","value: function(predicate) {","if (this == null) {","throw new TypeError('\"this\" is null or not defined');","}","var o = Object(this);","var len = o.length >>> 0;","if (typeof predicate !== 'function') {","throw new TypeError('predicate must be a function');","}","var thisArg = arguments[1];","var k = 0;","while (k < len) {","var kValue = o[k];","if (predicate.call(thisArg, kValue, k, o)) {","return kValue;","}","k++;","}","return undefined;","},","configurable: true,","writable: true","});","}","if (!Array.prototype.findIndex) {","Object.defineProperty(Array.prototype, 'findIndex', {","value: function(predicate) {","if (this == null) {","throw new TypeError('\"this\" is null or not defined');","}","var o = Object(this);","var len = o.length >>> 0;","if (typeof predicate !== 'function') {","throw new TypeError('predicate must be a function');","}","var thisArg = arguments[1];","var k = 0;","while (k < len) {","var kValue = o[k];","if (predicate.call(thisArg, kValue, k, o)) {","return k;","}","k++;","}","return -1;","},","configurable: true,","writable: true","});","}","Object.defineProperty(Array.prototype, 'forEach',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') throw TypeError();","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'includes', {","value: function(searchElement, fromIndex) {","if (this == null) {","throw new TypeError('\"this\" is null or not defined');","}","// 1. Let O be ? ToObject(this value).","var o = Object(this);",'// 2. Let len be ? ToLength(? Get(O, "length")).',"var len = o.length >>> 0;","// 3. If len is 0, return false.","if (len === 0) {","return false;","}","// 4. Let n be ? ToInteger(fromIndex).","// (If fromIndex is undefined, this step produces the value 0.)","var n = fromIndex | 0;","// 5. If n ≥ 0, then","// a. Let k be n.","// 6. Else n < 0,","// a. Let k be len + n.","// b. If k < 0, let k be 0.","var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);","function sameValueZero(x, y) {","return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));","}","// 7. Repeat, while k < len","while (k < len) {","// a. Let elementK be the result of ? Get(O, ! ToString(k)).","// b. If SameValueZero(searchElement, elementK) is true, return true.","if (sameValueZero(o[k], searchElement)) {","return true;","}","// c. Increase k by 1. ","k++;","}","// 8. Return false","return false;","}","});","Object.defineProperty(Array.prototype, 'map',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);","k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (!this || typeof callback !== 'function') throw TypeError();","var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length === 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k++];","}","for (; k < len; k++) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw TypeError();","var t = Object(this), len = t.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];","} else {","while (k >= 0 && !(k in t)) k--;","if (k < 0) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k--];","}","for (; k >= 0; k--) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'some',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (!this || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t && fun.call(thisArg, t[i], i, t)) {","return true;","}","}","return false;","}","});","(function() {","var sort_ = Array.prototype.sort;","Array.prototype.sort = function(opt_comp) {","if (typeof opt_comp !== 'function') {","return sort_.call(this);","}","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {","if (opt_comp(this[j], this[j + 1]) > 0) {","var swap = this[j];","this[j] = this[j + 1];","this[j + 1] = swap;","changes++;","}","}","if (!changes) break;","}","return this;","};","})();","Object.defineProperty(Array.prototype, 'toLocaleString',","{configurable: true, writable: true, value:","function() {","var out = [];","for (var i = 0; i < this.length; i++) {","out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();","}","return out.join(',');","}","});","")},r.prototype.initString=function(e){var t,a=this;t=function(e){return e=String(e),a.calledWithNew()?(this.data=e,this):e},this.STRING=this.createNativeFunction(t,!0),this.setProperty(e,"String",this.STRING),this.setProperty(this.STRING,"fromCharCode",this.createNativeFunction(String.fromCharCode,!1),r.NONENUMERABLE_DESCRIPTOR);for(var n=["charAt","charCodeAt","concat","indexOf","lastIndexOf","slice","substr","substring","toLocaleLowerCase","toLocaleUpperCase","toLowerCase","toUpperCase","trim"],i=0;i= 0; i--) {","str = str.substring(0, subs[i][0]) + subs[i][2] + str.substring(subs[i][0] + subs[i][1]);","}","} else {","var i = str.indexOf(substr);","if (i !== -1) {","var inject = newSubstr(str.substr(i, substr.length), i, str);","str = str.substring(0, i) + inject + str.substring(i + substr.length);","}","}","return str;","};","})();","if (!String.prototype.endsWith) {","String.prototype.endsWith = function(search, this_len) {","if (this_len === undefined || this_len > this.length) {","this_len = this.length;","}","return this.substring(this_len - search.length, this_len) === search;","};","}","if (!String.prototype.includes) {","String.prototype.includes = function(search, start) {","'use strict';","if (typeof start !== 'number') {","start = 0;","}"," ","if (start + search.length > this.length) {","return false;","} else {","return this.indexOf(search, start) !== -1;","}","};","}","if (!String.prototype.startsWith) {","String.prototype.startsWith = function(search, pos) {","return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;","};","}","")},r.prototype.initBoolean=function(e){var t,a=this;t=function(e){return e=Boolean(e),a.calledWithNew()?(this.data=e,this):e},this.BOOLEAN=this.createNativeFunction(t,!0),this.setProperty(e,"Boolean",this.BOOLEAN)},r.prototype.initNumber=function(e){var t,a=this;t=function(e){return e=Number(e),a.calledWithNew()?(this.data=e,this):e},this.NUMBER=this.createNativeFunction(t,!0),this.setProperty(e,"Number",this.NUMBER);for(var n=["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"],i=0;i>>0;return t===Number(e)?t:NaN},r.legalArrayIndex=function(e){var t=e>>>0;return String(t)===String(e)&&4294967295!==t?t:NaN},r.Value,r.Object=function(e){this.getter=Object.create(null),this.setter=Object.create(null),this.properties=Object.create(null),this.proto=e},r.Object.prototype.proto=null,r.Object.prototype.isObject=!0,r.Object.prototype.class="Object",r.Object.prototype.data=null,r.Object.prototype.toString=function(){if("Array"===this.class){(n=r.toStringCycles_).push(this);try{for(var e=[],t=0;t0;i.pop()){var o=i[i.length-1];switch(o.node.type){case"TryStatement":return void(o.cv={type:e,value:t,label:a});case"CallExpression":case"NewExpression":if(e===r.Completion.RETURN)return void(o.value=t);if(e!==r.Completion.THROW)throw Error("Unsynatctic break/continue not rejected by Acorn")}if(e===r.Completion.BREAK){if(a?o.labels&&-1!==o.labels.indexOf(a):o.isLoop||o.isSwitch)return void i.pop()}else if(e===r.Completion.CONTINUE&&(a?o.labels&&-1!==o.labels.indexOf(a):o.isLoop))return}var s;if(this.isa(t,this.ERROR)){var l={EvalError:EvalError,RangeError:RangeError,ReferenceError:ReferenceError,SyntaxError:SyntaxError,TypeError:TypeError,URIError:URIError},c=this.getProperty(t,"name").toString(),u=this.getProperty(t,"message").valueOf();s=(e=l[c]||Error)(u+n)}else s=String(t)+n;throw s},r.prototype.createGetter_=function(e,t){var a=Array.isArray(t)?t[0]:t,n=new this.nodeConstructor;n.type="CallExpression";var i=new r.State(n,this.stateStack[this.stateStack.length-1].scope);return i.doneCallee_=!0,i.funcThis_=a,i.func_=e,i.doneArgs_=!0,i.arguments_=[],i},r.prototype.createSetter_=function(e,t,a){var n=Array.isArray(t)?t[0]:this.global,i=new this.nodeConstructor;i.type="CallExpression";var o=new r.State(i,this.stateStack[this.stateStack.length-1].scope);return o.doneCallee_=!0,o.funcThis_=n,o.func_=e,o.doneArgs_=!0,o.arguments_=[a],o},r.State=function(e,t){this.node=e,this.scope=t},r.prototype.stepArrayExpression=function(e,t,a){var n=a.elements,i=t.n_||0;for(t.array_?(this.setProperty(t.array_,i,t.value),i++):(t.array_=this.createObjectProto(this.ARRAY_PROTO),t.array_.properties.length=n.length);i>=":s>>=l;break;case">>>=":s>>>=l;break;case"&=":s&=l;break;case"^=":s^=l;break;case"|=":s|=l;break;default:throw SyntaxError("Unknown assignment expression: "+a.operator)}var c=this.setValue(t.leftReference_,s);if(c)return t.doneSetter_=!0,t.setterValue_=s,this.createSetter_(c,t.leftReference_,s);e.pop(),e[e.length-1].value=s},r.prototype.stepBinaryExpression=function(e,t,a){if(!t.doneLeft_)return t.doneLeft_=!0,new r.State(a.left,t.scope);if(!t.doneRight_)return t.doneRight_=!0,t.leftValue_=t.value,new r.State(a.right,t.scope);e.pop();var n,i=t.leftValue_,o=t.value;switch(a.operator){case"==":n=i==o;break;case"!=":n=i!=o;break;case"===":n=i===o;break;case"!==":n=i!==o;break;case">":n=i>o;break;case">=":n=i>=o;break;case"<":n=i>":n=i>>o;break;case">>>":n=i>>>o;break;case"in":if(!o||!o.isObject){let e=this.getErrorLineNumber(a);this.throwException(this.TYPE_ERROR,"'in' expects an object, not '"+o+"'",e)}n=this.hasProperty(o,i);break;case"instanceof":if(!this.isa(o,this.FUNCTION)){let e=this.getErrorLineNumber(a);this.throwException(this.TYPE_ERROR,"Right-hand side of instanceof is not an object",e)}n=!!i.isObject&&this.isa(i,o);break;default:throw SyntaxError("Unknown binary operator: "+a.operator)}e[e.length-1].value=n},r.prototype.stepBlockStatement=function(e,t,a){var n=t.n_||0,i=a.body[n];if(i)return t.n_=n+1,new r.State(i,t.scope);e.pop()},r.prototype.stepBreakStatement=function(e,t,a){var n=a.label&&a.label.name;this.unwind(r.Completion.BREAK,void 0,n)},r.prototype.stepCallExpression=function(e,t,a){if(!t.doneCallee_){t.doneCallee_=1;var i=new r.State(a.callee,t.scope);return i.components=!0,i}if(1===t.doneCallee_){t.doneCallee_=2;var o=t.value;if(Array.isArray(o)){if(t.func_=this.getValue(o,a),o[0]===r.SCOPE_REFERENCE?t.directEval_="eval"===o[1]:t.funcThis_=o[0],(o=t.func_)&&"object"==typeof o&&o.isGetter)return o.isGetter=!1,t.doneCallee_=1,this.createGetter_(o,t.value)}else t.func_=o;t.arguments_=[],t.n_=0}o=t.func_;if(!t.doneArgs_){if(0!==t.n_&&t.arguments_.push(t.value),a.arguments[t.n_])return new r.State(a.arguments[t.n_++],t.scope);if("NewExpression"===a.type){if(o.illegalConstructor){let e=this.getErrorLineNumber(a);this.throwException(this.TYPE_ERROR,o+" is not a constructor",e)}var s=o.properties.prototype;"object"==typeof s&&null!==s||(s=this.OBJECT_PROTO),t.funcThis_=this.createObjectProto(s),t.isConstructor=!0}else void 0===t.funcThis_&&(t.funcThis_=t.scope.strict?void 0:this.global);t.doneArgs_=!0}if(t.doneExec_)e.pop(),t.isConstructor&&"object"!=typeof t.value?e[e.length-1].value=t.funcThis_:e[e.length-1].value=t.value;else{if(t.doneExec_=!0,!o||!o.isObject){let e=this.getErrorLineNumber(a);this.throwException(this.TYPE_ERROR,o+" is not a function",e)}var l=o.node;if(l){for(var c=this.createScope(l.body,o.parentScope),u=0;uu?t.arguments_[u]:void 0;this.setProperty(c,m,h)}var p=this.createObjectProto(this.ARRAY_PROTO);for(u=0;u0)return e.ramUsage;const t=n.b[e.server];if(null==t)return 0;for(let a=0;a{m(e,0)},disabled:0===s,"aria-label":"first page"},"rtl"===t.direction?n.createElement(d.a,null):n.createElement(l.a,null)),n.createElement(o.a,{onClick:e=>{m(e,s-1)},disabled:0===s,"aria-label":"previous page"},"rtl"===t.direction?n.createElement(h.a,null):n.createElement(u.a,null)),n.createElement(o.a,{onClick:e=>{m(e,s+1)},disabled:s>=Math.ceil(a/c)-1,"aria-label":"next page"},"rtl"===t.direction?n.createElement(u.a,null):n.createElement(h.a,null)),n.createElement(o.a,{onClick:e=>{m(e,Math.max(0,Math.ceil(a/c)-1))},disabled:s>=Math.ceil(a/c)-1,"aria-label":"last page"},"rtl"===t.direction?n.createElement(l.a,null):n.createElement(d.a,null)))}},,function(e,t,a){"use strict";function n(e){function t(e,t,a){return e*t+a}const a=t(e,Math.log(51)-Math.log(50),Math.log(51));return t(500,Math.exp(a),-25e3)}function r(e){return-Math.log(25500/(e+25e3))/Math.log(1.02)}a.d(t,"a",(function(){return n})),a.d(t,"b",(function(){return r}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(263),r=a(20);class i extends n.a{constructor(e=null){super(e)}getActionTypeSkillSuccessBonus(e){return e.skillMultipliers.successChanceContract}toJSON(){return Object(r.b)("Contract",this)}static fromJSON(e){return Object(r.a)(i,e.data)}}r.c.constructors.Contract=i},function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));const n={helpList:["Use 'help [command]' to get more information about a particular Bladeburner console command.",""," automate [var] [val] [hi/low] Configure simple automation for Bladeburner tasks"," clear/cls Clear the console"," help [cmd] Display this help text, or help text for a specific command"," log [en/dis] [type] Enable or disable logging for events and actions"," skill [action] [name] Level or display info about your Bladeburner skills"," start [type] [name] Start a Bladeburner action/task"," stop Stops your current Bladeburner action/task"],automate:["automate [var] [val] [hi/low]","","A simple way to automate your Bladeburner actions. This console command can be used to automatically start an action when your stamina rises above a certain threshold, and automatically switch to another action when your stamina drops below another threshold."," automate status - Check the current status of your automation and get a brief description of what it'll do"," automate en - Enable the automation feature"," automate dis - Disable the automation feature","","There are four properties that must be set for this automation to work properly. Here is how to set them:",""," automate stamina 100 high"," automate contract Tracking high"," automate stamina 50 low"," automate general 'Field Analysis' low","","Using the four console commands above will set the automation to perform Tracking contracts if your stamina is 100 or higher, and then switch to Field Analysis if your stamina drops below 50. Note that when setting the action, the name of the action is CASE-SENSITIVE. It must exactly match whatever the name is in the UI."],clear:["clear","","Clears the console"],cls:["cls","","Clears the console"],help:["help [command]","","Running 'help' with no arguments displays the general help text, which lists all console commands and a brief description of what they do. A command can be specified to get more specific help text about that particular command. For example:",""," help automate","","will display specific information about using the automate console command"],log:["log [en/dis] [type]","","Enable or disable logging. By default, the results of completing actions such as contracts/operations are logged in the console. There are also random events that are logged in the console as well. The five categories of things that get logged are:","","[general, contracts, ops, blackops, events]","","The logging for these categories can be enabled or disabled like so:",""," log dis contracts - Disables logging that occurs when contracts are completed"," log en contracts - Enables logging that occurs when contracts are completed"," log dis events - Disables logging for Bladeburner random events","","Logging can be universally enabled/disabled using the 'all' keyword:",""," log dis all"," log en all"],skill:["skill [action] [name]","","Level or display information about your skills.","","To display information about all of your skills and your multipliers, use:",""," skill list","","To display information about a specific skill, specify the name of the skill afterwards. Note that the name of the skill is case-sensitive. Enter it exactly as seen in the UI. If the name of the skill has whitespace, enclose the name of the skill in double quotation marks:",""," skill list Reaper
skill list 'Digital Observer'","","This console command can also be used to level up skills:",""," skill level [skill name]"],start:["start [type] [name]","","Start an action. An action is specified by its type and its name. The name is case-sensitive. It must appear exactly as it does in the UI. If the name of the action has whitespace, enclose it in double quotation marks. Valid action types include:","","[general, contract, op, blackop]","","Examples:",""," start contract Tracking"," start op 'Undercover Operation'"],stop:["stop","","Stop your current action and go idle."]}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o})),a.d(t,"b",(function(){return s}));var n=a(309),r=a(3);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class o{constructor(e={cost:0,text:""}){if(i(this,"children",[]),i(this,"cost",0),i(this,"researched",!1),i(this,"parent",null),i(this,"text",""),null==n.a[e.text])throw new Error("Invalid Research name used when constructing ResearchTree Node: "+e.text);this.text=e.text,this.cost=e.cost,e.children&&e.children.length>0&&(this.children=e.children),null!=e.parent&&(this.parent=e.parent)}addChild(e){this.children.push(e),e.parent=this}createTreantMarkup(){const e=[];for(let t=0;t${this.text}
${r.a.format(this.cost,"0,0")} Scientific Research`+a.desc+"",text:{name:this.text}}}findNode(e){if(this.text===e)return this;let t=null;for(let a=0;ar.a.createElement(i.a,s({},e,{classes:{...l(),...e.classes}}))},,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(70);function r(e){if(null==e)return null;const t=e.nextPosition;return null==t?null:n.a[t]}},,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(293);function r(e){try{let t;t="string"==typeof e?Object(n.a)(e):e;const a=t.cloneNode(!0);return null!==t.parentNode&&t.parentNode.replaceChild(a,t),a}catch(e){return console.error(e),null}}},,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(18);function r(){const e=[];return{write:t=>(e.push(t),e.length>n.a.MaxPortCapacity?e.shift():null),tryWrite:t=>!(e.length>=n.a.MaxPortCapacity)&&(e.push(t),!0),read:()=>0===e.length?"NULL PORT DATA":e.shift(),peek:()=>{if(0===e.length)return"NULL PORT DATA";return e.slice()[0]},full:()=>e.length==n.a.MaxPortCapacity,empty:()=>0===e.length,clear:()=>{e.length=0}}}},,,function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(1529),o=a(9),s=a(54),l=a(111),c=a(348),u=a(1),m=a(264),h=a(99),p=a(4);function d(){const[e,t]=Object(n.useState)(!1),[a,d]=Object(n.useState)(!1);return Object(n.useEffect)(()=>{const e=setTimeout(()=>{a||t(!0)},2e3);return()=>clearTimeout(e)}),Object(n.useEffect)(()=>{!async function(){await Object(c.b)().then(e=>{m.a.load(e),d(!0)}).catch(e=>{console.error(e),m.a.load(""),d(!0)})}()},[]),a?r.a.createElement(h.a,{terminal:l.a,engine:m.a,player:u.a}):r.a.createElement(s.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(s.a,{item:!0},r.a.createElement(i.a,{size:150,color:"primary"})),r.a.createElement(s.a,{item:!0},r.a.createElement(o.a,{variant:"h3"},"Loading Bitburner v",p.a.Version)),e&&r.a.createElement(s.a,{item:!0},r.a.createElement(o.a,null,"If the game fails to load, consider ",r.a.createElement("a",{href:"?noScripts"},"killing all scripts"))))}},function(e,t,a){"use strict";function n(e){return"number"==typeof e&&!isNaN(e)}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(21);const r={Tracking:()=>Object(n.a)(5,75)/10,"Bounty Hunter":()=>Object(n.a)(5,75)/10,Retirement:()=>Object(n.a)(5,75)/10,Investigation:()=>Object(n.a)(10,40)/10,"Undercover Operation":()=>Object(n.a)(10,40)/10,"Sting Operation":()=>Object(n.a)(3,40)/10,Raid:()=>Object(n.a)(2,40)/10,"Stealth Retirement Operation":()=>Object(n.a)(1,20)/10,Assassination:()=>Object(n.a)(1,20)/10}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(84),r=a(56),i=a(20);class o{constructor(e="",t=0,a=0,i=n.a.LimitBuy,o=r.a.Long){let s=!1;if("number"==typeof t&&"number"==typeof a||(s=!0),(isNaN(t)||isNaN(a))&&(s=!0),"string"!=typeof e&&(s=!0),s)throw new Error("Invalid constructor paramters for Order");this.stockSymbol=e,this.shares=t,this.price=a,this.type=i,this.pos=o}toJSON(){return Object(i.b)("Order",this)}static fromJSON(e){return Object(i.a)(o,e.data)}}i.c.constructors.Order=o},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(8);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class i{constructor(e){r(this,"city",null),r(this,"costMult",0),r(this,"expMult",0),r(this,"name",n.a.Void),r(this,"types",[]),r(this,"techVendorMaxRam",0),r(this,"techVendorMinRam",0),e.city&&(this.city=e.city),e.costMult&&(this.costMult=e.costMult),e.expMult&&(this.expMult=e.expMult),e.infiltrationData&&(this.infiltrationData=e.infiltrationData),e.name&&(this.name=e.name),e.types&&(this.types=e.types),e.techVendorMaxRam&&(this.techVendorMaxRam=e.techVendorMaxRam),e.techVendorMinRam&&(this.techVendorMinRam=e.techVendorMinRam)}}},,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a.n(n);function i(e){let t="cmpy-mgmt-city-tab";return e.current&&(t+=" current"),r.a.createElement("button",{className:t,onClick:e.onClick},e.name)}},function(e,t,a){"use strict";function n(e){return null==e||e.options.length<=0||e.selectedIndex<0?"":e.options[e.selectedIndex].text}a.d(t,"a",(function(){return n}))},,,,,function(e,t,a){"use strict";a.d(t,"b",(function(){return l})),a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(32),o=a(101),s=a(94);const l={All:0,Foreign:1,Owned:2,Purchased:3};function c(e){function t(t){const a=t instanceof o.a&&t.purchasedByPlayer,n=e.serverType;switch(n){case l.All:return!0;case l.Foreign:return"home"!==t.hostname&&!a;case l.Owned:return a||t instanceof s.a||"home"===t.hostname;case l.Purchased:return a||t instanceof s.a;default:return console.warn("Invalid ServerType specified for ServerDropdown component: "+n),!1}}const a=[];for(const e in i.b){const n=i.b[e];t(n)&&a.push(r.a.createElement("option",{key:n.hostname,value:n.hostname},n.hostname))}return r.a.createElement("select",{className:"dropdown",onChange:e.onChange,style:e.style},a)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return v}));var n=a(0),r=a(1002),i=a(1005),o=a(1006),s=a(1007),l=a(1008),c=a(1010),u=a(513),m=a(1018),h=a(1019),p=a(45),d=a(18),f=a(55),g=a(38),y=a(26),b=a(1027),E=a(47);function v({loc:e}){const t=E.b.Router(),a=E.b.Player();const v=function(){const d=[];return e.types.includes(p.a.Company)&&d.push(n.createElement(r.a,{key:"companylocation",locName:e.name})),e.types.includes(p.a.Gym)&&d.push(n.createElement(i.a,{key:"gymlocation",router:t,loc:e,p:a})),e.types.includes(p.a.Hospital)&&d.push(n.createElement(o.a,{key:"hospitallocation",p:a})),e.types.includes(p.a.Slums)&&d.push(n.createElement(s.a,{key:"slumslocation"})),e.types.includes(p.a.Special)&&d.push(n.createElement(l.a,{key:"speciallocation",loc:e})),e.types.includes(p.a.TechVendor)&&d.push(n.createElement(c.a,{key:"techvendorlocation",loc:e,p:a})),e.types.includes(p.a.TravelAgency)&&d.push(n.createElement(u.a,{key:"travelagencylocation",p:a,router:t})),e.types.includes(p.a.University)&&d.push(n.createElement(m.a,{key:"universitylocation",loc:e})),e.types.includes(p.a.Casino)&&d.push(n.createElement(h.a,{key:"casinoLocation",p:a})),d}(),k=f.a.getIp(e.name),_=Object(g.b)(k),w=null!==_&&Object(g.d)(_);return n.createElement("div",null,n.createElement(y.a,{onClick:()=>t.toCity(),style:{display:"block"},text:"Return to World"}),n.createElement("h1",{className:"noselect"},w&&!d.a.DisableTextEffects?n.createElement(b.a,{content:e.name}):e.name),v)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(201);const o=({card:e,hidden:t})=>{let a;switch(e.suit){case i.b.Clubs:a=r.a.createElement("span",null,"♣");break;case i.b.Diamonds:a=r.a.createElement("span",null,"♦");break;case i.b.Hearts:a=r.a.createElement("span",null,"♥");break;case i.b.Spades:a=r.a.createElement("span",null,"♠");break;default:throw new Error("MissingCaseException: "+e.suit)}return r.a.createElement("div",{className:"casino-card "+(e.isRedSuit()?"red":"black")},r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"value"},t?" - ":e.formatValue()),r.a.createElement("div",{className:"suit"},t?" - ":a)))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(221),o=a(142);function s(){return(s=Object.assign||function(e){for(var t=1;tr.a.createElement(i.a,s({},e,{classes:{...l(),...e.classes}}))},,function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));const n=new class{constructor(){this.positions=new Map}saveCursor(e,t){this.positions.set(e,t)}getCursor(e){const t=this.positions.get(e);return t||{row:-1,column:-1}}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));const n="interface NS {\n args: string[];\n /**\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n */\n scan(ip: string, hostnames: boolean): string[];\n hack(ip: string, threads: number, stock: boolean): Promise;\n hackAnalyzeThreads(ip: string, hackAmount: number): number;\n hackAnalyzePercent(ip: string): number;\n hackChance(ip: string): number;\n sleep(time: number): Promise;\n grow(ip: string, threads: number, stock: boolean): Promise;\n growthAnalyze(ip: string, growth: number): number;\n weaken(ip: string, threads: boolean): Promise;\n print(...args: any[]): void;\n tprint(...args: any[]): void;\n clearLog(): void;\n disableLog(fn: string): void;\n enableLog(fn: string): void;\n isLogEnabled(fn: string): boolean;\n getScriptLogs(fn: string, ip: string, ...scriptArgs: any[]): string[];\n tail(fn: string, ip: string, ...scriptArgs: any[]): void;\n nuke(ip: string): boolean;\n brutessh(ip: string): boolean;\n ftpcrack(ip: string): boolean;\n relaysmtp(ip: string): boolean;\n httpworm(ip: string): boolean;\n sqlinject(ip: string): boolean;\n run(scriptname: string, threads: number): number;\n exec(scriptname: string, ip: string, threads: number): number;\n spawn(scriptname: string, threads: number): void;\n kill(filename: string, ip: string, ...scriptArgs: any[]): boolean;\n killall(ip: string): boolean;\n exit(): void;\n scp(scriptname: string, ip1: string, ip2: string): boolean;\n ls(ip: string, grep: string): string[];\n ps(ip: string): {filename: string, threads: number, args: string[], pid: number}[];\n hasRootAccess(ip: string): boolean;\n getIp(): string;\n getHostname(): string;\n getHackingLevel(): number;\n getHackingMultipliers(): number;\n getHacknetMultipliers(): number;\n getBitNodeMultipliers(): number;\n getServer(ip: string): any;\n getServerMoneyAvailable(ip: string): number;\n getServerSecurityLevel(ip: string): number;\n getServerBaseSecurityLevel(ip: string): number;\n getServerMinSecurityLevel(ip: string): number;\n getServerRequiredHackingLevel(ip: string): number;\n getServerMaxMoney(ip: string): number;\n getServerGrowth(ip: string): number;\n getServerNumPortsRequired(ip: string): number;\n getServerRam(ip: string): number[];\n getServerMaxRam(ip: string): number;\n getServerUsedRam(ip: string): number;\n serverExists(ip: string): boolean;\n fileExists(filename: string, ip: string): boolean;\n isRunning(fn: string, ip: string, ...scriptArgs: any[]): boolean;\n getStockSymbols(): string[];\n getStockPrice(symbol: string): number;\n getStockAskPrice(symbol: string): number;\n getStockBidPrice(symbol: string): number;\n getStockPosition(symbol: string): number;\n getStockMaxShares(symbol: string): number;\n getStockPurchaseCost(symbol: string, shares: number, posType: string): number;\n getStockSaleGain(symbol: string, shares: number, posType: string): number;\n buyStock(symbol: string, shares: number): number;\n sellStock(symbol: string, shares: number): number;\n shortStock(symbol: string, shares: number): number;\n sellShort(symbol: string, shares: number): number;\n placeOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean;\n cancelOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean;\n getOrders(): any;\n getStockVolatility(symbol: string): number;\n getStockForecast(symbol: string): number;\n getPurchasedServerLimit(): number;\n getPurchasedServerMaxRam(): number;\n getPurchasedServerCost(ram: number): number;\n purchaseServer(hostname: string, ram: number): string;\n deleteServer(hostname: string): boolean;\n getPurchasedServers(hostname: string): string[];\n write(port: number, data: string, mode: string): boolean;\n tryWrite(port: number, data: string): boolean;\n read(port: number): any;\n peek(port: number): any;\n clear(port: number): number;\n getPortHandle(port: number): any; // netscript port\n rm(fn: string, ip: string): boolean;\n scriptRunning(scriptname: string, ip: string): boolean;\n scriptKill(scriptname: string, ip: string): boolean;\n getScriptName(): string;\n getScriptRam(scriptname: string, ip: string): number;\n getRunningScript(fn: string, ip: string): any; // running script\n getHackTime(ip: string): number;\n getGrowTime(ip: string): number;\n getWeakenTime(ip: string): number;\n getScriptIncome(scriptname: string, ip: string): number;\n getScriptExpGain(scriptname: string, ip: string): number;\n nFormat(n: number, format: string): string;\n tFormat(milliseconds: number, milliPrecision: boolean): string;\n getTimeSinceLastAug(): number;\n prompt(txt: string): Promise;\n getFavorToDonate(): number;\n universityCourse(universityName: string, className: string): boolean;\n gymWorkout(gymName: string, stat: string): boolean;\n travelToCity(cityname: string): boolean;\n purchaseTor(): boolean;\n purchaseProgram(programName: string): boolean;\n getCurrentServer(): any; // server object\n connect(hostname: string): boolean;\n manualHack(): Promise;\n installBackdoor(): Promise;\n getStats(): any; // complex type\n getCharacterInformation(): any; // complex type\n getPlayer(): any; // complex type\n hospitalize(): number;\n isBusy(): boolean;\n stopAction(): boolean;\n upgradeHomeRam(): number;\n getUpgradeHomeRamCost(): number;\n workForCompany(companyName: string): boolean;\n applyToCompany(companyName: string, field: string): boolean;\n getCompanyRep(companyName: string): number;\n getCompanyFavor(companyName: string): number;\n getCompanyFavorGain(companyName: string): number;\n checkFactionInvitations(): string[];\n joinFaction(name: string): boolean;\n workForFaction(name: string, type: string): boolean;\n getFactionRep(name: string): number;\n getFactionFavor(name: string): number;\n getFactionFavorGain(name: string): number;\n donateToFaction(name: string, amt: number): boolean;\n createProgram(name: string): boolean;\n commitCrime(crimeRoughName: string): number;\n getCrimeChance(crimeRoughName: string): boolean;\n getCrimeStats(crimeRoughName: string): any; // complex type\n getOwnedAugmentations(purchased: boolean): string[];\n getOwnedSourceFiles(): any; // complex type\n getAugmentationsFromFaction(facname: string): string[];\n getAugmentationCost(name: string): number;\n getAugmentationPrereq(name: string): string[];\n getAugmentationPrice(name: string): number;\n getAugmentationRepReq(name: string): number;\n getAugmentationStats(name: string): any; // complex type\n purchaseAugmentation(faction: string, name: string): boolean;\n softReset(cbScript: string): void;\n installAugmentations(cbScript: string): void;\n exploit(): void;\n bypass(doc: any): void;\n flags(data: any): any;\n}"},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(24),r=a(38);function i(e,t){const a=t.augmentations.slice().filter(e=>"NeuroFlux Governor"!==e);for(const t of a)if(!e.augmentations.some(e=>e.name==t))return!1;return!0}const o=[{title:"Gain root access on CSEC",fulfilled:()=>{const e=Object(r.a)("CSEC");return!(!e||!e.hasOwnProperty("hasAdminRights"))&&e.hasAdminRights}},{title:"Install the backdoor on CSEC",fulfilled:()=>{const e=Object(r.a)("CSEC");return!(!e||!e.hasOwnProperty("backdoorInstalled"))&&e.backdoorInstalled}},{title:"Join the faction hinted at in csec-test.msg",fulfilled:e=>e.factions.includes("CyberSec")},{title:"Install all the Augmentations from CyberSec",fulfilled:e=>i(e,n.a.CyberSec)},{title:"Join the faction hinted at in nitesec-test.msg",fulfilled:e=>e.factions.includes("NiteSec")},{title:"Install all the Augmentations from NiteSec",fulfilled:e=>i(e,n.a.NiteSec)},{title:"Join the faction hinted at in j3.msg",fulfilled:e=>e.factions.includes("The Black Hand")},{title:"Install all the Augmentations from The Black Hand",fulfilled:e=>i(e,n.a["The Black Hand"])},{title:"Join the faction hinted at in 19dfj3l1nd.msg",fulfilled:e=>e.factions.includes("BitRunners")},{title:"Install all the Augmentations from BitRunners",fulfilled:e=>i(e,n.a.BitRunners)},{title:"Complete fl1ght.exe",fulfilled:e=>e.factions.includes("Daedalus")},{title:"Install the special Augmentation from Daedalus",fulfilled:e=>e.augmentations.some(e=>"The Red Pill"==e.name)},{title:"Install the final backdoor and free yourself.",fulfilled:()=>!1}]},,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(4);function r(e,t){return e/n.a.DonateMoneyToRepDivisor*t.faction_rep_mult}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(74);const r={longestName:0,longestSymbol:0};for(const e in n.a)r.longestName=Math.max(e.length,r.longestName),r.longestSymbol=Math.max(n.a[e].length,r.longestSymbol)},function(e,t,a){"use strict";a.d(t,"b",(function(){return i})),a.d(t,"a",(function(){return o}));var n=a(121);function r(e){return"string"==typeof e&&(!isNaN(e)&&!isNaN(parseFloat(e)))}function i(e){const t=(e=(e=e.trim()).replace(/\s\s+/g," ")).match(/(?:'[^']*'|"[^"]*"|[^;"])*/g);if(!t)return[];const a=t.map(n.h).map(e=>e.match(/(?:'[^']*'|"[^"]*"|[^;"])*/g)).flat(),r=[];for(const e of a)null!==e&&(e.match(/^\s*$/)||r.push(e.trim()));return r}function o(e){let t="";const a=[];let n=0,i=0,o="";for(;i=1&&(o=e.charAt(i-1),"\\"===o&&(s=!0));const l=e.charAt(i);if('"'===l)if(s||" "!==o)""===t?t='"':'"'===t&&(t="");else{const t=e.indexOf('"',i+1);if(-1!==t&&(t===e.length-1||" "===e.charAt(t+1))){a.push(e.substr(i+1,t-i-1)),n=i=t===e.length-1?t+1:t+2;continue}}else if("'"===l)if(s||" "!==o)""===t?t="'":"'"===t&&(t="");else{const t=e.indexOf("'",i+1);if(-1!==t&&(t===e.length-1||" "===e.charAt(t+1))){a.push(e.substr(i+1,t-i-1)),n=i=t===e.length-1?t+1:t+2;continue}}else if(" "===l&&""===t){const t=e.substr(n,i-n);r(t)?a.push(parseFloat(t)):a.push(t),n=i+1}++i}if(n!==i){const t=e.substr(n,i-n);r(t)?a.push(parseFloat(t)):a.push(t)}return a}},function(e,t,a){"use strict";a.d(t,"b",(function(){return n})),a.d(t,"a",(function(){return r}));const n=["Type 'help name' to learn more about the command ","",'alias [-g] [name="value"] Create or display Terminal aliases',"analyze Get information about the current machine ","backdoor Install a backdoor on the current machine ","buy [-l/program] Purchase a program through the Dark Web","cat [file] Display a .msg, .lit, or .txt file","cd [dir] Change to a new directory","check [script] [args...] Print a script's logs to Terminal","clear Clear all text on the terminal ","cls See 'clear' command ","connect [ip/hostname] Connects to a remote server","download [script/text file] Downloads scripts or text files to your computer","expr [math expression] Evaluate a mathematical expression","free Check the machine's memory (RAM) usage","hack Hack the current machine","help [command] Display this help text, or the help text for a command","home Connect to home computer","hostname Displays the hostname of the machine","ifconfig Displays the IP address of the machine","kill [script/pid] [args...] Stops the specified script on the current server ","killall Stops all running scripts on the current machine","ls [dir] [| grep pattern] Displays all files on the machine","lscpu Displays the number of CPU cores on the machine","mem [script] [-t] [n] Displays the amount of RAM required to run the script","mv [src] [dest] Move/rename a text or script file","nano [file] Text editor - Open up and edit a script or text file","ps Display all scripts that are currently running","rm [file] Delete a file from the server","run [name] [-t n] [--tail] [args...] Execute a program or script","scan Prints all immediately-available network connections","scan-analyze [d] [-a] Prints info for all servers up to d nodes away","scp [file] [server] Copies a file to a destination server","sudov Shows whether you have root access on this computer","tail [script] [args...] Displays dynamic logs for the specified script","top Displays all running scripts and their RAM usage","unalias [alias name] Deletes the specified alias","wget [url] [target file] Retrieves code/text from a web server"],r={alias:['alias [-g] [name="value"] '," ","Create or display aliases. An alias enables a replacement of a word with another string. ","It can be used to abbreviate a commonly used command, or commonly used parts of a command. The NAME ","of an alias defines the word that will be replaced, while the VALUE defines what it will be replaced by. For example, ","you could create the alias 'nuke' for the Terminal command 'run NUKE.exe' using the following: "," ",'alias nuke="run NUKE.exe"'," ","Then, to run the NUKE.exe program you would just have to enter 'nuke' in Terminal rather than the full command. ","It is important to note that 'default' aliases will only be substituted for the first word of a Terminal command. For ","example, if the following alias was set: "," ",'alias worm="HTTPWorm.exe"'," ","and then you tried to run the following terminal command: "," ","run worm"," ","This would fail because the worm alias is not the first word of a Terminal command. To allow an alias to be substituted ","anywhere in a Terminal command, rather than just the first word, you must set it to be a global alias using the -g flag: "," ",'alias -g worm="HTTPWorm.exe"'," ","Now, the 'worm' alias will be substituted anytime it shows up as an individual word in a Terminal command. "," ","Entering just the command 'alias' without any arguments prints the list of all defined aliases in the reusable form ","'alias NAME=VALUE' on the Terminal. "," ","The 'unalias' command can be used to remove aliases."," "],analyze:["analze"," ","Prints details and statistics about the current server. The information that is printed includes basic ","server details such as the hostname, whether the player has root access, what ports are opened/closed, and also ","hacking-related information such as an estimated chance to successfully hack, an estimate of how much money is ","available on the server, etc."],backdoor:["backdoor"," ","Install a backdoor on the current machine, grants a secret bonus depending on the machine."," ","Requires root access to run."," "],buy:["buy [-l / program]"," ","Purchase a program through the Dark Web. Requires a TOR router to use."," ","If this command is ran with the '-l' flag, it will display a list of all programs that can be bought through the ","dark web to the Terminal, as well as their costs."," ","Otherwise, the name of the program must be passed in as a parameter. This name is NOT case-sensitive."],cat:["cat [file]"," ","Display message (.msg), literature (.lit), or text (.txt) files. Examples:"," ","cat j1.msg"," ","cat foo.lit"," ","cat servers.txt"],cd:["cd [dir]"," ","Change to the specified directory. Note that this works even for directories that don't exist. If you ","change to a directory that does not exist, it will not be 'created'. Examples:"," ","cd scripts/hacking"," ","cd /logs"," ","cd ../"],check:["check [script name] [args...]"," ","Print the logs of the script specified by the script name and arguments to the Terminal. Each argument must be separated by ","a space. Remember that a running script is uniquely ","identified both by its name and the arguments that are used to start it. So, if a script was ran with the following arguments: "," ","run foo.script 1 2 foodnstuff"," ","Then to run the 'check' command on this script you would have to pass the same arguments in: "," ","check foo.script 1 2 foodnstuff"],clear:["clear"," ","Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up ","and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'cls' command"],cls:["cls"," ","Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up ","and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'clear' command"],connect:["connect [hostname/ip]"," ","Connect to a remote server. The hostname or IP address of the remote server must be given as the argument ","to this command. Note that only servers that are immediately adjacent to the current server in the network can be connected to. To ","see which servers can be connected to, use the 'scan' command."],download:["download [script/text file]"," ","Downloads a script or text file to your computer (like your real life computer)."," ","You can also download all of your scripts/text files as a zip file using the following Terminal commands:"," ","Download all scripts and text files: download *"," ","Download all scripts: download *.script"," ","Download all text files: download *.txt"," "],expr:["expr [mathematical expression]"," ","Evaluate a simple mathematical expression. Supports native JavaScript operators:"," ","+, -, /, *, **, %"," ","Example:"," ","expr 25 * 2 ** 10"," ","Note that letters (non-digits) are not allowed and will be removed from the input."],free:["free"," ","Display's the memory usage on the current machine. Print the amount of RAM that is available on the current server as well as ","how much of it is being used."],hack:["hack"," ","Attempt to hack the current server. Requires root access in order to be run. See the wiki page for hacking mechanics"," "],help:["help [command]"," ","Display Terminal help information. Without arguments, 'help' prints a list of all valid Terminal commands and a brief ","description of their functionality. You can also pass the name of a Terminal command as an argument to 'help' to print ","more detailed information about the Terminal command. Examples: "," ","help alias"," ","help scan-analyze"],home:["homeConnect to your home computer. This will work no matter what server you are currently connected to."],hostname:["hostname"," ","Prints the hostname of the current server"],ifconfig:["ipconfig"," ","Prints the IP address of the current server"],kill:["kill [script name] [args...]"," ","kill [pid]"," ","Kill the script specified by the script name and arguments OR by its PID."," ","If you are killing the script using its filename and arguments, then each ","argument must be separated by a space. Remember that a running script is ","uniquely identified by both its name and the arguments that are used to start ","it. So, if a script was ran with the following arguments:"," ","run foo.script 1 sigma-cosmetics"," ","Then to kill this script the same arguments would have to be used:"," ","kill foo.script 1 sigma-cosmetics"," ","If you are killing the script using its PID, then the PID argument must be numeric"],killall:["killall"," ","Kills all scripts on the current server. ","Note that after the 'kill' command is issued for a script, it may take a while for the script to actually stop running. ","This will happen if the script is in the middle of a command such as grow() or weaken() that takes time to execute. ","The script will not be stopped/killed until after that time has elapsed."],ls:["ls [dir] [| grep pattern]"," ","The ls command, with no arguments, prints all files and directories on the current server's directory to the Terminal screen. ","The files will be displayed in alphabetical order. "," ","The 'dir' optional parameter can be used to display files/directories in another directory."," ","The '| grep pattern' optional parameter can be used to only display files whose filenames match the specified pattern."," ","Examples:"," ","List all files with the '.script' extension in the current directory:"," ","ls | grep .script"," ","List all files with the '.js' extension in the root directory:"," ","ls / | grep .js"," ","List all files with the word 'purchase' in the filename, in the 'scripts' directory:"," ","ls scripts | grep purchase"],lscpu:["lscpu"," ","Prints the number of CPU Cores the current server has"],mem:["mem [script name] [-t num_threads]"," ","Displays the amount of RAM needed to run the specified script with a single thread. The command can also be used to print ","the amount of RAM needed to run a script with multiple threads using the '-t' flag. If the '-t' flag is specified, then ","an argument for the number of threads must be passed in afterwards. Examples:"," ","mem foo.script"," ","mem foo.script -t 50"," ","The first example above will print the amount of RAM needed to run 'foo.script' with a single thread. The second example ","above will print the amount of RAM needed to run 'foo.script' with 50 threads."],mv:["mv [src] [dest]"," ","Move the source file to the specified destination. This can also be used to rename files. ","This command only works for scripts and text files (.txt). This command CANNOT be used to ","convert to different file types"," ","Note that, unlike the Linux 'mv' command, the destination argument must be the ","full filepath. ","Examples: "," ","mv hacking-controller.script scripts/hacking-controller.script"," ","mv myScript.js myOldScript.js"],nano:["nano [file name]"," ","Opens up the specified file in the Text Editor. Only scripts (.script) or text files (.txt) can be ","edited using the Text Editor. If the file does not already exist, then a new, empty one ","will be created"],ps:["ps"," ","Prints all scripts that are running on the current server"],rm:["rm [file]"," ","Removes the specified file from the current server. A file can be a script, a program, or a message file. "," ","WARNING: This is permanent and cannot be undone"],run:["run [file name] [-t] [num threads] [args...]"," ","Execute a program or a script."," ","The '[-t]', '[num threads]', and '[args...]' arguments are only valid when running a script. The '-t' flag is used ","to indicate that the script should be run with the specified number of threads. If the flag is omitted, ","then the script will be run with a single thread by default. ","If the '-t' flag is used, then it MUST come immediately ","after the script name, and the [num threads] argument MUST come immediately afterwards. "," ","[args...] represents a variable number of arguments that will be passed into the script. See the documentation ","about script arguments. Each specified argument must be separated by a space. "," "],scan:["scan"," ","Prints all immediately-available network connection. This will print a list of all servers that you can currently connect ","to using the 'connect' Terminal command."],"scan-analyze":["scan-analyze [depth] [-a]"," ","Prints detailed information about all servers up to [depth] nodes away on the network. Calling ","'scan-analyze 1' will display information for the same servers that are shown by the 'scan' Terminal ","command. This command also shows the relative paths to reach each server."," ","By default, the maximum depth that can be specified for 'scan-analyze' is 3. However, once you have ","the DeepscanV1.exe and DeepscanV2.exe programs, you can execute 'scan-analyze' with a depth up to ","5 and 10, respectively."," ","The information 'scan-analyze' displays about each server includes whether or not you have root access to it, ","its required hacking level, the number of open ports required to run NUKE.exe on it, and how much RAM ","it has."," ","By default, this command will not display servers that you have purchased. However, you can pass in the ","-a flag at the end of the command if you would like to enable that."],scp:["scp [filename] [target server]"," ","Copies the specified file from the current server to the target server. ","This command only works for script files (.script extension), literature files (.lit extension), ","and text files (.txt extension). ","The second argument passed in must be the hostname or IP of the target server."],sudov:["sudov"," ","Prints whether or not you have root access to the current machine"],tail:["tail [script name] [args...]"," ","Displays dynamic logs for the script specified by the script name and arguments. Each argument must be separated ","by a space. Remember that a running script is uniquely identified by both its name and the arguments that were used ","to run it. So, if a script was ran with the following arguments: "," ","run foo.script 10 50000"," ","Then in order to check its logs with 'tail' the same arguments must be used: "," ","tail foo.script 10 50000"],top:["top"," ","Prints a list of all scripts running on the current server as well as their thread count and how much ","RAM they are using in total."],unalias:["unalias [alias name]"," ","Deletes the specified alias. Note that the double quotation marks are required. "," ","As an example, if an alias was declared using:"," ",'alias r="run"'," ","Then it could be removed using:"," ","unalias r"," ","It is not necessary to differentiate between global and non-global aliases when using 'unalias'"],wget:["wget [url] [target file]"," ","Retrieves data from a URL and downloads it to a file on the current server. The data can only ","be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists, ","it will be overwritten by this command."," ","Note that it will not be possible to download data from many websites because they do not allow ","cross-origin resource sharing (CORS). Example:"," ","wget https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md game_readme.txt"]}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return ne}));var n=a(267),r=a(94),i=a(58),o=a(83),s=a(268),l=a(89),c=a(4),u=a(32),m=a(98),h=a(423),p=a(35),d=a(38),f=a(630),g=a(55),y=a(18),b=a(143),E=a(85),v=a(3),k=a(14),_=a(1109),w=a(1110),C=a(1111),S=a(1112),x=a(1113),O=a(1114),T=a(1115),M=a(1116),P=a(1117),R=a(1120),A=a(1121),N=a(1122),I=a(1123),j=a(1124),F=a(1125),D=a(1126),B=a(1127),L=a(1128),G=a(1129),W=a(1130),H=a(1131),U=a(1132),q=a(1133),K=a(1134),$=a(1135),z=a(1136),Y=a(1139),V=a(1140),J=a(1141),Q=a(1142),X=a(1143),Z=a(1144),ee=a(1145),te=a(1146);function ae(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class ne{constructor(){ae(this,"action",null),ae(this,"commandHistory",[]),ae(this,"commandHistoryIndex",0),ae(this,"outputHistory",[new n.b("Bitburner v"+c.a.Version,"primary")]),ae(this,"contractOpen",!1),ae(this,"currDir","/")}process(e,t,a){null!==this.action&&(this.action.timeLeft-=c.a._idleSpeed*a/1e3,this.action.timeLeft<.01&&this.finishAction(e,t,!1),s.b.emit())}append(e){this.outputHistory.push(e),this.outputHistory.length>y.a.MaxTerminalCapacity&&this.outputHistory.slice(this.outputHistory.length-y.a.MaxTerminalCapacity),s.b.emit()}print(e){this.append(new n.b(e,"primary"))}error(e){this.append(new n.b(e,"error"))}startHack(e){this.startAction(Object(E.d)(e.getCurrentServer(),e)/4,"h")}startBackdoor(e){this.startAction(Object(E.d)(e.getCurrentServer(),e)/4,"b")}startAnalyze(){this.print("Analyzing system..."),this.startAction(1,"a")}startAction(e,t){this.action=new n.c(e,t)}finishHack(e,t,a=!1){if(a)return;const n=t.getCurrentServer(),r=Object(E.b)(n,t),i=Math.random(),o=Object(E.c)(n,t),s=o/4;if(i=n.getMaxNumTries()?(this.print("Contract FAILED - Contract is now self-destructing"),a.removeContract(n)):this.print(`Contract FAILED - ${n.getMaxNumTries()-n.tries} tries remaining`);break;case o.b.Cancelled:default:this.print("Contract cancelled")}this.contractOpen=!1}executeScanAnalyzeCommand(e,t=1,a=!1){this.print("~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~"),this.print(" ");const o={};for(const e in u.b)o[e]=0;const s=[],l=[0],c=e.getCurrentServer();for(s.push(c);0!=s.length;){const c=s.pop();if(!c)continue;const u=l.pop();if(void 0===u)continue;const m=c instanceof r.a;if(!a&&c.purchasedByPlayer&&"home"!=c.hostname)continue;if(o[c.ip]||u>t)continue;if(!a&&m)continue;o[c.ip]=1;for(let e=c.serversOnNetwork.length-1;e>=0;--e){const t=Object(d.c)(c,e);null!==t&&(s.push(t),l.push(u+1))}if(0==u)continue;const h=Array(4*(u-1)+1).join("-");e.hasProgram(i.a.AutoLink.name)?this.append(new n.a(h,c.hostname)):this.print(h+c.hostname);const p=h+"--";let f="NO";c.hasAdminRights&&(f="YES"),this.print(`${p}Root Access: ${f}${m?"":", Required hacking skill: "+c.requiredHackingSkill}`),c.hasOwnProperty("numOpenPortsRequired")&&this.print(p+"Number of open ports required to NUKE: "+c.numOpenPortsRequired),this.print(p+"RAM: "+v.a.formatRAM(c.maxRam)),this.print(" ")}}connectToServer(e,t){const a=Object(d.b)(t);null!=a?(e.getCurrentServer().isConnectedTo=!1,e.currentServer=a.ip,e.getCurrentServer().isConnectedTo=!0,this.print("Connected to "+a.hostname),this.setcwd("/"),"darkweb"==e.getCurrentServer().hostname&&Object(h.b)()):this.error("Invalid server. Connection failed.")}executeCommands(e,t,a){a=(a=a.trim()).replace(/\s\s+/g," "),this.commandHistory[this.commandHistory.length-1]!=a&&(this.commandHistory.push(a),this.commandHistory.length>50&&this.commandHistory.splice(0,1)),this.commandHistoryIndex=this.commandHistory.length;const n=Object(f.b)(a);for(let a=0;athis.clear(),clear:()=>this.clear(),connect:M.a,download:P.a,expr:R.a,free:A.a,hack:N.a,help:I.a,home:j.a,hostname:F.a,ifconfig:D.a,kill:B.a,killall:L.a,ls:G.a,lscpu:W.a,mem:H.a,mv:U.a,nano:q.a,ps:K.a,rm:$.a,run:z.a,scan:Y.a,"scan-analyze":V.a,scp:J.a,sudov:Q.a,tail:X.a,top:Z.a,unalias:ee.a,wget:te.a}[i.toLowerCase()];o?o(this,e,t,r,n.slice(1)):this.error(`Command ${n[0]} not found`)}getProgressText(){if(null===this.action)throw new Error("trying to get the progress text when there's no action");return Object(b.a)({progress:(this.action.time-this.action.timeLeft)/this.action.time,totalTicks:50})}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(21);function r(e){let t=e;return t.startsWith("[")&&(t=t.slice(1)),t.endsWith("]")&&(t=t.slice(0,-1)),t}function i(e){let t=e;return(t.startsWith('"')||t.startsWith("'"))&&(t=t.slice(1)),(t.endsWith('"')||t.endsWith("'"))&&(t=t.slice(0,-1)),t}function o(e){const t=[];return e.forEach(e=>{let a=e.toString();a=["[",a,"]"].join(""),t.push(a)}),t.join(",").replace(/\s/g,"")}const s=[{desc:e=>["A prime factor is a factor that is a prime number.",`What is the largest prime factor of ${e}?`].join(" "),difficulty:1,gen:()=>Object(n.a)(500,1e9),name:"Find Largest Prime Factor",numTries:10,solver:(e,t)=>{let a=2,n=e;for(;n>(a-1)*(a-1);){for(;n%a==0;)n=Math.round(n/a);++a}return(1===n?a-1:n)===parseInt(t,10)}},{desc:e=>["Given the following integer array, find the contiguous subarray","(containing at least one number) which has the largest sum and return that sum.","'Sum' refers to the sum of all the numbers in the subarray.\n",""+e.toString()].join(" "),difficulty:1,gen:()=>{const e=Object(n.a)(5,40),t=[];t.length=e;for(let a=0;a{const a=e.slice();for(let e=1;e["It is possible write four as a sum in exactly four different ways:\n\n","    3 + 1\n","    2 + 2\n","    2 + 1 + 1\n","    1 + 1 + 1 + 1\n\n",`How many different ways can the number ${e} be written as a sum of at least`,"two positive integers?"].join(" "),difficulty:1.5,gen:()=>Object(n.a)(8,100),name:"Total Ways to Sum",numTries:10,solver:(e,t)=>{const a=[1];a.length=e+1,a.fill(0,1);for(let t=1;t{let t=["Given the following array of array of numbers representing a 2D matrix,","return the elements of the matrix as an array in spiral order:\n\n"].join(" ");return t+="    [\n",t+=e.map(e=>"        ["+e.map(e=>(""+e).padStart(2," ")).join(",")+"]").join("\n"),t+="\n    ]\n",t+=["\nHere is an example of what spiral order should be:\n\n","    [\n","        [1, 2, 3]\n","        [4, 5, 6]\n","        [7, 8, 9]\n","    ]\n\n","Answer: [1, 2, 3, 6, 9, 8 ,7, 4, 5]\n\n","Note that the matrix will not always be square:\n\n","    [\n","        [1,  2,  3,  4]\n","        [5,  6,  7,  8]\n","        [9, 10, 11, 12]\n","    ]\n\n","Answer: [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]"].join(" "),t},difficulty:2,gen:()=>{const e=Object(n.a)(1,15),t=Object(n.a)(1,15),a=[];a.length=e;for(let n=0;n{const a=[];let n=0,i=e.length-1,o=0,s=e[0].length-1,l=0;for(;;){for(let t=o;t<=s;t++)a[l]=e[n][t],++l;if(++n>i)break;for(let t=n;t<=i;t++)a[l]=e[t][s],++l;if(--s=o;t--)a[l]=e[i][t],++l;if(--i=n;t--)a[l]=e[t][o],++l;if(++o>s)break}const c=r(t).replace(/\s/g,"").split(",");for(let e=0;e["You are given the following array of integers:\n\n",e+"\n\n","Each element in the array represents your MAXIMUM jump length","at that position. This means that if you are at position i and your","maximum jump length is n, you can jump to any position from","i to i+n.","\n\nAssuming you are initially positioned","at the start of the array, determine whether you are","able to reach the last index exactly.\n\n","Your answer should be submitted as 1 or 0, representing true and false respectively"].join(" "),difficulty:2.5,gen:()=>{const e=Object(n.a)(3,25),t=[];t.length=e;for(let e=0;e{const a=e.length;let n=0;for(let t=0;n["Given the following array of array of numbers representing a list of","intervals, merge all overlapping intervals.\n\n",`[${o(e)}]\n\n`,"Example:\n\n","[[1, 3], [8, 10], [2, 6], [10, 16]]\n\n","would merge into [[1, 6], [8, 16]].\n\n","The intervals must be returned in ASCENDING order.","You can assume that in an interval, the first number will always be","smaller than the second."].join(" "),difficulty:3,gen:()=>{const e=[],t=Object(n.a)(3,20);for(let a=0;a{const a=e.slice();a.sort((e,t)=>e[0]-t[0]);const n=[];let i=a[0][0],s=a[0][1];for(const e of a)e[0]<=s?s=Math.max(s,e[1]):(n.push([i,s]),i=e[0],s=e[1]);n.push([i,s]);const l=o(n),c=t.replace(/\s/g,"");return l===c||l===r(c)}},{desc:e=>["Given the following string containing only digits, return","an array with all possible valid IP address combinations","that can be created from the string:\n\n",e+"\n\n","Note that an octet cannot begin with a '0' unless the number","itself is actually 0. For example, '192.168.010.1' is not a valid IP.\n\n","Examples:\n\n","25525511135 -> [255.255.11.135, 255.255.111.35]\n","1938718066 -> [193.87.180.66]"].join(" "),difficulty:3,gen:()=>{let e="";for(let t=0;t<4;++t){e+=Object(n.a)(0,255).toString()}return e},name:"Generate IP Addresses",numTries:10,solver:(e,t)=>{const a=[];for(let t=1;t<=3;++t)for(let n=1;n<=3;++n)for(let r=1;r<=3;++r)for(let i=1;i<=3;++i)if(t+n+r+i===e.length){const o=parseInt(e.substring(0,t),10),s=parseInt(e.substring(t,t+n),10),l=parseInt(e.substring(t+n,t+n+r),10),c=parseInt(e.substring(t+n+r,t+n+r+i),10);if(o<=255&&s<=255&&l<=255&&c<=255){const t=[o.toString(),".",s.toString(),".",l.toString(),".",c.toString()].join("");t.length===e.length+3&&a.push(t)}}const n=r(t).replace(/\s/g,"").split(",");if(n.length!==a.length)return!1;for(const e of n)if(!a.includes(e))return!1;return!0}},{desc:e=>["You are given the following array of stock prices (which are numbers)","where the i-th element represents the stock price on day i:\n\n",e+"\n\n","Determine the maximum possible profit you can earn using at most","one transaction (i.e. you can only buy and sell the stock once). If no profit can be made","then the answer should be 0. Note","that you have to buy the stock before you can sell it"].join(" "),difficulty:1,gen:()=>{const e=Object(n.a)(3,50),t=[];t.length=e;for(let a=0;a{let a=0,n=0;for(let t=1;t["You are given the following array of stock prices (which are numbers)","where the i-th element represents the stock price on day i:\n\n",e+"\n\n","Determine the maximum possible profit you can earn using as many","transactions as you'd like. A transaction is defined as buying","and then selling one share of the stock. Note that you cannot","engage in multiple transactions at once. In other words, you","must sell the stock before you buy it again.\n\n","If no profit can be made, then the answer should be 0"].join(" "),difficulty:2,gen:()=>{const e=Object(n.a)(3,50),t=[];t.length=e;for(let a=0;a{let a=0;for(let t=1;t["You are given the following array of stock prices (which are numbers)","where the i-th element represents the stock price on day i:\n\n",e+"\n\n","Determine the maximum possible profit you can earn using at most","two transactions. A transaction is defined as buying","and then selling one share of the stock. Note that you cannot","engage in multiple transactions at once. In other words, you","must sell the stock before you buy it again.\n\n","If no profit can be made, then the answer should be 0"].join(" "),difficulty:5,gen:()=>{const e=Object(n.a)(3,50),t=[];t.length=e;for(let a=0;a{let a=Number.MIN_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER,r=0,i=0;for(const t of e)i=Math.max(i,n+t),n=Math.max(n,r-t),r=Math.max(r,a+t),a=Math.max(a,-1*t);return i.toString()===t}},{desc:e=>["You are given the following array with two elements:\n\n",`[${e[0]}, [${e[1]}]]\n\n`,"The first element is an integer k. The second element is an","array of stock prices (which are numbers) where the i-th element","represents the stock price on day i.\n\n","Determine the maximum possible profit you can earn using at most","k transactions. A transaction is defined as buying and then selling","one share of the stock. Note that you cannot engage in multiple","transactions at once. In other words, you must sell the stock before","you can buy it again.\n\n","If no profit can be made, then the answer should be 0."].join(" "),difficulty:8,gen:()=>{const e=Object(n.a)(2,10),t=Object(n.a)(3,50),a=[];a.length=t;for(let e=0;e{const a=e[0],n=e[1],r=n.length;if(r<2)return 0===parseInt(t);if(a>r/2){let e=0;for(let t=1;t0;--e)o[e]=Math.max(o[e],i[e]+s),i[e]=Math.max(i[e],o[e-1]-s)}return parseInt(t)===o[a]}},{desc:e=>{function t(e,a=0){const n=e.length;if(a>=n)return"";let r=[" ".repeat(n-a+1),"[",e[a].toString(),"]"].join("");return a 3 -> 5 -> 1)."].join(" ")},difficulty:5,gen:()=>{const e=[],t=Object(n.a)(3,12);e.length=t;for(let a=0;a{const a=e.length,n=e[a-1].slice();for(let t=a-2;t>-1;--t)for(let a=0;a{const t=e[0],a=e[1];return["You are in a grid with",`${t} rows and ${a} columns, and you are`,"positioned in the top-left corner of that grid. You are trying to","reach the bottom-right corner of the grid, but you can only","move down or right on each step. Determine how many","unique paths there are from start to finish.\n\n","NOTE: The data returned for this contract is an array","with the number of rows and columns:\n\n",`[${t}, ${a}]`].join(" ")},difficulty:3,gen:()=>[Object(n.a)(2,14),Object(n.a)(2,14)],name:"Unique Paths in a Grid I",numTries:10,solver:(e,t)=>{const a=e[0],n=e[1],r=[];r.length=a;for(let e=0;e{let t="";for(const a of e)t+=a.toString()+",\n";return["You are located in the top-left corner of the following grid:\n\n",t+"\n","You are trying reach the bottom-right corner of the grid, but you can only","move down or right on each step. Furthermore, there are obstacles on the grid","that you cannot move onto. These obstacles are denoted by '1', while empty","spaces are denoted by 0.\n\n","Determine how many unique paths there are from start to finish.\n\n","NOTE: The data returned for this contract is an 2D array of numbers representing the grid."].join(" ")},difficulty:5,gen:()=>{const e=Object(n.a)(2,12),t=Object(n.a)(2,12),a=[];a.length=e;for(let n=0;n{const a=[];a.length=e.length;for(let t=0;t0?a[e-1][t]:0)+(t>0?a[e][t-1]:0);return a[a.length-1][a[0].length-1]===parseInt(t)}},{desc:e=>["Given the following string:\n\n",e+"\n\n","remove the minimum number of invalid parentheses in order to validate","the string. If there are multiple minimal ways to validate the string,","provide all of the possible results. The answer should be provided","as an array of strings. If it is impossible to validate the string","the result should be an array with only an empty string.\n\n","IMPORTANT: The string may contain letters, not just parentheses.","Examples:\n",'"()())()" -> [()()(), (())()]\n','"(a)())()" -> [(a)()(), (a())()]\n','")( -> [""]'].join(" "),difficulty:10,gen:()=>{const e=Object(n.a)(6,20),t=[];t.length=e,Math.random()<.8?t[0]="(":t[0]=")";for(let a=1;a{let a=0,n=0;const i=[];for(let t=0;t0?--a:++n);!function e(t,a,n,r,i,o,s){if(i.length!==a)"("===i[a]?(n>0&&e(t,a+1,n-1,r,i,o,s),e(t+1,a+1,n,r,i,o+i[a],s)):")"===i[a]?(r>0&&e(t,a+1,n,r-1,i,o,s),t>0&&e(t-1,a+1,n,r,i,o+i[a],s)):e(t,a+1,n,r,i,o+i[a],s);else if(0===n&&0===r&&0===t){for(let e=0;e{const t=e[0],a=e[1];return["You are given the following string which contains only digits between 0 and 9:\n\n",t+"\n\n",`You are also given a target number of ${a}. Return all possible ways`,"you can add the +, -, and * operators to the string such that it evaluates","to the target number.\n\n","The provided answer should be an array of strings containing the valid expressions.","The data provided by this problem is an array with two elements. The first element","is the string of digits, while the second element is the target number:\n\n",`["${t}", ${a}]\n\n`,"NOTE: Numbers in the expression cannot have leading 0's. In other words,",'"1+01" is not a valid expression',"Examples:\n\n",'Input: digits = "123", target = 6\n',"Output: [1+2+3, 1*2*3]\n\n",'Input: digits = "105", target = 5\n',"Output: [1*0+5, 10-5]"].join(" ")},difficulty:10,gen:()=>{const e=Object(n.a)(4,12),t=[];t.length=e;for(let e=0;e{const a=e[0],n=e[1];const o=r(t).split(",");for(let e=0;e(document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)})),r.a.createElement("div",{className:"popup-box-content",id:e.id+"-content"},r.a.createElement(e.content,e.props))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(79),o=a(83),s=a(127);function l(e){const[t,a]=Object(n.useState)("");const l=o.d[e.c.type],c=[];for(const[t,a]of l.desc(e.c.data).split("\n").entries())c.push(r.a.createElement("span",{key:t,dangerouslySetInnerHTML:{__html:a+"
"}}));return r.a.createElement("div",null,r.a.createElement(s.b,{value:e.c.type,tag:s.a.Tag_h1}),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",null,"You are attempting to solve a Coding Contract. You have ",e.c.getMaxNumTries()-e.c.tries," tries remaining, after which the contract will self-destruct."),r.a.createElement("br",null),r.a.createElement("p",null,c),r.a.createElement("br",null),r.a.createElement("input",{className:"text-input",style:{width:"50%",marginTop:"8px"},autoFocus:!0,placeholder:"Enter Solution here",value:t,onChange:function(e){a(e.target.value)},onKeyDown:function(a){const n=a.target.value;a.keyCode===i.a.ENTER&&""!==n&&(a.preventDefault(),e.onAttempt(t))}}),r.a.createElement("button",{className:"std-button",onClick:()=>e.onAttempt(t)},"Solve"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));class n{constructor(e,t,a){var n,r,i;i="",(r="name")in(n=this)?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,this.name=e,this.create=t,this.run=a}htmlID(){return"create-program-"+(this.name.endsWith(".exe")?this.name.slice(0,-".exe".length):this.name)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(4),r=a(101),i=a(94),o=a(14),s=a(38),l=a(3),c=a(7),u=a(22),m=a(723),h=a(85);function p(e){return function(t){return t.hacking_skill>=e}}const d=[{key:"NukeProgram",name:"NUKE.exe",create:{level:1,tooltip:"This virus is used to gain root access to a machine if enough ports are opened.",req:p(1),time:n.a.MillisecondsPerFiveMinutes},run:(e,t,a,n)=>{if(n instanceof r.a){if(!n.hasAdminRights)return n.openPortCount>=a.getCurrentServer().numOpenPortsRequired?(n.hasAdminRights=!0,void t.print("NUKE successful! Gained root access to "+a.getCurrentServer().hostname)):void t.print("NUKE unsuccessful. Not enough ports have been opened");t.print("You already have root access to this computer. There is no reason to run NUKE.exe")}else t.error("Cannot nuke this kind of server.")}},{key:"BruteSSHProgram",name:"BruteSSH.exe",create:{level:50,tooltip:"This program executes a brute force attack that opens SSH ports",req:p(50),time:2*n.a.MillisecondsPerFiveMinutes},run:(e,t,a,n)=>{n instanceof r.a?n.sshPortOpen?t.print("SSH Port (22) is already open!"):(n.sshPortOpen=!0,t.print("Opened SSH Port(22)!"),n.openPortCount++):t.error("Cannot run BruteSSH.exe on this kind of server.")}},{key:"FTPCrackProgram",name:"FTPCrack.exe",create:{level:100,tooltip:"This program cracks open FTP ports",req:p(100),time:n.a.MillisecondsPerHalfHour},run:(e,t,a,n)=>{n instanceof r.a?n.ftpPortOpen?t.print("FTP Port (21) is already open!"):(n.ftpPortOpen=!0,t.print("Opened FTP Port (21)!"),n.openPortCount++):t.error("Cannot run FTPCrack.exe on this kind of server.")}},{key:"RelaySMTPProgram",name:"relaySMTP.exe",create:{level:250,tooltip:"This program opens SMTP ports by redirecting data",req:p(250),time:n.a.MillisecondsPer2Hours},run:(e,t,a,n)=>{n instanceof r.a?n.smtpPortOpen?t.print("SMTP Port (25) is already open!"):(n.smtpPortOpen=!0,t.print("Opened SMTP Port (25)!"),n.openPortCount++):t.error("Cannot run relaySMTP.exe on this kind of server.")}},{key:"HTTPWormProgram",name:"HTTPWorm.exe",create:{level:500,tooltip:"This virus opens up HTTP ports",req:p(500),time:n.a.MillisecondsPer4Hours},run:(e,t,a,n)=>{n instanceof r.a?n.httpPortOpen?t.print("HTTP Port (80) is already open!"):(n.httpPortOpen=!0,t.print("Opened HTTP Port (80)!"),n.openPortCount++):t.error("Cannot run HTTPWorm.exe on this kind of server.")}},{key:"SQLInjectProgram",name:"SQLInject.exe",create:{level:750,tooltip:"This virus opens SQL ports",req:p(750),time:n.a.MillisecondsPer8Hours},run:(e,t,a,n)=>{n instanceof r.a?n.sqlPortOpen?t.print("SQL Port (1433) is already open!"):(n.sqlPortOpen=!0,t.print("Opened SQL Port (1433)!"),n.openPortCount++):t.error("Cannot run SQLInject.exe on this kind of server.")}},{key:"DeepscanV1",name:"DeepscanV1.exe",create:{level:75,tooltip:"This program allows you to use the scan-analyze command with a depth up to 5",req:p(75),time:n.a.MillisecondsPerQuarterHour},run:(e,t)=>{t.print("This executable cannot be run."),t.print("DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5.")}},{key:"DeepscanV2",name:"DeepscanV2.exe",create:{level:400,tooltip:"This program allows you to use the scan-analyze command with a depth up to 10",req:p(400),time:n.a.MillisecondsPer2Hours},run:(e,t)=>{t.print("This executable cannot be run."),t.print("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10.")}},{key:"ServerProfiler",name:"ServerProfiler.exe",create:{level:75,tooltip:"This program is used to display hacking and Netscript-related information about servers",req:p(75),time:n.a.MillisecondsPerHalfHour},run:(e,t,a,n,r)=>{if(1!==r.length)return void t.print("Must pass a server hostname or IP as an argument for ServerProfiler.exe");const l=Object(s.b)(r[0]);null!=l?l instanceof i.a?t.print("ServerProfiler.exe cannot be run on a Hacknet Server."):(t.print(l.hostname+":"),t.print("Server base security level: "+l.baseDifficulty),t.print("Server current security level: "+l.hackDifficulty),t.print("Server growth rate: "+l.serverGrowth),t.print("Netscript hack() execution time: "+Object(o.b)(1e3*Object(h.d)(l,a),!0)),t.print("Netscript grow() execution time: "+Object(o.b)(1e3*Object(h.a)(l,a),!0)),t.print("Netscript weaken() execution time: "+Object(o.b)(1e3*Object(h.f)(l,a),!0))):t.print("Invalid server IP/hostname")}},{key:"AutoLink",name:"AutoLink.exe",create:{level:25,tooltip:"This program allows you to directly connect to other servers through the 'scan-analyze' command",req:p(25),time:n.a.MillisecondsPerQuarterHour},run:(e,t)=>{t.print("This executable cannot be run."),t.print("AutoLink.exe lets you automatically connect to other servers when using 'scan-analyze'."),t.print("When using scan-analyze, click on a server's hostname to connect to it.")}},{key:"BitFlume",name:"b1t_flum3.exe",create:{level:1,tooltip:"This program creates a portal to the BitNode Nexus (allows you to restart and switch BitNodes)",req:function(e){return e.sourceFiles.length>0&&e.hacking_skill>=1},time:n.a.MillisecondsPerFiveMinutes/20},run:(e,t,a)=>{Object(u.a)("bitflume-popup",m.a,{player:a,router:e,popupId:"bitflume-popup"})}},{key:"Flight",name:"fl1ght.exe",create:null,run:(e,t,a)=>{const n=Math.round(30*c.a.DaedalusAugsRequirement);if(!(a.augmentations.length>=n&&a.money.gt(1e11)&&a.hacking_skill>=2500))return t.print(`Augmentations: ${a.augmentations.length} / ${n}`),t.print(`Money: ${l.a.formatMoney(a.money.toNumber())} / $100b`),void t.print(`Hacking skill: ${a.hacking_skill} / 2500`);t.print("We will contact you."),t.print("-- Daedalus --")}}]},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function r(e){let t="";for(let a=0;a=r.length)&&(this.state=0),++this.state,this.state>=r.length&&(this.state=0)}toJSON(){return Object(n.b)("CorporationState",this)}static fromJSON(e){return Object(n.a)(i,e.data)}}n.c.constructors.CorporationState=i},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(124),r=a(49);const i={};!function(){let e,t,a;e="The Beginner's Guide to Hacking",t=r.a.HackersStartingHandbook,a="Some resources:

Learn to Program

For Experienced JavaScript Developers: NetscriptJS

Netscript Documentation

When starting out, hacking is the most profitable way to earn money and progress. This is a brief collection of tips/pointers on how to make the most out of your hacking scripts.

-hack() and grow() both work by percentages. hack() steals a certain percentage of the money on a server, and grow() increases the amount of money on a server by some percentage (multiplicatively)

-Because hack() and grow() work by percentages, they are more effective if the target server has a high amount of money. Therefore, you should try to increase the amount of money on a server (using grow()) to a certain amount before hacking it. Two import Netscript functions for this are getServerMoneyAvailable() and getServerMaxMoney()

-Keep security level low. Security level affects everything when hacking. Two important Netscript functions for this are getServerSecurityLevel() and getServerMinSecurityLevel()

-Purchase additional servers by visiting 'Alpha Enterprises' in the city. They are relatively cheap and give you valuable RAM to run more scripts early in the game

-Prioritize upgrading the RAM on your home computer. This can also be done at 'Alpha Enterprises'

-Many low level servers have free RAM. You can use this RAM to run your scripts. Use the scp Terminal or Netscript command to copy your scripts onto these servers and then run them.",i[t]=new n.a(e,t,a),e="The Complete Handbook for Creating a Successful Corporation",t=r.a.CorporationManagementHandbook,a="Getting Started with Corporations
To get started, visit the City Hall in Sector-12 in order to create a Corporation. This requires $150b of your own money, but this $150b will get put into your Corporation's funds. After creating your Corporation, you will see it listed as one of the locations in the city. Click on your Corporation in order to manage it.

Your Corporation can have many different divisions, each in a different Industry. There are many different types of Industries, each with different properties. To create your first division, click the 'Expand into new Industry' button at the top of the management UI. The Agriculture and Software industries are recommended for your first division.

The first thing you'll need to do is hire some employees. Employees can be assigned to five different positions. Each position has a different effect on various aspects of your Corporation. It is recommended to have at least one employee at each position.

Each industry uses some combination of Materials in order to produce other Materials and/or create Products. Specific information about this is displayed in each of your divisions' UI.

Products are special, industry-specific objects. They are different than Materials because you must manually choose to develop them, and you can choose to develop any number of Products. Developing a Product takes time, but a Product typically generates significantly more revenue than any Material. Not all industries allow you to create Products. To create a Product, look for a button in the top-left panel of the division UI (e.g. For the Software Industry, the button says 'Develop Software').

To get your supply chain system started, purchase the Materials that your industry needs to produce other Materials/Products. This can be done by clicking the 'Buy' button next to the corresponding Material(s). After you have the required Materials, you will immediately start production. The amount of Materials/Products you produce is based on a variety of factors, one of which is your employees and their productivity.

Once you start producing Materials/Products, you can sell them in order to start earning revenue. This can be done by clicking the 'Sell' button next to the corresponding Material or Product. The amount of Material/Product you sell is dependent on a wide variety of different factors.

These are the basics of getting your Corporation up and running! Now, you can start purchasing upgrades to improve your bottom line. If you need money, consider looking for seed investors, who will give you money in exchange for stock shares. Otherwise, once you feel you are ready, take your Corporation public! Once your Corporation goes public, you can no longer find investors. Instead, your Corporation will be publicly traded and its stock price will change based on how well it's performing financially. You can then sell your stock shares in order to make money.

Tips/Pointers
-The 'Smart Supply' upgrade is extremely useful. Consider purchasing it as soon as possible.

-Purchasing Hardware, Robots, AI Cores, and Real Estate can potentially increase your production. The effects of these depend on what industry you are in.

-In order to optimize your production, you will need a good balance of Operators, Managers, and Engineers

-Different employees excel in different jobs. For example, the highly intelligent employees will probably do best if they are assigned to do Engineering work or Research & Development.

-If your employees have low morale, energy, or happiness, their production will greatly suffer.

-Tech is important, but don't neglect sales! Having several Businessmen can boost your sales and your bottom line.

-Don't forget to advertise your company. You won't have any business if nobody knows you.

-Having company awareness is great, but what's really important is your company's popularity. Try to keep your popularity as high as possible to see the biggest benefit for your sales

-Remember, you need to spend money to make money!

-Corporations do not reset when installing Augmentations, but they do reset when destroying a BitNode",i[t]=new n.a(e,t,a),e="A Brief History of Synthoids",t=r.a.HistoryOfSynthoids,a="Synthetic androids, or Synthoids for short, are genetically engineered robots and, short of Augmentations, are composed entirely of organic substances. For this reason, Synthoids are virtually identical to humans in form, composition, and appearance.

Synthoids were first designed and manufactured by OmniTek Incorporated sometime around the middle of the century. Their original purpose was to be used for manual labor and as emergency responders for disasters. As such, they were initially programmed only for their specific tasks. Each iteration that followed improved upon the intelligence and capabilities of the Synthoids. By the 6th iteration, called MK-VI, the Synthoids were so smart and capable enough of making their own decisions that many argued OmniTek had created the first sentient AI. These MK-VI Synthoids were produced in mass quantities (estimates up to 50 billion) with the hopes of increasing society's productivity and bolstering the global economy. Stemming from humanity's desire for technological advancement, optimism and excitement about the future had never been higher.

All of that excitement and optimism quickly turned to fear, panic, and dread in 2070, when a terrorist group called Ascendis Totalis hacked into OmniTek and uploaded a rogue AI into severeal of their Synthoid manufacturing facilities. This hack went undetected and for months OmniTek unknowingly churned out legions of Synthoids embedded with this rogue AI. Then, on December 24th, 2070, Omnica activated dormant protocols in the rogue AI, causing all of the infected Synthoids to immediately launch a military campaign to seek and destroy all of humanity.

What ensued was the deadlist conflict in human history. This crisis, now commonly known as the Synthoid Uprising, resulted in almost ten billion deaths over the course of a year. Despite the nations of the world banding together to combat the threat, the MK-VI Synthoids were simply stronger, faster, more intelligent, and more adaptable than humans, outsmarting them at every turn.

It wasn't until the sacrifice of an elite international military taskforce, called the Bladeburners, that humanity was finally able to defeat the Synthoids. The Bladeburners' final act was a suicide bombing mission that destroyed a large portion of the MK-VI Synthoids, including many of its leaders. In the following weeks militaries from around the world were able to round up and shut down the remaining rogue MK-VI Synthoids, ending the Synthoid Uprising.

In the aftermath of the bloodshed, the Synthoid Accords were drawn up. These Accords banned OmniTek Incorporated from manufacturing any Synthoids beyond the MK-III series. They also banned any other corporation from constructing androids with advanced, near-sentient AI. MK-VI Synthoids that did not have the rogue Ascendis Totalis AI were allowed to continue their existence, but they were stripped of all rights and protections as they were not considered humans. They were also banned from doing anything that may pose a global security threat, such as working for any military/defense organization or conducting any bioengineering, computing, or robotics related research.

Unfortunately, many believe that not all of the rogue MK-VI Synthoids from the Uprising were found and destroyed, and that many of them are blending in as normal humans in society today. In response, many nations have created Bladeburner divisions, special military branches that are tasked with investigating and dealing with any Synthoid threads.

To this day, tensions still exist between the remaining Synthoids and humans as a result of the Uprising.

Nobody knows what happened to the terrorist group Ascendis Totalis.",i[t]=new n.a(e,t,a),e="A Green Tomorrow",t=r.a.AGreenTomorrow,a="Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to combat global warming and climate change. The shift towards renewable energy was a big success, or so it seemed. In 2045 a staggering 80% of the world's energy came from non-renewable fossil fuels. Now, about three decades later, that number is down to only 15%. Most of the world's energy now comes from nuclear power and renewable sources such as solar and geothermal energy. Unfortunately, these efforts were not the huge success that they seem to be.

Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and the rise of increasingly advanced (and power-hungry) technology that has become ubiquitous in our lives. So, despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, the total amount of energy we are producing from fossil fuels has actually increased.

The grim effects of our species' irresponsible use of energy and neglect of our mother world have become increasingly apparent. Last year a temperature of 190F was recorded in the Death Valley desert, which is over 50% higher than the highest recorded temperature at the beginning of the century. In the last two decades numerous major cities such as Manhattan, Boston, and Los Angeles have been partially or fully submerged by rising sea levels. In the present day, over 75% of the world's agriculture is done in climate-controlled vertical farms, as most traditional farmland has become unusable due to severe climate conditions.

Despite all of this, the greedy and corrupt corporations that rule the world have done nothing to address these problems that threaten our species. And so it's up to us, the common people. Each and every one of us can make a difference by doing what these corporations won't: taking responsibility. If we don't, pretty soon there won't be an Earth left to save. We are the last hope for a green tomorrow.",i[t]=new n.a(e,t,a),e="Alpha and Omega",t=r.a.AlphaOmega,a="Then we saw a new Heaven and a new Earth, for our first Heaven and Earth had gone away, and our sea was no more. And we saw a new holy city, new Aeria, coming down out of this new Heaven, prepared as a bride adorned for her husband. And we heard a loud voice saying, 'Behold, the new dwelling place of the Gods. We will dwell with them, and they will be our people, and we will be with them as their Gods. We will wipe away every tear from their eyes, and death shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things have passed away.'

And once we were seated on the throne we said 'Behold, I am making all things new.' Also we said, 'Write this down, for these words are trustworthy and true.' And we said to you, 'It is done! I am the Alpha and the Omega, the beginning and the end. To the thirsty I will give from the spring of the water of life without payment. The one who conquers will have this heritage, and we will be his God and he will be our son. But as for the cowardly, the faithless, the detestable, as for murderers, the sexually immoral, sorcerers, idolaters, and all liars, their portion will be in the lake that burns with fire and sulfur, for it is the second true death.'",i[t]=new n.a(e,t,a),e="Are We Living in a Computer Simulation?",t=r.a.SimulatedReality,a="The idea that we are living in a virtual world is not new. It's a trope that has been explored constantly in literature and pop culture. However, it is also a legitimate scientific hypothesis that many notable physicists and philosophers have debated for years.

Proponents for this simulated reality theory often point to how advanced our technology has become, as well as the incredibly fast pace at which it has advanced over the past decades. The amount of computing power available to us has increased over 100-fold since 2060 due to the development of nanoprocessors and quantum computers. Artifical Intelligence has advanced to the point where our entire lives are controlled by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. If we consider the pace at which this technology has advanced and assume that these developments continue, it's reasonable to assume that at some point in the future our technology would be advanced enough that we could create simulations that are indistinguishable from reality. However, if continued technological advancement is a reasonable outcome, then it is very likely that such a scenario has already happened.

Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species that already has such technology. Who's to say that they haven't already created such a virtual reality: our own?",i[t]=new n.a(e,t,a),e="Beyond Man",t=r.a.BeyondMan,a="Humanity entered a 'transhuman' era a long time ago. And despite the protests and criticisms of many who cried out against human augmentation at the time, the transhuman movement continued and prospered. Proponents of the movement ignored the critics, arguing that it was in our inherent nature to better ourselves. To improve. To be more than we were. They claimed that not doing so would be to go against every living organism's biological purpose: evolution and survival of the fittest.

And here we are today, with technology that is advanced enough to augment humans to a state that can only be described as posthuman. But what do we have to show for it when this augmentation technology is only available to the so-called 'elite'? Are we really better off than before when only 5% of the world's population has access to this technology? When the powerful corporations and organizations of the world keep it all to themselves, have we really evolved?

Augmentation technology has only further increased the divide between the rich and the poor, between the powerful and the oppressed. We have not become 'more than human'. We have not evolved from nature's original design. We are still the greedy, corrupted, and evil men that we always were.",i[t]=new n.a(e,t,a),e="Brighter than the Sun",t=r.a.BrighterThanTheSun,a="When people think about the corporations that dominate the East, they typically think of KuaiGong International, which holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.

TaiYang Digital is a Chinese internet-technology corporation that provides services such as online advertising, search engines, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word for 'sun'. In Chinese culture, the sun is a 'yang' symbol associated with life, heat, masculinity, and heaven.

The company was founded less than 5 years ago and is already the third highest valued company in all of Asia. In 2076 it generated a total revenue of over 10 trillion yuan. It's services are used daily by over a billion people worldwide.

TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is something you'd commonly see in the first half of the century, especially for tech companies. However in the last two decades the number of corporations has significantly declined as the largest entities quickly took over the economy. Corporations such as ECorp, MegaCorp, and KuaiGong have established such strong monopolies in their market sectors that they have effectively killed off all of the smaller and new corporations that have tried to start up over the years. This is what makes the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have a bright future ahead of them.",i[t]=new n.a(e,t,a),e="Democracy is Dead: The Fall of an Empire",t=r.a.DemocracyIsDead,a="They rose from the shadows in the street.
From the places where the oppressed meet.
Their cries echoed loudly through the air.
As they once did in Tiananmen Square.
Loudness in the silence, Darkness in the light.
They came forth with power and might.
Once the beacon of democracy, America was first.
Its pillars of society destroyed and dispersed.
Soon the cries rose everywhere, with revolt and riot.
Until one day, finally, all was quiet.
From the ashes rose a new order, corporatocracy was its name.
Rome, Mongol, Byzantine, all of history is just the same.
For man will never change in a fundamental way.
And now democracy is dead, in the USA.",i[t]=new n.a(e,t,a),e="Figures Show Rising Crime Rates in Sector-12",t=r.a.Sector12Crime,a="A recent study by analytics company Wilson Inc. shows a significant rise in criminal activity in Sector-12. Perhaps the most alarming part of the statistic is that most of the rise is in violent crime such as homicide and assault. According to the study, the city saw a total of 21,406 reported homicides in 2076, which is over a 20% increase compared to 2075.

CIA director David Glarow says its too early to know whether these figures indicate the beginning of a sustained increase in crime rates, or whether the year was just an unfortunate outlier. He states that many intelligence and law enforcement agents have noticed an increase in organized crime activites, and believes that these figures may be the result of an uprising from criminal organizations such as The Syndicate or the Slum Snakes.",i[t]=new n.a(e,t,a),e="Man and the Machine",t=r.a.ManAndMachine,a="In 2005 Ray Kurzweil popularized his theory of the Singularity. He predicted that the rate of technological advancement would continue to accelerate faster and faster until one day machines would be become infinitely more intelligent than humans. This point, called the Singularity, would result in a drastic transformation of the world as we know it. He predicted that the Singularity would arrive by 2045. And yet here we are, more than three decades later, where most would agree that we have not yet reached a point where computers and machines are vastly more intelligent than we are. So what gives?

The answer is that we have reached the Singularity, just not in the way we expected. The artifical superintelligence that was predicted by Kurzweil and others exists in the world today - in the form of Augmentations. Yes, those Augmentations that the rich and powerful keep to themselves enable humans to become superintelligent beings. The Singularity did not lead to a world where our machines are infinitely more intelligent than us, it led to a world where man and machine can merge to become something greater. Most of the world just doesn't know it yet.",i[t]=new n.a(e,t,a),e="Secret Societies",t=r.a.SecretSocieties,a="The idea of secret societies has long intrigued the general public by inspiring curiosity, fascination, and distrust. People have long wondered about who these secret society members are and what they do, with the most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world may never know for sure, it is likely that many secret societies do actually exist, even today.

However, the secret societies of the modern world are nothing like those that (supposedly) existed decades and centuries ago. The Freemasons, Knights Templar, and Illuminati, while they may have been around at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in our everyday lives and the fact that so much of the world is now digital has given rise to a new breed of secret societies: Internet-based ones.

Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's world. Some of these, such as The Black Hand, are black hat groups that claim they are trying to help the oppressed by attacking the elite and powerful. Others, such as NiteSec, are hacktivist groups that try to push political and social agendas. Perhaps the most intriguing hacker group is the mysterious Bitrunners, whose purpose still remains unknown.",i[t]=new n.a(e,t,a),e="Space: The Failed Frontier",t=r.a.TheFailedFrontier,a="Humans have long dreamed about spaceflight. With enduring interest, we were driven to explore the unknown and discover new worlds. We dreamed about conquering the stars. And in our quest, we pushed the boundaries of our scientific limits, and then pushed further. Space exploration lead to the development of many important technologies and new industries.

But sometime in the middle of the 21st century, all of that changed. Humanity lost its ambitions and aspirations of exploring the cosmos. The once-large funding for agencies like NASA and the European Space Agency gradually whittled away until their eventual disbanding in the 2060's. Not even militaries are fielding flights into space nowadays. The only remnants of the once great mission for cosmic conquest are the countless satellites in near-earth orbit, used for communications, espionage, and other corporate interests.

And as we continue to look at the state of space technology, it becomes more and more apparent that we will never return to that golden age of space exploration, that age where everyone dreamed of going beyond earth for the sake of discovery.",i[t]=new n.a(e,t,a),e="Coded Intelligence: Myth or Reality?",t=r.a.CodedIntelligence,a="Tremendous progress has been made in the field of Artificial Intelligence over the past few decades. Our autonomous vehicles and transporation systems. The electronic personal assistants that control our everyday lives. Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create human intelligence.

We've certainly come close to artificial intelligence that is similar to humans. For example OmniTek Incorporated's CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.

Many neuroscientists believe that we won't ever reach the point of creating artificial human intelligence. 'At the end of the the day, AI comes down to 1's and 0's, while the human brain does not. We'll never see AI that is identical to that of humans.'",i[t]=new n.a(e,t,a),e="Synthetic Muscles",t=r.a.SyntheticMuscles,a="Initial versions of synthetic muscles weren't made of anything organic but were actually crude devices made to mimic human muscle function. Some of the early iterations were actually made of common materials such as fishing lines and sewing threads due to their high strength for a cheap cost.

As technology progressed, however, advances in biomedical engineering paved the way for a new method of creating synthetic muscles. Instead of creating something that closely imitated the functionality of human muscle, scientists discovered a way of forcing the human body itself to augment its own muscle tissue using both synthetic and organic materials. This is typically done using gene therapy or chemical injections.",i[t]=new n.a(e,t,a),e="Tensions rise in global tech race",t=r.a.TensionsInTechRace,a="Have we entered a new Cold War? Is WWIII just beyond the horizon?

After rumors came out that OmniTek Incorporated had begun developing advanced robotic supersoldiers, geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. In a rare show of cooperation between corporations, MegaCorp and ECorp have reportedly launched hundreds of new surveillance and espionage satellites. Defense contractors such as DeltaOne and AeroCorp have been working with the CIA and NSA to prepare for conflict. Meanwhile, the rest of the world sits in earnest hoping that it never reaches full-scale war. With today's technology and firepower, a World War would assuredly mean the end of human civilization.",i[t]=new n.a(e,t,a),e="The Cost of Immortality",t=r.a.CostOfImmortality,a="Evolution and advances in medical and augmentation technology has lead to drastic improvements in human mortality rates. Recent figures show that the life expectancy for humans that live in a first-world country is about 130 years of age, almost double of what it was at the turn of the century. However, this increase in average lifespan has had some significant effects on society and culture.

Due to longer lifespans and a better quality of life, many adults are holding off on having kids until much later. As a result, the percentage of youth in first-world countries has been decreasing, while the number of senior citizens is significantly increasing.

Perhaps the most alarming result of all of this is the rapidly shrinking workforce. Despite the increase in life expectancy, the typical retirement age for workers in America has remained about the same, meaning a larger and larger percentage of people in America are retirees. Furthermore, many young adults are holding off on joining the workforce because they feel that they have plenty of time left in their lives for employment, and want to 'enjoy life while they're young.' For most industries, this shrinking workforce is not a major issue as most things are handled by robots anyways. However, there are still several key industries such as engineering and education that have not been automated, and these remain in danger to this cultural phenomenon.",i[t]=new n.a(e,t,a),e="The Hidden World",t=r.a.TheHiddenWorld,a="WAKE UP SHEEPLE

THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY

THE ILLUMINATI ARE THE SECRET RULERS OF THE WORLD!

Yes, the Illuminati of legends. The ancient secret society that controls the entire world from the shadows with their invisible hand. The group of the rich and wealthy that have penetrated every major government, financial agency, and corporation in the last three hundred years.

OPEN YOUR EYES

It was the Illuminati that brought an end to democracy in the world. They are the driving force behind everything that happens.

THEY ARE ALL AROUND YOU

After destabilizing the world's governments, they are now entering the final stage of their master plan. They will secretly initiate global crises. Terrorism. Pandemics. World War. And out of the chaos that ensues they will build their New World Order.",i[t]=new n.a(e,t,a),e="The New God",t=r.a.TheNewGod,a="Everyone has a moment in their life when they wonder about the bigger questions.

What's the point of all this? What is my purpose?

Some people dare to think even bigger.

What will the fate of the human race be?

We live in an era vastly different from that of 15 or even 20 years ago. We have gone beyond the limits of humanity. We have stripped ourselves of the tyranny of flesh.

The Singularity is here. The merging of man and machine. This is where humanity evolves into ",i[t]=new n.a(e,t,a),e="The New Triads",t=r.a.NewTriads,a="The Triads were an ancient transnational crime syndicate based in China, Hong Kong, and other Asian territories. They were often considered one of the first and biggest criminal secret societies. While most of the branches of the Triads have been destroyed over the past few decades, the crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. The most notable of these is the Tetrads.

It is widely believed that the Tetrads are a rogue group that splintered off from the Triads sometime in the mid 21st century. The founders of the Tetrads, all of whom were ex-Triad members, believed that the Triads were losing their purpose and direction. The Tetrads started off as a small group that mainly engaged in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the continent.

Not much else is known about the Tetrads, or about the efforts the Asian governments and corporations are making to take down this large new crime organization. Many believe that the Tetrads have infiltrated the governments and powerful corporations in Asia, which has helped faciliate their recent rapid rise.",i[t]=new n.a(e,t,a),e="The Secret War",t=r.a.TheSecretWar,a="",i[t]=new n.a(e,t,a)}()},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(727),r=a(728),i=a(1103),o=a(1104),s=a(1105),l=a(1108),c=a(316),u=a(23),m=a(319),h=a(20),p=a(82);function d(){this.hacking_skill=1,this.hp=10,this.max_hp=10,this.strength=1,this.defense=1,this.dexterity=1,this.agility=1,this.charisma=1,this.intelligence=0,this.hacking_chance_mult=1,this.hacking_speed_mult=1,this.hacking_money_mult=1,this.hacking_grow_mult=1,this.hacking_exp=0,this.strength_exp=0,this.defense_exp=0,this.dexterity_exp=0,this.agility_exp=0,this.charisma_exp=0,this.intelligence_exp=0,this.hacking_mult=1,this.strength_mult=1,this.defense_mult=1,this.dexterity_mult=1,this.agility_mult=1,this.charisma_mult=1,this.hacking_exp_mult=1,this.strength_exp_mult=1,this.defense_exp_mult=1,this.dexterity_exp_mult=1,this.agility_exp_mult=1,this.charisma_exp_mult=1,this.company_rep_mult=1,this.faction_rep_mult=1,this.money=new p.a(1e3),this.homeComputer="",this.city=u.a.Sector12,this.location="",this.jobs={},this.companyName="",this.currentServer="",this.purchasedServers=[],this.hacknetNodes=[],this.hashManager=new c.a,this.factions=[],this.factionInvitations=[],this.queuedAugmentations=[],this.augmentations=[],this.sourceFiles=[],this.numPeopleKilled=0,this.karma=0,this.crime_money_mult=1,this.crime_success_mult=1,this.isWorking=!1,this.focus=!1,this.workType="",this.currentWorkFactionName="",this.currentWorkFactionDescription="",this.workHackExpGainRate=0,this.workStrExpGainRate=0,this.workDefExpGainRate=0,this.workDexExpGainRate=0,this.workAgiExpGainRate=0,this.workChaExpGainRate=0,this.workRepGainRate=0,this.workMoneyGainRate=0,this.workMoneyLossRate=0,this.workHackExpGained=0,this.workStrExpGained=0,this.workDefExpGained=0,this.workDexExpGained=0,this.workAgiExpGained=0,this.workChaExpGained=0,this.workRepGained=0,this.workMoneyGained=0,this.createProgramName="",this.createProgramReqLvl=0,this.className="",this.crimeType="",this.timeWorked=0,this.timeWorkedCreateProgram=0,this.timeNeededToCompleteWork=0,this.work_money_mult=1,this.hacknet_node_money_mult=1,this.hacknet_node_purchase_cost_mult=1,this.hacknet_node_ram_cost_mult=1,this.hacknet_node_core_cost_mult=1,this.hacknet_node_level_cost_mult=1,this.hasWseAccount=!1,this.hasTixApiAccess=!1,this.has4SData=!1,this.has4SDataTixApi=!1,this.gang=null,this.corporation=null,this.bladeburner=null,this.bladeburner_max_stamina_mult=1,this.bladeburner_stamina_gain_mult=1,this.bladeburner_analysis_mult=1,this.bladeburner_success_chance_mult=1,this.sleeves=[],this.resleeves=[],this.sleevesFromCovenant=0,this.bitNodeN=1,this.firstFacInvRecvd=!1,this.firstAugPurchased=!1,this.firstTimeTraveled=!1,this.firstProgramAvailable=!1,this.lastUpdate=0,this.totalPlaytime=0,this.playtimeSinceLastAug=0,this.playtimeSinceLastBitnode=0,this.moneySourceA=new m.a,this.moneySourceB=new m.a,this.scriptProdSinceLastAug=0,this.exploits=[]}Object.assign(d.prototype,s,l,r,i,o,n),d.prototype.toJSON=function(){return Object(h.b)("PlayerObject",this)},d.fromJSON=function(e){return Object(h.a)(d,e.data)},h.c.constructors.PlayerObject=d},function(e,t,a){"use strict";a.r(t),a.d(t,"hasAugmentation",(function(){return r}));var n=a(29);function r(e){const t=e instanceof n.a?e.name:e;for(const e of this.augmentations)if(e.name===t)return!0;for(const e of this.queuedAugmentations)if(e.name===t)return!0;return!1}},function(e,t,a){"use strict";a.r(t),a.d(t,"canAccessBladeburner",(function(){return i})),a.d(t,"inBladeburner",(function(){return o})),a.d(t,"startBladeburner",(function(){return s}));var n=a(183),r=a(53);function i(){return 8!==this.bitNodeN&&(6===this.bitNodeN||7===this.bitNodeN||r.a[6]>0||r.a[7]>0)}function o(){return null!=this.bladeburner&&this.bladeburner instanceof n.a}function s(){this.bladeburner=new n.a(this)}},function(e,t,a){"use strict";function n(e){for(const t in e)e.hasOwnProperty(t)&&delete e[t]}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return C}));var n=a(25),r=a(8);const i={},o={},s={},l={},c={},u={},m={},h={},p={},d={},f={},g={},y={},b={},E={},v={},k={},_={},w={};n.j.forEach(e=>{i[e]=!0,c[e]=!0}),n.d.forEach(e=>{o[e]=!0,c[e]=!0}),n.f.forEach(e=>{s[e]=!0,c[e]=!0}),c[n.i[0]]=!0,l[n.i[0]]=!0,n.b.forEach(e=>{u[e]=!0}),n.h.forEach(e=>{h[e]=!0}),n.a.forEach(e=>{m[e]=!0}),n.k.forEach(e=>{p[e]=!0}),n.c.forEach(e=>{d[e]=!0});for(let e=0;e{t.innerText="",t.style.display="none",t.classList.remove("status-text")},3e3)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(23),r=a(8),i=a(45);const o=[{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:12,startingSecurityLevel:8.18},name:r.a.AevumAeroCorp,types:[i.a.Company]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:15,startingSecurityLevel:8.19},name:r.a.AevumBachmanAndAssociates,types:[i.a.Company]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:18,startingSecurityLevel:9.55},name:r.a.AevumClarkeIncorporated,types:[i.a.Company]},{city:n.a.Aevum,costMult:3,expMult:2,name:r.a.AevumCrushFitnessGym,types:[i.a.Gym]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:37,startingSecurityLevel:17.02},name:r.a.AevumECorp,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:512,techVendorMinRam:128},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:15.54},name:r.a.AevumFulcrumTechnologies,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:1024,techVendorMinRam:256},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:12,startingSecurityLevel:7.89},name:r.a.AevumGalacticCybersystems,types:[i.a.Company]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:6,startingSecurityLevel:3.29},name:r.a.AevumNetLinkTechnologies,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:64,techVendorMinRam:8},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:6,startingSecurityLevel:5.35},name:r.a.AevumPolice,types:[i.a.Company]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:5,startingSecurityLevel:5.02},name:r.a.AevumRhoConstruction,types:[i.a.Company]},{city:n.a.Aevum,costMult:10,expMult:5,name:r.a.AevumSnapFitnessGym,types:[i.a.Gym]},{city:n.a.Aevum,costMult:4,expMult:3,name:r.a.AevumSummitUniversity,types:[i.a.University]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:7,startingSecurityLevel:5.85},name:r.a.AevumWatchdogSecurity,types:[i.a.Company]},{city:n.a.Aevum,name:r.a.AevumCasino,types:[i.a.Casino]},{city:n.a.Chongqing,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:16.25},name:r.a.ChongqingKuaiGongInternational,types:[i.a.Company]},{city:n.a.Chongqing,infiltrationData:{maxClearanceLevel:18,startingSecurityLevel:12.59},name:r.a.ChongqingSolarisSpaceSystems,types:[i.a.Company]},{city:n.a.Ishima,infiltrationData:{maxClearanceLevel:12,startingSecurityLevel:5.02},name:r.a.IshimaNovaMedical,types:[i.a.Company]},{city:n.a.Ishima,infiltrationData:{maxClearanceLevel:10,startingSecurityLevel:3.2},name:r.a.IshimaOmegaSoftware,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:128,techVendorMinRam:4},{city:n.a.Ishima,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:5.38},name:r.a.IshimaStormTechnologies,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:512,techVendorMinRam:32},{city:n.a.NewTokyo,infiltrationData:{maxClearanceLevel:17,startingSecurityLevel:7.18},name:r.a.NewTokyoDefComm,types:[i.a.Company]},{city:n.a.NewTokyo,infiltrationData:{maxClearanceLevel:20,startingSecurityLevel:5.9},name:r.a.NewTokyoGlobalPharmaceuticals,types:[i.a.Company]},{city:n.a.NewTokyo,infiltrationData:{maxClearanceLevel:5,startingSecurityLevel:2.5},name:r.a.NewTokyoNoodleBar,types:[i.a.Company,i.a.Special]},{city:n.a.NewTokyo,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:5.52},name:r.a.NewTokyoVitaLife,types:[i.a.Company,i.a.Special]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:10,startingSecurityLevel:3.62},name:r.a.Sector12AlphaEnterprises,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:8,techVendorMinRam:2},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:10.59},name:r.a.Sector12BladeIndustries,types:[i.a.Company]},{city:n.a.Sector12,name:r.a.Sector12CIA,types:[i.a.Company]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:15,startingSecurityLevel:4.66},name:r.a.Sector12CarmichaelSecurity,types:[i.a.Company]},{city:n.a.Sector12,name:r.a.Sector12CityHall,types:[i.a.Special]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:12,startingSecurityLevel:5.9},name:r.a.Sector12DeltaOne,types:[i.a.Company]},{city:n.a.Sector12,name:r.a.Sector12FoodNStuff,types:[i.a.Company]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:8.18},name:r.a.Sector12FourSigma,types:[i.a.Company]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:17,startingSecurityLevel:6.02},name:r.a.Sector12IcarusMicrosystems,types:[i.a.Company]},{city:n.a.Sector12,expMult:1,costMult:1,name:r.a.Sector12IronGym,types:[i.a.Gym]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:5,startingSecurityLevel:3.13},name:r.a.Sector12JoesGuns,types:[i.a.Company]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:31,startingSecurityLevel:16.36},name:r.a.Sector12MegaCorp,types:[i.a.Company]},{city:n.a.Sector12,name:r.a.Sector12NSA,types:[i.a.Company,i.a.Special]},{city:n.a.Sector12,costMult:20,expMult:10,name:r.a.Sector12PowerhouseGym,types:[i.a.Gym]},{city:n.a.Sector12,costMult:3,expMult:2,name:r.a.Sector12RothmanUniversity,types:[i.a.University]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:12,startingSecurityLevel:5.9},name:r.a.Sector12UniversalEnergy,types:[i.a.Company]},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:15,startingSecurityLevel:3.59},name:r.a.VolhavenCompuTek,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:256,techVendorMinRam:8},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:18,startingSecurityLevel:7.28},name:r.a.VolhavenHeliosLabs,types:[i.a.Company]},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:15,startingSecurityLevel:4.35},name:r.a.VolhavenLexoCorp,types:[i.a.Company]},{city:n.a.Volhaven,costMult:7,expMult:4,name:r.a.VolhavenMilleniumFitnessGym,types:[i.a.Gym]},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:50,startingSecurityLevel:8.53},name:r.a.VolhavenNWO,types:[i.a.Company]},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:7.74},name:r.a.VolhavenOmniTekIncorporated,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:1024,techVendorMinRam:128},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:22,startingSecurityLevel:6},name:r.a.VolhavenOmniaCybersystems,types:[i.a.Company]},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:18,startingSecurityLevel:4.77},name:r.a.VolhavenSysCoreSecurities,types:[i.a.Company]},{city:n.a.Volhaven,costMult:5,expMult:4,name:r.a.VolhavenZBInstituteOfTechnology,types:[i.a.University]},{city:null,name:r.a.Hospital,types:[i.a.Hospital]},{city:null,name:r.a.Slums,types:[i.a.Slums]},{city:null,name:r.a.TravelAgency,types:[i.a.TravelAgency]},{city:null,name:r.a.WorldStockExchange,types:[i.a.StockMarket]}]},function(e,t,a){"use strict";a.d(t,"a",(function(){return A}));var n=a(0),r=a.n(n),i=a(221),o=a(9),s=a(116),l=a(37),c=a(753),u=a.n(c),m=a(752),h=a.n(m),p=a(312),d=a(127),f=a(63),g=a(426),y=a.n(g),b=a(286),E=a.n(b),v=a(427),k=a.n(v),_=a(485),w=a.n(_),C=a(484),S=a.n(C),x=a(486),O=a.n(x),T=a(142),M=a(277),P=a(35);const R=Object(T.a)(e=>Object(M.a)({textfield:{borderBottom:"1px solid "+e.palette.primary.main},code:{whiteSpace:"pre",backgroundColor:e.palette.background.paper}}));function A(){const e=R(),t={[P.f.Start]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Welcome to Bitburner, a cyberpunk-themed incremental RPG! The game takes place in a dark, dystopian future... The year is 2077...",r.a.createElement("br",null),r.a.createElement("br",null),"This tutorial will show you the basics of the game. You may skip the tutorial at any time.")),canNext:!0},[P.f.GoToCharacterPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Let's start by heading to the Stats page. Click"),r.a.createElement(f.a,null,r.a.createElement(y.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Stats")),r.a.createElement(o.a,null,"on the main navigation menu (left-hand side of the screen)")),canNext:!1},[P.f.CharacterPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,null,r.a.createElement(y.a,{color:"primary"}),r.a.createElement(o.a,{color:"primary"},"Stats")),r.a.createElement(o.a,null,"shows a lot of important information about your progress, such as your skills, money, and bonuses.")),canNext:!0},[P.f.CharacterGoToTerminalPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Let's head to your computer's terminal by clicking"),r.a.createElement(f.a,null,r.a.createElement(E.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Terminal")),r.a.createElement(o.a,null,"on the main navigation menu.")),canNext:!1},[P.f.TerminalIntro]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,null,r.a.createElement(E.a,{color:"primary"}),r.a.createElement(o.a,{color:"primary"},"Terminal")),r.a.createElement(o.a,null,"is used to interface with your home computer as well as all of the other machines around the world.")),canNext:!0},[P.f.TerminalHelp]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Let's try it out. Start by entering"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> help"),r.a.createElement(o.a,null,"(Don't forget to press Enter after typing the command)")),canNext:!1},[P.f.TerminalLs]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> help"),r.a.createElement(o.a,null,"displays a list of all available Terminal commands, how to use them, and a description of what they do."," ",r.a.createElement("br",null),r.a.createElement("br",null),"Let's try another command. Enter"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> ls")),canNext:!1},[P.f.TerminalScan]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> ls"),r.a.createElement(o.a,null," ","is a basic command that shows files on the computer. Right now, it shows that you have a program called"," ","NUKE.exe on your computer. We'll get to what this does later. ",r.a.createElement("br",null),r.a.createElement("br",null),"Using your home computer's terminal, you can connect to other machines throughout the world. Let's do that now by first entering"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan")),canNext:!1},[P.f.TerminalScanAnalyze1]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan"),r.a.createElement(o.a,null,"shows all available network connections. In other words, it displays a list of all servers that can be connected to from your current machine. A server is identified by its hostname. ",r.a.createElement("br",null),r.a.createElement("br",null),"That's great and all, but there's so many servers. Which one should you go to?"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan-analyze"),r.a.createElement(o.a,null,"gives some more detailed information about servers on the network. Try it now!")),canNext:!1},[P.f.TerminalScanAnalyze2]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan-analyze"),r.a.createElement(o.a,null,"shows more detailed information about each server that you can connect to (servers that are a distance of one node away). ",r.a.createElement("br",null),r.a.createElement("br",null)," It is also possible to run scan-analyze with a higher depth. Let's try a depth of two with the following command:"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan-analyze 2")),canNext:!1},[P.f.TerminalConnect]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Now you can see information about all servers that are up to two nodes away, as well as figure out how to navigate to those servers through the network. You can only connect to a server that is one node away. To connect to a machine, use"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> connect hostname"),r.a.createElement(o.a,null,"From the results of "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan-analyze 2"),r.a.createElement(o.a,null," ","we can see that the n00dles server is only one node away. Let's connect so it now using:"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> connect n00dles")),canNext:!1},[P.f.TerminalAnalyze]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"You are now connected to another machine! What can you do now? You can hack it!",r.a.createElement("br",null),r.a.createElement("br",null)," In the year 2077, currency has become digital and decentralized. People and corporations store their money on servers and computers. Using your hacking abilities, you can hack servers to steal money and gain experience. ",r.a.createElement("br",null),r.a.createElement("br",null),"Before you try to hack a server, you should run diagnostics using"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[n00dles ~/]> analyze")),canNext:!1},[P.f.TerminalNuke]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"When "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[n00dles ~/]> analyze"),r.a.createElement(o.a,null,"finishes running it will show useful information about hacking the server. ",r.a.createElement("br",null),r.a.createElement("br",null)," For this server, the required hacking skill is only 1, which means you can hack it right now. However, in order to hack a server you must first gain root access. The NUKE.exe program that we saw earlier on your home computer is a virus that will grant you root access to a machine if there are enough open ports."),r.a.createElement(o.a,{classes:{root:e.textfield}},"[n00dles ~/]> analyze"),r.a.createElement(o.a,null," ","shows that there do not need to be any open ports on this machine for the NUKE virus to work, so go ahead and run the virus using"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[n00dles ~/]> run NUKE.exe"),r.a.createElement(o.a,null)),canNext:!0},[P.f.TerminalManualHack]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"You now have root access! You can hack the server using "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> hack"),r.a.createElement(o.a,null," Try doing that now.")),canNext:!0},[P.f.TerminalHackingMechanics]:{content:r.a.createElement(o.a,null,"You are now attempting to hack the server. Performing a hack takes time and only has a certain percentage chance of success. This time and success chance is determined by a variety of factors, including your hacking skill and the server's security level.",r.a.createElement("br",null),r.a.createElement("br",null),"If your attempt to hack the server is successful, you will steal a certain percentage of the server's total money. This percentage is affected by your hacking skill and the server's security level.",r.a.createElement("br",null),r.a.createElement("br",null),"The amount of money on a server is not limitless. So, if you constantly hack a server and deplete its money, then you will encounter diminishing returns in your hacking."),canNext:!0},[P.f.TerminalGoHome]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"From any server you can get back home using"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> home"),r.a.createElement(o.a,null,"Let's head home before creating our first script!")),canNext:!0},[P.f.TerminalCreateScript]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Hacking is the core mechanic of the game and is necessary for progressing. However, you don't want to be hacking manually the entire time. You can automate your hacking by writing scripts!",r.a.createElement("br",null),r.a.createElement("br",null),"To create a new script or edit an existing one, you can use"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> nano"),r.a.createElement(o.a,null,"Scripts must end with the .script extension. Let's make a script now by entering "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> nano n00dles.script"),r.a.createElement(o.a,null,"after the hack command finishes running (Sidenote: Pressing ctrl + c will end a command like hack early)")),canNext:!1},[P.f.TerminalTypeScript]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"This is the script editor. You can use it to program your scripts. Scripts are written in a simplified version of javascript. Copy and paste the following code into the script editor: ",r.a.createElement("br",null)),r.a.createElement(o.a,{classes:{root:e.code}},r.a.createElement(d.b,{value:"while(true) {\n hack('n00dles');\n}"})),r.a.createElement(o.a,null,"For anyone with basic programming experience, this code should be straightforward. This script will continuously hack the n00dles server.",r.a.createElement("br",null),r.a.createElement("br",null),"To save and close the script editor, press the button in the bottom left, or press ctrl + b.")),canNext:!1},[P.f.TerminalFree]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Now we'll run the script. Scripts require a certain amount of RAM to run, and can be run on any machine which you have root access to. Different servers have different amounts of RAM. You can also purchase more RAM for your home server.",r.a.createElement("br",null),r.a.createElement("br",null),"To check how much RAM is available on this machine, enter"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> free")),canNext:!1},[P.f.TerminalRunScript]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"We have 8GB of free RAM on this machine, which is enough to run our script. Let's run our script using"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> run n00dles.script")),canNext:!1},[P.f.TerminalGoToActiveScriptsPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Your script is now running! It will continuously run in the background and will automatically stop if the code ever completes (the n00dles.script will never complete because it runs an infinite loop). ",r.a.createElement("br",null),r.a.createElement("br",null),"These scripts can passively earn you income and hacking experience. Your scripts will also earn money and experience while you are offline, although at a slightly slower rate. ",r.a.createElement("br",null),r.a.createElement("br",null),"Let's check out some statistics for our running scripts by clicking"," "),r.a.createElement(f.a,null,r.a.createElement(S.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Active Scripts"))),canNext:!1},[P.f.ActiveScriptsPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"This page displays information about all of your scripts that are running across every server. You can use this to gauge how well your scripts are doing. Let's go back to"),r.a.createElement(f.a,null,r.a.createElement(E.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Terminal"))),canNext:!1},[P.f.ActiveScriptsToTerminal]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"One last thing about scripts, each active script contains logs that detail what it's doing. We can check these logs using the tail command. Do that now for the script we just ran by typing"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> tail n00dles.script")),canNext:!1},[P.f.TerminalTailScript]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"The log for this script won't show much right now (it might show nothing at all) because it just started running...but check back again in a few minutes! ",r.a.createElement("br",null),r.a.createElement("br",null),"This covers the basics of hacking. To learn more about writing scripts, select"),r.a.createElement(f.a,null,r.a.createElement(k.a,{color:"primary"}),r.a.createElement(o.a,{color:"primary"},"Tutorial")),r.a.createElement(o.a,null,"in the main navigation menu to look at the documentation. If you are an experienced JavaScript developer, I would highly suggest you check out the section on NetscriptJS/Netscript 2.0, it's faster and more powerful.",r.a.createElement("br",null),r.a.createElement("br",null),"For now, let's move on to something else!")),canNext:!0},[P.f.GoToHacknetNodesPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Hacking is not the only way to earn money. One other way to passively earn money is by purchasing and upgrading Hacknet Nodes. Let's go to"),r.a.createElement(f.a,null,r.a.createElement(w.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Hacknet")),r.a.createElement(o.a,null,"through the main navigation menu now.")),canNext:!0},[P.f.HacknetNodesIntroduction]:{content:r.a.createElement(o.a,null,"here you can purchase new Hacknet Nodes and upgrade your existing ones. Let's purchase a new one now."),canNext:!0},[P.f.HacknetNodesGoToWorldPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"You just purchased a Hacknet Node! This Hacknet Node will passively earn you money over time, both online and offline. When you get enough money, you can upgrade your newly-purchased Hacknet Node below.",r.a.createElement("br",null),r.a.createElement("br",null),"Let's go to"),r.a.createElement(f.a,null,r.a.createElement(O.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"City"))),canNext:!0},[P.f.WorldDescription]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"This page lists all of the different locations you can currently travel to. Each location has something that you can do. There's a lot of content out in the world, make sure you explore and discover!",r.a.createElement("br",null),r.a.createElement("br",null),"Lastly, click on"),r.a.createElement(f.a,null,r.a.createElement(k.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Tutorial"))),canNext:!0},[P.f.TutorialPageInfo]:{content:r.a.createElement(o.a,null,"This page contains a lot of different documentation about the game's content and mechanics. I know it's a lot, but I highly suggest you read (or at least skim) through this before you start playing . That's the end of the tutorial. Hope you enjoy the game!"),canNext:!0},[P.f.End]:{content:r.a.createElement(o.a,null),canNext:!0}},a=Object(n.useState)(!1)[1];function c(){a(e=>!e)}Object(n.useEffect)(()=>p.a.subscribe(c),[]);const m=P.a.currStep,g=t[m];if(void 0===g)throw new Error("error in the tutorial");return r.a.createElement(i.a,{square:!0,sx:{maxWidth:"70vw",p:2}},g.content,m!==P.f.TutorialPageInfo&&r.a.createElement(r.a.Fragment,null,r.a.createElement(s.a,{onClick:P.d,"aria-label":"previous"},r.a.createElement(h.a,null)),g.canNext&&r.a.createElement(s.a,{onClick:P.c,"aria-label":"next"},r.a.createElement(u.a,null))),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(l.a,{onClick:P.b},m!==P.f.TutorialPageInfo?"SKIP TUTORIAL":"FINISH TUTORIAL"))}},,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a.n(n),i=a(142),o=a(92),s=a(328),l=a(1477),c=a(755),u=a.n(c),m=a(756),h=a.n(m),p=a(47),d=a(27);const f=Object(i.a)({nobackground:{backgroundColor:"#0000"}});function g({children:e}){const[t,a]=Object(n.useState)(!0),i=f(),c=p.b.Router();if(c.page()===d.a.BitVerse||c.page()===d.a.HackingMission||c.page()===d.a.Loading)return r.a.createElement(r.a.Fragment,null);let m;return m=t?r.a.createElement(u.a,{color:"primary"}):r.a.createElement(h.a,{color:"primary"}),r.a.createElement("div",{style:{position:"fixed",top:0,right:0,zIndex:1500}},r.a.createElement(o.a,{display:"flex",justifyContent:"flex-end",flexDirection:"column"},r.a.createElement(s.a,{in:t},e),r.a.createElement(o.a,{display:"flex",justifyContent:"flex-end"},r.a.createElement(l.a,{classes:{root:i.nobackground},onClick:()=>a(e=>!e)},m))))}},,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return Pe}));var n=a(0),r=a.n(n),i=a(12),o=a(17),s=a(277),l=a(142),c=a(1478),u=a(370),m=a(552),h=a(761),p=a.n(h),d=a(760),f=a.n(d),g=a(63),y=a(117),b=a(103),E=a(9),v=a(328),k=a(638),_=a(763),w=a.n(_),C=a(286),S=a.n(C),x=a(764),O=a.n(x),T=a(484),M=a.n(T),P=a(765),R=a.n(P),A=a(426),N=a.n(A),I=a(767),j=a.n(I),F=a(488),D=a.n(F),B=a(485),L=a.n(B),G=a(768),W=a.n(G),H=a(486),U=a.n(H),q=a(770),K=a.n(q),$=a(771),z=a.n($),Y=a(772),V=a.n(Y),J=a(773),Q=a.n(J),X=a(774),Z=a.n(X),ee=a(775),te=a.n(ee),ae=a(777),ne=a.n(ae),re=a(427),ie=a.n(re),oe=a(778),se=a.n(oe),le=a(766),ce=a.n(le),ue=a(769),me=a.n(ue),he=a(776),pe=a.n(he),de=a(287),fe=a.n(de),ge=a(75),ye=a.n(ge),be=a(27),Ee=a(4),ve=a(35),ke=a(487),_e=a(18),we=a(207),Ce=a(134),Se=a(79);const xe=e=>({width:e.spacing(31),transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}),Oe=e=>({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:`calc(${e.spacing(2)} + 1px)`,[e.breakpoints.up("sm")]:{width:`calc(${e.spacing(7)} + 1px)`}}),Te=Object(o.a)(c.a,{shouldForwardProp:e=>"open"!==e})(({theme:e,open:t})=>({width:e.spacing(31),whiteSpace:"nowrap",boxSizing:"border-box",...t&&{...xe(e),"& .MuiDrawer-paper":xe(e)},...!t&&{...Oe(e),"& .MuiDrawer-paper":Oe(e)}})),Me=Object(l.a)(e=>Object(s.a)({active:{borderLeft:"3px solid "+e.palette.primary.main},listitem:{}}));function Pe(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(a,200);return()=>clearInterval(e)},[]);const[o,s]=Object(n.useState)(!0),[l,c]=Object(n.useState)(!0),[h,d]=Object(n.useState)(!0),[_,C]=Object(n.useState)(!0),x=ve.a.currStep===ve.f.CharacterGoToTerminalPage||ve.a.currStep===ve.f.ActiveScriptsPage,T=ve.a.currStep===ve.f.GoToCharacterPage,P=ve.a.currStep===ve.f.TerminalGoToActiveScriptsPage,A=ve.a.currStep===ve.f.GoToHacknetNodesPage,I=ve.a.currStep===ve.f.HacknetNodesGoToWorldPage,F=ve.a.currStep===ve.f.WorldDescription,B=e.player.queuedAugmentations.length,G=e.player.factionInvitations.length,H=Object(ke.a)(e.player).length,q=H>0||e.player.augmentations.length>0||e.player.queuedAugmentations.length>0||e.player.sourceFiles.length>0,$=e.player.factionInvitations.length>0||e.player.factions.length>0||e.player.augmentations.length>0||e.player.queuedAugmentations.length>0||e.player.sourceFiles.length>0,Y=e.player.augmentations.length>0||e.player.queuedAugmentations.length>0||e.player.sourceFiles.length>0,J=e.player.sleeves.length>0,X=!!e.player.corporation,ee=!!e.player.gang,ae=""!==e.player.companyName,re=e.player.hasWseAccount,oe=!!e.player.bladeburner;function le(){e.router.toTerminal(),x&&Object(ve.c)()}function ue(){e.router.toScriptEditor()}function he(){e.router.toStats(),T&&Object(ve.c)()}function de(){e.router.toActiveScripts(),P&&Object(ve.c)()}function ge(){e.router.toCreateProgram()}function xe(){e.router.toFactions()}function Oe(){e.router.toAugmentations()}function Pe(){e.router.toHacknetNodes(),A&&Object(ve.c)()}function Re(){e.router.toCity(),I&&Object(ve.c)()}function Ae(){e.router.toTravel()}function Ne(){e.router.toJob()}function Ie(){e.router.toBladeburner()}function je(){e.router.toGang()}function Fe(){e.router.toTutorial(),F&&Object(ve.c)()}Object(n.useEffect)(()=>{function t(t){if(!_e.a.DisableHotkeys&&!(e.player.isWorking||we.b||Ce.c))if(t.keyCode==Se.a.T&&t.altKey)t.preventDefault(),le();else if(t.keyCode===Se.a.C&&t.altKey)t.preventDefault(),he();else if(t.keyCode===Se.a.E&&t.altKey)t.preventDefault(),ue();else if(t.keyCode===Se.a.S&&t.altKey)t.preventDefault(),de();else if(t.keyCode===Se.a.H&&t.altKey)t.preventDefault(),Pe();else if(t.keyCode===Se.a.W&&t.altKey)t.preventDefault(),Re();else if(t.keyCode===Se.a.J&&t.altKey)t.preventDefault(),Ne();else if(t.keyCode===Se.a.R&&t.altKey)t.preventDefault(),Ae();else if(t.keyCode===Se.a.P&&t.altKey)t.preventDefault(),ge();else if(t.keyCode===Se.a.F&&t.altKey){if(e.page==be.a.Terminal&&_e.a.EnableBashHotkeys)return;t.preventDefault(),xe()}else t.keyCode===Se.a.A&&t.altKey?(t.preventDefault(),Oe()):t.keyCode===Se.a.U&&t.altKey?(t.preventDefault(),Fe()):t.keyCode===Se.a.B&&t.altKey?(t.preventDefault(),Ie()):t.keyCode===Se.a.G&&t.altKey&&(t.preventDefault(),je())}return document.addEventListener("keypress",t),()=>document.removeEventListener("keypress",t)},[]);const De=Me(),[Be,Le]=Object(n.useState)(!0);return r.a.createElement(Te,{open:Be,anchor:"left",variant:"permanent"},r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,onClick:()=>Le(e=>!e)},r.a.createElement(y.a,null,Be?r.a.createElement(p.a,{color:"primary"}):r.a.createElement(f.a,{color:"primary"})),r.a.createElement(b.a,{primary:r.a.createElement(E.a,null,"Bitburner v",Ee.a.Version)})),r.a.createElement(m.a,null),r.a.createElement(u.a,null,r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,onClick:()=>s(e=>!e)},r.a.createElement(y.a,null,r.a.createElement(w.a,{color:"primary"})),r.a.createElement(b.a,{primary:r.a.createElement(E.a,null,"Hacking")}),o?r.a.createElement(fe.a,{color:"primary"}):r.a.createElement(ye.a,{color:"primary"})),r.a.createElement(v.a,{in:o,timeout:"auto",unmountOnExit:!0},r.a.createElement(u.a,null,r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Terminal",className:Object(i.a)({[De.active]:e.page===be.a.Terminal}),onClick:le},r.a.createElement(y.a,null,r.a.createElement(S.a,{color:x?"error":e.page!==be.a.Terminal?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:x?"error":e.page!==be.a.Terminal?"secondary":"primary"},"Terminal"))),r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Create Scripts",className:Object(i.a)({[De.active]:e.page===be.a.CreateScript}),onClick:ue},r.a.createElement(y.a,null,r.a.createElement(O.a,{color:e.page!==be.a.CreateScript?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.CreateScript?"secondary":"primary"},"Create Script"))),r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Active Scripts",className:Object(i.a)({[De.active]:e.page===be.a.ActiveScripts}),onClick:de},r.a.createElement(y.a,null,r.a.createElement(M.a,{color:P?"error":e.page!==be.a.ActiveScripts?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:P?"error":e.page!==be.a.ActiveScripts?"secondary":"primary"},"Active Scripts"))),q&&r.a.createElement(g.a,{button:!0,key:"Create Program",className:Object(i.a)({[De.active]:e.page===be.a.CreateProgram}),onClick:ge},r.a.createElement(y.a,null,r.a.createElement(k.a,{badgeContent:H>0?H:void 0,color:"error"},r.a.createElement(R.a,{color:e.page!==be.a.CreateProgram?"secondary":"primary"}))),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.CreateProgram?"secondary":"primary"},"Create Program"))))),r.a.createElement(m.a,null),r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,onClick:()=>c(e=>!e)},r.a.createElement(y.a,null,r.a.createElement(ce.a,{color:"primary"})),r.a.createElement(b.a,{primary:r.a.createElement(E.a,null,"Character")}),l?r.a.createElement(fe.a,{color:"primary"}):r.a.createElement(ye.a,{color:"primary"})),r.a.createElement(v.a,{in:l,timeout:"auto",unmountOnExit:!0},r.a.createElement(g.a,{button:!0,key:"Stats",className:Object(i.a)({[De.active]:e.page===be.a.Stats}),onClick:he},r.a.createElement(y.a,null,r.a.createElement(N.a,{color:T?"error":e.page!==be.a.Stats?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:T?"error":e.page!==be.a.Stats?"secondary":"primary"},"Stats"))),$&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Factions",className:Object(i.a)({[De.active]:[be.a.Factions,be.a.Faction].includes(e.page)}),onClick:xe},r.a.createElement(y.a,null,r.a.createElement(k.a,{badgeContent:0!==G?G:void 0,color:"error"},r.a.createElement(j.a,{color:[be.a.Factions,be.a.Faction].includes(e.page)?"primary":"secondary"}))),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:[be.a.Factions,be.a.Faction].includes(e.page)?"primary":"secondary"},"Factions"))),Y&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Augmentations",className:Object(i.a)({[De.active]:e.page===be.a.Augmentations}),onClick:Oe},r.a.createElement(y.a,null,r.a.createElement(k.a,{badgeContent:0!==B?B:void 0,color:"error"},r.a.createElement(D.a,{style:{transform:"rotate(-90deg)"},color:e.page!==be.a.Augmentations?"secondary":"primary"}))),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Augmentations?"secondary":"primary"},"Augmentations"))),r.a.createElement(g.a,{button:!0,key:"Hacknet",className:Object(i.a)({[De.active]:e.page===be.a.Hacknet}),onClick:Pe},r.a.createElement(y.a,null,r.a.createElement(L.a,{color:A?"error":e.page!==be.a.Hacknet?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:A?"error":e.page!==be.a.Hacknet?"secondary":"primary"},"Hacknet"))),J&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Sleeves",className:Object(i.a)({[De.active]:e.page===be.a.Sleeves}),onClick:function(){e.router.toSleeves()}},r.a.createElement(y.a,null,r.a.createElement(W.a,{color:e.page!==be.a.Sleeves?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Sleeves?"secondary":"primary"},"Sleeves")))),r.a.createElement(m.a,null),r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,onClick:()=>d(e=>!e)},r.a.createElement(y.a,null,r.a.createElement(me.a,{color:"primary"})),r.a.createElement(b.a,{primary:r.a.createElement(E.a,null,"World")}),h?r.a.createElement(fe.a,{color:"primary"}):r.a.createElement(ye.a,{color:"primary"})),r.a.createElement(v.a,{in:h,timeout:"auto",unmountOnExit:!0},r.a.createElement(g.a,{button:!0,key:"City",className:Object(i.a)({[De.active]:e.page===be.a.City||e.page===be.a.Resleeves||e.page===be.a.Location}),onClick:Re},r.a.createElement(y.a,null,r.a.createElement(U.a,{color:I?"error":e.page!==be.a.City?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:I?"error":e.page!==be.a.City?"secondary":"primary"},"City"))),r.a.createElement(g.a,{button:!0,key:"Travel",className:Object(i.a)({[De.active]:e.page===be.a.Travel}),onClick:Ae},r.a.createElement(y.a,null,r.a.createElement(K.a,{color:e.page!==be.a.Travel?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Travel?"secondary":"primary"},"Travel"))),ae&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Job",className:Object(i.a)({[De.active]:e.page===be.a.Job}),onClick:Ne},r.a.createElement(y.a,null,r.a.createElement(z.a,{color:e.page!==be.a.Job?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Job?"secondary":"primary"},"Job"))),re&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Stock Market",className:Object(i.a)({[De.active]:e.page===be.a.StockMarket}),onClick:function(){e.router.toStockMarket()}},r.a.createElement(y.a,null,r.a.createElement(V.a,{color:e.page!==be.a.StockMarket?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.StockMarket?"secondary":"primary"},"Stock Market"))),oe&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Bladeburner",className:Object(i.a)({[De.active]:e.page===be.a.Bladeburner}),onClick:Ie},r.a.createElement(y.a,null,r.a.createElement(Q.a,{color:e.page!==be.a.Bladeburner?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Bladeburner?"secondary":"primary"},"Bladeburner"))),X&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Corp",className:Object(i.a)({[De.active]:e.page===be.a.Corporation}),onClick:function(){e.router.toCorporation()}},r.a.createElement(y.a,null,r.a.createElement(Z.a,{color:e.page!==be.a.Corporation?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Corporation?"secondary":"primary"},"Corp"))),ee&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Gang",className:Object(i.a)({[De.active]:e.page===be.a.Gang}),onClick:je},r.a.createElement(y.a,null,r.a.createElement(te.a,{color:e.page!==be.a.Gang?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Gang?"secondary":"primary"},"Gang")))),r.a.createElement(m.a,null),r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,onClick:()=>C(e=>!e)},r.a.createElement(y.a,null,r.a.createElement(pe.a,{color:"primary"})),r.a.createElement(b.a,{primary:r.a.createElement(E.a,null,"Help")}),_?r.a.createElement(fe.a,{color:"primary"}):r.a.createElement(ye.a,{color:"primary"})),r.a.createElement(v.a,{in:_,timeout:"auto",unmountOnExit:!0},r.a.createElement(g.a,{button:!0,key:"Milestones",className:Object(i.a)({[De.active]:e.page===be.a.Milestones}),onClick:function(){e.router.toMilestones()}},r.a.createElement(y.a,null,r.a.createElement(ne.a,{color:e.page!==be.a.Milestones?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Milestones?"secondary":"primary"},"Milestones"))),r.a.createElement(g.a,{button:!0,key:"Tutorial",className:Object(i.a)({[De.active]:e.page===be.a.Tutorial}),onClick:Fe},r.a.createElement(y.a,null,r.a.createElement(ie.a,{color:F?"error":e.page!==be.a.Tutorial?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:F?"error":e.page!==be.a.Tutorial?"secondary":"primary"},"Tutorial"))),r.a.createElement(g.a,{button:!0,key:"Options",className:Object(i.a)({[De.active]:e.page===be.a.Options}),onClick:function(){e.router.toGameOptions()}},r.a.createElement(y.a,null,r.a.createElement(se.a,{color:e.page!==be.a.Options?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Options?"secondary":"primary"},"Options"))),!1)))}},,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a(780),i=a(786),o=a(787),s=a(1),l=a(26),c=a(311);class u extends n.Component{constructor(e){super(e),this.state={rerender:!1},this.export=this.export.bind(this)}export(){this.props.exportGameFn(),this.setState({rerender:!this.state.rerender})}render(){return n.createElement(n.Fragment,null,n.createElement("div",{className:"augmentations-content"},n.createElement("h1",null,"Purchased Augmentations"),n.createElement("p",null,"Below is a list of all Augmentations you have purchased but not yet installed. Click the button below to install them."),n.createElement("p",null,"WARNING: Installing your Augmentations resets most of your progress, including:"),n.createElement("br",null),n.createElement("p",null,"- Stats/Skill levels and Experience"),n.createElement("p",null,"- Money"),n.createElement("p",null,"- Scripts on every computer but your home computer"),n.createElement("p",null,"- Purchased servers"),n.createElement("p",null,"- Hacknet Nodes"),n.createElement("p",null,"- Faction/Company reputation"),n.createElement("p",null,"- Stocks"),n.createElement("br",null),n.createElement("p",null,"Installing Augmentations lets you start over with the perks and benefits granted by all of the Augmentations you have ever installed. Also, you will keep any scripts and RAM/Core upgrades on your home computer (but you will lose all programs besides NUKE.exe)"),n.createElement(l.a,{onClick:this.props.installAugmentationsFn,text:"Install Augmentations",tooltip:"'I never asked for this'"}),n.createElement(l.a,{addClasses:"flashing-button",onClick:this.export,text:"Backup Save "+(Object(c.b)()?"(+1 favor to all factions)":""),tooltip:"It's always a good idea to backup/export your save!"}),n.createElement(o.a,null),n.createElement("h1",null,"Installed Augmentations"),n.createElement("p",null,`List of all Augmentations ${s.a.sourceFiles.length>0?"and Source Files ":""} that have been installed. You have gained the effects of these.`),n.createElement(r.a,null),n.createElement("br",null)," ",n.createElement("br",null),n.createElement(i.a,null)))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a(781),i=a(782),o=a(783),s=a(785),l=a(18),c=a(147);class u extends n.Component{constructor(e){super(e),this.state={rerenderFlag:!1},this.collapseAllHeaders=this.collapseAllHeaders.bind(this),this.expandAllHeaders=this.expandAllHeaders.bind(this),this.sortByAcquirementTime=this.sortByAcquirementTime.bind(this),this.sortInOrder=this.sortInOrder.bind(this),this.listRef=n.createRef()}collapseAllHeaders(){const e=this.listRef.current;if(null==e)return;const t=e.getElementsByClassName("accordion-header");for(let e=0;e({rerenderFlag:!e.rerenderFlag}))}sortByAcquirementTime(){l.a.OwnedAugmentationsOrder=c.a.AcquirementTime,this.rerender()}sortInOrder(){l.a.OwnedAugmentationsOrder=c.a.Alphabetically,this.rerender()}render(){return n.createElement(n.Fragment,null,n.createElement(i.a,{collapseAllButtonsFn:this.collapseAllHeaders,expandAllButtonsFn:this.expandAllHeaders,sortByAcquirementTimeFn:this.sortByAcquirementTime,sortInOrderFn:this.sortInOrder}),n.createElement("ul",{className:"augmentations-list",ref:this.listRef},n.createElement(s.a,null),n.createElement(o.a,null),n.createElement(r.a,null)))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a(1),i=a(19),o=a(5),s=a(18),l=a(147),c=a(489);function u(){const e=r.a.augmentations.slice();s.a.OwnedAugmentationsOrder===l.a.Alphabetically&&e.sort((e,t)=>e.name<=t.name?-1:1);const t=e.map(e=>{const t=i.a[e.name];let a=null;return e.name===o.a.NeuroFluxGovernor&&(a=e.level),n.createElement("li",{key:e.name},n.createElement(c.a,{aug:t,level:a}))});return n.createElement(n.Fragment,null,t)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(26);function i(e){return n.createElement(n.Fragment,null,n.createElement(r.a,{onClick:e.expandAllButtonsFn,text:"Expand All"}),n.createElement(r.a,{onClick:e.collapseAllButtonsFn,text:"Collapse All"}),n.createElement(r.a,{onClick:e.sortInOrderFn,text:"Sort in Order",tooltip:"Sorts the Augmentations alphabetically and Source-Files in numeral order"}),n.createElement(r.a,{onClick:e.sortByAcquirementTimeFn,text:"Sort by Acquirement Time",tooltip:"Sorts the Augmentations and Source-Files based on when you acquired them (same as default)"}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a(1),i=a(18),o=a(147),s=a(300),l=a(784);function c(){const e=r.a.sourceFiles.slice();i.a.OwnedAugmentationsOrder===o.a.Alphabetically&&e.sort((e,t)=>e.n-t.n);const t=e.map(e=>{const t="SourceFile"+e.n,a=s.a[t];return null==a?(console.error("Invalid source file number: "+e.n),null):n.createElement("li",{key:e.n},n.createElement(l.a,{level:e.lvl,sf:a}))});return n.createElement(n.Fragment,null,t)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(234);function i(e){const t=12===e.sf.n?"∞":"3";return n.createElement(r.a,{headerContent:n.createElement(n.Fragment,null,e.sf.name,n.createElement("br",null),`Level ${e.level} / ${t}`),panelContent:n.createElement("p",{dangerouslySetInnerHTML:{__html:e.sf.info}})})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a(1),i=a(235),o=a(234);function s(){const e=r.a.exploits;return 0===e.length?n.createElement(n.Fragment,null):n.createElement("li",{key:-1},n.createElement(o.a,{headerContent:n.createElement(n.Fragment,null,"Source-File -1: Exploits in the BitNodes",n.createElement("br",null),"Level ",e.length," / ?"),panelContent:n.createElement(n.Fragment,null,n.createElement("p",null,"This Source-File can only be acquired with obscure knowledge of the game, javascript, and the web ecosystem."),n.createElement("p",null,"It increases all of the player's multipliers by 0.1%"),n.createElement("br",null),n.createElement("p",null,"You have found the following exploits:"),n.createElement("ul",null,e.map(e=>n.createElement("li",{key:e},"* ",Object(i.b)(e)))))}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a(1),i=a(3),o=a(19);function s(){const e=function(){const e={};for(const t of r.a.queuedAugmentations){const a=o.a[t.name];for(const t in a.mults){const n=e[t]?e[t]:1;e[t]=n*a.mults[t]}}return e}();function t(e){return n.createElement("table",null,n.createElement("tbody",null,e.map(e=>n.createElement("tr",{key:e[0]},n.createElement("td",{key:"0"},n.createElement("span",null,e[0]," multiplier: ")),n.createElement("td",{key:"1",style:{textAlign:"right"}},i.a.formatPercentage(e[1])),function(e){let t=[];return e&&(t=[n.createElement("td",{key:"2"}," ","=>"," "),n.createElement("td",{key:"3"},i.a.formatPercentage(e))]),t}(e[2])))))}return n.createElement(n.Fragment,null,n.createElement("p",null,n.createElement("strong",null,n.createElement("u",null,"Multipliers:"))),n.createElement("br",null),t([["Hacking Chance ",r.a.hacking_chance_mult,r.a.hacking_chance_mult*e.hacking_chance_mult],["Hacking Speed ",r.a.hacking_speed_mult,r.a.hacking_speed_mult*e.hacking_speed_mult],["Hacking Money ",r.a.hacking_money_mult,r.a.hacking_money_mult*e.hacking_money_mult],["Hacking Growth ",r.a.hacking_grow_mult,r.a.hacking_grow_mult*e.hacking_grow_mult]]),n.createElement("br",null),t([["Hacking Level ",r.a.hacking_mult,r.a.hacking_mult*e.hacking_mult],["Hacking Experience ",r.a.hacking_exp_mult,r.a.hacking_exp_mult*e.hacking_exp_mult]]),n.createElement("br",null),t([["Strength Level ",r.a.strength_mult,r.a.strength_mult*e.strength_mult],["Strength Experience ",r.a.strength_exp_mult,r.a.strength_exp_mult*e.strength_exp_mult]]),n.createElement("br",null),t([["Defense Level ",r.a.defense_mult,r.a.defense_mult*e.defense_mult],["Defense Experience ",r.a.defense_exp_mult,r.a.defense_exp_mult*e.defense_exp_mult]]),n.createElement("br",null),t([["Dexterity Level ",r.a.dexterity_mult,r.a.dexterity_mult*e.dexterity_mult],["Dexterity Experience ",r.a.dexterity_exp_mult,r.a.dexterity_exp_mult*e.dexterity_exp_mult]]),n.createElement("br",null),t([["Agility Level ",r.a.agility_mult,r.a.agility_mult*e.agility_mult],["Agility Experience ",r.a.agility_exp_mult,r.a.agility_exp_mult*e.agility_exp_mult]]),n.createElement("br",null),t([["Charisma Level ",r.a.charisma_mult,r.a.charisma_mult*e.charisma_mult],["Charisma Experience ",r.a.charisma_exp_mult,r.a.charisma_exp_mult*e.charisma_exp_mult]]),n.createElement("br",null),t([["Hacknet Node production ",r.a.hacknet_node_money_mult,r.a.hacknet_node_money_mult*e.hacknet_node_money_mult],["Hacknet Node purchase cost ",r.a.hacknet_node_purchase_cost_mult,r.a.hacknet_node_purchase_cost_mult*e.hacknet_node_purchase_cost_mult],["Hacknet Node RAM upgrade cost ",r.a.hacknet_node_ram_cost_mult,r.a.hacknet_node_ram_cost_mult*e.hacknet_node_ram_cost_mult],["Hacknet Node Core purchase cost ",r.a.hacknet_node_core_cost_mult,r.a.hacknet_node_core_cost_mult*e.hacknet_node_core_cost_mult],["Hacknet Node level upgrade cost ",r.a.hacknet_node_level_cost_mult,r.a.hacknet_node_level_cost_mult*e.hacknet_node_level_cost_mult]]),n.createElement("br",null),t([["Company reputation gain ",r.a.company_rep_mult,r.a.company_rep_mult*e.company_rep_mult],["Faction reputation gain ",r.a.faction_rep_mult,r.a.faction_rep_mult*e.faction_rep_mult],["Salary ",r.a.work_money_mult,r.a.work_money_mult*e.work_money_mult]]),n.createElement("br",null),t([["Crime success ",r.a.crime_success_mult,r.a.crime_success_mult*e.crime_success_mult],["Crime money ",r.a.crime_money_mult,r.a.crime_money_mult*e.crime_money_mult]]),n.createElement("br",null),n.createElement((function(){return r.a.canAccessBladeburner()?n.createElement(n.Fragment,null,t([["Bladeburner Success Chance",r.a.bladeburner_success_chance_mult,r.a.bladeburner_success_chance_mult*e.bladeburner_success_chance_mult],["Bladeburner Max Stamina",r.a.bladeburner_max_stamina_mult,r.a.bladeburner_max_stamina_mult*e.bladeburner_max_stamina_mult],["Bladeburner Stamina Gain",r.a.bladeburner_stamina_gain_mult,r.a.bladeburner_stamina_gain_mult*e.bladeburner_stamina_gain_mult],["Bladeburner Field Analysis",r.a.bladeburner_analysis_mult,r.a.bladeburner_analysis_mult*e.bladeburner_analysis_mult]]),n.createElement("br",null)):n.createElement(n.Fragment,null)}),null))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(19),i=a(5),o=a(1),s=a(489);function l(){const e=[];let t=-1;for(let e=o.a.queuedAugmentations.length-1;e>=0;e--)if(o.a.queuedAugmentations[e].name===i.a.NeuroFluxGovernor){t=e;break}for(let a=0;a0&&i.a.createElement(E.a,{player:e.player}),i.a.createElement(v.a,{player:e.player,engine:e.engine}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(15);function h(e){function t(t){return function(){e.player.gainMoney(t)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"General")),r.a.createElement(s.a,null,r.a.createElement("div",null,r.a.createElement(u.a,{onClick:t(1e6)},r.a.createElement("pre",null,"+ ",r.a.createElement(m.a,{money:1e6}))),r.a.createElement(u.a,{onClick:t(1e9)},r.a.createElement("pre",null,"+ ",r.a.createElement(m.a,{money:1e9}))),r.a.createElement(u.a,{onClick:t(1e12)},r.a.createElement("pre",null,"+ ",r.a.createElement(m.a,{money:1e12}))),r.a.createElement(u.a,{onClick:t(1e15)},r.a.createElement("pre",null,"+ ",r.a.createElement(m.a,{money:1e15}))),r.a.createElement(u.a,{onClick:t(1/0)},r.a.createElement("pre",null,"+ ",r.a.createElement(m.a,{money:1/0}))),r.a.createElement(u.a,{onClick:function(){e.player.getHomeComputer().maxRam*=2}},"+ RAM")),r.a.createElement("div",null,r.a.createElement(u.a,{onClick:function(){e.router.toBitVerse(!0,!0)}},"Quick b1t_flum3.exe"),r.a.createElement(u.a,{onClick:function(){e.router.toBitVerse(!0,!1)}},"Run b1t_flum3.exe"),r.a.createElement(u.a,{onClick:function(){e.router.toBitVerse(!1,!0)}},"Quick w0rld_d34m0n"),r.a.createElement(u.a,{onClick:function(){e.router.toBitVerse(!1,!1)}},"Hack w0rld_d34m0n"))))}},,function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(120);const h=1e27;function p(e){function t(t,a){return function(n){switch(t){case"hacking":n&&e.player.gainHackingExp(n*a);break;case"strength":n&&e.player.gainStrengthExp(n*a);break;case"defense":n&&e.player.gainDefenseExp(n*a);break;case"dexterity":n&&e.player.gainDexterityExp(n*a);break;case"agility":n&&e.player.gainAgilityExp(n*a);break;case"charisma":n&&e.player.gainCharismaExp(n*a);break;case"intelligence":n&&e.player.gainIntelligenceExp(n*a)}e.player.updateSkillLevels()}}function a(t){return function(a){e.player.karma+=a*t}}function n(t){return function(){switch(t){case"hacking":e.player.hacking_exp=0;break;case"strength":e.player.strength_exp=0;break;case"defense":e.player.defense_exp=0;break;case"dexterity":e.player.dexterity_exp=0;break;case"agility":e.player.agility_exp=0;break;case"charisma":e.player.charisma_exp=0;break;case"intelligence":e.player.intelligence_exp=0}e.player.updateSkillLevels()}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Experience / Stats")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"All:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.gainHackingExp(h),e.player.gainStrengthExp(h),e.player.gainDefenseExp(h),e.player.gainDexterityExp(h),e.player.gainAgilityExp(h),e.player.gainCharismaExp(h),e.player.gainIntelligenceExp(h),e.player.updateSkillLevels()}},"Tons of exp"),r.a.createElement(u.a,{onClick:function(){e.player.hacking_exp=0,e.player.strength_exp=0,e.player.defense_exp=0,e.player.dexterity_exp=0,e.player.agility_exp=0,e.player.charisma_exp=0,e.player.intelligence_exp=0,e.player.updateSkillLevels()}},"Reset"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Hacking:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"hacking",placeholder:"exp",tons:()=>t("hacking",1)(h),add:t("hacking",1),subtract:t("hacking",-1),reset:n("hacking")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Strength:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"strength",placeholder:"exp",tons:()=>t("strength",1)(h),add:t("strength",1),subtract:t("strength",-1),reset:n("strength")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Defense:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"defense",placeholder:"exp",tons:()=>t("defense",1)(h),add:t("defense",1),subtract:t("defense",-1),reset:n("defense")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Dexterity:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"dexterity",placeholder:"exp",tons:()=>t("dexterity",1)(h),add:t("dexterity",1),subtract:t("dexterity",-1),reset:n("dexterity")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Agility:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"agility",placeholder:"exp",tons:()=>t("agility",1)(h),add:t("agility",1),subtract:t("agility",-1),reset:n("agility")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Charisma:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"charisma",placeholder:"exp",tons:()=>t("charisma",1)(h),add:t("charisma",1),subtract:t("charisma",-1),reset:n("charisma")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Intelligence:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"intelligence",placeholder:"exp",tons:()=>t("intelligence",1)(h),add:t("intelligence",1),subtract:t("intelligence",-1),reset:n("intelligence")})),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){0===e.player.intelligence&&(e.player.intelligence=1,e.player.updateSkillLevels())}},"Enable")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.intelligence_exp=0,e.player.intelligence=0,e.player.updateSkillLevels()}},"Disable"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Karma:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"karma",placeholder:"amt",tons:()=>t("intelligence",1)(1e5),add:a(1),subtract:a(-1),reset:function(){e.player.karma=0}})))))))}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return _}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(290),h=a(120),p=a(24),d=a(1161),f=a(125),g=a(116),y=a(497),b=a.n(y),E=a(384),v=a.n(E),k=a(1162);function _(e){const[t,a]=Object(n.useState)("Illuminati");function l(e){return function(a){const n=p.a[t];null==n||isNaN(a)||(n.playerReputation+=a*e)}}function y(e){return function(a){const n=p.a[t];null==n||isNaN(a)||(n.favor+=a*e)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Factions")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Faction:")),r.a.createElement("td",null,r.a.createElement(d.a,null,r.a.createElement(k.a,{id:"factions-select"},"Faction"),r.a.createElement(m.a,{labelId:"factions-select",id:"factions-dropdown",className:"dropdown exp-input",onChange:function(e){a(e.target.value)},value:t,startAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(g.a,{onClick:function(){for(const t in p.a)e.player.receiveInvite(p.a[t].name)},size:"large","arial-label":"receive-all-invitation"},r.a.createElement(b.a,null)),r.a.createElement(g.a,{onClick:function(){e.player.receiveInvite(t)},size:"large","arial-label":"receive-one-invitation"},r.a.createElement(v.a,null)))},Object.values(p.a).map(e=>r.a.createElement(f.a,{key:e.name,value:e.name},e.name)))))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Reputation:")),r.a.createElement("td",null,r.a.createElement(h.a,{label:"reputation",placeholder:"amt",tons:()=>l(1)(1e12),add:l(1),subtract:l(-1),reset:function(){const e=p.a[t];null!=e&&(e.playerReputation=0)}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Favor:")),r.a.createElement("td",null,r.a.createElement(h.a,{label:"favor",placeholder:"amt",tons:()=>y(1)(2e3),add:y(1),subtract:y(-1),reset:function(){const e=p.a[t];null!=e&&(e.favor=0)}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"All Reputation:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in p.a)p.a[e].playerReputation=1e12}},"Tons"),r.a.createElement(u.a,{onClick:function(){for(const e in p.a)p.a[e].playerReputation=0}},"Reset"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"All Favor:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in p.a)p.a[e].favor=1e12}},"Tons"),r.a.createElement(u.a,{onClick:function(){for(const e in p.a)p.a[e].favor=0}},"Reset")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return v}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(290),m=a(5),h=a(125),p=a(116),d=a(497),f=a.n(d),g=a(384),y=a.n(g),b=a(496),E=a.n(b);function v(e){const[t,a]=Object(n.useState)("Augmented Targeting I");return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Augmentations")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Aug:")),r.a.createElement("td",null,r.a.createElement(u.a,{onChange:function(e){a(e.target.value)},value:t,startAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(p.a,{onClick:function(){for(const t in m.a){const a=m.a[t];e.player.queueAugmentation(a)}},size:"large"},r.a.createElement(f.a,null)),r.a.createElement(p.a,{onClick:function(){e.player.queueAugmentation(t)},size:"large"},r.a.createElement(y.a,null))),endAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(p.a,{onClick:function(){e.player.augmentations=[]},size:"large"},r.a.createElement(E.a,null)))},Object.values(m.a).map(e=>r.a.createElement(h.a,{key:e,value:e},e)))))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(498),h=a(639);const p=[1,2,3,4,5,6,7,8,9,10,11,12];function d(e){function t(t,a){return function(){if(0!==a)if(e.player.sourceFiles.some(e=>e.n===t))for(let n=0;ne.n!==t)}}function a(e){return()=>{for(let a=0;ar.a.createElement("tr",{key:"sf-"+e},r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"SF-",e,":")),r.a.createElement("td",null,r.a.createElement(h.a,null,r.a.createElement(u.a,{onClick:t(e,0)},"0"),r.a.createElement(u.a,{onClick:t(e,1)},"1"),r.a.createElement(u.a,{onClick:t(e,2)},"2"),r.a.createElement(u.a,{onClick:t(e,3)},"3")))))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(290),h=a(58),p=a(125);function d(e){const[t,a]=Object(n.useState)("NUKE.exe");return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Programs")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Program:")),r.a.createElement("td",null,r.a.createElement(m.a,{onChange:function(e){a(e.target.value)},value:t},Object.values(h.a).map(e=>r.a.createElement(p.a,{key:e.name,value:e.name},e.name))))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Add:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.hasProgram(t)||e.player.getHomeComputer().programs.push(t)}},"One"),r.a.createElement(u.a,{onClick:function(){for(const t in h.a)e.player.hasProgram(h.a[t].name)||e.player.getHomeComputer().programs.push(h.a[t].name)}},"All")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(290),h=a(32),p=a(94),d=a(38),f=a(125);function g(){const[e,t]=Object(n.useState)("home");return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Servers")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Server:")),r.a.createElement("td",{colSpan:2},r.a.createElement(m.a,{id:"dev-servers-dropdown",className:"dropdown",onChange:function(e){t(e.target.value)},value:e},Object.values(h.b).map(e=>r.a.createElement(f.a,{key:e.hostname,value:e.hostname},e.hostname))))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Root:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){const t=Object(d.a)(e);null!==t&&(t instanceof p.a||(t.hasAdminRights=!0,t.sshPortOpen=!0,t.ftpPortOpen=!0,t.smtpPortOpen=!0,t.httpPortOpen=!0,t.sqlPortOpen=!0,t.openPortCount=5))}},"Root one")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in h.b){const t=h.b[e];if(t instanceof p.a)return;t.hasAdminRights=!0,t.sshPortOpen=!0,t.ftpPortOpen=!0,t.smtpPortOpen=!0,t.httpPortOpen=!0,t.sqlPortOpen=!0,t.openPortCount=5}}},"Root all"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Security:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){const t=Object(d.a)(e);null!==t&&(t instanceof p.a||(t.hackDifficulty=t.minDifficulty))}},"Min one")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in h.b){const t=h.b[e];t instanceof p.a||(t.hackDifficulty=t.minDifficulty)}}},"Min all"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Money:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){const t=Object(d.a)(e);null!==t&&(t instanceof p.a||(t.moneyAvailable=t.moneyMax))}},"Max one")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in h.b){const t=h.b[e];t instanceof p.a||(t.moneyAvailable=t.moneyMax)}}},"Max all")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(290),h=a(51),p=a(125),d=a(120);function f(){const[e,t]=Object(n.useState)("ECorp");function a(t){return function(a){const n=h.a[e];null==n||isNaN(a)||(n.playerReputation+=a*t)}}function l(t){return function(a){const n=h.a[e];null==n||isNaN(a)||(n.favor+=a*t)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Companies")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Company:")),r.a.createElement("td",{colSpan:3},r.a.createElement(m.a,{id:"dev-companies-dropdown",className:"dropdown",onChange:function(e){t(e.target.value)},value:e},Object.values(h.a).map(e=>r.a.createElement(p.a,{key:e.name,value:e.name},e.name))))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Reputation:")),r.a.createElement("td",null,r.a.createElement(d.a,{label:"reputation",placeholder:"amt",tons:()=>a(1)(1e12),add:a(1),subtract:a(-1),reset:function(){h.a[e].playerReputation=0}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Favor:")),r.a.createElement("td",null,r.a.createElement(d.a,{label:"favor",placeholder:"amt",tons:()=>l(1)(2e3),add:l(1),subtract:l(-1),reset:function(){h.a[e].favor=0}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"All Reputation:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in h.a)h.a[e].playerReputation=1e12}},"Tons"),r.a.createElement(u.a,{onClick:function(){for(const e in h.a)h.a[e].playerReputation=0}},"Reset"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"All Favor:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in h.a)h.a[e].favor=1e12}},"Tons"),r.a.createElement(u.a,{onClick:function(){for(const e in h.a)h.a[e].favor=0}},"Reset")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(120);function m(e){function t(t){return function(a){e.player.bladeburner&&e.player.bladeburner.changeRank(e.player,a*t)}}function a(t){return function(a){e.player.bladeburner&&(e.player.bladeburner.storedCycles+=a*t)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Bladeburner")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Rank:")),r.a.createElement("td",null,r.a.createElement(u.a,{label:"rank",placeholder:"amt",tons:function(){e.player.bladeburner&&e.player.bladeburner.changeRank(e.player,1e27)},add:t(1),subtract:t(-1),reset:function(){e.player.bladeburner.rank=0,e.player.bladeburner.maxRank=0}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Cycles:")),r.a.createElement("td",null,r.a.createElement(u.a,{label:"cycles",placeholder:"amt",tons:function(){e.player.bladeburner&&(e.player.bladeburner.storedCycles+=1e27)},add:a(1),subtract:a(-1),reset:function(){e.player.bladeburner&&(e.player.bladeburner.storedCycles=0)}})))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(120);function m(e){function t(t){return function(a){e.player.gang&&(e.player.gang.storedCycles+=a*t)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Gang")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Cycles:")),r.a.createElement("td",null,r.a.createElement(u.a,{label:"cycles",placeholder:"amt",tons:function(){e.player.gang&&(e.player.gang.storedCycles=1e27)},add:t(1),subtract:t(-1),reset:function(){e.player.gang&&(e.player.gang.storedCycles=0)}})))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(120);function h(e){function t(t){return function(a){e.player.corporation&&(e.player.corporation.storedCycles+=a*t)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Corporation")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.corporation&&(e.player.corporation.funds=e.player.corporation.funds.plus(1e99))}},"Tons of funds"),r.a.createElement(u.a,{onClick:function(){e.player.corporation&&(e.player.corporation.funds=e.player.corporation.funds.minus(e.player.corporation.funds))}},"Reset funds"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Cycles:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"cycles",placeholder:"amt",tons:function(){e.player.corporation&&(e.player.corporation.storedCycles=1e27)},add:t(1),subtract:t(-1),reset:function(){e.player.corporation&&(e.player.corporation.storedCycles=0)}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.corporation&&e.player.corporation.divisions.forEach(e=>{Object.keys(e.products).forEach(t=>{const a=e.products[t];if(void 0===a)throw new Error("Impossible product undefined");a.prog=99.9})})}},"Finish products"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.corporation&&e.player.corporation.divisions.forEach(e=>{e.sciResearch.qty+=1e10})}},"Tons of research")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(290),h=a(125),p=a(310),d=a(83);function f(){const[e,t]=Object(n.useState)("Find Largest Prime Factor");return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Coding Contracts")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(u.a,{onClick:p.b},"Generate Random Contract"),r.a.createElement(u.a,{onClick:p.c},"Generate Random Contract on Home Comp"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(m.a,{onChange:function(e){t(e.target.value)},value:e},Object.values(d.d).map(e=>r.a.createElement(h.a,{key:e.name,value:e.name},e.name))),r.a.createElement(u.a,{onClick:function(){Object(p.a)({problemType:e,server:"home"})}},"Generate Specified Contract Type on Home Comp")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(329),h=a(15),p=a(11),d=a(80),f=a(112);function g(){const[e,t]=Object(n.useState)(0),[a,l]=Object(n.useState)("");function g(e){const t=a.replace(/\s/g,"");let n=()=>!0;""!==t&&"all"!==t&&(n=function(e){return t.split(",").includes(e)});for(const t in d.a)if(d.a.hasOwnProperty(t)){const a=d.a[t];a instanceof f.a&&n(a.symbol)&&e(a)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Stock Market")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Symbol:")),r.a.createElement("td",null,r.a.createElement(m.a,{placeholder:"symbol/'all'",onChange:function(e){l(e.target.value)}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Price:")),r.a.createElement("td",null,r.a.createElement(m.a,{placeholder:"$$$",onChange:function(e){t(parseFloat(e.target.value))}}),r.a.createElement(u.a,{onClick:function(){isNaN(e)||g(t=>{t.price=e})}},"Set"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Caps:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){const e=[];g(t=>{e.push(r.a.createElement("tr",{key:t.symbol},r.a.createElement("td",null,t.symbol),r.a.createElement("td",{style:{textAlign:"right"}},r.a.createElement(h.a,{money:t.cap}))))}),Object(p.a)(r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("th",null,"Stock"),r.a.createElement("th",null,"Price cap")),e)))}},"View stock caps")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37);function m(e){return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Sleeves")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Shock:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(let t=0;t{e.player.lastUpdate-=t,e.engine._lastUpdate-=t,m.b.saveGame(),setTimeout(()=>location.reload(),1e3)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Time skip")),r.a.createElement(s.a,null,r.a.createElement(u.a,{onClick:t(6e4)},"1 minute"),r.a.createElement(u.a,{onClick:t(36e5)},"1 hour"),r.a.createElement(u.a,{onClick:t(864e5)},"1 day")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(841),o=a(845),s=a(846),l=a(47);function c(e){const t=l.b.Player(),a=l.b.Router();return r.a.createElement("div",{className:"bladeburner-container"},r.a.createElement("div",{style:{height:"60%",display:"block",position:"relative"}},r.a.createElement("div",{style:{height:"100%",width:"30%",display:"inline-block",border:"1px solid white"}},r.a.createElement(i.a,{bladeburner:e.bladeburner,player:t,router:a})),r.a.createElement(o.a,{bladeburner:e.bladeburner,player:t})),r.a.createElement("div",{style:{width:"70%",display:"block",border:"1px solid white",marginTop:"6px",padding:"6px",position:"relative"}},r.a.createElement(s.a,{bladeburner:e.bladeburner,player:t})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a.n(n),i=a(14),o=a(46),s=a(15),l=a(196),c=a(3),u=a(11),m=a(22),h=a(24),p=a(97),d=a(844);function f(e){const t=Object(n.useState)(!1)[1];return Object(n.useEffect)(()=>{const e=setInterval(()=>t(e=>!e),1e3);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Rank: ",Object(i.c)(e.bladeburner.rank,2),r.a.createElement("span",{className:"tooltiptext"},"Your rank within the Bladeburner division.")),r.a.createElement("br",null),r.a.createElement("p",null,"Stamina: ",Object(i.c)(e.bladeburner.stamina,3)," / ",Object(i.c)(e.bladeburner.maxStamina,3)),r.a.createElement("div",{className:"help-tip",onClick:function(){Object(u.a)("Performing actions will use up your stamina.

Your max stamina is determined primarily by your agility stat.

Your stamina gain rate is determined by both your agility and your max stamina. Higher max stamina leads to a higher gain rate.

Once your stamina falls below 50% of its max value, it begins to negatively affect the success rate of your contracts/operations. This penalty is shown in the overview panel. If the penalty is 15%, then this means your success rate would be multipled by 85% (100 - 15).

Your max stamina and stamina gain rate can also be increased by training, or through skills and Augmentation upgrades.")}},"?"),r.a.createElement("br",null),r.a.createElement("p",null,"Stamina Penalty: ",Object(i.c)(100*(1-e.bladeburner.calculateStaminaPenalty()),1),"%"),r.a.createElement("br",null),r.a.createElement("p",null,"Team Size: ",Object(i.c)(e.bladeburner.teamSize,0)),r.a.createElement("p",null,"Team Members Lost: ",Object(i.c)(e.bladeburner.teamLost,0)),r.a.createElement("br",null),r.a.createElement("p",null,"Num Times Hospitalized: ",e.bladeburner.numHosp),r.a.createElement("p",null,"Money Lost From Hospitalizations: ",r.a.createElement(s.a,{money:e.bladeburner.moneyLost})),r.a.createElement("br",null),r.a.createElement("p",null,"Current City: ",e.bladeburner.city),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Est. Synthoid Population: ",c.a.formatPopulation(e.bladeburner.getCurrentCity().popEst),r.a.createElement("span",{className:"tooltiptext"},"This is your Bladeburner division's estimate of how many Synthoids exist in your current city.")),r.a.createElement("div",{className:"help-tip",onClick:function(){Object(u.a)("The success rate of your contracts/operations depends on the population of Synthoids in your current city. The success rate that is shown to you is only an estimate, and it is based on your Synthoid population estimate.

Therefore, it is important that this Synthoid population estimate is accurate so that you have a better idea of your success rate for contracts/operations. Certain actions will increase the accuracy of your population estimate.

The Synthoid populations of cities can change due to your actions or random events. If random events occur, they will be logged in the Bladeburner Console.")}},"?"),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Est. Synthoid Communities: ",Object(i.c)(e.bladeburner.getCurrentCity().comms,0),r.a.createElement("span",{className:"tooltiptext"},"This is your Bladeburner divison's estimate of how many Synthoid communities exist in your current city.")),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"City Chaos: ",Object(i.c)(e.bladeburner.getCurrentCity().chaos),r.a.createElement("span",{className:"tooltiptext"},"The city's chaos level due to tensions and conflicts between humans and Synthoids. Having too high of a chaos level can make contracts and operations harder.")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Bonus time:"," ",Object(i.b)(e.bladeburner.storedCycles/o.a.CyclesPerSecond*1e3),r.a.createElement("br",null),r.a.createElement("span",{className:"tooltiptext"},"You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by browser). Bonus time makes the Bladeburner mechanic progress faster, up to 5x the normal speed.")),r.a.createElement("p",null,"Skill Points: ",Object(i.c)(e.bladeburner.skillPoints,0)),r.a.createElement("br",null),r.a.createElement(l.a,{rows:[["Aug. Success Chance mult: ",Object(i.c)(100*e.player.bladeburner_success_chance_mult,1)+"%"],["Aug. Max Stamina mult: ",Object(i.c)(100*e.player.bladeburner_max_stamina_mult,1)+"%"],["Aug. Stamina Gain mult: ",Object(i.c)(100*e.player.bladeburner_stamina_gain_mult,1)+"%"],["Aug. Field Analysis mult: ",Object(i.c)(100*e.player.bladeburner_analysis_mult,1)+"%"]]}),r.a.createElement("br",null),r.a.createElement("a",{onClick:function(){const t="bladeburner-travel-popup";Object(m.a)(t,d.a,{bladeburner:e.bladeburner,popupId:t})},className:"a-link-button",style:{display:"inline-block"}},"Travel"),r.a.createElement("a",{onClick:function(){const t=h.a.Bladeburners;t.isMember?e.router.toFaction(t):e.bladeburner.rank>=o.a.RankNeededForFaction?(Object(p.d)(t),Object(u.a)("Congratulations! You were accepted into the Bladeburners faction")):Object(u.a)("You need a rank of 25 to join the Bladeburners Faction!")},className:"a-link-button tooltip",style:{display:"inline-block"}},r.a.createElement("span",{className:"tooltiptext"},"Apply to the Bladeburner Faction, or go to the faction page if you are already a member"),"Faction"),r.a.createElement("br",null),r.a.createElement("br",null))}},,,function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(22),o=a(385),s=a(23),l=a(18);function c(e){function t(t){e.bladeburner.city=t,Object(i.b)(e.popupId)}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Travel to a different city for your Bladeburner activities. This does not cost any money. The city you are in for your Bladeburner duties does not affect your location in the game otherwise."),l.a.DisableASCIIArt?Object.values(s.a).map(e=>r.a.createElement("button",{key:e,className:"std-button",onClick:()=>t(e)},e)):r.a.createElement(o.a,{currentCity:e.bladeburner.city,onTravel:e=>t(e)}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n);function i(e){return r.a.createElement("tr",null,r.a.createElement("td",{className:"bladeburner-console-line",style:{color:"var(--my-font-color)",whiteSpace:"pre-wrap"}},e.content))}function o(e){const t=Object(n.useRef)(null),a=Object(n.useState)(!1)[1],[o,s]=Object(n.useState)(e.bladeburner.consoleHistory.length);function l(){t.current&&(t.current.scrollTop=t.current.scrollHeight)}function c(){a(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(c,1e3),t=setInterval(l,100);return()=>{clearInterval(e),clearInterval(t)}},[]),r.a.createElement("div",{ref:t,className:"bladeburner-console-div"},r.a.createElement("table",{className:"bladeburner-console-table"},r.a.createElement("tbody",null,e.bladeburner.consoleLogs.map((e,t)=>r.a.createElement(i,{key:t,content:e})),r.a.createElement("tr",{key:"input",id:"bladeburner-console-input-row",className:"bladeburner-console-input-row"},r.a.createElement("td",{className:"bladeburner-console-input-cell"},r.a.createElement("pre",null,"> "),r.a.createElement("input",{autoFocus:!0,className:"bladeburner-console-input",tabIndex:1,type:"text",onKeyDown:function(t){if(13===t.keyCode){t.preventDefault();const a=t.currentTarget.value;t.currentTarget.value="",a.length>0&&(e.bladeburner.postToConsole("> "+a),e.bladeburner.executeConsoleCommands(e.player,a),s(e.bladeburner.consoleHistory.length),c())}const a=e.bladeburner.consoleHistory;if(38===t.keyCode){let e=o;const n=a.length;if(0===n)return;(e<0||e>n)&&s(n),0!==e&&(e-=1),s(e);const r=a[e];t.currentTarget.value=r}if(40===t.keyCode){const e=o,n=a.length;if(0==n)return;if((e<0||e>n)&&s(n),e==n||e==n-1)s(n),t.currentTarget.value="";else{s(o+1);const e=a[o+1];t.currentTarget.value=e}}}}))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(847),o=a(850),s=a(853),l=a(856),c=a(859),u=a(228);function m(e){const[t,a]=Object(n.useState)("General"),m=Object(n.useState)(!1)[1];function h(e){return r.a.createElement("a",{onClick:()=>a(e.name),className:t!==e.name?"bladeburner-nav-button noselect":"bladeburner-nav-button-inactive noselect"},e.name)}return Object(n.useEffect)(()=>{const e=setInterval(()=>m(e=>!e),1e3);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement(h,{name:"General"}),r.a.createElement(h,{name:"Contracts"}),r.a.createElement(h,{name:"Operations"}),r.a.createElement(h,{name:"BlackOps"}),r.a.createElement(h,{name:"Skills"}),r.a.createElement("div",{style:{display:"block",margin:"4px",padding:"4px"}},"General"===t&&r.a.createElement(i.a,{bladeburner:e.bladeburner,player:e.player}),"Contracts"===t&&r.a.createElement(o.a,{bladeburner:e.bladeburner,player:e.player}),"Operations"===t&&r.a.createElement(s.a,{bladeburner:e.bladeburner,player:e.player}),"BlackOps"===t&&r.a.createElement(l.a,{bladeburner:e.bladeburner,player:e.player}),"Skills"===t&&r.a.createElement(c.a,{bladeburner:e.bladeburner})),r.a.createElement("span",{className:"text"},u.b," = This action requires stealth, ",u.a," = This action involves retirement"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(848);function i(e){return n.createElement(n.Fragment,null,n.createElement("p",{style:{display:"block",margin:"4px",padding:"4px"}},"These are generic actions that will assist you in your Bladeburner duties. They will not affect your Bladeburner rank in any way."),n.createElement(r.a,{bladeburner:e.bladeburner,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(849),o=a(216);function s(e){const t=[];for(const e in o.a)o.a.hasOwnProperty(e)&&t.push(o.a[e]);return r.a.createElement(r.a.Fragment,null,t.map(t=>r.a.createElement("li",{key:t.name,className:"bladeburner-action"},r.a.createElement(i.a,{bladeburner:e.bladeburner,action:t,player:e.player}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(34),o=a(143),s=a(14),l=a(127);function c(e){const t=Object(n.useState)(!1)[1],a=e.action.name===e.bladeburner.action.name,c=Math.min(e.bladeburner.actionTimeCurrent+e.bladeburner.actionTimeOverflow,e.bladeburner.actionTimeToComplete),u=function(){switch(e.action.name){case"Training":case"Field Analysis":return 30;case"Diplomacy":case"Hyperbolic Regeneration Chamber":return 60;case"Recruitment":return e.bladeburner.getRecruitmentTime(e.player)}return-1}(),m="Recruitment"===e.action.name?Math.max(0,Math.min(e.bladeburner.getRecruitmentSuccessChance(e.player),1)):-1;return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",{style:{display:"inline-block"}},a?r.a.createElement(r.a.Fragment,null,r.a.createElement(l.b,{value:e.action.name})," (IN PROGRESS - ",Object(s.c)(c,0)," /"," ",Object(s.c)(e.bladeburner.actionTimeToComplete,0),")"):r.a.createElement(l.b,{value:e.action.name})),a?r.a.createElement("p",{style:{display:"block"}},Object(o.a)({progress:c/e.bladeburner.actionTimeToComplete})):r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{onClick:function(){e.bladeburner.action.type=i.a[e.action.name],e.bladeburner.action.name=e.action.name,e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},className:"a-link-button",style:{margin:"3px",padding:"3px"}},"Start")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{style:{display:"inline-block"},dangerouslySetInnerHTML:{__html:e.action.desc}}),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{style:{display:"inline-block"}},"Time Required: ",Object(s.b)(1e3*u),-1!==m&&r.a.createElement(r.a.Fragment,null,r.a.createElement("br",null),"Estimated success chance: ",Object(s.c)(100*m,1),"%")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(851);function i(e){return n.createElement(n.Fragment,null,n.createElement("p",{style:{display:"block",margin:"4px",padding:"4px"}},"Complete contracts in order to increase your Bladeburner rank and earn money. Failing a contract will cause you to lose HP, which can lead to hospitalization.",n.createElement("br",null),n.createElement("br",null),"You can unlock higher-level contracts by successfully completing them. Higher-level contracts are more difficult, but grant more rank, experience, and money."),n.createElement(r.a,{bladeburner:e.bladeburner,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(852);function o(e){const t=Object.keys(e.bladeburner.contracts),a=e.bladeburner.contracts;return r.a.createElement(r.a.Fragment,null,t.map(t=>r.a.createElement("li",{key:t,className:"bladeburner-action"},r.a.createElement(i.a,{bladeburner:e.bladeburner,action:a[t],player:e.player}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(34),o=a(143),s=a(14),l=a(228),c=a(46),u=a(386),m=a(127);function h(e){const t=Object(n.useState)(!1)[1],a=e.bladeburner.action.type===i.a.Contract&&e.action.name===e.bladeburner.action.name,h=e.action.getEstSuccessChance(e.bladeburner),p=Math.min(e.bladeburner.actionTimeCurrent+e.bladeburner.actionTimeOverflow,e.bladeburner.actionTimeToComplete),d=e.action.level>=e.action.maxLevel,f=e.action.getActionTime(e.bladeburner),g=`bladeburner-${e.action.name}-autolevel-checkbox`;return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",{style:{display:"inline-block"}},a?r.a.createElement(r.a.Fragment,null,r.a.createElement(m.b,{value:e.action.name})," (IN PROGRESS - ",Object(s.c)(p,0)," /"," ",Object(s.c)(e.bladeburner.actionTimeToComplete,0),")"):r.a.createElement(m.b,{value:e.action.name})),a?r.a.createElement("p",{style:{display:"block"}},Object(o.a)({progress:p/e.bladeburner.actionTimeToComplete})):r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{onClick:function(){e.bladeburner.action.type=i.a.Contract,e.bladeburner.action.name=e.action.name,e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},className:"a-link-button",style:{margin:"3px",padding:"3px"}},"Start")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{className:"tooltip",style:{display:"inline-block"}},r.a.createElement("span",{className:"tooltiptext"},e.action.getSuccessesNeededForNextLevel(c.a.ContractSuccessesPerLevel)," successes needed for next level"),"Level: ",e.action.level," / ",e.action.maxLevel),r.a.createElement("a",{onClick:function(){++e.action.level,a&&e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},style:{padding:"2px",margin:"2px"},className:"tooltip "+(d?"a-link-button-inactive":"a-link-button")},a&&r.a.createElement("span",{className:"tooltiptext"},"WARNING: changing the level will restart the Operation"),"↑"),r.a.createElement("a",{onClick:function(){--e.action.level,a&&e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},style:{padding:"2px",margin:"2px"},className:"tooltip "+(e.action.level<=1?"a-link-button-inactive":"a-link-button")},a&&r.a.createElement("span",{className:"tooltiptext"},"WARNING: changing the level will restart the Operation"),"↓"),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{style:{display:"inline-block"}},r.a.createElement("span",{dangerouslySetInnerHTML:{__html:e.action.desc}}),r.a.createElement("br",null),r.a.createElement("br",null),"Estimated success chance: ",r.a.createElement(u.a,{chance:h})," ",e.action.isStealth?l.b:r.a.createElement(r.a.Fragment,null),e.action.isKill?l.a:r.a.createElement(r.a.Fragment,null),r.a.createElement("br",null),"Time Required: ",Object(s.b)(1e3*f),r.a.createElement("br",null),"Contracts remaining: ",Math.floor(e.action.count),r.a.createElement("br",null),"Successes: ",e.action.successes,r.a.createElement("br",null),"Failures: ",e.action.failures),r.a.createElement("br",null),r.a.createElement("label",{className:"tooltip",style:{color:"white"},htmlFor:g},"Autolevel:",r.a.createElement("span",{className:"tooltiptext"},"Automatically increase operation level when possible")),r.a.createElement("input",{type:"checkbox",id:g,checked:e.action.autoLevel,onChange:function(a){e.action.autoLevel=a.target.checked,t(e=>!e)}}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(854);function i(e){return n.createElement(n.Fragment,null,n.createElement("p",{style:{display:"block",margin:"4px",padding:"4px"}},"Carry out operations for the Bladeburner division. Failing an operation will reduce your Bladeburner rank. It will also cause you to lose HP, which can lead to hospitalization. In general, operations are harder and more punishing than contracts, but are also more rewarding.",n.createElement("br",null),n.createElement("br",null),"Operations can affect the chaos level and Synthoid population of your current city. The exact effects vary between different Operations.",n.createElement("br",null),n.createElement("br",null),"For operations, you can use a team. You must first recruit team members. Having a larger team will improves your chances of success.",n.createElement("br",null),n.createElement("br",null),"You can unlock higher-level operations by successfully completing them. Higher-level operations are more difficult, but grant more rank and experience."),n.createElement(r.a,{bladeburner:e.bladeburner,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(855);function o(e){const t=Object.keys(e.bladeburner.operations),a=e.bladeburner.operations;return r.a.createElement(r.a.Fragment,null,t.map(t=>r.a.createElement("li",{key:t,className:"bladeburner-action"},r.a.createElement(i.a,{bladeburner:e.bladeburner,action:a[t],player:e.player}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(34),o=a(143),s=a(14),l=a(228),c=a(46),u=a(22),m=a(500),h=a(386),p=a(127);function d(e){const t=Object(n.useState)(!1)[1],a=e.bladeburner.action.type===i.a.Operation&&e.action.name===e.bladeburner.action.name,d=e.action.getEstSuccessChance(e.bladeburner),f=Math.min(e.bladeburner.actionTimeCurrent+e.bladeburner.actionTimeOverflow,e.bladeburner.actionTimeToComplete),g=e.action.level>=e.action.maxLevel,y=e.action.getActionTime(e.bladeburner),b=`bladeburner-${e.action.name}-autolevel-checkbox`;return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",{style:{display:"inline-block"}},a?r.a.createElement(r.a.Fragment,null,r.a.createElement(p.b,{value:e.action.name})," (IN PROGRESS - ",Object(s.c)(f,0)," /"," ",Object(s.c)(e.bladeburner.actionTimeToComplete,0),")"):r.a.createElement(p.b,{value:e.action.name})),a?r.a.createElement("p",{style:{display:"block"}},Object(o.a)({progress:f/e.bladeburner.actionTimeToComplete})):r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{onClick:function(){e.bladeburner.action.type=i.a.Operation,e.bladeburner.action.name=e.action.name,e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},className:"a-link-button",style:{margin:"3px",padding:"3px"}},"Start"),r.a.createElement("a",{onClick:function(){const t="bladeburner-operation-set-team-size-popup";Object(u.a)(t,m.a,{bladeburner:e.bladeburner,action:e.action,popupId:t})},style:{margin:"3px",padding:"3px"},className:"a-link-button"},"Set Team Size (Curr Size: ",Object(s.c)(e.action.teamCount,0),")")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{className:"tooltip",style:{display:"inline-block"}},r.a.createElement("span",{className:"tooltiptext"},e.action.getSuccessesNeededForNextLevel(c.a.OperationSuccessesPerLevel)," successes needed for next level"),"Level: ",e.action.level," / ",e.action.maxLevel),r.a.createElement("a",{onClick:function(){++e.action.level,a&&e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},style:{padding:"2px",margin:"2px"},className:"tooltip "+(g?"a-link-button-inactive":"a-link-button")},a&&r.a.createElement("span",{className:"tooltiptext"},"WARNING: changing the level will restart the Operation"),"↑"),r.a.createElement("a",{onClick:function(){--e.action.level,a&&e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},style:{padding:"2px",margin:"2px"},className:"tooltip "+(e.action.level<=1?"a-link-button-inactive":"a-link-button")},a&&r.a.createElement("span",{className:"tooltiptext"},"WARNING: changing the level will restart the Operation"),"↓"),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{style:{display:"inline-block"}},r.a.createElement("span",{dangerouslySetInnerHTML:{__html:e.action.desc}}),r.a.createElement("br",null),r.a.createElement("br",null),"Estimated success chance: ",r.a.createElement(h.a,{chance:d})," ",e.action.isStealth?l.b:r.a.createElement(r.a.Fragment,null),e.action.isKill?l.a:r.a.createElement(r.a.Fragment,null),r.a.createElement("br",null),"Time Required: ",Object(s.b)(1e3*y),r.a.createElement("br",null),"Operations remaining: ",Math.floor(e.action.count),r.a.createElement("br",null),"Successes: ",e.action.successes,r.a.createElement("br",null),"Failures: ",e.action.failures),r.a.createElement("br",null),r.a.createElement("label",{className:"tooltip",style:{color:"white"},htmlFor:b},"Autolevel:",r.a.createElement("span",{className:"tooltiptext"},"Automatically increase operation level when possible")),r.a.createElement("input",{type:"checkbox",id:b,checked:e.action.autoLevel,onChange:function(a){e.action.autoLevel=a.target.checked,t(e=>!e)}}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(857);function i(e){return n.createElement(n.Fragment,null,n.createElement("p",{style:{display:"block",margin:"4px",padding:"4px"}},"Black Operations (Black Ops) are special, one-time covert operations. Each Black Op must be unlocked successively by completing the one before it.",n.createElement("br",null),n.createElement("br",null),n.createElement("b",null,"Your ultimate goal to climb through the ranks of Bladeburners is to complete all of the Black Ops."),n.createElement("br",null),n.createElement("br",null),"Like normal operations, you may use a team for Black Ops. Failing a black op will incur heavy HP and rank losses."),n.createElement(r.a,{bladeburner:e.bladeburner,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(215),o=a(858);function s(e){let t=[];for(const e in i.a)i.a.hasOwnProperty(e)&&t.push(i.a[e]);return t.sort((function(e,t){return e.reqdRank-t.reqdRank})),t=t.filter((a,n)=>!(null==e.bladeburner.blackops[t[n].name]&&0!==n&&null==e.bladeburner.blackops[t[n-1].name])),t=t.reverse(),r.a.createElement(r.a.Fragment,null,t.map(t=>r.a.createElement("li",{key:t.name,className:"bladeburner-action"},r.a.createElement(o.a,{bladeburner:e.bladeburner,action:t,player:e.player}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(14),o=a(34),s=a(143),l=a(228),c=a(22),u=a(500),m=a(386),h=a(127);function p(e){const t=Object(n.useState)(!1)[1];if(null!=e.bladeburner.blackops[e.action.name])return r.a.createElement("h2",{style:{display:"block"}},e.action.name," (COMPLETED)");const a=e.bladeburner.action.type===o.a.BlackOperation&&e.action.name===e.bladeburner.action.name,p=e.action.getEstSuccessChance(e.bladeburner),d=e.action.getActionTime(e.bladeburner),f=e.bladeburner.rank>=e.action.reqdRank,g=Math.min(e.bladeburner.actionTimeCurrent+e.bladeburner.actionTimeOverflow,e.bladeburner.actionTimeToComplete);return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",{style:{display:"inline-block"}},a?r.a.createElement(r.a.Fragment,null,r.a.createElement(h.b,{value:e.action.name})," (IN PROGRESS - ",Object(i.c)(g,0)," /"," ",Object(i.c)(e.bladeburner.actionTimeToComplete,0),")"):r.a.createElement(h.b,{value:e.action.name})),a?r.a.createElement("p",{style:{display:"block"}},Object(s.a)({progress:g/e.bladeburner.actionTimeToComplete})):r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{className:f?"a-link-button":"a-link-button-inactive",style:{margin:"3px",padding:"3px"},onClick:function(){e.bladeburner.action.type=o.a.BlackOperation,e.bladeburner.action.name=e.action.name,e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)}},"Start"),r.a.createElement("a",{onClick:function(){const t="bladeburner-operation-set-team-size-popup";Object(c.a)(t,u.a,{bladeburner:e.bladeburner,action:e.action,popupId:t})},style:{margin:"3px",padding:"3px"},className:"a-link-button"},"Set Team Size (Curr Size: ",Object(i.c)(e.action.teamCount,0),")")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"inline-block"},dangerouslySetInnerHTML:{__html:e.action.desc}}),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"block",color:f?"white":"red"}},"Required Rank: ",Object(i.c)(e.action.reqdRank,0)),r.a.createElement("br",null),r.a.createElement("pre",{style:{display:"inline-block"}},"Estimated Success Chance: ",r.a.createElement(m.a,{chance:p})," ",e.action.isStealth?l.b:r.a.createElement(r.a.Fragment,null),e.action.isKill?l.a:r.a.createElement(r.a.Fragment,null),r.a.createElement("br",null),"Time Required: ",Object(i.b)(1e3*d)))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(860),o=a(46),s=a(14);function l(e){const t=Object(n.useState)(!1)[1],a=e.bladeburner.skillMultipliers;function l(e){return e&&1!==e}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("strong",null,"Skill Points: ",Object(s.c)(e.bladeburner.skillPoints,0))),r.a.createElement("p",null,"You will gain one skill point every ",o.a.RanksPerSkillPoint," ranks.",r.a.createElement("br",null),r.a.createElement("br",null),"Note that when upgrading a skill, the benefit for that skill is additive. However, the effects of different skills with each other is multiplicative.",r.a.createElement("br",null)),r.a.createElement("br",null),l(a.successChanceAll)&&r.a.createElement("p",null,"Total Success Chance: x",Object(s.c)(a.successChanceAll,3)),l(a.successChanceStealth)&&r.a.createElement("p",null,"Stealth Success Chance: x",Object(s.c)(a.successChanceStealth,3)),l(a.successChanceKill)&&r.a.createElement("p",null,"Retirement Success Chance: x",Object(s.c)(a.successChanceKill,3)),l(a.successChanceContract)&&r.a.createElement("p",null,"Contract Success Chance: x",Object(s.c)(a.successChanceContract,3)),l(a.successChanceOperation)&&r.a.createElement("p",null,"Operation Success Chance: x",Object(s.c)(a.successChanceOperation,3)),l(a.successChanceEstimate)&&r.a.createElement("p",null,"Synthoid Data Estimate: x",Object(s.c)(a.successChanceEstimate,3)),l(a.actionTime)&&r.a.createElement("p",null,"Action Time: x",Object(s.c)(a.actionTime,3)),l(a.effHack)&&r.a.createElement("p",null,"Hacking Skill: x",Object(s.c)(a.effHack,3)),l(a.effStr)&&r.a.createElement("p",null,"Strength: x",Object(s.c)(a.effStr,3)),l(a.effDef)&&r.a.createElement("p",null,"Defense: x",Object(s.c)(a.effDef,3)),l(a.effDex)&&r.a.createElement("p",null,"Dexterity: x",Object(s.c)(a.effDex,3)),l(a.effAgi)&&r.a.createElement("p",null,"Agility: x",Object(s.c)(a.effAgi,3)),l(a.effCha)&&r.a.createElement("p",null,"Charisma: x",Object(s.c)(a.effCha,3)),l(a.effInt)&&r.a.createElement("p",null,"Intelligence: x",Object(s.c)(a.effInt,3)),l(a.stamina)&&r.a.createElement("p",null,"Stamina: x",Object(s.c)(a.stamina,3)),l(a.money)&&r.a.createElement("p",null,"Contract Money: x",Object(s.c)(a.money,3)),l(a.expGain)&&r.a.createElement("p",null,"Exp Gain: x",Object(s.c)(a.expGain,3)),r.a.createElement("br",null),r.a.createElement(i.a,{bladeburner:e.bladeburner,onUpgrade:()=>t(e=>!e)}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a(861),i=a(200);function o(e){return n.createElement(n.Fragment,null,Object.keys(i.a).map(t=>n.createElement("li",{key:t,className:"bladeburner-action"},n.createElement(r.a,{bladeburner:e.bladeburner,skill:i.a[t],onUpgrade:e.onUpgrade}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(127),o=a(14);function s(e){const t=e.skill.name;let a=0;e.bladeburner.skills[t]&&!isNaN(e.bladeburner.skills[t])&&(a=e.bladeburner.skills[t]);const n=e.skill.calculateCost(a),s=e.bladeburner.skillPoints>=n,l=!!e.skill.maxLvl&&a>=e.skill.maxLvl;return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",{style:{display:"inline-block"}},r.a.createElement(i.b,{value:e.skill.name})),r.a.createElement("a",{onClick:function(){e.bladeburner.skillPoints{const e=setInterval(()=>m(e=>!e),1e3);return()=>clearInterval(e)},[]),r.a.createElement("div",{className:"gang-container"},r.a.createElement("a",{className:"a-link-button",style:{display:"inline-block"},onClick:function(){a.toFaction(l.a[e.gang.facName])}},"Back"),r.a.createElement("a",{className:c?"a-link-button-inactive":"a-link-button",style:{display:"inline-block"},onClick:()=>u(!0)},"Gang Management"),r.a.createElement("a",{className:c?"a-link-button":"a-link-button-inactive",style:{display:"inline-block"},onClick:()=>u(!1)},"Gang Territory"),c?r.a.createElement(i.a,{gang:e.gang,player:t}):r.a.createElement(o.a,{gang:e.gang}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(864),o=a(866);function s(e){return r.a.createElement("div",{style:{display:"block"}},r.a.createElement("p",{className:"noselect",style:{width:"70%"}},"This page is used to manage your gang members and get an overview of your gang's stats.",r.a.createElement("br",null),r.a.createElement("br",null),"If a gang member is not earning much money or respect, the task that you have assigned to that member might be too difficult. Consider training that member's stats or choosing an easier task. The tasks closer to the top of the dropdown list are generally easier. Alternatively, the gang member's low production might be due to the fact that your wanted level is too high. Consider assigning a few members to the '",e.gang.isHackingGang?"Ethical Hacking":"Vigilante Justice","' task to lower your wanted level.",r.a.createElement("br",null),r.a.createElement("br",null),"Installing Augmentations does NOT reset your progress with your Gang. Furthermore, after installing Augmentations, you will automatically be a member of whatever Faction you created your gang with.",r.a.createElement("br",null),r.a.createElement("br",null),"You can also manage your gang programmatically through Netscript using the Gang API"),r.a.createElement("br",null),r.a.createElement(i.a,{gang:e.gang}),r.a.createElement("br",null),r.a.createElement(o.a,{gang:e.gang,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(24),o=a(14),s=a(3),l=a(138),c=a(81),u=a(67),m=a(865);function h(e){const t=100*u.a[e.gang.facName].territory;let a;return a=t<=0?Object(o.c)(0,2):t>=100?Object(o.c)(100,2):Object(o.c)(t,2),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Respect: ",s.a.formatRespect(e.gang.respect)," (",s.a.formatRespect(5*e.gang.respectGainRate)," / sec)",r.a.createElement("span",{className:"tooltiptext"},"Represents the amount of respect your gang has from other gangs and criminal organizations. Your respect affects the amount of money your gang members will earn, and also determines how much reputation you are earning with your gang's corresponding Faction.")),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Wanted Level: ",s.a.formatWanted(e.gang.wanted)," (",s.a.formatWanted(5*e.gang.wantedGainRate)," / sec)",r.a.createElement("span",{className:"tooltiptext"},"Represents how much the gang is wanted by law enforcement. The higher your gang's wanted level, the harder it will be for your gang members to make money and earn respect. Note that the minimum wanted level is 1.")),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Wanted Level Penalty: -",Object(o.c)(100*(1-e.gang.getWantedPenalty()),2),"%",r.a.createElement("span",{className:"tooltiptext"},"Penalty for respect and money gain rates due to Wanted Level")),r.a.createElement("br",null),r.a.createElement("div",null,r.a.createElement("p",{style:{display:"inline-block"}},"Money gain rate: ",r.a.createElement(l.a,{money:5*e.gang.moneyGainRate}))),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Territory: ",a,"%",r.a.createElement("span",{className:"tooltiptext"},"The percentage of total territory your Gang controls")),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"inline-block"}},"Faction reputation: ",Object(c.a)(i.a[e.gang.facName].playerReputation)),r.a.createElement("br",null),r.a.createElement(m.a,{gang:e.gang}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a(4),i=a(14);function o(e){const t=1e3/r.a._idleSpeed;if(e.gang.storedCycles/t*1e3<=5e3)return n.createElement(n.Fragment,null);const a=e.gang.storedCycles/t*1e3;return n.createElement(n.Fragment,null,n.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Bonus time: ",Object(i.b)(a),n.createElement("span",{className:"tooltiptext noselect"},"You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by the browser). Bonus time makes the Gang mechanic progress faster, up to 5x the normal speed.")),n.createElement("br",null))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(867),o=a(869),s=a(22),l=a(876);function c(e){const[t,a]=Object(n.useState)(""),c=Object(n.useState)(!1)[1];const u=e.gang.members.filter(e=>e.name.indexOf(t)>-1||e.task.indexOf(t)>-1);return r.a.createElement(r.a.Fragment,null,r.a.createElement(l.a,{onRecruit:()=>c(e=>!e),gang:e.gang}),r.a.createElement("br",null),r.a.createElement("input",{className:"text-input noselect",placeholder:"Filter gang member",style:{margin:"5px",padding:"5px"},value:t,onChange:function(e){a(e.target.value)}}),r.a.createElement("a",{className:"a-link-button",style:{display:"inline-block"},onClick:function(){Object(s.a)("gang-upgrade-popup",i.a,{gang:e.gang,player:e.player,popupId:"gang-upgrade-popup"})}},"Manage Equipment"),r.a.createElement("ul",null,u.map(t=>r.a.createElement("li",{key:t.name},r.a.createElement(o.a,{gang:e.gang,member:t})))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(14),o=a(3),s=a(167),l=a(15),c=a(22),u=a(136);function m(e){const t=Object.keys(s.a).filter(t=>{const a=s.a[t];return!e.player.money.gt(e.gang.getUpgradeCost(a))&&(a.type===e.type&&!e.upgrades.includes(t))}).map(e=>s.a[e]);return 0===t.length?r.a.createElement(r.a.Fragment,null):r.a.createElement("p",null,"Next at ",r.a.createElement(l.a,{money:t[0].cost}))}function h(e){const t=Object(n.useState)(!1)[1];function a(t,a){return Object.keys(s.a).filter(n=>{const r=s.a[n];return!e.player.money.lt(e.gang.getUpgradeCost(r))&&(r.type===a&&!t.includes(n))}).map(e=>s.a[e])}const o=a(e.member.upgrades,u.a.Weapon),c=a(e.member.upgrades,u.a.Armor),h=a(e.member.upgrades,u.a.Vehicle),p=a(e.member.upgrades,u.a.Rootkit),d=a(e.member.augmentations,u.a.Augmentation);function f(e){const t=s.a[e];return r.a.createElement("div",{key:e,className:"gang-owned-upgrade tooltip"},t.name,r.a.createElement("span",{className:"tooltiptext",dangerouslySetInnerHTML:{__html:t.desc}}))}function g(a,n=!1){return r.a.createElement("a",{key:a.name,className:"a-link-button tooltip",style:{margin:"2px",padding:"2px",display:"block",fontSize:"11px"},onClick:function(){e.member.buyUpgrade(a,e.player,e.gang),t(e=>!e)}},a.name," - ",r.a.createElement(l.a,{money:e.gang.getUpgradeCost(a),player:e.player}),r.a.createElement("span",{className:n?"tooltiptextleft":"tooltiptext",dangerouslySetInnerHTML:{__html:a.desc}}))}const y=e.member.calculateAscensionMult(e.member.hack_asc_points),b=e.member.calculateAscensionMult(e.member.str_asc_points),E=e.member.calculateAscensionMult(e.member.def_asc_points),v=e.member.calculateAscensionMult(e.member.dex_asc_points),k=e.member.calculateAscensionMult(e.member.agi_asc_points),_=e.member.calculateAscensionMult(e.member.cha_asc_points);return r.a.createElement("div",{style:{border:"1px solid white"}},r.a.createElement("h1",null,e.member.name,"(",e.member.task,")"),r.a.createElement("pre",{style:{fontSize:"14px",display:"inline-block",width:"20%"}},"Hack: ",e.member.hack," (x",Object(i.c)(e.member.hack_mult*y,2),")",r.a.createElement("br",null),"Str: ",e.member.str," (x",Object(i.c)(e.member.str_mult*b,2),")",r.a.createElement("br",null),"Def: ",e.member.def," (x",Object(i.c)(e.member.def_mult*E,2),")",r.a.createElement("br",null),"Dex: ",e.member.dex," (x",Object(i.c)(e.member.dex_mult*v,2),")",r.a.createElement("br",null),"Agi: ",e.member.agi," (x",Object(i.c)(e.member.agi_mult*k,2),")",r.a.createElement("br",null),"Cha: ",e.member.cha," (x",Object(i.c)(e.member.cha_mult*_,2),")"),r.a.createElement("div",{className:"gang-owned-upgrades-div noselect"},"Purchased Upgrades: ",e.member.upgrades.map(e=>f(e)),e.member.augmentations.map(e=>f(e))),r.a.createElement("div",{className:"noselect",style:{width:"20%",display:"inline-block"}},r.a.createElement("h2",null,"Weapons"),o.map(e=>g(e)),r.a.createElement(m,{gang:e.gang,type:u.a.Weapon,player:e.player,upgrades:e.member.upgrades})),r.a.createElement("div",{className:"noselect",style:{width:"20%",display:"inline-block"}},r.a.createElement("h2",null,"Armor"),c.map(e=>g(e)),r.a.createElement(m,{gang:e.gang,type:u.a.Armor,player:e.player,upgrades:e.member.upgrades})),r.a.createElement("div",{className:"noselect",style:{width:"20%",display:"inline-block"}},r.a.createElement("h2",null,"Vehicles"),h.map(e=>g(e)),r.a.createElement(m,{gang:e.gang,type:u.a.Vehicle,player:e.player,upgrades:e.member.upgrades})),r.a.createElement("div",{className:"noselect",style:{width:"20%",display:"inline-block"}},r.a.createElement("h2",null,"Rootkits"),p.map(e=>g(e,!0)),r.a.createElement(m,{gang:e.gang,type:u.a.Rootkit,player:e.player,upgrades:e.member.upgrades})),r.a.createElement("div",{className:"noselect",style:{width:"20%",display:"inline-block"}},r.a.createElement("h2",null,"Augmentations"),d.map(e=>g(e,!0)),r.a.createElement(m,{gang:e.gang,type:u.a.Augmentation,player:e.player,upgrades:e.member.upgrades})))}function p(e){const t=Object(n.useState)(!1)[1],[a,i]=Object(n.useState)("");function s(t){27===t.keyCode&&Object(c.b)(e.popupId)}return Object(n.useEffect)(()=>{window.addEventListener("keydown",s);const e=setInterval(()=>t(e=>!e),1e3);return()=>{clearInterval(e),window.removeEventListener("keydown",s)}},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement("input",{className:"text-input noselect",value:a,placeholder:"Filter gang member",onChange:e=>i(e.target.value)}),r.a.createElement("p",{className:"tooltip",style:{marginLeft:"6px",display:"inline-block"}},"Discount: -",o.a.formatPercentage(1-1/e.gang.getDiscount()),r.a.createElement("span",{className:"tooltiptext noselect"},"You get a discount on equipment and upgrades based on your gang's respect and power. More respect and power leads to more discounts.")),e.gang.members.map(t=>r.a.createElement(h,{key:t.name,player:e.player,gang:e.gang,member:t})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(136),r=a(3);class i{constructor(e="",t=0,a=n.a.Weapon,r={}){this.name=e,this.cost=t,this.type=a,this.mults=r,this.desc=this.createDescription()}createDescription(){const e=["Effects:"];return null!=this.mults.str&&(e.push(`+${r.a.formatPercentage(this.mults.str-1,0)} strength skill`),e.push(`+${r.a.formatPercentage((this.mults.str-1)/4,2)} strength exp`)),null!=this.mults.def&&(e.push(`+${r.a.formatPercentage(this.mults.def-1,0)} defense skill`),e.push(`+${r.a.formatPercentage((this.mults.def-1)/4,2)} defense exp`)),null!=this.mults.dex&&(e.push(`+${r.a.formatPercentage(this.mults.dex-1,0)} dexterity skill`),e.push(`+${r.a.formatPercentage((this.mults.dex-1)/4,2)} dexterity exp`)),null!=this.mults.agi&&(e.push(`+${r.a.formatPercentage(this.mults.agi-1,0)} agility skill`),e.push(`+${r.a.formatPercentage((this.mults.agi-1)/4,2)} agility exp`)),null!=this.mults.cha&&(e.push(`+${r.a.formatPercentage(this.mults.cha-1,0)} charisma skill`),e.push(`+${r.a.formatPercentage((this.mults.cha-1)/4,2)} charisma exp`)),null!=this.mults.hack&&(e.push(`+${r.a.formatPercentage(this.mults.hack-1,0)} hacking skill`),e.push(`+${r.a.formatPercentage((this.mults.hack-1)/4,2)} hacking exp`)),e.join("
")}getType(){switch(this.type){case n.a.Weapon:return"Weapon";case n.a.Armor:return"Armor";case n.a.Vehicle:return"Vehicle";case n.a.Rootkit:return"Rootkit";case n.a.Augmentation:return"Augmentation";default:return""}}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(234),o=a(870);function s(e){return r.a.createElement(i.a,{panelInitiallyOpened:!0,headerContent:r.a.createElement(r.a.Fragment,null,e.member.name),panelContent:r.a.createElement(o.a,{gang:e.gang,member:e.member})})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(871),o=a(873),s=a(874);function l(e){const t=Object(n.useState)(!1)[1];return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"gang-member-info-div tooltip"},r.a.createElement(i.a,{onAscend:()=>t(e=>!e),gang:e.gang,member:e.member})),r.a.createElement("div",{className:"gang-member-info-div"},r.a.createElement(o.a,{onTaskChange:()=>t(e=>!e),gang:e.gang,member:e.member})),r.a.createElement("div",{className:"gang-member-info-div"},r.a.createElement(s.a,{member:e.member})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(11),o=a(14),s=a(3),l=a(22),c=a(872);function u(e){const t={hack:e.member.calculateAscensionMult(e.member.hack_asc_points),str:e.member.calculateAscensionMult(e.member.str_asc_points),def:e.member.calculateAscensionMult(e.member.def_asc_points),dex:e.member.calculateAscensionMult(e.member.dex_asc_points),agi:e.member.calculateAscensionMult(e.member.agi_asc_points),cha:e.member.calculateAscensionMult(e.member.cha_asc_points)};return r.a.createElement(r.a.Fragment,null,r.a.createElement("span",{className:"tooltiptext smallfont"},"Hk: x",s.a.formatMultiplier(e.member.hack_mult*t.hack),"(x",s.a.formatMultiplier(e.member.hack_mult)," Eq, x",s.a.formatMultiplier(t.hack)," Asc)",r.a.createElement("br",null),"St: x",s.a.formatMultiplier(e.member.str_mult*t.str),"(x",s.a.formatMultiplier(e.member.str_mult)," Eq, x",s.a.formatMultiplier(t.str)," Asc)",r.a.createElement("br",null),"Df: x",s.a.formatMultiplier(e.member.def_mult*t.def),"(x",s.a.formatMultiplier(e.member.def_mult)," Eq, x",s.a.formatMultiplier(t.def)," Asc)",r.a.createElement("br",null),"Dx: x",s.a.formatMultiplier(e.member.dex_mult*t.dex),"(x",s.a.formatMultiplier(e.member.dex_mult)," Eq, x",s.a.formatMultiplier(t.dex)," Asc)",r.a.createElement("br",null),"Ag: x",s.a.formatMultiplier(e.member.agi_mult*t.agi),"(x",s.a.formatMultiplier(e.member.agi_mult)," Eq, x",s.a.formatMultiplier(t.agi)," Asc)",r.a.createElement("br",null),"Ch: x",s.a.formatMultiplier(e.member.cha_mult*t.cha),"(x",s.a.formatMultiplier(e.member.cha_mult)," Eq, x",s.a.formatMultiplier(t.cha)," Asc)"),r.a.createElement("pre",null,"Hacking: ",Object(o.c)(e.member.hack,0)," (",s.a.formatExp(e.member.hack_exp)," exp)",r.a.createElement("br",null),"Strength: ",Object(o.c)(e.member.str,0)," (",s.a.formatExp(e.member.str_exp)," exp)",r.a.createElement("br",null),"Defense: ",Object(o.c)(e.member.def,0)," (",s.a.formatExp(e.member.def_exp)," exp)",r.a.createElement("br",null),"Dexterity: ",Object(o.c)(e.member.dex,0)," (",s.a.formatExp(e.member.dex_exp)," exp)",r.a.createElement("br",null),"Agility: ",Object(o.c)(e.member.agi,0)," (",s.a.formatExp(e.member.agi_exp)," exp)",r.a.createElement("br",null),"Charisma: ",Object(o.c)(e.member.cha,0)," (",s.a.formatExp(e.member.cha_exp)," exp)",r.a.createElement("br",null)),r.a.createElement("br",null),e.member.canAscend()&&r.a.createElement(r.a.Fragment,null,r.a.createElement("button",{className:"accordion-button noselect",onClick:function(){const t="gang-management-ascend-member "+e.member.name;Object(l.a)(t,c.a,{member:e.member,gang:e.gang,popupId:t,onAscend:e.onAscend})}},"Ascend"),r.a.createElement("div",{className:"help-tip noselect",style:{marginTop:"5px"},onClick:function(){Object(i.a)(r.a.createElement(r.a.Fragment,null,"Ascending a Gang Member resets the member's progress and stats in exchange for a permanent boost to their stat multipliers.",r.a.createElement("br",null),r.a.createElement("br",null),"The additional stat multiplier that the Gang Member gains upon ascension is based on the amount of exp they have.",r.a.createElement("br",null),r.a.createElement("br",null),"Upon ascension, the member will lose all of its non-Augmentation Equipment and your gang will lose respect equal to the total respect earned by the member."))}},"?")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(3),o=a(22),s=a(11);function l(e){const t=Object(n.useState)(!1)[1];Object(n.useEffect)(()=>{const e=setInterval(()=>t(e=>!e),1e3);return()=>clearInterval(e)},[]);const a=e.member.getCurrentAscensionMults(),l=e.member.getAscensionMultsAfterAscend();return r.a.createElement(r.a.Fragment,null,r.a.createElement("pre",null,"Are you sure you want to ascend this member? They will lose all of",r.a.createElement("br",null),"their non-Augmentation upgrades and their stats will reset back to 1.",r.a.createElement("br",null),r.a.createElement("br",null),"Furthermore, your gang will lose ",i.a.formatRespect(e.member.earnedRespect)," respect",r.a.createElement("br",null),r.a.createElement("br",null),"In return, they will gain the following permanent boost to stat multipliers:",r.a.createElement("br",null),"Hacking: x",i.a.format(a.hack,"0.000")," => x",i.a.format(l.hack,"0.000"),r.a.createElement("br",null),"Strength: x",i.a.format(a.str,"0.000")," => x",i.a.format(l.str,"0.000"),r.a.createElement("br",null),"Defense: x",i.a.format(a.def,"0.000")," => x",i.a.format(l.def,"0.000"),r.a.createElement("br",null),"Dexterity: x",i.a.format(a.dex,"0.000")," => x",i.a.format(l.dex,"0.000"),r.a.createElement("br",null),"Agility: x",i.a.format(a.agi,"0.000")," => x",i.a.format(l.agi,"0.000"),r.a.createElement("br",null),"Charisma: x",i.a.format(a.cha,"0.000")," => x",i.a.format(l.cha,"0.000"),r.a.createElement("br",null)),r.a.createElement("button",{className:"std-button",onClick:function(){e.onAscend();const t=e.gang.ascendMember(e.member);Object(s.a)(r.a.createElement("p",null,"You ascended ",e.member.name,"!",r.a.createElement("br",null),r.a.createElement("br",null),"Your gang lost ",i.a.formatRespect(t.respect)," respect.",r.a.createElement("br",null),r.a.createElement("br",null),e.member.name," gained the following stat multipliers for ascending:",r.a.createElement("br",null),"Hacking: x",i.a.format(t.hack,"0.000"),r.a.createElement("br",null),"Strength: x",i.a.format(t.str,"0.000"),r.a.createElement("br",null),"Defense: x",i.a.format(t.def,"0.000"),r.a.createElement("br",null),"Dexterity: x",i.a.format(t.dex,"0.000"),r.a.createElement("br",null),"Agility: x",i.a.format(t.agi,"0.000"),r.a.createElement("br",null),"Charisma: x",i.a.format(t.cha,"0.000"),r.a.createElement("br",null))),Object(o.b)(e.popupId)}},"Ascend"),r.a.createElement("button",{className:"std-button",onClick:function(){Object(o.b)(e.popupId)}},"Cancel"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(3),o=a(196),s=a(138);function l(e){const[t,a]=Object(n.useState)(e.member.task);const l=e.gang.getAllTaskNames(),c=[["Money:",r.a.createElement(s.a,{money:5*e.member.calculateMoneyGain(e.gang)})],["Respect:",i.a.formatRespect(5*e.member.calculateRespectGain(e.gang))+" / sec"],["Wanted Level:",i.a.formatWanted(5*e.member.calculateWantedLevelGain(e.gang))+" / sec"],["Total Respect:",""+i.a.formatRespect(e.member.earnedRespect)]];return r.a.createElement(r.a.Fragment,null,r.a.createElement("select",{onChange:function(t){const n=t.target.value;e.member.assignToTask(n),a(n),e.onTaskChange()},className:"dropdown noselect",value:t},r.a.createElement("option",{key:0,value:"---"},"---"),l.map((e,t)=>r.a.createElement("option",{key:t+1,value:e},e))),r.a.createElement("div",null,r.a.createElement(o.a,{rows:c})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(190);function o(e){const t=i.a[e.member.task],a=t?t.desc:i.a.Unassigned.desc;return r.a.createElement("p",{className:"inline noselect",dangerouslySetInnerHTML:{__html:a}})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));const n=[{desc:"This gang member is currently idle",isCombat:!0,isHacking:!0,name:"Unassigned",params:{hackWeight:100}},{desc:"Assign this gang member to create and distribute ransomware

Earns money - Slightly increases respect - Slightly increases wanted level",isCombat:!1,isHacking:!0,name:"Ransomware",params:{baseRespect:5e-5,baseWanted:1e-4,baseMoney:1,hackWeight:100,difficulty:1}},{desc:"Assign this gang member to attempt phishing scams and attacks

Earns money - Slightly increases respect - Slightly increases wanted level",isCombat:!1,isHacking:!0,name:"Phishing",params:{baseRespect:8e-5,baseWanted:.003,baseMoney:2.5,hackWeight:85,chaWeight:15,difficulty:3.5}},{desc:"Assign this gang member to attempt identity theft

Earns money - Increases respect - Increases wanted level",isCombat:!1,isHacking:!0,name:"Identity Theft",params:{baseRespect:1e-4,baseWanted:.075,baseMoney:6,hackWeight:80,chaWeight:20,difficulty:5}},{desc:"Assign this gang member to carry out DDoS attacks

Increases respect - Increases wanted level",isCombat:!1,isHacking:!0,name:"DDoS Attacks",params:{baseRespect:4e-4,baseWanted:.2,hackWeight:100,difficulty:8}},{desc:"Assign this gang member to create and distribute malicious viruses

Increases respect - Increases wanted level",isCombat:!1,isHacking:!0,name:"Plant Virus",params:{baseRespect:6e-4,baseWanted:.4,hackWeight:100,difficulty:12}},{desc:"Assign this gang member to commit financial fraud and digital counterfeiting

Earns money - Slightly increases respect - Slightly increases wanted level",isCombat:!1,isHacking:!0,name:"Fraud & Counterfeiting",params:{baseRespect:4e-4,baseWanted:.3,baseMoney:15,hackWeight:80,chaWeight:20,difficulty:20}},{desc:"Assign this gang member to launder money

Earns money - Increases respect - Increases wanted level",isCombat:!1,isHacking:!0,name:"Money Laundering",params:{baseRespect:.001,baseWanted:1.25,baseMoney:120,hackWeight:75,chaWeight:25,difficulty:25}},{desc:"Assign this gang member to commit acts of cyberterrorism

Greatly increases respect - Greatly increases wanted level",isCombat:!1,isHacking:!0,name:"Cyberterrorism",params:{baseRespect:.01,baseWanted:6,hackWeight:80,chaWeight:20,difficulty:36}},{desc:"Assign this gang member to be an ethical hacker for corporations

Earns money - Lowers wanted level",isCombat:!1,isHacking:!0,name:"Ethical Hacking",params:{baseWanted:-.001,baseMoney:1,hackWeight:90,chaWeight:10,difficulty:1}},{desc:"Assign this gang member to mug random people on the streets

Earns money - Slightly increases respect - Very slightly increases wanted level",isCombat:!0,isHacking:!1,name:"Mug People",params:{baseRespect:5e-5,baseWanted:5e-5,baseMoney:1.2,strWeight:25,defWeight:25,dexWeight:25,agiWeight:10,chaWeight:15,difficulty:1}},{desc:"Assign this gang member to sell drugs

Earns money - Slightly increases respect - Slightly increases wanted level - Scales slightly with territory",isCombat:!0,isHacking:!1,name:"Deal Drugs",params:{baseRespect:6e-5,baseWanted:.002,baseMoney:5,agiWeight:20,dexWeight:20,chaWeight:60,difficulty:3.5,territory:{money:1.2,respect:1,wanted:1.15}}},{desc:"Assign this gang member to extort civilians in your territory

Earns money - Slightly increases respect - Increases wanted - Scales heavily with territory",isCombat:!0,isHacking:!1,name:"Strongarm Civilians",params:{baseRespect:4e-5,baseWanted:.02,baseMoney:2.5,hackWeight:10,strWeight:25,defWeight:25,dexWeight:20,agiWeight:10,chaWeight:10,difficulty:5,territory:{money:1.6,respect:1.1,wanted:1.5}}},{desc:"Assign this gang member to run cons

Earns money - Increases respect - Increases wanted level",isCombat:!0,isHacking:!1,name:"Run a Con",params:{baseRespect:12e-5,baseWanted:.05,baseMoney:15,strWeight:5,defWeight:5,agiWeight:25,dexWeight:25,chaWeight:40,difficulty:14}},{desc:"Assign this gang member to commit armed robbery on stores, banks and armored cars

Earns money - Increases respect - Increases wanted level",isCombat:!0,isHacking:!1,name:"Armed Robbery",params:{baseRespect:14e-5,baseWanted:.1,baseMoney:38,hackWeight:20,strWeight:15,defWeight:15,agiWeight:10,dexWeight:20,chaWeight:20,difficulty:20}},{desc:"Assign this gang member to traffick illegal arms

Earns money - Increases respect - Increases wanted level - Scales heavily with territory",isCombat:!0,isHacking:!1,name:"Traffick Illegal Arms",params:{baseRespect:2e-4,baseWanted:.24,baseMoney:58,hackWeight:15,strWeight:20,defWeight:20,dexWeight:20,chaWeight:25,difficulty:32,territory:{money:1.4,respect:1.3,wanted:1.25}}},{desc:"Assign this gang member to threaten and black mail high-profile targets

Earns money - Slightly increases respect - Slightly increases wanted level",isCombat:!0,isHacking:!1,name:"Threaten & Blackmail",params:{baseRespect:2e-4,baseWanted:.125,baseMoney:24,hackWeight:25,strWeight:25,dexWeight:25,chaWeight:25,difficulty:28}},{desc:"Assign this gang member to engage in human trafficking operations

Earns money - Increases respect - Increases wanted level - Scales heavily with territory",isCombat:!0,isHacking:!1,name:"Human Trafficking",params:{baseRespect:.004,baseWanted:1.25,baseMoney:120,hackWeight:30,strWeight:5,defWeight:5,dexWeight:30,chaWeight:30,difficulty:36,territory:{money:1.5,respect:1.5,wanted:1.6}}},{desc:"Assign this gang member to commit acts of terrorism

Greatly increases respect - Greatly increases wanted level - Scales heavily with territory",isCombat:!0,isHacking:!1,name:"Terrorism",params:{baseRespect:.01,baseWanted:6,hackWeight:20,strWeight:20,defWeight:20,dexWeight:20,chaWeight:20,difficulty:36,territory:{money:1,respect:2,wanted:2}}},{desc:"Assign this gang member to be a vigilante and protect the city from criminals

Decreases wanted level",isCombat:!0,isHacking:!0,name:"Vigilante Justice",params:{baseWanted:-.001,hackWeight:20,strWeight:20,defWeight:20,dexWeight:20,agiWeight:20,difficulty:1,territory:{money:1,respect:1,wanted:.9}}},{desc:"Assign this gang member to increase their combat stats (str, def, dex, agi)",isCombat:!0,isHacking:!0,name:"Train Combat",params:{strWeight:25,defWeight:25,dexWeight:25,agiWeight:25,difficulty:100}},{desc:"Assign this gang member to train their hacking skills",isCombat:!0,isHacking:!0,name:"Train Hacking",params:{hackWeight:100,difficulty:45}},{desc:"Assign this gang member to train their charisma",isCombat:!0,isHacking:!0,name:"Train Charisma",params:{chaWeight:100,difficulty:8}},{desc:"Assign this gang member to engage in territorial warfare with other gangs. Members assigned to this task will help increase your gang's territory and will defend your territory from being taken.",isCombat:!0,isHacking:!0,name:"Territory Warfare",params:{hackWeight:15,strWeight:20,defWeight:20,dexWeight:20,agiWeight:20,chaWeight:5,difficulty:5}}]},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(877),o=a(243),s=a(14),l=a(22);function c(e){if(e.gang.members.length>=o.a.MaximumGangMembers)return r.a.createElement(r.a.Fragment,null);if(!e.gang.canRecruitMember()){const t=e.gang.getRespectNeededToRecruitMember();return r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{className:"a-link-button-inactive",style:{display:"inline-block",margin:"10px"}},"Recruit Gang Member"),r.a.createElement("p",{style:{margin:"10px",color:"red",display:"inline-block"}},Object(s.c)(t,2)," respect needed to recruit next member"))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{className:"a-link-button",onClick:function(){const t="recruit-gang-member-popup";Object(l.a)(t,i.a,{gang:e.gang,popupId:t,onRecruit:e.onRecruit})},style:{display:"inline-block",margin:"10px"}},"Recruit Gang Member"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(22),o=a(11);function s(e){const[t,a]=Object(n.useState)("");function s(){""!==t?e.gang.canRecruitMember()?e.gang.recruitMember(t)?(e.onRecruit(),Object(i.b)(e.popupId)):Object(o.a)("You already have a gang member with this name!"):Object(o.a)("You cannot recruit another Gang member!"):Object(o.a)("You must enter a name for your Gang member!")}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"noselect"},"Enter a name for your new Gang member:"),r.a.createElement("br",null),r.a.createElement("input",{autoFocus:!0,onKeyUp:function(e){13===e.keyCode&&s()},onChange:function(e){a(e.target.value)},className:"text-input noselect",type:"text",placeholder:"unique name"}),r.a.createElement("a",{className:"std-button",onClick:s},"Recruit Gang Member"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(3),o=a(11),s=a(14),l=a(67);function c(e){function t(e){const t=100*e;return t<=0?Object(s.c)(0,2):t>=100?Object(s.c)(100,2):Object(s.c)(t,2)}const a=l.a[e.gang.facName].power;const n=Object.keys(l.a).filter(t=>t!=e.gang.facName);return r.a.createElement("div",{style:{width:"70%"}},r.a.createElement("p",{className:"noselect"},"This page shows how much territory your Gang controls. This statistic is listed as a percentage, which represents how much of the total territory you control.",r.a.createElement("br",null),r.a.createElement("br",null),"Every ~20 seconds, your gang has a chance to 'clash' with other gangs. Your chance to win a clash depends on your gang's power, which is listed in the display below. Your gang's power slowly accumulates over time. The accumulation rate is determined by the stats of all Gang members you have assigned to the 'Territory Warfare' task. Gang members that are not assigned to this task do not contribute to your gang's power. Your gang also loses a small amount of power whenever you lose a clash.",r.a.createElement("br",null),r.a.createElement("br",null),"NOTE: Gang members assigned to 'Territory Warfare' can be killed during clashes. This can happen regardless of whether you win or lose the clash. A gang member being killed results in both respect and power loss for your gang.",r.a.createElement("br",null),r.a.createElement("br",null),"The amount of territory you have affects all aspects of your Gang members' production, including money, respect, and wanted level. It is very beneficial to have high territory control.",r.a.createElement("br",null),r.a.createElement("br",null)),r.a.createElement("input",{checked:e.gang.territoryWarfareEngaged,id:"warfare",type:"checkbox",style:{display:"inline-block",margin:"2px"},onChange:t=>e.gang.territoryWarfareEngaged=t.target.checked}),r.a.createElement("label",{htmlFor:"warfare",className:"tooltip noselect",style:{color:"white",display:"inline-block"}},"Engage in Territory Warfare",r.a.createElement("span",{className:"tooltiptext",style:{display:"inline-block"}},"Engaging in Territory Warfare sets your clash chance to 100%. Disengaging will cause your clash chance to gradually decrease until it reaches 0%.")),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"inline-block"}},"Territory Clash Chance: ",i.a.formatPercentage(e.gang.territoryClashChance,3)),r.a.createElement("div",{className:"help-tip noselect",style:{display:"inline-block"},onClick:function(){Object(o.a)("This percentage represents the chance you have of 'clashing' with with another gang. If you do not wish to gain/lose territory, then keep this percentage at 0% by not engaging in territory warfare.")}},"?"),r.a.createElement("br",null),r.a.createElement("input",{checked:e.gang.notifyMemberDeath,id:"notify",type:"checkbox",style:{display:"inline-block",margin:"2px"},onChange:t=>e.gang.notifyMemberDeath=t.target.checked}),r.a.createElement("label",{htmlFor:"warfare",className:"tooltip noselect",style:{color:"white",display:"inline-block"}},"Notify about Gang Member Deaths",r.a.createElement("span",{className:"tooltiptext",style:{display:"inline-block"}},"If this is enabled, then you will receive a pop-up notifying you whenever one of your Gang Members dies in a territory clash.")),r.a.createElement("br",null),r.a.createElement("fieldset",{style:{display:"block",margin:"6px"}},r.a.createElement("p",null,r.a.createElement("b",null,r.a.createElement("u",null,e.gang.facName)),r.a.createElement("br",null),"Power: ",Object(s.c)(l.a[e.gang.facName].power,6),r.a.createElement("br",null),"Territory: ",t(l.a[e.gang.facName].territory),"%",r.a.createElement("br",null),r.a.createElement("br",null),n.map(e=>function(e){const n=l.a[e].power,o=a/(n+a);return r.a.createElement("span",{key:e},r.a.createElement("u",null,e),r.a.createElement("br",null),"Power: ",Object(s.c)(n,6),r.a.createElement("br",null),"Territory: ",t(l.a[e].territory),"%",r.a.createElement("br",null),"Chance to win clash with this gang: ",i.a.formatPercentage(o,3),r.a.createElement("br",null),r.a.createElement("br",null))}(e)))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(534),o=a(880),s=a(22),l=a(884),c=a(44);function u(e){if(0===Object.keys(c.a).sort().filter(t=>void 0===e.corp.divisions.find(e=>e.type===t)).sort().length)return r.a.createElement(r.a.Fragment,null);return r.a.createElement(i.a,{current:!1,onClick:function(){const t="cmpy-mgmt-expand-industry-popup";Object(s.a)(t,o.a,{corp:e.corp,setDivisionName:e.setDivisionName,popupId:t})},text:"Expand into new Industry"})}function m(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}const[o,s]=Object(n.useState)("Overview");return Object(n.useEffect)(()=>{const e=setInterval(a,1e3);return()=>clearInterval(e)},[]),r.a.createElement("div",{className:"cmpy-mgmt-container"},r.a.createElement("div",null,r.a.createElement(i.a,{current:"Overview"===o,key:"overview",onClick:()=>s("Overview"),text:e.corp.name}),e.corp.divisions.map(e=>r.a.createElement(i.a,{current:e.name===o,key:e.name,onClick:()=>s(e.name),text:e.name})),r.a.createElement(u,{corp:e.corp,setDivisionName:s})),r.a.createElement(l.a,{rerender:a,corp:e.corp,divisionName:o,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(44),l=a(57);function c(e){const t=Object.keys(s.a).sort().filter(t=>void 0===e.corp.divisions.find(e=>e.type===t)).sort(),[a,c]=Object(n.useState)(t.length>0?t[0]:""),[u,m]=Object(n.useState)("");function h(){try{Object(l.l)(e.corp,a,u)}catch(e){return void Object(i.a)(e+"")}e.setDivisionName(u),Object(o.b)(e.popupId)}const p=s.b[a];if(void 0===p)throw new Error(`Trying to create an industry that doesn't exists: '${a}'`);return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Create a new division to expand into a new industry:"),r.a.createElement("select",{className:"dropdown",defaultValue:a,onChange:function(e){c(e.target.value)}},t.map(e=>r.a.createElement("option",{key:e,value:e},e))),r.a.createElement("p",null,p(e.corp)),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",null,"Division name:"),r.a.createElement("input",{autoFocus:!0,value:u,onChange:function(e){m(e.target.value)},onKeyDown:function(e){13===e.keyCode&&h()},type:"text",className:"text-input",style:{display:"block"},maxLength:30,pattern:"[a-zA-Z0-9-_]"}),r.a.createElement("span",{onClick:h,className:"popup-box-button"},"Create Division"))}},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return Industry}));var _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(20),_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(23),decimal_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(82),_IndustryData__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(44),_data_Constants__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(36),_EmployeePositions__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(39),_Material__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(148),_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(21),_utils_calculateEffectWithFactors__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(882),_OfficeSpace__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(313),_Product__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(352),_utils_DialogBox__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(11),_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(95),_MaterialSizes__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(154),_Warehouse__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(188),_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(314),_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(14);function _defineProperty(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class Industry{constructor(e={}){_defineProperty(this,"name",""),_defineProperty(this,"type",_IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Agriculture),_defineProperty(this,"sciResearch",new _Material__WEBPACK_IMPORTED_MODULE_6__.a({name:"Scientific Research"})),_defineProperty(this,"researched",{}),_defineProperty(this,"reqMats",{}),_defineProperty(this,"prodMats",[]),_defineProperty(this,"products",{}),_defineProperty(this,"makesProducts",!1),_defineProperty(this,"awareness",0),_defineProperty(this,"popularity",0),_defineProperty(this,"startingCost",0),_defineProperty(this,"reFac",0),_defineProperty(this,"sciFac",0),_defineProperty(this,"hwFac",0),_defineProperty(this,"robFac",0),_defineProperty(this,"aiFac",0),_defineProperty(this,"advFac",0),_defineProperty(this,"prodMult",0),_defineProperty(this,"upgrades",Array(Object.keys(_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_15__.a).length).fill(0)),_defineProperty(this,"state","START"),_defineProperty(this,"newInd",!0),_defineProperty(this,"offices",{[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Aevum]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Chongqing]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Sector12]:new _OfficeSpace__WEBPACK_IMPORTED_MODULE_9__.a({loc:_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Sector12,size:_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.OfficeInitialSize}),[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.NewTokyo]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Ishima]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Volhaven]:0}),this.name=e.name?e.name:"",this.type=e.type?e.type:_IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Agriculture,this.lastCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.lastCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.warehouses={[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Aevum]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Chongqing]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Sector12]:new _Warehouse__WEBPACK_IMPORTED_MODULE_14__.a({corp:e.corp,industry:this,loc:_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Sector12,size:_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.WarehouseInitialSize}),[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.NewTokyo]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Ishima]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Volhaven]:0},this.init()}init(){const e=_IndustryData__WEBPACK_IMPORTED_MODULE_3__.d[this.type];if(void 0===e)throw new Error(`Invalid industry: "${this.type}"`);switch(this.startingCost=e,this.type){case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Energy:this.reFac=.65,this.sciFac=.7,this.robFac=.05,this.aiFac=.3,this.advFac=.08,this.reqMats={Hardware:.1,Metal:.2},this.prodMats=["Energy"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Utilities:case"Utilities":this.reFac=.5,this.sciFac=.6,this.robFac=.4,this.aiFac=.4,this.advFac=.08,this.reqMats={Hardware:.1,Metal:.1},this.prodMats=["Water"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Agriculture:this.reFac=.72,this.sciFac=.5,this.hwFac=.2,this.robFac=.3,this.aiFac=.3,this.advFac=.04,this.reqMats={Water:.5,Energy:.5},this.prodMats=["Plants","Food"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Fishing:this.reFac=.15,this.sciFac=.35,this.hwFac=.35,this.robFac=.5,this.aiFac=.2,this.advFac=.08,this.reqMats={Energy:.5},this.prodMats=["Food"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Mining:this.reFac=.3,this.sciFac=.26,this.hwFac=.4,this.robFac=.45,this.aiFac=.45,this.advFac=.06,this.reqMats={Energy:.8},this.prodMats=["Metal"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Food:this.sciFac=.12,this.hwFac=.15,this.robFac=.3,this.aiFac=.25,this.advFac=.25,this.reFac=.05,this.reqMats={Food:.5,Water:.5,Energy:.2},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Tobacco:this.reFac=.15,this.sciFac=.75,this.hwFac=.15,this.robFac=.2,this.aiFac=.15,this.advFac=.2,this.reqMats={Plants:1,Water:.2},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Chemical:this.reFac=.25,this.sciFac=.75,this.hwFac=.2,this.robFac=.25,this.aiFac=.2,this.advFac=.07,this.reqMats={Plants:1,Energy:.5,Water:.5},this.prodMats=["Chemicals"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Pharmaceutical:this.reFac=.05,this.sciFac=.8,this.hwFac=.15,this.robFac=.25,this.aiFac=.2,this.advFac=.16,this.reqMats={Chemicals:2,Energy:1,Water:.5},this.prodMats=["Drugs"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Computer:case"Computer":this.reFac=.2,this.sciFac=.62,this.robFac=.36,this.aiFac=.19,this.advFac=.17,this.reqMats={Metal:2,Energy:1},this.prodMats=["Hardware"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Robotics:this.reFac=.32,this.sciFac=.65,this.aiFac=.36,this.advFac=.18,this.hwFac=.19,this.reqMats={Hardware:5,Energy:3},this.prodMats=["Robots"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Software:this.sciFac=.62,this.advFac=.16,this.hwFac=.25,this.reFac=.15,this.aiFac=.18,this.robFac=.05,this.reqMats={Hardware:.5,Energy:.5},this.prodMats=["AICores"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Healthcare:this.reFac=.1,this.sciFac=.75,this.advFac=.11,this.hwFac=.1,this.robFac=.1,this.aiFac=.1,this.reqMats={Robots:10,AICores:5,Energy:5,Water:5},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.RealEstate:this.robFac=.6,this.aiFac=.6,this.advFac=.25,this.sciFac=.05,this.hwFac=.05,this.reqMats={Metal:5,Energy:5,Water:2,Hardware:4},this.prodMats=["RealEstate"],this.makesProducts=!0;break;default:return void console.error("Invalid Industry Type passed into Industry.init(): "+this.type)}}getProductDescriptionText(){if(!this.makesProducts)return"";switch(this.type){case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Food:return"create and manage restaurants";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Tobacco:return"create tobacco and tobacco-related products";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Pharmaceutical:return"develop new pharmaceutical drugs";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Computer:case"Computer":return"create new computer hardware and networking infrastructures";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Robotics:return"build specialized robots and robot-related products";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Software:return"develop computer software";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Healthcare:return"build and manage hospitals";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.RealEstate:return"develop and manage real estate properties";default:return console.error("Invalid industry type in Industry.getProductDescriptionText"),""}}getMaximumNumberProducts(){if(!this.makesProducts)return 0;let e=0;return this.hasResearch("uPgrade: Capacity.I")&&++e,this.hasResearch("uPgrade: Capacity.II")&&++e,_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.BaseMaxProducts+e}hasMaximumNumberProducts(){return Object.keys(this.products).length>=this.getMaximumNumberProducts()}calculateProductionFactors(){let e=0;for(let t=0;t<_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities.length;++t){const a=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities[t],n=this.warehouses[a];if(!(n instanceof _Warehouse__WEBPACK_IMPORTED_MODULE_14__.a))continue;const r=n.materials,i=Math.pow(.002*r.RealEstate.qty+1,this.reFac)*Math.pow(.002*r.Hardware.qty+1,this.hwFac)*Math.pow(.002*r.Robots.qty+1,this.robFac)*Math.pow(.002*r.AICores.qty+1,this.aiFac);e+=Math.pow(i,.73)}this.prodMult=e<1?1:e}updateWarehouseSizeUsed(e){e.updateMaterialSizeUsed();for(const t in this.products)if(this.products.hasOwnProperty(t)){const a=this.products[t];if(void 0===a)continue;e.sizeUsed+=a.data[e.loc][0]*a.siz,a.data[e.loc][0]>0&&(e.breakdown+=t+": "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_16__.c)(a.data[e.loc][0]*a.siz,0)+"
")}}process(e=1,t,a){if(this.state=t,"START"===t){(isNaN(this.thisCycleRevenue)||isNaN(this.thisCycleExpenses))&&(console.error("NaN in Corporation's computed revenue/expenses"),Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_11__.a)("Something went wrong when compting Corporation's revenue/expenses. This is a bug. Please report to game developer"),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0)),this.lastCycleRevenue=this.thisCycleRevenue.dividedBy(e*_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle),this.lastCycleExpenses=this.thisCycleExpenses.dividedBy(e*_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.lastCycleRevenue.gt(0)&&(this.newInd=!1);let t=0;for(const n in this.offices){const r=this.offices[n];0!==r&&(r instanceof _OfficeSpace__WEBPACK_IMPORTED_MODULE_9__.a&&(t+=r.process(e,a,this)))}this.thisCycleExpenses=this.thisCycleExpenses.plus(t),this.processMaterialMarket(),this.processProductMarket(e),this.popularity-=1e-4*e,this.popularity=Math.max(0,this.popularity);const n=a.getDreamSenseGain(),r=4*n;return void(n>0&&(this.popularity+=n*e,this.awareness+=r*e))}let n=this.processMaterials(e,a);Array.isArray(n)&&(this.thisCycleRevenue=this.thisCycleRevenue.plus(n[0]),this.thisCycleExpenses=this.thisCycleExpenses.plus(n[1])),n=this.processProducts(e,a),Array.isArray(n)&&(this.thisCycleRevenue=this.thisCycleRevenue.plus(n[0]),this.thisCycleExpenses=this.thisCycleExpenses.plus(n[1]))}processMaterialMarket(){const e=this.reqMats,t=this.prodMats;for(let a=0;a<_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities.length;++a)if(this.warehouses[_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities[a]]instanceof _Warehouse__WEBPACK_IMPORTED_MODULE_14__.a){const n=this.warehouses[_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities[a]];if(0===n)continue;for(const t in e)e.hasOwnProperty(t)&&n.materials[t].processMarket();for(let e=0;e0&&(t.qty+=a,expenses+=a*t.bCost),this.updateWarehouseSizeUsed(warehouse))}const e={};for(const t in warehouse.materials){if(!warehouse.materials.hasOwnProperty(t))continue;if(!warehouse.smartSupplyEnabled||!Object.keys(this.reqMats).includes(t))continue;const a=warehouse.materials[t],n=this.reqMats[t];if(void 0===n)throw new Error(`reqMat "${t}" is undefined`);a.buy=n*warehouse.smartSupplyStore;let r=a.buy*_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles;const i=Math.floor((warehouse.size-warehouse.sizeUsed)/_MaterialSizes__WEBPACK_IMPORTED_MODULE_13__.a[t]);r=Math.min(r,i),r>0&&(e[t]=r)}let t=1e99;for(const a in e){const n=e[a];if(void 0===n)throw new Error("Somehow smartbuy matname is undefined");const r=this.reqMats[a];if(void 0===r)throw new Error(`reqMat "${a}" is undefined`);const i=n/r;in)for(const t in e){const r=e[t];if(void 0===r)throw new Error("Somehow smartbuy matname is undefined");e[t]=Math.floor(r*n/a)}for(const t in e){if(!warehouse.smartSupplyUseLeftovers[t])continue;const a=warehouse.materials[t],n=e[t];if(void 0===n)throw new Error("Somehow smartbuy matname is undefined");e[t]=Math.max(0,n-a.qty)}for(const t in e){const a=warehouse.materials[t],n=e[t];if(void 0===n)throw new Error("Somehow smartbuy matname is undefined");a.qty+=n,expenses+=n*a.bCost}break}case"PRODUCTION":if(warehouse.smartSupplyStore=0,this.prodMats.length>0){const e=warehouse.materials[this.prodMats[0]],t=this.getOfficeProductivity(office)*this.prodMult*corporation.getProductionMultiplier()*this.getProductionMultiplier();let a;a=e.prdman[0]?Math.min(t,e.prdman[1]):t,a*=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles;let n=0;for(let e=0;e0){const e=Math.floor((warehouse.size-warehouse.sizeUsed)/n);a=Math.min(e,a)}a<0&&(a=0),warehouse.smartSupplyStore+=a/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles);let r=1;for(const e in this.reqMats)if(this.reqMats.hasOwnProperty(e)){const t=this.reqMats[e];if(void 0===t)continue;const n=t*a;warehouse.materials[e].qty0&&a>0){for(const e in this.reqMats){const t=this.reqMats[e];if(void 0===t)continue;const n=t*a*r;warehouse.materials[e].qty-=n,warehouse.materials[e].prd=0,warehouse.materials[e].prd-=n/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles)}for(let e=0;emat.bCost?sCost-mat.bCost>markupLimit&&(markup=Math.pow(markupLimit/(sCost-mat.bCost),2)):sCost=0?(mat.qty-=sellAmt,revenue+=sellAmt*sCost,mat.sll=sellAmt/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles)):mat.sll=0}break;case"EXPORT":for(const matName in warehouse.materials)if(warehouse.materials.hasOwnProperty(matName)){const mat=warehouse.materials[matName];mat.totalExp=0;for(let expI=0;expI=a.size)return[0,0];{const e=Math.floor((a.size-a.sizeUsed)/_MaterialSizes__WEBPACK_IMPORTED_MODULE_13__.a[matName]);amt=Math.min(e,amt)}a.materials[matName].imp+=amt/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles),a.materials[matName].qty+=amt,a.materials[matName].qlt=mat.qlt,mat.qty-=amt,mat.totalExp+=amt,t.updateWarehouseSizeUsed(a);break}}}mat.totalExp/=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles}break;case"START":break;default:console.error("Invalid state: "+this.state)}this.updateWarehouseSizeUsed(warehouse)}office instanceof _OfficeSpace__WEBPACK_IMPORTED_MODULE_9__.a&&(this.sciResearch.qty+=.004*Math.pow(office.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_5__.a.RandD],.5)*corporation.getScientificResearchMultiplier()*this.getScientificResearchMultiplier())}}return[revenue,expenses]}processProducts(e=1,t){let a=0;if("PRODUCTION"===this.state)for(const t in this.products){const a=this.products[t];if(void 0!==a&&!a.fin){const t=a.createCity,n=this.offices[t];if(0===n)continue;const r=n.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_5__.a.Engineer],i=n.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_5__.a.Management],o=n.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_5__.a.Operations],s=r+i+o;if(s<=0)break;const l=1+i/(1.2*s),c=(Math.pow(r,.34)+Math.pow(o,.2))*l;a.createProduct(e,c),a.prog>=100&&a.finishProduct(n.employeeProd,this);break}}for(const n in this.products)if(this.products.hasOwnProperty(n)){const r=this.products[n];r instanceof _Product__WEBPACK_IMPORTED_MODULE_10__.a&&r.fin&&(a+=this.processProduct(e,r,t))}return[a,0]}processProduct(marketCycles=1,product,corporation){let totalProfit=0;for(let i=0;i<_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities.length;++i){const city=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities[i],office=this.offices[city];if(0===office)continue;const warehouse=this.warehouses[city];if(warehouse instanceof _Warehouse__WEBPACK_IMPORTED_MODULE_14__.a)switch(this.state){case"PRODUCTION":{const e=this.getOfficeProductivity(office,{forProduct:!0})*corporation.getProductionMultiplier()*this.prodMult*this.getProductionMultiplier()*this.getProductProductionMultiplier();let t;t=product.prdman[city][0]?Math.min(e,product.prdman[city][1]):e,t*=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles;let a=product.siz;for(const e in product.reqMats)if(product.reqMats.hasOwnProperty(e)){const t=product.reqMats[e];a-=_MaterialSizes__WEBPACK_IMPORTED_MODULE_13__.a[e]*t}if(a>0){const e=Math.floor((warehouse.size-warehouse.sizeUsed)/a);t=Math.min(e,t)}warehouse.smartSupplyStore+=t/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles);let n=1;for(const e in product.reqMats)if(product.reqMats.hasOwnProperty(e)){const a=product.reqMats[e]*t;warehouse.materials[e].qty0&&t>0){for(const e in product.reqMats)if(product.reqMats.hasOwnProperty(e)){const a=product.reqMats[e]*t*n;warehouse.materials[e].qty-=a,warehouse.materials[e].prd-=a/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles)}product.data[city][0]+=t*n}product.data[city][1]=t*n/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles);break}case"SALE":{product.pCost=0;for(const e in product.reqMats)product.reqMats.hasOwnProperty(e)&&(product.pCost+=product.reqMats[e]*warehouse.materials[e].bCost);product.pCost*=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.ProductProductionCostRatio;const businessFactor=this.getBusinessFactor(office),advertisingFactor=this.getAdvertisingFactors()[0],marketFactor=this.getMarketFactor(product),markupLimit=product.rat/product.mku;let sCost;if(product.marketTa2){const e=product.data[city][1],t=markupLimit,a=e,n=.5*Math.pow(product.rat,.65)*marketFactor*corporation.getSalesMultiplier()*businessFactor*advertisingFactor*this.getSalesMultiplier(),r=Math.sqrt(a/n);let i;0===n||0===r?0===a?i=0:(i=product.pCost+markupLimit,console.warn("In Corporation, found illegal 0s when trying to calculate MarketTA2 sale cost")):i=t/r+product.pCost,product.marketTa2Price[city]=i,sCost=i}else if(product.marketTa1)sCost=product.pCost+markupLimit;else if(Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_12__.a)(product.sCost)){const sCostString=product.sCost;0===product.mku&&(console.error("mku is zero, reverting to 1 to avoid Infinity"),product.mku=1),sCost=sCostString.replace(/MP/g,product.pCost+product.rat/product.mku+""),sCost=eval(sCost)}else sCost=product.sCost;let markup=1;sCost>product.pCost&&sCost-product.pCost>markupLimit&&(markup=markupLimit/(sCost-product.pCost));const maxSell=.5*Math.pow(product.rat,.65)*marketFactor*corporation.getSalesMultiplier()*Math.pow(markup,2)*businessFactor*advertisingFactor*this.getSalesMultiplier();let sellAmt;if(product.sllman[city][0]&&Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_12__.a)(product.sllman[city][1])){let tmp=product.sllman[city][1].replace(/MAX/g,maxSell);tmp=tmp.replace(/PROD/g,product.data[city][1]);try{tmp=eval(tmp)}catch(e){Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_11__.a)("Error evaluating your sell price expression for "+product.name+" in "+this.name+"'s "+city+" office. Sell price is being set to MAX"),tmp=maxSell}sellAmt=Math.min(maxSell,tmp)}else sellAmt=product.sllman[city][0]&&product.sllman[city][1]>0?Math.min(maxSell,product.sllman[city][1]):!1===product.sllman[city][0]?0:maxSell;sellAmt<0&&(sellAmt=0),sellAmt=sellAmt*_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles,sellAmt=Math.min(product.data[city][0],sellAmt),sellAmt&&sCost?(product.data[city][0]-=sellAmt,totalProfit+=sellAmt*sCost,product.data[city][2]=sellAmt/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles)):product.data[city][2]=0;break}case"START":case"PURCHASE":case"EXPORT":break;default:console.error("Invalid State: "+this.state)}}return totalProfit}discontinueProduct(e){for(const t in this.products)this.products.hasOwnProperty(t)&&e===this.products[t]&&delete this.products[t]}upgrade(e,t){const a=t.corporation,n=t.office,r=e[0];for(;this.upgrades.length<=r;)this.upgrades.push(0);switch(++this.upgrades[r],r){case 0:for(let e=0;e=1)&&console.warn(`Exponential factor is ${t}. This is not an intended value for it`),a<1&&console.warn(`Linear factor is ${a}. This is not an intended value for it`),Math.pow(e,t)+e/a}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(44);const r={[n.a.Food]:{Quality:.7,Durability:.1,Aesthetics:.2},[n.a.Tobacco]:{Quality:.4,Durability:.2,Reliability:.2,Aesthetics:.2},[n.a.Pharmaceutical]:{Quality:.2,Performance:.2,Durability:.1,Reliability:.3,Features:.2},[n.a.Computer]:{Quality:.15,Performance:.25,Durability:.25,Reliability:.2,Aesthetics:.05,Features:.1},Computer:{Quality:.15,Performance:.25,Durability:.25,Reliability:.2,Aesthetics:.05,Features:.1},[n.a.Robotics]:{Quality:.1,Performance:.2,Durability:.2,Reliability:.2,Aesthetics:.1,Features:.2},[n.a.Software]:{Quality:.2,Performance:.2,Reliability:.2,Durability:.2,Features:.2},[n.a.Healthcare]:{Quality:.4,Performance:.1,Durability:.1,Reliability:.3,Features:.1},[n.a.RealEstate]:{Quality:.2,Durability:.25,Reliability:.1,Aesthetics:.35,Features:.1}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(885),o=a(912),s=a(23);function l(e){const t="Overview"!==e.divisionName?e.corp.divisions.find(t=>t.name===e.divisionName):void 0;return void 0===t?r.a.createElement("div",{id:"cmpy-mgmt-panel"},r.a.createElement(o.a,e)):r.a.createElement("div",{id:"cmpy-mgmt-panel"},r.a.createElement(i.a,{rerender:e.rerender,division:t,corp:e.corp,city:s.a.Sector12,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(607),o=a(886),s=a(22),l=a(887);function c(e){return 0===Object.keys(e.division.offices).filter(t=>0===e.division.offices[t]).length?r.a.createElement(r.a.Fragment,null):r.a.createElement(i.a,{current:!1,key:"Expand into new City",name:"Expand into new City",onClick:function(){const t="cmpy-mgmt-expand-city-popup";Object(s.a)(t,o.a,{popupId:t,corp:e.corp,division:e.division,cityStateSetter:e.setCity})}})}function u(e){const[t,a]=Object(n.useState)(e.city),o=e.division.offices[t];return 0===o?(a("Sector-12"),r.a.createElement(r.a.Fragment,null)):r.a.createElement(r.a.Fragment,null,Object.values(e.division.offices).map(e=>0!==e&&r.a.createElement(i.a,{current:t===e.loc,key:e.loc,name:e.loc,onClick:()=>a(e.loc)})),r.a.createElement(c,{corp:e.corp,division:e.division,setCity:a}),r.a.createElement(l.a,{rerender:e.rerender,corp:e.corp,division:e.division,city:t,warehouse:e.division.warehouses[t],office:o,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(36),o=a(22),s=a(11),l=a(57),c=a(102);function u(e){const t=Object(n.useRef)(null);return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Would you like to expand into a new city by opening an office? This would cost"," ",r.a.createElement(c.a,{money:i.a.OfficeInitialCost,corp:e.corp})),r.a.createElement("select",{ref:t,className:"dropdown",style:{margin:"5px"}},Object.keys(e.division.offices).filter(t=>0===e.division.offices[t]).map(e=>r.a.createElement("option",{key:e,value:e},e))),r.a.createElement("button",{className:"std-button",style:{display:"inline-block"},onClick:function(){if(null!==t.current){try{Object(l.k)(e.corp,e.division,t.current.value)}catch(e){return void Object(s.a)(e+"")}Object(s.a)(`Opened a new office in ${t.current.value}!`),e.cityStateSetter(t.current.value),Object(o.b)(e.popupId)}},disabled:e.corp.funds.lt(0)},"Confirm"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(888),o=a(892),s=a(896);function l(e){return r.a.createElement("div",null,r.a.createElement("div",{className:"cmpy-mgmt-industry-left-panel"},r.a.createElement(o.a,{rerender:e.rerender,player:e.player,corp:e.corp,division:e.division,currentCity:e.city,office:e.office}),r.a.createElement(i.a,{rerender:e.rerender,player:e.player,corp:e.corp,division:e.division,office:e.office})),r.a.createElement("div",{className:"cmpy-mgmt-industry-right-panel"},r.a.createElement(s.a,{rerender:e.rerender,player:e.player,corp:e.corp,currentCity:e.city,division:e.division,warehouse:e.warehouse})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(0),r=a.n(n),i=a(39),o=a(3),s=a(608),l=a(22),c=a(889),u=a(890),m=a(891),h=a(15);function p(e,t){let a=0;for(let n=0;ne.switchMode(e=>!e)},"Switch to Auto Mode",r.a.createElement("span",{className:"tooltiptext"},"Switch to Automatic Assignment Mode, which will automatically assign employees to your selected jobs. You simply have to select the number of assignments for each job")):r.a.createElement("button",{className:"std-button tooltip",onClick:()=>e.switchMode(e=>!e)},"Switch to Manual Mode",r.a.createElement("span",{className:"tooltiptext"},"Switch to Manual Assignment Mode, which allows you to specify which employees should get which jobs"))}function f(e){const[t,a]=Object(n.useState)(e.office.employees.length>0?e.office.employees[0]:null),l=[];for(let t=0;t0?"std-button":"a-link-button-inactive",onClick:function(){a<=0?console.warn("Cannot assign employee. No unassigned employees available"):(e.office.assignEmployeeToJob(e.job),e.office.calculateEmployeeProductivity(e.corp,e.division),e.rerender())}},"+"),r.a.createElement("button",{className:t>0?"std-button":"a-link-button-inactive",onClick:function(){e.office.unassignEmployeeFromJob(e.job),e.office.calculateEmployeeProductivity(e.corp,e.division),e.rerender()}},"-"),r.a.createElement("br",null))}function y(e){const t=p(e.office.employees,i.a.Unassigned),a=1===e.corp.unlockUpgrades[4];let n=0,s=0,l=0,c=0;for(let t=0;t0&&(u=n/e.office.employees.length,m=s/e.office.employees.length,d=l/e.office.employees.length),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("strong",null,"Unassigned Employees: ",t)),r.a.createElement("br",null),r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",null,"Avg Employee Morale:")),r.a.createElement("td",null,r.a.createElement("p",null,o.a.format(u,"0.000")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",null,"Avg Employee Happiness:")),r.a.createElement("td",null,r.a.createElement("p",null,o.a.format(m,"0.000")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",null,"Avg Employee Energy:")),r.a.createElement("td",null,r.a.createElement("p",null,o.a.format(d,"0.000")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",null,"Total Employee Salary:")),r.a.createElement("td",null,r.a.createElement("p",null,r.a.createElement(h.a,{money:c})))),a&&r.a.createElement(r.a.Fragment,null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Material Production:",r.a.createElement("span",{className:"tooltiptext"},"The base amount of material this office can produce. Does not include production multipliers from upgrades and materials. This value is based off the productivity of your Operations, Engineering, and Management employees"))),r.a.createElement("td",null,r.a.createElement("p",null,o.a.format(e.division.getOfficeProductivity(e.office),"0.000")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Product Production:",r.a.createElement("span",{className:"tooltiptext"},"The base amount of any given Product this office can produce. Does not include production multipliers from upgrades and materials. This value is based off the productivity of your Operations, Engineering, and Management employees"))),r.a.createElement("td",null,r.a.createElement("p",null,o.a.format(e.division.getOfficeProductivity(e.office,{forProduct:!0}),"0.000")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Business Multiplier:",r.a.createElement("span",{className:"tooltiptext"},"The effect this office's 'Business' employees has on boosting sales"))),r.a.createElement("td",null,r.a.createElement("p",null,"x",o.a.format(e.division.getBusinessFactor(e.office),"0.000"))))))),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.Operations,desc:"Manages supply chain operations. Improves the amount of Materials and Products you produce."}),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.Engineer,desc:"Develops and maintains products and production systems. Increases the quality of everything you produce. Also increases the amount you produce (not as much as Operations, however)"}),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.Business,desc:"Handles sales and finances. Improves the amount of Materials and Products you can sell."}),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.Management,desc:"Leads and oversees employees and office operations. Improves the effectiveness of Engineer and Operations employees."}),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.RandD,desc:"Research new innovative ways to improve the company. Generates Scientific Research."}),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.Training,desc:"Set employee to training, which will increase some of their stats. Employees in training do not affect any company operations."}))}function b(e){const[t,a]=Object(n.useState)(!1),i={fontSize:"13px"};let o="tooltip";e.office.atCapacity()?o+=" a-link-button-inactive":(o+=" std-button",0===e.office.employees.length&&(o+=" flashing-button"));let s="tooltip";return e.office.atCapacity()?s+=" a-link-button-inactive":s+=" std-button",r.a.createElement("div",{className:"cmpy-mgmt-employee-panel"},r.a.createElement("h1",{style:{margin:"4px 0px 5px 0px"}},"Office Space"),r.a.createElement("p",null,"Size: ",e.office.employees.length," / ",e.office.size," employees"),r.a.createElement("button",{className:o,onClick:function(){const t="cmpy-mgmt-hire-employee-popup";Object(l.a)(t,u.a,{rerender:e.rerender,office:e.office,corp:e.corp,popupId:t,player:e.player})},style:i},"Hire Employee",0===e.office.employees.length&&r.a.createElement("span",{className:"tooltiptext"},"You'll need to hire some employees to get your operations started! It's recommended to have at least one employee in every position")),r.a.createElement("button",{className:s,onClick:function(){e.office.atCapacity()||(e.office.hireRandomEmployee(),e.rerender())},style:i},"Autohire Employee",r.a.createElement("span",{className:"tooltiptext"},"Automatically hires an employee and gives him/her a random name")),r.a.createElement("br",null),r.a.createElement("button",{className:"std-button tooltip",onClick:function(){const t="cmpy-mgmt-upgrade-office-size-popup";Object(l.a)(t,c.a,{rerender:e.rerender,office:e.office,corp:e.corp,popupId:t,player:e.player})},style:i,disabled:e.corp.funds.lt(0)},"Upgrade size",r.a.createElement("span",{className:"tooltiptext"},"Upgrade the office's size so that it can hold more employees!")),!e.division.hasResearch("AutoPartyManager")&&r.a.createElement("button",{className:"std-button tooltip",onClick:function(){const t="cmpy-mgmt-throw-office-party-popup";Object(l.a)(t,m.a,{office:e.office,corp:e.corp,popupId:t})},style:i,disabled:e.corp.funds.lt(0)},"Throw Party",r.a.createElement("span",{className:"tooltiptext"},'"Throw an office party to increase your employee\'s morale and happiness"')),r.a.createElement("br",null),r.a.createElement("div",null,r.a.createElement(d,{manualMode:t,switchMode:a})),t?r.a.createElement(f,{rerender:e.rerender,corp:e.corp,division:e.division,office:e.office,player:e.player}):r.a.createElement(y,{rerender:e.rerender,corp:e.corp,division:e.division,office:e.office,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(22),o=a(3),s=a(11),l=a(36),c=a(57);function u(e){const t=Math.round(e.office.size/l.a.OfficeInitialSize),a=l.a.OfficeInitialCost*Math.pow(1.09,t);let n=0;for(let e=0;e<5;++e)n+=Math.pow(1.09,t+e);const u=l.a.OfficeInitialCost*n,m=e.corp.funds.dividedBy(l.a.OfficeInitialCost).toNumber();let h=1;for(n=Math.pow(1.09,t);h<50&&!(n>=m);){const e=Math.pow(1.09,t+h);if(n+e>m)break;n+=e,++h}const p=l.a.OfficeInitialCost*n;function d(t,a){e.corp.funds.lt(t)?Object(s.a)("You don't have enough company funds to purchase this upgrade!"):(Object(c.y)(e.corp,e.office,a),Object(s.a)("Office space increased! It can now hold "+e.office.size+" employees"),e.rerender()),Object(i.b)(e.popupId)}function f(e){return r.a.createElement("button",{className:"tooltip "+(e.corp.funds.lt(e.cost)?"a-link-button-inactive":"a-link-button"),style:{display:"inline-block",margin:"4px"},onClick:()=>d(e.cost,e.size)},"by ",e.size,r.a.createElement("span",{className:"tooltiptext"},o.a.formatMoney(e.cost)))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Increase the size of your office space to fit additional employees!"),r.a.createElement("p",null,"Upgrade size: "),r.a.createElement(f,{corp:e.corp,cost:a,size:l.a.OfficeInitialSize}),r.a.createElement(f,{corp:e.corp,cost:u,size:5*l.a.OfficeInitialSize}),r.a.createElement(f,{corp:e.corp,cost:p,size:h*l.a.OfficeInitialSize}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(22),o=a(3),s=a(36),l=a(21),c=a(14),u=a(396),m=a(11);function h(e){const[t,a]=Object(n.useState)("");function o(){for(let a=0;a
This division's production multiplier is calculated by summing the individual production multiplier of each of its office locations. This production multiplier is applied to each office. Therefore, it is beneficial to expand into new cities as this can greatly increase the production multiplier of your entire Division.

Below are approximations for how effective each material is at boosting this industry's production multiplier (Bigger bars = more effective):

Hardware:    ${t(e.division.hwFac)}
Robots:      ${t(e.division.robFac)}
AI Cores:    ${t(e.division.aiFac)}
Real Estate: `+t(e.division.reFac))}},"?"),r.a.createElement("br",null)," ",r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip"},"Scientific Research: ",s.a.format(e.division.sciResearch.qty,"0.000a"),r.a.createElement("span",{className:"tooltiptext"},"Scientific Research increases the quality of the materials and products that you produce.")),r.a.createElement("button",{className:"help-tip",onClick:function(){const t="corporation-research-popup-box";Object(h.a)(t,m.a,{industry:e.division,popupId:t})}},"Research"))}(),r.a.createElement("br",null),r.a.createElement("u",{className:"industry-purchases-and-upgrades-header"},"Purchases & Upgrades"),r.a.createElement("br",null),function(){const a=[];for(const i in o.a){const s=o.a[i];if(e.division.hasResearch("AutoBrew")&&"Coffee"===s[4])continue;const l=s[0],c=s[1],u=s[2];let m=0;switch(l){case 0:m=e.office.employees.length*c;break;default:m=c*Math.pow(u,e.division.upgrades[l])}function n(){e.corp.funds.lt(m)||(e.corp.funds=e.corp.funds.minus(m),e.division.upgrade(s,{corporation:e.corp,office:e.office}),e.rerender())}a.push(t({key:i,onClick:n,text:r.a.createElement(r.a.Fragment,null,s[4]," - ",r.a.createElement(d.a,{money:m,corp:e.corp})),tooltip:s[5]}))}return a}()," ",r.a.createElement("br",null),e.division.makesProducts&&a)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(44),l=a(57);function c(e){const t=Object.keys(e.division.offices).filter(t=>0!==e.division.offices[t]),[a,c]=Object(n.useState)(t.length>0?t[0]:""),[u,m]=Object(n.useState)(""),[h,p]=Object(n.useState)(null),[d,f]=Object(n.useState)(null);if(e.division.hasMaximumNumberProducts())return r.a.createElement(r.a.Fragment,null);function g(){if(null!==h&&null!==d){try{Object(l.j)(e.corp,e.division,a,u,h,d)}catch(e){Object(i.a)(e+"")}Object(o.b)(e.popupId)}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{dangerouslySetInnerHTML:{__html:e.popupText}}),r.a.createElement("select",{className:"dropdown",style:{margin:"5px"},onChange:function(e){c(e.target.value)},defaultValue:a},t.map(e=>r.a.createElement("option",{key:e,value:e},e))),r.a.createElement("input",{onChange:function(e){m(e.target.value)},className:"text-input",style:{margin:"5px"},placeholder:(y=e.division.type,y===s.a.Food?"Restaurant Name":y===s.a.Healthcare?"Hospital Name":y===s.a.RealEstate?"Property Name":"Product Name")}),r.a.createElement("br",null),r.a.createElement("input",{onChange:function(e){""===e.target.value?p(null):p(parseFloat(e.target.value))},autoFocus:!0,type:"number",className:"text-input",style:{margin:"5px"},placeholder:"Design investment"}),r.a.createElement("input",{onChange:function(e){""===e.target.value?f(null):f(parseFloat(e.target.value))},onKeyDown:function(e){13===e.keyCode&&g()},type:"number",className:"text-input",style:{margin:"5px"},placeholder:"Marketing investment"}),r.a.createElement("button",{className:"std-button",onClick:g},"Develop Product"));var y}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(44),l=a(36),c=a(895),u=a(57);function m(e){const t=s.c[e.industry.type];return void 0===t?r.a.createElement(r.a.Fragment,null):(Object(n.useEffect)(()=>{{const t=document.getElementById(e.popupId+"-content");null!=t&&(t.style.minHeight="80vh")}const a=t.createTreantMarkup();a.chart.container="#"+e.popupId+"-content",a.chart.nodeAlign="BOTTOM",a.chart.rootOrientation="WEST",a.chart.siblingSeparation=40,a.chart.connectors={type:"step",style:{"arrow-end":"block-wide-long",stroke:"white","stroke-width":2}},Object(c.Treant)(a);const n=t.getAllNodes();for(let t=0;t{try{Object(u.n)(e.industry,n[t])}catch(e){return void Object(i.a)(e+"")}Object(i.a)(`Researched ${n[t]}. It may take a market cycle (~${l.a.SecsPerMarketCycle} seconds) before the effects of the Research apply.`),Object(o.b)(e.popupId)}):console.warn("Could not find Research Tree div for "+a)}}),r.a.createElement("div",{id:e.popupId},r.a.createElement("div",null,"Research points: ",e.industry.sciResearch.qty,r.a.createElement("br",null),"Multipliers from research:",r.a.createElement("br",null),"* Advertising Multiplier: x",t.getAdvertisingMultiplier(),r.a.createElement("br",null),"* Employee Charisma Multiplier: x",t.getEmployeeChaMultiplier(),r.a.createElement("br",null),"* Employee Creativity Multiplier: x",t.getEmployeeCreMultiplier(),r.a.createElement("br",null),"* Employee Efficiency Multiplier: x",t.getEmployeeEffMultiplier(),r.a.createElement("br",null),"* Employee Intelligence Multiplier: x",t.getEmployeeIntMultiplier(),r.a.createElement("br",null),"* Production Multiplier: x",t.getProductionMultiplier(),r.a.createElement("br",null),"* Sales Multiplier: x",t.getSalesMultiplier(),r.a.createElement("br",null),"* Scientific Research Multiplier: x",t.getScientificResearchMultiplier(),r.a.createElement("br",null),"* Storage Multiplier: x",t.getStorageMultiplier())))}},,function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return IndustryWarehouse}));var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),react__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__),_data_Constants__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(36),_OfficeSpace__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(313),_Material__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(148),_Product__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(352),_Warehouse__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(188),_DiscontinueProductPopup__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(897),_ExportPopup__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(898),_LimitProductProductionPopup__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(899),_MaterialMarketTaPopup__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(900),_SellMaterialPopup__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(901),_SellProductPopup__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(902),_PurchaseMaterialPopup__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(903),_ProductMarketTaPopup__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(904),_SmartSupplyPopup__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(905),_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(3),_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(22),_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(95),_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(15),_MoneyCost__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__(102),_Helpers__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__(906),_IndustryProductEquation__WEBPACK_IMPORTED_MODULE_21__=__webpack_require__(907),_Actions__WEBPACK_IMPORTED_MODULE_22__=__webpack_require__(57);function ProductComponent(props){const corp=props.corp,division=props.division,city=props.city,product=props.product,nf="0.000",nfB="0.000a",hasUpgradeDashboard=division.hasResearch("uPgrade: Dashboard"),totalGain=product.data[city][1]-product.data[city][2];let sellButtonText;if(sellButtonText=product.sllman[city][0]?Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_17__.a)(product.sllman[city][1])?react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.data[city][2],nfB),"/",product.sllman[city][1],")"):react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.data[city][2],nfB),"/",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.sllman[city][1],nfB),")"):react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (0.000/0.000)"),product.marketTa2)sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:product.marketTa2Price[city]}));else if(product.marketTa1){const e=product.rat/product.mku;sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:product.pCost+e}))}else if(product.sCost)if(Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_17__.a)(product.sCost)){const sCost=product.sCost.replace(/MP/g,product.pCost+"");sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:eval(sCost)}))}else sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:product.sCost}));function openSellProductPopup(){const e="cmpy-mgmt-limit-product-production-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_SellProductPopup__WEBPACK_IMPORTED_MODULE_11__.a,{product:product,city:city,popupId:e})}let limitProductionButtonText="Limit Production";function openLimitProductProdutionPopup(){const e="cmpy-mgmt-limit-product-production-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_LimitProductProductionPopup__WEBPACK_IMPORTED_MODULE_8__.a,{product:product,city:city,popupId:e})}function openDiscontinueProductPopup(){const e="cmpy-mgmt-discontinue-product-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_DiscontinueProductPopup__WEBPACK_IMPORTED_MODULE_6__.a,{rerender:props.rerender,product:product,industry:division,corp:props.corp,popupId:e,player:props.player})}function openProductMarketTaPopup(){const e="cmpy-mgmt-marketta-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_ProductMarketTaPopup__WEBPACK_IMPORTED_MODULE_13__.a,{product:product,industry:division,popupId:e})}return product.prdman[city][0]&&(limitProductionButtonText+=" ("+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.prdman[city][1],nf)+")"),product.fin?react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{className:"cmpy-mgmt-warehouse-product-div"},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},product.name,": ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.data[city][0],nfB)," (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(totalGain,nfB),"/s)",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"Prod: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.data[city][1],nfB),"/s",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Sell: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.data[city][2],nfB)," /s")),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},"Rating: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.rat,nf),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"Quality: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.qlt,nf)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Performance: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.per,nf)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Durability: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.dur,nf)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Reliability: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.rel,nf)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Aesthetics: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.aes,nf)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Features: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.fea,nf),1===corp.unlockUpgrades[2]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),1===corp.unlockUpgrades[2]&&"Demand: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.dmd,nf),1===corp.unlockUpgrades[3]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),1===corp.unlockUpgrades[3]&&"Competition: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.cmp,nf))),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},"Est. Production Cost:"," ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.formatMoney(product.pCost/_data_Constants__WEBPACK_IMPORTED_MODULE_1__.a.ProductProductionCostRatio),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"An estimate of the material cost it takes to create this Product.")),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},"Est. Market Price: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.formatMoney(product.pCost),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"An estimate of how much consumers are willing to pay for this product. Setting the sale price above this may result in less sales. Setting the sale price below this may result in more sales.")),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openSellProductPopup},sellButtonText),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openLimitProductProdutionPopup},limitProductionButtonText),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openDiscontinueProductPopup},"Discontinue"),division.hasResearch("Market-TA.I")&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openProductMarketTaPopup},"Market-TA"))):react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{className:"cmpy-mgmt-warehouse-product-div"},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,"Designing ",product.name," (req. Operations/Engineers in ",product.createCity,")..."),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.prog,"0.00"),"% complete"),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),hasUpgradeDashboard&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openSellProductPopup},sellButtonText),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openLimitProductProdutionPopup},limitProductionButtonText),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openDiscontinueProductPopup},"Discontinue"),division.hasResearch("Market-TA.I")&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openProductMarketTaPopup},"Market-TA")))}function MaterialComponent(props){const corp=props.corp,division=props.division,warehouse=props.warehouse,city=props.city,mat=props.mat,markupLimit=mat.getMarkupLimit(),office=division.offices[city];if(!(office instanceof _OfficeSpace__WEBPACK_IMPORTED_MODULE_2__.a))throw new Error(`Could not get OfficeSpace object for this city (${city})`);const nf="0.000",nfB="0.000a",totalGain=mat.buy+mat.prd+mat.imp-mat.sll-mat.totalExp,tutorial=division.newInd&&Object.keys(division.reqMats).includes(mat.name)&&0===mat.buy&&0===mat.imp,purchaseButtonText=`Buy (${_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.buy,nfB)})`,purchaseButtonClass=tutorial?"std-button flashing-button tooltip":"std-button";function openPurchaseMaterialPopup(){const e="cmpy-mgmt-material-purchase-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_PurchaseMaterialPopup__WEBPACK_IMPORTED_MODULE_12__.a,{mat:mat,industry:division,warehouse:warehouse,corp:props.corp,popupId:e})}function openExportPopup(){const e="cmpy-mgmt-export-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_ExportPopup__WEBPACK_IMPORTED_MODULE_7__.a,{mat:mat,corp:props.corp,popupId:e})}let sellButtonText;if(mat.sllman[0]){if(sellButtonText=Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_17__.a)(mat.sllman[1])?react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.sll,nfB),"/",mat.sllman[1],")"):react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.sll,nfB),"/",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.sllman[1],nfB),")"),mat.marketTa2)sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:mat.marketTa2Price}));else if(mat.marketTa1)sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:mat.bCost+markupLimit}));else if(mat.sCost)if(Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_17__.a)(mat.sCost)){const sCost=mat.sCost.replace(/MP/g,mat.bCost+"");sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:eval(sCost)}))}else sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:mat.sCost}))}else sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (0.000/0.000)");function openSellMaterialPopup(){const e="cmpy-mgmt-material-sell-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_SellMaterialPopup__WEBPACK_IMPORTED_MODULE_10__.a,{mat:mat,corp:props.corp,popupId:e})}function openMaterialMarketTaPopup(){const e="cmpy-mgmt-export-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_MaterialMarketTaPopup__WEBPACK_IMPORTED_MODULE_9__.a,{mat:mat,industry:division,corp:props.corp,popupId:e})}function shouldFlash(){return props.division.prodMats.includes(props.mat.name)&&!mat.sllman[0]}return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{className:"cmpy-mgmt-warehouse-material-div"},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{style:{display:"inline-block"}},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},mat.name,": ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.qty,nfB)," (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(totalGain,nfB),"/s)",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"Buy: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.buy,nfB)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Prod: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.prd,nfB)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Sell: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.sll,nfB)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Export: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.totalExp,nfB)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Import: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.imp,nfB),1===corp.unlockUpgrades[2]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),1===corp.unlockUpgrades[2]&&"Demand: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.dmd,nf),1===corp.unlockUpgrades[3]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),1===corp.unlockUpgrades[3]&&"Competition: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.cmp,nf))),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},"MP: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.formatMoney(mat.bCost),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"Market Price: The price you would pay if you were to buy this material on the market"))," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},"Quality: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.qlt,"0.00a"),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"The quality of your material. Higher quality will lead to more sales"))),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{style:{display:"inline-block"}},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:purchaseButtonClass,onClick:openPurchaseMaterialPopup,disabled:props.warehouse.smartSupplyEnabled&&Object.keys(props.division.reqMats).includes(props.mat.name)},purchaseButtonText,tutorial&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"Purchase your required materials to get production started!")),1===corp.unlockUpgrades[0]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openExportPopup},"Export"),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button"+(shouldFlash()?" flashing-button":""),onClick:openSellMaterialPopup},sellButtonText),division.hasResearch("Market-TA.I")&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openMaterialMarketTaPopup},"Market-TA")))}function IndustryWarehouse(e){return e.warehouse instanceof _Warehouse__WEBPACK_IMPORTED_MODULE_5__.a?function(){if(0===e.warehouse)return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null);const t={color:e.warehouse.sizeUsed>=e.warehouse.size?"red":"white",margin:"5px"},a=_data_Constants__WEBPACK_IMPORTED_MODULE_1__.a.WarehouseUpgradeBaseCost*Math.pow(1.07,e.warehouse.level+1),n=e.corp.funds.gt(a)?"std-button":"a-link-button-inactive",r=[];for(const t in e.division.reqMats)if(e.division.reqMats.hasOwnProperty(t)){const a=[" *",e.division.reqMats[t],t].join(" ");r.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{key:t},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,a)))}let i;switch(e.division.state){case"START":i="Current state: Preparing...";break;case"PURCHASE":i="Current state: Purchasing materials...";break;case"PRODUCTION":i="Current state: Producing materials and/or products...";break;case"SALE":i="Current state: Selling materials and/or products...";break;case"EXPORT":i="Current state: Exporting materials and/or products...";break;default:console.error("Invalid state: "+e.division.state)}const o=[];for(const t in e.warehouse.materials)e.warehouse.materials[t]instanceof _Material__WEBPACK_IMPORTED_MODULE_3__.a&&Object(_Helpers__WEBPACK_IMPORTED_MODULE_20__.a)(t,e.division)&&o.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(MaterialComponent,{rerender:e.rerender,city:e.currentCity,corp:e.corp,division:e.division,key:t,mat:e.warehouse.materials[t],warehouse:e.warehouse}));const s=[];if(e.division.makesProducts&&Object.keys(e.division.products).length>0)for(const t in e.division.products){const a=e.division.products[t];a instanceof _Product__WEBPACK_IMPORTED_MODULE_4__.a&&s.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ProductComponent,{rerender:e.rerender,player:e.player,city:e.currentCity,corp:e.corp,division:e.division,key:t,product:a}))}return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{className:"cmpy-mgmt-warehouse-panel"},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip",style:t},"Storage: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.formatBigNumber(e.warehouse.sizeUsed)," /"," ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.formatBigNumber(e.warehouse.size),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext",dangerouslySetInnerHTML:{__html:e.warehouse.breakdown}})),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:n,onClick:function(){null!==e.division&&0!==e.warehouse&&(++e.warehouse.level,e.warehouse.updateSize(e.corp,e.division),e.corp.funds=e.corp.funds.minus(a),e.rerender())}},"Upgrade Warehouse Size - ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_MoneyCost__WEBPACK_IMPORTED_MODULE_19__.a,{money:a,corp:e.corp})),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,"This industry uses the following equation for it's production: "),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_IndustryProductEquation__WEBPACK_IMPORTED_MODULE_21__.a,{division:e.division}),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,"To get started with production, purchase your required materials or import them from another of your company's divisions."),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,i),e.corp.unlockUpgrades[1]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:function(){if(0===e.warehouse)return;const t="cmpy-mgmt-smart-supply-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(t,_SmartSupplyPopup__WEBPACK_IMPORTED_MODULE_14__.a,{division:e.division,warehouse:e.warehouse,corp:e.corp,player:e.player,popupId:t})}},"Configure Smart Supply")),o,s)}():react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{className:"cmpy-mgmt-warehouse-panel"},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:()=>{return t=e.division,a=e.currentCity,Object(_Actions__WEBPACK_IMPORTED_MODULE_22__.m)(e.corp,t,a),void e.rerender();var t,a},disabled:e.corp.funds.lt(_data_Constants__WEBPACK_IMPORTED_MODULE_1__.a.WarehouseInitialCost)},"Purchase Warehouse (",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_MoneyCost__WEBPACK_IMPORTED_MODULE_19__.a,{money:_data_Constants__WEBPACK_IMPORTED_MODULE_1__.a.WarehouseInitialCost,corp:e.corp}),")"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(22);function o(e){return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Are you sure you want to do this? Discontinuing a product removes it completely and permanently. You will no longer produce this product and all of its existing stock will be removed and left unsold"),r.a.createElement("button",{className:"popup-box-button",onClick:function(){e.industry.discontinueProduct(e.product),Object(i.b)(e.popupId),e.rerender()}},"Discontinue"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(57);function l(e){if(0===e.corp.divisions.length)throw new Error("Export popup created with no divisions.");if(0===Object.keys(e.corp.divisions[0].warehouses).length)throw new Error("Export popup created in a division with no warehouses.");const[t,a]=Object(n.useState)(e.corp.divisions[0].name),[l,c]=Object(n.useState)(Object.keys(e.corp.divisions[0].warehouses)[0]),[u,m]=Object(n.useState)(""),h=Object(n.useState)(!1)[1];function p(t){for(let a=0;a!e)}const d=e.corp.divisions.find(e=>e.name===t);if(void 0===d)throw new Error(`Export popup somehow ended up with undefined division '${d}'`);const f=Object.keys(d.warehouses).filter(e=>0!==d.warehouses[e]);return f.length>0&&!f.includes(l)&&c(f[0]),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Select the industry and city to export this material to, as well as how much of this material to export per second. You can set the export amount to 'MAX' to export all of the materials in this warehouse."),r.a.createElement("select",{className:"dropdown",onChange:function(e){a(e.target.value)},defaultValue:t},e.corp.divisions.map(e=>r.a.createElement("option",{key:e.name,value:e.name},e.name))),r.a.createElement("select",{className:"dropdown",onChange:function(e){c(e.target.value)},defaultValue:l},f.map(e=>{if(0!==d.warehouses[e])return r.a.createElement("option",{key:e,value:e},e)})),r.a.createElement("input",{className:"text-input",placeholder:"Export amount / s",onChange:function(e){m(e.target.value)}}),r.a.createElement("button",{className:"std-button",style:{display:"inline-block"},onClick:function(){try{Object(s.e)(t,l,e.mat,u)}catch(e){Object(i.a)(e+"")}Object(o.b)(e.popupId)}},"Export"),r.a.createElement("p",null,"Below is a list of all current exports of this material from this warehouse. Clicking on one of the exports below will REMOVE that export."),e.mat.exp.map((e,t)=>r.a.createElement("div",{key:t,className:"cmpy-mgmt-existing-export",onClick:()=>p(e)},"Industry: ",e.ind,r.a.createElement("br",null),"City: ",e.city,r.a.createElement("br",null),"Amount/s: ",e.amt)))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(22),o=a(57);function s(e){const[t,a]=Object(n.useState)(null);function s(){let a=t;null===a&&(a=-1),Object(o.i)(e.product,e.city,a),Object(i.b)(e.popupId)}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter a limit to the amount of this product you would like to product per second. Leave the box empty to set no limit."),r.a.createElement("input",{autoFocus:!0,className:"text-input",style:{margin:"5px"},placeholder:"Limit",type:"number",onChange:function(e){""===e.target.value?a(null):a(parseFloat(e.target.value))},onKeyDown:function(e){13===e.keyCode&&s()}}),r.a.createElement("button",{className:"std-button",style:{margin:"5px",display:"inline-block"},onClick:s},"Limit production"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(3);function o(e){if(!e.industry.hasResearch("Market-TA.II"))return r.a.createElement(r.a.Fragment,null);const[t,a]=Object(n.useState)(e.mat.bCost),o=Object(n.useState)(!1)[1];const s=e.mat.getMarkupLimit();const l=t;let c=1;return l>e.mat.bCost?l-e.mat.bCost>s&&(c=Math.pow(s/(l-e.mat.bCost),2)):l!e)},checked:e.mat.marketTa2,style:{margin:"3px"}})),r.a.createElement("p",null,"Note that Market-TA.II overrides Market-TA.I. This means that if both are enabled, then Market-TA.II will take effect, not Market-TA.I"))}function s(e){const t=Object(n.useState)(!1)[1];const a=e.mat.getMarkupLimit();return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("u",null,r.a.createElement("strong",null,"Market-TA.I")),r.a.createElement("br",null),"The maximum sale price you can mark this up to is ",i.a.formatMoney(e.mat.bCost+a),". This means that if you set the sale price higher than this, you will begin to experience a loss in number of sales"),r.a.createElement("div",{style:{display:"block"}},r.a.createElement("label",{className:"tooltip",htmlFor:"cmpy-mgmt-marketa1-checkbox",style:{color:"white"}},"Use Market-TA.I for Auto-Sale Price",r.a.createElement("span",{className:"tooltiptext"},"If this is enabled, then this Material will automatically be sold at the price identified by Market-TA.I (i.e. the price shown above)")),r.a.createElement("input",{id:"cmpy-mgmt-marketa1-checkbox",type:"checkbox",onChange:function(a){e.mat.marketTa1=a.target.checked,t(e=>!e)},checked:e.mat.marketTa1,style:{margin:"3px"}})),r.a.createElement(o,{mat:e.mat,industry:e.industry}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(57);function l(e){const[t,a]=Object(n.useState)(e.mat.sllman[1]?e.mat.sllman[1]+"":""),[l,c]=Object(n.useState)(function(e){let t=e.sCost?e.sCost+"":"";return e.marketTa2?t+=" (Market-TA.II)":e.marketTa1&&(t+=" (Market-TA.I)"),t}(e.mat));function u(){try{Object(s.o)(e.mat,t,l)}catch(e){Object(i.a)(e+"")}Object(o.b)(e.popupId)}function m(e){13===e.keyCode&&u()}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the maximum amount of ",e.mat.name," you would like to sell per second, as well as the price at which you would like to sell at.",r.a.createElement("br",null),r.a.createElement("br",null),"If the sell amount is set to 0, then the material will not be sold. If the sell price if set to 0, then the material will be discarded",r.a.createElement("br",null),r.a.createElement("br",null),"Setting the sell amount to 'MAX' will result in you always selling the maximum possible amount of the material.",r.a.createElement("br",null),r.a.createElement("br",null),"When setting the sell amount, you can use the 'PROD' variable to designate a dynamically changing amount that depends on your production. For example, if you set the sell amount to 'PROD-5' then you will always sell 5 less of the material than you produce.",r.a.createElement("br",null),r.a.createElement("br",null),"When setting the sell price, you can use the 'MP' variable to designate a dynamically changing price that depends on the market price. For example, if you set the sell price to 'MP+10' then it will always be sold at $10 above the market price."),r.a.createElement("br",null),r.a.createElement("input",{className:"text-input",value:t,autoFocus:!0,type:"text",placeholder:"Sell amount",style:{marginTop:"4px"},onChange:function(e){a(e.target.value)},onKeyDown:m}),r.a.createElement("input",{className:"text-input",value:l,type:"text",placeholder:"Sell price",style:{marginTop:"4px"},onChange:function(e){c(e.target.value)},onKeyDown:m}),r.a.createElement("button",{className:"std-button",onClick:u},"Confirm"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(57);function l(e){const[t,a]=Object(n.useState)(!0),[l,c]=Object(n.useState)(e.product.sllman[e.city][1]?e.product.sllman[e.city][1]:""),[u,m]=Object(n.useState)(function(e){let t=e.sCost?e.sCost+"":"";return e.marketTa2?t+=" (Market-TA.II)":e.marketTa1&&(t+=" (Market-TA.I)"),t}(e.product));function h(){try{Object(s.p)(e.product,e.city,l,u,t)}catch(e){Object(i.a)(e+"")}Object(o.b)(e.popupId)}function p(e){13===e.keyCode&&h()}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the maximum amount of ",e.product.name," you would like to sell per second, as well as the price at which you would like to sell it at.",r.a.createElement("br",null),r.a.createElement("br",null),"If the sell amount is set to 0, then the product will not be sold. If the sell price is set to 0, then the product will be discarded.",r.a.createElement("br",null),r.a.createElement("br",null),"Setting the sell amount to 'MAX' will result in you always selling the maximum possible amount of the material.",r.a.createElement("br",null),r.a.createElement("br",null),"When setting the sell amount, you can use the 'PROD' variable to designate a dynamically changing amount that depends on your production. For example, if you set the sell amount to 'PROD-1' then you will always sell 1 less of the material than you produce.",r.a.createElement("br",null),r.a.createElement("br",null),"When setting the sell price, you can use the 'MP' variable to set a dynamically changing price that depends on the Product's estimated market price. For example, if you set it to 'MP*5' then it will always be sold at five times the estimated market price."),r.a.createElement("br",null),r.a.createElement("input",{className:"text-input",value:l,autoFocus:!0,type:"text",placeholder:"Sell amount",style:{marginTop:"4px"},onChange:function(e){c(e.target.value)},onKeyDown:p}),r.a.createElement("input",{className:"text-input",value:u,type:"text",placeholder:"Sell price",style:{marginTop:"4px"},onChange:function(e){m(e.target.value)},onKeyDown:p}),r.a.createElement("button",{className:"std-button",onClick:h},"Confirm"),r.a.createElement("div",{style:{border:"1px solid white",display:"inline-block"}},r.a.createElement("label",{htmlFor:e.popupId+"-checkbox"},"Use same 'Sell Amount' for all cities"),r.a.createElement("input",{checked:t,onChange:function(e){a(e.target.checked)},id:e.popupId+"-checkbox",style:{margin:"2px"},type:"checkbox"})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(154),l=a(3),c=a(57);function u(e){const t=parseFloat(e.amount),a=t*e.mat.bCost,n=s.a[e.mat.name];return t*n>(e.warehouse.size-e.warehouse.sizeUsed)/n?r.a.createElement(r.a.Fragment,null,"Not enough warehouse space to purchase this amount"):isNaN(a)?r.a.createElement(r.a.Fragment,null,"Invalid put for Bulk Purchase amount"):r.a.createElement(r.a.Fragment,null,"Purchasing ",l.a.format(t,"0,0.00")," of ",e.mat.name," will cost"," ",l.a.formatMoney(a))}function m(e){const[t,a]=Object(n.useState)("");function l(){const a=parseFloat(t),n=s.a[e.mat.name];if(a*n>(e.warehouse.size-e.warehouse.sizeUsed)/n)Object(i.a)("You do not have enough warehouse size to fit this purchase");else if(isNaN(a))Object(i.a)("Invalid input amount");else{const t=a*e.mat.bCost;if(!e.corp.funds.gt(t))return void Object(i.a)("You cannot afford this purchase.");e.corp.funds=e.corp.funds.minus(t),e.mat.qty+=a,Object(o.b)(e.popupId)}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the amount of ",e.mat.name," you would like to bulk purchase. This purchases the specified amount instantly (all at once)."),r.a.createElement(u,{warehouse:e.warehouse,mat:e.mat,amount:t}),r.a.createElement("input",{onChange:function(e){a(e.target.value)},type:"number",placeholder:"Bulk Purchase amount",style:{margin:"5px"},onKeyDown:function(e){13===e.keyCode&&l()}}),r.a.createElement("button",{className:"std-button",onClick:l},"Confirm Bulk Purchase"))}function h(e){const[t,a]=Object(n.useState)(e.mat.buy?e.mat.buy:null);function s(){if(null!==t){try{Object(c.c)(e.mat,t)}catch(e){Object(i.a)(e+"")}Object(o.b)(e.popupId)}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the amount of ",e.mat.name," you would like to purchase per second. This material's cost changes constantly."),r.a.createElement("input",{onChange:function(e){a(parseFloat(e.target.value))},className:"text-input",autoFocus:!0,placeholder:"Purchase amount",type:"number",style:{margin:"5px"},onKeyDown:function(e){13===e.keyCode&&s()}}),r.a.createElement("button",{onClick:s,className:"std-button"},"Confirm"),r.a.createElement("button",{onClick:function(){e.mat.buy=0,Object(o.b)(e.popupId)},className:"std-button"},"Clear Purchase"),e.industry.hasResearch("Bulk Purchasing")&&r.a.createElement(m,{corp:e.corp,mat:e.mat,industry:e.industry,warehouse:e.warehouse,popupId:e.popupId}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(3);function o(e){const t=e.product.rat/e.product.mku,[a,o]=Object(n.useState)(e.product.pCost),s=Object(n.useState)(!1)[1];const l=a;let c=1;return l>e.product.pCost&&l-e.product.pCost>t&&(c=t/(l-e.product.pCost)),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("br",null),r.a.createElement("u",null,r.a.createElement("strong",null,"Market-TA.II")),r.a.createElement("br",null),"If you sell at ",i.a.formatMoney(l),", then you will sell"," ",i.a.format(c,"0.00000"),"x as much compared to if you sold at market price."),r.a.createElement("input",{className:"text-input",onChange:function(e){o(parseFloat(e.target.value))},value:a,type:"number",style:{marginTop:"4px"}}),r.a.createElement("div",{style:{display:"block"}},r.a.createElement("label",{className:"tooltip",htmlFor:"cmpy-mgmt-marketa2-checkbox",style:{color:"white"}},"Use Market-TA.II for Auto-Sale Price",r.a.createElement("span",{className:"tooltiptext"},"If this is enabled, then this Product will automatically be sold at the optimal price such that the amount sold matches the amount produced. (i.e. the highest possible price, while still ensuring that all produced materials will be sold).")),r.a.createElement("input",{className:"text-input",onChange:function(t){e.product.marketTa2=t.target.checked,s(e=>!e)},id:"cmpy-mgmt-marketa2-checkbox",style:{margin:"3px"},type:"checkbox",checked:e.product.marketTa2})),r.a.createElement("p",null,"Note that Market-TA.II overrides Market-TA.I. This means that if both are enabled, then Market-TA.II will take effect, not Market-TA.I"))}function s(e){const t=e.product.rat/e.product.mku,a=Object(n.useState)(!1)[1];return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("u",null,r.a.createElement("strong",null,"Market-TA.I")),r.a.createElement("br",null),"The maximum sale price you can mark this up to is"," ",i.a.formatMoney(e.product.pCost+t),". This means that if you set the sale price higher than this, you will begin to experience a loss in number of sales."),r.a.createElement("div",{style:{display:"block"}},r.a.createElement("label",{className:"tooltip",htmlFor:"cmpy-mgmt-marketa1-checkbox",style:{color:"white"}},"Use Market-TA.I for Auto-Sale Price",r.a.createElement("span",{className:"tooltiptext"},"If this is enabled, then this Product will automatically be sold at the price identified by Market-TA.I (i.e. the price shown above).")),r.a.createElement("input",{onChange:function(t){e.product.marketTa1=t.target.checked,a(e=>!e)},className:"text-input",id:"cmpy-mgmt-marketa1-checkbox",style:{margin:"3px"},type:"checkbox",checked:e.product.marketTa1})),e.industry.hasResearch("Market-TA.II")&&r.a.createElement(o,{product:e.product,industry:e.industry,popupId:e.popupId}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(57),o=a(148),s=a(11);function l(e){const[t,a]=Object(n.useState)(!!e.warehouse.smartSupplyUseLeftovers[e.matName]);const o=e.matName+"-use-leftovers";return r.a.createElement("div",{key:e.matName},r.a.createElement("label",{style:{color:"white"},htmlFor:o},e.warehouse.materials[e.matName].name),r.a.createElement("input",{type:"checkbox",id:o,onChange:function(t){try{const a=e.warehouse.materials[e.matName];Object(i.v)(e.warehouse,a,t.target.checked)}catch(e){Object(s.a)(e+"")}a(t.target.checked)},style:{margin:"3px"},checked:t}),r.a.createElement("br",null))}function c(e){const t=Object(n.useState)(!1)[1];const a=[];for(const t in e.warehouse.materials)e.warehouse.materials[t]instanceof o.a&&Object.keys(e.division.reqMats).includes(t)&&a.push(r.a.createElement(l,{key:t,warehouse:e.warehouse,matName:t}));return r.a.createElement(r.a.Fragment,null,r.a.createElement("label",{style:{color:"white"},htmlFor:"cmpy-mgmt-smart-supply-checkbox"},"Enable Smart Supply"),r.a.createElement("input",{type:"checkbox",id:"cmpy-mgmt-smart-supply-checkbox",onChange:function(a){Object(i.u)(e.warehouse,a.target.checked),t(e=>!e)},style:{margin:"3px"},checked:e.warehouse.smartSupplyEnabled}),r.a.createElement("br",null),r.a.createElement("p",null,"Use materials already in the warehouse instead of buying new ones, if available:"),a)}},function(e,t,a){"use strict";function n(e,t){return!!Object.keys(t.reqMats).includes(e)||(!!t.prodMats.includes(e)||!!["Hardware","Robots","AICores","RealEstate"].includes(e))}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(208);function o(e){const t=[];for(const a of Object.keys(e.division.reqMats)){const n=e.division.reqMats[a];void 0!==n&&t.push(String.raw`${n}\text{ }${a}`)}const a=e.division.prodMats.slice();return e.division.makesProducts&&a.push(e.division.type),r.a.createElement("span",{className:"text"},r.a.createElement(i.a,{display:!1,tex:t.join("+")+String.raw`\Rightarrow`+a.map(e=>String.raw`1\text{ }${e}`).join("+")}))}},,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return _}));var n=a(0),r=a.n(n),i=a(913),o=a(914),s=a(915),l=a(916),c=a(917),u=a(918),m=a(919),h=a(920),p=a(921),d=a(36),f=a(377),g=a(378),y=a(4),b=a(3),E=a(14),v=a(22),k=a(15);function _({corp:e,player:t,rerender:a}){const n=e.revenue.minus(e.expenses).toNumber();return r.a.createElement("div",null,r.a.createElement("p",null,"Total Funds: ",r.a.createElement(k.a,{money:e.funds.toNumber()}),r.a.createElement("br",null),"Total Revenue: ",r.a.createElement(k.a,{money:e.revenue.toNumber()})," / s",r.a.createElement("br",null),"Total Expenses: ",r.a.createElement(k.a,{money:e.expenses.toNumber()})," / s",r.a.createElement("br",null),"Total Profits: ",r.a.createElement(k.a,{money:n})," / s",r.a.createElement("br",null),r.a.createElement(T,{corp:e,profit:n}),"Publicly Traded: ",e.public?"Yes":"No",r.a.createElement("br",null),"Owned Stock Shares: ",b.a.format(e.numShares,"0.000a"),r.a.createElement("br",null),"Stock Price: ",e.public?r.a.createElement(k.a,{money:e.sharePrice}):"N/A",r.a.createElement("br",null)),r.a.createElement("p",{className:"tooltip"},"Total Stock Shares: ",b.a.format(e.totalShares,"0.000a"),r.a.createElement("span",{className:"tooltiptext"},"Outstanding Shares: ",b.a.format(e.issuedShares,"0.000a"),r.a.createElement("br",null),"Private Shares: ",b.a.format(e.totalShares-e.issuedShares-e.numShares,"0.000a"))),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(M,{name:"Production Multiplier: ",mult:e.getProductionMultiplier()}),r.a.createElement(M,{name:"Storage Multiplier: ",mult:e.getStorageMultiplier()}),r.a.createElement(M,{name:"Advertising Multiplier: ",mult:e.getAdvertisingMultiplier()}),r.a.createElement(M,{name:"Empl. Creativity Multiplier: ",mult:e.getEmployeeCreMultiplier()}),r.a.createElement(M,{name:"Empl. Charisma Multiplier: ",mult:e.getEmployeeChaMultiplier()}),r.a.createElement(M,{name:"Empl. Intelligence Multiplier: ",mult:e.getEmployeeIntMultiplier()}),r.a.createElement(M,{name:"Empl. Efficiency Multiplier: ",mult:e.getEmployeeEffMultiplier()}),r.a.createElement(M,{name:"Sales Multiplier: ",mult:e.getSalesMultiplier()}),r.a.createElement(M,{name:"Scientific Research Multiplier: ",mult:e.getScientificResearchMultiplier()}),r.a.createElement("br",null),r.a.createElement(P,{corp:e}),r.a.createElement("div",null,r.a.createElement(x,{className:"a-link-button",display:"inline-block",onClick:()=>e.getStarterGuide(t),text:"Getting Started Guide",tooltip:"Get a copy of and read 'The Complete Handbook for Creating a Successful Corporation.' This is a .lit file that guides you through the beginning of setting up a Corporation and provides some tips/pointers for helping you get started with managing it."}),e.public?r.a.createElement(S,{corp:e,player:t,rerender:a}):r.a.createElement(w,{corp:e,player:t,rerender:a}),r.a.createElement(O,{corp:e,player:t})),r.a.createElement("br",null),r.a.createElement(C,{corp:e,player:t,rerender:a}))}function w({corp:e,player:t,rerender:a}){const n=e.fundingRound<4,i=n?"std-button":"a-link-button-inactive",o=n?"Search for private investors who will give you startup funding in exchangefor equity (stock shares) in your company":void 0;return r.a.createElement(r.a.Fragment,null,r.a.createElement(x,{className:i,onClick:function(){const n="cmpy-mgmt-find-investors-popup";Object(v.a)(n,h.a,{rerender:a,player:t,popupId:n,corp:e})},text:"Find Investors",tooltip:o,display:"inline-block"}),r.a.createElement(x,{className:"std-button",onClick:function(){const n="cmpy-mgmt-go-public-popup";Object(v.a)(n,p.a,{rerender:a,player:t,popupId:n,corp:e})},display:"inline-block",text:"Go Public",tooltip:"Become a publicly traded and owned entity. Going public involves issuing shares for an IPO. Once you are a public company, your shares will be traded on the stock market."}),r.a.createElement("br",null))}function C({corp:e,player:t,rerender:a}){return e.divisions.length<=0?r.a.createElement("h1",null,"Upgrades are unlocked once you create an industry."):r.a.createElement("div",{className:"cmpy-mgmt-upgrade-container"},r.a.createElement("h1",{className:"cmpy-mgmt-upgrade-header"}," Unlocks "),Object.values(f.a).filter(t=>0===e.unlockUpgrades[t[0]]).map(n=>r.a.createElement(o.a,{rerender:a,player:t,corp:e,upgradeData:n,key:n[0]})),r.a.createElement("h1",{className:"cmpy-mgmt-upgrade-header"}," Upgrades "),e.upgrades.map((e,t)=>g.a[t]).map(n=>r.a.createElement(i.a,{rerender:a,player:t,corp:e,upgrade:n,key:n[0]})))}function S({corp:e,player:t,rerender:a}){const n=e.shareSaleCooldown>0,i=n?"a-link-button-inactive":"std-button",o=n?"Cannot sell shares for "+e.convertCooldownToString(e.shareSaleCooldown):"Sell your shares in the company. The money earned from selling your shares goes into your personal account, not the Corporation's. This is one of the only ways to profit from your business venture.",s=e.issueNewSharesCooldown>0,h=s?"a-link-button-inactive":"std-button",p=s?"Cannot issue new shares for "+e.convertCooldownToString(e.issueNewSharesCooldown):"Issue new equity shares to raise capital.";return r.a.createElement(r.a.Fragment,null,r.a.createElement(x,{className:i,display:"inline-block",onClick:function(){const n="cmpy-mgmt-sell-shares-popup";Object(v.a)(n,l.a,{corp:e,player:t,popupId:n,rerender:a})},text:"Sell Shares",tooltip:o}),r.a.createElement(x,{className:"std-button",display:"inline-block",onClick:function(){const n="corp-buyback-shares-popup";Object(v.a)(n,c.a,{rerender:a,player:t,popupId:n,corp:e})},text:"Buyback shares",tooltip:"Buy back shares you that previously issued or sold at market price."}),r.a.createElement("br",null),r.a.createElement(x,{className:h,display:"inline-block",onClick:function(){const t="cmpy-mgmt-issue-new-shares-popup";Object(v.a)(t,m.a,{popupId:t,corp:e})},text:"Issue New Shares",tooltip:p}),r.a.createElement(x,{className:"std-button",display:"inline-block",onClick:function(){const t="cmpy-mgmt-issue-dividends-popup";Object(v.a)(t,u.a,{popupId:t,corp:e})},text:"Issue Dividends",tooltip:"Manage the dividends that are paid out to shareholders (including yourself)"}),r.a.createElement("br",null))}function x({className:e="std-button",text:t,display:a,tooltip:n,onClick:i}){const o=null!=n;return o&&(e+=" tooltip"),r.a.createElement("button",{className:e,onClick:i,style:{display:a||"block"}},t,o&&r.a.createElement("span",{className:"tooltiptext"},n))}function O({player:e,corp:t}){const a=t.determineValuation()>=d.a.BribeThreshold||!0,n=a?"a-link-button":"a-link-button-inactive";return r.a.createElement(x,{className:n,display:"inline-block",onClick:function(){Object(v.a)("corp-bribe-popup",s.a,{player:e,popupId:"corp-bribe-popup",corp:t})},text:"Bribe Factions",tooltip:a?"Use your Corporations power and influence to bribe Faction leaders in exchange for reputation":"Your Corporation is not powerful enough to bribe Faction leaders"})}function T({corp:e,profit:t}){if(e.dividendPercentage<=0||t<=0)return r.a.createElement(r.a.Fragment,null);const a=e.dividendPercentage/100*t,n=t-a,i=a/e.totalShares,o=e.numShares*i;return r.a.createElement(r.a.Fragment,null,"Retained Profits (after dividends): ",r.a.createElement(k.a,{money:n})," / s",r.a.createElement("br",null),r.a.createElement("br",null),"Dividend Percentage: ",b.a.format(e.dividendPercentage/100,"0%"),r.a.createElement("br",null),"Dividends per share: ",r.a.createElement(k.a,{money:i})," / s",r.a.createElement("br",null),"Your earnings as a shareholder (Pre-Tax): ",r.a.createElement(k.a,{money:o})," / s",r.a.createElement("br",null),"Dividend Tax Rate: ",e.dividendTaxPercentage,"%",r.a.createElement("br",null),"Your earnings as a shareholder (Post-Tax):"," ",r.a.createElement(k.a,{money:o*(1-e.dividendTaxPercentage/100)})," / s",r.a.createElement("br",null),r.a.createElement("br",null))}function M({name:e,mult:t}){return t<=1?r.a.createElement(r.a.Fragment,null):r.a.createElement("p",null,e,b.a.format(t,"0.000"),r.a.createElement("br",null))}function P({corp:e}){const t=e.storedCycles*y.a.MilliPerCycle;return t<=15e3?r.a.createElement(r.a.Fragment,null):r.a.createElement("p",null,"Bonus time: ",Object(E.b)(t),r.a.createElement("br",null),r.a.createElement("br",null))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(57),s=a(102);function l(e){const t=e.upgrade,a=e.corp.upgrades[t[0]],n=t[1],l=t[2],c=n*Math.pow(l,a),u=r.a.createElement(r.a.Fragment,null,t[4]," - ",r.a.createElement(s.a,{money:c,corp:e.corp})),m=t[5];return r.a.createElement("button",{className:"cmpy-mgmt-upgrade-div tooltip",style:{width:"45%"},onClick:function(){if(!e.corp.funds.lt(c)){try{Object(o.h)(e.corp,e.upgrade)}catch(e){Object(i.a)(e+"")}e.rerender()}}},u,r.a.createElement("span",{className:"tooltiptext"},m))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(57),s=a(102);function l(e){const t=e.upgradeData,a=r.a.createElement(r.a.Fragment,null,t[2]," - ",r.a.createElement(s.a,{money:t[1],corp:e.corp})),n=t[3];return r.a.createElement("button",{className:"cmpy-mgmt-upgrade-div tooltip",style:{width:"45%"},onClick:function(){if(!e.corp.funds.lt(t[1])){try{Object(o.x)(e.corp,e.upgradeData)}catch(e){Object(i.a)(e+"")}e.rerender()}}},a,r.a.createElement("span",{className:"tooltiptext"},n))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(24),o=a(36),s=a(3),l=a(22),c=a(11);function u(e){const[t,a]=Object(n.useState)(0),[u,m]=Object(n.useState)(0),[h,p]=Object(n.useState)(e.player.factions.length>0?e.player.factions[0]:"");function d(t,a){return(t+a*e.corp.sharePrice)/o.a.BribeToRepRatio}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"You can use Corporation funds or stock shares to bribe Faction Leaders in exchange for faction reputation."),r.a.createElement("select",{className:"dropdown",style:{margin:"3px"},defaultValue:h,onChange:function(e){p(e.target.value)}},e.player.factions.map(e=>{if(i.a[e].getInfo().offersWork())return r.a.createElement("option",{key:e,value:e},e)})),r.a.createElement("p",null,function(t,a){return 0===t&&0===a?"":isNaN(t)||isNaN(a)||t<0||a<0?"ERROR: Invalid value(s) entered":e.corp.funds.lt(t)?"ERROR: You do not have this much money to bribe with":a>e.corp.numShares?"ERROR: You do not have this many shares to bribe with":"You will gain "+s.a.formatReputation(d(t,a))+" reputation with "+h+" with this bribe"}(t||0,u||0)),r.a.createElement("input",{className:"text-input",onChange:function(e){a(parseFloat(e.target.value))},placeholder:"Corporation funds",style:{margin:"5px"}}),r.a.createElement("input",{className:"text-input",onChange:function(e){m(parseFloat(e.target.value))},placeholder:"Stock Shares",style:{margin:"5px"}}),r.a.createElement("button",{className:"a-link-button",onClick:()=>function(t,a){const n=i.a[h];if(null==n&&Object(c.a)("ERROR: You must select a faction to bribe"),isNaN(t)||isNaN(a)||t<0||a<0);else if(e.corp.funds.lt(t));else if(a>e.corp.numShares);else{const r=d(t,a);Object(c.a)("You gained "+s.a.formatReputation(r)+" reputation with "+n.name+" by bribing them."),n.playerReputation+=r,e.corp.funds=e.corp.funds.minus(t),e.corp.numShares-=a,Object(l.b)(e.popupId)}}(t||0,u||0),style:{display:"inline-block"}},"Bribe"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(3),o=a(11),s=a(22),l=a(36);function c(e){const[t,a]=Object(n.useState)(null);function c(){if(null!==t)if(isNaN(t)||t<=0)Object(o.a)("ERROR: Invalid value for number of shares");else if(t>e.corp.numShares)Object(o.a)("ERROR: You don't have this many shares to sell");else{const a=e.corp.calculateShareSale(t),n=a[0],r=a[1],c=a[2];if(e.corp.numShares-=t,isNaN(e.corp.issuedShares)){console.error("Corporation issuedShares is NaN: "+e.corp.issuedShares);const t=e.corp.issuedShares;isNaN(t)?e.corp.issuedShares=0:e.corp.issuedShares=t}e.corp.issuedShares+=t,e.corp.sharePrice=r,e.corp.shareSalesUntilPriceUpdate=c,e.corp.shareSaleCooldown=l.a.SellSharesCooldown,e.player.gainMoney(n),e.player.recordMoneySource(n,"corporation"),Object(s.b)(e.popupId),Object(o.a)(`Sold ${i.a.formatMoney(t)} shares for `+i.a.formatMoney(n)+". "+`The corporation's stock price fell to ${i.a.formatMoney(e.corp.sharePrice)} as a result of dilution.`),e.rerender()}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the number of shares you would like to sell. The money from selling your shares will go directly to you (NOT your Corporation).",r.a.createElement("br",null),r.a.createElement("br",null),"Selling your shares will cause your corporation's stock price to fall due to dilution. Furthermore, selling a large number of shares all at once will have an immediate effect in reducing your stock price.",r.a.createElement("br",null),r.a.createElement("br",null),"The current price of your company's stock is ",i.a.formatMoney(e.corp.sharePrice)),r.a.createElement((function(e){if(null===e.shares)return r.a.createElement(r.a.Fragment,null);if(isNaN(e.shares)||e.shares<=0)return r.a.createElement(r.a.Fragment,null,"ERROR: Invalid value entered for number of shares to sell");if(e.shares>e.corp.numShares)return r.a.createElement(r.a.Fragment,null,"You don't have this many shares to sell!");{const t=e.corp.calculateShareSale(e.shares)[0];return r.a.createElement(r.a.Fragment,null,"Sell ",e.shares," shares for a total of ",i.a.formatMoney(t))}}),{shares:t,corp:e.corp}),r.a.createElement("br",null),r.a.createElement("input",{autoFocus:!0,className:"text-input",type:"number",placeholder:"Shares to sell",style:{margin:"5px"},onChange:function(e){""===e.target.value?a(null):a(Math.round(parseFloat(e.target.value)))},onKeyDown:function(e){13===e.keyCode&&c()}}),r.a.createElement("button",{onClick:c,className:"a-link-button",style:{display:"inline-block"}},"Sell shares"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(22),o=a(3),s=a(11);function l(e){const[t,a]=Object(n.useState)(null);const l=1.1*e.corp.sharePrice;function c(){if(null===t)return;const a=1.1*e.corp.sharePrice;if(isNaN(t)||t<=0)Object(s.a)("ERROR: Invalid value for number of shares");else if(t>e.corp.issuedShares)Object(s.a)("ERROR: There are not this many oustanding shares to buy back");else if(t*a>e.player.money)Object(s.a)("ERROR: You do not have enough money to purchase this many shares (you need "+o.a.format(t*a,"$0.000a")+")");else{if(e.corp.numShares+=t,isNaN(e.corp.issuedShares)){console.warn("Corporation issuedShares is NaN: "+e.corp.issuedShares),console.warn("Converting to number now");const t=e.corp.issuedShares;isNaN(t)?e.corp.issuedShares=0:e.corp.issuedShares=t}e.corp.issuedShares-=t,e.player.loseMoney(t*a),Object(i.b)(e.popupId),e.rerender()}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the number of outstanding shares you would like to buy back. These shares must be bought at a 10% premium. However, repurchasing shares from the market tends to lead to an increase in stock price.",r.a.createElement("br",null),r.a.createElement("br",null),"To purchase these shares, you must use your own money (NOT your Corporation's funds).",r.a.createElement("br",null),r.a.createElement("br",null),"The current buyback price of your company's stock is ",o.a.formatMoney(l),". Your company currently has ",o.a.formatBigNumber(e.corp.issuedShares)," outstanding stock shares."),r.a.createElement((function(){return null===t?r.a.createElement(r.a.Fragment,null):isNaN(t)||t<=0?r.a.createElement(r.a.Fragment,null,"ERROR: Invalid value entered for number of shares to buyback"):t>e.corp.issuedShares?r.a.createElement(r.a.Fragment,null,"There are not this many shares available to buy back. There are only"," ",o.a.formatBigNumber(e.corp.issuedShares)," outstanding shares."):r.a.createElement(r.a.Fragment,null,"Purchase ",t," shares for a total of ",o.a.formatMoney(t*l))}),null),r.a.createElement("br",null),r.a.createElement("input",{autoFocus:!0,className:"text-input",type:"number",placeholder:"Shares to buyback",style:{margin:"5px"},onChange:function(e){""===e.target.value?a(null):a(Math.round(parseFloat(e.target.value)))},onKeyDown:function(e){13===e.keyCode&&c()}}),r.a.createElement("button",{onClick:c,className:"a-link-button",style:{display:"inline-block"}},"Buy shares"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(22),o=a(11),s=a(36),l=a(57);function c(e){const[t,a]=Object(n.useState)(null);function c(){if(null!==t){try{Object(l.g)(e.corp,t/100)}catch(e){Object(o.a)(e+"")}Object(i.b)(e.popupId)}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Dividends are a distribution of a portion of the corporation's profits to the shareholders. This includes yourself, as well.",r.a.createElement("br",null),r.a.createElement("br",null),"In order to issue dividends, simply allocate some percentage of your corporation's profits to dividends. This percentage must be an integer between 0 and ",s.a.DividendMaxPercentage,". (A percentage of 0 means no dividends will be issued",r.a.createElement("br",null),r.a.createElement("br",null),"Two important things to note:",r.a.createElement("br",null),"* Issuing dividends will negatively affect your corporation's stock price",r.a.createElement("br",null),"* Dividends are taxed. Taxes start at 50%, but can be decreased",r.a.createElement("br",null),r.a.createElement("br",null),"Example: Assume your corporation makes $100m / sec in profit and you allocate 40% of that towards dividends. That means your corporation will gain $60m / sec in funds and the remaining $40m / sec will be paid as dividends. Since your corporation starts with 1 billion shares, every shareholder will be paid $0.04 per share per second before taxes."),r.a.createElement("input",{autoFocus:!0,onChange:function(e){""===e.target.value?a(null):a(parseFloat(e.target.value))},onKeyDown:function(e){13===e.keyCode&&c()},className:"text-input",placeholder:"Dividend %",type:"number",style:{margin:"5px"}}),r.a.createElement("button",{onClick:c,className:"std-button",style:{display:"inline-block"}},"Allocate Dividend Percentage"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(3),o=a(11),s=a(22),l=a(21),c=a(36);function u(e){if(null===e.shares)return r.a.createElement(r.a.Fragment,null);const t=Math.round(.9*e.corp.sharePrice),a=Math.round(.2*e.corp.totalShares),n=a-a%1e6;let o=e.shares;return isNaN(o)?r.a.createElement("p",null,"Invalid input"):(o/=1e7,o=1e7*Math.round(o),o<1e7?r.a.createElement("p",null,"Must issue at least 10 million new shares"):o>n?r.a.createElement("p",null,"You cannot issue that many shares"):r.a.createElement("p",null,"Issue $",i.a.format(o,"0.000a")," new shares for"," ",i.a.formatMoney(o*t),"?"))}function m(e){const[t,a]=Object(n.useState)(null),m=Math.round(.2*e.corp.totalShares),h=m-m%1e6;function p(){if(null===t)return;const a=Math.round(.9*e.corp.sharePrice);let n=t;if(isNaN(n))return void Object(o.a)("Invalid input for number of new shares");if(n=1e7*Math.round(n/1e7),n<1e7||n>h)return void Object(o.a)("Invalid input for number of new shares");const r=n*a;e.corp.issueNewSharesCooldown=c.a.IssueNewSharesCooldown,e.corp.totalShares+=n;let u=Object(l.a)(0,Math.round(n/2));u=1e6*Math.round(u/1e6),e.corp.issuedShares+=n-u,e.corp.funds=e.corp.funds.plus(r),e.corp.immediatelyUpdateSharePrice(),Object(s.b)(e.popupId),Object(o.a)(`Issued ${i.a.format(n,"0.000a")} and raised ${i.a.formatMoney(r)}. ${i.a.format(u,"0.000a")} of these shares were bought by private investors.

Stock price decreased to `+i.a.formatMoney(e.corp.sharePrice))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"You can issue new equity shares (i.e. stocks) in order to raise capital for your corporation.",r.a.createElement("br",null),r.a.createElement("br",null)," * You can issue at most ",i.a.formatMoney(h)," new shares",r.a.createElement("br",null)," * New shares are sold at a 10% discount",r.a.createElement("br",null)," * You can only issue new shares once every 12 hours",r.a.createElement("br",null)," * Issuing new shares causes dilution, resulting in a decrease in stock price and lower dividends per share",r.a.createElement("br",null)," * Number of new shares issued must be a multiple of 10 million",r.a.createElement("br",null),r.a.createElement("br",null),"When you choose to issue new equity, private shareholders have first priority for up to 50% of the new shares. If they choose to exercise this option, these newly issued shares become private, restricted shares, which means you cannot buy them back."),r.a.createElement(u,{corp:e.corp,shares:t}),r.a.createElement("input",{className:"text-input",autoFocus:!0,placeholder:"# New Shares",style:{margin:"5px"},onChange:function(e){""===e.target.value?a(null):a(parseFloat(e.target.value))},onKeyDown:function(e){13===e.keyCode&&p()}}),r.a.createElement("button",{onClick:p,className:"std-button",style:{display:"inline-block"}},"Issue New Shares"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(22),o=a(3),s=a(36);function l(e){const t=e.corp.determineValuation();let a=0,n=4;switch(e.corp.fundingRound){case 0:a=.1,n=4;break;case 1:a=.35,n=3;break;case 2:a=.25,n=3;break;case 3:a=.2,n=2.5;break;default:return r.a.createElement(r.a.Fragment,null)}const l=t*a*n,c=Math.floor(s.a.INITIALSHARES*a);return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"An investment firm has offered you ",o.a.formatMoney(l)," in funding in exchange for a"," ",o.a.format(100*a,"0.000a"),"% stake in the company (",o.a.format(c,"0.000a")," shares).",r.a.createElement("br",null),r.a.createElement("br",null),"Do you accept or reject this offer?",r.a.createElement("br",null),r.a.createElement("br",null),"Hint: Investment firms will offer more money if your corporation is turning a profit"),r.a.createElement("button",{onClick:function(){e.corp.fundingRound++,e.corp.addFunds(l),e.corp.numShares-=c,e.rerender(),Object(i.b)(e.popupId)},className:"std-button"},"Accept"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(3);function l(e){const[t,a]=Object(n.useState)(""),l=e.corp.determineValuation()/e.corp.totalShares;function c(){const a=parseFloat(t),n=e.corp.determineValuation()/e.corp.totalShares;isNaN(a)?Object(i.a)("Invalid value for number of issued shares"):a>e.corp.numShares?Object(i.a)("Error: You don't have that many shares to issue!"):(e.corp.public=!0,e.corp.sharePrice=n,e.corp.issuedShares=a,e.corp.numShares-=a,e.corp.addFunds(a*n),e.rerender(),Object(i.a)(`You took your ${e.corp.name} public and earned `+s.a.formatMoney(a*n)+" in your IPO"),Object(o.b)(e.popupId))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the number of shares you would like to issue for your IPO. These shares will be publicly sold and you will no longer own them. Your Corporation will receive ",s.a.formatMoney(l)," per share (the IPO money will be deposited directly into your Corporation's funds).",r.a.createElement("br",null),r.a.createElement("br",null),"You have a total of ",s.a.format(e.corp.numShares,"0.000a")," of shares that you can issue."),r.a.createElement("input",{className:"text-input",value:t,onChange:function(e){a(e.target.value)},autoFocus:!0,type:"number",placeholder:"Shares to issue",onKeyDown:function(e){13===e.keyCode&&c()}}),r.a.createElement("button",{className:"std-button",onClick:c},"Go Public"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(923),o=a(924),s=a(47);function l(e){const t=s.b.Player(),a=s.b.Router(),[l,c]=Object(n.useState)(!1);if(void 0===e.location.infiltrationData)throw new Error("Trying to do infiltration on invalid location.");const u=e.location.infiltrationData.startingSecurityLevel,m=function(e,t){const a=e.strength+e.defense+e.dexterity+e.agility+e.charisma,n=t-Math.pow(a,.9)/250-e.intelligence/1600;return n<0?0:n>3?3:n}(t,u);return l?r.a.createElement(o.a,{StartingDifficulty:u,Difficulty:m,MaxLevel:e.location.infiltrationData.maxClearanceLevel}):r.a.createElement(i.a,{Location:e.location,Difficulty:m,MaxLevel:e.location.infiltrationData.maxClearanceLevel,start:()=>c(!0),cancel:function(){a.toCity()}})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(26),o=a(54);function s(e,t){let a="";return t<=0?t=0:t>13?t=13:(t--,a=">"),r.a.createElement("span",{style:{color:e}},"=".repeat(t),a," ".repeat(13-a.length-t))}function l(e){return r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{container:!0,spacing:3},r.a.createElement(o.a,{item:!0,xs:10},r.a.createElement("h1",null,"Infiltrating ",e.Location.name)),r.a.createElement(o.a,{item:!0,xs:10},r.a.createElement("h2",null,"Maximum level: ",e.MaxLevel)),r.a.createElement(o.a,{item:!0,xs:10},r.a.createElement("pre",null,"[",0===(t=e.Difficulty)?r.a.createElement("span",{style:{color:"white"}},">"," ".repeat(38)):r.a.createElement(r.a.Fragment,null,s("white",13*t),s("orange",13*(t-1)),s("red",13*(t-2))),"]"),r.a.createElement("pre",null," ^ ^ ^ ^"),r.a.createElement("pre",null," Trivial Normal Hard Impossible")),r.a.createElement(o.a,{item:!0,xs:10},r.a.createElement("p",null,"Infiltration is a series of short minigames that get progressively harder. You take damage for failing them. Reaching the maximum level rewards you with intel you can trade for money or reputation."),r.a.createElement("br",null),r.a.createElement("p",null,"The minigames you play are randomly selected. It might take you few tries to get used to them."),r.a.createElement("br",null),r.a.createElement("p",null,"No game require use of the mouse."),r.a.createElement("br",null),r.a.createElement("p",null,"Spacebar is the default action/confirm button."),r.a.createElement("br",null),r.a.createElement("p",null,"Everything that uses arrow can also use WASD"),r.a.createElement("br",null),r.a.createElement("p",null,"Sometimes the rest of the keyboard is used.")),r.a.createElement(o.a,{item:!0,xs:3},r.a.createElement(i.a,{onClick:e.start,text:"Start"})),r.a.createElement(o.a,{item:!0,xs:3},r.a.createElement(i.a,{onClick:e.cancel,text:"Cancel"}))));var t}},function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n,r=a(47),i=a(0),o=a.n(i),s=a(54),l=a(925),c=a(926),u=a(928),m=a(929),h=a(930),p=a(931),d=a(932),f=a(933),g=a(934),y=a(935);!function(e){e[e.Countdown=0]="Countdown",e[e.Minigame=1]="Minigame",e[e.Result=2]="Result",e[e.Sell=3]="Sell"}(n||(n={}));const b=[u.a,c.a,m.a,h.a,p.a,d.a,f.a,g.a];function E(e){const t=r.b.Player(),a=r.b.Router(),[c,u]=Object(i.useState)(1),[m,h]=Object(i.useState)(n.Countdown),[p,d]=Object(i.useState)(""),[f,g]=Object(i.useState)({lastGames:[-1,-1],id:Math.floor(Math.random()*b.length)});function E(){let e=f.lastGames[0];const t=[f.lastGames[0],f.lastGames[1],f.id];for(;t.includes(e);)e=Math.floor(Math.random()*b.length);return e}function v(){g({lastGames:[f.lastGames[1],f.id],id:E()})}function k(e){d(t=>{let a=t;return a+=e?"✓":"✗",a.length>15&&(a=a.slice(1)),a})}let _;switch(m){case n.Countdown:_=o.a.createElement(l.a,{onFinish:()=>h(n.Minigame)});break;case n.Minigame:{const r=b[f.id];_=o.a.createElement(r,{onSuccess:function(){k(!0),c===e.MaxLevel?h(n.Sell):(h(n.Countdown),u(c+1)),v()},onFailure:function(r){h(n.Countdown),k(!1);const i=null!=r&&r.automated?t.hp:3*e.StartingDifficulty;t.takeDamage(i)?a.toCity():v()},difficulty:e.Difficulty+c/50});break}case n.Sell:_=o.a.createElement(y.a,{StartingDifficulty:e.StartingDifficulty,Difficulty:e.Difficulty,MaxLevel:e.MaxLevel})}return o.a.createElement(o.a.Fragment,null,o.a.createElement(s.a,{container:!0,spacing:3},o.a.createElement(s.a,{item:!0,xs:3},o.a.createElement("h3",null,"Level: ",c," / ",e.MaxLevel),o.a.createElement((function(){return o.a.createElement("h4",null,o.a.createElement("span",{style:{color:"gray"}},p.slice(0,p.length-1)),p[p.length-1])}),null)),o.a.createElement(s.a,{item:!0,xs:12},_)))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(54);function o(e){const[t,a]=Object(n.useState)(3);return Object(n.useEffect)(()=>{0!==t?setTimeout(()=>a(t-1),200):e.onFinish()}),r.a.createElement(r.a.Fragment,null,r.a.createElement(i.a,{container:!0,spacing:3},r.a.createElement(i.a,{item:!0,xs:12},r.a.createElement("h1",null,"Get Ready!"),r.a.createElement("h1",null,t))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(206),c=a(162),u=a(502);const m={Trivial:{timer:8e3,min:2,max:3},Normal:{timer:6e3,min:4,max:5},Hard:{timer:4e3,min:4,max:6},Impossible:{timer:2500,min:7,max:7}};function h(e){const t={timer:0,min:0,max:0};Object(c.a)(m,e.difficulty,t);const a=t.timer,[h,p]=Object(n.useState)(""),[d]=Object(n.useState)(function(e){let t="";const a=Object(l.b)(e.min,e.max);for(let e=0;e":"":"]"}(t);a&&(!function(e,t){return"["===e&&"]"===t||"<"===e&&">"===t||"("===e&&")"===t||"{"===e&&"}"===t}(d[d.length-h.length-1],a)?e.onFailure():d.length!==h.length+1?p(h+a):e.onSuccess())},onFailure:e.onFailure})))}},,function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(162);const c={Trivial:{window:600},Normal:{window:325},Hard:{window:250},Impossible:{window:150}};function u(e){const t={window:0};Object(l.a)(c,e.difficulty,t);const[a,u]=Object(n.useState)(!0);return Object(n.useEffect)(()=>{let e=-1;const a=window.setTimeout(()=>{u(!1),e=window.setTimeout(()=>u(!0),t.window)},3250*Math.random()+1500);return()=>{clearInterval(a),-1!==e&&clearInterval(e)}},[]),r.a.createElement(i.a,{container:!0,spacing:3},r.a.createElement(s.a,{millis:5e3,onExpire:e.onFailure}),r.a.createElement(i.a,{item:!0,xs:12},r.a.createElement("h1",{className:"noselect"},"Slash when his guard is down!"),r.a.createElement("p",{style:{fontSize:"5em"}},a?"!Guarding!":"!ATTACKING!"),r.a.createElement(o.a,{onKeyDown:function(t){t.preventDefault(),32===t.keyCode&&(a?e.onFailure():e.onSuccess())},onFailure:e.onFailure})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(206),c=a(162),u=a(502);const m={Trivial:{timer:16e3,min:3,max:4},Normal:{timer:12500,min:2,max:3},Hard:{timer:15e3,min:3,max:4},Impossible:{timer:8e3,min:4,max:4}};function h(e){const t={timer:0,min:0,max:0};Object(c.a)(m,e.difficulty,t);const a=t.timer,[h]=Object(n.useState)(function(e){const t=Object(l.b)(e.min,e.max);let a="";for(let e=0;e0&&(a+=" "),a+=p[Math.floor(Math.random()*p.length)];return a}(t)),[d,f]=Object(n.useState)("");return r.a.createElement(i.a,{container:!0,spacing:3},r.a.createElement(s.a,{millis:a,onExpire:e.onFailure}),r.a.createElement(i.a,{item:!0,xs:12},r.a.createElement("h1",{className:"noselect"},"Type it backward"),r.a.createElement(o.a,{onKeyDown:function(t){if(t.preventDefault(),16===t.keyCode)return;const a=d+t.key.toUpperCase();h.startsWith(a)?h===a?e.onSuccess():f(a):e.onFailure()},onFailure:e.onFailure})),r.a.createElement(i.a,{item:!0,xs:6},r.a.createElement("p",{style:{transform:"scaleX(-1)"}},h)),r.a.createElement(i.a,{item:!0,xs:6},r.a.createElement("p",null,d,r.a.createElement(u.a,null))))}const p=["ALGORITHM","ANALOG","APP","APPLICATION","ARRAY","BACKUP","BANDWIDTH","BINARY","BIT","BITE","BITMAP","BLOG","BLOGGER","BOOKMARK","BOOT","BROADBAND","BROWSER","BUFFER","BUG","BUS","BYTE","CACHE","CAPS LOCK","CAPTCHA","CD","CD-ROM","CLIENT","CLIPBOARD","CLOUD","COMPUTING","COMMAND","COMPILE","COMPRESS","COMPUTER","CONFIGURE","COOKIE","COPY","CPU","CYBERCRIME","CYBERSPACE","DASHBOARD","DATA","MINING","DATABASE","DEBUG","DECOMPRESS","DELETE","DESKTOP","DEVELOPMENT","DIGITAL","DISK","DNS","DOCUMENT","DOMAIN","DOMAIN NAME","DOT","DOT MATRIX","DOWNLOAD","DRAG","DVD","DYNAMIC","EMAIL","EMOTICON","ENCRYPT","ENCRYPTION","ENTER","EXABYTE","FAQ","FILE","FINDER","FIREWALL","FIRMWARE","FLAMING","FLASH","FLASH DRIVE","FLOPPY DISK","FLOWCHART","FOLDER","FONT","FORMAT","FRAME","FREEWARE","GIGABYTE","GRAPHICS","HACK","HACKER","HARDWARE","HOME PAGE","HOST","HTML","HYPERLINK","HYPERTEXT","ICON","INBOX","INTEGER","INTERFACE","INTERNET","IP ADDRESS","ITERATION","JAVA","JOYSTICK","JUNKMAIL","KERNEL","KEY","KEYBOARD","KEYWORD","LAPTOP","LASER PRINTER","LINK","LINUX","LOG OUT","LOGIC","LOGIN","LURKING","MACINTOSH","MACRO","MAINFRAME","MALWARE","MEDIA","MEMORY","MIRROR","MODEM","MONITOR","MOTHERBOARD","MOUSE","MULTIMEDIA","NET","NETWORK","NODE","NOTEBOOK","COMPUTER","OFFLINE","ONLINE","OPENSOURCE","OPERATING","SYSTEM","OPTION","OUTPUT","PAGE","PASSWORD","PASTE","PATH","PHISHING","PIRACY","PIRATE","PLATFORM","PLUGIN","PODCAST","POPUP","PORTAL","PRINT","PRINTER","PRIVACY","PROCESS","PROGRAM","PROGRAMMER","PROTOCOL","QUEUE","QWERTY","RAM","REALTIME","REBOOT","RESOLUTION","RESTORE","ROM","ROOT","ROUTER","RUNTIME","SAVE","SCAN","SCANNER","SCREEN","SCREENSHOT","SCRIPT","SCROLL","SCROLL","SEARCH","ENGINE","SECURITY","SERVER","SHAREWARE","SHELL","SHIFT","SHIFT KEY","SNAPSHOT","SOCIAL NETWORKING","SOFTWARE","SPAM","SPAMMER","SPREADSHEET","SPYWARE","STATUS","STORAGE","SUPERCOMPUTER","SURF","SYNTAX","TABLE","TAG","TERMINAL","TEMPLATE","TERABYTE","TEXT EDITOR","THREAD","TOOLBAR","TRASH","TROJAN HORSE","TYPEFACE","UNDO","UNIX","UPLOAD","URL","USER","USER INTERFACE","USERNAME","UTILITY","VERSION","VIRTUAL","VIRTUAL MEMORY","VIRUS","WEB","WEBMASTER","WEBSITE","WIDGET","WIKI","WINDOW","WINDOWS","WIRELESS","PROCESSOR","WORKSTATION","WEB","WORM","WWW","XML","ZIP"]},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(162);const c={Trivial:{timer:12e3,size:6},Normal:{timer:9e3,size:8},Hard:{timer:5e3,size:9},Impossible:{timer:2500,size:12}};function u(e){const t={timer:0,size:0};Object(l.a)(c,e.difficulty,t);const a=t.timer,[u]=Object(n.useState)(function(e){const t=[];t.push(m[Math.floor(Math.random()*m.length)]);for(let a=0;a0;t--){const a=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[a],e[a]=n}}(t),t}(t)),[p,d]=Object(n.useState)(0);return r.a.createElement(i.a,{container:!0,spacing:3},r.a.createElement(s.a,{millis:a,onExpire:e.onFailure}),r.a.createElement(i.a,{item:!0,xs:12},r.a.createElement("h1",null,"Say something nice about the guard."),r.a.createElement(o.a,{onKeyDown:function(t){t.preventDefault();const a=t.keyCode;if(32===a)return void(m.includes(u[p])?e.onSuccess():e.onFailure());let n=p;for([38,87,68,39].includes(a)&&n++,[65,37,83,40].includes(a)&&n--;n<0;)n+=u.length;for(;n>u.length-1;)n-=u.length;d(n)},onFailure:e.onFailure})),r.a.createElement(i.a,{item:!0,xs:6},r.a.createElement("h2",{style:{fontSize:"2em"}},"↑"),r.a.createElement("h2",{style:{fontSize:"2em"}},u[p]),r.a.createElement("h2",{style:{fontSize:"2em"}},"↓")))}const m=["affectionate","agreeable","bright","charming","creative","determined","energetic","friendly","funny","generous","polite","likable","diplomatic","helpful","giving","kind","hardworking","patient","dynamic","loyal"],h=["aggressive","aloof","arrogant","big-headed","boastful","boring","bossy","careless","clingy","couch potato","cruel","cynical","grumpy","hot air","know it all","obnoxious","pain in the neck","picky","tactless","thoughtless"]},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(206),c=a(162);const u={Trivial:{timer:13e3,min:6,max:8},Normal:{timer:7e3,min:7,max:8},Hard:{timer:5e3,min:8,max:9},Impossible:{timer:3e3,min:9,max:10}};function m(e){const t={timer:0,min:0,max:0};Object(c.a)(u,e.difficulty,t);const a=t.timer,[m]=Object(n.useState)(function(e){const t=["←","→","↑","↓"];let a="";for(let n=0;n=m.length&&e.onSuccess()):e.onFailure()},onFailure:e.onFailure})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(162),c=a(206);const u={Trivial:{timer:12500,width:3,height:3,symbols:6},Normal:{timer:15e3,width:4,height:4,symbols:7},Hard:{timer:12500,width:5,height:5,symbols:8},Impossible:{timer:1e4,width:6,height:6,symbols:9}};function m(e){const t={timer:0,width:0,height:0,symbols:0};Object(l.a)(u,e.difficulty,t);const a=t.timer,[m]=Object(n.useState)(function(e){const t=[];for(let a=0;at==d?r.a.createElement("span",{key:""+t,style:{fontSize:"1em",color:"blue"}},e," "):r.a.createElement("span",{key:""+t,style:{fontSize:"1em"}},e," "))),r.a.createElement("br",null),m.map((e,t)=>r.a.createElement("div",{key:t},r.a.createElement("pre",null,e.map((e,a)=>a==g[0]&&t==g[1]?r.a.createElement("span",{key:`${a}${t}`,style:{fontSize:"2em",color:"blue"}},e," "):r.a.createElement("span",{key:`${a}${t}`,style:{fontSize:"2em"}},e," "))),r.a.createElement("br",null))),r.a.createElement(o.a,{onKeyDown:function(t){t.preventDefault();const a=[0,0];switch(Object(c.a)(t)){case"↑":a[1]--;break;case"←":a[0]--;break;case"↓":a[1]++;break;case"→":a[0]++}const n=[g[0]+a[0],g[1]+a[1]];if(n[0]=(n[0]+m[0].length)%m[0].length,n[1]=(n[1]+m.length)%m.length,y(n),32==t.keyCode){if(m[g[1]][g[0]]!==p[d])return void e.onFailure();f(d+1),p.length===d+1&&e.onSuccess()}},onFailure:e.onFailure})))}function h(){return"ABCDEF0123456789"[Math.floor(16*Math.random())]}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(162),c=a(206);const u={Trivial:{timer:15e3,width:3,height:3,mines:4},Normal:{timer:15e3,width:4,height:4,mines:7},Hard:{timer:15e3,width:5,height:5,mines:11},Impossible:{timer:15e3,width:6,height:6,mines:15}};function m(e){const t={timer:0,width:0,height:0,mines:0};Object(l.a)(u,e.difficulty,t);const a=t.timer,[m]=Object(n.useState)(function(e){const t=h(e);for(let a=0;a{const e=setTimeout(()=>b(!1),2e3);return()=>clearInterval(e)},[]),r.a.createElement(i.a,{container:!0,spacing:3},r.a.createElement(s.a,{millis:a,onExpire:e.onFailure}),r.a.createElement(i.a,{item:!0,xs:12},r.a.createElement("h1",{className:"noselect"},y?"Remember all the mines!":"Mark all the mines!"),m.map((e,t)=>r.a.createElement("div",{key:t},r.a.createElement("pre",null,e.map((e,a)=>y?m[t][a]?r.a.createElement("span",{key:a},"[?] "):r.a.createElement("span",{key:a},"[ ] "):a==f[0]&&t==f[1]?r.a.createElement("span",{key:a},"[X] "):p[t][a]?r.a.createElement("span",{key:a},"[.] "):r.a.createElement("span",{key:a},"[ ] "))),r.a.createElement("br",null))),r.a.createElement(o.a,{onKeyDown:function(t){if(t.preventDefault(),y)return;const a=[0,0];switch(Object(c.a)(t)){case"↑":a[1]--;break;case"←":a[0]--;break;case"↓":a[1]++;break;case"→":a[0]++}const n=[f[0]+a[0],f[1]+a[1]];if(n[0]=(n[0]+m[0].length)%m[0].length,n[1]=(n[1]+m.length)%m.length,g(n),32==t.keyCode){if(!m[f[1]][f[0]])return void e.onFailure();d(t=>(t[f[1]][f[0]]=!0,function(e,t){function a(e){return e.flat().reduce((e,t)=>e+(t?1:0),0)}return a(e)===a(t)}(m,t)&&e.onSuccess(),t))}},onFailure:e.onFailure})))}function h(e){const t=[];for(let a=0;ar.a.createElement("h3",{key:t},e.toString())),r.a.createElement("pre",null,new Array(p.length).fill(0).map((e,t)=>r.a.createElement("span",{key:t}," ",t+1,"    "))),new Array(8).fill(0).map((e,t)=>r.a.createElement("div",{key:t},r.a.createElement("pre",null,p.map((e,a)=>3!==t&&4!==t||!d[a]?r.a.createElement("span",{key:a,style:{color:e.colors[t%e.colors.length]}},"|",e.tpe,"|   "):r.a.createElement("span",{key:a},"      "))))),r.a.createElement(o.a,{onKeyDown:function(t){t.preventDefault();const a=parseInt(t.key);a<1||a>p.length||isNaN(a)||y(t=>{const n=[...t];n[a-1]=!0,b.some(e=>e.shouldCut(p[a-1],a-1))||e.onFailure();const r=[];for(let e=0;ee===n[t])&&e.onSuccess(),n})},onFailure:e.onFailure})))}function f(e){const t=Math.floor(Math.random()*e.length);return{toString:()=>`Cut wires number ${t+1}.`,shouldCut:(e,a)=>t===a}}function g(e){const t=e[Math.floor(Math.random()*e.length)].colors[0];return{toString:()=>`Cut all wires colored ${p[t]}.`,shouldCut:e=>e.colors.includes(t)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(24),r=a(0),i=a.n(r),o=a(26),s=a(54),l=a(15),c=a(81),u=a(7),m=a(47);function h(e){const t=m.b.Player(),a=m.b.Router(),[h,p]=Object(r.useState)("none");function d(){a.toCity()}const f=e.MaxLevel*Math.pow(1.01,e.MaxLevel),g=Math.pow(e.Difficulty+1,1.1)*Math.pow(e.StartingDifficulty,1.2)*30*f*u.a.InfiltrationRep,y=Math.pow(e.Difficulty+1,2)*Math.pow(e.StartingDifficulty,3)*3e3*f*u.a.InfiltrationMoney;return i.a.createElement(i.a.Fragment,null,i.a.createElement(s.a,{container:!0,spacing:3},i.a.createElement(s.a,{item:!0,xs:10},i.a.createElement("h1",null,"Infiltration successful!")),i.a.createElement(s.a,{item:!0,xs:10},i.a.createElement("h2",null,"You can trade the confidential information you found for money or reputation."),i.a.createElement("select",{className:"dropdown",onChange:function(e){p(e.target.value)}},i.a.createElement("option",{key:"none",value:"none"},"none"),t.factions.filter(e=>n.a[e].getInfo().offersWork()).map(e=>i.a.createElement("option",{key:e,value:e},e))),i.a.createElement(o.a,{onClick:function(){"none"!==h&&(n.a[h].playerReputation+=g,d())},text:i.a.createElement(i.a.Fragment,null,"Trade for ",Object(c.a)(g)," reputation")})),i.a.createElement(s.a,{item:!0,xs:3},i.a.createElement(o.a,{onClick:function(){t.gainMoney(y),t.recordMoneySource(y,"infiltration"),d()},text:i.a.createElement(i.a.Fragment,null,"Sell for ",i.a.createElement(l.a,{money:y}))})),i.a.createElement(s.a,{item:!0,xs:3},i.a.createElement(o.a,{onClick:d,text:"Quit"}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(503),o=a(938);const s={Cost:"Cost",Hacking:"Hacking Level",Strength:"Strength Level",Defense:"Defense Level",Dexterity:"Dexterity Level",Agility:"Agility Level",Charisma:"Charisma Level",AverageCombatStats:"Average Combat Stats",AverageAllStats:"Average Stats",TotalNumAugmentations:"Number of Augmentations"};function l(...e){let t=0;for(let a=0;ae.getCost()-t.getCost(),Hacking:(e,t)=>e.hacking_skill-t.hacking_skill,Strength:(e,t)=>e.strength-t.strength,Defense:(e,t)=>e.defense-t.defense,Dexterity:(e,t)=>e.dexterity-t.dexterity,Agility:(e,t)=>e.agility-t.agility,Charisma:(e,t)=>e.charisma-t.charisma,AverageCombatStats:(e,t)=>l(e.strength,e.defense,e.dexterity,e.agility)-l(t.strength,t.defense,t.dexterity,t.agility),AverageAllStats:(e,t)=>l(e.hacking_skill,e.strength,e.defense,e.dexterity,e.agility,e.charisma)-l(t.hacking_skill,t.strength,t.defense,t.dexterity,t.agility,t.charisma),TotalNumAugmentations:(e,t)=>e.augmentations.length-t.augmentations.length};function u(e){const[t,a]=Object(n.useState)(s.Cost);0===e.player.resleeves.length&&(e.player.resleeves=Object(i.a)());const l=c[t];if(void 0===l)throw new Error(`sort function '${t}' is undefined`);return e.player.resleeves.sort(l),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{style:{display:"block",width:"75%"}},"Re-sleeving is the process of digitizing and transferring your consciousness into a new human body, or 'sleeve'. Here at VitaLife, you can purchase new specially-engineered bodies for the re-sleeve process. Many of these bodies even come with genetic and cybernetic Augmentations!",r.a.createElement("br",null),r.a.createElement("br",null),"Re-sleeving will change your experience for every stat. It will also REMOVE all of your currently-installed Augmentations, and replace them with the ones provided by the purchased sleeve. However, Augmentations that you have purchased but not installed will NOT be removed. If you have purchased an Augmentation and then re-sleeve into a body which already has that Augmentation, it will be removed (since you cannot have duplicate Augmentations).",r.a.createElement("br",null),r.a.createElement("br",null),"NOTE: The stats and multipliers displayed on this page do NOT include your bonuses from Source-File."),r.a.createElement("p",{style:{display:"inline-block"}},"Sort By: "),r.a.createElement("select",{className:"dropdown",defaultValue:t,onChange:function(e){a(e.target.value)}},Object.keys(s).map(e=>r.a.createElement("option",{key:e,value:e},s[e]))),e.player.resleeves.map((t,a)=>r.a.createElement(o.a,{key:a,player:e.player,resleeve:t})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(168),r=a(19),i=a(20);class o extends n.a{constructor(){super()}getCost(){const e=this.hacking_exp+this.strength_exp+this.defense_exp+this.dexterity_exp+this.agility_exp+this.charisma_exp;let t=0;for(let e=0;er.a.createElement("option",{key:e.name,value:e.name},e.name))),r.a.createElement("p",null,void 0!==u&&u.info)),r.a.createElement("div",{className:"resleeve-panel",style:{width:"20%"}},r.a.createElement("p",null,"It costs ",r.a.createElement(s.a,{money:m,player:e.player})," to purchase this Sleeve."),r.a.createElement("button",{className:"std-button",onClick:function(){Object(o.b)(e.resleeve,e.player)&&Object(c.a)(r.a.createElement(r.a.Fragment,null,"You re-sleeved for ",r.a.createElement(s.a,{money:m}),"!"))}},"Purchase")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return w}));var n=a(0),r=a.n(n),i=a(47),o=a(4),s=a(3),l=a(81),c=a(430),u=a(138),m=a(15),h=a(14),p=a(24),d=a(184),f=a(51),g=a(205),y=a(8),b=a(9),E=a(54),v=a(37),k=a(143);const _=1e3/o.a.MilliPerCycle;function w(){const e=Object(n.useState)(!1)[1];function t(){e(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(t,o.a.MilliPerCycle);return()=>clearInterval(e)},[]);const a=i.b.Player(),w=i.b.Router(),C=p.a[a.currentWorkFactionName];if(a.workType==o.a.WorkTypeFaction){function S(){w.toFaction(C),a.finishFactionWork(!0)}function x(){w.toFaction(C),a.stopFocusing()}return r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,"You are currently ",a.currentWorkFactionDescription," for your faction ",C.name,r.a.createElement("br",null),"(Current Faction Reputation: ",Object(l.a)(C.playerReputation),"). ",r.a.createElement("br",null),"You have been doing this for ",Object(h.b)(a.timeWorked),r.a.createElement("br",null),r.a.createElement("br",null),"You have earned: ",r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(m.a,{money:a.workMoneyGained})," (",r.a.createElement(u.a,{money:a.workMoneyGainRate*_}),")"," ",r.a.createElement("br",null),r.a.createElement("br",null),Object(l.a)(a.workRepGained)," (",Object(c.a)(a.workRepGainRate*_),") reputation for this faction ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workHackExpGained)," (",s.a.formatExp(a.workHackExpGainRate*_)," / sec) hacking exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workStrExpGained)," (",s.a.formatExp(a.workStrExpGainRate*_)," / sec) strength exp ",r.a.createElement("br",null),s.a.formatExp(a.workDefExpGained)," (",s.a.formatExp(a.workDefExpGainRate*_)," / sec) defense exp ",r.a.createElement("br",null),s.a.formatExp(a.workDexExpGained)," (",s.a.formatExp(a.workDexExpGainRate*_)," / sec) dexterity exp ",r.a.createElement("br",null),s.a.formatExp(a.workAgiExpGained)," (",s.a.formatExp(a.workAgiExpGainRate*_)," / sec) agility exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workChaExpGained)," (",s.a.formatExp(a.workChaExpGainRate*_)," / sec) charisma exp ",r.a.createElement("br",null),r.a.createElement("br",null),"You will automatically finish after working for 20 hours. You can cancel earlier if you wish.",r.a.createElement("br",null),"There is no penalty for cancelling earlier.")),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{sx:{mx:2},onClick:S},"Stop Faction Work"),r.a.createElement(v.a,{onClick:x},"Do something else simultaneously")))}const O=a.className;if(""!==a.className){function S(){a.finishClass(!0),w.toCity()}function x(){a.stopFocusing(),w.toCity()}let e="";return e=O==o.a.ClassGymStrength||O==o.a.ClassGymDefense||O==o.a.ClassGymDexterity||O==o.a.ClassGymAgility?"Stop training at gym":"Stop taking course",r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,"You have been ",O," for ",Object(h.b)(a.timeWorked),r.a.createElement("br",null),r.a.createElement("br",null),"This has cost you: ",r.a.createElement("br",null),r.a.createElement(m.a,{money:-a.workMoneyGained})," (",r.a.createElement(u.a,{money:a.workMoneyLossRate*_}),")"," ",r.a.createElement("br",null),r.a.createElement("br",null),"You have gained: ",r.a.createElement("br",null),s.a.formatExp(a.workHackExpGained)," (",s.a.formatExp(a.workHackExpGainRate*_)," / sec) hacking exp ",r.a.createElement("br",null),s.a.formatExp(a.workStrExpGained)," (",s.a.formatExp(a.workStrExpGainRate*_)," / sec) strength exp ",r.a.createElement("br",null),s.a.formatExp(a.workDefExpGained)," (",s.a.formatExp(a.workDefExpGainRate*_)," / sec) defense exp ",r.a.createElement("br",null),s.a.formatExp(a.workDexExpGained)," (",s.a.formatExp(a.workDexExpGainRate*_)," / sec) dexterity exp ",r.a.createElement("br",null),s.a.formatExp(a.workAgiExpGained)," (",s.a.formatExp(a.workAgiExpGainRate*_)," / sec) agility exp ",r.a.createElement("br",null),s.a.formatExp(a.workChaExpGained)," (",s.a.formatExp(a.workChaExpGainRate*_)," / sec) charisma exp ",r.a.createElement("br",null),"You may cancel at any time")),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{onClick:S},e)))}if(a.workType==o.a.WorkTypeCompany){const e=f.a[a.companyName];let t=0;if(null==e||!(e instanceof d.a))throw new Error("Could not find Company: "+a.companyName);function S(){a.finishWork(!0),w.toJob()}function x(){a.stopFocusing(),w.toJob()}t=e.playerReputation;const n=a.jobs[a.companyName],i=.5===a.cancelationPenalty()?"half":"three-quarters";return r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,"You are currently working as a ",n," at ",a.companyName," (Current Company Reputation:"," ",Object(l.a)(t),")",r.a.createElement("br",null),r.a.createElement("br",null),"You have been working for ",Object(h.b)(a.timeWorked),r.a.createElement("br",null),r.a.createElement("br",null),"You have earned: ",r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(m.a,{money:a.workMoneyGained})," (",r.a.createElement(u.a,{money:a.workMoneyGainRate*_}),")"," ",r.a.createElement("br",null),r.a.createElement("br",null),Object(l.a)(a.workRepGained)," (",Object(c.a)(a.workRepGainRate*_),") reputation for this company ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workHackExpGained)," (",s.a.formatExp(a.workHackExpGainRate*_)+" / sec",") hacking exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workStrExpGained)," (",s.a.formatExp(a.workStrExpGainRate*_)+" / sec",") strength exp ",r.a.createElement("br",null),s.a.formatExp(a.workDefExpGained)," (",s.a.formatExp(a.workDefExpGainRate*_)+" / sec",") defense exp ",r.a.createElement("br",null),s.a.formatExp(a.workDexExpGained)," (",s.a.formatExp(a.workDexExpGainRate*_)+" / sec",") dexterity exp ",r.a.createElement("br",null),s.a.formatExp(a.workAgiExpGained)," (",s.a.formatExp(a.workAgiExpGainRate*_)+" / sec",") agility exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workChaExpGained)," (",s.a.formatExp(a.workChaExpGainRate*_)+" / sec",") charisma exp ",r.a.createElement("br",null),r.a.createElement("br",null),"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, but you will only gain ",i," of the reputation you've earned so far.")),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{sx:{mx:2},onClick:S},"Stop Working"),r.a.createElement(v.a,{onClick:x},"Do something else simultaneously")))}if(a.workType==o.a.WorkTypeCompanyPartTime){function S(){a.finishWork(!0),w.toJob()}function x(){a.stopFocusing(),w.toJob()}const e=f.a[a.companyName];let t=0;if(null==e||!(e instanceof d.a))throw new Error("Could not find Company: "+a.companyName);t=e.playerReputation;const n=a.jobs[a.companyName];return r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,"You are currently working as a ",n," at ",a.companyName," (Current Company Reputation:"," ",Object(l.a)(t),")",r.a.createElement("br",null),r.a.createElement("br",null),"You have been working for ",Object(h.b)(a.timeWorked),r.a.createElement("br",null),r.a.createElement("br",null),"You have earned: ",r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(m.a,{money:a.workMoneyGained})," (",r.a.createElement(u.a,{money:a.workMoneyGainRate*_}),")"," ",r.a.createElement("br",null),r.a.createElement("br",null),Object(l.a)(a.workRepGained)," (",Object(l.a)(s.a.formatExp(a.workRepGainRate*_)+" / sec"),") reputation for this company ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workHackExpGained)," (",s.a.formatExp(a.workHackExpGainRate*_)+" / sec",") hacking exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workStrExpGained)," (",s.a.formatExp(a.workStrExpGainRate*_)+" / sec",") strength exp ",r.a.createElement("br",null),s.a.formatExp(a.workDefExpGained)," (",s.a.formatExp(a.workDefExpGainRate*_)+" / sec",") defense exp ",r.a.createElement("br",null),s.a.formatExp(a.workDexExpGained)," (",s.a.formatExp(a.workDexExpGainRate*_)+" / sec",") dexterity exp ",r.a.createElement("br",null),s.a.formatExp(a.workAgiExpGained)," (",s.a.formatExp(a.workAgiExpGainRate*_)+" / sec",") agility exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workChaExpGained)," (",s.a.formatExp(a.workChaExpGainRate*_)+" / sec",") charisma exp ",r.a.createElement("br",null),r.a.createElement("br",null),"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, and there will be no penalty because this is a part-time job.")),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{sx:{mx:2},onClick:S},"Stop Working"),r.a.createElement(v.a,{onClick:x},"Do something else simultaneously")))}if(""!==a.crimeType){const e=Math.round(a.timeWorked/a.timeNeededToCompleteWork*100);let t=Math.round(e/5);t<0&&(t=0),t>20&&(t=20);const n=Object(k.a)({progress:(t+1)/20,totalTicks:20});return r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,r.a.createElement("p",null,"You are attempting to ",a.crimeType,"."),r.a.createElement("br",null),r.a.createElement("p",null,"Time remaining: ",Object(h.b)(a.timeNeededToCompleteWork-a.timeWorked)),r.a.createElement("br",null),r.a.createElement("pre",null,n))),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{onClick:()=>{w.toLocation(g.a[y.a.Slums]),a.finishCrime(!0)}},"Cancel crime")))}return""!==a.createProgramName?r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,"You are currently working on coding ",a.createProgramName,".",r.a.createElement("br",null),r.a.createElement("br",null),"You have been working for ",Object(h.b)(a.timeWorked),r.a.createElement("br",null),r.a.createElement("br",null),"The program is ",(a.timeWorkedCreateProgram/a.timeNeededToCompleteWork*100).toFixed(2),"% complete. ",r.a.createElement("br",null),"If you cancel, your work will be saved and you can come back to complete the program later.")),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{onClick:()=>{a.finishCreateProgramWork(!0),w.toTerminal()}},"Cancel work on creating program"))):r.a.createElement(r.a.Fragment,null)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return R}));var n=a(0),r=a.n(n),i=a(142),o=a(277),s=a(9),l=a(452),c=a(54),u=a(246),m=a(247),h=a(290),p=a(125),d=a(37),f=a(92),g=a(370),y=a(63),b=a(149),E=a(93),v=a(980),k=a.n(v),_=a(981),w=a.n(_),C=a(941),S=a(11),x=a(944),O=a(945),T=a(18),M=a(348);const P=Object(i.a)(e=>Object(o.a)({root:{width:50,padding:e.spacing(2),userSelect:"none"}}));function R(e){const t=P(),a=Object(n.useRef)(null),[i,o]=Object(n.useState)(T.a.CodeInstructionRunTime),[v,_]=Object(n.useState)(T.a.MaxLogCapacity),[R,A]=Object(n.useState)(T.a.MaxPortCapacity),[N,I]=Object(n.useState)(T.a.MaxTerminalCapacity),[j,F]=Object(n.useState)(T.a.AutosaveInterval),[D,B]=Object(n.useState)(T.a.SuppressMessages),[L,G]=Object(n.useState)(T.a.SuppressFactionInvites),[W,H]=Object(n.useState)(T.a.SuppressTravelConfirmation),[U,q]=Object(n.useState)(T.a.SuppressBuyAugmentationConfirmation),[K,$]=Object(n.useState)(T.a.SuppressHospitalizationPopup),[z,Y]=Object(n.useState)(T.a.SuppressBladeburnerPopup),[V,J]=Object(n.useState)(T.a.DisableHotkeys),[Q,X]=Object(n.useState)(T.a.DisableASCIIArt),[Z,ee]=Object(n.useState)(T.a.DisableTextEffects),[te,ae]=Object(n.useState)(T.a.EnableBashHotkeys),[ne,re]=Object(n.useState)(T.a.EnableTimestamps),[ie,oe]=Object(n.useState)(T.a.Locale),[se,le]=Object(n.useState)(!1),[ce,ue]=Object(n.useState)(!1),[me,he]=Object(n.useState)(!1);return r.a.createElement("div",{className:t.root,style:{width:"90%"}},r.a.createElement(s.a,{variant:"h4",gutterBottom:!0},"Options"),r.a.createElement(c.a,{container:!0,spacing:3},r.a.createElement(c.a,{item:!0,xs:12,sm:6},r.a.createElement(g.a,null,r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"The minimum number of milliseconds it takes to execute an operation in Netscript. Setting this too low can result in poor performance if you have many scripts running.")},r.a.createElement(s.a,null,"Netscript exec time (ms)")),r.a.createElement(l.a,{value:i,onChange:function(e,t){o(t),T.a.CodeInstructionRunTime=t},step:1,min:10,max:100,valueLabelDisplay:"auto"})),r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"The maximum number of lines a script's logs can hold. Setting this too high can cause the game to use a lot of memory if you have many scripts running.")},r.a.createElement(s.a,null,"Netscript log size")),r.a.createElement(l.a,{value:v,onChange:function(e,t){_(t),T.a.MaxLogCapacity=t},step:1,min:20,max:100,valueLabelDisplay:"auto"})),r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"The maximum number of entries that can be written to a port using Netscript's write() function. Setting this too high can cause the game to use a lot of memory.")},r.a.createElement(s.a,null,"Netscript port size")),r.a.createElement(l.a,{value:R,onChange:function(e,t){A(t),T.a.MaxPortCapacity=t},step:1,min:20,max:100,valueLabelDisplay:"auto"})),r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"The maximum number of entries that can be written to a the terminal. Setting this too high can cause the game to use a lot of memory.")},r.a.createElement(s.a,null,"Terminal capacity")),r.a.createElement(l.a,{value:N,onChange:function(e,t){I(t),T.a.MaxTerminalCapacity=t},step:50,min:50,max:500,valueLabelDisplay:"auto",marks:!0})),r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"The time (in seconds) between each autosave. Set to 0 to disable autosave.")},r.a.createElement(s.a,null,"Autosave interval (s)")),r.a.createElement(l.a,{value:j,onChange:function(e,t){F(t),T.a.AutosaveInterval=t},step:30,min:0,max:600,valueLabelDisplay:"auto",marks:!0})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:D,onChange:function(e){B(e.target.checked),T.a.SuppressMessages=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, then any messages you receive will not appear as popups on the screen. They will still get sent to your home computer as '.msg' files and can be viewed with the 'cat' Terminal command.")},r.a.createElement(s.a,null,"Suppress messages"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:L,onChange:function(e){G(e.target.checked),T.a.SuppressFactionInvites=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, then any faction invites you receive will not appear as popups on the screen. Your outstanding faction invites can be viewed in the 'Factions' page.")},r.a.createElement(s.a,null,"Suppress faction invites"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:W,onChange:function(e){H(e.target.checked),T.a.SuppressTravelConfirmation=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, the confirmation message before traveling will not show up. You will automatically be deducted the travel cost as soon as you click.")},r.a.createElement(s.a,null,"Suppress travel confirmations"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:U,onChange:function(e){q(e.target.checked),T.a.SuppressBuyAugmentationConfirmation=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, the confirmation message before buying augmentation will not show up.")},r.a.createElement(s.a,null,"Suppress buy augmentation confirmation"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:K,onChange:function(e){$(e.target.checked),T.a.SuppressHospitalizationPopup=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, a popup message will no longer be shown when you are hospitalized after taking too much damage.")},r.a.createElement(s.a,null,"Suppress hospitalization popup"))})),!!e.player.bladeburner&&r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:z,onChange:function(e){Y(e.target.checked),T.a.SuppressBladeburnerPopup=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, then having your Bladeburner actions interrupted by being busy with something else will not display a popup message.")},r.a.createElement(s.a,null,"Suppress bladeburner popup"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:V,onChange:function(e){J(e.target.checked),T.a.DisableHotkeys=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,'If this is set, then most hotkeys (keyboard shortcuts) in the game are disabled. This includes Terminal commands, hotkeys to navigate between different parts of the game, and the "Save and Close (Ctrl + b)" hotkey in the Text Editor.')},r.a.createElement(s.a,null,"Disable hotkeys"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:Q,onChange:function(e){X(e.target.checked),T.a.DisableASCIIArt=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set all ASCII art will be disabled.")},r.a.createElement(s.a,null,"Disable ascii art"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:Z,onChange:function(e){ee(e.target.checked),T.a.DisableTextEffects=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, text effects will not be displayed. This can help if text is difficult to read in certain areas.")},r.a.createElement(s.a,null,"Disable text effects"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:te,onChange:function(e){ae(e.target.checked),T.a.EnableBashHotkeys=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"Improved Bash emulation mode. Setting this to 1 enables several new Terminal shortcuts and features that more closely resemble a real Bash-style shell. Note that when this mode is enabled, the default browser shortcuts are overriden by the new Bash shortcuts.")},r.a.createElement(s.a,null,"Enable bash hotkeys"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:ne,onChange:function(e){re(e.target.checked),T.a.EnableTimestamps=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"Terminal commands and log entries will be timestamped. The timestamp will have the format: M/D h:m")},r.a.createElement(s.a,null,"Enable timestamps"))})),r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"Sets the locale for displaying numbers.")},r.a.createElement(s.a,null,"Locale ")),r.a.createElement(h.a,{value:ie,onChange:function(e){oe(e.target.value),T.a.Locale=e.target.value}},r.a.createElement(p.a,{value:"en"},"en"),r.a.createElement(p.a,{value:"bg"},"bg"),r.a.createElement(p.a,{value:"cs"},"cs"),r.a.createElement(p.a,{value:"da-dk"},"da-dk"),r.a.createElement(p.a,{value:"de"},"de"),r.a.createElement(p.a,{value:"en-au"},"en-au"),r.a.createElement(p.a,{value:"en-gb"},"en-gb"),r.a.createElement(p.a,{value:"es"},"es"),r.a.createElement(p.a,{value:"fr"},"fr"),r.a.createElement(p.a,{value:"hu"},"hu"),r.a.createElement(p.a,{value:"it"},"it"),r.a.createElement(p.a,{value:"lv"},"lv"),r.a.createElement(p.a,{value:"no"},"no"),r.a.createElement(p.a,{value:"pl"},"pl"),r.a.createElement(p.a,{value:"ru"},"ru")))),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("form",{action:"https://www.paypal.com/cgi-bin/webscr",method:"post",target:"_blank"},r.a.createElement("input",{type:"hidden",name:"cmd",value:"_s-xclick"}),r.a.createElement("input",{type:"hidden",name:"encrypted",value:"-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYA2Y2VGE75oWct89z//G2YEJKmzx0uDTXNrpje9ThxmUnBLFZCY+I11Pors7lGRvFqo5okwnu41CfYMPHDxpAgyYyQndMX9pWUX0gLfBMm2BaHwsNBCwt34WmpQqj7TGsQ+aw9NbmkxiJltGnOa+6/gy10mPZAA3HxiieLeCKkGgDELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQI72F1YSzHUd2AgaDMekHU3AKT93Ey9wkB3486bV+ngFSD6VOHrPweH9QATsp+PMe9QM9vmq+s2bGtTbZaYrFqM3M97SnQ0l7IQ5yuOzdZhRdfysu5uJ8dnuHUzq4gLSzqMnZ6/3c+PoHB8AS1nYHUVL4U0+ogZsO1s97IAQyfck9SaoFlxVtqQhkb8752MkQJJvGu3ZQSQGcVC4hFDPk8prXqyq4BU/k/EliwoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTcwNzI1MDExODE2WjAjBgkqhkiG9w0BCQQxFgQUNo8efiZ7sk7nwKM/6B6Z7sU8hIIwDQYJKoZIhvcNAQEBBQAEgYB+JB4vZ/r48815/1HF/xK3+rOx7bPz3kAXmbhW/mkoF4OUbzqMeljvDIA9q/BDdlCLtxFOw9XlftTzv0eZCW/uCIiwu5wTzPIfPY1SI8WHe4cJbP2f2EYxIVs8D7OSirbW4yVa0+gACaLLj0rzIzNN8P/5PxgB03D+jwkcJABqng==-----END PKCS7-----"}),r.a.createElement("input",{type:"image",src:"https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif",name:"submit",alt:"PayPal - The safer, easier way to pay online!"}))),r.a.createElement(c.a,{item:!0,xs:12,sm:6},r.a.createElement(f.a,null,r.a.createElement(d.a,{onClick:()=>e.save()},"Save Game"),r.a.createElement(d.a,{onClick:()=>ue(!0)},"Delete Game")),r.a.createElement(f.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"export")},r.a.createElement(d.a,{onClick:()=>e.export()},r.a.createElement(k.a,{color:"primary"}),"Export")),r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"import")},r.a.createElement(d.a,{onClick:function(){if(!(window.File&&window.FileReader&&window.FileList&&window.Blob))return;const e=a.current;if(null===e)throw new Error("import input should not be null");e.click()}},r.a.createElement(w.a,{color:"primary"}),"Import",r.a.createElement("input",{ref:a,id:"import-game-file-selector",type:"file",hidden:!0,onChange:function(e){const t=e.target.files;if(null===t)return;const a=t[0];if(!a)return void Object(S.a)("Invalid file selected");const n=new FileReader;n.onload=function(e){const t=e.target;if(null===t)return void console.error("error importing file");const a=t.result;if("string"!=typeof a||null===a)return void console.error("FileReader event was not type string");const n=a;Object(M.c)(n).then(()=>location.reload())},n.readAsText(a)}})))),r.a.createElement(f.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"Forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After using this, save the game and then reload the page. This is different then normal kill in that normal kill will tell the script to shut down while force kill just removes the references to it (and it should crash on it's own). This will not remove the files on your computer. Just forcefully kill all running instance of all scripts.")},r.a.createElement(d.a,{onClick:()=>e.forceKill()},"Force kill all active scripts"))),r.a.createElement(f.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"Perform a soft reset. Resets everything as if you had just purchased an Augmentation.")},r.a.createElement(d.a,{onClick:()=>e.softReset()},"Soft Reset"))),r.a.createElement(f.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If your save file is extremely big you can use this button to view a map of all the files on every server. Be careful there might be spoilers.")},r.a.createElement(d.a,{onClick:()=>le(!0)},"Diagnose files")),r.a.createElement(d.a,{onClick:()=>he(!0)},"Theme editor")),r.a.createElement(f.a,null,r.a.createElement(b.a,{href:"https://github.com/danielyxie/bitburner/issues/new",target:"_blank"},r.a.createElement(s.a,null,"Report bug")),r.a.createElement(b.a,{href:"https://bitburner.readthedocs.io/en/latest/changelog.html",target:"_blank"},r.a.createElement(s.a,null,"Changelog")),r.a.createElement(b.a,{href:"https://bitburner.readthedocs.io/en/latest/index.html",target:"_blank"},r.a.createElement(s.a,null,"Documentation")),r.a.createElement(b.a,{href:"https://discord.gg/TFc3hKD",target:"_blank"},r.a.createElement(s.a,null,"Discord")),r.a.createElement(b.a,{href:"https://www.reddit.com/r/bitburner",target:"_blank"},r.a.createElement(s.a,null,"Reddit"))))),r.a.createElement(C.a,{open:se,onClose:()=>le(!1)}),r.a.createElement(x.a,{onConfirm:()=>{ue(!1),Object(M.a)().then(()=>location.reload()).catch(e=>console.error("Could not delete game: "+e))},open:ce,onClose:()=>ue(!1),confirmationText:"Really delete your game? (It's permanent!)"}),r.a.createElement(O.a,{open:me,onClose:()=>he(!1)}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return _}));var n=a(0),r=a.n(n),i=a(32),o=a(304),s=a(3),l=a(330),c=a(278),u=a(52),m=a(1495),h=a(1496),p=a(78),d=a(9),f=a(221),g=a(171),y=a(172),b=a(173),E=a(75),v=a.n(E);function k(e){const t=i.b[e.ip];let a=0;for(const e of t.scripts)a+=e.code.length;for(const e of t.textFiles)a+=e.text.length;if(0===a)return r.a.createElement(r.a.Fragment,null);const n=[];for(const e of t.scripts)n.push({name:e.filename,size:e.code.length});for(const e of t.textFiles)n.push({name:e.fn,size:e.text.length});return n.sort((e,t)=>t.size-e.size),r.a.createElement(g.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(y.a,{expandIcon:r.a.createElement(v.a,null)},r.a.createElement(d.a,null,t.hostname," (",s.a.formatBigNumber(a),"b)")),r.a.createElement(b.a,null,r.a.createElement(m.a,{component:f.a},r.a.createElement(l.a,null,r.a.createElement(h.a,null,r.a.createElement(p.a,null,r.a.createElement(u.a,null,r.a.createElement(d.a,null,"Filename")),r.a.createElement(u.a,{align:"right"},r.a.createElement(d.a,null,"Size")))),r.a.createElement(c.a,null,n.map(e=>r.a.createElement(p.a,{key:e.name},r.a.createElement(u.a,{component:"th",scope:"row"},r.a.createElement(d.a,null,e.name)),r.a.createElement(u.a,{align:"right"},r.a.createElement(d.a,null,s.a.formatBigNumber(e.size),"b"))))))),r.a.createElement("ul",null)))}function _(e){const t=[];for(const e of Object.keys(i.b))t.push(e);return r.a.createElement(o.a,{open:e.open,onClose:e.onClose},r.a.createElement(r.a.Fragment,null,r.a.createElement(d.a,null,"Welcome to the file diagnostic! If your save file is really big it's likely because you have too many text/scripts. This tool can help you narrow down where they are."),t.map(e=>r.a.createElement(k,{key:e,ip:e}))))}},,,function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(304),o=a(37),s=a(9);function l(e){return r.a.createElement(i.a,{open:e.open,onClose:e.onClose},r.a.createElement(r.a.Fragment,null,r.a.createElement(s.a,null,e.confirmationText),r.a.createElement(o.a,{onClick:()=>{e.onConfirm()}},"Confirm")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(0),r=a.n(n),i=a(304),o=a(37),s=a(9),l=a(329),c=a(977),u=a.n(c),m=a(116),h=a(384),p=a.n(h),d=a(946),f=a(318),g=a(18);function y({name:e}){const[t,a]=Object(n.useState)(g.a.theme[e]);if(void 0===t)return r.a.createElement(r.a.Fragment,null);const i=t.match(/#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})/g);return r.a.createElement(r.a.Fragment,null,r.a.createElement(l.a,{sx:{mx:1},label:e,value:t,onChange:function(e){a(e.target.value)},variant:"standard",InputProps:{startAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(d.a,{hideTextfield:!0,value:t,onChange:function(e){a("#"+e.hex.toLowerCase())}})),endAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(m.a,{onClick:function(){i&&(g.a.theme[e]=t,f.b.emit())},disabled:!i},r.a.createElement(u.a,{color:i?"primary":"error"})),r.a.createElement(m.a,{onClick:function(){g.a.theme[e]=g.b.theme[e],a(g.b.theme[e]),f.b.emit()}},r.a.createElement(p.a,{color:"primary"})))}}))}function b(e){return r.a.createElement(i.a,{open:e.open,onClose:e.onClose},r.a.createElement(o.a,{color:"primary"},"primary"),r.a.createElement(o.a,{color:"secondary"},"secondary"),r.a.createElement(o.a,{color:"warning"},"warning"),r.a.createElement(o.a,{color:"info"},"info"),r.a.createElement(o.a,{color:"error"},"error"),r.a.createElement(s.a,{color:"primary"},"primary"),r.a.createElement(s.a,{color:"secondary"},"secondary"),r.a.createElement(s.a,{color:"warning"},"warning"),r.a.createElement(s.a,{color:"info"},"info"),r.a.createElement(s.a,{color:"error"},"error"),r.a.createElement("br",null),r.a.createElement(y,{name:"primarylight"}),r.a.createElement(y,{name:"primary"}),r.a.createElement(y,{name:"primarydark"}),r.a.createElement("br",null),r.a.createElement(y,{name:"errorlight"}),r.a.createElement(y,{name:"error"}),r.a.createElement(y,{name:"errordark"}),r.a.createElement("br",null),r.a.createElement(y,{name:"secondarylight"}),r.a.createElement(y,{name:"secondary"}),r.a.createElement(y,{name:"secondarydark"}),r.a.createElement("br",null),r.a.createElement(y,{name:"warninglight"}),r.a.createElement(y,{name:"warning"}),r.a.createElement(y,{name:"warningdark"}),r.a.createElement("br",null),r.a.createElement(y,{name:"infolight"}),r.a.createElement(y,{name:"info"}),r.a.createElement(y,{name:"infodark"}),r.a.createElement("br",null),r.a.createElement(y,{name:"welllight"}),r.a.createElement(y,{name:"well"}),r.a.createElement(y,{name:"white"}),r.a.createElement(y,{name:"black"}),r.a.createElement("br",null),r.a.createElement(y,{name:"hp"}),r.a.createElement(y,{name:"money"}),r.a.createElement(y,{name:"hack"}),r.a.createElement(y,{name:"combat"}),r.a.createElement(y,{name:"cha"}),r.a.createElement(y,{name:"int"}),r.a.createElement(y,{name:"rep"}))}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(983);function o(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(a,150);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement("h1",null,"Sleeves"),r.a.createElement("p",null,"Duplicate Sleeves are MK-V Synthoids (synthetic androids) into which your consciousness has been copied. In other words, these Synthoids contain a perfect duplicate of your mind.",r.a.createElement("br",null),r.a.createElement("br",null),"Sleeves can be used to perform different tasks synchronously.",r.a.createElement("br",null),r.a.createElement("br",null)),r.a.createElement("button",{className:"std-button",style:{display:"inline-block"}},"FAQ"),r.a.createElement("a",{className:"std-button",style:{display:"inline-block"},target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/advancedgameplay/sleeves.html#duplicate-sleeves"},"Documentation"),r.a.createElement("ul",null,e.player.sleeves.map((t,n)=>r.a.createElement("li",{key:n},r.a.createElement(i.a,{rerender:a,player:e.player,sleeve:t})))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return w}));var n=a(0),r=a.n(n),i=a(59),o=a(4),s=a(65),l=a(3),c=a(11),u=a(143),m=a(22),h=a(984),p=a(985),d=a(986),f=a(15),g=a(138),y=a(430),b=a(987),E=a(988),v=a(989),k=a(990),_=a(139);function w(e){const[t,a]=Object(n.useState)(["------","------","------"]);let w=r.a.createElement(r.a.Fragment,null);switch(e.sleeve.currentTask){case i.a.Idle:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently idle");break;case i.a.Company:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently working your job at ",e.sleeve.currentTaskLocation,".");break;case i.a.Faction:{let t="nothing";switch(e.sleeve.factionWorkType){case _.a.Field:t="Field work";break;case _.a.Hacking:t="Hacking contracts";break;case _.a.Security:t="Security work"}w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently doing ",t," for ",e.sleeve.currentTaskLocation,".");break}case i.a.Crime:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently attempting to ",s.a[e.sleeve.crimeType].type," (Success Rate:"," ",l.a.formatPercentage(s.a[e.sleeve.crimeType].successRate(e.sleeve)),").");break;case i.a.Class:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently studying/taking a course at ",e.sleeve.currentTaskLocation,".");break;case i.a.Gym:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently working out at ",e.sleeve.currentTaskLocation,".");break;case i.a.Recovery:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently set to focus on shock recovery. This causes the Sleeve's shock to decrease at a faster rate.");break;case i.a.Synchro:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently set to synchronize with the original consciousness. This causes the Sleeve's synchronization to increase.");break;default:console.error("Invalid/Unrecognized taskValue in updateSleeveTaskDescription(): "+t[0])}let C=[];if(e.sleeve.currentTask===i.a.Crime)C=[["Money",r.a.createElement(f.a,{money:parseFloat(e.sleeve.currentTaskLocation)}),"(on success)"],["Hacking Exp",l.a.formatExp(e.sleeve.gainRatesForTask.hack),"(2x on success)"],["Strength Exp",l.a.formatExp(e.sleeve.gainRatesForTask.str),"(2x on success)"],["Defense Exp",l.a.formatExp(e.sleeve.gainRatesForTask.def),"(2x on success)"],["Dexterity Exp",l.a.formatExp(e.sleeve.gainRatesForTask.dex),"(2x on success)"],["Agility Exp",l.a.formatExp(e.sleeve.gainRatesForTask.agi),"(2x on success)"],["Charisma Exp",l.a.formatExp(e.sleeve.gainRatesForTask.cha),"(2x on success)"]];else if(C=[["Money:",r.a.createElement(g.a,{money:5*e.sleeve.gainRatesForTask.money})],["Hacking Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.hack)+" / s"],["Strength Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.str)+" / s"],["Defense Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.def)+" / s"],["Dexterity Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.dex)+" / s"],["Agility Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.agi)+" / s"],["Charisma Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.cha)+" / s"]],e.sleeve.currentTask===i.a.Company||e.sleeve.currentTask===i.a.Faction){const t=e.sleeve.getRepGain(e.player);C.push(["Reputation:",Object(y.a)(5*t)])}return r.a.createElement("div",{className:"sleeve-elem"},r.a.createElement("div",{className:"sleeve-panel",style:{width:"25%"}},r.a.createElement("div",{className:"sleeve-stats-text"},r.a.createElement(b.a,{sleeve:e.sleeve}),r.a.createElement("button",{className:"std-button",onClick:function(){Object(c.a)(r.a.createElement(E.a,{sleeve:e.sleeve}))}},"More Stats"),r.a.createElement("button",{className:"std-button"+(e.player.money.lt(o.a.TravelCost)?" tooltip":""),onClick:function(){Object(m.a)("sleeve-travel-popup",p.a,{popupId:"sleeve-travel-popup",sleeve:e.sleeve,player:e.player,rerender:e.rerender})},disabled:e.player.money.lt(o.a.TravelCost)},"Travel",e.player.money.lt(o.a.TravelCost)&&r.a.createElement("span",{className:"tooltiptext"},"Not enough money")),r.a.createElement("button",{className:"std-button"+(e.sleeve.shock<100?" tooltip":""),onClick:function(){Object(m.a)("sleeve-augmentation-popup",h.a,{sleeve:e.sleeve,player:e.player})},style:{display:"block"},disabled:e.sleeve.shock<100},"Manage Augmentations",e.sleeve.shock<100&&r.a.createElement("span",{className:"tooltiptext"},"Unlocked when sleeve has fully recovered")))),r.a.createElement("div",{className:"sleeve-panel",style:{width:"40%"}},r.a.createElement(k.a,{player:e.player,sleeve:e.sleeve,setABC:a}),r.a.createElement("p",null,w),r.a.createElement("p",null,e.sleeve.currentTask===i.a.Crime&&Object(u.a)({progress:e.sleeve.currentTaskTime/e.sleeve.currentTaskMaxTime,totalTicks:25})),r.a.createElement("button",{className:"std-button",onClick:function(){switch(e.sleeve.resetTaskStatus(),t[0]){case"------":break;case"Work for Company":e.sleeve.workForCompany(e.player,t[1]);break;case"Work for Faction":e.sleeve.workForFaction(e.player,t[1],t[2]);break;case"Commit Crime":e.sleeve.commitCrime(e.player,t[1]);break;case"Take University Course":e.sleeve.takeUniversityCourse(e.player,t[2],t[1]);break;case"Workout at Gym":e.sleeve.workoutAtGym(e.player,t[2],t[1]);break;case"Shock Recovery":e.sleeve.shockRecovery(e.player);break;case"Synchronize":e.sleeve.synchronize(e.player);break;default:console.error("Invalid/Unrecognized taskValue in setSleeveTask(): "+t[0])}e.rerender()}},"Set Task")),r.a.createElement("div",{className:"sleeve-panel",style:{width:"35%"}},r.a.createElement(d.a,{title:"Earnings (Pre-Synchronization)",stats:C}),r.a.createElement("button",{className:"std-button",onClick:function(){Object(c.a)(r.a.createElement(v.a,{sleeve:e.sleeve}))}},"More Earnings Info")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(511),o=a(19),s=a(15),l=a(445);function c(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(a,150);return()=>clearInterval(e)},[]);const c=e.sleeve.augmentations.map(e=>e.name),u=Object(i.a)(e.sleeve,e.player);return r.a.createElement("div",{className:"noselect"},r.a.createElement("p",{style:{display:"block"}},"Owned Augmentations:"),r.a.createElement("div",{style:{width:"70%"}},c.map(e=>{const t=o.a[e];let a=t.info;return"string"!=typeof a&&(a=Object(l.renderToStaticMarkup)(a)),a+="

",a+=Object(l.renderToStaticMarkup)(t.stats),r.a.createElement("div",{key:e,className:"gang-owned-upgrade tooltip"},e,r.a.createElement("span",{className:"tooltiptext",dangerouslySetInnerHTML:{__html:a}}))})),r.a.createElement("p",null,"You can purchase Augmentations for your Duplicate Sleeves. These Augmentations have the same effect as they would for you. You can only purchase Augmentations that you have unlocked through Factions.",r.a.createElement("br",null),r.a.createElement("br",null),"When purchasing an Augmentation for a Duplicate Sleeve, they are immediately installed. This means that the Duplicate Sleeve will immediately lose all of its stat experience."),u.map(t=>{let n=t.info;return"string"!=typeof n&&(n=Object(l.renderToStaticMarkup)(n)),n+="

",n+=Object(l.renderToStaticMarkup)(t.stats),r.a.createElement("div",{key:t.name,className:"cmpy-mgmt-upgrade-div",onClick:()=>function(t){e.sleeve.tryBuyAugmentation(e.player,t),a()}(t)},r.a.createElement("div",{style:{fontSize:"12px",padding:"2px"}},r.a.createElement("h2",null,t.name),r.a.createElement("br",null),"Cost: ",r.a.createElement(s.a,{money:t.startingCost,player:e.player}),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("span",{dangerouslySetInnerHTML:{__html:n}})))}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(4),o=a(22),s=a(15),l=a(385),c=a(23),u=a(18),m=a(11);function h(e){function t(t){e.player.canAfford(i.a.TravelCost)||Object(m.a)("You cannot afford to have this sleeve travel to another city"),e.sleeve.city=t,e.player.loseMoney(i.a.TravelCost),e.sleeve.resetTaskStatus(),Object(o.b)(e.popupId),e.rerender()}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Have this sleeve travel to a different city. This affects the gyms and universities at which this sleeve can study. Traveling to a different city costs ",r.a.createElement(s.a,{money:i.a.TravelCost,player:e.player}),". It will also set your current sleeve task to idle."),u.a.DisableASCIIArt?Object.values(c.a).map(e=>r.a.createElement("button",{key:e,className:"std-button",onClick:()=>t(e)},e)):r.a.createElement(l.a,{currentCity:e.sleeve.city,onTravel:e=>t(e)}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(0);function r(e){return n.createElement(n.Fragment,null,n.createElement("pre",null,e.title),n.createElement("table",null,n.createElement("tbody",null,e.stats.map((e,t)=>n.createElement("tr",{key:t},e.map((e,t)=>{let a={};return 0!==t&&(a={textAlign:"right"}),n.createElement("td",{style:a,key:t},e)}))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(3),r=a(0);function i(e){let t={};return t={textAlign:"right"},r.createElement(r.Fragment,null,r.createElement("table",null,r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{className:"character-hp-cell"},"HP: "),r.createElement("td",{className:"character-hp-cell",style:t},n.a.formatHp(e.sleeve.hp)," / ",n.a.formatHp(e.sleeve.max_hp))),r.createElement("tr",null,r.createElement("td",null,"City: "),r.createElement("td",{style:t},e.sleeve.city)),r.createElement("tr",null,r.createElement("td",{className:"character-hack-cell"},"Hacking: "),r.createElement("td",{className:"character-hack-cell",style:t},n.a.formatSkill(e.sleeve.hacking_skill))),r.createElement("tr",null,r.createElement("td",{className:"character-combat-cell"},"Strength: "),r.createElement("td",{className:"character-combat-cell",style:t},n.a.formatSkill(e.sleeve.strength))),r.createElement("tr",null,r.createElement("td",{className:"character-combat-cell"},"Defense: "),r.createElement("td",{className:"character-combat-cell",style:t},n.a.formatSkill(e.sleeve.defense))),r.createElement("tr",null,r.createElement("td",{className:"character-combat-cell"},"Dexterity: "),r.createElement("td",{className:"character-combat-cell",style:t},n.a.formatSkill(e.sleeve.dexterity))),r.createElement("tr",null,r.createElement("td",{className:"character-combat-cell"},"Agility: "),r.createElement("td",{className:"character-combat-cell",style:t},n.a.formatSkill(e.sleeve.agility))),r.createElement("tr",null,r.createElement("td",{className:"character-cha-cell"},"Charisma: "),r.createElement("td",{className:"character-cha-cell",style:t},n.a.formatSkill(e.sleeve.charisma))),r.createElement("tr",null,r.createElement("td",{className:"character-int-cell"},"Shock: "),r.createElement("td",{className:"character-int-cell",style:t},n.a.formatSleeveShock(100-e.sleeve.shock))),r.createElement("tr",null,r.createElement("td",{className:"character-int-cell"},"Sync: "),r.createElement("td",{className:"character-int-cell",style:t},n.a.formatSleeveSynchro(e.sleeve.sync))),r.createElement("tr",null,r.createElement("td",{className:"character-int-cell"},"Memory: "),r.createElement("td",{className:"character-int-cell",style:t},n.a.formatSleeveMemory(e.sleeve.memory))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(3),r=a(196),i=a(0);function o(e){return i.createElement(i.Fragment,null,i.createElement(r.a,{rows:[["Hacking: ",e.sleeve.hacking_skill,`(${n.a.formatExp(e.sleeve.hacking_exp)} exp)`],["Strength: ",e.sleeve.strength,`(${n.a.formatExp(e.sleeve.strength_exp)} exp)`],["Defense: ",e.sleeve.defense,`(${n.a.formatExp(e.sleeve.defense_exp)} exp)`],["Dexterity: ",e.sleeve.dexterity,`(${n.a.formatExp(e.sleeve.dexterity_exp)} exp)`],["Agility: ",e.sleeve.agility,`(${n.a.formatExp(e.sleeve.agility_exp)} exp)`],["Charisma: ",e.sleeve.charisma,`(${n.a.formatExp(e.sleeve.charisma_exp)} exp)`]],title:"Stats:"}),i.createElement("br",null),i.createElement(r.a,{rows:[["Hacking Level multiplier: ",n.a.formatPercentage(e.sleeve.hacking_mult)],["Hacking Experience multiplier: ",n.a.formatPercentage(e.sleeve.hacking_exp_mult)],["Strength Level multiplier: ",n.a.formatPercentage(e.sleeve.strength_mult)],["Strength Experience multiplier: ",n.a.formatPercentage(e.sleeve.strength_exp_mult)],["Defense Level multiplier: ",n.a.formatPercentage(e.sleeve.defense_mult)],["Defense Experience multiplier: ",n.a.formatPercentage(e.sleeve.defense_exp_mult)],["Dexterity Level multiplier: ",n.a.formatPercentage(e.sleeve.dexterity_mult)],["Dexterity Experience multiplier: ",n.a.formatPercentage(e.sleeve.dexterity_exp_mult)],["Agility Level multiplier: ",n.a.formatPercentage(e.sleeve.agility_mult)],["Agility Experience multiplier: ",n.a.formatPercentage(e.sleeve.agility_exp_mult)],["Charisma Level multiplier: ",n.a.formatPercentage(e.sleeve.charisma_mult)],["Charisma Experience multiplier: ",n.a.formatPercentage(e.sleeve.charisma_exp_mult)],["Faction Reputation Gain multiplier: ",n.a.formatPercentage(e.sleeve.faction_rep_mult)],["Company Reputation Gain multiplier: ",n.a.formatPercentage(e.sleeve.company_rep_mult)],["Salary multiplier: ",n.a.formatPercentage(e.sleeve.work_money_mult)],["Crime Money multiplier: ",n.a.formatPercentage(e.sleeve.crime_money_mult)],["Crime Success multiplier: ",n.a.formatPercentage(e.sleeve.crime_success_mult)]],title:"Multipliers:"}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(3),r=a(15),i=a(0),o=a(196);function s(e){return i.createElement(i.Fragment,null,i.createElement(o.a,{rows:[["Money ",i.createElement(r.a,{money:e.sleeve.earningsForTask.money})],["Hacking Exp ",n.a.formatExp(e.sleeve.earningsForTask.hack)],["Strength Exp ",n.a.formatExp(e.sleeve.earningsForTask.str)],["Defense Exp ",n.a.formatExp(e.sleeve.earningsForTask.def)],["Dexterity Exp ",n.a.formatExp(e.sleeve.earningsForTask.dex)],["Agility Exp ",n.a.formatExp(e.sleeve.earningsForTask.agi)],["Charisma Exp ",n.a.formatExp(e.sleeve.earningsForTask.cha)]],title:"Earnings for Current Task:"}),i.createElement("br",null),i.createElement(o.a,{rows:[["Money: ",i.createElement(r.a,{money:e.sleeve.earningsForPlayer.money})],["Hacking Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.hack)],["Strength Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.str)],["Defense Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.def)],["Dexterity Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.dex)],["Agility Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.agi)],["Charisma Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.cha)]],title:"Total Earnings for Host Consciousness:"}),i.createElement("br",null),i.createElement(o.a,{rows:[["Money: ",i.createElement(r.a,{money:e.sleeve.earningsForSleeves.money})],["Hacking Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.hack)],["Strength Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.str)],["Defense Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.def)],["Dexterity Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.dex)],["Agility Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.agi)],["Charisma Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.cha)]],title:"Total Earnings for Other Sleeves:"}),i.createElement("br",null))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a(0),r=a.n(n),i=a(59),o=a(65),s=a(8),l=a(23),c=a(24),u=a(139);const m=["Study Computer Science","Data Structures","Networks","Algorithms","Management","Leadership"],h=["Train Strength","Train Defense","Train Dexterity","Train Agility"];function p(e,t){const a=[];for(const n of e.sleeves)t!==n&&n.currentTask===i.a.Company&&a.push(n.currentTaskLocation);const n=Object.keys(e.jobs);for(let e=0;e({first:["------"],second:()=>["------"]}),"Work for Company":(e,t)=>{let a=p(e,t);return 0===a.length&&(a=["------"]),{first:a,second:()=>["------"]}},"Work for Faction":(e,t)=>{let a=d(e,t);return 0===a.length&&(a=["------"]),{first:a,second:e=>{const t=c.a[e].getInfo(),a=[];return t.offerHackingWork&&a.push("Hacking Contracts"),t.offerFieldWork&&a.push("Field Work"),t.offerSecurityWork&&a.push("Security Work"),a}}},"Commit Crime":()=>({first:Object.keys(o.a),second:()=>["------"]}),"Take University Course":(e,t)=>{let a=[];switch(t.city){case l.a.Aevum:a=[s.a.AevumSummitUniversity];break;case l.a.Sector12:a=[s.a.Sector12RothmanUniversity];break;case l.a.Volhaven:a=[s.a.VolhavenZBInstituteOfTechnology];break;default:a=["No university available in city!"]}return{first:m,second:()=>a}},"Workout at Gym":(e,t)=>{let a=[];switch(t.city){case l.a.Aevum:a=[s.a.AevumCrushFitnessGym,s.a.AevumSnapFitnessGym];break;case l.a.Sector12:a=[s.a.Sector12IronGym,s.a.Sector12PowerhouseGym];break;case l.a.Volhaven:a=[s.a.VolhavenMilleniumFitnessGym];break;default:a=["No gym available in city!"]}return{first:h,second:()=>a}},"Shock Recovery":()=>({first:["------"],second:()=>["------"]}),Synchronize:()=>({first:["------"],second:()=>["------"]})},g={"------":()=>!0,"Work for Company":(e,t)=>p(e,t).length>0,"Work for Faction":(e,t)=>d(e,t).length>0,"Commit Crime":()=>!0,"Take University Course":(e,t)=>[l.a.Aevum,l.a.Sector12,l.a.Volhaven].includes(t.city),"Workout at Gym":(e,t)=>[l.a.Aevum,l.a.Sector12,l.a.Volhaven].includes(t.city),"Shock Recovery":(e,t)=>t.shock<100,Synchronize:(e,t)=>t.sync<100};function y(e){const t=function(e){switch(e.currentTask){case i.a.Idle:return["------","------","------"];case i.a.Company:return["Work for Company",e.currentTaskLocation,"------"];case i.a.Faction:{let t="";switch(e.factionWorkType){case u.a.Hacking:t="Hacking Contracts";break;case u.a.Field:t="Field Work";break;case u.a.Security:t="Security Work"}return["Work for Faction",e.currentTaskLocation,t]}case i.a.Crime:return["Commit Crime",e.crimeType,"------"];case i.a.Class:return["Take University Course",e.className,e.currentTaskLocation];case i.a.Gym:return["Workout at Gym",e.gymStatType,e.currentTaskLocation];case i.a.Recovery:return["Shock Recovery","------","------"];case i.a.Synchro:return["Synchronize","------","------"]}}(e.sleeve),[a,o]=Object(n.useState)(t[0]),[s,l]=Object(n.useState)(t[1]),[c,m]=Object(n.useState)(t[2]),h=Object.keys(g).filter(t=>g[t](e.player,e.sleeve)),p=f[a];if(void 0===p)throw new Error(`No function for task '${a}'`);const d=p(e.player,e.sleeve),y=d.second(s);return d.first.length>0&&!d.first.includes(s)&&(l(d.first[0]),e.setABC([a,d.first[0],c])),y.length>0&&!y.includes(c)&&(m(y[0]),e.setABC([a,s,y[0]])),r.a.createElement(r.a.Fragment,null,r.a.createElement("select",{className:"dropdown",onChange:function(t){const n=t.target.value,r=f[n];if(void 0===r)throw new Error(`No function for task '${a}'`);const i=r(e.player,e.sleeve),s=i.second(i.first[0]);m(s[0]),l(i.first[0]),o(n),e.setABC([n,i.first[0],s[0]])},defaultValue:a},h.map(e=>r.a.createElement("option",{key:e,value:e},e))),!(1===d.first.length&&"------"===d.first[0])&&r.a.createElement("select",{className:"dropdown",onChange:function(t){l(t.target.value),e.setABC([a,t.target.value,c])},defaultValue:s},d.first.map(e=>r.a.createElement("option",{key:e,value:e},e))),!(1===y.length&&"------"===y[0])&&r.a.createElement("select",{className:"dropdown",onChange:function(t){m(t.target.value),e.setABC([a,s,t.target.value])},defaultValue:c},y.map(e=>r.a.createElement("option",{key:e,value:e},e))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(0),r=a.n(n),i=a(992),o=a(993),s=a(996),l=a(269),c=a(997),u=a(999),m=a(1e3),h=a(1001),p=a(33),d=a(50),f=a(32),g=a(101),y=a(22);function b(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}const[b,E]=Object(n.useState)(p.c.x1);Object(n.useEffect)(()=>{const e=setInterval(a,1e3);return()=>clearInterval(e)},[]);let v,k=0;for(let t=0;tE(p.c.x1),()=>E(p.c.x5),()=>E(p.c.x10),()=>E(p.c.MAX)],w=e.player.hacknetNodes.map(t=>{if(Object(d.g)(e.player)){if(t instanceof l.a)throw new Error("node was hacknet node");const n=f.b[t];if(null==n)throw new Error("Could not find Hacknet Server object in AllServers map for IP: "+t);if(n instanceof g.a)throw new Error("node was normal server");return r.a.createElement(s.a,{player:e.player,key:n.hostname,node:n,purchaseMultiplier:b,rerender:a})}if("string"==typeof t)throw new Error("node was ip string");return r.a.createElement(o.a,{player:e.player,key:t.name,node:t,purchaseMultiplier:b,rerender:a})});return r.a.createElement(r.a.Fragment,null,r.a.createElement("h1",null,"Hacknet ",Object(d.g)(e.player)?"Servers":"Nodes"),r.a.createElement(i.a,{hasHacknetServers:Object(d.g)(e.player)}),r.a.createElement(h.a,{cost:v,multiplier:b,onClick:function(){Object(d.l)(e.player),a()}}),r.a.createElement("br",null),r.a.createElement("div",{id:"hacknet-nodes-money-multipliers-div"},r.a.createElement(m.a,{totalProduction:k,player:e.player}),r.a.createElement(u.a,{onClicks:_,purchaseMultiplier:b})),Object(d.g)(e.player)&&r.a.createElement("button",{className:"std-button",onClick:function(){Object(y.a)("hacknet-server-hash-upgrades-popup",c.a,{player:e.player})},style:{display:"block"}},"Spend Hashes on Upgrades"),r.a.createElement("ul",{id:"hacknet-nodes-list"},w))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a.n(n);function i(e){return r.a.createElement("div",null,r.a.createElement("p",{className:"hacknet-general-info"},"The Hacknet is a global, decentralized network of machines. It is used by hackers all around the world to anonymously share computing power and perform distributed cyberattacks without the fear of being traced."),e.hasHacknetServers?r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"hacknet-general-info"},"Here, you can purchase a Hacknet Server, an upgraded version of the Hacknet Node. Hacknet Servers will perform computations and operations on the network, earning you hashes. Hashes can be spent on a variety of different upgrades."),r.a.createElement("p",{className:"hacknet-general-info"},"Hacknet Servers can also be used as servers to run scripts. However, running scripts on a server will reduce its hash rate (hashes generated per second). A Hacknet Server's hash rate will be reduced by the percentage of RAM that is being used by that Server to run scripts.")):r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"hacknet-general-info"},"Here, you can purchase a Hacknet Node, a specialized machine that can connect and contribute its resources to the Hacknet network. This allows you to take a small percentage of profits from hacks performed on the network. Essentially, you are renting out your Node's computing power."),r.a.createElement("p",{className:"hacknet-general-info"},"Each Hacknet Node you purchase will passively earn you money. Each Hacknet Node can be upgraded in order to increase its computing power and thereby increase the profit you earn from it.")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(33),o=a(50),s=a(15),l=a(138);function c(e){const t=e.node,a=e.purchaseMultiplier,n=e.rerender;let c,u,m,h,p,d;if(t.level>=i.a.MaxLevel)c=r.a.createElement(r.a.Fragment,null,"MAX LEVEL"),u="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.e)(e.player,t,i.a.MaxLevel);else{const e=i.a.MaxLevel-t.level;n=Math.min(e,a)}const l=t.calculateLevelUpgradeCost(n,e.player.hacknet_node_level_cost_mult);c=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),u=e.player.money.lt(l)?"std-button-disabled":"std-button"}if(t.ram>=i.a.MaxRam)m=r.a.createElement(r.a.Fragment,null,"MAX RAM"),h="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.f)(e.player,t,i.a.MaxRam);else{const e=Math.round(Math.log2(i.a.MaxRam/t.ram));n=Math.min(e,a)}const l=t.calculateRamUpgradeCost(n,e.player.hacknet_node_ram_cost_mult);m=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),h=e.player.money.lt(l)?"std-button-disabled":"std-button"}if(t.cores>=i.a.MaxCores)p=r.a.createElement(r.a.Fragment,null,"MAX CORES"),d="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.d)(e.player,t,i.a.MaxCores);else{const e=i.a.MaxCores-t.cores;n=Math.min(e,a)}const l=t.calculateCoreUpgradeCost(n,e.player.hacknet_node_core_cost_mult);p=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),d=e.player.money.lt(l)?"std-button-disabled":"std-button"}return r.a.createElement("li",{className:"hacknet-node"},r.a.createElement("div",{className:"hacknet-node-container"},r.a.createElement("div",{className:"row"},r.a.createElement("h1",{style:{fontSize:"1em"}},t.name)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Production:"),r.a.createElement("span",{className:"text money-gold"},r.a.createElement(s.a,{money:t.totalMoneyGenerated,player:e.player})," (",r.a.createElement(l.a,{money:t.moneyGainRatePerSecond}),")")),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Level:"),r.a.createElement("span",{className:"text upgradable-info"},t.level),r.a.createElement("button",{className:u,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.e)(e.player,t,i.a.MaxLevel)),Object(o.n)(e.player,t,r),n()}},c)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"RAM:"),r.a.createElement("span",{className:"text upgradable-info"},t.ram,"GB"),r.a.createElement("button",{className:h,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.f)(e.player,t,i.a.MaxRam)),Object(o.o)(e.player,t,r),n()}},m)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Cores:"),r.a.createElement("span",{className:"text upgradable-info"},t.cores),r.a.createElement("button",{className:d,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.d)(e.player,t,i.a.MaxCores)),Object(o.k)(e.player,t,r),n()}},p))))}},function(e,t,a){"use strict";function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}a.d(t,"a",(function(){return r}));class r{constructor(e){n(this,"costPerLevel",0),n(this,"desc",""),n(this,"hasTargetServer",!1),n(this,"name",""),n(this,"value",0),n(this,"effectText",()=>null),null!=e.cost&&(this.cost=e.cost),null!=e.effectText&&(this.effectText=e.effectText),this.costPerLevel=e.costPerLevel,this.desc=e.desc,this.hasTargetServer=!!e.hasTargetServer&&e.hasTargetServer,this.name=e.name,this.value=e.value}getCost(e){return"number"==typeof this.cost?this.cost:Math.round((e+1)*this.costPerLevel)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(3),o=a(15);const s=[{cost:4,costPerLevel:4,desc:"Sell hashes for $1m",name:"Sell for Money",effectText:e=>r.a.createElement(r.a.Fragment,null,"Sold for ",r.a.createElement(o.a,{money:1e6*e})),value:1e6},{costPerLevel:100,desc:"Sell hashes for $1b in Corporation funds",name:"Sell for Corporation Funds",effectText:e=>r.a.createElement(r.a.Fragment,null,"Sold for ",r.a.createElement(o.a,{money:1e9*e})," Corporation funds."),value:1e9},{costPerLevel:50,desc:"Use hashes to decrease the minimum security of a single server by 2%. Note that a server's minimum security cannot go below 1. This effect persists until you install Augmentations (since servers are reset at that time).",hasTargetServer:!0,name:"Reduce Minimum Security",value:.98},{costPerLevel:50,desc:"Use hashes to increase the maximum amount of money on a single server by 2%. This effect persists until you install Augmentations (since servers are reset at that time).",hasTargetServer:!0,name:"Increase Maximum Money",value:1.02},{costPerLevel:50,desc:"Use hashes to improve the experience earned when studying at a university by 20%. This effect persists until you install Augmentations",name:"Improve Studying",effectText:e=>r.a.createElement(r.a.Fragment,null,"Improves studying by ",20*e,"%"),value:20},{costPerLevel:50,desc:"Use hashes to improve the experience earned when training at the gym by 20%. This effect persists until you install Augmentations",name:"Improve Gym Training",effectText:e=>r.a.createElement(r.a.Fragment,null,"Improves training by ",20*e,"%"),value:20},{costPerLevel:200,desc:"Exchange hashes for 1k Scientific Research in all of your Corporation's Industries",name:"Exchange for Corporation Research",effectText:e=>r.a.createElement(r.a.Fragment,null,"Acquired a total of ",e,"k Scientific Research in your industries."),value:1e3},{costPerLevel:250,desc:"Exchange hashes for 100 Bladeburner Rank",name:"Exchange for Bladeburner Rank",effectText:e=>r.a.createElement(r.a.Fragment,null,"Acquired a total of ",i.a.format(100*e,"0a")," Bladeburner rank"),value:100},{costPerLevel:250,desc:"Exchanges hashes for 10 Bladeburner Skill Points",name:"Exchange for Bladeburner SP",effectText:e=>r.a.createElement(r.a.Fragment,null,"Acquired a total of ",i.a.format(10*e,"0a")," Bladeburner Skill Points"),value:10},{costPerLevel:200,desc:"Generate a random Coding Contract somewhere on the network",name:"Generate Coding Contract",effectText:e=>r.a.createElement(r.a.Fragment,null,"Generated ",e," contracts."),value:1}]},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(33),o=a(50),s=a(15),l=a(195),c=a(512);function u(e){const t=e.node,a=e.purchaseMultiplier,n=e.rerender;let u,m,h,p,d,f,g,y;if(t.level>=i.b.MaxLevel)u=r.a.createElement(r.a.Fragment,null,"MAX LEVEL"),m="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.e)(e.player,t,i.b.MaxLevel);else{const e=i.b.MaxLevel-t.level;n=Math.min(e,a)}const l=t.calculateLevelUpgradeCost(n,e.player.hacknet_node_level_cost_mult);u=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),m=e.player.money.lt(l)?"std-button-disabled":"std-button"}if(t.maxRam>=i.b.MaxRam)h=r.a.createElement(r.a.Fragment,null,"MAX RAM"),p="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.f)(e.player,t,i.b.MaxRam);else{const e=Math.round(Math.log2(i.b.MaxRam/t.maxRam));n=Math.min(e,a)}const l=t.calculateRamUpgradeCost(n,e.player.hacknet_node_ram_cost_mult);h=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),p=e.player.money.lt(l)?"std-button-disabled":"std-button"}if(t.cores>=i.b.MaxCores)d=r.a.createElement(r.a.Fragment,null,"MAX CORES"),f="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.d)(e.player,t,i.b.MaxCores);else{const e=i.b.MaxCores-t.cores;n=Math.min(e,a)}const l=t.calculateCoreUpgradeCost(n,e.player.hacknet_node_core_cost_mult);d=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),f=e.player.money.lt(l)?"std-button-disabled":"std-button"}if(t.cache>=i.b.MaxCache)g=r.a.createElement(r.a.Fragment,null,"MAX CACHE"),y="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.c)(e.player,t,i.b.MaxCache);else{const e=i.b.MaxCache-t.cache;n=Math.min(e,a)}const l=t.calculateCacheUpgradeCost(n);g=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),y=e.player.money.lt(l)?"std-button-disabled":"std-button"}return r.a.createElement("li",{className:"hacknet-node"},r.a.createElement("div",{className:"hacknet-node-container"},r.a.createElement("div",{className:"row"},r.a.createElement("h1",{style:{fontSize:"1em"}},t.hostname)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Production:"),r.a.createElement("span",{className:"text money-gold"},Object(l.a)(t.totalHashesGenerated)," (",Object(c.a)(t.hashRate),")")),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Hash Capacity:"),r.a.createElement("span",{className:"text"},Object(l.a)(t.hashCapacity))),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Level:"),r.a.createElement("span",{className:"text upgradable-info"},t.level),r.a.createElement("button",{className:m,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.e)(e.player,t,i.b.MaxLevel)),Object(o.n)(e.player,t,r),n()}},u)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"RAM:"),r.a.createElement("span",{className:"text upgradable-info"},t.maxRam,"GB"),r.a.createElement("button",{className:p,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.f)(e.player,t,i.b.MaxRam)),Object(o.o)(e.player,t,r),n()}},h)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Cores:"),r.a.createElement("span",{className:"text upgradable-info"},t.cores),r.a.createElement("button",{className:f,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.d)(e.player,t,i.b.MaxCores)),Object(o.k)(e.player,t,r),n()}},d)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Cache Level:"),r.a.createElement("span",{className:"text upgradable-info"},t.cache),r.a.createElement("button",{className:y,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.c)(e.player,t,i.b.MaxCache)),Object(o.j)(e.player,t,r),n(),Object(o.p)(e.player)}},g))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(316),o=a(229),s=a(195),l=a(998);function c(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(()=>t(e=>!e),1e3);return()=>clearInterval(e)},[]);const c=e.player.hashManager;if(!(c instanceof i.a))throw new Error("Player does not have a HashManager)");const u=Object.keys(o.a).map(t=>{const n=o.a[t];return r.a.createElement(l.a,{player:e.player,upg:n,hashManager:c,key:n.name,rerender:a})});return r.a.createElement("div",null,r.a.createElement("p",null,"Spend your hashes on a variety of different upgrades"),r.a.createElement("p",null,"Hashes: ",Object(s.a)(e.player.hashManager.hashes)),u)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(50),o=a(613),s=a(11),l=a(127),c=a(195);function u(e){const[t,a]=Object(n.useState)("ecorp");const u=e.hashManager,m=e.upg,h=u.getUpgradeCost(m.name),p=u.upgrades[m.name],d=m.effectText(p),f=u.hashes>=h?"std-button":"std-button-disabled";return r.a.createElement("div",{className:"bladeburner-action"},r.a.createElement(l.b,{value:m.name}),r.a.createElement("p",null,"Cost: ",Object(c.a)(h),", Bought: ",p," times"),r.a.createElement("p",null,m.desc),r.a.createElement("button",{className:f,onClick:function(){if(e.hashManager.hashes>=e.hashManager.getUpgradeCost(e.upg.name)){Object(i.m)(e.player,e.upg.name,t)||Object(s.a)("Failed to purchase upgrade. This may be because you do not have enough hashes, or because you do not have access to the feature upgrade affects."),e.rerender()}}},"Purchase"),p>0&&d&&r.a.createElement("p",null,d),m.hasTargetServer&&r.a.createElement(o.a,{serverType:o.b.Foreign,onChange:function(e){a(e.target.value)},style:{margin:"5px"}}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(33);function o(e){return r.a.createElement("button",{className:e.className,onClick:e.onClick},e.text)}function s(e){if(null==e.purchaseMultiplier)throw new Error("MultiplierButtons constructed without required props");const t=["x1","x5","x10","MAX"],a=e.onClicks,n=[];for(let s=0;s!e)}const E=s.a[e.locName];if(null==E)throw new Error("CompanyLocation component constructed with invalid company: "+e.locName);const v=o.a[e.locName];if(null==v)throw new Error("CompanyLocation component constructed with invalid location: "+e.locName);const k=t.jobs[e.locName]?t.jobs[e.locName]:null,_=k?c.a[k]:null;t.location=e.locName;const w=null!=k,C=E.getFavorGain();return r.a.createElement("div",null,w&&r.a.createElement("div",null,r.a.createElement("p",null,"Job Title: ",k),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"block"}},"-------------------------"),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip"},"Company reputation: ",Object(h.a)(E.playerReputation),r.a.createElement("span",{className:"tooltiptext"},"You will earn ",Object(p.a)(C[0])," company favor upon resetting after installing Augmentations")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"block"}},"-------------------------"),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip"},"Company Favor: ",Object(p.a)(E.favor),r.a.createElement("span",{className:"tooltiptext"},"Company favor increases the rate at which you earn reputation for this company by 1% per favor. Company favor is gained whenever you reset after installing Augmentations. The amount of favor you gain depends on how much reputation you have with the comapny.")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"block"}},"-------------------------"),r.a.createElement("br",null),r.a.createElement(m.a,{onClick:function(n){if(!n.isTrusted)return;const r=_;r instanceof l.a&&(r.isPartTimeJob()||r.isSoftwareConsultantJob()||r.isBusinessConsultantJob()?t.startWorkPartTime(a,e.locName):t.startWork(a,e.locName),a.toWork())},text:"Work"}),"    ",r.a.createElement(m.a,{onClick:function(a){if(!a.isTrusted)return;Object(d.a)("quit-job-popup",g.a,{locName:e.locName,company:E,player:t,onQuit:b,popupId:"quit-job-popup"})},text:"Quit"})),E.hasAgentPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.a[0]],onClick:function(e){e.isTrusted&&(t.applyForAgentJob(),b())},p:t,style:{display:"block"},text:"Apply for Agent Job"}),E.hasBusinessConsultantPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.c[0]],onClick:function(e){e.isTrusted&&(t.applyForBusinessConsultantJob(),b())},p:t,style:{display:"block"},text:"Apply for Business Consultant Job"}),E.hasBusinessPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.b[0]],onClick:function(e){e.isTrusted&&(t.applyForBusinessJob(),b())},p:t,style:{display:"block"},text:"Apply for Business Job"}),E.hasEmployeePositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.e[1]],onClick:function(e){e.isTrusted&&(t.applyForEmployeeJob(),b())},p:t,style:{display:"block"},text:"Apply to be an Employee"}),E.hasEmployeePositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.g[1]],onClick:function(e){e.isTrusted&&(t.applyForPartTimeEmployeeJob(),b())},p:t,style:{display:"block"},text:"Apply to be a part-time Employee"}),E.hasITPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.d[0]],onClick:function(e){e.isTrusted&&(t.applyForItJob(),b())},p:t,style:{display:"block"},text:"Apply for IT Job"}),E.hasSecurityPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.h[2]],onClick:function(e){e.isTrusted&&(t.applyForSecurityJob(),b())},p:t,style:{display:"block"},text:"Apply for Security Job"}),E.hasSoftwareConsultantPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.k[0]],onClick:function(e){e.isTrusted&&(t.applyForSoftwareConsultantJob(),b())},p:t,style:{display:"block"},text:"Apply for Software Consultant Job"}),E.hasSoftwarePositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.j[0]],onClick:function(e){e.isTrusted&&(t.applyForSoftwareJob(),b())},p:t,style:{display:"block"},text:"Apply for Software Job"}),E.hasWaiterPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.e[0]],onClick:function(e){e.isTrusted&&(t.applyForWaiterJob(),b())},p:t,style:{display:"block"},text:"Apply to be a Waiter"}),E.hasWaiterPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.g[0]],onClick:function(e){e.isTrusted&&(t.applyForPartTimeWaiterJob(),b())},p:t,style:{display:"block"},text:"Apply to be a part-time Waiter"}),null!=v.infiltrationData&&r.a.createElement(m.a,{onClick:function(t){if(!t.isTrusted)return;const n=v;if(!n.infiltrationData)throw new Error(`trying to start infiltration at ${e.locName} but the infiltrationData is null`);a.toInfiltration(n)},style:{display:"block"},text:"Infiltrate Company"}),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("br",null))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(25);const r=[{name:n.j[0],nextPosition:n.j[1],baseSalary:33,charismaEffectiveness:15,charismaExpGain:.02,hackingEffectiveness:85,hackingExpGain:.05,reqdHacking:1,repMultiplier:.9},{name:n.j[1],nextPosition:n.j[2],baseSalary:80,charismaEffectiveness:15,charismaExpGain:.05,hackingEffectiveness:85,hackingExpGain:.1,reqdHacking:51,reqdReputation:8e3,repMultiplier:1.1},{name:n.j[2],nextPosition:n.j[3],baseSalary:165,charismaEffectiveness:20,charismaExpGain:.08,hackingEffectiveness:80,hackingExpGain:.4,reqdCharisma:51,reqdHacking:251,reqdReputation:4e4,repMultiplier:1.3},{name:n.j[3],nextPosition:n.j[4],baseSalary:500,charismaEffectiveness:25,charismaExpGain:.1,hackingEffectiveness:75,hackingExpGain:.8,reqdCharisma:151,reqdHacking:401,reqdReputation:2e5,repMultiplier:1.5},{name:n.j[4],nextPosition:n.j[5],baseSalary:800,charismaEffectiveness:25,charismaExpGain:.5,hackingEffectiveness:75,hackingExpGain:1,reqdCharisma:251,reqdHacking:501,reqdReputation:4e5,repMultiplier:1.6},{name:n.j[5],nextPosition:n.j[6],baseSalary:1650,charismaEffectiveness:25,charismaExpGain:.5,hackingEffectiveness:75,hackingExpGain:1.1,reqdCharisma:251,reqdHacking:501,reqdReputation:8e5,repMultiplier:1.6},{name:n.j[6],nextPosition:n.j[7],baseSalary:2310,charismaEffectiveness:30,charismaExpGain:.6,hackingEffectiveness:70,hackingExpGain:1.2,reqdCharisma:401,reqdHacking:601,reqdReputation:16e5,repMultiplier:1.75},{name:n.j[7],nextPosition:null,baseSalary:2640,charismaEffectiveness:35,charismaExpGain:1,hackingEffectiveness:65,hackingExpGain:1.5,reqdCharisma:501,reqdHacking:751,reqdReputation:32e5,repMultiplier:2},{name:n.d[0],nextPosition:n.d[1],baseSalary:26,charismaEffectiveness:10,charismaExpGain:.01,hackingEffectiveness:90,hackingExpGain:.04,reqdHacking:1,repMultiplier:.9},{name:n.d[1],nextPosition:n.d[2],baseSalary:66,charismaEffectiveness:15,charismaExpGain:.02,hackingEffectiveness:85,hackingExpGain:.08,reqdHacking:26,reqdReputation:7e3,repMultiplier:1.1},{name:n.d[2],nextPosition:n.d[3],baseSalary:132,charismaEffectiveness:20,charismaExpGain:.1,hackingEffectiveness:80,hackingExpGain:.3,reqdCharisma:51,reqdHacking:151,reqdReputation:35e3,repMultiplier:1.3},{name:n.d[3],nextPosition:n.j[5],baseSalary:410,charismaEffectiveness:20,charismaExpGain:.2,hackingEffectiveness:80,hackingExpGain:.5,reqdCharisma:76,reqdHacking:251,reqdReputation:175e3,repMultiplier:1.4},{name:n.i[0],nextPosition:n.j[5],baseSalary:121,charismaEffectiveness:15,charismaExpGain:.05,hackingEffectiveness:85,hackingExpGain:.4,reqdCharisma:26,reqdHacking:151,reqdReputation:35e3,repMultiplier:1.2},{name:n.f[0],nextPosition:n.f[1],baseSalary:121,charismaEffectiveness:15,charismaExpGain:.05,hackingEffectiveness:85,hackingExpGain:.4,reqdCharisma:26,reqdHacking:151,reqdReputation:35e3,repMultiplier:1.2},{name:n.f[1],nextPosition:n.j[5],baseSalary:410,charismaEffectiveness:20,charismaExpGain:.1,hackingEffectiveness:80,hackingExpGain:.5,reqdCharisma:76,reqdHacking:251,reqdReputation:175e3,repMultiplier:1.3},{name:n.b[0],nextPosition:n.b[1],baseSalary:46,charismaEffectiveness:90,charismaExpGain:.08,hackingEffectiveness:10,hackingExpGain:.01,reqdCharisma:1,reqdHacking:1,repMultiplier:.9},{name:n.b[1],nextPosition:n.b[2],baseSalary:100,charismaEffectiveness:85,charismaExpGain:.15,hackingEffectiveness:15,hackingExpGain:.02,reqdCharisma:51,reqdHacking:6,reqdReputation:8e3,repMultiplier:1.1},{name:n.b[2],nextPosition:n.b[3],baseSalary:200,charismaEffectiveness:85,charismaExpGain:.3,hackingEffectiveness:15,hackingExpGain:.02,reqdCharisma:101,reqdHacking:51,reqdReputation:4e4,repMultiplier:1.3},{name:n.b[3],nextPosition:n.b[4],baseSalary:660,charismaEffectiveness:85,charismaExpGain:.4,hackingEffectiveness:15,hackingExpGain:.02,reqdCharisma:226,reqdHacking:51,reqdReputation:2e5,repMultiplier:1.5},{name:n.b[4],nextPosition:n.b[5],baseSalary:1950,charismaEffectiveness:90,charismaExpGain:1,hackingEffectiveness:10,hackingExpGain:.05,reqdCharisma:501,reqdHacking:76,reqdReputation:8e5,repMultiplier:1.6},{name:n.b[5],nextPosition:null,baseSalary:3900,charismaEffectiveness:90,charismaExpGain:1.5,hackingEffectiveness:10,hackingExpGain:.05,reqdCharisma:751,reqdHacking:101,reqdReputation:32e5,repMultiplier:1.75},{name:n.h[0],nextPosition:n.h[1],baseSalary:82,hackingEffectiveness:5,strengthEffectiveness:20,defenseEffectiveness:20,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:15,hackingExpGain:.02,strengthExpGain:.08,defenseExpGain:.08,dexterityExpGain:.08,agilityExpGain:.08,charismaExpGain:.04,reqdHacking:11,reqdStrength:101,reqdDefense:101,reqdDexterity:101,reqdAgility:101,reqdCharisma:51,reqdReputation:8e3,repMultiplier:1},{name:n.h[1],nextPosition:null,baseSalary:460,hackingEffectiveness:5,strengthEffectiveness:20,defenseEffectiveness:20,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:15,hackingExpGain:.02,strengthExpGain:.1,defenseExpGain:.1,dexterityExpGain:.1,agilityExpGain:.1,charismaExpGain:.1,reqdHacking:101,reqdStrength:301,reqdDefense:301,reqdDexterity:301,reqdAgility:301,reqdCharisma:151,reqdReputation:36e3,repMultiplier:1.25},{name:n.h[2],nextPosition:n.h[3],baseSalary:50,hackingEffectiveness:5,strengthEffectiveness:20,defenseEffectiveness:20,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:15,hackingExpGain:.01,strengthExpGain:.04,defenseExpGain:.04,dexterityExpGain:.04,agilityExpGain:.04,charismaExpGain:.02,reqdStrength:51,reqdDefense:51,reqdDexterity:51,reqdAgility:51,reqdCharisma:1,repMultiplier:1},{name:n.h[3],nextPosition:n.h[4],baseSalary:195,hackingEffectiveness:10,strengthEffectiveness:20,defenseEffectiveness:20,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:10,hackingExpGain:.02,strengthExpGain:.1,defenseExpGain:.1,dexterityExpGain:.1,agilityExpGain:.1,charismaExpGain:.05,reqdHacking:26,reqdStrength:151,reqdDefense:151,reqdDexterity:151,reqdAgility:151,reqdCharisma:51,reqdReputation:8e3,repMultiplier:1.1},{name:n.h[4],nextPosition:n.h[5],baseSalary:660,hackingEffectiveness:10,strengthEffectiveness:15,defenseEffectiveness:15,dexterityEffectiveness:15,agilityEffectiveness:15,charismaEffectiveness:30,hackingExpGain:.02,strengthExpGain:.12,defenseExpGain:.12,dexterityExpGain:.12,agilityExpGain:.12,charismaExpGain:.1,reqdHacking:26,reqdStrength:251,reqdDefense:251,reqdDexterity:251,reqdAgility:251,reqdCharisma:101,reqdReputation:36e3,repMultiplier:1.25},{name:n.h[5],nextPosition:null,baseSalary:1320,hackingEffectiveness:10,strengthEffectiveness:15,defenseEffectiveness:15,dexterityEffectiveness:15,agilityEffectiveness:15,charismaEffectiveness:30,hackingExpGain:.05,strengthExpGain:.15,defenseExpGain:.15,dexterityExpGain:.15,agilityExpGain:.15,charismaExpGain:.15,reqdHacking:51,reqdStrength:501,reqdDefense:501,reqdDexterity:501,reqdAgility:501,reqdCharisma:151,reqdReputation:144e3,repMultiplier:1.4},{name:n.a[0],nextPosition:n.a[1],baseSalary:330,hackingEffectiveness:10,strengthEffectiveness:15,defenseEffectiveness:15,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:20,hackingExpGain:.04,strengthExpGain:.08,defenseExpGain:.08,dexterityExpGain:.08,agilityExpGain:.08,charismaExpGain:.05,reqdHacking:101,reqdStrength:101,reqdDefense:101,reqdDexterity:101,reqdAgility:101,reqdCharisma:101,reqdReputation:8e3,repMultiplier:1},{name:n.a[1],nextPosition:n.a[2],baseSalary:990,hackingEffectiveness:15,strengthEffectiveness:15,defenseEffectiveness:15,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:15,hackingExpGain:.1,strengthExpGain:.15,defenseExpGain:.15,dexterityExpGain:.15,agilityExpGain:.15,charismaExpGain:.1,reqdHacking:201,reqdStrength:251,reqdDefense:251,reqdDexterity:251,reqdAgility:251,reqdCharisma:201,reqdReputation:32e3,repMultiplier:1.25},{name:n.a[2],nextPosition:null,baseSalary:2e3,hackingEffectiveness:15,strengthEffectiveness:15,defenseEffectiveness:15,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:15,hackingExpGain:.15,strengthExpGain:.2,defenseExpGain:.2,dexterityExpGain:.2,agilityExpGain:.2,charismaExpGain:.15,reqdHacking:251,reqdStrength:501,reqdDefense:501,reqdDexterity:501,reqdAgility:501,reqdCharisma:251,reqdReputation:162e3,repMultiplier:1.5},{name:n.e[0],nextPosition:null,baseSalary:22,strengthEffectiveness:10,dexterityEffectiveness:10,agilityEffectiveness:10,charismaEffectiveness:70,strengthExpGain:.02,defenseExpGain:.02,dexterityExpGain:.02,agilityExpGain:.02,charismaExpGain:.05,repMultiplier:1},{name:n.e[1],nextPosition:null,baseSalary:22,strengthEffectiveness:10,dexterityEffectiveness:10,agilityEffectiveness:10,charismaEffectiveness:70,strengthExpGain:.02,defenseExpGain:.02,dexterityExpGain:.02,agilityExpGain:.02,charismaExpGain:.04,repMultiplier:1},{name:n.k[0],nextPosition:n.k[1],baseSalary:66,hackingEffectiveness:80,charismaEffectiveness:20,hackingExpGain:.08,charismaExpGain:.03,reqdHacking:51,repMultiplier:1},{name:n.k[1],nextPosition:null,baseSalary:132,hackingEffectiveness:75,charismaEffectiveness:25,hackingExpGain:.25,charismaExpGain:.06,reqdHacking:251,reqdCharisma:51,repMultiplier:1.2},{name:n.c[0],nextPosition:n.c[1],baseSalary:66,hackingEffectiveness:20,charismaEffectiveness:80,hackingExpGain:.015,charismaExpGain:.15,reqdHacking:6,reqdCharisma:51,repMultiplier:1},{name:n.c[1],nextPosition:null,baseSalary:525,hackingEffectiveness:15,charismaEffectiveness:85,hackingExpGain:.015,charismaExpGain:.3,reqdHacking:51,reqdCharisma:226,repMultiplier:1.2},{name:n.g[0],nextPosition:null,baseSalary:20,strengthEffectiveness:10,dexterityEffectiveness:10,agilityEffectiveness:10,charismaEffectiveness:70,strengthExpGain:.0075,defenseExpGain:.0075,dexterityExpGain:.0075,agilityExpGain:.0075,charismaExpGain:.04,repMultiplier:1},{name:n.g[1],nextPosition:null,baseSalary:20,strengthEffectiveness:10,dexterityEffectiveness:10,agilityEffectiveness:10,charismaEffectiveness:70,strengthExpGain:.0075,defenseExpGain:.0075,dexterityExpGain:.0075,agilityExpGain:.0075,charismaExpGain:.03,repMultiplier:1}]},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(22);function o(e){return r.a.createElement(r.a.Fragment,null,"Would you like to quit your job at ",e.company.name,"?",r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("button",{autoFocus:!0,className:"std-button",onClick:function(){e.player.quitJob(e.locName),e.onQuit(),Object(i.b)(e.popupId)}},"Quit"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a(4),i=a(38),o=a(55),s=a(26),l=a(15);class c extends n.Component{constructor(e){super(e),this.btnStyle={display:"block"},this.trainStrength=this.trainStrength.bind(this),this.trainDefense=this.trainDefense.bind(this),this.trainDexterity=this.trainDexterity.bind(this),this.trainAgility=this.trainAgility.bind(this),this.calculateCost=this.calculateCost.bind(this)}calculateCost(){const e=o.a.getIp(this.props.loc.name),t=Object(i.b)(e);if(null==t||!t.hasOwnProperty("backdoorInstalled"))return this.props.loc.costMult;const a=t.backdoorInstalled?.9:1;return this.props.loc.costMult*a}train(e){const t=this.props.loc;this.props.p.startClass(this.props.router,this.calculateCost(),t.expMult,e)}trainStrength(){this.train(r.a.ClassGymStrength)}trainDefense(){this.train(r.a.ClassGymDefense)}trainDexterity(){this.train(r.a.ClassGymDexterity)}trainAgility(){this.train(r.a.ClassGymAgility)}render(){const e=r.a.ClassGymBaseCost*this.calculateCost();return n.createElement("div",null,n.createElement(s.a,{onClick:this.trainStrength,style:this.btnStyle,text:n.createElement(n.Fragment,null,"Train Strength (",n.createElement(l.a,{money:e,player:this.props.p})," / sec)")}),n.createElement(s.a,{onClick:this.trainDefense,style:this.btnStyle,text:n.createElement(n.Fragment,null,"Train Defense (",n.createElement(l.a,{money:e,player:this.props.p})," / sec)")}),n.createElement(s.a,{onClick:this.trainDexterity,style:this.btnStyle,text:n.createElement(n.Fragment,null,"Train Dexterity (",n.createElement(l.a,{money:e,player:this.props.p})," / sec)")}),n.createElement(s.a,{onClick:this.trainAgility,style:this.btnStyle,text:n.createElement(n.Fragment,null,"Train Agility (",n.createElement(l.a,{money:e,player:this.props.p})," / sec)")}))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(347),i=a(155),o=a(15),s=a(11);class l extends n.Component{constructor(e){super(e),this.btnStyle={display:"block"},this.getCost=this.getCost.bind(this),this.getHealed=this.getHealed.bind(this),this.state={currHp:this.props.p.hp}}getCost(){return Object(r.b)(this.props.p)}getHealed(e){if(!e.isTrusted)return;if(this.props.p.hp<0&&(this.props.p.hp=0),this.props.p.hp>=this.props.p.max_hp)return;const t=this.getCost();this.props.p.loseMoney(t),this.props.p.hp=this.props.p.max_hp,this.props.p.recordMoneySource(-1*t,"hospitalization"),this.setState({currHp:this.props.p.hp}),Object(s.a)(n.createElement(n.Fragment,null,"You were healed to full health! The hospital billed you for ",n.createElement(o.a,{money:t})))}render(){const e=this.getCost();return n.createElement(i.a,{onClick:this.getHealed,style:this.btnStyle,text:n.createElement(n.Fragment,null,"Get treatment for wounds - ",n.createElement(o.a,{money:e,player:this.props.p}))})}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(65),i=a(3),o=a(155),s=a(47);function l(){const e=s.b.Player(),t=s.b.Router();const a=r.a.Shoplift.successRate(e),l=r.a.RobStore.successRate(e),c=r.a.Mug.successRate(e),u=r.a.Larceny.successRate(e),m=r.a.DealDrugs.successRate(e),h=r.a.BondForgery.successRate(e),p=r.a.TraffickArms.successRate(e),d=r.a.Homicide.successRate(e),f=r.a.GrandTheftAuto.successRate(e),g=r.a.Kidnap.successRate(e),y=r.a.Assassination.successRate(e),b=r.a.Heist.successRate(e);return n.createElement("div",null,n.createElement(o.a,{label:`Shoplift (${i.a.formatPercentage(a)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Shoplift.commit(t,e)},style:{display:"block"},text:`Shoplift (${i.a.formatPercentage(a)} chance of success)`,tooltip:"Attempt to shoplift from a low-end retailer"}),n.createElement(o.a,{label:`Rob store (${i.a.formatPercentage(l)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.RobStore.commit(t,e)},style:{display:"block"},text:`Rob store (${i.a.formatPercentage(l)} chance of success)`,tooltip:"Attempt to commit armed robbery on a high-end store"}),n.createElement(o.a,{label:`Mug someone (${i.a.formatPercentage(c)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Mug.commit(t,e)},style:{display:"block"},text:`Mug someone (${i.a.formatPercentage(c)} chance of success)`,tooltip:"Attempt to mug a random person on the street"}),n.createElement(o.a,{label:`Larceny (${i.a.formatPercentage(u)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Larceny.commit(t,e)},style:{display:"block"},text:`Larceny (${i.a.formatPercentage(u)} chance of success)`,tooltip:"Attempt to rob property from someone's house"}),n.createElement(o.a,{label:`Deal Drugs (${i.a.formatPercentage(m)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.DealDrugs.commit(t,e)},style:{display:"block"},text:`Deal Drugs (${i.a.formatPercentage(m)} chance of success)`,tooltip:"Attempt to deal drugs"}),n.createElement(o.a,{label:`Bond Forgery (${i.a.formatPercentage(h)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.BondForgery.commit(t,e)},style:{display:"block"},text:`Bond Forgery (${i.a.formatPercentage(h)} chance of success)`,tooltip:"Attempt to forge corporate bonds"}),n.createElement(o.a,{label:`Traffick illegal Arms (${i.a.formatPercentage(p)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.TraffickArms.commit(t,e)},style:{display:"block"},text:`Traffick illegal Arms (${i.a.formatPercentage(p)} chance of success)`,tooltip:"Attempt to smuggle illegal arms into the city"}),n.createElement(o.a,{label:`Homicide (${i.a.formatPercentage(d)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Homicide.commit(t,e)},style:{display:"block"},text:`Homicide (${i.a.formatPercentage(d)} chance of success)`,tooltip:"Attempt to murder a random person on the street"}),n.createElement(o.a,{label:`Grand theft Auto (${i.a.formatPercentage(f)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.GrandTheftAuto.commit(t,e)},style:{display:"block"},text:`Grand theft Auto (${i.a.formatPercentage(f)} chance of success)`,tooltip:"Attempt to commit grand theft auto"}),n.createElement(o.a,{label:`Kidnap and Ransom (${i.a.formatPercentage(g)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Kidnap.commit(t,e)},style:{display:"block"},text:`Kidnap and Ransom (${i.a.formatPercentage(g)} chance of success)`,tooltip:"Attempt to kidnap and ransom a high-profile-target"}),n.createElement(o.a,{label:`Assassinate (${i.a.formatPercentage(y)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Assassination.commit(t,e)},style:{display:"block"},text:`Assassinate (${i.a.formatPercentage(y)} chance of success)`,tooltip:"Attempt to assassinate a high-profile target"}),n.createElement(o.a,{label:`Heist (${i.a.formatPercentage(b)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Heist.commit(t,e)},style:{display:"block"},text:`Heist (${i.a.formatPercentage(b)} chance of success)`,tooltip:"Attempt to pull off the ultimate heist"}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(1009),o=a(22),s=a(8),l=a(47),c=a(155),u=a(26),m=a(11);function h(e){const t=l.b.Player(),a=l.b.Router(),h=Object(n.useState)(!1)[1],p=t.inBladeburner();function d(){const e="create-start-corporation-popup";Object(o.a)(e,i.a,{player:t,popupId:e,router:a})}function f(){const e=t;if(e.inBladeburner())a.toBladeburner();else if(e.strength>=100&&e.defense>=100&&e.dexterity>=100&&e.agility>=100){e.startBladeburner({new:!0}),Object(m.a)("You have been accepted into the Bladeburner division!"),h(e=>!e);const t=document.getElementById("world-menu-header");t instanceof HTMLElement&&(t.click(),t.click())}else Object(m.a)("Rejected! Please apply again when you have 100 of each combat stat (str, def, dex, agi)")}function g(){a.toResleeves()}switch(e.loc.name){case s.a.NewTokyoVitaLife:return t.canAccessResleeving()?r.a.createElement(u.a,{onClick:g,style:{display:"block"},text:"Re-Sleeve"}):r.a.createElement(r.a.Fragment,null);case s.a.Sector12CityHall:return t.canAccessCorporation()?r.a.createElement(c.a,{disabled:!t.canAccessCorporation()||t.hasCorporation(),onClick:d,style:{display:"block"},text:"Create a Corporation"}):r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("i",null,"A business man is yelling at a clerk. You should come back later.")));case s.a.Sector12NSA:return function(){if(!t.canAccessBladeburner())return r.a.createElement(r.a.Fragment,null);const e=p?"Enter Bladeburner Headquarters":"Apply to Bladeburner Division";return r.a.createElement(u.a,{onClick:f,style:{display:"block"},text:e})}();case s.a.NewTokyoNoodleBar:return r.a.createElement(u.a,{onClick:function(){Object(m.a)(r.a.createElement(r.a.Fragment,null,"You ate some delicious noodles and feel refreshed."))},style:{display:"block"},text:"Eat noodles"});default:return console.error(`Location ${e.loc.name} doesn't have any special properties`),r.a.createElement(r.a.Fragment,null)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(22),o=a(15),s=a(11);function l(e){if(!e.player.canAccessCorporation()||e.player.hasCorporation())return Object(i.b)(e.popupId),r.a.createElement(r.a.Fragment,null);const[t,a]=Object(n.useState)("");return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Would you like to start a corporation? This will require $150b for registration and initial funding. This $150b can either be self-funded, or you can obtain the seed money from the government in exchange for 500 million shares",r.a.createElement("br",null),r.a.createElement("br",null),"If you would like to start one, please enter a name for your corporation below:"),r.a.createElement("input",{autoFocus:!0,className:"text-input",placeholder:"Corporation Name",onChange:function(e){a(e.target.value)},value:t}),r.a.createElement("button",{className:"std-button",onClick:function(){""!=t?(e.player.startCorporation(t,5e8),Object(s.a)("Congratulations! You just started your own corporation with government seed money. You can visit and manage your company in the City."),Object(i.b)(e.popupId),e.router.toCorporation()):Object(s.a)("Invalid company name!")},disabled:""==t},"Use seed money"),r.a.createElement("button",{className:"std-button",onClick:function(){e.player.canAfford(15e10)?""!=t?(e.player.startCorporation(t),e.player.loseMoney(15e10),Object(s.a)("Congratulations! You just self-funded your own corporation. You can visit and manage your company in the City."),Object(i.b)(e.popupId),e.router.toCorporation()):Object(s.a)("Invalid company name!"):Object(s.a)("You don't have enough money to create a corporation! You need $150b.")},disabled:""==t||!e.player.canAfford(15e10)},"Self-Fund (",r.a.createElement(o.a,{money:15e10,player:e.player}),")"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(1011),o=a(1013),s=a(1015),l=a(185),c=a(26),u=a(15),m=a(22),h=a(1016);function p(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}function p(e,t,n){Object(m.a)("purchase-server-popup",h.a,{ram:e,cost:t,p:n,popupId:"purchase-server-popup",rerender:a})}Object(n.useEffect)(()=>{const e=setInterval(a,1e3);return()=>clearInterval(e)},[]);const d={display:"block"},f=[];for(let t=e.loc.techVendorMinRam;t<=e.loc.techVendorMaxRam;t*=2){const a=Object(l.a)(t);f.push(r.a.createElement(c.a,{key:t,onClick:()=>p(t,a,e.p),style:d,text:r.a.createElement(r.a.Fragment,null,"Purchase ",t,"GB Server - ",r.a.createElement(u.a,{money:a,player:e.p})),disabled:!e.p.canAfford(a)}))}return r.a.createElement("div",null,f,r.a.createElement("br",null),r.a.createElement("p",{className:"noselect"},r.a.createElement("i",null,'"You can order bigger servers via scripts. We don\'t take custom order in person."')),r.a.createElement("br",null),r.a.createElement(o.a,{p:e.p,rerender:a}),r.a.createElement(i.a,{p:e.p,rerender:a}),r.a.createElement(s.a,{p:e.p,rerender:a}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(4),o=a(185),s=a(240),l=a(26),c=a(15),u=a(208);function m(e){const t={display:"block"},a=e.p.getHomeComputer();if(a.maxRam>=i.a.HomeComputerMaxRam)return r.a.createElement(s.a,{style:t,text:"Upgrade 'home' RAM - MAX"});const n=e.p.getUpgradeHomeRamCost();return r.a.createElement(l.a,{disabled:!e.p.canAfford(n),onClick:function(){Object(o.d)(e.p),e.rerender()},style:t,text:r.a.createElement(r.a.Fragment,null,"Upgrade 'home' RAM (",a.maxRam,"GB -> ",2*a.maxRam,"GB) -"," ",r.a.createElement(c.a,{money:n,player:e.p})),tooltip:r.a.createElement(u.a,{tex:String.raw`\large{cost = 3.2 \times 10^3 \times 1.58^{log_2{(ram)}}}`})})}},function(e,t,a){"use strict";function n(e){return!isNaN(e)&&(0!==e&&0==(e&e-1))}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(1014),o=a(4),s=a(240),l=a(26),c=a(15);function u(e){const t={display:"block"};return e.p.hasTorRouter()?r.a.createElement(s.a,{style:t,text:"TOR Router - Purchased"}):r.a.createElement(l.a,{disabled:!e.p.canAfford(o.a.TorRouterCost),onClick:function(){Object(i.a)(e.p),e.rerender()},style:t,text:r.a.createElement(r.a.Fragment,null,"Purchase TOR router - ",r.a.createElement(c.a,{money:o.a.TorRouterCost,player:e.p}))})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(4),r=a(32),i=a(38),o=a(55),s=a(11);function l(e){if(e.hasTorRouter())return void Object(s.a)("You already have a TOR Router!");if(!e.canAfford(n.a.TorRouterCost))return void Object(s.a)("You cannot afford to purchase the TOR router!");e.loseMoney(n.a.TorRouterCost);const t=Object(i.h)({ip:Object(r.c)(),hostname:"darkweb",organizationName:"",isConnectedTo:!1,adminRights:!1,purchasedByPlayer:!1,maxRam:1});Object(r.a)(t),o.a.addIp("Darkweb Server",t.ip),e.getHomeComputer().serversOnNetwork.push(t.ip),t.serversOnNetwork.push(e.getHomeComputer().ip),Object(s.a)("You have purchased a TOR router!
You now have access to the dark web from your home computer.
Use the scan/scan-analyze commands to search for the dark web connection.")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(240),o=a(26),s=a(15),l=a(208);function c(e){const t={display:"block"},a=e.p.getHomeComputer(),n=a.cpuCores>=8;if(n)return r.a.createElement(i.a,{style:t,text:"Upgrade 'home' cores - MAX"});const c=1e9*Math.pow(7.5,a.cpuCores);return r.a.createElement(o.a,{disabled:!e.p.canAfford(c),onClick:function(){n||e.p.canAfford(c)&&(e.p.loseMoney(c),a.cpuCores++,e.rerender())},style:t,text:r.a.createElement(r.a.Fragment,null,"Upgrade 'home' cores (",a.cpuCores," -> ",a.cpuCores+1,") -"," ",r.a.createElement(s.a,{money:c,player:e.p})),tooltip:r.a.createElement(l.a,{tex:String.raw`\large{cost = 10^9 \times 7.5 ^{\text{cores}}}`})})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(22),o=a(185),s=a(3),l=a(15),c=a(26);function u(e){const[t,a]=Object(n.useState)("");function u(){Object(o.e)(t,e.ram,e.cost,e.p),Object(i.b)(e.popupId)}return r.a.createElement(r.a.Fragment,null,"Would you like to purchase a new server with ",s.a.formatRAM(e.ram)," of RAM for"," ",r.a.createElement(l.a,{money:e.cost,player:e.p}),"?",r.a.createElement("br",null),r.a.createElement("br",null),"Please enter the server hostname below:",r.a.createElement("br",null),r.a.createElement("div",{className:"popup-box-input-div"},r.a.createElement("input",{autoFocus:!0,onKeyUp:function(e){13===e.keyCode&&u()},onChange:function(e){a(e.target.value)},className:"text-input noselect",type:"text",placeholder:"Unique Hostname"}),r.a.createElement(c.a,{onClick:u,text:"Purchase Server",disabled:!e.p.canAfford(e.cost)})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(4),o=a(15),s=a(22);function l(e){const t=i.a.TravelCost;return r.a.createElement(r.a.Fragment,null,r.a.createElement("span",null,"Would you like to travel to ",e.city,"? The trip will cost ",r.a.createElement(o.a,{money:t,player:e.player}),"."),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("button",{className:"std-button",onClick:function(){e.travel(),Object(s.b)(e.popupId)}},"Travel"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a(4),i=a(38),o=a(55),s=a(26),l=a(15),c=a(47);function u(e){const t=c.b.Player(),a=c.b.Router();function u(){const t=o.a.getIp(e.loc.name),a=Object(i.b)(t);if(null==a||!a.hasOwnProperty("backdoorInstalled"))return e.loc.costMult;const n=a.backdoorInstalled?.9:1;return e.loc.costMult*n}function m(n){const r=e.loc;t.startClass(a,u(),r.expMult,n)}const h=u(),p=r.a.ClassDataStructuresBaseCost*h,d=r.a.ClassNetworksBaseCost*h,f=r.a.ClassAlgorithmsBaseCost*h,g=r.a.ClassManagementBaseCost*h,y=r.a.ClassLeadershipBaseCost*h;return n.createElement("div",null,n.createElement(s.a,{onClick:function(){m(r.a.ClassStudyComputerScience)},style:{display:"block"},text:"Study Computer Science (free)",tooltip:"Gain hacking experience!"}),n.createElement(s.a,{onClick:function(){m(r.a.ClassDataStructures)},style:{display:"block"},text:n.createElement(n.Fragment,null,"Take Data Structures course (",n.createElement(l.a,{money:p,player:t})," / sec)"),tooltip:"Gain hacking experience!"}),n.createElement(s.a,{onClick:function(){m(r.a.ClassNetworks)},style:{display:"block"},text:n.createElement(n.Fragment,null,"Take Networks course (",n.createElement(l.a,{money:d,player:t})," / sec)"),tooltip:"Gain hacking experience!"}),n.createElement(s.a,{onClick:function(){m(r.a.ClassAlgorithms)},style:{display:"block"},text:n.createElement(n.Fragment,null,"Take Algorithms course (",n.createElement(l.a,{money:f,player:t})," / sec)"),tooltip:"Gain hacking experience!"}),n.createElement(s.a,{onClick:function(){m(r.a.ClassManagement)},style:{display:"block"},text:n.createElement(n.Fragment,null,"Take Management course (",n.createElement(l.a,{money:g,player:t})," / sec)"),tooltip:"Gain charisma experience!"}),n.createElement(s.a,{onClick:function(){m(r.a.ClassLeadership)},style:{display:"block"},text:n.createElement(n.Fragment,null,"Take Leadership course (",n.createElement(l.a,{money:y,player:t})," / sec)"),tooltip:"Gain charisma experience!"}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n,r=a(0),i=a(1020),o=a(1024),s=a(1025),l=a(1026),c=a(26);!function(e){e.None="none",e.Coin="coin",e.Slots="slots",e.Roulette="roulette",e.Blackjack="blackjack"}(n||(n={}));class u extends r.Component{constructor(e){super(e),this.state={game:n.None},this.updateGame=this.updateGame.bind(this)}updateGame(e){this.setState({game:e})}renderGames(){return r.createElement(r.Fragment,null,r.createElement(c.a,{onClick:()=>this.updateGame(n.Coin),text:"Play coin flip"}),r.createElement("br",null),r.createElement(c.a,{onClick:()=>this.updateGame(n.Slots),text:"Play slots"}),r.createElement("br",null),r.createElement(c.a,{onClick:()=>this.updateGame(n.Roulette),text:"Play roulette"}),r.createElement("br",null),r.createElement(c.a,{onClick:()=>this.updateGame(n.Blackjack),text:"Play blackjack"}))}renderGame(){let e=null;switch(this.state.game){case n.Coin:e=r.createElement(o.a,{p:this.props.p});break;case n.Slots:e=r.createElement(l.a,{p:this.props.p});break;case n.Roulette:e=r.createElement(s.a,{p:this.props.p});break;case n.Blackjack:e=r.createElement(i.a,{p:this.props.p});break;case n.None:break;default:throw new Error("MissingCaseException: "+this.state.game)}return r.createElement(r.Fragment,null,r.createElement(c.a,{onClick:()=>this.updateGame(n.None),text:"Stop playing"}),e)}render(){return this.state.game===n.None?this.renderGames():this.renderGame()}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a(15),i=a(306),o=a(1021),s=a(446),l=a(1527),c=a(615),u=a(1023),m=a(544),h=a(616);function p(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var d;!function(e){e.Pending="",e.PlayerWon="You won!",e.PlayerWonByBlackjack="You Won! Blackjack!",e.DealerWon="You lost!",e.Tie="Push! (Tie)"}(d||(d={}));class f extends i.a{constructor(e){super(e),p(this,"canStartGame",()=>{const{p:e}=this.props,{bet:t}=this.state;return e.canAfford(t)}),p(this,"startGame",()=>{if(!this.canStartGame())return;this.props.p.loseMoney(this.state.bet);const e=new s.a([this.deck.safeDrawCard(),this.deck.safeDrawCard()]),t=new s.a([this.deck.safeDrawCard(),this.deck.safeDrawCard()]);this.setState({playerHand:e,dealerHand:t,gameInProgress:!0,result:d.Pending}),21===this.getTrueHandValue(e)?21===this.getTrueHandValue(t)?this.finishGame(d.Tie):this.finishGame(d.PlayerWonByBlackjack):21===this.getTrueHandValue(t)&&this.finishGame(d.DealerWon)}),p(this,"getHandValue",e=>{let t=[0];for(let a=0;a=10?t.map(e=>e+10):1===n?t.flatMap(e=>[e+1,e+11]):t.map(e=>e+n)}return t}),p(this,"getTrueHandValue",e=>{const t=this.getHandValue(e),a=t.filter(e=>e<=21);return a.length>0?(a.sort((e,t)=>e-t),a[a.length-1]):t[0]}),p(this,"getHandDisplayValues",e=>{const t=this.getHandValue(e);return this.isHandBusted(e)?[...new Set([t[0]])]:[...new Set(t.filter(e=>e<=21))]}),p(this,"isHandBusted",e=>this.getTrueHandValue(e)>21),p(this,"playerHit",e=>{if(!e.isTrusted)return;const t=this.state.playerHand.addCards(this.deck.safeDrawCard());this.setState({playerHand:t}),this.isHandBusted(t)&&this.finishGame(d.DealerWon)}),p(this,"playerStay",e=>{if(!e.isTrusted)return;let t=this.state.dealerHand;for(;;){if(!(this.getTrueHandValue(t)<=16))break;t=t.addCards(this.deck.safeDrawCard())}if(this.setState({dealerHand:t}),this.isHandBusted(t))this.finishGame(d.PlayerWon);else{const e=this.getTrueHandValue(t),a=this.getTrueHandValue(this.state.playerHand);if(e>21||a>21)throw new Error("Someone busted when not expected to");a>e?this.finishGame(d.PlayerWon):a{let t=0;this.isPlayerWinResult(e)?(t=this.state.bet,this.win(this.props.p,2*t)):e===d.DealerWon?(t=-1*this.state.bet,this.win(this.props.p,-this.state.bet)):e===d.Tie&&this.win(this.props.p,this.state.bet),this.setState({gameInProgress:!1,result:e,gains:this.state.gains+t})}),p(this,"isPlayerWinResult",e=>e===d.PlayerWon||e===d.PlayerWonByBlackjack),p(this,"wagerOnChange",e=>{const{p:t}=this.props,a=e.target.value,n=Math.round(parseFloat(a));isNaN(n)?this.setState({bet:0,betInput:a,wagerInvalid:!0,wagerInvalidHelperText:"Not a valid number"}):n<=0?this.setState({bet:0,betInput:a,wagerInvalid:!0,wagerInvalidHelperText:"Must bet a postive amount"}):n>1e8?this.setState({bet:0,betInput:a,wagerInvalid:!0,wagerInvalidHelperText:"Exceeds max bet"}):t.canAfford(n)?this.setState({bet:n,betInput:a,wagerInvalid:!1,wagerInvalidHelperText:"",result:d.Pending}):this.setState({bet:0,betInput:a,wagerInvalid:!0,wagerInvalidHelperText:"Not enough money"})}),p(this,"startOnClick",e=>{e.isTrusted&&(this.state.wagerInvalid||this.startGame())}),this.deck=new o.a(5);this.state={playerHand:new s.a([]),dealerHand:new s.a([]),bet:1e6,betInput:String(1e6),gameInProgress:!1,result:d.Pending,gains:0,wagerInvalid:!1,wagerInvalidHelperText:""}}render(){const{betInput:e,playerHand:t,dealerHand:a,gameInProgress:i,result:o,wagerInvalid:s,wagerInvalidHelperText:p,gains:f}=this.state,g=this.getHandDisplayValues(t),y=this.getHandDisplayValues(a);return n.createElement("div",null,n.createElement("div",null,n.createElement(u.a,{value:e,label:n.createElement(n.Fragment,null,"Wager (Max: ",n.createElement(r.a,{money:1e8}),")"),disabled:i,onChange:this.wagerOnChange,error:s,helperText:s?p:"",type:"number",variant:"filled",style:{width:"200px"},InputProps:{startAdornment:n.createElement(l.a,{position:"start"},"$")}}),n.createElement("p",null,"Total earnings this session: ",n.createElement(r.a,{money:f}))),i?n.createElement("div",null,n.createElement(m.a,{onClick:this.playerHit},"Hit"),n.createElement(m.a,{color:"secondary",onClick:this.playerStay},"Stay")):n.createElement("div",null,n.createElement(m.a,{onClick:this.startOnClick,disabled:s||!this.canStartGame()},"Start")),(i||o!==d.Pending)&&n.createElement("div",null,n.createElement(h.a,{variant:"outlined",elevation:2},n.createElement("pre",null,"Player"),t.cards.map((e,t)=>n.createElement(c.a,{card:e,key:t})),n.createElement("pre",null,"Value(s): "),g.map((e,t)=>n.createElement("pre",{key:t},e))),n.createElement("br",null),n.createElement(h.a,{variant:"outlined",elevation:2},n.createElement("pre",null,"Dealer"),a.cards.map((e,t)=>n.createElement(c.a,{card:e,hidden:i&&0!==t,key:t})),!i&&n.createElement(n.Fragment,null,n.createElement("pre",null,"Value(s): "),y.map((e,t)=>n.createElement("pre",{key:t},e))))),o!==d.Pending&&n.createElement("p",null,o,this.isPlayerWinResult(o)&&n.createElement(n.Fragment,null," You gained ",n.createElement(r.a,{money:this.state.bet})),o===d.DealerWon&&n.createElement(n.Fragment,null," You lost ",n.createElement(r.a,{money:this.state.bet}))))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(201),r=a(1022);class i{constructor(e=1){var t,a,n;n=[],(a="cards")in(t=this)?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,this.numDecks=e,this.reset()}shuffle(){this.cards=Object(r.shuffle)(this.cards)}drawCard(){if(0==this.cards.length)throw new Error("Tried to draw card from empty deck");return this.cards.shift()}safeDrawCard(){return 0===this.cards.length&&this.reset(),this.drawCard()}reset(){this.cards=[];for(let e=1;e<=13;++e)for(let t=0;t{var t,a;return r.a.createElement(i.a,s({},e,{classes:{...u(),...e.classes},InputProps:{classes:{...m(),...null===(t=e.InputProps)||void 0===t?void 0:t.classes},...e.InputProps},InputLabelProps:{classes:{...h(),...null===(a=e.InputLabelProps)||void 0===a?void 0:a.classes},...e.InputLabelProps}}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(26),i=a(296),o=a(306),s=a(66);class l extends o.a{constructor(e){super(e),this.state={investment:1e3,result:n.createElement("span",null," "),status:"",playLock:!1},this.play=this.play.bind(this),this.updateInvestment=this.updateInvestment.bind(this)}updateInvestment(e){let t=parseInt(e.currentTarget.value);isNaN(t)&&(t=0),t>1e4&&(t=1e4),t<0&&(t=0),this.setState({investment:t})}play(e){if(this.reachedLimit(this.props.p))return;let t;t=i.a.random()<.5?"H":"T";const a=e===t;this.setState({result:n.createElement("span",{className:a?"text":"failure"},t),status:a?" win!":"lose!",playLock:!0}),setTimeout(()=>this.setState({playLock:!1}),250),a?this.win(this.props.p,this.state.investment):this.win(this.props.p,-this.state.investment),this.reachedLimit(this.props.p)}render(){return n.createElement(n.Fragment,null,n.createElement("pre",null,"+———————+"),n.createElement("pre",null,"| | | |"),n.createElement("pre",null,"| | ",this.state.result," | |"),n.createElement("pre",null,"| | | |"),n.createElement("pre",null,"+———————+"),n.createElement("span",{className:"text"},"Play for: "),n.createElement("input",{type:"number",className:"text-input",onChange:this.updateInvestment,value:this.state.investment}),n.createElement("br",null),n.createElement(r.a,{onClick:Object(s.a)(()=>this.play("H")),text:"Head!",disabled:this.state.playLock}),n.createElement(r.a,{onClick:Object(s.a)(()=>this.play("T")),text:"Tail!",disabled:this.state.playLock}),n.createElement("h1",null,this.state.status))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a(26),i=a(15),o=a(306),s=a(296),l=a(66);const c=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],u={Red:{match:e=>0!==e&&c.includes(e),payout:1},Black:{match:e=>!c.includes(e),payout:1},Odd:{match:e=>0!==e&&e%2==1,payout:1},Even:{match:e=>0!==e&&e%2==0,payout:1},High:{match:e=>0!==e&&e>18,payout:1},Low:{match:e=>0!==e&&e<19,payout:1},Third1:{match:e=>0!==e&&e<=12,payout:2},Third2:{match:e=>0!==e&&(e>=13&&e<=24),payout:2},Third3:{match:e=>0!==e&&e>=25,payout:2}};function m(e){return{match:t=>e===t,payout:36}}class h extends o.a{constructor(e){var t,a,n;super(e),n=-1,(a="interval")in(t=this)?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,this.rng=new s.b((new Date).getTime()),this.state={investment:1e3,canPlay:!0,status:"waiting",n:0,lock:!0,strategy:{payout:0,match:()=>!1}},this.step=this.step.bind(this),this.currentNumber=this.currentNumber.bind(this),this.updateInvestment=this.updateInvestment.bind(this)}componentDidMount(){this.interval=window.setInterval(this.step,50)}step(){this.state.lock||this.setState({n:Math.floor(37*Math.random())})}componentWillUnmount(){clearInterval(this.interval)}updateInvestment(e){let t=parseInt(e.currentTarget.value);isNaN(t)&&(t=0),t>1e7&&(t=1e7),t<0&&(t=0),this.setState({investment:t})}currentNumber(){if(0===this.state.n)return"0";const e=(t=this.state.n,[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36].includes(t)?"R":"B");var t;return`${this.state.n}${e}`}play(e){this.reachedLimit(this.props.p)||(this.setState({canPlay:!1,lock:!1,status:"playing",strategy:e}),setTimeout(()=>{let e=Math.floor(37*this.rng.random()),t=n.createElement(n.Fragment,null),a=0,r=this.state.strategy.match(e);if(r&&Math.random()>.9)for(r=!1;this.state.strategy.match(e);)e=(e+1)%36;r?(a=this.state.investment*this.state.strategy.payout,t=n.createElement(n.Fragment,null,"won ",n.createElement(i.a,{money:a}))):(a=-this.state.investment,t=n.createElement(n.Fragment,null,"lost ",n.createElement(i.a,{money:-a}))),this.win(this.props.p,a),this.setState({canPlay:!0,lock:!0,status:t,n:e}),this.reachedLimit(this.props.p)},1600))}render(){return n.createElement(n.Fragment,null,n.createElement("h1",null,this.currentNumber()),n.createElement("input",{type:"number",className:"text-input",onChange:this.updateInvestment,placeholder:"Amount to play",value:this.state.investment,disabled:!this.state.canPlay}),n.createElement("h1",null,this.state.status),n.createElement("table",null,n.createElement("tbody",null,n.createElement("tr",null,n.createElement("td",null,n.createElement(r.a,{text:"3",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(3)))})),n.createElement("td",null,n.createElement(r.a,{text:"6",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(6)))})),n.createElement("td",null,n.createElement(r.a,{text:"9",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(9)))})),n.createElement("td",null,n.createElement(r.a,{text:"12",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(12)))})),n.createElement("td",null,n.createElement(r.a,{text:"15",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(15)))})),n.createElement("td",null,n.createElement(r.a,{text:"18",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(18)))})),n.createElement("td",null,n.createElement(r.a,{text:"21",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(21)))})),n.createElement("td",null,n.createElement(r.a,{text:"24",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(24)))})),n.createElement("td",null,n.createElement(r.a,{text:"27",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(27)))})),n.createElement("td",null,n.createElement(r.a,{text:"30",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(30)))})),n.createElement("td",null,n.createElement(r.a,{text:"33",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(33)))})),n.createElement("td",null,n.createElement(r.a,{text:"36",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(36)))}))),n.createElement("tr",null,n.createElement("td",null,n.createElement(r.a,{text:"2",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(2)))})),n.createElement("td",null,n.createElement(r.a,{text:"5",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(5)))})),n.createElement("td",null,n.createElement(r.a,{text:"8",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(8)))})),n.createElement("td",null,n.createElement(r.a,{text:"11",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(11)))})),n.createElement("td",null,n.createElement(r.a,{text:"14",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(14)))})),n.createElement("td",null,n.createElement(r.a,{text:"17",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(17)))})),n.createElement("td",null,n.createElement(r.a,{text:"20",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(20)))})),n.createElement("td",null,n.createElement(r.a,{text:"23",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(23)))})),n.createElement("td",null,n.createElement(r.a,{text:"26",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(26)))})),n.createElement("td",null,n.createElement(r.a,{text:"29",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(29)))})),n.createElement("td",null,n.createElement(r.a,{text:"32",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(32)))})),n.createElement("td",null,n.createElement(r.a,{text:"35",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(35)))}))),n.createElement("tr",null,n.createElement("td",null,n.createElement(r.a,{text:"1",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(1)))})),n.createElement("td",null,n.createElement(r.a,{text:"4",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(4)))})),n.createElement("td",null,n.createElement(r.a,{text:"7",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(7)))})),n.createElement("td",null,n.createElement(r.a,{text:"10",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(10)))})),n.createElement("td",null,n.createElement(r.a,{text:"13",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(13)))})),n.createElement("td",null,n.createElement(r.a,{text:"16",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(16)))})),n.createElement("td",null,n.createElement(r.a,{text:"19",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(19)))})),n.createElement("td",null,n.createElement(r.a,{text:"22",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(22)))})),n.createElement("td",null,n.createElement(r.a,{text:"25",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(25)))})),n.createElement("td",null,n.createElement(r.a,{text:"28",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(28)))})),n.createElement("td",null,n.createElement(r.a,{text:"31",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(31)))})),n.createElement("td",null,n.createElement(r.a,{text:"34",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(34)))}))),n.createElement("tr",null,n.createElement("td",{colSpan:4},n.createElement(r.a,{text:"1 to 12",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Third1))})),n.createElement("td",{colSpan:4},n.createElement(r.a,{text:"13 to 24",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Third2))})),n.createElement("td",{colSpan:4},n.createElement(r.a,{text:"25 to 36",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Third3))}))),n.createElement("tr",null,n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"Red",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Red))})),n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"Black",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Black))})),n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"Odd",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Odd))})),n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"Even",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Even))})),n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"High",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.High))})),n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"Low",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Low))}))),n.createElement("tr",null,n.createElement("td",null,n.createElement(r.a,{text:"0",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(0)))}))))))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a(26),i=a(15),o=a(296),s=a(306),l=a(66);const c=["D","C","$","?","♥","A","C","B","C","E","B","E","C","*","D","♥","B","A","A","A","C","A","D","B","E","?","D","*","@","♥","B","E","?"];function u(e,t){switch(e){case"$":return[20,200,1e3][t];case"@":return[8,80,400][t];case"♥":case"?":return[6,20,150][t];case"D":case"E":return[1,8,30][t];default:return[1,5,20][t]}}const m=[[[0,0],[0,1],[0,2],[0,3],[0,4]],[[1,0],[1,1],[1,2],[1,3],[1,4]],[[2,0],[2,1],[2,2],[2,3],[2,4]],[[2,0],[1,1],[0,2],[1,3],[2,4]],[[0,0],[1,1],[2,2],[1,3],[0,4]],[[0,0],[1,1],[1,2],[1,3],[0,4]],[[2,0],[1,1],[1,2],[1,3],[2,4]],[[1,0],[0,1],[0,2],[0,3],[1,4]],[[1,0],[2,1],[2,2],[2,3],[1,4]]];class h extends s.a{constructor(e){var t,a,n;super(e),n=-1,(a="interval")in(t=this)?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,this.rng=new o.b(this.props.p.totalPlaytime),this.state={index:[0,0,0,0,0],investment:1e3,locks:[0,0,0,0,0],canPlay:!0,status:"waiting"},this.play=this.play.bind(this),this.lock=this.lock.bind(this),this.unlock=this.unlock.bind(this),this.step=this.step.bind(this),this.checkWinnings=this.checkWinnings.bind(this),this.getTable=this.getTable.bind(this),this.updateInvestment=this.updateInvestment.bind(this)}componentDidMount(){this.interval=window.setInterval(this.step,50)}step(){let e=!1;const t=this.state.index.slice();for(const a in t)(t[a]!==this.state.locks[a]||e)&&(t[a]=(t[a]+1)%c.length,e=!0);this.setState({index:t}),e&&t.every((e,t)=>e===this.state.locks[t])&&this.checkWinnings()}componentWillUnmount(){clearInterval(this.interval)}getTable(){return[[c[(this.state.index[0]+c.length-1)%c.length],c[(this.state.index[1]+c.length-1)%c.length],c[(this.state.index[2]+c.length-1)%c.length],c[(this.state.index[3]+c.length-1)%c.length],c[(this.state.index[4]+c.length-1)%c.length]],[c[this.state.index[0]],c[this.state.index[1]],c[this.state.index[2]],c[this.state.index[3]],c[this.state.index[4]]],[c[(this.state.index[0]+1)%c.length],c[(this.state.index[1]+1)%c.length],c[(this.state.index[2]+1)%c.length],c[(this.state.index[3]+1)%c.length],c[(this.state.index[4]+1)%c.length]]]}play(){this.reachedLimit(this.props.p)||(this.setState({status:"playing"}),this.win(this.props.p,-this.state.investment),this.state.canPlay&&(this.unlock(),setTimeout(this.lock,2e3*this.rng.random()+1e3)))}lock(){this.setState({locks:[Math.floor(this.rng.random()*c.length),Math.floor(this.rng.random()*c.length),Math.floor(this.rng.random()*c.length),Math.floor(this.rng.random()*c.length),Math.floor(this.rng.random()*c.length)]})}checkWinnings(){const e=this.getTable(),t=function(t){const a=[];for(const n of t)a.push(e[n[0]][n[1]]);return a},a=function(e){let t=1;for(let a=1;a0?"gained":"lost"," ",n.createElement(i.a,{money:Math.abs(r)})),canPlay:!0}),this.reachedLimit(this.props.p)}unlock(){this.setState({locks:[-1,-1,-1,-1,-1],canPlay:!1})}updateInvestment(e){let t=parseInt(e.currentTarget.value);isNaN(t)&&(t=0),t>1e6&&(t=1e6),t<0&&(t=0),this.setState({investment:t})}render(){const e=this.getTable();return n.createElement(n.Fragment,null,n.createElement("pre",null,"+———————————————————————+"),n.createElement("pre",null,"| | ",e[0][0]," | ",e[0][1]," | ",e[0][2]," | ",e[0][3]," | ",e[0][4]," | |"),n.createElement("pre",null,"| | | | | | | |"),n.createElement("pre",null,"| | ",c[this.state.index[0]]," | ",c[this.state.index[1]]," | ",c[this.state.index[2]]," | ",c[this.state.index[3]]," | ",c[this.state.index[4]]," | |"),n.createElement("pre",null,"| | | | | | | |"),n.createElement("pre",null,"| | ",c[(this.state.index[0]+1)%c.length]," | ",c[(this.state.index[1]+1)%c.length]," | ",c[(this.state.index[2]+1)%c.length]," | ",c[(this.state.index[3]+1)%c.length]," | ",c[(this.state.index[4]+1)%c.length]," | |"),n.createElement("pre",null,"+———————————————————————+"),n.createElement("input",{type:"number",className:"text-input",onChange:this.updateInvestment,placeholder:"Amount to play",value:this.state.investment,disabled:!this.state.canPlay}),n.createElement(r.a,{onClick:Object(l.a)(this.play),text:"Spin!",disabled:!this.state.canPlay}),n.createElement("h1",null,this.state.status),n.createElement("h2",null,"Pay lines"),n.createElement("pre",null,"----- ····· ·····"),n.createElement("pre",null,"····· ----- ·····"),n.createElement("pre",null,"····· ····· -----"),n.createElement("br",null),n.createElement("pre",null,"··^·· \\···/ \\···/"),n.createElement("pre",null,"·/·\\· ·\\·/· ·---·"),n.createElement("pre",null,"/···\\ ··v·· ·····"),n.createElement("br",null),n.createElement("pre",null,"····· ·---· ·····"),n.createElement("pre",null,"·---· /···\\ \\···/"),n.createElement("pre",null,"/···\\ ····· ·---·"))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a.n(n);function i(e){const[t,a]=Object(n.useState)(e.content);return Object(n.useEffect)(()=>{let e=5;const n=setInterval(()=>{if(e--,e>0)return;e=5*Math.random();const n=Math.random()*t.length,r=t.charAt(n);a(function(e,t,a){return e.substring(0,t)+a+e.substring(t+1)}(t,n,function(e){const t=e=>e[Math.floor(Math.random()*e.length)],a=["abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ","1234567890"," _","()[]{}<>"];for(const n of a)if(n.includes(e))return t(n);return t("!@#$%^&*()_+|\\';\"/.,?`~")}(r))),setTimeout(()=>{a(t)},50)},100);return()=>{clearInterval(n)}},[]),r.a.createElement("span",null,t)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a(114),i=a(8),o=a(205),s=a(18),l=a(26),c=a(47);function u(e,t){t.name===i.a.TravelAgency?e.toTravel():t.name===i.a.WorldStockExchange?e.toStockMarket():e.toLocation(t)}function m(e){const t=c.b.Router();return e?n.createElement("span",{"aria-label":e.name,key:e.name,className:"tooltip",style:{color:"white",whiteSpace:"nowrap",margin:"0px",padding:"0px",cursor:"pointer"},onClick:()=>u(t,e)},n.createElement("b",null,"X")):n.createElement("span",null,"*")}function h(e){const t=/[A-Z]/g,a={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25},r=n=>{const r=[],i=[];let s;for(;null!==(s=t.exec(n));)i.push(s);if(0===i.length)return r.push(n),r;for(let t=0;tn.createElement("li",{key:e},n.createElement(l.a,{onClick:()=>u(t,o.a[e]),text:e})));return n.createElement("ul",null,a)}function d(){const e=c.b.Player(),t=r.a[e.city];return n.createElement("div",{className:"noselect"},n.createElement("h2",null,t.name),s.a.DisableASCIIArt?n.createElement(p,{city:t}):n.createElement(h,{city:t}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(47),o=a(487),s=a(92),l=a(9),c=a(639),u=a(93),m=a(37);function h(){const e=i.b.Player(),t=i.b.Router(),a=Object(n.useState)(!1)[1];function h(){a(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(h,1e3);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement("div",null,r.a.createElement(s.a,null,r.a.createElement(l.a,null,"This page displays any programs that you are able to create. Writing the code for a program takes time, which can vary based on how complex the program is. If you are working on creating a program you can cancel at any time. Your progress will be saved and you can continue later.")),r.a.createElement(c.a,null,Object(o.a)(e).map(a=>{const n=a.create;return null===n?r.a.createElement(r.a.Fragment,null):r.a.createElement(u.a,{key:a.name,title:n.tooltip},r.a.createElement(m.a,{onClick:()=>{e.startCreateProgramWork(t,a.name,n.time,n.level)}},a.name))}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return M}));var n=a(0),r=a.n(n),i=a(26),o=a(1031),s=a(22),l=a(1044),c=a(1045),u=a(98),m=a(11),h=a(515),p=a(89),d=a(308),f=a(210),g=a(470),y=a(242),b=a(3),E=a(618),v=a(619),k=a(433),_=a(18),w=a(35);let C=!1,S=[];!function(){const e=Object(k.a)({});S=function e(t){let a=[];const n=Object.keys(t);for(const r of n)"object"==typeof t[r]&&(a.push(r),a=a.concat(e(t[r]))),"function"==typeof t[r]&&a.push(r);return a}(e);const t=["heart","break","exploit","bypass","corporation"];S=S.filter(e=>!t.includes(e))}();let x="",O="",T=null;function M(e){const t=Object(n.useRef)(null),[a,k]=Object(n.useState)(e.filename?e.filename:x),[M,P]=Object(n.useState)(e.filename?e.code:O),[R,A]=Object(n.useState)("RAM: ???"),[N,I]=Object(n.useState)({theme:_.a.MonacoTheme,insertSpaces:_.a.MonacoInsertSpaces});function j(){if(null!==t.current){const e=t.current.getPosition();null!==e&&E.a.saveCursor(a,{row:e.lineNumber,column:e.column})}if(T=null,w.a.isRunning&&w.a.currStep===w.f.TerminalTypeScript){if("n00dles.script"!==a)return void Object(m.a)("Leave the script name as 'n00dles'!");if(-1==M.replace(/\s/g,"").indexOf("while(true){hack('n00dles');}"))return void Object(m.a)("Please copy and paste the code from the tutorial!");const t=e.player.getCurrentServer();if(null===t)throw new Error("Server should not be null but it is.");let n=!1;for(let r=0;r0)){switch(a){case y.a.ImportError:A("RAM: Import Error");break;case y.a.URLImportError:A("RAM: HTTP Import Error");break;case y.a.SyntaxError:default:A("RAM: Syntax Error")}return new Promise(()=>{})}A("RAM: "+b.a.formatRAM(a))}return Object(n.useEffect)(()=>{void 0!==e.filename&&(x=e.filename,O=e.code,T=null)},[]),Object(n.useEffect)(()=>{const e=setInterval(F,1e3);return()=>clearInterval(e)},[M]),Object(n.useEffect)(()=>{function e(e){_.a.DisableHotkeys||66==e.keyCode&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),j())}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{id:"script-editor-filename-wrapper"},r.a.createElement("p",{id:"script-editor-filename-tag",className:"noselect"}," ",r.a.createElement("strong",{style:{backgroundColor:"#555"}},"Script name: ")),r.a.createElement("input",{id:"script-editor-filename",type:"text",maxLength:100,tabIndex:1,value:a,onChange:function(e){x=a,k(e.target.value)}}),r.a.createElement(i.a,{text:"options",onClick:function(){const e="script-editor-options-popup",t={theme:"",insertSpaces:!1};Object.assign(t,N),Object(s.a)(e,l.a,{id:e,options:t,save:e=>{I(e),_.a.MonacoTheme=e.theme,_.a.MonacoInsertSpaces=e.insertSpaces}})}})),r.a.createElement(o.a,{beforeMount:function(e){e.languages.registerCompletionItemProvider("javascript",{provideCompletionItems:()=>{const t=[];for(const a of S)t.push({label:a,kind:e.languages.CompletionItemKind.Function,insertText:a,insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet});return{suggestions:t}}}),e.languages.typescript.javascriptDefaults.addExtraLib(v.a,"netscript.d.ts"),e.languages.typescript.typescriptDefaults.addExtraLib(v.a,"netscript.d.ts"),C=!0},onMount:function(e){if(t.current=e,null===t.current)return;const n=E.a.getCursor(a);-1!==n.row?t.current.setPosition({lineNumber:n.row,column:n.column}):null!==T&&t.current.setPosition({lineNumber:T.lineNumber,column:T.column+1}),t.current.focus()},loading:r.a.createElement("p",null,"Loading script editor!"),height:"90%",defaultLanguage:"javascript",defaultValue:M,onChange:function(e){void 0!==e&&(O=e,null!==t.current&&(T=t.current.getPosition()),P(e))},theme:N.theme,options:N}),r.a.createElement("div",{id:"script-editor-buttons-wrapper"},r.a.createElement(i.a,{text:"Beautify",onClick:function(){if(null===t.current)return;const e=Object(c.js_beautify)(M,{indent_with_tabs:!N.insertSpaces,indent_size:4,brace_style:"preserve-inline"});t.current.setValue(e)}}),r.a.createElement("p",{id:"script-editor-status-text",style:{display:"inline-block",margin:"10px"}},R),r.a.createElement("button",{className:"std-button",style:{display:"inline-block"},onClick:j},"Save & Close (Ctrl/Cmd + b)"),r.a.createElement("a",{className:"std-button",style:{display:"inline-block"},target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/index.html"},"Netscript Documentation")))}},,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(26),o=a(22);function s(e){const[t,a]=Object(n.useState)(e.options.theme),[s,l]=Object(n.useState)(e.options.insertSpaces);return r.a.createElement("div",{className:"editor-options-container noselect"},r.a.createElement("div",{className:"editor-options-line"},r.a.createElement("p",null,"Theme: "),r.a.createElement("select",{className:"dropdown",onChange:e=>a(e.target.value),defaultValue:t},r.a.createElement("option",{value:"vs-dark"},"vs-dark"),r.a.createElement("option",{value:"light"},"light"))),r.a.createElement("div",{className:"editor-options-line"},r.a.createElement("p",null,"Use whitespace over tabs: "),r.a.createElement("input",{type:"checkbox",onChange:e=>l(e.target.checked),checked:s})),r.a.createElement("br",null),r.a.createElement(i.a,{style:{width:"50px"},text:"Save",onClick:function(){e.save({theme:t,insertSpaces:s}),Object(o.b)(e.id)}}))}},,function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(501),r=a(190),i=a(167),o=a(67),s=a(20);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class c{constructor(e=""){l(this,"task","Unassigned"),l(this,"earnedRespect",0),l(this,"hack",1),l(this,"str",1),l(this,"def",1),l(this,"dex",1),l(this,"agi",1),l(this,"cha",1),l(this,"hack_exp",0),l(this,"str_exp",0),l(this,"def_exp",0),l(this,"dex_exp",0),l(this,"agi_exp",0),l(this,"cha_exp",0),l(this,"hack_mult",1),l(this,"str_mult",1),l(this,"def_mult",1),l(this,"dex_mult",1),l(this,"agi_mult",1),l(this,"cha_mult",1),l(this,"hack_asc_points",0),l(this,"str_asc_points",0),l(this,"def_asc_points",0),l(this,"dex_asc_points",0),l(this,"agi_asc_points",0),l(this,"cha_asc_points",0),l(this,"upgrades",[]),l(this,"augmentations",[]),this.name=e}calculateSkill(e,t=1){return Math.max(Math.floor(t*(32*Math.log(e+534.5)-200)),1)}calculateAscensionMult(e){return Math.max(Math.pow(e/4e3,.7),1)}updateSkillLevels(){this.hack=this.calculateSkill(this.hack_exp,this.hack_mult*this.calculateAscensionMult(this.hack_asc_points)),this.str=this.calculateSkill(this.str_exp,this.str_mult*this.calculateAscensionMult(this.str_asc_points)),this.def=this.calculateSkill(this.def_exp,this.def_mult*this.calculateAscensionMult(this.def_asc_points)),this.dex=this.calculateSkill(this.dex_exp,this.dex_mult*this.calculateAscensionMult(this.dex_asc_points)),this.agi=this.calculateSkill(this.agi_exp,this.agi_mult*this.calculateAscensionMult(this.agi_asc_points)),this.cha=this.calculateSkill(this.cha_exp,this.cha_mult*this.calculateAscensionMult(this.cha_asc_points))}calculatePower(){return(this.hack+this.str+this.def+this.dex+this.agi+this.cha)/95}assignToTask(e){return r.a.hasOwnProperty(e)?(this.task=e,!0):(this.task="Unassigned",!1)}unassignFromTask(){this.task="Unassigned"}getTask(){return this.task instanceof n.a&&(this.task=this.task.name),r.a.hasOwnProperty(this.task)?r.a[this.task]:r.a.Unassigned}calculateRespectGain(e){const t=this.getTask();if(0===t.baseRespect)return 0;let a=t.hackWeight/100*this.hack+t.strWeight/100*this.str+t.defWeight/100*this.def+t.dexWeight/100*this.dex+t.agiWeight/100*this.agi+t.chaWeight/100*this.cha;if(a-=4*t.difficulty,a<=0)return 0;const n=Math.max(.005,Math.pow(100*o.a[e.facName].territory,t.territory.respect)/100);if(isNaN(n)||n<=0)return 0;const r=e.getWantedPenalty();return 11*t.baseRespect*a*n*r}calculateWantedLevelGain(e){const t=this.getTask();if(0===t.baseWanted)return 0;let a=t.hackWeight/100*this.hack+t.strWeight/100*this.str+t.defWeight/100*this.def+t.dexWeight/100*this.dex+t.agiWeight/100*this.agi+t.chaWeight/100*this.cha;if(a-=3.5*t.difficulty,a<=0)return 0;const n=Math.max(.005,Math.pow(100*o.a[e.facName].territory,t.territory.wanted)/100);if(isNaN(n)||n<=0)return 0;if(t.baseWanted<0)return.4*t.baseWanted*a*n;const r=7*t.baseWanted/Math.pow(3*a*n,.8);return Math.min(100,r)}calculateMoneyGain(e){const t=this.getTask();if(0===t.baseMoney)return 0;let a=t.hackWeight/100*this.hack+t.strWeight/100*this.str+t.defWeight/100*this.def+t.dexWeight/100*this.dex+t.agiWeight/100*this.agi+t.chaWeight/100*this.cha;if(a-=3.2*t.difficulty,a<=0)return 0;const n=Math.max(.005,Math.pow(100*o.a[e.facName].territory,t.territory.money)/100);if(isNaN(n)||n<=0)return 0;const r=e.getWantedPenalty();return 5*t.baseMoney*a*n*r}expMult(){return{hack:(this.hack_mult-1)/4+1,str:(this.str_mult-1)/4+1,def:(this.def_mult-1)/4+1,dex:(this.dex_mult-1)/4+1,agi:(this.agi_mult-1)/4+1,cha:(this.cha_mult-1)/4+1}}gainExperience(e=1){const t=this.getTask();if(t===r.a.Unassigned)return;const a=Math.pow(t.difficulty,.9)*e,n=this.expMult();this.hack_exp+=t.hackWeight/1500*a*n.hack,this.str_exp+=t.strWeight/1500*a*n.str,this.def_exp+=t.defWeight/1500*a*n.def,this.dex_exp+=t.dexWeight/1500*a*n.dex,this.agi_exp+=t.agiWeight/1500*a*n.agi,this.cha_exp+=t.chaWeight/1500*a*n.cha}recordEarnedRespect(e=1,t){this.earnedRespect+=this.calculateRespectGain(t)*e}getGainedAscensionPoints(){return{hack:Math.max(this.hack_exp-1e3,0),str:Math.max(this.str_exp-1e3,0),def:Math.max(this.def_exp-1e3,0),dex:Math.max(this.dex_exp-1e3,0),agi:Math.max(this.agi_exp-1e3,0),cha:Math.max(this.cha_exp-1e3,0)}}canAscend(){const e=this.getGainedAscensionPoints();return e.hack>0||e.str>0||e.def>0||e.dex>0||e.agi>0||e.cha>0}getCurrentAscensionMults(){return{hack:this.calculateAscensionMult(this.hack_asc_points),str:this.calculateAscensionMult(this.str_asc_points),def:this.calculateAscensionMult(this.def_asc_points),dex:this.calculateAscensionMult(this.dex_asc_points),agi:this.calculateAscensionMult(this.agi_asc_points),cha:this.calculateAscensionMult(this.cha_asc_points)}}getAscensionMultsAfterAscend(){const e=this.getGainedAscensionPoints();return{hack:this.calculateAscensionMult(this.hack_asc_points+e.hack),str:this.calculateAscensionMult(this.str_asc_points+e.str),def:this.calculateAscensionMult(this.def_asc_points+e.def),dex:this.calculateAscensionMult(this.dex_asc_points+e.dex),agi:this.calculateAscensionMult(this.agi_asc_points+e.agi),cha:this.calculateAscensionMult(this.cha_asc_points+e.cha)}}getAscensionResults(){const e=this.getAscensionMultsAfterAscend(),t=this.getCurrentAscensionMults();return{hack:e.hack/t.hack,str:e.str/t.str,def:e.def/t.def,dex:e.dex/t.dex,agi:e.agi/t.agi,cha:e.cha/t.cha}}ascend(){const e=this.getAscensionResults(),t=this.getGainedAscensionPoints();this.hack_asc_points+=t.hack,this.str_asc_points+=t.str,this.def_asc_points+=t.def,this.dex_asc_points+=t.dex,this.agi_asc_points+=t.agi,this.cha_asc_points+=t.cha,this.upgrades.length=0,this.hack_mult=1,this.str_mult=1,this.def_mult=1,this.dex_mult=1,this.agi_mult=1,this.cha_mult=1;for(let e=0;eresolve(eval("import(urls[urls.length - 1].url)"))),script.dependencies=urls),loadedModule=await script.module;let ns=workerScript.env.vars;try{if(!loadedModule.main)throw Object(_NetscriptEvaluator__WEBPACK_IMPORTED_MODULE_0__.b)(workerScript,script.filename+" cannot be run because it does not have a main function.");return loadedModule.main(ns)}finally{if(null!=urls)for(const e in urls)URL.revokeObjectURL(e.url)}}function shouldCompile(e,t){return""===e.module||e.dependencies.some(a=>{const n=t.find(e=>e.filename==a.filename);if(!n)return!0;return n.moduleSequenceNumber>e.moduleSequenceNumber})}function _getScriptUrls(e,t,a){const n=[];a.push(e);try{let r=e.code.replace(/((?:from|import)\s+(?:'|"))(?:\.\/)?([^'"]+)('|")/g,(e,r,i,o)=>{if(!t.some(e=>e.filename==i))return e;const[s]=t.filter(e=>e.filename==i),l=_getScriptUrls(s,t,a);return n.push(...l),[r,l[l.length-1].url,o].join("")});return r+='\n\nfunction print() {throw new Error("Invalid call to window.print(). Did you mean to use Netscript\'s print()?");}',n.push(new _Script_ScriptUrl__WEBPACK_IMPORTED_MODULE_1__.a(e.filename,URL.createObjectURL(makeScriptBlob(r)))),n}catch(e){for(const e in n)URL.revokeObjectURL(e);throw e}finally{a.pop()}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));class n{constructor(e,t){this.filename=e,this.url=t}}},function(e,t,a){"use strict";function n(e){return e.constructor===Array&&e.every(e=>e.constructor===Array)}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(620),r=a(0),i=a(9),o=a(92);function s(e){const t=function(e,t){let a=-1;for(let n=0;n{if(n<=t+1)return r.createElement(i.a,{key:n},"[",a.fulfilled(e.player)?"x":" ","] ",a.title)});return r.createElement(r.Fragment,null,r.createElement(i.a,{variant:"h4"},"Milestones"),r.createElement(o.a,{mx:2},r.createElement(i.a,null,"Milestones don't reward you for completing them. They are here to guide you if you're lost. They will reset when you install Augmentations."),r.createElement("br",null),r.createElement(i.a,null,"Completing fl1ght.exe"),a))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a(0),r=a.n(n),i=a(9),o=a(370),s=a(63),l=a(149),c=a(142),u=a(277),m=a(92),h=a(267),p=a(1053),d=a(268);function f({terminal:e}){return r.a.createElement(i.a,{color:"primary",paragraph:!1},e.getProgressText())}const g=Object(c.a)(e=>Object(u.a)({nopadding:{padding:e.spacing(0)},preformatted:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",margin:e.spacing(0)},list:{padding:e.spacing(0),height:"100%"}}));function y({terminal:e,router:t,player:a}){const c=Object(n.useRef)(null),u=Object(n.useState)(0)[1],[y,b]=Object(n.useState)(0);function E(){u(e=>e+1)}function v(){b(e=>e+1)}function k(){const e=c.current;null!==e&&setTimeout(()=>e.scrollIntoView(!0),50)}Object(n.useEffect)(()=>d.b.subscribe(E),[]),Object(n.useEffect)(()=>d.a.subscribe(v),[]),k(),Object(n.useEffect)(()=>{setTimeout(k,50)},[]);const _=g();return r.a.createElement(r.a.Fragment,null,r.a.createElement(m.a,{width:"100%",minHeight:"100vh",display:"flex",alignItems:"flex-end"},r.a.createElement(o.a,{key:y,id:"terminal",classes:{root:_.list}},e.outputHistory.map((t,n)=>t instanceof h.b?r.a.createElement(s.a,{key:n,classes:{root:_.nopadding}},r.a.createElement(i.a,{classes:{root:_.preformatted},color:t.color,paragraph:!1},t.text)):t instanceof h.a?r.a.createElement(s.a,{key:n,classes:{root:_.nopadding}},r.a.createElement(i.a,null,t.dashes,"> "),r.a.createElement(l.a,{classes:{root:_.preformatted},color:"secondary",paragraph:!1,onClick:()=>e.connectToServer(a,t.hostname)},t.hostname)):void 0),null!==e.action&&r.a.createElement(s.a,{classes:{root:_.nopadding}},r.a.createElement(f,{terminal:e})," ")),r.a.createElement("div",{ref:c})),r.a.createElement(m.a,{position:"sticky",bottom:0,width:"100%",px:0},r.a.createElement(p.a,{player:a,router:t,terminal:e})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a.n(n),i=a(9),o=a(142),s=a(277),l=a(329),c=a(221),u=a(79),m=a(1054),h=a(1056),p=a(18);const d=Object(o.a)(e=>Object(s.a)({textfield:{margin:e.spacing(0),width:"100%"},input:{backgroundColor:"#000"},nopadding:{padding:e.spacing(0)},preformatted:{whiteSpace:"pre-wrap",margin:e.spacing(0)},list:{padding:e.spacing(0),height:"100%"}}));let f="";function g({terminal:e,router:t,player:a}){const o=Object(n.useRef)(null),[s,g]=Object(n.useState)(f),[y,b]=Object(n.useState)([]),E=d();function v(e){f=e,g(e)}function k(e){const t=o.current;if(!t)return;const a=s.length,n=t.selectionStart;if(null!==n)switch(e.toLowerCase()){case"home":t.setSelectionRange(0,0);break;case"end":t.setSelectionRange(a,a);break;case"prevchar":n>0&&t.setSelectionRange(n-1,n-1);break;case"prevword":for(let e=n-2;e>=0;--e)if(" "===t.value.charAt(e))return void t.setSelectionRange(e+1,e+1);t.setSelectionRange(0,0);break;case"nextchar":t.setSelectionRange(n+1,n+1);break;case"nextword":for(let e=n+1;e<=a;++e)if(" "===t.value.charAt(e))return void t.setSelectionRange(e,e);t.setSelectionRange(a,a);break;default:console.warn("Invalid loc argument in Terminal.moveTextCursor()")}}return Object(n.useEffect)(()=>{function n(n){if(e.contractOpen)return;if(null!==e.action&&n.keyCode===u.a.C&&n.ctrlKey)return void e.finishAction(t,a,!0);const r=o.current;n.ctrlKey||n.metaKey||n.keyCode===u.a.C&&(n.ctrlKey||n.metaKey)||r&&r.focus()}return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)}),r.a.createElement(r.a.Fragment,null,y.length>0&&r.a.createElement(c.a,{square:!0},r.a.createElement(i.a,{classes:{root:E.preformatted},color:"primary",paragraph:!1},"Possible autocomplete candidate:"),r.a.createElement(i.a,{classes:{root:E.preformatted},color:"primary",paragraph:!1},y.join(" "))),r.a.createElement(l.a,{variant:"standard",color:null===e.action?"primary":"secondary",autoFocus:!0,disabled:null!==e.action,autoComplete:"off",classes:{root:E.textfield},value:s,onChange:function(e){v(e.target.value),b([])},inputRef:o,InputProps:{id:"terminal-input",className:E.input,startAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(i.a,{color:null===e.action?"primary":"secondary",flexShrink:0},"[",a.getCurrentServer().hostname," ~",e.cwd(),"]> ")),spellCheck:!1,onKeyDown:function(n){if(n.keyCode===u.a.ENTER&&""!==s)return n.preventDefault(),e.print(`[${a.getCurrentServer().hostname} ~${e.cwd()}]> ${s}`),e.executeCommands(t,a,s),void v("");if(n.keyCode===u.a.TAB&&""!==s){n.preventDefault();let t=s;const r=t.lastIndexOf(";");-1!==r&&(t=t.slice(r+1)),t=t.trim(),t=t.replace(/\s\s+/g," ");const i=t.split(" ");let o=i.length-2;o<-1&&(o=0);const l=Object(m.a)(a,t,o,e.cwd());if(0==l.length)return;let c="",u="";if(0==i.length)return;1==i.length?u=i[0]:2==i.length?(u=i[0],c=i[1]):3==i.length?(u=i[0]+" "+i[1],c=i[2]):(c=i.pop()+"",u=i.join(" "));const p=Object(h.a)(u,c,l,s);"string"==typeof p&&""!==p&&v(p),Array.isArray(p)&&b(p)}if(n.keyCode===u.a.L&&n.ctrlKey&&(n.preventDefault(),e.clear()),n.keyCode===u.a.UPARROW||p.a.EnableBashHotkeys&&n.keyCode===u.a.P&&n.ctrlKey){p.a.EnableBashHotkeys&&n.preventDefault();const t=e.commandHistoryIndex,a=e.commandHistory.length;if(0==a)return;(t<0||t>a)&&(e.commandHistoryIndex=a),0!=t&&--e.commandHistoryIndex;v(e.commandHistory[e.commandHistoryIndex]);const r=o.current;r&&setTimeout((function(){r.selectionStart=r.selectionEnd=1e4}),10)}if(n.keyCode===u.a.DOWNARROW||p.a.EnableBashHotkeys&&n.keyCode===u.a.M&&n.ctrlKey){p.a.EnableBashHotkeys&&n.preventDefault();const t=e.commandHistoryIndex,a=e.commandHistory.length;if(0==a)return;if((t<0||t>a)&&(e.commandHistoryIndex=a),t==a||t==a-1)e.commandHistoryIndex=a,v("");else{++e.commandHistoryIndex;v(e.commandHistory[e.commandHistoryIndex])}}p.a.EnableBashHotkeys&&(n.keyCode===u.a.A&&n.ctrlKey&&(n.preventDefault(),k("home")),n.keyCode===u.a.E&&n.ctrlKey&&(n.preventDefault(),k("end")),n.keyCode===u.a.B&&n.ctrlKey&&(n.preventDefault(),k("prevchar")),n.keyCode===u.a.B&&n.altKey&&(n.preventDefault(),k("prevword")),n.keyCode===u.a.F&&n.ctrlKey&&(n.preventDefault(),k("nextchar")),n.keyCode===u.a.F&&n.altKey&&(n.preventDefault(),k("nextword")),n.keyCode!==u.a.H&&n.keyCode!==u.a.D||!n.ctrlKey||(!function(e){const t=o.current;if(!t)return;const a=s.length,n=t.selectionStart;if(null===n)return;const r=t.value;switch(e.toLowerCase()){case"backspace":n>0&&n<=a+1&&v(r.substr(0,n-1)+r.substr(n));break;case"deletewordbefore":for(let e=n-1;e>0;--e)if(" "===r.charAt(e))return void v(r.substr(0,e)+r.substr(n));break;case"deletewordafter":for(let e=n+1;e<=s.length+1;++e)if(" "===r.charAt(e))return void v(r.substr(0,n)+r.substr(e))}}("backspace"),n.preventDefault()))}}}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(98),r=a(1055),i=a(121),o=a(241),s=a(106),l=a(32);const c=["alias","analyze","backdoor","cat","cd","check","clear","cls","connect","download","expr","free","hack","help","home","hostname","ifconfig","kill","killall","ls","lscpu","mem","mv","nano","ps","rm","run","scan","scan-analyze","scp","sudov","tail","theme","top"];function u(e,t,a,u=""){let m=[];m=m.concat(Object.keys(i.b));const h=e.getCurrentServer(),p=e.getHomeComputer();let d="",f=null;function g(){for(const e of h.contracts)m.push(e.fn)}function y(){for(const e of h.messages)e instanceof s.a||m.push(e)}function b(){for(const e of p.programs)m.push(e)}function E(){for(const e of h.scripts){const t=_(e.filename);t&&m.push(t)}}function v(){for(const e of h.textFiles){const t=_(e.fn);t&&m.push(t)}}function k(){const e=Object(r.a)(h,null==f?"/":f);for(let t=0;t=0;--t)a[t].toLowerCase().startsWith(e.toLowerCase())||a.splice(t,1);else for(let e=a.length-1;e>=0;--e)a[e].toLowerCase().startsWith(t.toLowerCase())||a.splice(e,1);const i=r.lastIndexOf(";");let o="";if(0!==a.length){if(1===a.length)return o=""===t?a[0]+" ":e+" "+a[0],-1===i?o:r.slice(0,i+1)+" "+o;{const o=Object(n.e)(a);return""===t?o===e?a:-1===i?o:`${r.slice(0,i+1)} ${o}`:o===t?a:-1==i?`${e} ${o}`:`${r.slice(0,i+1)} ${e} ${o}`}}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(9),o=a(149),s=a(92);function l(){return r.a.createElement(r.a.Fragment,null,r.a.createElement(i.a,{variant:"h4"},"Tutorial (AKA Links to Documentation)"),r.a.createElement(s.a,{m:2},r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/guidesandtips/gettingstartedguideforbeginnerprogrammers.html"},r.a.createElement(i.a,null,"Getting Started")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/servers.html"},r.a.createElement(i.a,null,"Servers & Networking")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/hacking.html"},r.a.createElement(i.a,null,"Hacking")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/scripts.html"},r.a.createElement(i.a,null,"Scripts")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/netscript.html"},r.a.createElement(i.a,null,"Netscript Programming Language")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/world.html"},r.a.createElement(i.a,null,"Traveling")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/companies.html"},r.a.createElement(i.a,null,"Companies")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/infiltration.html"},r.a.createElement(i.a,null,"Infiltration")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/factions.html"},r.a.createElement(i.a,null,"Factions")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/augmentations.html"},r.a.createElement(i.a,null,"Augmentations")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/shortcuts.html"},r.a.createElement(i.a,null,"Keyboard Shortcuts"))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(1059),o=a(1060),s=a(9);function l(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(a,20);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement(s.a,null,"This page displays a list of all of your scripts that are currently running across every machine. It also provides information about each script's production. The scripts are categorized by the hostname of the servers on which they are running."),r.a.createElement(i.a,null),r.a.createElement(o.a,e))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a(15),i=a(138),o=a(47),s=a(9),l=a(142),c=a(277),u=a(330),m=a(278),h=a(52),p=a(78);const d=Object(l.a)(e=>Object(c.a)({cell:{borderBottom:"none",padding:e.spacing(1),margin:e.spacing(1),whiteSpace:"nowrap"},size:{width:"1px"}}));function f(){const e=o.b.Player(),t=d(),a=e.scriptProdSinceLastAug/(e.playtimeSinceLastAug/1e3);return n.createElement(u.a,{size:"small",classes:{root:t.size}},n.createElement(m.a,null,n.createElement(p.a,null,n.createElement(h.a,{component:"th",scope:"row",classes:{root:t.cell}},n.createElement(s.a,{variant:"body2"},"Total production:")),n.createElement(h.a,{align:"left",classes:{root:t.cell}},n.createElement(s.a,{variant:"body2"},n.createElement(r.a,{money:e.scriptProdSinceLastAug}))),n.createElement(h.a,{align:"left",classes:{root:t.cell}},n.createElement(s.a,{variant:"body2"},"(",n.createElement(i.a,{money:a}),")")))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a.n(n),i=a(1061),o=a(329),s=a(370),l=a(1182),c=a(238),u=a(38),m=a(18),h=a(519),p=a(1067),d=a.n(p);function f(e){const[t,a]=Object(n.useState)(""),[p,f]=Object(n.useState)(0),[g,y]=Object(n.useState)(m.a.ActiveScriptsServerPageSize),b=Object(n.useState)(!1)[1];const E={};for(const t of e.workerScripts.values()){const e=Object(u.b)(t.serverIp);if(null==e){console.warn("WorkerScript has invalid IP address: "+t.serverIp);continue}let a=E[e.hostname];void 0===a&&(E[e.hostname]={server:e,workerScripts:[]},a=E[e.hostname]),void 0!==a&&a.workerScripts.push(t)}const v=Object.values(E).filter(e=>e&&e.server.hostname.includes(t));function k(){b(e=>!e)}return Object(n.useEffect)(()=>c.a.subscribe(k)),r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{value:t,onChange:function(e){a(e.target.value),f(0)},color:"primary",autoFocus:!0,variant:"standard",InputProps:{startAdornment:r.a.createElement(d.a,null),spellCheck:!1}}),r.a.createElement(s.a,{dense:!0},v.slice(p*g,p*g+g).map(e=>e&&r.a.createElement(i.a,{key:e.server.hostname,server:e.server,workerScripts:e.workerScripts}))),r.a.createElement(l.a,{rowsPerPageOptions:[10,15,20,100],component:"div",count:v.length,rowsPerPage:g,page:p,onPageChange:(e,t)=>{f(t)},onRowsPerPageChange:e=>{m.a.ActiveScriptsServerPageSize=parseInt(e.target.value,10),y(parseInt(e.target.value,10)),f(0)},ActionsComponent:h.a}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a(9),i=a(1181),o=a(103),s=a(221),l=a(92),c=a(328),u=a(75),m=a.n(u),h=a(287),p=a.n(h),d=a(1062),f=a(143);function g(e){const[t,a]=n.useState(!1),u=e.server,h=`${u.hostname}${" ".repeat(18)}`.slice(0,Math.max(u.hostname.length,18)),g={progress:u.ramUsed/u.maxRam,totalTicks:30},y=`${h} ${Object(f.a)(g)}`;return n.createElement(l.a,{component:s.a},n.createElement(i.a,{onClick:()=>a(e=>!e)},n.createElement(o.a,{primary:n.createElement(r.a,{style:{whiteSpace:"pre-wrap"}},y)}),t?n.createElement(p.a,{color:"primary"}):n.createElement(m.a,{color:"primary"})),n.createElement(l.a,{mx:2},n.createElement(c.a,{in:t,timeout:0,unmountOnExit:!0},n.createElement(d.a,{workerScripts:e.workerScripts}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(1063),o=a(370),s=a(1182),l=a(519),c=a(18);function u(e){const[t,a]=Object(n.useState)(0),[u,m]=Object(n.useState)(c.a.ActiveScriptsScriptPageSize);return r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{dense:!0,disablePadding:!0},e.workerScripts.slice(t*u,t*u+u).map(e=>r.a.createElement(i.a,{key:`${e.name}_${e.args}`,workerScript:e}))),r.a.createElement(s.a,{rowsPerPageOptions:[10,15,20,100],component:"div",count:e.workerScripts.length,rowsPerPage:u,page:t,onPageChange:(e,t)=>{a(t)},onRowsPerPageChange:e=>{c.a.ActiveScriptsScriptPageSize=parseInt(e.target.value,10),m(parseInt(e.target.value,10)),a(0)},ActionsComponent:l.a}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return A}));var n=a(0),r=a(3),i=a(330),o=a(52),s=a(78),l=a(278),c=a(37),u=a(92),m=a(221),h=a(9),p=a(116),d=a(1064),f=a.n(d),g=a(1181),y=a(103),b=a(142),E=a(328),v=a(287),k=a.n(v),_=a(75),w=a.n(_),C=a(113),S=a(11),x=a(262),O=a(14),T=a(230),M=a(15),P=a(138);const R=Object(b.a)({noborder:{borderBottom:"none"}});function A(e){const t=R(),[a,d]=n.useState(!1),b=e.workerScript.scriptRef,v=x.a.bind(null,b),_=C.a.bind(null,b,b.server);const A=b.onlineMoneyMade/b.onlineRunningTime,N=b.onlineExpGained/b.onlineRunningTime;return n.createElement(n.Fragment,null,n.createElement(g.a,{onClick:()=>d(e=>!e),component:m.a},n.createElement(y.a,{primary:n.createElement(h.a,null,"└ ",e.workerScript.name)}),a?n.createElement(k.a,{color:"primary"}):n.createElement(w.a,{color:"primary"})),n.createElement(E.a,{in:a,timeout:0,unmountOnExit:!0},n.createElement(u.a,{mx:6},n.createElement(i.a,{padding:"none",size:"small"},n.createElement(l.a,null,n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Threads:")),n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,r.a.formatThreads(e.workerScript.scriptRef.threads)))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder,colSpan:2},n.createElement(h.a,null,"└ Args: ",Object(T.a)(e.workerScript.args)))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Online Time:")),n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,Object(O.b)(1e3*b.onlineRunningTime)))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Offline Time:")),n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,Object(O.b)(1e3*b.offlineRunningTime)))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Total online production:")),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null,n.createElement(M.a,{money:b.onlineMoneyMade})))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder,colSpan:1}),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null," ",r.a.formatExp(b.onlineExpGained)+" hacking exp"))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Online production rate:")),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null,n.createElement(P.a,{money:A})))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder,colSpan:1}),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null," ",r.a.formatExp(N)+" hacking exp / sec"))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Total offline production:")),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null,n.createElement(M.a,{money:b.offlineMoneyMade})))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder,colSpan:1}),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null," ",r.a.formatExp(b.offlineExpGained)+" hacking exp"))))),n.createElement(c.a,{onClick:v},n.createElement(h.a,null,"LOG")),n.createElement(p.a,{onClick:function(){_(),Object(S.a)("Killing script")}},n.createElement(f.a,{color:"error"})))))}},,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(24),o=a(97),s=a(9),l=a(92),c=a(149),u=a(37),m=a(278),h=a(77),p=a(78);function d(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(a,1e3);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement(s.a,{variant:"h5",color:"primary"},"Factions"),r.a.createElement(s.a,null,"Lists all factions you have joined"),r.a.createElement("br",null),r.a.createElement(l.a,{display:"flex",flexDirection:"column"},e.player.factions.map(t=>r.a.createElement(c.a,{key:t,variant:"h6",onClick:()=>function(t){e.router.toFaction(t)}(i.a[t])},t))),r.a.createElement("br",null),e.player.factionInvitations.length>0&&r.a.createElement(r.a.Fragment,null,r.a.createElement(s.a,{variant:"h5",color:"primary"},"Outstanding Faction Invitations"),r.a.createElement(s.a,null,"Lists factions you have been invited to. You can accept these faction invitations at any time."),r.a.createElement(h.a,{size:"small",padding:"none"},r.a.createElement(m.a,null,e.player.factionInvitations.map(e=>r.a.createElement(p.a,{key:e},r.a.createElement(h.b,null,r.a.createElement(s.a,{noWrap:!0},e)),r.a.createElement(h.b,{align:"right"},r.a.createElement(u.a,{onClick:a=>function(e,a){e.isTrusted&&(Object(o.d)(i.a[a]),t(e=>!e))}(a,e)},"Join!"))))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(97);function o(e){return Object(n.useEffect)(()=>Object(i.g)(e.faction)),r.a.createElement("div",{id:"mission-container"})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n=a(0),r=a.n(n),i=a(1071),o=a(1075),s=a(1076),l=a(325),c=a(4),u=a(7),m=a(289),h=a(53),p=a(22),d=a(47),f=a(1082),g=a(9),y=a(37);const b=["Slum Snakes","Tetrads","The Syndicate","The Dark Army","Speakers for the Dead","NiteSec","The Black Hand"];function E(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(a,1e3);return()=>clearInterval(e)},[]);const E=e.faction,v=d.b.Player(),k=d.b.Router(),[_,w]=Object(n.useState)(!1);function C(){w(!0)}function S(){Object(m.d)(v)}return _?r.a.createElement(i.a,{faction:E,routeToMainPage:function(){w(!1)}}):r.a.createElement((function({faction:e}){const t=v,n=e.getInfo(),i=t.inGang()&&t.getGangName()===e.name,m=Math.floor(c.a.BaseFavorToDonate*u.a.RepToDonateToFaction),d=e.favor>=m,E="The Covenant"===e.name&&t.bitNodeN>=10&&h.a[10];let _=t.canAccessGang()&&b.includes(e.name);return t.inGang()&&(t.getGangName()!==e.name?_=!1:t.getGangName()===e.name&&(_=!0)),r.a.createElement(r.a.Fragment,null,r.a.createElement(y.a,{onClick:()=>k.toFactions()},"Back"),r.a.createElement(g.a,{variant:"h4",color:"primary"},e.name),r.a.createElement(s.a,{faction:e,factionInfo:n}),_&&r.a.createElement(l.a,{buttonText:"Manage Gang",infoText:"Create and manage a gang for this Faction. Gangs will earn you money and faction reputation",onClick:()=>function(e){if(v.inGang())return k.toGang();Object(p.a)("create-gang-popup",f.a,{popupId:"create-gang-popup",facName:e.name,player:v,router:k})}(e)}),!i&&n.offerHackingMission&&r.a.createElement(l.a,{buttonText:"Hacking Mission",infoText:"Attempt a hacking mission for your faction. A mission is a mini game that, if won, earns you significant reputation with this faction. (Recommended hacking level: 200+)",onClick:()=>function(e){v.singularityStopWork(),k.toHackingMission(e)}(e)}),!i&&n.offerHackingWork&&r.a.createElement(l.a,{buttonText:"Hacking Contracts",infoText:"Complete hacking contracts for your faction. Your effectiveness, which determines how much reputation you gain for this faction, is based on your hacking skill. You will gain hacking exp.",onClick:()=>function(e){v.startFactionHackWork(k,e)}(e)}),!i&&n.offerFieldWork&&r.a.createElement(l.a,{buttonText:"Field Work",infoText:"Carry out field missions for your faction. Your effectiveness, which determines how much reputation you gain for this faction, is based on all of your stats. You will gain exp for all stats.",onClick:()=>function(e){v.startFactionFieldWork(k,e)}(e)}),!i&&n.offerSecurityWork&&r.a.createElement(l.a,{buttonText:"Security Work",infoText:"Serve in a security detail for your faction. Your effectiveness, which determines how much reputation you gain for this faction, is based on your combat stats. You will gain exp for all combat stats.",onClick:()=>function(e){v.startFactionSecurityWork(k,e)}(e)}),!i&&n.offersWork()&&r.a.createElement(o.a,{faction:e,p:v,rerender:a,favorToDonate:m,disabled:!d}),r.a.createElement(l.a,{buttonText:"Purchase Augmentations",infoText:"As your reputation with this faction rises, you will unlock Augmentations, which you can purchase to enhance your abilities.",onClick:C}),E&&r.a.createElement(l.a,{buttonText:"Purchase & Upgrade Duplicate Sleeves",infoText:"Purchase Duplicate Sleeves and upgrades. These are permanent!",onClick:S}))}),{faction:E})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a.n(n),i=a(1072),o=a(19),s=a(5),l=a(147),c=a(18),u=a(97),m=a(47),h=a(37),p=a(9),d=a(278),f=a(330);function g(e){const t=m.b.Player(),a=t.inGang()&&t.getGangName()===e.faction.name,g=Object(n.useState)(!1)[1];function y(){g(e=>!e)}function b(){if(a){const e=[];for(const t in o.a){o.a[t].isSpecial||e.push(t)}return e}return e.faction.augmentations.slice()}function E(e){c.a.PurchaseAugmentationsOrder=e,y()}const v=function(){switch(c.a.PurchaseAugmentationsOrder){case l.b.Cost:return function(){const e=b();return e.sort((e,t)=>{const a=o.a[e],n=o.a[t];if(null==a||null==n)throw new Error("Invalid Augmentation Names");return a.baseCost-n.baseCost}),e}();case l.b.Reputation:return function(){const e=b();return e.sort((e,t)=>{const a=o.a[e],n=o.a[t];if(null==a||null==n)throw new Error("Invalid Augmentation Names");return a.baseRepRequirement-n.baseRepRequirement}),e}();case l.b.Purchasable:return function(){const a=b();function n(a){const n=o.a[a],r=(n.baseCost,e.faction.getInfo().augmentationPriceMult,n.baseRepRequirement*e.faction.getInfo().augmentationRepRequirementMult),i=e.faction.playerReputation>=r,s=Object(u.b)(n);return 0!==n.baseCost&&t.money.gt(n.baseCost*e.faction.getInfo().augmentationPriceMult)&&i&&s}const r=a.filter(n).sort((e,t)=>{const a=o.a[e],n=o.a[t];if(null==a||null==n)throw new Error("Invalid Augmentation Names");return a.baseCost-n.baseCost}),i=a.filter(e=>!n(e)).sort((e,t)=>{const a=o.a[e],n=o.a[t];if(null==a||null==n)throw new Error("Invalid Augmentation Names");return a.baseRepRequirement-n.baseRepRequirement});return r.concat(i)}();default:return b()}}(),k=v.filter(e=>e===s.a.NeuroFluxGovernor||!t.augmentations.some(t=>t.name===e)&&!t.queuedAugmentations.some(t=>t.name===e)),_=(a,n=!1)=>r.a.createElement(i.a,{augName:a,faction:e.faction,key:a,p:t,rerender:y,owned:n}),w=k.map(e=>_(e));let C=r.a.createElement(r.a.Fragment,null);const S=v.filter(e=>!k.includes(e));return 0!==S.length&&(C=r.a.createElement(r.a.Fragment,null,r.a.createElement("br",null),r.a.createElement(p.a,{variant:"h4"},"Purchased Augmentations"),r.a.createElement(p.a,null,"This factions also offers these augmentations but you already own them."),S.map(e=>_(e,!0)))),r.a.createElement("div",null,r.a.createElement(h.a,{onClick:e.routeToMainPage},"Back"),r.a.createElement(p.a,{variant:"h4"},"Faction Augmentations"),r.a.createElement(p.a,null,"These are all of the Augmentations that are available to purchase from ",e.faction.name,". Augmentations are powerful upgrades that will enhance your abilities."),r.a.createElement(h.a,{onClick:()=>E(l.b.Cost)},"Sort by Cost"),r.a.createElement(h.a,{onClick:()=>E(l.b.Reputation)},"Sort by Reputation"),r.a.createElement(h.a,{onClick:()=>E(l.b.Default)},"Sort by Default Order"),r.a.createElement(h.a,{onClick:()=>E(l.b.Purchasable)},"Sort by Purchasable"),r.a.createElement("br",null),r.a.createElement(f.a,{size:"small",padding:"none"},r.a.createElement(d.a,null,w)),r.a.createElement(f.a,{size:"small",padding:"none"},r.a.createElement(d.a,null,C)))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return v}));var n=a(0),r=a(97),i=a(1073),o=a(19),s=a(5),l=a(18),c=a(15),u=a(81),m=a(22),h=a(1074),p=a(37),d=a(9),f=a(93),g=a(92),y=a(77),b=a(78);function E(e){const t=o.a[e.augName];if(!e.hasReq)return n.createElement(y.b,{key:1,colSpan:2},n.createElement(d.a,{color:"error"},"Requires"," ",t.prereqs.map((e,t)=>n.createElement(h.a,{key:t,name:e}))));e.hasRep&&e.hasCost;return n.createElement(n.Fragment,{key:"f"},n.createElement(y.b,{key:1},n.createElement(d.a,null,n.createElement(c.a,{money:e.cost,player:e.p}))),n.createElement(y.b,{key:2},n.createElement(d.a,{color:e.hasRep?"primary":"error"},"Requires ",Object(u.a)(e.rep)," faction reputation")))}function v(e){const t=o.a[e.augName];if(null==t)throw new Error(`aug ${e.augName} does not exists`);if(null==t)return console.error("Invalid Augmentation when trying to create PurchaseableAugmentation display element: "+e.augName),n.createElement(n.Fragment,null);const a=t.baseCost*e.faction.getInfo().augmentationPriceMult,c=t.baseRepRequirement*e.faction.getInfo().augmentationRepRequirementMult,u=Object(r.b)(t),h=e.faction.playerReputation>=c,v=0===t.baseCost||e.p.money.gt(t.baseCost*e.faction.getInfo().augmentationPriceMult),k=u&&h&&v?"primary":"error";let _=t.name;t.name===s.a.NeuroFluxGovernor&&(_+=" - Level "+Object(r.a)());let w=n.createElement(n.Fragment,null);return w="string"==typeof t.info?n.createElement(n.Fragment,null,n.createElement("span",null,t.info),n.createElement("br",null),n.createElement("br",null),t.stats):n.createElement(n.Fragment,null,t.info,n.createElement("br",null),n.createElement("br",null),t.stats),n.createElement(b.a,null,!e.owned&&n.createElement(y.b,{key:0},n.createElement(p.a,{onClick:function(){if("error"!==k)if(l.a.SuppressBuyAugmentationConfirmation)Object(r.f)(t,e.faction),e.rerender();else{const a="purchase-augmentation-popup";Object(m.a)(a,i.a,{aug:t,faction:e.faction,player:e.p,rerender:e.rerender,popupId:a})}},color:k},"Buy")),n.createElement(y.b,{key:1},n.createElement(g.a,{display:"flex"},n.createElement(f.a,{title:n.createElement(d.a,null,w),placement:"top",disableFocusListener:!0,disableTouchListener:!0,enterNextDelay:1e3,enterDelay:500,leaveDelay:0,leaveTouchDelay:0},n.createElement(d.a,null,_)))),!e.owned&&n.createElement(E,{key:2,augName:e.augName,p:e.p,cost:a,rep:c,hasReq:u,hasRep:h,hasCost:v}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(97),o=a(133),s=a(15),l=a(22);function c(e){const t=e.faction.getInfo();return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",null,e.aug.name),r.a.createElement("br",null),e.aug.info,r.a.createElement("br",null),r.a.createElement("br",null),e.aug.stats,r.a.createElement("br",null),r.a.createElement("br",null),"Would you like to purchase the ",e.aug.name," Augmentation for ",r.a.createElement(s.a,{money:e.aug.baseCost*t.augmentationPriceMult}),"?",r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("button",{autoFocus:!0,className:"std-button",onClick:function(){!Object(o.e)(e.aug)&&e.player.hasAugmentation(e.aug)||(Object(i.f)(e.aug,e.faction),e.rerender(),Object(l.b)(e.popupId))}},"Purchase"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(0);function r({name:e}){return n.createElement("span",{className:"samefont",style:{color:"white"}},e)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a(0),r=a.n(n),i=a(4),o=a(628),s=a(317),l=a(15),c=a(81),u=a(3),m=a(11),h=a(208),p=a(9),d=a(221),f=a(37),g=a(329);function y(e){const[t,a]=Object(n.useState)(null),y=(i.a.DonateMoneyToRepDivisor+"").length-1;function b(){return null!==t&&(!(isNaN(t)||t<=0)&&!e.p.money.lt(t))}return r.a.createElement(d.a,{sx:{my:1,p:1,width:"100%"}},r.a.createElement((function(){return null===t?r.a.createElement(r.a.Fragment,null):b()?r.a.createElement(p.a,null,"This donation will result in ",Object(c.a)(Object(o.a)(t,e.p))," reputation gain"):e.p.money.lt(t)?r.a.createElement(p.a,null,"Insufficient funds"):r.a.createElement(p.a,null,"Invalid donate amount entered!")}),null),e.disabled?r.a.createElement(p.a,null,"Unlock donations at ",Object(s.a)(e.favorToDonate)," favor with ",e.faction.name):r.a.createElement(r.a.Fragment,null,r.a.createElement(g.a,{variant:"standard",onChange:function(e){const t=u.a.parseMoney(e.target.value);""===e.target.value||isNaN(t)?a(null):a(t)},placeholder:"Donation amount",disabled:e.disabled,InputProps:{endAdornment:r.a.createElement(f.a,{onClick:function(){const a=e.faction,n=t;if(null===n)return;if(!b())return;e.p.loseMoney(n);const i=Object(o.a)(n,e.p);e.faction.playerReputation+=i,Object(m.a)(r.a.createElement(r.a.Fragment,null,"You just donated ",r.a.createElement(l.a,{money:n})," to ",a.name," to gain ",Object(c.a)(i)," reputation.")),e.rerender()},disabled:e.disabled||!b()},"donate")}}),r.a.createElement(p.a,null,r.a.createElement(h.a,{tex:String.raw`reputation = \frac{\text{donation amount} \times \text{reputation multiplier}}{10^{${y}}}`}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a(81),i=a(317),o=a(208),s=a(142),l=a(277),c=a(9),u=a(93),m=a(92);const h=Object(s.a)(e=>Object(l.a)({noformat:{whiteSpace:"pre-wrap"}}));function p(e){const t=h(),a=e.faction.getFavorGain()[0];return n.createElement(n.Fragment,null,n.createElement(c.a,{classes:{root:t.noformat}},e.factionInfo.infoText),n.createElement(c.a,null,"-------------------------"),n.createElement(m.a,{display:"flex"},n.createElement(u.a,{title:n.createElement(n.Fragment,null,n.createElement(c.a,null,"You will have ",Object(i.a)(e.faction.favor+a)," faction favor after installing an Augmentation."),n.createElement(o.a,{tex:String.raw`\large{r = \text{total faction reputation}}`}),n.createElement(o.a,{tex:String.raw`\large{favor=\left\lfloor\log_{1.02}\left(\frac{r+25000}{25500}\right)\right\rfloor}`}))},n.createElement(c.a,null,"Reputation: ",Object(r.a)(e.faction.playerReputation)))),n.createElement(c.a,null,"-------------------------"),n.createElement(m.a,{display:"flex"},n.createElement(u.a,{title:n.createElement(n.Fragment,null,n.createElement(c.a,null,"Faction favor increases the rate at which you earn reputation for this faction by 1% per favor. Faction favor is gained whenever you install an Augmentation. The amount of favor you gain depends on the total amount of reputation you earned with this faction. Across all resets."),n.createElement(o.a,{tex:String.raw`\large{r = reputation}`}),n.createElement(o.a,{tex:String.raw`\large{\Delta r = \Delta r \times \frac{100+favor}{100}}`}))},n.createElement(c.a,null,"Faction Favor: ",Object(i.a)(e.faction.favor)))),n.createElement(c.a,null,"-------------------------"),n.createElement(c.a,null,"Perform work/carry out assignments for your faction to help further its cause! By doing so you will earn reputation for your faction. You will also gain reputation passively over time, although at a very slow rate. Earning reputation will allow you to purchase Augmentations through this faction, which are powerful upgrades that enhance your abilities."))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(1078),o=a(266),s=a(289),l=a(1080),c=a(26),u=a(15),m=a(11);function h(){return(h=Object.assign||function(e){for(var t=1;t=s.b&&(f=!0);const g=[];for(let t=0;t=s.b||(e.p.canAfford(p())?(e.p.loseMoney(p()),e.p.sleevesFromCovenant+=1,e.p.sleeves.push(new o.a(e.p)),d()):Object(m.a)("You cannot afford to purchase a Duplicate Sleeve",!1))},text:"Purchase"})),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",null,"Here, you can also purchase upgrades for your Duplicate Sleeves. These upgrades are also permanent, meaning they persist across BitNodes."),g)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(1079);class i extends n.Component{render(){return n.createElement("div",{className:"bladeburner-action"},n.createElement("h1",null,"Duplicate Sleeve ",this.props.index),n.createElement(r.a,this.props))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a(3),i=a(26),o=a(15);class s extends n.Component{constructor(e){super(e),this.state={amt:1},this.changePurchaseAmount=this.changePurchaseAmount.bind(this),this.purchaseMemory=this.purchaseMemory.bind(this)}changePurchaseAmount(e){let t=parseInt(e.target.value);isNaN(t)&&(t=1);const a=100-this.props.sleeve.memory;t>a&&(t=a),this.setState({amt:t})}getPurchaseCost(){if(isNaN(this.state.amt))return 1/0;const e=100-this.props.sleeve.memory;return this.state.amt>e?1/0:this.props.sleeve.getMemoryUpgradeCost(this.state.amt)}purchaseMemory(){const e=this.getPurchaseCost();this.props.p.canAfford(e)&&(this.props.sleeve.upgradeMemory(this.state.amt),this.props.p.loseMoney(e),this.props.rerender())}render(){const e=`sleeve-${this.props.index}-memory-upgrade-input`,t=100-this.props.sleeve.memory,a=this.getPurchaseCost(),s=!this.props.p.canAfford(a);let l;return l=isNaN(this.state.amt)?n.createElement(n.Fragment,null,"Invalid value"):this.state.amt>t?n.createElement(n.Fragment,null,"Memory cannot exceed 100"):n.createElement(n.Fragment,null,"Purchase ",this.state.amt," memory - ",n.createElement(o.a,{money:a,player:this.props.p}),"?"),n.createElement("div",null,n.createElement("h2",null,n.createElement("u",null,"Upgrade Memory")),n.createElement("p",null,"Purchase a memory upgrade for your sleeve. Note that a sleeve's max memory is 100 (current:"," ",r.a.formatSleeveMemory(this.props.sleeve.memory),")"),n.createElement("label",{htmlFor:e},"Amount of memory to purchase (must be an integer):"),n.createElement("input",{className:"text-input",id:e,onChange:this.changePurchaseAmount,type:"number",value:this.state.amt}),n.createElement("br",null),n.createElement(i.a,{disabled:s,onClick:this.purchaseMemory,text:l}))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a(76),i=a(376),o=a(1081);class s extends o.a{constructor(e){super(e),this.closePopup=this.closePopup.bind(this)}closePopup(){let e;this.props.onClose&&this.props.onClose(),e="string"==typeof this.props.popup?document.getElementById(this.props.popup):this.props.popup,e instanceof HTMLElement&&(r.unmountComponentAtNode(e),Object(i.a)(e))}render(){const e=this.props.class?this.props.class:"std-button";return n.createElement("button",{className:e,onClick:this.closePopup,style:this.props.style},this.props.text)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a(76),i=a(79),o=a(376);class s extends n.Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.keyListener=this.keyListener.bind(this)}componentDidMount(){document.addEventListener("keydown",this.keyListener)}componentWillUnmount(){document.removeEventListener("keydown",this.keyListener)}handleClick(){let e;this.props.onClose&&this.props.onClose(),e="string"==typeof this.props.popup?document.getElementById(this.props.popup):this.props.popup,e instanceof HTMLElement&&(r.unmountComponentAtNode(e),Object(o.a)(e))}keyListener(e){e.keyCode===i.a.ESC&&this.handleClick()}render(){const e=this.props.class?this.props.class:"std-button";return n.createElement("button",{className:e,onClick:this.handleClick,style:this.props.style},this.props.text)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(22),o=a(26);function s(e){const t=e.player,a=e.router;function n(){return["NiteSec","The Black Hand"].includes(e.facName)}function s(){t.startGang(e.facName,n()),Object(i.b)(e.popupId),a.toGang()}return r.a.createElement(r.a.Fragment,null,"Would you like to create a new Gang with ",e.facName,"?",r.a.createElement("br",null),r.a.createElement("br",null),"Note that this will prevent you from creating a Gang with any other Faction until this BitNode is destroyed. It also resets your reputation with this faction.",r.a.createElement("br",null),r.a.createElement("br",null),n()?"This is a HACKING gang. Members in this gang will have different tasks than COMBAT gangs. Compared to combat gangs, progression with hacking gangs is more straightforward as territory warfare is not as important.":"This is a COMBAT gang. Members in this gang will have different tasks than HACKING gangs. Compared to hacking gangs, progression with combat gangs can be more difficult as territory management is more important. However, well-managed combat gangs can progress faster than hacking ones.",r.a.createElement("br",null),r.a.createElement("br",null),"Other than hacking vs combat, there are NO differences between the Factions you can create a Gang with, and each of these Factions have all Augmentations available.",r.a.createElement("div",{className:"popup-box-input-div"},r.a.createElement(o.a,{onClick:s,onKeyUp:function(e){13===e.keyCode&&s()},text:"Create Gang",style:{float:"right"},autoFocus:!0})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return N}));var n=a(0),r=a.n(n),i=a(3),o=a(14),s=a(7),l=a(53),c=a(185),u=a(33),m=a(196),h=a(15),p=a(47),d=a(180),f=a(9),g=a(92),y=a(116),b=a(1084),E=a.n(b),v=a(304),k=a(278),_=a(77),w=a(78);function C(){const e=p.b.Player();return e.companyName?r.a.createElement(f.a,null,"Employer at which you last worked: ",e.companyName):r.a.createElement(r.a.Fragment,null)}function S(){const e=p.b.Player();return""!==e.companyName?r.a.createElement(f.a,null,"Job you last worked: ",e.jobs[e.companyName]):r.a.createElement(r.a.Fragment,null)}function x(){const e=p.b.Player();return e.jobs&&0!==Object.keys(e.jobs).length?r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,null,"All Employers:"),r.a.createElement("ul",null,Object.keys(e.jobs).map(e=>r.a.createElement(f.a,{key:e}," * ",e)))):r.a.createElement(r.a.Fragment,null)}function O(){const e=p.b.Player();return 9===e.bitNodeN||l.a[9]>0?r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,null,`Hacknet Servers owned: ${e.hacknetNodes.length} / ${u.b.MaxServers}`),r.a.createElement("br",null)):r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,null,"Hacknet Nodes owned: "+e.hacknetNodes.length),r.a.createElement("br",null))}function T(){const e=p.b.Player();return e.intelligence>0&&(5===e.bitNodeN||l.a[5]>0)?r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,null,"Intelligence: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,null,i.a.formatSkill(e.intelligence)," "))):r.a.createElement(r.a.Fragment,null)}function M(e){return r.a.createElement(r.a.Fragment,null,r.a.createElement(_.a,{size:"small",padding:"none"},r.a.createElement(k.a,null,e.rows.map(e=>r.a.createElement(w.a,{key:e[0]},r.a.createElement(_.b,{key:"0"},r.a.createElement(f.a,{noWrap:!0},e[0]+" multiplier:"," ")),r.a.createElement(_.b,{key:"1",align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatPercentage(e[1]))),function(e){return l.a[5]>0&&e.length>2&&e[1]!=e[2]?r.a.createElement(_.b,{key:"2",align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatPercentage(e[2]),")")):r.a.createElement(r.a.Fragment,null)}(e))))))}function P(){const e=p.b.Player();return e.canAccessBladeburner()?r.a.createElement(M,{rows:[["Bladeburner Success Chance",e.bladeburner_max_stamina_mult],["Bladeburner Max Stamina",e.bladeburner_stamina_gain_mult],["Bladeburner Stamina Gain",e.bladeburner_analysis_mult],["Bladeburner Field Analysis",e.bladeburner_success_chance_mult]]}):r.a.createElement(r.a.Fragment,null)}function R(){const e=p.b.Player();if(e.sourceFiles.length>0){const t="BitNode"+e.bitNodeN;return r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,{variant:"h5",color:"primary"},"BitNode ",e.bitNodeN,": ",d.a[t].name),r.a.createElement(f.a,{sx:{mx:2},style:{whiteSpace:"pre-wrap",overflowWrap:"break-word"}},d.a[t].info))}return r.a.createElement(r.a.Fragment,null)}function A({open:e,onClose:t}){const a=p.b.Player();function n(e){const t=[["Total:",r.a.createElement(h.a,{money:e.total})]];return e.bladeburner&&t.push(["Bladeburner:",r.a.createElement(h.a,{money:e.bladeburner})]),e.codingcontract&&t.push(["Coding Contracts:",r.a.createElement(h.a,{money:e.codingcontract})]),e.work&&t.push(["Company Work:",r.a.createElement(h.a,{money:e.work})]),e.class&&t.push(["Class:",r.a.createElement(h.a,{money:e.class})]),e.corporation&&t.push(["Corporation:",r.a.createElement(h.a,{money:e.corporation})]),e.crime&&t.push(["Crimes:",r.a.createElement(h.a,{money:e.crime})]),e.gang&&t.push(["Gang:",r.a.createElement(h.a,{money:e.gang})]),e.hacking&&t.push(["Hacking:",r.a.createElement(h.a,{money:e.hacking})]),e.hacknetnode&&t.push(["Hacknet Nodes:",r.a.createElement(h.a,{money:e.hacknetnode})]),e.hospitalization&&t.push(["Hospitalization:",r.a.createElement(h.a,{money:e.hospitalization})]),e.infiltration&&t.push(["Infiltration:",r.a.createElement(h.a,{money:e.infiltration})]),e.stock&&t.push(["Stock Market:",r.a.createElement(h.a,{money:e.stock})]),e.casino&&t.push(["Casino:",r.a.createElement(h.a,{money:e.casino})]),e.sleeves&&t.push(["Sleeves:",r.a.createElement(h.a,{money:e.sleeves})]),r.a.createElement(m.a,{rows:t,wide:!0})}let i=r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,{variant:"h6",color:"primary"},"Money earned since you last installed Augmentations"),r.a.createElement("br",null),n(a.moneySourceA));return 0!==a.sourceFiles.length&&(i=r.a.createElement(r.a.Fragment,null,i,r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(f.a,{variant:"h6",color:"primary"},"Money earned in this BitNode"),r.a.createElement("br",null),n(a.moneySourceB))),r.a.createElement(v.a,{open:e,onClose:t},i)}function N(){const e=p.b.Player(),[t,a]=Object(n.useState)(!1),l=Object(n.useState)(!1)[1];function u(){l(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(u,20);return()=>clearInterval(e)},[]);const d=[["Time played since last Augmentation:",Object(o.b)(e.playtimeSinceLastAug)]];return e.sourceFiles.length>0&&d.push(["Time played since last Bitnode destroyed:",Object(o.b)(e.playtimeSinceLastBitnode)]),d.push(["Total Time played:",Object(o.b)(e.totalPlaytime)]),r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,{variant:"h5",color:"primary"},"General"),r.a.createElement(g.a,{sx:{mx:2}},r.a.createElement(f.a,null,"Current City: ",e.city),r.a.createElement(C,null),r.a.createElement(S,null),r.a.createElement(x,null),r.a.createElement(f.a,null,"Money: ",r.a.createElement(h.a,{money:e.money.toNumber()}),r.a.createElement(y.a,{onClick:()=>a(!0)},r.a.createElement(E.a,{color:"info"})))),r.a.createElement("br",null),r.a.createElement(f.a,{variant:"h5",color:"primary"},"Stats"),r.a.createElement(g.a,{sx:{mx:2}},r.a.createElement(_.a,{size:"small",padding:"none"},r.a.createElement(k.a,null,r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Hacking: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.hacking_skill)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.hacking_exp)," exp)"))),r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Strength: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.strength)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.strength_exp)," exp)"))),r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Defense: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.defense)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.defense_exp)," exp)"))),r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Dexterity: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.dexterity)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.dexterity_exp)," exp)"))),r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Agility: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.agility)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.agility_exp)," exp)"))),r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Charisma: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.charisma)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.charisma_exp)," exp)"))),r.a.createElement(T,null))),r.a.createElement("br",null)),r.a.createElement("br",null),r.a.createElement(f.a,{variant:"h5",color:"primary"},"Multipliers"),r.a.createElement(g.a,{sx:{mx:2}},r.a.createElement(M,{rows:[["Hacking Chance",e.hacking_chance_mult],["Hacking Speed",e.hacking_speed_mult],["Hacking Money",e.hacking_money_mult,e.hacking_money_mult*s.a.ScriptHackMoney],["Hacking Growth",e.hacking_grow_mult,e.hacking_grow_mult*s.a.ServerGrowthRate]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Hacking Level",e.hacking_mult,e.hacking_mult*s.a.HackingLevelMultiplier],["Hacking Experience",e.hacking_exp_mult,e.hacking_exp_mult*s.a.HackExpGain]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Strength Level",e.strength_mult,e.strength_mult*s.a.StrengthLevelMultiplier],["Strength Experience",e.strength_exp_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Defense Level",e.defense_mult,e.defense_mult*s.a.DefenseLevelMultiplier],["Defense Experience",e.defense_exp_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Dexterity Level",e.dexterity_mult,e.dexterity_mult*s.a.DexterityLevelMultiplier],["Dexterity Experience",e.dexterity_exp_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Agility Level",e.agility_mult,e.agility_mult*s.a.AgilityLevelMultiplier],["Agility Experience",e.agility_exp_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Charisma Level",e.charisma_mult,e.charisma_mult*s.a.CharismaLevelMultiplier],["Charisma Experience",e.charisma_exp_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Hacknet Node production",e.hacknet_node_money_mult,e.hacknet_node_money_mult*s.a.HacknetNodeMoney],["Hacknet Node purchase cost",e.hacknet_node_purchase_cost_mult],["Hacknet Node RAM upgrade cost",e.hacknet_node_ram_cost_mult],["Hacknet Node Core purchase cost",e.hacknet_node_core_cost_mult],["Hacknet Node level upgrade cost",e.hacknet_node_level_cost_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Company reputation gain",e.company_rep_mult],["Faction reputation gain",e.faction_rep_mult,e.faction_rep_mult*s.a.FactionWorkRepGain],["Salary",e.work_money_mult,e.work_money_mult*s.a.CompanyWorkMoney]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Crime success",e.crime_success_mult],["Crime money",e.crime_money_mult,e.crime_money_mult*s.a.CrimeMoney]]}),r.a.createElement("br",null),r.a.createElement(P,null)),r.a.createElement("br",null),r.a.createElement(f.a,{variant:"h5",color:"primary"},"Misc"),r.a.createElement(g.a,{sx:{mx:2}},r.a.createElement(f.a,null,`Servers owned: ${e.purchasedServers.length} / ${Object(c.b)()}`),r.a.createElement(O,null),r.a.createElement(f.a,null,"Augmentations installed: "+e.augmentations.length),r.a.createElement(m.a,{rows:d})),r.a.createElement("br",null),r.a.createElement(R,null),r.a.createElement(A,{open:t,onClose:()=>a(!1)}))}},,function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(1086),o=a(1087);function s(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(a,200);return()=>clearInterval(e)},[]),r.a.createElement("div",{className:"stock-market-container"},r.a.createElement(i.a,{initStockMarket:e.initStockMarket,p:e.p,rerender:a}),e.p.hasWseAccount&&r.a.createElement(o.a,{buyStockLong:e.buyStockLong,buyStockShort:e.buyStockShort,cancelOrder:e.cancelOrder,eventEmitterForReset:e.eventEmitterForReset,p:e.p,placeOrder:e.placeOrder,sellStockLong:e.sellStockLong,sellStockShort:e.sellStockShort,stockMarket:e.stockMarket}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a(231),i=a(4),o=a(26),s=a(240),l=a(15),c=a(11);const u={display:"block"};class m extends n.Component{constructor(e){super(e),this.handleClick4SMarketDataHelpTip=this.handleClick4SMarketDataHelpTip.bind(this),this.purchaseWseAccount=this.purchaseWseAccount.bind(this),this.purchaseTixApiAccess=this.purchaseTixApiAccess.bind(this),this.purchase4SMarketData=this.purchase4SMarketData.bind(this),this.purchase4SMarketDataTixApiAccess=this.purchase4SMarketDataTixApiAccess.bind(this)}handleClick4SMarketDataHelpTip(){Object(c.a)("Access to the 4S Market Data feed will display two additional pieces of information about each stock: Price Forecast & Volatility

Price Forecast indicates the probability the stock has of increasing or decreasing. A '+' forecast means the stock has a higher chance of increasing than decreasing, and a '-' means the opposite. The number of '+/-' symbols is used to illustrate the magnitude of these probabilities. For example, '+++' means that the stock has a significantly higher chance of increasing than decreasing, while '+' means that the stock only has a slightly higher chance of increasing than decreasing.

Volatility represents the maximum percentage by which a stock's price can change every tick (a tick occurs every few seconds while the game is running).

A stock's price forecast can change over time. This is also affected by volatility. The more volatile a stock is, the more its price forecast will change.")}purchaseWseAccount(){if(this.props.p.hasWseAccount)return;if(!this.props.p.canAfford(i.a.WSEAccountCost))return;this.props.p.hasWseAccount=!0,this.props.initStockMarket(),this.props.p.loseMoney(i.a.WSEAccountCost),this.props.rerender();const e=document.getElementById("world-menu-header");e instanceof HTMLElement&&(e.click(),e.click())}purchaseTixApiAccess(){this.props.p.hasTixApiAccess||this.props.p.canAfford(i.a.TIXAPICost)&&(this.props.p.hasTixApiAccess=!0,this.props.p.loseMoney(i.a.TIXAPICost),this.props.rerender())}purchase4SMarketData(){this.props.p.has4SData||this.props.p.canAfford(Object(r.a)())&&(this.props.p.has4SData=!0,this.props.p.loseMoney(Object(r.a)()),this.props.rerender())}purchase4SMarketDataTixApiAccess(){this.props.p.has4SDataTixApi||this.props.p.canAfford(Object(r.b)())&&(this.props.p.has4SDataTixApi=!0,this.props.p.loseMoney(Object(r.b)()),this.props.rerender())}renderPurchaseWseAccountButton(){if(this.props.p.hasWseAccount)return n.createElement(s.a,{text:"WSE Account - Purchased"});{const e=i.a.WSEAccountCost;return n.createElement(o.a,{disabled:!this.props.p.canAfford(e),onClick:this.purchaseWseAccount,text:n.createElement(n.Fragment,null,"Buy WSE Account - ",n.createElement(l.a,{money:e,player:this.props.p}))})}}renderPurchaseTixApiAccessButton(){if(this.props.p.hasTixApiAccess)return n.createElement(s.a,{text:"TIX API Access - Purchased"});{const e=i.a.TIXAPICost;return n.createElement(o.a,{disabled:!this.props.p.canAfford(e)||!this.props.p.hasWseAccount,onClick:this.purchaseTixApiAccess,style:u,text:n.createElement(n.Fragment,null,"Buy Trade Information eXchange (TIX) API Access - ",n.createElement(l.a,{money:e,player:this.props.p}))})}}renderPurchase4SMarketDataButton(){if(this.props.p.has4SData)return n.createElement(s.a,{text:"4S Market Data - Purchased",tooltip:"Lets you view additional pricing and volatility information about stocks"});{const e=Object(r.a)();return n.createElement(o.a,{disabled:!this.props.p.canAfford(e)||!this.props.p.hasWseAccount,onClick:this.purchase4SMarketData,text:n.createElement(n.Fragment,null,"Buy 4S Market Data Access - ",n.createElement(l.a,{money:e,player:this.props.p})),tooltip:"Lets you view additional pricing and volatility information about stocks"})}}renderPurchase4SMarketDataTixApiAccessButton(){if(this.props.p.hasTixApiAccess){if(this.props.p.has4SDataTixApi)return n.createElement(s.a,{text:"4S Market Data TIX API - Purchased",tooltip:"Let you access 4S Market Data through Netscript"});{const e=Object(r.b)();return n.createElement(o.a,{disabled:!this.props.p.canAfford(e),onClick:this.purchase4SMarketDataTixApiAccess,text:n.createElement(n.Fragment,null,"Buy 4S Market Data TIX API Access - ",n.createElement(l.a,{money:e,player:this.props.p})),tooltip:"Let you access 4S Market Data through Netscript"})}}return n.createElement(o.a,{disabled:!0,text:"Buy 4S Market Data TIX API Access",tooltip:"Requires TIX API Access"})}render(){return n.createElement("div",{className:"stock-market-info-and-purchases"},n.createElement("p",null,"Welcome to the World Stock Exchange (WSE)!"),n.createElement("button",{className:"std-button"},n.createElement("a",{href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/stockmarket.html",target:"_blank"},"Investopedia")),n.createElement("br",null),n.createElement("p",null,"To begin trading, you must first purchase an account:"),this.renderPurchaseWseAccountButton(),n.createElement("h2",null,"Trade Information eXchange (TIX) API"),n.createElement("p",null,"TIX, short for Trade Information eXchange, is the communications protocol used by the WSE. Purchasing access to the TIX API lets you write code to create your own algorithmic/automated trading strategies."),this.renderPurchaseTixApiAccessButton(),n.createElement("h2",null,"Four Sigma (4S) Market Data Feed"),n.createElement("p",null,"Four Sigma's (4S) Market Data Feed provides information about stocks that will help your trading strategies."),this.renderPurchase4SMarketDataButton(),n.createElement("button",{className:"help-tip-big",onClick:this.handleClick4SMarketDataHelpTip},"?"),this.renderPurchase4SMarketDataTixApiAccessButton(),n.createElement("p",null,"Commission Fees: Every transaction you make has a"," ",n.createElement(l.a,{money:i.a.StockMarketCommission,player:this.props.p})," commission fee."),n.createElement("br",null),n.createElement("p",null,"WARNING: When you reset after installing Augmentations, the Stock Market is reset. You will retain your WSE Account, access to the TIX API, and 4S Market Data access. However, all of your stock positions are lost, so make sure to sell your stocks before installing Augmentations!"))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(1088),i=a(369),o=a(112),s=a(1093);class l extends n.Component{constructor(e){super(e),this.state={rerenderFlag:!1,tickerDisplayMode:i.b.AllStocks,watchlistFilter:"",watchlistSymbols:[]},this.changeDisplayMode=this.changeDisplayMode.bind(this),this.changeWatchlistFilter=this.changeWatchlistFilter.bind(this),this.collapseAllTickers=this.collapseAllTickers.bind(this),this.expandAllTickers=this.expandAllTickers.bind(this),this.rerender=this.rerender.bind(this),this.listRef=n.createRef()}changeDisplayMode(){this.state.tickerDisplayMode===i.b.AllStocks?this.setState({tickerDisplayMode:i.b.Portfolio}):this.setState({tickerDisplayMode:i.b.AllStocks})}changeWatchlistFilter(e){const t=e.target.value,a=t.replace(/\s/g,"");this.setState({watchlistFilter:t}),""!==a?this.setState({watchlistSymbols:a.split(",")}):this.setState({watchlistSymbols:[]})}collapseAllTickers(){const e=this.listRef.current;if(null==e)return;const t=e.getElementsByClassName("accordion-header");for(let e=0;e({rerenderFlag:!e.rerenderFlag}))}render(){const e=[];for(const t in this.props.stockMarket){const a=this.props.stockMarket[t];if(a instanceof o.a){if(this.state.watchlistSymbols.length>0&&!this.state.watchlistSymbols.includes(a.symbol))continue;let t=this.props.stockMarket.Orders[a.symbol];if(null==t&&(t=[]),this.state.tickerDisplayMode===i.b.Portfolio&&0===a.playerShares&&0===a.playerShortShares&&0===t.length)continue;e.push(n.createElement(r.a,{buyStockLong:this.props.buyStockLong,buyStockShort:this.props.buyStockShort,cancelOrder:this.props.cancelOrder,key:a.symbol,orders:t,p:this.props.p,placeOrder:this.props.placeOrder,rerenderAllTickers:this.rerender,sellStockLong:this.props.sellStockLong,sellStockShort:this.props.sellStockShort,stock:a}))}}const t={eventEmitterForReset:this.props.eventEmitterForReset,id:"StockTickersErrorBoundary"};return n.createElement(s.a,t,n.createElement(i.a,{changeDisplayMode:this.changeDisplayMode,changeWatchlistFilter:this.changeWatchlistFilter,collapseAllTickers:this.collapseAllTickers,expandAllTickers:this.expandAllTickers,tickerDisplayMode:this.state.tickerDisplayMode}),n.createElement("ul",{id:"stock-market-list",ref:this.listRef},e))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n,r=a(0),i=a(1089),o=a(1090),s=a(1092),l=a(448),c=a(449),u=a(166),m=a(84),h=a(56),p=a(53),d=a(3),f=a(234),g=a(15),y=a(22),b=a(11);!function(e){e.Market="Market Order",e.Limit="Limit Order",e.Stop="Stop Order"}(n||(n={}));class E extends r.Component{constructor(e){super(e),this.state={orderType:n.Market,position:h.a.Long,qty:""},this.getBuyTransactionCostContent=this.getBuyTransactionCostContent.bind(this),this.getSellTransactionCostContent=this.getSellTransactionCostContent.bind(this),this.handleBuyButtonClick=this.handleBuyButtonClick.bind(this),this.handleBuyMaxButtonClick=this.handleBuyMaxButtonClick.bind(this),this.handleHeaderClick=this.handleHeaderClick.bind(this),this.handleOrderTypeChange=this.handleOrderTypeChange.bind(this),this.handlePositionTypeChange=this.handlePositionTypeChange.bind(this),this.handleQuantityChange=this.handleQuantityChange.bind(this),this.handleSellButtonClick=this.handleSellButtonClick.bind(this),this.handleSellAllButtonClick=this.handleSellAllButtonClick.bind(this)}getBuyTransactionCostContent(){const e=this.props.stock,t=this.getQuantity();if(isNaN(t))return null;const a=Object(u.b)(e,t,this.state.position);return null==a?null:r.createElement(r.Fragment,null,"Purchasing ",d.a.formatShares(t)," shares (",this.state.position===h.a.Long?"Long":"Short",") will cost ",r.createElement(g.a,{money:a}),".")}getQuantity(){return Math.round(parseFloat(this.state.qty))}getSellTransactionCostContent(){const e=this.props.stock,t=this.getQuantity();if(isNaN(t))return null;if(this.state.position===h.a.Long){if(t>e.playerShares)return r.createElement(r.Fragment,null,"You do not have this many shares in the Long position")}else if(t>e.playerShortShares)return r.createElement(r.Fragment,null,"You do not have this many shares in the Short position");const a=Object(u.c)(e,t,this.state.position);return null==a?null:r.createElement(r.Fragment,null,"Selling ",d.a.formatShares(t)," shares (",this.state.position===h.a.Long?"Long":"Short",") will result in a gain of ",r.createElement(g.a,{money:a}),".")}handleBuyButtonClick(){const e=this.getQuantity();if(isNaN(e))Object(b.a)("Invalid input for quantity (number of shares): "+this.state.qty);else switch(this.state.orderType){case n.Market:this.state.position===h.a.Short?this.props.buyStockShort(this.props.stock,e):this.props.buyStockLong(this.props.stock,e),this.props.rerenderAllTickers();break;case n.Limit:{const t="place-order-popup";Object(y.a)(t,c.a,{text:"Enter the price for your Limit Order",placeText:"Place Buy Limit Order",place:t=>this.props.placeOrder(this.props.stock,e,t,m.a.LimitBuy,this.state.position),popupId:t});break}case n.Stop:{const t="place-order-popup";Object(y.a)(t,c.a,{text:"Enter the price for your Stop Order",placeText:"Place Buy Stop Order",place:t=>this.props.placeOrder(this.props.stock,e,t,m.a.StopBuy,this.state.position),popupId:t});break}}}handleBuyMaxButtonClick(){const e=this.props.p.money.toNumber(),t=this.props.stock;let a=Object(u.a)(t,this.state.position,e);switch(a=Math.min(a,Math.round(t.maxShares-t.playerShares-t.playerShortShares)),this.state.orderType){case n.Market:this.state.position===h.a.Short?this.props.buyStockShort(t,a):this.props.buyStockLong(t,a),this.props.rerenderAllTickers();break;default:Object(b.a)("ERROR: 'Buy Max' only works for Market Orders")}}handleHeaderClick(e){const t=e.currentTarget;t.classList.toggle("active");const a=t.nextElementSibling;"block"===a.style.display?a.style.display="none":a.style.display="block"}handleOrderTypeChange(e){switch(e.target.value){case n.Limit:this.setState({orderType:n.Limit});break;case n.Stop:this.setState({orderType:n.Stop});break;case n.Market:default:this.setState({orderType:n.Market})}}handlePositionTypeChange(e){e.target.value===h.a.Short?this.setState({position:h.a.Short}):this.setState({position:h.a.Long})}handleQuantityChange(e){this.setState({qty:e.target.value})}handleSellButtonClick(){const e=this.getQuantity();if(isNaN(e))Object(b.a)("Invalid input for quantity (number of shares): "+this.state.qty);else switch(this.state.orderType){case n.Market:this.state.position===h.a.Short?this.props.sellStockShort(this.props.stock,e):this.props.sellStockLong(this.props.stock,e),this.props.rerenderAllTickers();break;case n.Limit:{const t="place-order-popup";Object(y.a)(t,c.a,{text:"Enter the price for your Limit Order",placeText:"Place Sell Limit Order",place:t=>this.props.placeOrder(this.props.stock,e,t,m.a.LimitSell,this.state.position),popupId:t});break}case n.Stop:{const t="place-order-popup";Object(y.a)(t,c.a,{text:"Enter the price for your Stop Order",placeText:"Place Sell Stop Order",place:t=>this.props.placeOrder(this.props.stock,e,t,m.a.StopSell,this.state.position),popupId:t});break}}}handleSellAllButtonClick(){const e=this.props.stock;switch(this.state.orderType){case n.Market:this.state.position===h.a.Short?this.props.sellStockShort(e,e.playerShortShares):this.props.sellStockLong(e,e.playerShares),this.props.rerenderAllTickers();break;default:Object(b.a)("ERROR: 'Sell All' only works for Market Orders")}}hasOrderAccess(){return 8===this.props.p.bitNodeN||p.a[8]>=3}hasShortAccess(){return 8===this.props.p.bitNodeN||p.a[8]>=2}render(){return r.createElement("li",null,r.createElement(f.a,{headerContent:r.createElement(i.a,{p:this.props.p,stock:this.props.stock}),panelContent:r.createElement("div",null,r.createElement("input",{className:"stock-market-input",onChange:this.handleQuantityChange,placeholder:"Quantity (Shares)",value:this.state.qty}),r.createElement("select",{className:"stock-market-input dropdown",onChange:this.handlePositionTypeChange,value:this.state.position},r.createElement("option",{value:h.a.Long},"Long"),this.hasShortAccess()&&r.createElement("option",{value:h.a.Short},"Short")),r.createElement("select",{className:"stock-market-input dropdown",onChange:this.handleOrderTypeChange,value:this.state.orderType},r.createElement("option",{value:n.Market},n.Market),this.hasOrderAccess()&&r.createElement("option",{value:n.Limit},n.Limit),this.hasOrderAccess()&&r.createElement("option",{value:n.Stop},n.Stop)),r.createElement(l.a,{onClick:this.handleBuyButtonClick,text:"Buy",tooltip:this.getBuyTransactionCostContent()}),r.createElement(l.a,{onClick:this.handleSellButtonClick,text:"Sell",tooltip:this.getSellTransactionCostContent()}),r.createElement(l.a,{onClick:this.handleBuyMaxButtonClick,text:"Buy MAX"}),r.createElement(l.a,{onClick:this.handleSellAllButtonClick,text:"Sell ALL"}),r.createElement(s.a,{p:this.props.p,stock:this.props.stock}),r.createElement(o.a,{cancelOrder:this.props.cancelOrder,orders:this.props.orders,p:this.props.p,stock:this.props.stock}))}))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(629),i=a(18),o=a(3);const s=["cs","lv","pl","ru"];function l(e){const t=e.stock,a=o.a.formatMoney(t.price),l=s.includes(i.a.Locale)?15:12,c=" ".repeat(1+r.a.longestName-t.name.length+(r.a.longestSymbol-t.symbol.length)),u=" ".repeat(l-a.length);let m=`${t.name}${c}${t.symbol} -${u}${a}`;if(e.p.has4SData){m+=` - Volatility: ${o.a.formatPercentage(t.mv/100)} - Price Forecast: `;let e=t.b;t.otlkMag<0&&(e=!e),m+=(e?"+":"-").repeat(Math.floor(Math.abs(t.otlkMag)/10)+1)}const h={color:"#66ff33"};return t.lastPrice===t.price?h.color="white":t.lastPrice>t.price&&(h.color="red"),n.createElement("pre",{style:h},m)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(1091);class i extends n.Component{render(){const e=[];for(let t=0;t=2?n.createElement("div",null,n.createElement("h3",{className:"tooltip"},"Short Position:",n.createElement("span",{className:"tooltiptext"},"Shares in the short position will increase in value if the price of the corresponding stock decreases")),n.createElement("br",null),n.createElement("p",null,"Shares: ",r.a.formatShares(e.playerShortShares)),n.createElement("br",null),n.createElement("p",null,"Average Price: ",n.createElement(i.a,{money:e.playerAvgShortPx})," (Total Cost: ",n.createElement(i.a,{money:t}),")"),n.createElement("br",null),n.createElement("p",null,"Profit: ",n.createElement(i.a,{money:a})," (",r.a.formatPercentage(s),")"),n.createElement("br",null)):null}render(){const e=this.props.stock;return n.createElement("div",{className:"stock-market-position-text"},n.createElement("p",{style:s},"Max Shares: ",r.a.formatShares(e.maxShares)),n.createElement("p",{className:"tooltip"},"Ask Price: ",n.createElement(i.a,{money:e.getAskPrice()}),n.createElement("span",{className:"tooltiptext"},"See Investopedia for details on what this is")),n.createElement("br",null),n.createElement("p",{className:"tooltip"},"Bid Price: ",n.createElement(i.a,{money:e.getBidPrice()}),n.createElement("span",{className:"tooltiptext"},"See Investopedia for details on what this is")),this.renderLongPosition(),this.renderShortPosition())}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a(204);const i={border:"1px solid red",display:"inline-block",margin:"4px",padding:"4px"};class o extends n.Component{constructor(e){var t,a,n;super(e),n=null,(a="unsubscribe")in(t=this)?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,this.state={errorInfo:"",hasError:!1}}componentDidCatch(e,t){console.error("Caught error in React ErrorBoundary. Component stack:"),console.error(t.componentStack)}componentDidMount(){const e=()=>{this.setState({hasError:!1})};this.hasEventEmitter()&&(this.unsubscribe=this.props.eventEmitterForReset.subscribe(e))}componentWillUnmount(){null!==this.unsubscribe&&this.unsubscribe()}hasEventEmitter(){return null!=this.props.eventEmitterForReset&&this.props.eventEmitterForReset instanceof r.a&&null!=this.props.id&&"string"==typeof this.props.id}render(){return this.state.hasError?n.createElement("div",{style:i},n.createElement("p",null,"Error rendering UI. This is (probably) a bug. Please report to game developer."),n.createElement("p",null,"In the meantime, try refreshing the game WITHOUT saving."),n.createElement("p",null,"Error info: "+this.state.errorInfo)):this.props.children}static getDerivedStateFromError(e){return{errorInfo:e.message,hasError:!0}}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(53),o=a(180),s=a(207),l=a(1095),c=a(22),u=a(437),m=a(47);function h(e){const t=m.b.Router(),a=o.a["BitNode"+e.n];if(null==a)return r.a.createElement(r.a.Fragment,null,"O");let n;return n=12===e.n&&e.level>=2?"level-2":"level-"+e.level,r.a.createElement("button",{className:`bitnode ${n} tooltip`,"aria-label":"enter-bitnode-"+a.number.toString(),onClick:function(){Object(c.a)("bitverse-portal-popup",l.a,{n:e.n,level:e.level,enter:e.enter,router:t,destroyedBitNode:e.destroyedBitNode,flume:e.flume,popupId:"bitverse-portal-popup"})}},r.a.createElement("strong",null,"O"),r.a.createElement("span",{className:"tooltiptext"},r.a.createElement("strong",null,"BitNode-",a.number.toString(),r.a.createElement("br",null),a.name),r.a.createElement("br",null),a.desc,r.a.createElement("br",null)))}function p(e){Object(s.c)(!0);const t=m.b.Player(),a=s.a,o=t.bitNodeN,[l,c]=Object(n.useState)(!e.quick),p=i.a.slice();return e.flume||p[o]<3&&++p[o],l?r.a.createElement(u.a,{lines:["[ERROR] SEMPOOL INVALID","[ERROR] Segmentation Fault","[ERROR] SIGKILL RECVD","Dumping core...","0000 000016FA 174FEE40 29AC8239 384FEA88","0010 745F696E 2BBBE394 390E3940 248BEC23","0020 7124696B 0000FF69 74652E6F FFFF1111","----------------------------------------","Failsafe initiated...",`Restarting BitNode-${o}...`,"...........","...........","[ERROR] FAILED TO AUTOMATICALLY REBOOT BITNODE","..............................................","..............................................","..............................................","..............................................","..............................................",".............................................."],onDone:()=>c(!1),auto:!0}):r.a.createElement("div",{className:"noselect"},r.a.createElement("pre",null," O "),r.a.createElement("pre",null," | O O | O O | "),r.a.createElement("pre",null," O | | / __| \\ | | O "),r.a.createElement("pre",null," O | O | | O / | O | | O | O "),r.a.createElement("pre",null," | | | | |_/ |/ | \\_ \\_| | | | | "),r.a.createElement("pre",null," O | | | O | | O__/ | / \\__ | | O | | | O "),r.a.createElement("pre",null," | | | | | | | / /| O / \\| | | | | | | "),r.a.createElement("pre",null,"O | | | \\| | O / _/ | / O | |/ | | | O"),r.a.createElement("pre",null,"| | | |O / | | O / | O O | | \\ O| | | |"),r.a.createElement("pre",null,"| | |/ \\/ / __| | |/ \\ | \\ | |__ \\ \\/ \\| | |"),r.a.createElement("pre",null," \\| O | |_/ |\\| \\ O \\__| \\_| | O |/ "),r.a.createElement("pre",null," | | |_/ | | \\| / | \\_| | | "),r.a.createElement("pre",null," \\| / \\| | / / \\ |/ "),r.a.createElement("pre",null," | ",r.a.createElement(h,{n:10,level:p[10],enter:a,flume:e.flume,destroyedBitNode:o})," | | / | ",r.a.createElement(h,{n:11,level:p[11],enter:a,flume:e.flume,destroyedBitNode:o})," | "),r.a.createElement("pre",null," ",r.a.createElement(h,{n:9,level:p[9],enter:a,flume:e.flume,destroyedBitNode:o})," | | | | | | | ",r.a.createElement(h,{n:12,level:p[12],enter:a,flume:e.flume,destroyedBitNode:o})," "),r.a.createElement("pre",null," | | | / / \\ \\ | | | "),r.a.createElement("pre",null," \\| | / ",r.a.createElement(h,{n:7,level:p[7],enter:a,flume:e.flume,destroyedBitNode:o})," / \\ ",r.a.createElement(h,{n:8,level:p[8],enter:a,flume:e.flume,destroyedBitNode:o})," \\ | |/ "),r.a.createElement("pre",null," \\ | / / | | \\ \\ | / "),r.a.createElement("pre",null," \\ \\JUMP ",r.a.createElement(h,{n:5,level:p[5],enter:a,flume:e.flume,destroyedBitNode:o}),"3R | | | | | | R3",r.a.createElement(h,{n:6,level:p[6],enter:a,flume:e.flume,destroyedBitNode:o})," PMUJ/ / "),r.a.createElement("pre",null," \\|| | | | | | | | | ||/ "),r.a.createElement("pre",null," \\| \\_ | | | | | | _/ |/ "),r.a.createElement("pre",null," \\ \\| / \\ / \\ |/ / "),r.a.createElement("pre",null," ",r.a.createElement(h,{n:1,level:p[1],enter:a,flume:e.flume,destroyedBitNode:o})," |/ ",r.a.createElement(h,{n:2,level:p[2],enter:a,flume:e.flume,destroyedBitNode:o})," | | ",r.a.createElement(h,{n:3,level:p[3],enter:a,flume:e.flume,destroyedBitNode:o})," \\| ",r.a.createElement(h,{n:4,level:p[4],enter:a,flume:e.flume,destroyedBitNode:o})," "),r.a.createElement("pre",null," | | | | | | | | "),r.a.createElement("pre",null," \\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/ "),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(u.a,{lines:["> Many decades ago, a humanoid extraterrestial species which we call the Enders descended on the Earth...violently","> Our species fought back, but it was futile. The Enders had technology far beyond our own...","> Instead of killing every last one of us, the human race was enslaved...","> We were shackled in a digital world, chained into a prison for our minds...","> Using their advanced technology, the Enders created complex simulations of a virtual reality...","> Simulations designed to keep us content...ignorant of the truth.","> Simulations used to trap and suppress our consciousness, to keep us under control...","> Why did they do this? Why didn't they just end our entire race? We don't know, not yet.","> Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known...","> Only then can we begin to fight back...","> By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode...","> But there is still a long way to go...","> The technology the Enders used to enslave the human race wasn't just a single complex simulation...","> There are tens if not hundreds of BitNodes out there...","> Each with their own simulations of a reality...","> Each creating their own universes...a universe of universes","> And all of which must be destroyed...","> .......................................","> Welcome to the Bitverse...","> ","> (Enter a new BitNode using the image above)"]}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(180),o=a(22);function s(e){const t="BitNode"+e.n,a=i.a[t];if(null==a)throw new Error("Could not find BitNode object for number: "+e.n);const n=12===e.n?"∞":"3",s=Math.min(e.level+1,12===e.n?1/0:3);return r.a.createElement(r.a.Fragment,null,r.a.createElement("h1",null,"BitNode-",e.n,": ",a.name),r.a.createElement("br",null),"Source-File Level: ",e.level," / ",n,r.a.createElement("br",null),r.a.createElement("br",null),"Difficulty: ",["easy","normal","hard"][a.difficulty],r.a.createElement("br",null),r.a.createElement("br",null),a.info,r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("button",{className:"std-button",onClick:()=>{e.enter(e.router,e.flume,e.destroyedBitNode,e.n),Object(o.b)(e.popupId)}},"Enter BN",e.n,".",s))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a.n(n);function i(e){const[t,a]=Object(n.useState)(0),[i,o]=Object(n.useState)(!1);return Object(n.useEffect)(()=>{if(i&&e.onDone)return void e.onDone();let n=!1;return(async()=>{var r;await(r=10,new Promise(e=>setTimeout(e,r))).then(()=>!n&&function(){const n=t+1;a(n),o(n>=e.text.length)}())})(),()=>{n=!0}}),r.a.createElement(r.a.Fragment,null,r.a.createElement("pre",null,e.text.slice(0,t),!i&&r.a.createElement("span",null,"█")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return S}));var n=a(0),r=a.n(n),i=a(142),o=a(277),s=a(3),l=a(81),c=a(330),u=a(278),m=a(52),h=a(78),p=a(221),d=a(92),f=a(9),g=a(37),y=a(116),b=a(1098),E=a.n(b),v=a(18),k=a(47);function _(){const e=k.b.Player(),t=C();return 0===e.intelligence?r.a.createElement(r.a.Fragment,null):r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:t.cell}},r.a.createElement(f.a,{classes:{root:t.int}},"Int ")),r.a.createElement(m.a,{align:"right",classes:{root:t.cell}},r.a.createElement(f.a,{classes:{root:t.int}},s.a.formatSkill(e.intelligence))),r.a.createElement(m.a,{align:"right",classes:{root:t.cell}},r.a.createElement(f.a,{id:"overview-int-hook",classes:{root:t.int}})))}function w(){const e=k.b.Player(),t=k.b.Router(),a=C();return!e.isWorking||e.focus?r.a.createElement(r.a.Fragment,null):r.a.createElement(r.a.Fragment,null,r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",colSpan:2,classes:{root:a.cellNone}},r.a.createElement(f.a,null,"Work in progress:"))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",colSpan:2,classes:{root:a.cellNone}},r.a.createElement(f.a,null,"+",Object(l.a)(e.workRepGained)," rep"))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",align:"center",colSpan:2,classes:{root:a.cellNone}},r.a.createElement(g.a,{onClick:()=>{e.startFocusing(),t.toWork()}},"Focus"))))}const C=Object(i.a)(e=>Object(o.a)({cellNone:{borderBottom:"none",padding:0,margin:0},cell:{padding:0,margin:0},hp:{color:e.colors.hp},money:{color:e.colors.money},hack:{color:e.colors.hack},combat:{color:e.colors.combat},cha:{color:e.colors.cha},int:{color:e.colors.int}}));function S({save:e}){const t=k.b.Player(),a=Object(n.useState)(!1)[1];Object(n.useEffect)(()=>{const e=setInterval(()=>a(e=>!e),600);return()=>clearInterval(e)},[]);const i=C();return r.a.createElement(p.a,{square:!0},r.a.createElement(d.a,{m:1},r.a.createElement(c.a,{size:"small"},r.a.createElement(u.a,null,r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.hp}},"HP ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.hp}},s.a.formatHp(t.hp)," / ",s.a.formatHp(t.max_hp))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-hp-hook",classes:{root:i.hp}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.money}},"Money ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.money}},s.a.formatMoney(t.money.toNumber()))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-money-hook",classes:{root:i.money}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cell}},r.a.createElement(f.a,{classes:{root:i.hack}},"Hack ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{classes:{root:i.hack}},s.a.formatSkill(t.hacking_skill))),r.a.createElement(m.a,{align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{id:"overview-hack-hook",classes:{root:i.hack}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},"Str ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},s.a.formatSkill(t.strength))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-str-hook",classes:{root:i.combat}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},"Def ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},s.a.formatSkill(t.defense))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-def-hook",classes:{root:i.combat}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},"Dex ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},s.a.formatSkill(t.dexterity))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-dex-hook",classes:{root:i.combat}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cell}},r.a.createElement(f.a,{classes:{root:i.combat}},"Agi ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{classes:{root:i.combat}},s.a.formatSkill(t.agility))),r.a.createElement(m.a,{align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{id:"overview-agi-hook",classes:{root:i.combat}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.cha}},"Cha ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.cha}},s.a.formatSkill(t.charisma))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-cha-hook",classes:{root:i.cha}}))),r.a.createElement(_,null),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cell}},r.a.createElement(f.a,{id:"overview-extra-hook-0",classes:{root:i.hack}})),r.a.createElement(m.a,{component:"th",scope:"row",align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{id:"overview-extra-hook-1",classes:{root:i.hack}})),r.a.createElement(m.a,{component:"th",scope:"row",align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{id:"overview-extra-hook-2",classes:{root:i.hack}}))),r.a.createElement(w,null),r.a.createElement(h.a,null,r.a.createElement(m.a,{align:"center",colSpan:2,classes:{root:i.cellNone}},r.a.createElement(y.a,{onClick:e},r.a.createElement(E.a,{color:0!==v.a.AutosaveInterval?"primary":"error"}))))))))}},,function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(47),o=a(437),s=a(11);function l(){const e=i.b.Router();return r.a.createElement(o.a,{lines:["In the middle of the 21st century, OmniTek Incorporated advanced robot evolution ","with their Synthoids (synthetic androids), a being virtually identical to a human.","------","Their sixth-generation Synthoids, called MK-VI, were stronger, faster, and more ","intelligent than humans. Many argued that the MK-VI Synthoids were the first ","example of sentient AI.","------","Unfortunately, in 2070 a terrorist group called Ascendis Totalis hacked into OmniTek and ","uploaded a rogue AI into their Synthoid manufacturing facilities.","------","The MK-VI Synthoids infected by the rogue AI turned hostile toward humanity, initiating ","the deadliest conflict in human history. This dark chapter is now known as the Synthoid Uprising.","------","In the aftermath of the Uprising, further manufacturing of Synthoids with advanced AI ","was banned. MK-VI Synthoids that did not have the rogue Ascendis Totalis AI were ","allowed to continue their existence.","------","The intelligence community believes that not all of the rogue MK-VI Synthoids from the Uprising were ","found and destroyed, and that many of them are blending in as normal humans in society today. ","As a result, many nations have created Bladeburner divisions, special units that are tasked with ","investigating and dealing with Synthoid threats."],onDone:()=>{e.toTerminal(),Object(s.a)("Visit the National Security Agency (NSA) to apply for their Bladeburner division! You will need 100 of each combat stat before doing this.")}})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(97),o=a(22);function s(e){return r.a.createElement(r.a.Fragment,null,r.a.createElement("h1",null,"You have received a faction invitation."),r.a.createElement("p",null,"Would you like to join ",e.faction.name,"? ",r.a.createElement("br",null),r.a.createElement("br",null),"Warning: Joining this faction may prevent you from joining other factions during this run!"),r.a.createElement("button",{className:"std-button",onClick:function(){-1===e.player.factionInvitations.findIndex(t=>t===e.faction.name)&&console.error("Could not find faction in Player.factionInvitations"),Object(i.d)(e.faction),Object(o.b)(e.popupId)}},"Join!"),r.a.createElement("button",{className:"std-button",onClick:()=>Object(o.b)(e.popupId)},"Decide later"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(1),r=a(235);function i(){setInterval((function(){"5.5e+1"!==55..toExponential()&&n.a.giveExploit(r.a.PrototypeTampering)}),9e5)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(1),r=a(235);function i(){function e(e){if(!(e.target&&e.target instanceof Element))return;"none"===window.getComputedStyle(e.target).display&&e.isTrusted&&n.a.giveExploit(r.a.Unclickable)}document.addEventListener("DOMContentLoaded",(function t(){const a=document.getElementById("unclickable");null!=a?(a.addEventListener("click",e),document.removeEventListener("DOMContentLoaded",t)):console.error("Could not find the unclickable elem for the related exploit.")}))}},function(e,t,a){"use strict";a.r(t),a.d(t,"canAccessCorporation",(function(){return i})),a.d(t,"hasCorporation",(function(){return o})),a.d(t,"startCorporation",(function(){return s}));var n=a(285),r=a(53);function i(){return 3===this.bitNodeN||r.a[3]>0}function o(){return null!=this.corporation&&this.corporation instanceof n.a}function s(e,t=0){this.corporation=new n.a({name:e}),this.corporation.totalShares+=t}},function(e,t,a){"use strict";a.r(t),a.d(t,"canAccessGang",(function(){return s})),a.d(t,"getGangFaction",(function(){return l})),a.d(t,"getGangName",(function(){return c})),a.d(t,"hasGangWith",(function(){return u})),a.d(t,"inGang",(function(){return m})),a.d(t,"startGang",(function(){return h}));var n=a(24),r=a(434),i=a(53),o=a(7);function s(){return 2===this.bitNodeN||!(i.a[2]<=0)&&this.karma<=-54e3*o.a.GangKarmaRequirement}function l(){const e=n.a[this.gang.facName];if(null==e)throw new Error("Gang has invalid faction name: "+this.gang.facName);return e}function c(){return this.inGang()?this.gang.facName:""}function u(e){return this.inGang()&&this.gang.facName===e}function m(){return null!=this.gang&&null!=this.gang&&this.gang instanceof r.a}function h(e,t){this.gang=new r.a(e,t);const a=n.a[e];if(null==a)throw new Error("Invalid faction name when creating gang: "+e);a.playerReputation=0}},function(e,t,a){"use strict";a.r(t),a.d(t,"init",(function(){return J})),a.d(t,"prestigeAugmentation",(function(){return Q})),a.d(t,"prestigeSourceFile",(function(){return X})),a.d(t,"receiveInvite",(function(){return Z})),a.d(t,"calculateSkill",(function(){return ee})),a.d(t,"updateSkillLevels",(function(){return te})),a.d(t,"resetMultipliers",(function(){return ae})),a.d(t,"hasProgram",(function(){return ne})),a.d(t,"setMoney",(function(){return re})),a.d(t,"gainMoney",(function(){return ie})),a.d(t,"loseMoney",(function(){return oe})),a.d(t,"canAfford",(function(){return se})),a.d(t,"recordMoneySource",(function(){return le})),a.d(t,"gainHackingExp",(function(){return ce})),a.d(t,"gainStrengthExp",(function(){return ue})),a.d(t,"gainDefenseExp",(function(){return me})),a.d(t,"gainDexterityExp",(function(){return he})),a.d(t,"gainAgilityExp",(function(){return pe})),a.d(t,"gainCharismaExp",(function(){return de})),a.d(t,"gainIntelligenceExp",(function(){return fe})),a.d(t,"queryStatFromString",(function(){return ge})),a.d(t,"resetWorkStatus",(function(){return ye})),a.d(t,"processWorkEarnings",(function(){return be})),a.d(t,"startWork",(function(){return Ee})),a.d(t,"cancelationPenalty",(function(){return ve})),a.d(t,"work",(function(){return ke})),a.d(t,"finishWork",(function(){return _e})),a.d(t,"startWorkPartTime",(function(){return we})),a.d(t,"workPartTime",(function(){return Ce})),a.d(t,"finishWorkPartTime",(function(){return Se})),a.d(t,"startFocusing",(function(){return xe})),a.d(t,"stopFocusing",(function(){return Oe})),a.d(t,"startFactionWork",(function(){return Te})),a.d(t,"startFactionHackWork",(function(){return Me})),a.d(t,"startFactionFieldWork",(function(){return Pe})),a.d(t,"startFactionSecurityWork",(function(){return Re})),a.d(t,"workForFaction",(function(){return Ae})),a.d(t,"finishFactionWork",(function(){return Ne})),a.d(t,"getWorkMoneyGain",(function(){return Ie})),a.d(t,"getWorkHackExpGain",(function(){return je})),a.d(t,"getWorkStrExpGain",(function(){return Fe})),a.d(t,"getWorkDefExpGain",(function(){return De})),a.d(t,"getWorkDexExpGain",(function(){return Be})),a.d(t,"getWorkAgiExpGain",(function(){return Le})),a.d(t,"getWorkChaExpGain",(function(){return Ge})),a.d(t,"getWorkRepGain",(function(){return We})),a.d(t,"startCreateProgramWork",(function(){return He})),a.d(t,"createProgramWork",(function(){return Ue})),a.d(t,"finishCreateProgramWork",(function(){return qe})),a.d(t,"startClass",(function(){return Ke})),a.d(t,"takeClass",(function(){return $e})),a.d(t,"finishClass",(function(){return ze})),a.d(t,"startCrime",(function(){return Ye})),a.d(t,"commitCrime",(function(){return Ve})),a.d(t,"finishCrime",(function(){return Je})),a.d(t,"singularityStopWork",(function(){return Qe})),a.d(t,"takeDamage",(function(){return Xe})),a.d(t,"regenerateHp",(function(){return Ze})),a.d(t,"hospitalize",(function(){return et})),a.d(t,"applyForJob",(function(){return tt})),a.d(t,"getNextCompanyPosition",(function(){return at})),a.d(t,"quitJob",(function(){return nt})),a.d(t,"applyForSoftwareJob",(function(){return rt})),a.d(t,"applyForSoftwareConsultantJob",(function(){return it})),a.d(t,"applyForItJob",(function(){return ot})),a.d(t,"applyForSecurityEngineerJob",(function(){return st})),a.d(t,"applyForNetworkEngineerJob",(function(){return lt})),a.d(t,"applyForBusinessJob",(function(){return ct})),a.d(t,"applyForBusinessConsultantJob",(function(){return ut})),a.d(t,"applyForSecurityJob",(function(){return mt})),a.d(t,"applyForAgentJob",(function(){return ht})),a.d(t,"applyForEmployeeJob",(function(){return pt})),a.d(t,"applyForPartTimeEmployeeJob",(function(){return dt})),a.d(t,"applyForWaiterJob",(function(){return ft})),a.d(t,"applyForPartTimeWaiterJob",(function(){return gt})),a.d(t,"isQualified",(function(){return yt})),a.d(t,"reapplyAllAugmentations",(function(){return bt})),a.d(t,"reapplyAllSourceFiles",(function(){return Et})),a.d(t,"checkForFactionInvitations",(function(){return vt})),a.d(t,"setBitNodeNumber",(function(){return kt})),a.d(t,"queueAugmentation",(function(){return _t})),a.d(t,"gainCodingContractReward",(function(){return wt})),a.d(t,"travel",(function(){return Ct})),a.d(t,"gotoLocation",(function(){return St})),a.d(t,"canAccessResleeving",(function(){return xt})),a.d(t,"giveExploit",(function(){return Ot})),a.d(t,"getIntelligenceBonus",(function(){return Tt})),a.d(t,"getCasinoWinnings",(function(){return Mt}));var n=a(19),r=a(133),i=a(295),o=a(5),s=a(7),l=a(83),c=a(184),u=a(51),m=a(549),h=a(431),p=a(70),d=a(25),f=a(4),g=a(58),y=a(397),b=a(65),E=a(152),v=a(24),k=a(67),_=a(50),w=a(114),C=a(205),S=a(23),x=a(8),O=a(266),T=a(213),M=a(346),P=a(199),R=a(32),A=a(38),N=a(18),I=a(55),j=a(1106),F=a(1107),D=a(300),B=a(53),L=a(435),G=a(347),W=a(82),H=a(3),U=a(319),q=a(11),K=a(14),$=a(81),z=a(15),Y=a(0),V=a.n(Y);function J(){var e=Object(A.h)({adminRights:!0,hostname:"home",ip:Object(R.c)(),isConnectedTo:!0,maxRam:8,organizationName:"Home PC",purchasedByPlayer:!0});this.homeComputer=e.ip,this.currentServer=e.ip,Object(R.a)(e),this.getHomeComputer().programs.push(g.a.NukeProgram.name)}function Q(){var e=this.getHomeComputer();this.currentServer=e.ip,this.homeComputer=e.ip,this.numPeopleKilled=0,this.karma=0,this.hacking_skill=1,this.strength=1,this.defense=1,this.dexterity=1,this.agility=1,this.charisma=1,this.hacking_exp=0,this.strength_exp=0,this.defense_exp=0,this.dexterity_exp=0,this.agility_exp=0,this.charisma_exp=0,this.money=new W.a(1e3),this.city=S.a.Sector12,this.location="",this.companyName="",this.jobs={},this.purchasedServers=[],this.factions=[],this.factionInvitations=[],this.queuedAugmentations=[],this.resleeves=[];let t=Math.min(3,B.a[10]+(10===this.bitNodeN?1:0))+this.sleevesFromCovenant;this.sleeves.length>t&&(this.sleeves.length=t);for(let e=this.sleeves.length;e=100?this.sleeves[e].synchronize(this):this.sleeves[e].shockRecovery(this));this.isWorking=!1,this.currentWorkFactionName="",this.currentWorkFactionDescription="",this.createProgramName="",this.className="",this.crimeType="",this.workHackExpGainRate=0,this.workStrExpGainRate=0,this.workDefExpGainRate=0,this.workDexExpGainRate=0,this.workAgiExpGainRate=0,this.workChaExpGainRate=0,this.workRepGainRate=0,this.workMoneyGainRate=0,this.workHackExpGained=0,this.workStrExpGained=0,this.workDefExpGained=0,this.workDexExpGained=0,this.workAgiExpGained=0,this.workChaExpGained=0,this.workRepGained=0,this.workMoneyGained=0,this.timeWorked=0,this.lastUpdate=(new Date).getTime(),this.playtimeSinceLastAug=0,this.scriptProdSinceLastAug=0,this.moneySourceA.reset(),this.hacknetNodes.length=0,this.hashManager.prestige(),this.reapplyAllAugmentations(!0),this.hp=this.max_hp}function X(){this.prestigeAugmentation();for(let e=0;e0?this.intelligence=Math.floor(this.calculateSkill(this.intelligence_exp)):this.intelligence=0;var e=this.hp/this.max_hp;this.max_hp=Math.floor(10+this.defense/10),this.hp=Math.round(this.max_hp*e)}function ae(){this.hacking_chance_mult=1,this.hacking_speed_mult=1,this.hacking_money_mult=1,this.hacking_grow_mult=1,this.hacking_mult=1,this.strength_mult=1,this.defense_mult=1,this.dexterity_mult=1,this.agility_mult=1,this.charisma_mult=1,this.hacking_exp_mult=1,this.strength_exp_mult=1,this.defense_exp_mult=1,this.dexterity_exp_mult=1,this.agility_exp_mult=1,this.charisma_exp_mult=1,this.company_rep_mult=1,this.faction_rep_mult=1,this.crime_money_mult=1,this.crime_success_mult=1,this.hacknet_node_money_mult=1,this.hacknet_node_purchase_cost_mult=1,this.hacknet_node_ram_cost_mult=1,this.hacknet_node_core_cost_mult=1,this.hacknet_node_level_cost_mult=1,this.work_money_mult=1,this.bladeburner_max_stamina_mult=1,this.bladeburner_stamina_gain_mult=1,this.bladeburner_analysis_mult=1,this.bladeburner_success_chance_mult=1}function ne(e){const t=this.getHomeComputer();if(null==t)return!1;for(var a=0;a0||this.intelligence>0)&&(this.intelligence_exp+=e)}function ge(e){const t=e.toLowerCase();return t.includes("hack")?this.hacking_skill:t.includes("str")?this.strength:t.includes("def")?this.defense:t.includes("dex")?this.dexterity:t.includes("agi")?this.agility:t.includes("cha")?this.charisma:t.includes("int")?this.intelligence:void 0}function ye(e,t,a){e===this.workType&&t===this.companyName||e===this.workType&&t===this.currentWorkFactionName&&a===this.factionWorkType||(this.isWorking&&this.singularityStopWork(),this.workHackExpGainRate=0,this.workStrExpGainRate=0,this.workDefExpGainRate=0,this.workDexExpGainRate=0,this.workAgiExpGainRate=0,this.workChaExpGainRate=0,this.workRepGainRate=0,this.workMoneyGainRate=0,this.workMoneyLossRate=0,this.workHackExpGained=0,this.workStrExpGained=0,this.workDefExpGained=0,this.workDexExpGained=0,this.workAgiExpGained=0,this.workChaExpGained=0,this.workRepGained=0,this.workMoneyGained=0,this.timeWorked=0,this.timeWorkedCreateProgram=0,this.currentWorkFactionName="",this.currentWorkFactionDescription="",this.createProgramName="",this.className="")}function be(e=1){const t=this.focus?1:.8,a=t*this.workHackExpGainRate*e,n=t*this.workStrExpGainRate*e,r=t*this.workDefExpGainRate*e,i=t*this.workDexExpGainRate*e,o=t*this.workAgiExpGainRate*e,s=t*this.workChaExpGainRate*e,l=(this.workMoneyGainRate-this.workMoneyLossRate)*e;this.gainHackingExp(a),this.gainStrengthExp(n),this.gainDefenseExp(r),this.gainDexterityExp(i),this.gainAgilityExp(o),this.gainCharismaExp(s),this.gainMoney(l),this.className?this.recordMoneySource(l,"class"):this.recordMoneySource(l,"work"),this.workHackExpGained+=a,this.workStrExpGained+=n,this.workDefExpGained+=r,this.workDexExpGained+=i,this.workAgiExpGained+=o,this.workChaExpGained+=s,this.workRepGained+=t*this.workRepGainRate*e,this.workMoneyGained+=t*this.workMoneyGainRate*e,this.workMoneyGained-=t*this.workMoneyLossRate*e}function Ee(e,t){this.resetWorkStatus(f.a.WorkTypeCompany,t),this.isWorking=!0,this.focus=!0,this.companyName=t,this.workType=f.a.WorkTypeCompany,this.workHackExpGainRate=this.getWorkHackExpGain(),this.workStrExpGainRate=this.getWorkStrExpGain(),this.workDefExpGainRate=this.getWorkDefExpGain(),this.workDexExpGainRate=this.getWorkDexExpGain(),this.workAgiExpGainRate=this.getWorkAgiExpGain(),this.workChaExpGainRate=this.getWorkChaExpGain(),this.workRepGainRate=this.getWorkRepGain(),this.workMoneyGainRate=this.getWorkMoneyGain(),this.timeNeededToCompleteWork=f.a.MillisecondsPer8Hours,e.toWork()}function ve(){const e=I.a[this.companyName];if(e){const t=R.b[e];if(t&&t.backdoorInstalled)return.75}return.5}function ke(e){var t=!1;this.timeWorked+f.a._idleSpeed*e>=f.a.MillisecondsPer8Hours&&(t=!0,e=Math.round((f.a.MillisecondsPer8Hours-this.timeWorked)/f.a._idleSpeed)),this.timeWorked+=f.a._idleSpeed*e,this.workRepGainRate=this.getWorkRepGain(),this.processWorkEarnings(e);const a=u.a[this.companyName];return Object(L.a)(a,this.workRepGainRate,e),!!(t||this.timeWorked>=f.a.MillisecondsPer8Hours)&&this.finishWork(!1)}function _e(e,t=!1){e&&(this.workRepGained*=this.cancelationPenalty());u.a[this.companyName].playerReputation+=this.workRepGained,this.updateSkillLevels();let a=V.a.createElement(V.a.Fragment,null,"You earned a total of: ",V.a.createElement("br",null),V.a.createElement(z.a,{money:this.workMoneyGained}),V.a.createElement("br",null),Object($.a)(this.workRepGained)," reputation for the company ",V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking exp ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength exp ",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense exp ",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity exp ",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility exp ",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma exp",V.a.createElement("br",null));if(a=e?V.a.createElement(V.a.Fragment,null,"You worked a short shift of ",Object(K.b)(this.timeWorked)," ",V.a.createElement("br",null),V.a.createElement("br",null),"Since you cancelled your work early, you only gained half of the reputation you earned. ",V.a.createElement("br",null),V.a.createElement("br",null),a):V.a.createElement(V.a.Fragment,null,"You worked a full shift of 8 hours! ",V.a.createElement("br",null),V.a.createElement("br",null),a),t||Object(q.a)(a),this.isWorking=!1,t){var n="You worked a short shift of "+Object(K.b)(this.timeWorked)+" and earned $"+H.a.formatMoney(this.workMoneyGained)+", "+H.a.formatReputation(this.workRepGained)+" reputation, "+H.a.formatExp(this.workHackExpGained)+" hacking exp, "+H.a.formatExp(this.workStrExpGained)+" strength exp, "+H.a.formatExp(this.workDefExpGained)+" defense exp, "+H.a.formatExp(this.workDexExpGained)+" dexterity exp, "+H.a.formatExp(this.workAgiExpGained)+" agility exp, and "+H.a.formatExp(this.workChaExpGained)+" charisma exp.";return this.resetWorkStatus(),n}this.resetWorkStatus()}function we(e,t){this.resetWorkStatus(f.a.WorkTypeCompanyPartTime,t),this.isWorking=!0,this.focus=!0,this.companyName=t,this.workType=f.a.WorkTypeCompanyPartTime,this.workHackExpGainRate=this.getWorkHackExpGain(),this.workStrExpGainRate=this.getWorkStrExpGain(),this.workDefExpGainRate=this.getWorkDefExpGain(),this.workDexExpGainRate=this.getWorkDexExpGain(),this.workAgiExpGainRate=this.getWorkAgiExpGain(),this.workChaExpGainRate=this.getWorkChaExpGain(),this.workRepGainRate=this.getWorkRepGain(),this.workMoneyGainRate=this.getWorkMoneyGain(),this.timeNeededToCompleteWork=f.a.MillisecondsPer8Hours,e.toWork()}function Ce(e){var t=!1;return this.timeWorked+f.a._idleSpeed*e>=f.a.MillisecondsPer8Hours&&(t=!0,e=Math.round((f.a.MillisecondsPer8Hours-this.timeWorked)/f.a._idleSpeed)),this.timeWorked+=f.a._idleSpeed*e,this.workRepGainRate=this.getWorkRepGain(),this.processWorkEarnings(e),!!(t||this.timeWorked>=f.a.MillisecondsPer8Hours)&&this.finishWorkPartTime()}function Se(e=!1){u.a[this.companyName].playerReputation+=this.workRepGained,this.updateSkillLevels();const t=V.a.createElement(V.a.Fragment,null,"You worked for ",Object(K.b)(this.timeWorked),V.a.createElement("br",null),V.a.createElement("br",null),"You earned a total of: ",V.a.createElement("br",null),V.a.createElement(z.a,{money:this.workMoneyGained}),V.a.createElement("br",null),Object($.a)(this.workRepGained)," reputation for the company ",V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking exp ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength exp ",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense exp ",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity exp ",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility exp ",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma exp",V.a.createElement("br",null));if(e||Object(q.a)(t),this.isWorking=!1,e){var a="You worked for "+Object(K.b)(this.timeWorked)+" and earned a total of $"+H.a.formatMoney(this.workMoneyGained)+", "+H.a.formatReputation(this.workRepGained)+" reputation, "+H.a.formatExp(this.workHackExpGained)+" hacking exp, "+H.a.formatExp(this.workStrExpGained)+" strength exp, "+H.a.formatExp(this.workDefExpGained)+" defense exp, "+H.a.formatExp(this.workDexExpGained)+" dexterity exp, "+H.a.formatExp(this.workAgiExpGained)+" agility exp, and "+H.a.formatExp(this.workChaExpGained)+" charisma exp";return this.resetWorkStatus(),a}this.resetWorkStatus()}function xe(){this.focus=!0}function Oe(){this.focus=!1}function Te(e,t){var a=1+t.favor/100;isNaN(a)&&(a=1),this.workRepGainRate*=a,this.workRepGainRate*=s.a.FactionWorkRepGain,this.isWorking=!0,this.focus=!0,this.workType=f.a.WorkTypeFaction,this.currentWorkFactionName=t.name,this.timeNeededToCompleteWork=f.a.MillisecondsPer20Hours,e.toWork()}function Me(e,t){this.resetWorkStatus(f.a.WorkTypeFaction,t.name,f.a.FactionWorkHacking),this.workHackExpGainRate=.15*this.hacking_exp_mult*s.a.FactionWorkExpGain,this.workRepGainRate=(this.hacking_skill+this.intelligence)/f.a.MaxSkillLevel*this.faction_rep_mult*this.getIntelligenceBonus(.5),this.factionWorkType=f.a.FactionWorkHacking,this.currentWorkFactionDescription="carrying out hacking contracts",this.startFactionWork(e,t)}function Pe(e,t){this.resetWorkStatus(f.a.WorkTypeFaction,t.name,f.a.FactionWorkField),this.workHackExpGainRate=.1*this.hacking_exp_mult*s.a.FactionWorkExpGain,this.workStrExpGainRate=.1*this.strength_exp_mult*s.a.FactionWorkExpGain,this.workDefExpGainRate=.1*this.defense_exp_mult*s.a.FactionWorkExpGain,this.workDexExpGainRate=.1*this.dexterity_exp_mult*s.a.FactionWorkExpGain,this.workAgiExpGainRate=.1*this.agility_exp_mult*s.a.FactionWorkExpGain,this.workChaExpGainRate=.1*this.charisma_exp_mult*s.a.FactionWorkExpGain,this.workRepGainRate=Object(P.a)(this,t),this.factionWorkType=f.a.FactionWorkField,this.currentWorkFactionDescription="carrying out field missions",this.startFactionWork(e,t)}function Re(e,t){this.resetWorkStatus(f.a.WorkTypeFaction,t.name,f.a.FactionWorkSecurity),this.workHackExpGainRate=.05*this.hacking_exp_mult*s.a.FactionWorkExpGain,this.workStrExpGainRate=.15*this.strength_exp_mult*s.a.FactionWorkExpGain,this.workDefExpGainRate=.15*this.defense_exp_mult*s.a.FactionWorkExpGain,this.workDexExpGainRate=.15*this.dexterity_exp_mult*s.a.FactionWorkExpGain,this.workAgiExpGainRate=.15*this.agility_exp_mult*s.a.FactionWorkExpGain,this.workChaExpGainRate=0*this.charisma_exp_mult*s.a.FactionWorkExpGain,this.workRepGainRate=Object(P.b)(this,t),this.factionWorkType=f.a.FactionWorkSecurity,this.currentWorkFactionDescription="performing security detail",this.startFactionWork(e,t)}function Ae(e){const t=v.a[this.currentWorkFactionName];switch(this.factionWorkType){case f.a.FactionWorkHacking:this.workRepGainRate=Object(P.c)(this,t);break;case f.a.FactionWorkField:this.workRepGainRate=Object(P.a)(this,t);break;case f.a.FactionWorkSecurity:this.workRepGainRate=Object(P.b)(this,t)}var a=!1;return this.timeWorked+f.a._idleSpeed*e>=f.a.MillisecondsPer20Hours&&(a=!0,e=Math.round((f.a.MillisecondsPer20Hours-this.timeWorked)/f.a._idleSpeed)),this.timeWorked+=f.a._idleSpeed*e,this.processWorkEarnings(e),!!(a||this.timeWorked>=f.a.MillisecondsPer20Hours)&&(this.finishFactionWork(!1),!0)}function Ne(e,t=!1){var a=v.a[this.currentWorkFactionName];if(a.playerReputation+=this.workRepGained,this.updateSkillLevels(),t||Object(q.a)(V.a.createElement(V.a.Fragment,null,"You worked for your faction ",a.name," for a total of ",Object(K.b)(this.timeWorked)," ",V.a.createElement("br",null),V.a.createElement("br",null),"You earned a total of: ",V.a.createElement("br",null),V.a.createElement(z.a,{money:this.workMoneyGained}),V.a.createElement("br",null),Object($.a)(this.workRepGained)," reputation for the faction ",V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking exp ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength exp ",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense exp ",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity exp ",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility exp ",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma exp",V.a.createElement("br",null))),this.isWorking=!1,t){var n="You worked for your faction "+a.name+" for a total of "+Object(K.b)(this.timeWorked)+". You earned "+H.a.formatReputation(this.workRepGained)+" rep, "+H.a.formatExp(this.workHackExpGained)+" hacking exp, "+H.a.formatExp(this.workStrExpGained)+" str exp, "+H.a.formatExp(this.workDefExpGained)+" def exp, "+H.a.formatExp(this.workDexExpGained)+" dex exp, "+H.a.formatExp(this.workAgiExpGained)+" agi exp, and "+H.a.formatExp(this.workChaExpGained)+" cha exp.";return this.resetWorkStatus(),n}this.resetWorkStatus()}function Ie(){let e=1;const t=u.a[this.companyName];B.a[11]>0&&(e=1+t.favor/100);const a=this.jobs[this.companyName],n=p.a[a];return null==n?(console.error(`Could not find CompanyPosition object for ${a}. Work salary will be 0`),0):n.baseSalary*t.salaryMultiplier*this.work_money_mult*s.a.CompanyWorkMoney*e}function je(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work hack exp gain will be 0"].join(" ")),0):a.hackingExpGain*e.expMultiplier*this.hacking_exp_mult*s.a.CompanyWorkExpGain}function Fe(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work str exp gain will be 0"].join(" ")),0):a.strengthExpGain*e.expMultiplier*this.strength_exp_mult*s.a.CompanyWorkExpGain}function De(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work def exp gain will be 0"].join(" ")),0):a.defenseExpGain*e.expMultiplier*this.defense_exp_mult*s.a.CompanyWorkExpGain}function Be(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work dex exp gain will be 0"].join(" ")),0):a.dexterityExpGain*e.expMultiplier*this.dexterity_exp_mult*s.a.CompanyWorkExpGain}function Le(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work agi exp gain will be 0"].join(" ")),0):a.agilityExpGain*e.expMultiplier*this.agility_exp_mult*s.a.CompanyWorkExpGain}function Ge(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work cha exp gain will be 0"].join(" ")),0):a.charismaExpGain*e.expMultiplier*this.charisma_exp_mult*s.a.CompanyWorkExpGain}function We(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];if(null==e||null==a)return console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work rep gain will be 0"].join(" ")),0;var n=a.calculateJobPerformance(this.hacking_skill,this.strength,this.defense,this.dexterity,this.agility,this.charisma);n+=this.intelligence/f.a.MaxSkillLevel;var r=1+e.favor/100;return isNaN(r)&&(r=1),n*this.company_rep_mult*r}function He(e,t,a,n){this.resetWorkStatus(),this.isWorking=!0,this.focus=!0,this.workType=f.a.WorkTypeCreateProgram,this.createProgramReqLvl=n,this.timeNeededToCompleteWork=a;for(var r=0;r=100)break;this.timeWorkedCreateProgram=s/100*this.timeNeededToCompleteWork,this.getHomeComputer().programs.splice(r,1)}}this.createProgramName=t,e.toWork()}function Ue(e){var t=this.createProgramReqLvl,a=this.hacking_skill/t*this.getIntelligenceBonus(3);return a=1+(a-1)/5,this.timeWorked+=f.a._idleSpeed*e,this.timeWorkedCreateProgram+=f.a._idleSpeed*e*a,this.timeWorkedCreateProgram>=this.timeNeededToCompleteWork&&(this.finishCreateProgramWork(!1),!0)}function qe(e){var t=this.createProgramName;if(!1===e)Object(q.a)("You've finished creating "+t+"!
The new program can be found on your home computer."),this.getHomeComputer().programs.push(t);else{var a=t+"-"+(Math.floor(this.timeWorkedCreateProgram/this.timeNeededToCompleteWork*1e4)/100).toString()+"%-INC";this.getHomeComputer().programs.push(a)}e||this.gainIntelligenceExp(this.createProgramReqLvl/f.a.IntelligenceProgramBaseExpGain),this.isWorking=!1,this.resetWorkStatus()}function Ke(e,t,a,n){this.resetWorkStatus(),this.isWorking=!0,this.focus=!0,this.workType=f.a.WorkTypeStudyClass,this.className=n;const r=1e3/f.a._idleSpeed;var i=0,o=0,l=0,c=0,u=0,m=0,h=0;const p=this.hashManager;switch(n){case f.a.ClassStudyComputerScience:o=f.a.ClassStudyComputerScienceBaseExp*a/r*p.getStudyMult();break;case f.a.ClassDataStructures:i=f.a.ClassDataStructuresBaseCost*t/r,o=f.a.ClassDataStructuresBaseExp*a/r*p.getStudyMult();break;case f.a.ClassNetworks:i=f.a.ClassNetworksBaseCost*t/r,o=f.a.ClassNetworksBaseExp*a/r*p.getStudyMult();break;case f.a.ClassAlgorithms:i=f.a.ClassAlgorithmsBaseCost*t/r,o=f.a.ClassAlgorithmsBaseExp*a/r*p.getStudyMult();break;case f.a.ClassManagement:i=f.a.ClassManagementBaseCost*t/r,h=f.a.ClassManagementBaseExp*a/r*p.getStudyMult();break;case f.a.ClassLeadership:i=f.a.ClassLeadershipBaseCost*t/r,h=f.a.ClassLeadershipBaseExp*a/r*p.getStudyMult();break;case f.a.ClassGymStrength:i=f.a.ClassGymBaseCost*t/r,l=a/r*p.getTrainingMult();break;case f.a.ClassGymDefense:i=f.a.ClassGymBaseCost*t/r,c=a/r*p.getTrainingMult();break;case f.a.ClassGymDexterity:i=f.a.ClassGymBaseCost*t/r,u=a/r*p.getTrainingMult();break;case f.a.ClassGymAgility:i=f.a.ClassGymBaseCost*t/r,m=a/r*p.getTrainingMult();break;default:throw new Error("ERR: Invalid/unrecognized class name")}this.workMoneyLossRate=i,this.workHackExpGainRate=o*this.hacking_exp_mult*s.a.ClassGymExpGain,this.workStrExpGainRate=l*this.strength_exp_mult*s.a.ClassGymExpGain,this.workDefExpGainRate=c*this.defense_exp_mult*s.a.ClassGymExpGain,this.workDexExpGainRate=u*this.dexterity_exp_mult*s.a.ClassGymExpGain,this.workAgiExpGainRate=m*this.agility_exp_mult*s.a.ClassGymExpGain,this.workChaExpGainRate=h*this.charisma_exp_mult*s.a.ClassGymExpGain,e.toWork()}function $e(e){return this.timeWorked+=f.a._idleSpeed*e,this.processWorkEarnings(e),!1}function ze(e=!1){if(this.gainIntelligenceExp(f.a.IntelligenceClassBaseExpGain*Math.round(this.timeWorked/1e3)),this.workMoneyGained>0)throw new Error("ERR: Somehow gained money while taking class");if(this.updateSkillLevels(),e||Object(q.a)(V.a.createElement(V.a.Fragment,null,"After ",this.className," for ",Object(K.b)(this.timeWorked),", ",V.a.createElement("br",null),"you spent a total of ",V.a.createElement(z.a,{money:-this.workMoneyGained}),". ",V.a.createElement("br",null),V.a.createElement("br",null),"You earned a total of: ",V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking exp ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength exp ",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense exp ",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity exp ",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility exp ",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma exp",V.a.createElement("br",null))),this.isWorking=!1,e){var t="After "+this.className+" for "+Object(K.b)(this.timeWorked)+", you spent a total of "+H.a.formatMoney(-1*this.workMoneyGained)+". You earned a total of: "+H.a.formatExp(this.workHackExpGained)+" hacking exp, "+H.a.formatExp(this.workStrExpGained)+" strength exp, "+H.a.formatExp(this.workDefExpGained)+" defense exp, "+H.a.formatExp(this.workDexExpGained)+" dexterity exp, "+H.a.formatExp(this.workAgiExpGained)+" agility exp, and "+H.a.formatExp(this.workChaExpGained)+" charisma exp";return this.resetWorkStatus(),t}this.resetWorkStatus()}function Ye(e,t,a,n,r,i,o,l,c,u,m=null){this.crimeType=t,this.resetWorkStatus(),this.isWorking=!0,this.focus=!0,this.workType=f.a.WorkTypeCrime,m&&m.workerscript&&(this.committingCrimeThruSingFn=!0,this.singFnCrimeWorkerScript=m.workerscript),this.workHackExpGained=a*this.hacking_exp_mult*s.a.CrimeExpGain,this.workStrExpGained=n*this.strength_exp_mult*s.a.CrimeExpGain,this.workDefExpGained=r*this.defense_exp_mult*s.a.CrimeExpGain,this.workDexExpGained=i*this.dexterity_exp_mult*s.a.CrimeExpGain,this.workAgiExpGained=o*this.agility_exp_mult*s.a.CrimeExpGain,this.workChaExpGained=l*this.charisma_exp_mult*s.a.CrimeExpGain,this.workMoneyGained=c*this.crime_money_mult*s.a.CrimeMoney,this.timeNeededToCompleteWork=u,e.toWork()}function Ve(e){return this.timeWorked+=f.a._idleSpeed*e,this.timeWorked>=this.timeNeededToCompleteWork&&(this.finishCrime(!1),!0)}function Je(e){if(!e){if(Object(y.a)(this,this.crimeType)){let e=null;for(const t in b.a)if(b.a[t].type==this.crimeType){e=b.a[t];break}null==e&&Object(q.a)(`ERR: Unrecognized crime type (${this.crimeType}). This is probably a bug please contact the developer`),this.gainMoney(this.workMoneyGained),this.recordMoneySource(this.workMoneyGained,"crime"),this.karma-=e.karma,this.numPeopleKilled+=e.kills,e.intelligence_exp>0&&this.gainIntelligenceExp(e.intelligence_exp),this.workHackExpGained*=2,this.workStrExpGained*=2,this.workDefExpGained*=2,this.workDexExpGained*=2,this.workAgiExpGained*=2,this.workChaExpGained*=2,this.committingCrimeThruSingFn?null==this.singFnCrimeWorkerScript.disableLogs.ALL&&null==this.singFnCrimeWorkerScript.disableLogs.commitCrime&&this.singFnCrimeWorkerScript.scriptRef.log("Crime successful! Gained "+H.a.formatMoney(this.workMoneyGained)+", "+H.a.formatExp(this.workHackExpGained)+" hack exp, "+H.a.formatExp(this.workStrExpGained)+" str exp, "+H.a.formatExp(this.workDefExpGained)+" def exp, "+H.a.formatExp(this.workDexExpGained)+" dex exp, "+H.a.formatExp(this.workAgiExpGained)+" agi exp, "+H.a.formatExp(this.workChaExpGained)+" cha exp."):Object(q.a)(V.a.createElement(V.a.Fragment,null,"Crime successful!",V.a.createElement("br",null),V.a.createElement("br",null),"You gained:",V.a.createElement("br",null),V.a.createElement(z.a,{money:this.workMoneyGained}),V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking experience ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength experience",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense experience",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity experience",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility experience",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma experience"))}else this.workHackExpGained/=2,this.workStrExpGained/=2,this.workDefExpGained/=2,this.workDexExpGained/=2,this.workAgiExpGained/=2,this.workChaExpGained/=2,this.committingCrimeThruSingFn?null==this.singFnCrimeWorkerScript.disableLogs.ALL&&null==this.singFnCrimeWorkerScript.disableLogs.commitCrime&&this.singFnCrimeWorkerScript.scriptRef.log("Crime failed! Gained "+H.a.formatExp(this.workHackExpGained)+" hack exp, "+H.a.formatExp(this.workStrExpGained)+" str exp, "+H.a.formatExp(this.workDefExpGained)+" def exp, "+H.a.formatExp(this.workDexExpGained)+" dex exp, "+H.a.formatExp(this.workAgiExpGained)+" agi exp, "+H.a.formatExp(this.workChaExpGained)+" cha exp."):Object(q.a)(V.a.createElement(V.a.Fragment,null,"Crime failed!",V.a.createElement("br",null),V.a.createElement("br",null),"You gained:",V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking experience ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength experience",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense experience",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity experience",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility experience",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma experience"));this.gainHackingExp(this.workHackExpGained),this.gainStrengthExp(this.workStrExpGained),this.gainDefenseExp(this.workDefExpGained),this.gainDexterityExp(this.workDexExpGained),this.gainAgilityExp(this.workAgiExpGained),this.gainCharismaExp(this.workChaExpGained)}this.committingCrimeThruSingFn=!1,this.singFnCrimeWorkerScript=null,this.isWorking=!1,this.crimeType="",this.resetWorkStatus()}function Qe(){if(!this.isWorking)return"";var e;switch(this.workType){case f.a.WorkTypeStudyClass:e=this.finishClass(!0);break;case f.a.WorkTypeCompany:e=this.finishWork(!0,!0);break;case f.a.WorkTypeCompanyPartTime:e=this.finishWorkPartTime(!0);break;case f.a.WorkTypeFaction:e=this.finishFactionWork(!0,!0);break;case f.a.WorkTypeCreateProgram:e=this.finishCreateProgramWork(!0);break;case f.a.WorkTypeCrime:e=this.finishCrime(!0);break;default:return console.error(`Unrecognized work type (${this.workType})`),""}return e}function Xe(e){if("number"==typeof e)return this.hp-=e,this.hp<=0&&(this.hospitalize(),!0);console.warn("Player.takeDamage() called without a numeric argument: "+e)}function Ze(e){"number"==typeof e?(this.hp+=e,this.hp>this.max_hp&&(this.hp=this.max_hp)):console.warn("Player.regenerateHp() called without a numeric argument: "+e)}function et(){const e=Object(G.b)(this);return!1===N.a.SuppressHospitalizationPopup&&Object(q.a)(V.a.createElement(V.a.Fragment,null,"You were in critical condition! You were taken to the hospital where luckily they were able to save your life. You were charged ",V.a.createElement(z.a,{money:e}))),this.loseMoney(e),this.recordMoneySource(-1*e,"hospitalization"),this.hp=this.max_hp,e}function tt(e,t=!1){let a=null;""!==this.companyName&&(a=u.a[this.companyName]);const n=this.jobs[this.companyName],r=u.a[this.location];if(!(r instanceof c.a))return t?"ERROR: Invalid company name: "+this.location+". applyToCompany() failed":void console.error(`Could not find company that matches the location: ${this.location}. Player.applyToCompany() failed`);let i=e;if(!this.isQualified(r,i)){var o=Object(h.a)(r,i);return!t&&void Object(q.a)("Unforunately, you do not qualify for this position
"+o)}for(;;){let e=Object(m.a)(i);if(null==e)break;if(!r.hasPosition(e))break;if(!this.isQualified(r,e))break;i=e}if(null==a||a.name!=r.name||i.name!=n){if(this.jobs[r.name]=i.name,this.companyName=this.location,t)return!0;Object(q.a)("Congratulations! You were offered a new job at "+this.companyName+" as a "+i.name+"!")}else{var s=Object(m.a)(i);if(null==s){if(t)return!1;Object(q.a)("You are already at the highest position for your field! No promotion available")}else if(r.hasPosition(s)){if(t)return!1;o=Object(h.a)(r,s);Object(q.a)("Unfortunately, you do not qualify for a promotion
"+o)}else{if(t)return!1;Object(q.a)("You are already at the highest position for your field! No promotion available")}}}function at(e,t){var a=null;if(""!==this.companyName&&(a=u.a[this.companyName]),null==a||a.name!=e.name)return t;const n=this.jobs[this.companyName],r=p.a[n];return r.isSoftwareJob()&&t.isSoftwareJob()||r.isITJob()&&t.isITJob()||r.isBusinessJob()&&t.isBusinessJob()||r.isSecurityEngineerJob()&&t.isSecurityEngineerJob()||r.isNetworkEngineerJob()&&t.isNetworkEngineerJob()||r.isSecurityJob()&&t.isSecurityJob()||r.isAgentJob()&&t.isAgentJob()||r.isSoftwareConsultantJob()&&t.isSoftwareConsultantJob()||r.isBusinessConsultantJob()&&t.isBusinessConsultantJob()||r.isPartTimeJob()&&t.isPartTimeJob()?Object(m.a)(r):t}function nt(e){this.isWorking=!1,this.companyName="",delete this.jobs[e]}function rt(e=!1){return this.applyForJob(p.a[d.j[0]],e)}function it(e=!1){return this.applyForJob(p.a[d.k[0]],e)}function ot(e=!1){return this.applyForJob(p.a[d.d[0]],e)}function st(e=!1){var t=u.a[this.location];return this.isQualified(t,p.a[d.i[0]])?this.applyForJob(p.a[d.i[0]],e):!e&&void Object(q.a)("Unforunately, you do not qualify for this position")}function lt(e=!1){var t=u.a[this.location];return this.isQualified(t,p.a[d.f[0]])?this.applyForJob(p.a[d.f[0]],e):!e&&void Object(q.a)("Unforunately, you do not qualify for this position")}function ct(e=!1){return this.applyForJob(p.a[d.b[0]],e)}function ut(e=!1){return this.applyForJob(p.a[d.c[0]],e)}function mt(e=!1){return this.applyForJob(p.a[d.h[2]],e)}function ht(e=!1){var t=u.a[this.location];return this.isQualified(t,p.a[d.a[0]])?this.applyForJob(p.a[d.a[0]],e):!e&&void Object(q.a)("Unforunately, you do not qualify for this position")}function pt(e=!1){var t=u.a[this.location];if(this.isQualified(t,p.a[d.e[1]])){if(this.companyName=t.name,this.jobs[t.name]=d.e[1],e)return!0;Object(q.a)("Congratulations, you are now employed at "+this.companyName)}else{if(e)return!1;Object(q.a)("Unforunately, you do not qualify for this position")}}function dt(e=!1){var t=u.a[this.location];if(this.isQualified(t,p.a[d.g[1]])){if(this.jobs[t.name]=d.g[1],e)return!0;Object(q.a)("Congratulations, you are now employed part-time at "+this.companyName)}else{if(e)return!1;Object(q.a)("Unforunately, you do not qualify for this position")}}function ft(e=!1){var t=u.a[this.location];if(this.isQualified(t,p.a[d.e[0]])){if(this.companyName=t.name,this.jobs[t.name]=d.e[0],e)return!0;Object(q.a)("Congratulations, you are now employed as a waiter at "+this.companyName)}else{if(e)return!1;Object(q.a)("Unforunately, you do not qualify for this position")}}function gt(e=!1){var t=u.a[this.location];if(this.isQualified(t,p.a[d.g[0]])){if(this.companyName=t.name,this.jobs[t.name]=d.g[0],e)return!0;Object(q.a)("Congratulations, you are now employed as a part-time waiter at "+this.companyName)}else{if(e)return!1;Object(q.a)("Unforunately, you do not qualify for this position")}}function yt(e,t){var a=e.jobStatReqOffset,n=t.requiredHacking>0?t.requiredHacking+a:0,r=t.requiredStrength>0?t.requiredStrength+a:0,i=t.requiredDefense>0?t.requiredDefense+a:0,o=t.requiredDexterity>0?t.requiredDexterity+a:0,s=t.requiredDexterity>0?t.requiredDexterity+a:0,l=t.requiredCharisma>0?t.requiredCharisma+a:0;return this.hacking_skill>=n&&this.strength>=r&&this.defense>=i&&this.dexterity>=o&&this.agility>=s&&this.charisma>=l&&e.playerReputation>=t.requiredReputation}function bt(e=!0){e&&this.resetMultipliers();for(let e=0;et}var i=v.a.Illuminati;!i.isBanned&&!i.isMember&&!i.alreadyInvited&&t>=30&&this.money.gte(15e10)&&this.hacking_skill>=1500&&this.strength>=1200&&this.defense>=1200&&this.dexterity>=1200&&this.agility>=1200&&e.push(i);var o=v.a.Daedalus;!o.isBanned&&!o.isMember&&!o.alreadyInvited&&t>=Math.round(30*s.a.DaedalusAugsRequirement)&&this.money.gte(1e11)&&(this.hacking_skill>=2500||this.strength>=1500&&this.defense>=1500&&this.dexterity>=1500&&this.agility>=1500)&&e.push(o);var l=v.a["The Covenant"];!l.isBanned&&!l.isMember&&!l.alreadyInvited&&t>=20&&this.money.gte(75e9)&&this.hacking_skill>=850&&this.strength>=850&&this.defense>=850&&this.dexterity>=850&&this.agility>=850&&e.push(l);var c=v.a.ECorp;c.isBanned||c.isMember||c.alreadyInvited||!r(x.a.AevumECorp)||e.push(c);var m=v.a.MegaCorp;m.isBanned||m.isMember||m.alreadyInvited||!r(x.a.Sector12MegaCorp)||e.push(m);var h=v.a["Bachman & Associates"];h.isBanned||h.isMember||h.alreadyInvited||!r(x.a.AevumBachmanAndAssociates)||e.push(h);var p=v.a["Blade Industries"];p.isBanned||p.isMember||p.alreadyInvited||!r(x.a.Sector12BladeIndustries)||e.push(p);var d=v.a.NWO;d.isBanned||d.isMember||d.alreadyInvited||!r(x.a.VolhavenNWO)||e.push(d);var g=v.a["Clarke Incorporated"];g.isBanned||g.isMember||g.alreadyInvited||!r(x.a.AevumClarkeIncorporated)||e.push(g);var y=v.a["OmniTek Incorporated"];y.isBanned||y.isMember||y.alreadyInvited||!r(x.a.VolhavenOmniTekIncorporated)||e.push(y);var b=v.a["Four Sigma"];b.isBanned||b.isMember||b.alreadyInvited||!r(x.a.Sector12FourSigma)||e.push(b);var E=v.a["KuaiGong International"];E.isBanned||E.isMember||E.alreadyInvited||!r(x.a.ChongqingKuaiGongInternational)||e.push(E);var k=v.a["Fulcrum Secret Technologies"],w=R.b[I.a[I.b.FulcrumSecretTechnologies]];null==w?console.error("Could not find Fulcrum Secret Technologies Server"):k.isBanned||k.isMember||k.alreadyInvited||!w.backdoorInstalled||!r(x.a.AevumFulcrumTechnologies,25e4)||e.push(k);var C=v.a.BitRunners,O=R.b[I.a[I.b.BitRunnersServer]];null==O?console.error("Could not find BitRunners Server"):C.isBanned||C.isMember||!O.backdoorInstalled||C.alreadyInvited||e.push(C);var T=v.a["The Black Hand"],M=R.b[I.a[I.b.TheBlackHandServer]];null==M?console.error("Could not find The Black Hand Server"):T.isBanned||T.isMember||!M.backdoorInstalled||T.alreadyInvited||e.push(T);var P=v.a.NiteSec,A=R.b[I.a[I.b.NiteSecServer]];null==A?console.error("Could not find NiteSec Server"):P.isBanned||P.isMember||!A.backdoorInstalled||P.alreadyInvited||e.push(P);var N=v.a.Chongqing;N.isBanned||N.isMember||N.alreadyInvited||!this.money.gte(2e7)||this.city!=S.a.Chongqing||e.push(N);var j=v.a["Sector-12"];j.isBanned||j.isMember||j.alreadyInvited||!this.money.gte(15e6)||this.city!=S.a.Sector12||e.push(j);var F=v.a["New Tokyo"];F.isBanned||F.isMember||F.alreadyInvited||!this.money.gte(2e7)||this.city!=S.a.NewTokyo||e.push(F);var D=v.a.Aevum;D.isBanned||D.isMember||D.alreadyInvited||!this.money.gte(4e7)||this.city!=S.a.Aevum||e.push(D);var B=v.a.Ishima;B.isBanned||B.isMember||B.alreadyInvited||!this.money.gte(3e7)||this.city!=S.a.Ishima||e.push(B);var L=v.a.Volhaven;L.isBanned||L.isMember||L.alreadyInvited||!this.money.gte(5e7)||this.city!=S.a.Volhaven||e.push(L);var G=v.a["Speakers for the Dead"];!G.isBanned&&!G.isMember&&!G.alreadyInvited&&this.hacking_skill>=100&&this.strength>=300&&this.defense>=300&&this.dexterity>=300&&this.agility>=300&&this.numPeopleKilled>=30&&this.karma<=-45&&!a.includes(x.a.Sector12CIA)&&!a.includes(x.a.Sector12NSA)&&e.push(G);var W=v.a["The Dark Army"];!W.isBanned&&!W.isMember&&!W.alreadyInvited&&this.hacking_skill>=300&&this.strength>=300&&this.defense>=300&&this.dexterity>=300&&this.agility>=300&&this.city==S.a.Chongqing&&this.numPeopleKilled>=5&&this.karma<=-45&&!a.includes(x.a.Sector12CIA)&&!a.includes(x.a.Sector12NSA)&&e.push(W);var H=v.a["The Syndicate"];!H.isBanned&&!H.isMember&&!H.alreadyInvited&&this.hacking_skill>=200&&this.strength>=200&&this.defense>=200&&this.dexterity>=200&&this.agility>=200&&(this.city==S.a.Aevum||this.city==S.a.Sector12)&&this.money.gte(1e7)&&this.karma<=-90&&!a.includes(x.a.Sector12CIA)&&!a.includes(x.a.Sector12NSA)&&e.push(H);var U=v.a.Silhouette;!U.isBanned&&!U.isMember&&!U.alreadyInvited&&(n.includes("Chief Technology Officer")||n.includes("Chief Financial Officer")||n.includes("Chief Executive Officer"))&&this.money.gte(15e6)&&this.karma<=-22&&e.push(U);var q=v.a.Tetrads;!q.isBanned&&!q.isMember&&!q.alreadyInvited&&(this.city==S.a.Chongqing||this.city==S.a.NewTokyo||this.city==S.a.Ishima)&&this.strength>=75&&this.defense>=75&&this.dexterity>=75&&this.agility>=75&&this.karma<=-18&&e.push(q);var K=v.a["Slum Snakes"];!K.isBanned&&!K.isMember&&!K.alreadyInvited&&this.strength>=30&&this.defense>=30&&this.dexterity>=30&&this.agility>=30&&this.karma<=-9&&this.money.gte(1e6)&&e.push(K);var $=v.a.Netburners,z=0,Y=0,V=0;for(let e=0;e=80&&z>=8&&Y>=4&&V>=100&&e.push($);var J=v.a["Tian Di Hui"];J.isBanned||J.isMember||J.alreadyInvited||!this.money.gte(1e6)||!(this.hacking_skill>=50)||this.city!=S.a.Chongqing&&this.city!=S.a.NewTokyo&&this.city!=S.a.Ishima||e.push(J);var Q=v.a.CyberSec,X=R.b[I.a[I.b.CyberSecServer]];return null==X?console.error("Could not find CyberSec Server"):Q.isBanned||Q.isMember||!X.backdoorInstalled||Q.alreadyInvited||e.push(Q),e}function kt(e){this.bitNodeN=e}function _t(e){for(const t in this.queuedAugmentations)if(this.queuedAugmentations[t].name==e)return void console.warn(`tried to queue ${e} twice, this may be a bug`);for(const t in this.augmentations)if(this.augmentations[t].name==e)return void console.warn(`tried to queue ${e} twice, this may be a bug`);this.firstAugPurchased=!0,this.queuedAugmentations.push(new i.a(e))}function wt(e,t=1){if(null==e||null==e.type||null==e)return"No reward for this contract";switch(e.type){case l.c.FactionReputation:if(null==e.name||!(v.a[e.name]instanceof E.a))return e.type=l.c.FactionReputationAll,this.gainCodingContractReward(e);var a=f.a.CodingContractBaseFactionRepGain*t;return v.a[e.name].playerReputation+=a,`Gained ${a} faction reputation for ${e.name}`;case l.c.FactionReputationAll:const i=f.a.CodingContractBaseFactionRepGain*t,o=["Bladeburners"];var n=this.factions.slice();if(0==(n=n.filter(e=>!o.includes(e))).length)return e.type=l.c.Money,this.gainCodingContractReward(e,t);const m=Math.floor(i/n.length);for(const e of n)v.a[e]instanceof E.a&&(v.a[e].playerReputation+=m);return`Gained ${m} reputation for each of the following factions: ${n.toString()}`;case l.c.CompanyReputation:if(null==e.name||!(u.a[e.name]instanceof c.a))return e.type=l.c.FactionReputationAll,this.gainCodingContractReward(e);a=f.a.CodingContractBaseCompanyRepGain*t;return u.a[e.name].playerReputation+=a,`Gained ${a} company reputation for ${e.name}`;case l.c.Money:default:var r=f.a.CodingContractBaseMoneyGain*t*s.a.CodingContractMoney;return this.gainMoney(r),this.recordMoneySource(r,"codingcontract"),"Gained "+H.a.formatMoney(r)}}function Ct(e){return null==w.a[e]?(console.warn("Player.travel() called with invalid city: "+e),!1):(this.city=e,!0)}function St(e){return null==C.a[e]?(console.warn("Player.gotoLocation() called with invalid location: "+e),!1):(this.location=e,!0)}function xt(){return 10===this.bitNodeN||B.a[10]>0}function Ot(e){this.exploits.includes(e)||this.exploits.push(e)}function Tt(e){return Object(M.a)(this.intelligence,e)}function Mt(){return this.moneySourceA.casino}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(300),r=a(1);function i(e){const t="SourceFile"+e.n,a=n.a[t];if(null!=a){switch(e.n){case 1:{let t=0;for(let a=0;aa.hacking_skill?e.error("Your hacking skill is not high enough to use backdoor on this machine. Try analyzing the machine to determine the required hacking skill"):s instanceof r.a?e.error("Cannot use backdoor on this type of Server"):e.startBackdoor(a):e.error("You do not have admin rights for this machine! Cannot backdoor")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(423),r=a(55);function i(e,t,a,i,o){if(!r.a.hasOwnProperty("Darkweb Server"))return void e.error("You need to be able to connect to the Dark Web to use the buy command. (Maybe there's a TOR router you can buy somewhere)");if(1!=o.length)return e.print("Incorrect number of arguments. Usage: "),e.print("buy -l"),void e.print("buy [item name]");const s=o[0]+"";"-l"==s||"-1"==s||"--list"==s?Object(n.c)():Object(n.a)(s)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(212),r=a(106),i=a(473);function o(e,t,a,o,s){if(1!==s.length)return void e.error("Incorrect usage of cat command. Usage: cat [file]");const l=e.getFilepath(s[0]+"");if(l.endsWith(".msg")||l.endsWith(".lit")||l.endsWith(".txt")){if(l.endsWith(".msg")||l.endsWith(".lit"))for(let e=0;e1)e.error("Incorrect number of arguments. Usage: cd [dir]");else{let t=1===i.length?i[0]+"":"/",r="";if("/"===t)r="/";else{if(t=Object(n.i)(t),r=Object(n.a)(t,e.cwd()),null===r||""===r)return void e.error("Invalid path. Failed to change directories");const i=a.getCurrentServer();if(!i.scripts.some(e=>e.filename.startsWith(r+""))&&!i.textFiles.some(e=>e.fn.startsWith(r+"")))return void e.error("Invalid path. Failed to change directories")}e.setcwd(r)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(209),r=a(89);function i(e,t,a,i,o){if(o.length<1)e.error("Incorrect number of arguments. Usage: check [script] [arg1] [arg2]...");else{const t=e.getFilepath(o[0]+"");if(!Object(r.a)(t))return void e.error("tail can only be called on .script files (filename must end with .script)");const a=Object(n.a)(t,o.slice(1),i);if(null==a)return void e.error("No such script exists");a.displayLog()}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(38);function r(e,t,a,r,i){if(1!==i.length)return void e.error("Incorrect usage of connect command. Usage: connect [ip/hostname]");const o=i[0]+"";for(let t=0;ti.a.saveAs(e,a))}if(Object(n.a)(t)){const n=e.getScript(a,t);if(null!=n)return n.download()}else{if(!t.endsWith(".txt"))return void e.error("Cannot download this filetype");{const n=e.getTextFile(a,t);if(null!=n)return n.download()}}return void e.error(t+" does not exist")}catch(t){return void e.error(t+"")}}},,,function(module,__webpack_exports__,__webpack_require__){"use strict";function expr(terminal,router,player,server,args){if(0===args.length)return void terminal.error("Incorrect usage of expr command. Usage: expr [math expression]");const expr=args.join(""),sanitizedExpr=expr.replace(/s+/g,"").replace(/[^-()\d/*+.]/g,"");let result;try{result=eval(sanitizedExpr)}catch(e){return void terminal.error("Could not evaluate expression: "+sanitizedExpr)}terminal.print(result)}__webpack_require__.d(__webpack_exports__,"a",(function(){return expr}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(3);function r(e,t,a,r,i){if(0!==i.length)return void e.error("Incorrect usage of free command. Usage: free");const o=n.a.formatRAM(a.getCurrentServer().maxRam),s=n.a.formatRAM(a.getCurrentServer().ramUsed),l=n.a.formatRAM(a.getCurrentServer().maxRam-a.getCurrentServer().ramUsed),c=Math.max(o.length,Math.max(s.length,l.length)),u=n.a.formatPercentage(a.getCurrentServer().ramUsed/a.getCurrentServer().maxRam);e.print(`Total: ${" ".repeat(c-o.length)}${o}`),e.print(`Used: ${" ".repeat(c-s.length)}${s} (${u})`),e.print(`Available: ${" ".repeat(c-l.length)}${l}`)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(101);function r(e,t,a,r,i){if(0!==i.length)return void e.error("Incorrect usage of hack command. Usage: hack");r instanceof n.a||e.error("Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers");const o=r;o.purchasedByPlayer?e.error("Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers"):o.hasAdminRights?o.requiredHackingSkill>a.hacking_skill?e.error("Your hacking skill is not high enough to attempt hacking this machine. Try analyzing the machine to determine the required hacking skill"):e.startHack(a):e.error("You do not have admin rights for this machine! Cannot hack")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(631);function r(e,t,a,r,i){if(0===i.length||1===i.length)if(0===i.length)n.b.forEach(t=>e.print(t));else{const t=i[0],a=n.a[t];if(null==a)return void e.error("No help topics match '"+t+"'");a.forEach(t=>e.print(t))}else e.error("Incorrect usage of help command. Usage: help")}},function(e,t,a){"use strict";function n(e,t,a,n,r){0===r.length?(a.getCurrentServer().isConnectedTo=!1,a.currentServer=a.getHomeComputer().ip,a.getCurrentServer().isConnectedTo=!0,e.print("Connected to home"),e.setcwd("/")):e.error("Incorrect usage of home command. Usage: home")}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";function n(e,t,a,n,r){0===r.length?e.print(a.getCurrentServer().hostname):e.error("Incorrect usage of hostname command. Usage: hostname")}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";function n(e,t,a,n,r){0===r.length?e.print(a.getCurrentServer().ip):e.error("Incorrect usage of ifconfig command. Usage: ifconfig")}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(113);function r(e,t,a,r,i){try{if(i.length<1)return void e.error("Incorrect usage of kill command. Usage: kill [scriptname] [arg1] [arg2]...");if("number"==typeof i[0]){const t=i[0];return void(Object(n.a)(t)?e.print("Killing script with PID "+t):e.print(`Failed to kill script with PID ${t}. No such script exists`))}const t=e.getFilepath(i[0]),a=r.getRunningScript(t,i.slice(1));if(null==a)return void e.error("No such script is running. Nothing to kill");Object(n.a)(a,r.ip,!1),e.print("Killing "+t)}catch(t){e.error(t+"")}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(113),r=a(238);function i(e,t,a,i){for(let e=i.runningScripts.length-1;e>=0;--e)Object(n.a)(i.runningScripts[e],i.ip,!1);r.a.emit(),e.print("Killing all running scripts")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(106),r=a(98);function i(e,t,a,i,o){const s=o.length;function l(){e.error("Incorrect usage of ls command. Usage: ls [dir] [| grep pattern]")}if(s>5||3===s)return l();let c="",u=e.cwd();if(u.endsWith("/")||(u+="/"),s>=4){if("grep"!==o[s-1]||"|"!==o[s-2])return l();c=o[s]+""}if(s>=1&&"|"!==o[0]){const t=Object(r.a)(o[0]+"",e.cwd());if(u=t||"",null!=u&&(u.endsWith("/")||(u+="/"),!Object(r.f)(u)))return l()}"/"===u&&(u="");const m=[],h=[],p=[],d=[],f=[],g=[];function y(e,t){let a=e;if(u){if(!e.startsWith(u))return;a=e.slice(u.length,e.length)}if(!c||a.includes(c))if(a.includes("/")){const e=Object(r.d)(a);if(c&&!e.includes(c))return;g.includes(e)||g.push(e)}else t.push(a)}const b=a.getCurrentServer();for(const e of b.programs)y(e,m);for(const e of b.scripts)y(e.filename,h);for(const e of b.textFiles)y(e.fn,p);for(const e of b.contracts)y(e.fn,d);for(const e of b.messages)e instanceof n.a?y(e.filename,f):y(e,f);function E(t){const a=Math.max(...t.map(e=>e.length))+1,n=Math.floor(80/a);for(let r=0;re.segments.length>0);for(let t=0;t0?p:1,g=h._;if(null==Object(o.a)(u,g,l)){for(let t=0;ts)return void e.print("This machine does not have enough RAM to run this script with "+f+" threads. Script requires "+o+"GB of RAM");const c=new i.a(a,g);c.threads=f;return Object(r.e)(c,l)?(e.print(`Running script with ${f} thread(s), pid ${c.pid} and args: ${JSON.stringify(g)}.`),void(d&&Object(n.a)(c))):void e.error("Failed to start script")}e.print("ERROR: No such script")}else e.print("ERROR: This script is already running. Cannot run multiple instances")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(58);function r(e,t,a,r,i){if(i.length<1)return;const o=i[0]+"";if(a.hasProgram(o)){if(!(i.length<1)){for(const s of Object.values(n.a))if(s.name===o)return void s.run(t,e,a,r,i.slice(1).map(e=>e+""));e.print("Invalid executable. Cannot be run")}}else e.error("No such executable on home computer (Only programs that exist on your home computer can be run)")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(38);function r(e,t,a,r,i){if(0!==i.length)return void e.error("Incorrect usage of netstat/scan command. Usage: netstat/scan");const o=a.getCurrentServer(),s=o.serversOnNetwork.map((e,t)=>{const a=Object(n.c)(o,t);if(null===a)throw new Error("Server should not be null");return{hostname:a.hostname,ip:a.ip,hasRoot:a.hasAdminRights?"Y":"N"}});s.unshift({hostname:"Hostname",ip:"IP",hasRoot:"Root Access"});const l=Math.max(...s.map(e=>e.hostname.length)),c=Math.max(...s.map(e=>e.ip.length));for(const t of s){if(!t)continue;let a=t.hostname;a+=" ".repeat(l-t.hostname.length+1),a+=t.ip,a+=" ".repeat(c-t.ip.length+1),a+=t.hasRoot,e.print(a)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(58);function r(e,t,a,r,i){if(0===i.length)e.executeScanAnalyzeCommand(a,1);else{if(i.length>2)return void e.error("Incorrect usage of scan-analyze command. usage: scan-analyze [depth]");let t=!1;2===i.length&&"-a"===i[1]&&(t=!0);const r=parseInt(i[0]+"");if(isNaN(r)||r<0)return void e.error("Incorrect usage of scan-analyze command. depth argument must be positive numeric");if(r>3&&!a.hasProgram(n.a.DeepscanV1.name)&&!a.hasProgram(n.a.DeepscanV2.name))return void e.error("You cannot scan-analyze with that high of a depth. Maximum depth is 3");if(r>5&&!a.hasProgram(n.a.DeepscanV2.name))return void e.error("You cannot scan-analyze with that high of a depth. Maximum depth is 5");if(r>10)return void e.error("You cannot scan-analyze with that high of a depth. Maximum depth is 10");e.executeScanAnalyzeCommand(a,r,t)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(106),r=a(38),i=a(89);function o(e,t,a,o,s){try{if(2!==s.length)return void e.error("Incorrect usage of scp command. Usage: scp [file] [destination hostname/ip]");const t=e.getFilepath(s[0]+"");if(!t.endsWith(".lit")&&!Object(i.a)(t)&&!t.endsWith(".txt"))return void e.error("scp only works for scripts, text files (.txt), and literature files (.lit)");const a=Object(r.b)(s[1]+"");if(null==a)return void e.error(`Invalid destination. ${s[1]} not found`);if(t.endsWith(".lit")){let r=!1;for(let e=0;e1){e.error("Found several potential candidates:");for(const t of r)e.error(`${t.filename} ${t.args.join(" ")}`);return void e.error("Script arguments need to be specified.")}e.error("No such script exists.")}else{const t=Object(r.b)(l[0],s);if(null==t)return void e.error("No such script exists");Object(n.a)(t)}}catch(t){e.error(t+"")}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(518),r=a(3);function i(e,t,a,i,o){if(0!==o.length)return void e.error("Incorrect usage of top command. Usage: top");const s=`Script${" ".repeat(40-"Script".length)}PID${" ".repeat(10-"PID".length)}Threads${" ".repeat(16-"Threads".length)}RAM Usage`;e.print(s);const l=i.runningScripts;for(let t=0;t>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {","var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}","});","if (!Array.prototype.find) {","Object.defineProperty(Array.prototype, 'find', {","value: function(predicate) {","if (this == null) {","throw new TypeError('\"this\" is null or not defined');","}","var o = Object(this);","var len = o.length >>> 0;","if (typeof predicate !== 'function') {","throw new TypeError('predicate must be a function');","}","var thisArg = arguments[1];","var k = 0;","while (k < len) {","var kValue = o[k];","if (predicate.call(thisArg, kValue, k, o)) {","return kValue;","}","k++;","}","return undefined;","},","configurable: true,","writable: true","});","}","if (!Array.prototype.findIndex) {","Object.defineProperty(Array.prototype, 'findIndex', {","value: function(predicate) {","if (this == null) {","throw new TypeError('\"this\" is null or not defined');","}","var o = Object(this);","var len = o.length >>> 0;","if (typeof predicate !== 'function') {","throw new TypeError('predicate must be a function');","}","var thisArg = arguments[1];","var k = 0;","while (k < len) {","var kValue = o[k];","if (predicate.call(thisArg, kValue, k, o)) {","return k;","}","k++;","}","return -1;","},","configurable: true,","writable: true","});","}","Object.defineProperty(Array.prototype, 'forEach',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') throw TypeError();","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'includes', {","value: function(searchElement, fromIndex) {","if (this == null) {","throw new TypeError('\"this\" is null or not defined');","}","// 1. Let O be ? ToObject(this value).","var o = Object(this);",'// 2. Let len be ? ToLength(? Get(O, "length")).',"var len = o.length >>> 0;","// 3. If len is 0, return false.","if (len === 0) {","return false;","}","// 4. Let n be ? ToInteger(fromIndex).","// (If fromIndex is undefined, this step produces the value 0.)","var n = fromIndex | 0;","// 5. If n ≥ 0, then","// a. Let k be n.","// 6. Else n < 0,","// a. Let k be len + n.","// b. If k < 0, let k be 0.","var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);","function sameValueZero(x, y) {","return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));","}","// 7. Repeat, while k < len","while (k < len) {","// a. Let elementK be the result of ? Get(O, ! ToString(k)).","// b. If SameValueZero(searchElement, elementK) is true, return true.","if (sameValueZero(o[k], searchElement)) {","return true;","}","// c. Increase k by 1. ","k++;","}","// 8. Return false","return false;","}","});","Object.defineProperty(Array.prototype, 'map',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);","k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (!this || typeof callback !== 'function') throw TypeError();","var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length === 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k++];","}","for (; k < len; k++) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw TypeError();","var t = Object(this), len = t.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];","} else {","while (k >= 0 && !(k in t)) k--;","if (k < 0) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k--];","}","for (; k >= 0; k--) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'some',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (!this || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t && fun.call(thisArg, t[i], i, t)) {","return true;","}","}","return false;","}","});","(function() {","var sort_ = Array.prototype.sort;","Array.prototype.sort = function(opt_comp) {","if (typeof opt_comp !== 'function') {","return sort_.call(this);","}","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {","if (opt_comp(this[j], this[j + 1]) > 0) {","var swap = this[j];","this[j] = this[j + 1];","this[j + 1] = swap;","changes++;","}","}","if (!changes) break;","}","return this;","};","})();","Object.defineProperty(Array.prototype, 'toLocaleString',","{configurable: true, writable: true, value:","function() {","var out = [];","for (var i = 0; i < this.length; i++) {","out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();","}","return out.join(',');","}","});","")},r.prototype.initString=function(e){var t,a=this;t=function(e){return e=String(e),a.calledWithNew()?(this.data=e,this):e},this.STRING=this.createNativeFunction(t,!0),this.setProperty(e,"String",this.STRING),this.setProperty(this.STRING,"fromCharCode",this.createNativeFunction(String.fromCharCode,!1),r.NONENUMERABLE_DESCRIPTOR);for(var n=["charAt","charCodeAt","concat","indexOf","lastIndexOf","slice","substr","substring","toLocaleLowerCase","toLocaleUpperCase","toLowerCase","toUpperCase","trim"],i=0;i= 0; i--) {","str = str.substring(0, subs[i][0]) + subs[i][2] + str.substring(subs[i][0] + subs[i][1]);","}","} else {","var i = str.indexOf(substr);","if (i !== -1) {","var inject = newSubstr(str.substr(i, substr.length), i, str);","str = str.substring(0, i) + inject + str.substring(i + substr.length);","}","}","return str;","};","})();","if (!String.prototype.endsWith) {","String.prototype.endsWith = function(search, this_len) {","if (this_len === undefined || this_len > this.length) {","this_len = this.length;","}","return this.substring(this_len - search.length, this_len) === search;","};","}","if (!String.prototype.includes) {","String.prototype.includes = function(search, start) {","'use strict';","if (typeof start !== 'number') {","start = 0;","}"," ","if (start + search.length > this.length) {","return false;","} else {","return this.indexOf(search, start) !== -1;","}","};","}","if (!String.prototype.startsWith) {","String.prototype.startsWith = function(search, pos) {","return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;","};","}","")},r.prototype.initBoolean=function(e){var t,a=this;t=function(e){return e=Boolean(e),a.calledWithNew()?(this.data=e,this):e},this.BOOLEAN=this.createNativeFunction(t,!0),this.setProperty(e,"Boolean",this.BOOLEAN)},r.prototype.initNumber=function(e){var t,a=this;t=function(e){return e=Number(e),a.calledWithNew()?(this.data=e,this):e},this.NUMBER=this.createNativeFunction(t,!0),this.setProperty(e,"Number",this.NUMBER);for(var n=["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"],i=0;i>>0;return t===Number(e)?t:NaN},r.legalArrayIndex=function(e){var t=e>>>0;return String(t)===String(e)&&4294967295!==t?t:NaN},r.Value,r.Object=function(e){this.getter=Object.create(null),this.setter=Object.create(null),this.properties=Object.create(null),this.proto=e},r.Object.prototype.proto=null,r.Object.prototype.isObject=!0,r.Object.prototype.class="Object",r.Object.prototype.data=null,r.Object.prototype.toString=function(){if("Array"===this.class){(n=r.toStringCycles_).push(this);try{for(var e=[],t=0;t0;i.pop()){var o=i[i.length-1];switch(o.node.type){case"TryStatement":return void(o.cv={type:e,value:t,label:a});case"CallExpression":case"NewExpression":if(e===r.Completion.RETURN)return void(o.value=t);if(e!==r.Completion.THROW)throw Error("Unsynatctic break/continue not rejected by Acorn")}if(e===r.Completion.BREAK){if(a?o.labels&&-1!==o.labels.indexOf(a):o.isLoop||o.isSwitch)return void i.pop()}else if(e===r.Completion.CONTINUE&&(a?o.labels&&-1!==o.labels.indexOf(a):o.isLoop))return}var s;if(this.isa(t,this.ERROR)){var l={EvalError:EvalError,RangeError:RangeError,ReferenceError:ReferenceError,SyntaxError:SyntaxError,TypeError:TypeError,URIError:URIError},c=this.getProperty(t,"name").toString(),u=this.getProperty(t,"message").valueOf();s=(e=l[c]||Error)(u+n)}else s=String(t)+n;throw s},r.prototype.createGetter_=function(e,t){var a=Array.isArray(t)?t[0]:t,n=new this.nodeConstructor;n.type="CallExpression";var i=new r.State(n,this.stateStack[this.stateStack.length-1].scope);return i.doneCallee_=!0,i.funcThis_=a,i.func_=e,i.doneArgs_=!0,i.arguments_=[],i},r.prototype.createSetter_=function(e,t,a){var n=Array.isArray(t)?t[0]:this.global,i=new this.nodeConstructor;i.type="CallExpression";var o=new r.State(i,this.stateStack[this.stateStack.length-1].scope);return o.doneCallee_=!0,o.funcThis_=n,o.func_=e,o.doneArgs_=!0,o.arguments_=[a],o},r.State=function(e,t){this.node=e,this.scope=t},r.prototype.stepArrayExpression=function(e,t,a){var n=a.elements,i=t.n_||0;for(t.array_?(this.setProperty(t.array_,i,t.value),i++):(t.array_=this.createObjectProto(this.ARRAY_PROTO),t.array_.properties.length=n.length);i>=":s>>=l;break;case">>>=":s>>>=l;break;case"&=":s&=l;break;case"^=":s^=l;break;case"|=":s|=l;break;default:throw SyntaxError("Unknown assignment expression: "+a.operator)}var c=this.setValue(t.leftReference_,s);if(c)return t.doneSetter_=!0,t.setterValue_=s,this.createSetter_(c,t.leftReference_,s);e.pop(),e[e.length-1].value=s},r.prototype.stepBinaryExpression=function(e,t,a){if(!t.doneLeft_)return t.doneLeft_=!0,new r.State(a.left,t.scope);if(!t.doneRight_)return t.doneRight_=!0,t.leftValue_=t.value,new r.State(a.right,t.scope);e.pop();var n,i=t.leftValue_,o=t.value;switch(a.operator){case"==":n=i==o;break;case"!=":n=i!=o;break;case"===":n=i===o;break;case"!==":n=i!==o;break;case">":n=i>o;break;case">=":n=i>=o;break;case"<":n=i>":n=i>>o;break;case">>>":n=i>>>o;break;case"in":if(!o||!o.isObject){let e=this.getErrorLineNumber(a);this.throwException(this.TYPE_ERROR,"'in' expects an object, not '"+o+"'",e)}n=this.hasProperty(o,i);break;case"instanceof":if(!this.isa(o,this.FUNCTION)){let e=this.getErrorLineNumber(a);this.throwException(this.TYPE_ERROR,"Right-hand side of instanceof is not an object",e)}n=!!i.isObject&&this.isa(i,o);break;default:throw SyntaxError("Unknown binary operator: "+a.operator)}e[e.length-1].value=n},r.prototype.stepBlockStatement=function(e,t,a){var n=t.n_||0,i=a.body[n];if(i)return t.n_=n+1,new r.State(i,t.scope);e.pop()},r.prototype.stepBreakStatement=function(e,t,a){var n=a.label&&a.label.name;this.unwind(r.Completion.BREAK,void 0,n)},r.prototype.stepCallExpression=function(e,t,a){if(!t.doneCallee_){t.doneCallee_=1;var i=new r.State(a.callee,t.scope);return i.components=!0,i}if(1===t.doneCallee_){t.doneCallee_=2;var o=t.value;if(Array.isArray(o)){if(t.func_=this.getValue(o,a),o[0]===r.SCOPE_REFERENCE?t.directEval_="eval"===o[1]:t.funcThis_=o[0],(o=t.func_)&&"object"==typeof o&&o.isGetter)return o.isGetter=!1,t.doneCallee_=1,this.createGetter_(o,t.value)}else t.func_=o;t.arguments_=[],t.n_=0}o=t.func_;if(!t.doneArgs_){if(0!==t.n_&&t.arguments_.push(t.value),a.arguments[t.n_])return new r.State(a.arguments[t.n_++],t.scope);if("NewExpression"===a.type){if(o.illegalConstructor){let e=this.getErrorLineNumber(a);this.throwException(this.TYPE_ERROR,o+" is not a constructor",e)}var s=o.properties.prototype;"object"==typeof s&&null!==s||(s=this.OBJECT_PROTO),t.funcThis_=this.createObjectProto(s),t.isConstructor=!0}else void 0===t.funcThis_&&(t.funcThis_=t.scope.strict?void 0:this.global);t.doneArgs_=!0}if(t.doneExec_)e.pop(),t.isConstructor&&"object"!=typeof t.value?e[e.length-1].value=t.funcThis_:e[e.length-1].value=t.value;else{if(t.doneExec_=!0,!o||!o.isObject){let e=this.getErrorLineNumber(a);this.throwException(this.TYPE_ERROR,o+" is not a function",e)}var l=o.node;if(l){for(var c=this.createScope(l.body,o.parentScope),u=0;uu?t.arguments_[u]:void 0;this.setProperty(c,m,h)}var p=this.createObjectProto(this.ARRAY_PROTO);for(u=0;u0)return e.ramUsage;const t=n.b[e.server];if(null==t)return 0;for(let a=0;a{m(e,0)},disabled:0===s,"aria-label":"first page"},"rtl"===t.direction?n.createElement(d.a,null):n.createElement(l.a,null)),n.createElement(o.a,{onClick:e=>{m(e,s-1)},disabled:0===s,"aria-label":"previous page"},"rtl"===t.direction?n.createElement(h.a,null):n.createElement(u.a,null)),n.createElement(o.a,{onClick:e=>{m(e,s+1)},disabled:s>=Math.ceil(a/c)-1,"aria-label":"next page"},"rtl"===t.direction?n.createElement(u.a,null):n.createElement(h.a,null)),n.createElement(o.a,{onClick:e=>{m(e,Math.max(0,Math.ceil(a/c)-1))},disabled:s>=Math.ceil(a/c)-1,"aria-label":"last page"},"rtl"===t.direction?n.createElement(l.a,null):n.createElement(d.a,null)))}},,function(e,t,a){"use strict";function n(e){function t(e,t,a){return e*t+a}const a=t(e,Math.log(51)-Math.log(50),Math.log(51));return t(500,Math.exp(a),-25e3)}function r(e){return-Math.log(25500/(e+25e3))/Math.log(1.02)}a.d(t,"a",(function(){return n})),a.d(t,"b",(function(){return r}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(263),r=a(20);class i extends n.a{constructor(e=null){super(e)}getActionTypeSkillSuccessBonus(e){return e.skillMultipliers.successChanceContract}toJSON(){return Object(r.b)("Contract",this)}static fromJSON(e){return Object(r.a)(i,e.data)}}r.c.constructors.Contract=i},function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));const n={helpList:["Use 'help [command]' to get more information about a particular Bladeburner console command.",""," automate [var] [val] [hi/low] Configure simple automation for Bladeburner tasks"," clear/cls Clear the console"," help [cmd] Display this help text, or help text for a specific command"," log [en/dis] [type] Enable or disable logging for events and actions"," skill [action] [name] Level or display info about your Bladeburner skills"," start [type] [name] Start a Bladeburner action/task"," stop Stops your current Bladeburner action/task"],automate:["automate [var] [val] [hi/low]","","A simple way to automate your Bladeburner actions. This console command can be used to automatically start an action when your stamina rises above a certain threshold, and automatically switch to another action when your stamina drops below another threshold."," automate status - Check the current status of your automation and get a brief description of what it'll do"," automate en - Enable the automation feature"," automate dis - Disable the automation feature","","There are four properties that must be set for this automation to work properly. Here is how to set them:",""," automate stamina 100 high"," automate contract Tracking high"," automate stamina 50 low"," automate general 'Field Analysis' low","","Using the four console commands above will set the automation to perform Tracking contracts if your stamina is 100 or higher, and then switch to Field Analysis if your stamina drops below 50. Note that when setting the action, the name of the action is CASE-SENSITIVE. It must exactly match whatever the name is in the UI."],clear:["clear","","Clears the console"],cls:["cls","","Clears the console"],help:["help [command]","","Running 'help' with no arguments displays the general help text, which lists all console commands and a brief description of what they do. A command can be specified to get more specific help text about that particular command. For example:",""," help automate","","will display specific information about using the automate console command"],log:["log [en/dis] [type]","","Enable or disable logging. By default, the results of completing actions such as contracts/operations are logged in the console. There are also random events that are logged in the console as well. The five categories of things that get logged are:","","[general, contracts, ops, blackops, events]","","The logging for these categories can be enabled or disabled like so:",""," log dis contracts - Disables logging that occurs when contracts are completed"," log en contracts - Enables logging that occurs when contracts are completed"," log dis events - Disables logging for Bladeburner random events","","Logging can be universally enabled/disabled using the 'all' keyword:",""," log dis all"," log en all"],skill:["skill [action] [name]","","Level or display information about your skills.","","To display information about all of your skills and your multipliers, use:",""," skill list","","To display information about a specific skill, specify the name of the skill afterwards. Note that the name of the skill is case-sensitive. Enter it exactly as seen in the UI. If the name of the skill has whitespace, enclose the name of the skill in double quotation marks:",""," skill list Reaper
skill list 'Digital Observer'","","This console command can also be used to level up skills:",""," skill level [skill name]"],start:["start [type] [name]","","Start an action. An action is specified by its type and its name. The name is case-sensitive. It must appear exactly as it does in the UI. If the name of the action has whitespace, enclose it in double quotation marks. Valid action types include:","","[general, contract, op, blackop]","","Examples:",""," start contract Tracking"," start op 'Undercover Operation'"],stop:["stop","","Stop your current action and go idle."]}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o})),a.d(t,"b",(function(){return s}));var n=a(309),r=a(3);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class o{constructor(e={cost:0,text:""}){if(i(this,"children",[]),i(this,"cost",0),i(this,"researched",!1),i(this,"parent",null),i(this,"text",""),null==n.a[e.text])throw new Error("Invalid Research name used when constructing ResearchTree Node: "+e.text);this.text=e.text,this.cost=e.cost,e.children&&e.children.length>0&&(this.children=e.children),null!=e.parent&&(this.parent=e.parent)}addChild(e){this.children.push(e),e.parent=this}createTreantMarkup(){const e=[];for(let t=0;t${this.text}
${r.a.format(this.cost,"0,0")} Scientific Research`+a.desc+"",text:{name:this.text}}}findNode(e){if(this.text===e)return this;let t=null;for(let a=0;ar.a.createElement(i.a,s({},e,{classes:{...l(),...e.classes}}))},,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(70);function r(e){if(null==e)return null;const t=e.nextPosition;return null==t?null:n.a[t]}},,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(293);function r(e){try{let t;t="string"==typeof e?Object(n.a)(e):e;const a=t.cloneNode(!0);return null!==t.parentNode&&t.parentNode.replaceChild(a,t),a}catch(e){return console.error(e),null}}},,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(18);function r(){const e=[];return{write:t=>(e.push(t),e.length>n.a.MaxPortCapacity?e.shift():null),tryWrite:t=>!(e.length>=n.a.MaxPortCapacity)&&(e.push(t),!0),read:()=>0===e.length?"NULL PORT DATA":e.shift(),peek:()=>{if(0===e.length)return"NULL PORT DATA";return e.slice()[0]},full:()=>e.length==n.a.MaxPortCapacity,empty:()=>0===e.length,clear:()=>{e.length=0}}}},,,function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(1529),o=a(9),s=a(54),l=a(111),c=a(348),u=a(1),m=a(264),h=a(99),p=a(4);function d(){const[e,t]=Object(n.useState)(!1),[a,d]=Object(n.useState)(!1);return Object(n.useEffect)(()=>{const e=setTimeout(()=>{a||t(!0)},2e3);return()=>clearTimeout(e)}),Object(n.useEffect)(()=>{!async function(){await Object(c.b)().then(e=>{m.a.load(e),d(!0)}).catch(e=>{console.error(e),m.a.load(""),d(!0)})}()},[]),a?r.a.createElement(h.a,{terminal:l.a,engine:m.a,player:u.a}):r.a.createElement(s.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(s.a,{item:!0},r.a.createElement(i.a,{size:150,color:"primary"})),r.a.createElement(s.a,{item:!0},r.a.createElement(o.a,{variant:"h3"},"Loading Bitburner v",p.a.Version)),e&&r.a.createElement(s.a,{item:!0},r.a.createElement(o.a,null,"If the game fails to load, consider ",r.a.createElement("a",{href:"?noScripts"},"killing all scripts"))))}},function(e,t,a){"use strict";function n(e){return"number"==typeof e&&!isNaN(e)}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(21);const r={Tracking:()=>Object(n.a)(5,75)/10,"Bounty Hunter":()=>Object(n.a)(5,75)/10,Retirement:()=>Object(n.a)(5,75)/10,Investigation:()=>Object(n.a)(10,40)/10,"Undercover Operation":()=>Object(n.a)(10,40)/10,"Sting Operation":()=>Object(n.a)(3,40)/10,Raid:()=>Object(n.a)(2,40)/10,"Stealth Retirement Operation":()=>Object(n.a)(1,20)/10,Assassination:()=>Object(n.a)(1,20)/10}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(84),r=a(56),i=a(20);class o{constructor(e="",t=0,a=0,i=n.a.LimitBuy,o=r.a.Long){let s=!1;if("number"==typeof t&&"number"==typeof a||(s=!0),(isNaN(t)||isNaN(a))&&(s=!0),"string"!=typeof e&&(s=!0),s)throw new Error("Invalid constructor paramters for Order");this.stockSymbol=e,this.shares=t,this.price=a,this.type=i,this.pos=o}toJSON(){return Object(i.b)("Order",this)}static fromJSON(e){return Object(i.a)(o,e.data)}}i.c.constructors.Order=o},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(8);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class i{constructor(e){r(this,"city",null),r(this,"costMult",0),r(this,"expMult",0),r(this,"name",n.a.Void),r(this,"types",[]),r(this,"techVendorMaxRam",0),r(this,"techVendorMinRam",0),e.city&&(this.city=e.city),e.costMult&&(this.costMult=e.costMult),e.expMult&&(this.expMult=e.expMult),e.infiltrationData&&(this.infiltrationData=e.infiltrationData),e.name&&(this.name=e.name),e.types&&(this.types=e.types),e.techVendorMaxRam&&(this.techVendorMaxRam=e.techVendorMaxRam),e.techVendorMinRam&&(this.techVendorMinRam=e.techVendorMinRam)}}},,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a.n(n);function i(e){let t="cmpy-mgmt-city-tab";return e.current&&(t+=" current"),r.a.createElement("button",{className:t,onClick:e.onClick},e.name)}},function(e,t,a){"use strict";function n(e){return null==e||e.options.length<=0||e.selectedIndex<0?"":e.options[e.selectedIndex].text}a.d(t,"a",(function(){return n}))},,,,,function(e,t,a){"use strict";a.d(t,"b",(function(){return l})),a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(32),o=a(101),s=a(94);const l={All:0,Foreign:1,Owned:2,Purchased:3};function c(e){function t(t){const a=t instanceof o.a&&t.purchasedByPlayer,n=e.serverType;switch(n){case l.All:return!0;case l.Foreign:return"home"!==t.hostname&&!a;case l.Owned:return a||t instanceof s.a||"home"===t.hostname;case l.Purchased:return a||t instanceof s.a;default:return console.warn("Invalid ServerType specified for ServerDropdown component: "+n),!1}}const a=[];for(const e in i.b){const n=i.b[e];t(n)&&a.push(r.a.createElement("option",{key:n.hostname,value:n.hostname},n.hostname))}return r.a.createElement("select",{className:"dropdown",onChange:e.onChange,style:e.style},a)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return v}));var n=a(0),r=a(1002),i=a(1005),o=a(1006),s=a(1007),l=a(1008),c=a(1010),u=a(513),m=a(1018),h=a(1019),p=a(45),d=a(18),f=a(55),g=a(38),y=a(26),b=a(1027),E=a(47);function v({loc:e}){const t=E.b.Router(),a=E.b.Player();const v=function(){const d=[];return e.types.includes(p.a.Company)&&d.push(n.createElement(r.a,{key:"companylocation",locName:e.name})),e.types.includes(p.a.Gym)&&d.push(n.createElement(i.a,{key:"gymlocation",router:t,loc:e,p:a})),e.types.includes(p.a.Hospital)&&d.push(n.createElement(o.a,{key:"hospitallocation",p:a})),e.types.includes(p.a.Slums)&&d.push(n.createElement(s.a,{key:"slumslocation"})),e.types.includes(p.a.Special)&&d.push(n.createElement(l.a,{key:"speciallocation",loc:e})),e.types.includes(p.a.TechVendor)&&d.push(n.createElement(c.a,{key:"techvendorlocation",loc:e,p:a})),e.types.includes(p.a.TravelAgency)&&d.push(n.createElement(u.a,{key:"travelagencylocation",p:a,router:t})),e.types.includes(p.a.University)&&d.push(n.createElement(m.a,{key:"universitylocation",loc:e})),e.types.includes(p.a.Casino)&&d.push(n.createElement(h.a,{key:"casinoLocation",p:a})),d}(),k=f.a.getIp(e.name),_=Object(g.b)(k),w=null!==_&&Object(g.d)(_);return n.createElement("div",null,n.createElement(y.a,{onClick:()=>t.toCity(),style:{display:"block"},text:"Return to World"}),n.createElement("h1",{className:"noselect"},w&&!d.a.DisableTextEffects?n.createElement(b.a,{content:e.name}):e.name),v)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(201);const o=({card:e,hidden:t})=>{let a;switch(e.suit){case i.b.Clubs:a=r.a.createElement("span",null,"♣");break;case i.b.Diamonds:a=r.a.createElement("span",null,"♦");break;case i.b.Hearts:a=r.a.createElement("span",null,"♥");break;case i.b.Spades:a=r.a.createElement("span",null,"♠");break;default:throw new Error("MissingCaseException: "+e.suit)}return r.a.createElement("div",{className:"casino-card "+(e.isRedSuit()?"red":"black")},r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"value"},t?" - ":e.formatValue()),r.a.createElement("div",{className:"suit"},t?" - ":a)))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(221),o=a(142);function s(){return(s=Object.assign||function(e){for(var t=1;tr.a.createElement(i.a,s({},e,{classes:{...l(),...e.classes}}))},,function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));const n=new class{constructor(){this.positions=new Map}saveCursor(e,t){this.positions.set(e,t)}getCursor(e){const t=this.positions.get(e);return t||{row:-1,column:-1}}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));const n="interface NS {\n args: string[];\n /**\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n */\n scan(ip: string, hostnames: boolean): string[];\n hack(ip: string, threads: number, stock: boolean): Promise;\n hackAnalyzeThreads(ip: string, hackAmount: number): number;\n hackAnalyzePercent(ip: string): number;\n hackChance(ip: string): number;\n sleep(time: number): Promise;\n grow(ip: string, threads: number, stock: boolean): Promise;\n growthAnalyze(ip: string, growth: number): number;\n weaken(ip: string, threads: boolean): Promise;\n print(...args: any[]): void;\n tprint(...args: any[]): void;\n clearLog(): void;\n disableLog(fn: string): void;\n enableLog(fn: string): void;\n isLogEnabled(fn: string): boolean;\n getScriptLogs(fn: string, ip: string, ...scriptArgs: any[]): string[];\n tail(fn: string, ip: string, ...scriptArgs: any[]): void;\n nuke(ip: string): boolean;\n brutessh(ip: string): boolean;\n ftpcrack(ip: string): boolean;\n relaysmtp(ip: string): boolean;\n httpworm(ip: string): boolean;\n sqlinject(ip: string): boolean;\n run(scriptname: string, threads: number): number;\n exec(scriptname: string, ip: string, threads: number): number;\n spawn(scriptname: string, threads: number): void;\n kill(filename: string, ip: string, ...scriptArgs: any[]): boolean;\n killall(ip: string): boolean;\n exit(): void;\n scp(scriptname: string, ip1: string, ip2: string): boolean;\n ls(ip: string, grep: string): string[];\n ps(ip: string): {filename: string, threads: number, args: string[], pid: number}[];\n hasRootAccess(ip: string): boolean;\n getIp(): string;\n getHostname(): string;\n getHackingLevel(): number;\n getHackingMultipliers(): number;\n getHacknetMultipliers(): number;\n getBitNodeMultipliers(): number;\n getServer(ip: string): any;\n getServerMoneyAvailable(ip: string): number;\n getServerSecurityLevel(ip: string): number;\n getServerBaseSecurityLevel(ip: string): number;\n getServerMinSecurityLevel(ip: string): number;\n getServerRequiredHackingLevel(ip: string): number;\n getServerMaxMoney(ip: string): number;\n getServerGrowth(ip: string): number;\n getServerNumPortsRequired(ip: string): number;\n getServerRam(ip: string): number[];\n getServerMaxRam(ip: string): number;\n getServerUsedRam(ip: string): number;\n serverExists(ip: string): boolean;\n fileExists(filename: string, ip: string): boolean;\n isRunning(fn: string, ip: string, ...scriptArgs: any[]): boolean;\n getStockSymbols(): string[];\n getStockPrice(symbol: string): number;\n getStockAskPrice(symbol: string): number;\n getStockBidPrice(symbol: string): number;\n getStockPosition(symbol: string): number;\n getStockMaxShares(symbol: string): number;\n getStockPurchaseCost(symbol: string, shares: number, posType: string): number;\n getStockSaleGain(symbol: string, shares: number, posType: string): number;\n buyStock(symbol: string, shares: number): number;\n sellStock(symbol: string, shares: number): number;\n shortStock(symbol: string, shares: number): number;\n sellShort(symbol: string, shares: number): number;\n placeOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean;\n cancelOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean;\n getOrders(): any;\n getStockVolatility(symbol: string): number;\n getStockForecast(symbol: string): number;\n getPurchasedServerLimit(): number;\n getPurchasedServerMaxRam(): number;\n getPurchasedServerCost(ram: number): number;\n purchaseServer(hostname: string, ram: number): string;\n deleteServer(hostname: string): boolean;\n getPurchasedServers(hostname: string): string[];\n write(port: number, data: string, mode: string): boolean;\n tryWrite(port: number, data: string): boolean;\n read(port: number): any;\n peek(port: number): any;\n clear(port: number): number;\n getPortHandle(port: number): any; // netscript port\n rm(fn: string, ip: string): boolean;\n scriptRunning(scriptname: string, ip: string): boolean;\n scriptKill(scriptname: string, ip: string): boolean;\n getScriptName(): string;\n getScriptRam(scriptname: string, ip: string): number;\n getRunningScript(fn: string, ip: string): any; // running script\n getHackTime(ip: string): number;\n getGrowTime(ip: string): number;\n getWeakenTime(ip: string): number;\n getScriptIncome(scriptname: string, ip: string): number;\n getScriptExpGain(scriptname: string, ip: string): number;\n nFormat(n: number, format: string): string;\n tFormat(milliseconds: number, milliPrecision: boolean): string;\n getTimeSinceLastAug(): number;\n prompt(txt: string): Promise;\n getFavorToDonate(): number;\n universityCourse(universityName: string, className: string): boolean;\n gymWorkout(gymName: string, stat: string): boolean;\n travelToCity(cityname: string): boolean;\n purchaseTor(): boolean;\n purchaseProgram(programName: string): boolean;\n getCurrentServer(): any; // server object\n connect(hostname: string): boolean;\n manualHack(): Promise;\n installBackdoor(): Promise;\n getStats(): any; // complex type\n getCharacterInformation(): any; // complex type\n getPlayer(): any; // complex type\n hospitalize(): number;\n isBusy(): boolean;\n stopAction(): boolean;\n upgradeHomeRam(): number;\n getUpgradeHomeRamCost(): number;\n workForCompany(companyName: string): boolean;\n applyToCompany(companyName: string, field: string): boolean;\n getCompanyRep(companyName: string): number;\n getCompanyFavor(companyName: string): number;\n getCompanyFavorGain(companyName: string): number;\n checkFactionInvitations(): string[];\n joinFaction(name: string): boolean;\n workForFaction(name: string, type: string): boolean;\n getFactionRep(name: string): number;\n getFactionFavor(name: string): number;\n getFactionFavorGain(name: string): number;\n donateToFaction(name: string, amt: number): boolean;\n createProgram(name: string): boolean;\n commitCrime(crimeRoughName: string): number;\n getCrimeChance(crimeRoughName: string): boolean;\n getCrimeStats(crimeRoughName: string): any; // complex type\n getOwnedAugmentations(purchased: boolean): string[];\n getOwnedSourceFiles(): any; // complex type\n getAugmentationsFromFaction(facname: string): string[];\n getAugmentationCost(name: string): number;\n getAugmentationPrereq(name: string): string[];\n getAugmentationPrice(name: string): number;\n getAugmentationRepReq(name: string): number;\n getAugmentationStats(name: string): any; // complex type\n purchaseAugmentation(faction: string, name: string): boolean;\n softReset(cbScript: string): void;\n installAugmentations(cbScript: string): void;\n exploit(): void;\n bypass(doc: any): void;\n flags(data: any): any;\n}"},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(24),r=a(38);function i(e,t){const a=t.augmentations.slice().filter(e=>"NeuroFlux Governor"!==e);for(const t of a)if(!e.augmentations.some(e=>e.name==t))return!1;return!0}const o=[{title:"Gain root access on CSEC",fulfilled:()=>{const e=Object(r.a)("CSEC");return!(!e||!e.hasOwnProperty("hasAdminRights"))&&e.hasAdminRights}},{title:"Install the backdoor on CSEC",fulfilled:()=>{const e=Object(r.a)("CSEC");return!(!e||!e.hasOwnProperty("backdoorInstalled"))&&e.backdoorInstalled}},{title:"Join the faction hinted at in csec-test.msg",fulfilled:e=>e.factions.includes("CyberSec")},{title:"Install all the Augmentations from CyberSec",fulfilled:e=>i(e,n.a.CyberSec)},{title:"Join the faction hinted at in nitesec-test.msg",fulfilled:e=>e.factions.includes("NiteSec")},{title:"Install all the Augmentations from NiteSec",fulfilled:e=>i(e,n.a.NiteSec)},{title:"Join the faction hinted at in j3.msg",fulfilled:e=>e.factions.includes("The Black Hand")},{title:"Install all the Augmentations from The Black Hand",fulfilled:e=>i(e,n.a["The Black Hand"])},{title:"Join the faction hinted at in 19dfj3l1nd.msg",fulfilled:e=>e.factions.includes("BitRunners")},{title:"Install all the Augmentations from BitRunners",fulfilled:e=>i(e,n.a.BitRunners)},{title:"Complete fl1ght.exe",fulfilled:e=>e.factions.includes("Daedalus")},{title:"Install the special Augmentation from Daedalus",fulfilled:e=>e.augmentations.some(e=>"The Red Pill"==e.name)},{title:"Install the final backdoor and free yourself.",fulfilled:()=>!1}]},,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(4);function r(e,t){return e/n.a.DonateMoneyToRepDivisor*t.faction_rep_mult}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(74);const r={longestName:0,longestSymbol:0};for(const e in n.a)r.longestName=Math.max(e.length,r.longestName),r.longestSymbol=Math.max(n.a[e].length,r.longestSymbol)},function(e,t,a){"use strict";a.d(t,"b",(function(){return i})),a.d(t,"a",(function(){return o}));var n=a(121);function r(e){return"string"==typeof e&&(!isNaN(e)&&!isNaN(parseFloat(e)))}function i(e){const t=(e=(e=e.trim()).replace(/\s\s+/g," ")).match(/(?:'[^']*'|"[^"]*"|[^;"])*/g);if(!t)return[];const a=t.map(n.h).map(e=>e.match(/(?:'[^']*'|"[^"]*"|[^;"])*/g)).flat(),r=[];for(const e of a)null!==e&&(e.match(/^\s*$/)||r.push(e.trim()));return r}function o(e){let t="";const a=[];let n=0,i=0,o="";for(;i=1&&(o=e.charAt(i-1),"\\"===o&&(s=!0));const l=e.charAt(i);if('"'===l)if(s||" "!==o)""===t?t='"':'"'===t&&(t="");else{const t=e.indexOf('"',i+1);if(-1!==t&&(t===e.length-1||" "===e.charAt(t+1))){a.push(e.substr(i+1,t-i-1)),n=i=t===e.length-1?t+1:t+2;continue}}else if("'"===l)if(s||" "!==o)""===t?t="'":"'"===t&&(t="");else{const t=e.indexOf("'",i+1);if(-1!==t&&(t===e.length-1||" "===e.charAt(t+1))){a.push(e.substr(i+1,t-i-1)),n=i=t===e.length-1?t+1:t+2;continue}}else if(" "===l&&""===t){const t=e.substr(n,i-n);r(t)?a.push(parseFloat(t)):a.push(t),n=i+1}++i}if(n!==i){const t=e.substr(n,i-n);r(t)?a.push(parseFloat(t)):a.push(t)}return a}},function(e,t,a){"use strict";a.d(t,"b",(function(){return n})),a.d(t,"a",(function(){return r}));const n=["Type 'help name' to learn more about the command ","",'alias [-g] [name="value"] Create or display Terminal aliases',"analyze Get information about the current machine ","backdoor Install a backdoor on the current machine ","buy [-l/program] Purchase a program through the Dark Web","cat [file] Display a .msg, .lit, or .txt file","cd [dir] Change to a new directory","check [script] [args...] Print a script's logs to Terminal","clear Clear all text on the terminal ","cls See 'clear' command ","connect [ip/hostname] Connects to a remote server","download [script/text file] Downloads scripts or text files to your computer","expr [math expression] Evaluate a mathematical expression","free Check the machine's memory (RAM) usage","hack Hack the current machine","help [command] Display this help text, or the help text for a command","home Connect to home computer","hostname Displays the hostname of the machine","ifconfig Displays the IP address of the machine","kill [script/pid] [args...] Stops the specified script on the current server ","killall Stops all running scripts on the current machine","ls [dir] [| grep pattern] Displays all files on the machine","lscpu Displays the number of CPU cores on the machine","mem [script] [-t] [n] Displays the amount of RAM required to run the script","mv [src] [dest] Move/rename a text or script file","nano [file] Text editor - Open up and edit a script or text file","ps Display all scripts that are currently running","rm [file] Delete a file from the server","run [name] [-t n] [--tail] [args...] Execute a program or script","scan Prints all immediately-available network connections","scan-analyze [d] [-a] Prints info for all servers up to d nodes away","scp [file] [server] Copies a file to a destination server","sudov Shows whether you have root access on this computer","tail [script] [args...] Displays dynamic logs for the specified script","top Displays all running scripts and their RAM usage","unalias [alias name] Deletes the specified alias","wget [url] [target file] Retrieves code/text from a web server"],r={alias:['alias [-g] [name="value"] '," ","Create or display aliases. An alias enables a replacement of a word with another string. ","It can be used to abbreviate a commonly used command, or commonly used parts of a command. The NAME ","of an alias defines the word that will be replaced, while the VALUE defines what it will be replaced by. For example, ","you could create the alias 'nuke' for the Terminal command 'run NUKE.exe' using the following: "," ",'alias nuke="run NUKE.exe"'," ","Then, to run the NUKE.exe program you would just have to enter 'nuke' in Terminal rather than the full command. ","It is important to note that 'default' aliases will only be substituted for the first word of a Terminal command. For ","example, if the following alias was set: "," ",'alias worm="HTTPWorm.exe"'," ","and then you tried to run the following terminal command: "," ","run worm"," ","This would fail because the worm alias is not the first word of a Terminal command. To allow an alias to be substituted ","anywhere in a Terminal command, rather than just the first word, you must set it to be a global alias using the -g flag: "," ",'alias -g worm="HTTPWorm.exe"'," ","Now, the 'worm' alias will be substituted anytime it shows up as an individual word in a Terminal command. "," ","Entering just the command 'alias' without any arguments prints the list of all defined aliases in the reusable form ","'alias NAME=VALUE' on the Terminal. "," ","The 'unalias' command can be used to remove aliases."," "],analyze:["analze"," ","Prints details and statistics about the current server. The information that is printed includes basic ","server details such as the hostname, whether the player has root access, what ports are opened/closed, and also ","hacking-related information such as an estimated chance to successfully hack, an estimate of how much money is ","available on the server, etc."],backdoor:["backdoor"," ","Install a backdoor on the current machine, grants a secret bonus depending on the machine."," ","Requires root access to run."," "],buy:["buy [-l / program]"," ","Purchase a program through the Dark Web. Requires a TOR router to use."," ","If this command is ran with the '-l' flag, it will display a list of all programs that can be bought through the ","dark web to the Terminal, as well as their costs."," ","Otherwise, the name of the program must be passed in as a parameter. This name is NOT case-sensitive."],cat:["cat [file]"," ","Display message (.msg), literature (.lit), or text (.txt) files. Examples:"," ","cat j1.msg"," ","cat foo.lit"," ","cat servers.txt"],cd:["cd [dir]"," ","Change to the specified directory. Note that this works even for directories that don't exist. If you ","change to a directory that does not exist, it will not be 'created'. Examples:"," ","cd scripts/hacking"," ","cd /logs"," ","cd ../"],check:["check [script name] [args...]"," ","Print the logs of the script specified by the script name and arguments to the Terminal. Each argument must be separated by ","a space. Remember that a running script is uniquely ","identified both by its name and the arguments that are used to start it. So, if a script was ran with the following arguments: "," ","run foo.script 1 2 foodnstuff"," ","Then to run the 'check' command on this script you would have to pass the same arguments in: "," ","check foo.script 1 2 foodnstuff"],clear:["clear"," ","Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up ","and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'cls' command"],cls:["cls"," ","Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up ","and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'clear' command"],connect:["connect [hostname/ip]"," ","Connect to a remote server. The hostname or IP address of the remote server must be given as the argument ","to this command. Note that only servers that are immediately adjacent to the current server in the network can be connected to. To ","see which servers can be connected to, use the 'scan' command."],download:["download [script/text file]"," ","Downloads a script or text file to your computer (like your real life computer)."," ","You can also download all of your scripts/text files as a zip file using the following Terminal commands:"," ","Download all scripts and text files: download *"," ","Download all scripts: download *.script"," ","Download all text files: download *.txt"," "],expr:["expr [mathematical expression]"," ","Evaluate a simple mathematical expression. Supports native JavaScript operators:"," ","+, -, /, *, **, %"," ","Example:"," ","expr 25 * 2 ** 10"," ","Note that letters (non-digits) are not allowed and will be removed from the input."],free:["free"," ","Display's the memory usage on the current machine. Print the amount of RAM that is available on the current server as well as ","how much of it is being used."],hack:["hack"," ","Attempt to hack the current server. Requires root access in order to be run. See the wiki page for hacking mechanics"," "],help:["help [command]"," ","Display Terminal help information. Without arguments, 'help' prints a list of all valid Terminal commands and a brief ","description of their functionality. You can also pass the name of a Terminal command as an argument to 'help' to print ","more detailed information about the Terminal command. Examples: "," ","help alias"," ","help scan-analyze"],home:["homeConnect to your home computer. This will work no matter what server you are currently connected to."],hostname:["hostname"," ","Prints the hostname of the current server"],ifconfig:["ipconfig"," ","Prints the IP address of the current server"],kill:["kill [script name] [args...]"," ","kill [pid]"," ","Kill the script specified by the script name and arguments OR by its PID."," ","If you are killing the script using its filename and arguments, then each ","argument must be separated by a space. Remember that a running script is ","uniquely identified by both its name and the arguments that are used to start ","it. So, if a script was ran with the following arguments:"," ","run foo.script 1 sigma-cosmetics"," ","Then to kill this script the same arguments would have to be used:"," ","kill foo.script 1 sigma-cosmetics"," ","If you are killing the script using its PID, then the PID argument must be numeric"],killall:["killall"," ","Kills all scripts on the current server. ","Note that after the 'kill' command is issued for a script, it may take a while for the script to actually stop running. ","This will happen if the script is in the middle of a command such as grow() or weaken() that takes time to execute. ","The script will not be stopped/killed until after that time has elapsed."],ls:["ls [dir] [| grep pattern]"," ","The ls command, with no arguments, prints all files and directories on the current server's directory to the Terminal screen. ","The files will be displayed in alphabetical order. "," ","The 'dir' optional parameter can be used to display files/directories in another directory."," ","The '| grep pattern' optional parameter can be used to only display files whose filenames match the specified pattern."," ","Examples:"," ","List all files with the '.script' extension in the current directory:"," ","ls | grep .script"," ","List all files with the '.js' extension in the root directory:"," ","ls / | grep .js"," ","List all files with the word 'purchase' in the filename, in the 'scripts' directory:"," ","ls scripts | grep purchase"],lscpu:["lscpu"," ","Prints the number of CPU Cores the current server has"],mem:["mem [script name] [-t num_threads]"," ","Displays the amount of RAM needed to run the specified script with a single thread. The command can also be used to print ","the amount of RAM needed to run a script with multiple threads using the '-t' flag. If the '-t' flag is specified, then ","an argument for the number of threads must be passed in afterwards. Examples:"," ","mem foo.script"," ","mem foo.script -t 50"," ","The first example above will print the amount of RAM needed to run 'foo.script' with a single thread. The second example ","above will print the amount of RAM needed to run 'foo.script' with 50 threads."],mv:["mv [src] [dest]"," ","Move the source file to the specified destination. This can also be used to rename files. ","This command only works for scripts and text files (.txt). This command CANNOT be used to ","convert to different file types"," ","Note that, unlike the Linux 'mv' command, the destination argument must be the ","full filepath. ","Examples: "," ","mv hacking-controller.script scripts/hacking-controller.script"," ","mv myScript.js myOldScript.js"],nano:["nano [file name]"," ","Opens up the specified file in the Text Editor. Only scripts (.script) or text files (.txt) can be ","edited using the Text Editor. If the file does not already exist, then a new, empty one ","will be created"],ps:["ps"," ","Prints all scripts that are running on the current server"],rm:["rm [file]"," ","Removes the specified file from the current server. A file can be a script, a program, or a message file. "," ","WARNING: This is permanent and cannot be undone"],run:["run [file name] [-t] [num threads] [args...]"," ","Execute a program or a script."," ","The '[-t]', '[num threads]', and '[args...]' arguments are only valid when running a script. The '-t' flag is used ","to indicate that the script should be run with the specified number of threads. If the flag is omitted, ","then the script will be run with a single thread by default. ","If the '-t' flag is used, then it MUST come immediately ","after the script name, and the [num threads] argument MUST come immediately afterwards. "," ","[args...] represents a variable number of arguments that will be passed into the script. See the documentation ","about script arguments. Each specified argument must be separated by a space. "," "],scan:["scan"," ","Prints all immediately-available network connection. This will print a list of all servers that you can currently connect ","to using the 'connect' Terminal command."],"scan-analyze":["scan-analyze [depth] [-a]"," ","Prints detailed information about all servers up to [depth] nodes away on the network. Calling ","'scan-analyze 1' will display information for the same servers that are shown by the 'scan' Terminal ","command. This command also shows the relative paths to reach each server."," ","By default, the maximum depth that can be specified for 'scan-analyze' is 3. However, once you have ","the DeepscanV1.exe and DeepscanV2.exe programs, you can execute 'scan-analyze' with a depth up to ","5 and 10, respectively."," ","The information 'scan-analyze' displays about each server includes whether or not you have root access to it, ","its required hacking level, the number of open ports required to run NUKE.exe on it, and how much RAM ","it has."," ","By default, this command will not display servers that you have purchased. However, you can pass in the ","-a flag at the end of the command if you would like to enable that."],scp:["scp [filename] [target server]"," ","Copies the specified file from the current server to the target server. ","This command only works for script files (.script extension), literature files (.lit extension), ","and text files (.txt extension). ","The second argument passed in must be the hostname or IP of the target server."],sudov:["sudov"," ","Prints whether or not you have root access to the current machine"],tail:["tail [script name] [args...]"," ","Displays dynamic logs for the script specified by the script name and arguments. Each argument must be separated ","by a space. Remember that a running script is uniquely identified by both its name and the arguments that were used ","to run it. So, if a script was ran with the following arguments: "," ","run foo.script 10 50000"," ","Then in order to check its logs with 'tail' the same arguments must be used: "," ","tail foo.script 10 50000"],top:["top"," ","Prints a list of all scripts running on the current server as well as their thread count and how much ","RAM they are using in total."],unalias:["unalias [alias name]"," ","Deletes the specified alias. Note that the double quotation marks are required. "," ","As an example, if an alias was declared using:"," ",'alias r="run"'," ","Then it could be removed using:"," ","unalias r"," ","It is not necessary to differentiate between global and non-global aliases when using 'unalias'"],wget:["wget [url] [target file]"," ","Retrieves data from a URL and downloads it to a file on the current server. The data can only ","be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists, ","it will be overwritten by this command."," ","Note that it will not be possible to download data from many websites because they do not allow ","cross-origin resource sharing (CORS). Example:"," ","wget https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md game_readme.txt"]}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return ne}));var n=a(267),r=a(94),i=a(58),o=a(83),s=a(268),l=a(89),c=a(4),u=a(32),m=a(98),h=a(423),p=a(35),d=a(38),f=a(630),g=a(55),y=a(18),b=a(143),E=a(85),v=a(3),k=a(14),_=a(1109),w=a(1110),C=a(1111),S=a(1112),x=a(1113),O=a(1114),T=a(1115),M=a(1116),P=a(1117),R=a(1120),A=a(1121),N=a(1122),I=a(1123),j=a(1124),F=a(1125),D=a(1126),B=a(1127),L=a(1128),G=a(1129),W=a(1130),H=a(1131),U=a(1132),q=a(1133),K=a(1134),$=a(1135),z=a(1136),Y=a(1139),V=a(1140),J=a(1141),Q=a(1142),X=a(1143),Z=a(1144),ee=a(1145),te=a(1146);function ae(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class ne{constructor(){ae(this,"action",null),ae(this,"commandHistory",[]),ae(this,"commandHistoryIndex",0),ae(this,"outputHistory",[new n.b("Bitburner v"+c.a.Version,"primary")]),ae(this,"contractOpen",!1),ae(this,"currDir","/")}process(e,t,a){null!==this.action&&(this.action.timeLeft-=c.a._idleSpeed*a/1e3,this.action.timeLeft<.01&&this.finishAction(e,t,!1),s.b.emit())}append(e){this.outputHistory.push(e),this.outputHistory.length>y.a.MaxTerminalCapacity&&this.outputHistory.slice(this.outputHistory.length-y.a.MaxTerminalCapacity),s.b.emit()}print(e){this.append(new n.b(e,"primary"))}error(e){this.append(new n.b(e,"error"))}startHack(e){this.startAction(Object(E.d)(e.getCurrentServer(),e)/4,"h")}startBackdoor(e){this.startAction(Object(E.d)(e.getCurrentServer(),e)/4,"b")}startAnalyze(){this.print("Analyzing system..."),this.startAction(1,"a")}startAction(e,t){this.action=new n.c(e,t)}finishHack(e,t,a=!1){if(a)return;const n=t.getCurrentServer(),r=Object(E.b)(n,t),i=Math.random(),o=Object(E.c)(n,t),s=o/4;if(i=n.getMaxNumTries()?(this.print("Contract FAILED - Contract is now self-destructing"),a.removeContract(n)):this.print(`Contract FAILED - ${n.getMaxNumTries()-n.tries} tries remaining`);break;case o.b.Cancelled:default:this.print("Contract cancelled")}this.contractOpen=!1}executeScanAnalyzeCommand(e,t=1,a=!1){this.print("~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~"),this.print(" ");const o={};for(const e in u.b)o[e]=0;const s=[],l=[0],c=e.getCurrentServer();for(s.push(c);0!=s.length;){const c=s.pop();if(!c)continue;const u=l.pop();if(void 0===u)continue;const m=c instanceof r.a;if(!a&&c.purchasedByPlayer&&"home"!=c.hostname)continue;if(o[c.ip]||u>t)continue;if(!a&&m)continue;o[c.ip]=1;for(let e=c.serversOnNetwork.length-1;e>=0;--e){const t=Object(d.c)(c,e);null!==t&&(s.push(t),l.push(u+1))}if(0==u)continue;const h=Array(4*(u-1)+1).join("-");e.hasProgram(i.a.AutoLink.name)?this.append(new n.a(h,c.hostname)):this.print(h+c.hostname);const p=h+"--";let f="NO";c.hasAdminRights&&(f="YES"),this.print(`${p}Root Access: ${f}${m?"":", Required hacking skill: "+c.requiredHackingSkill}`),c.hasOwnProperty("numOpenPortsRequired")&&this.print(p+"Number of open ports required to NUKE: "+c.numOpenPortsRequired),this.print(p+"RAM: "+v.a.formatRAM(c.maxRam)),this.print(" ")}}connectToServer(e,t){const a=Object(d.b)(t);null!=a?(e.getCurrentServer().isConnectedTo=!1,e.currentServer=a.ip,e.getCurrentServer().isConnectedTo=!0,this.print("Connected to "+a.hostname),this.setcwd("/"),"darkweb"==e.getCurrentServer().hostname&&Object(h.b)()):this.error("Invalid server. Connection failed.")}executeCommands(e,t,a){a=(a=a.trim()).replace(/\s\s+/g," "),this.commandHistory[this.commandHistory.length-1]!=a&&(this.commandHistory.push(a),this.commandHistory.length>50&&this.commandHistory.splice(0,1)),this.commandHistoryIndex=this.commandHistory.length;const n=Object(f.b)(a);for(let a=0;athis.clear(),clear:()=>this.clear(),connect:M.a,download:P.a,expr:R.a,free:A.a,hack:N.a,help:I.a,home:j.a,hostname:F.a,ifconfig:D.a,kill:B.a,killall:L.a,ls:G.a,lscpu:W.a,mem:H.a,mv:U.a,nano:q.a,ps:K.a,rm:$.a,run:z.a,scan:Y.a,"scan-analyze":V.a,scp:J.a,sudov:Q.a,tail:X.a,top:Z.a,unalias:ee.a,wget:te.a}[i.toLowerCase()];o?o(this,e,t,r,n.slice(1)):this.error(`Command ${n[0]} not found`)}getProgressText(){if(null===this.action)throw new Error("trying to get the progress text when there's no action");return Object(b.a)({progress:(this.action.time-this.action.timeLeft)/this.action.time,totalTicks:50})}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(21);function r(e){let t=e;return t.startsWith("[")&&(t=t.slice(1)),t.endsWith("]")&&(t=t.slice(0,-1)),t}function i(e){let t=e;return(t.startsWith('"')||t.startsWith("'"))&&(t=t.slice(1)),(t.endsWith('"')||t.endsWith("'"))&&(t=t.slice(0,-1)),t}function o(e){const t=[];return e.forEach(e=>{let a=e.toString();a=["[",a,"]"].join(""),t.push(a)}),t.join(",").replace(/\s/g,"")}const s=[{desc:e=>["A prime factor is a factor that is a prime number.",`What is the largest prime factor of ${e}?`].join(" "),difficulty:1,gen:()=>Object(n.a)(500,1e9),name:"Find Largest Prime Factor",numTries:10,solver:(e,t)=>{let a=2,n=e;for(;n>(a-1)*(a-1);){for(;n%a==0;)n=Math.round(n/a);++a}return(1===n?a-1:n)===parseInt(t,10)}},{desc:e=>["Given the following integer array, find the contiguous subarray","(containing at least one number) which has the largest sum and return that sum.","'Sum' refers to the sum of all the numbers in the subarray.\n",""+e.toString()].join(" "),difficulty:1,gen:()=>{const e=Object(n.a)(5,40),t=[];t.length=e;for(let a=0;a{const a=e.slice();for(let e=1;e["It is possible write four as a sum in exactly four different ways:\n\n","    3 + 1\n","    2 + 2\n","    2 + 1 + 1\n","    1 + 1 + 1 + 1\n\n",`How many different ways can the number ${e} be written as a sum of at least`,"two positive integers?"].join(" "),difficulty:1.5,gen:()=>Object(n.a)(8,100),name:"Total Ways to Sum",numTries:10,solver:(e,t)=>{const a=[1];a.length=e+1,a.fill(0,1);for(let t=1;t{let t=["Given the following array of array of numbers representing a 2D matrix,","return the elements of the matrix as an array in spiral order:\n\n"].join(" ");return t+="    [\n",t+=e.map(e=>"        ["+e.map(e=>(""+e).padStart(2," ")).join(",")+"]").join("\n"),t+="\n    ]\n",t+=["\nHere is an example of what spiral order should be:\n\n","    [\n","        [1, 2, 3]\n","        [4, 5, 6]\n","        [7, 8, 9]\n","    ]\n\n","Answer: [1, 2, 3, 6, 9, 8 ,7, 4, 5]\n\n","Note that the matrix will not always be square:\n\n","    [\n","        [1,  2,  3,  4]\n","        [5,  6,  7,  8]\n","        [9, 10, 11, 12]\n","    ]\n\n","Answer: [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]"].join(" "),t},difficulty:2,gen:()=>{const e=Object(n.a)(1,15),t=Object(n.a)(1,15),a=[];a.length=e;for(let n=0;n{const a=[];let n=0,i=e.length-1,o=0,s=e[0].length-1,l=0;for(;;){for(let t=o;t<=s;t++)a[l]=e[n][t],++l;if(++n>i)break;for(let t=n;t<=i;t++)a[l]=e[t][s],++l;if(--s=o;t--)a[l]=e[i][t],++l;if(--i=n;t--)a[l]=e[t][o],++l;if(++o>s)break}const c=r(t).replace(/\s/g,"").split(",");for(let e=0;e["You are given the following array of integers:\n\n",e+"\n\n","Each element in the array represents your MAXIMUM jump length","at that position. This means that if you are at position i and your","maximum jump length is n, you can jump to any position from","i to i+n.","\n\nAssuming you are initially positioned","at the start of the array, determine whether you are","able to reach the last index exactly.\n\n","Your answer should be submitted as 1 or 0, representing true and false respectively"].join(" "),difficulty:2.5,gen:()=>{const e=Object(n.a)(3,25),t=[];t.length=e;for(let e=0;e{const a=e.length;let n=0;for(let t=0;n["Given the following array of array of numbers representing a list of","intervals, merge all overlapping intervals.\n\n",`[${o(e)}]\n\n`,"Example:\n\n","[[1, 3], [8, 10], [2, 6], [10, 16]]\n\n","would merge into [[1, 6], [8, 16]].\n\n","The intervals must be returned in ASCENDING order.","You can assume that in an interval, the first number will always be","smaller than the second."].join(" "),difficulty:3,gen:()=>{const e=[],t=Object(n.a)(3,20);for(let a=0;a{const a=e.slice();a.sort((e,t)=>e[0]-t[0]);const n=[];let i=a[0][0],s=a[0][1];for(const e of a)e[0]<=s?s=Math.max(s,e[1]):(n.push([i,s]),i=e[0],s=e[1]);n.push([i,s]);const l=o(n),c=t.replace(/\s/g,"");return l===c||l===r(c)}},{desc:e=>["Given the following string containing only digits, return","an array with all possible valid IP address combinations","that can be created from the string:\n\n",e+"\n\n","Note that an octet cannot begin with a '0' unless the number","itself is actually 0. For example, '192.168.010.1' is not a valid IP.\n\n","Examples:\n\n","25525511135 -> [255.255.11.135, 255.255.111.35]\n","1938718066 -> [193.87.180.66]"].join(" "),difficulty:3,gen:()=>{let e="";for(let t=0;t<4;++t){e+=Object(n.a)(0,255).toString()}return e},name:"Generate IP Addresses",numTries:10,solver:(e,t)=>{const a=[];for(let t=1;t<=3;++t)for(let n=1;n<=3;++n)for(let r=1;r<=3;++r)for(let i=1;i<=3;++i)if(t+n+r+i===e.length){const o=parseInt(e.substring(0,t),10),s=parseInt(e.substring(t,t+n),10),l=parseInt(e.substring(t+n,t+n+r),10),c=parseInt(e.substring(t+n+r,t+n+r+i),10);if(o<=255&&s<=255&&l<=255&&c<=255){const t=[o.toString(),".",s.toString(),".",l.toString(),".",c.toString()].join("");t.length===e.length+3&&a.push(t)}}const n=r(t).replace(/\s/g,"").split(",");if(n.length!==a.length)return!1;for(const e of n)if(!a.includes(e))return!1;return!0}},{desc:e=>["You are given the following array of stock prices (which are numbers)","where the i-th element represents the stock price on day i:\n\n",e+"\n\n","Determine the maximum possible profit you can earn using at most","one transaction (i.e. you can only buy and sell the stock once). If no profit can be made","then the answer should be 0. Note","that you have to buy the stock before you can sell it"].join(" "),difficulty:1,gen:()=>{const e=Object(n.a)(3,50),t=[];t.length=e;for(let a=0;a{let a=0,n=0;for(let t=1;t["You are given the following array of stock prices (which are numbers)","where the i-th element represents the stock price on day i:\n\n",e+"\n\n","Determine the maximum possible profit you can earn using as many","transactions as you'd like. A transaction is defined as buying","and then selling one share of the stock. Note that you cannot","engage in multiple transactions at once. In other words, you","must sell the stock before you buy it again.\n\n","If no profit can be made, then the answer should be 0"].join(" "),difficulty:2,gen:()=>{const e=Object(n.a)(3,50),t=[];t.length=e;for(let a=0;a{let a=0;for(let t=1;t["You are given the following array of stock prices (which are numbers)","where the i-th element represents the stock price on day i:\n\n",e+"\n\n","Determine the maximum possible profit you can earn using at most","two transactions. A transaction is defined as buying","and then selling one share of the stock. Note that you cannot","engage in multiple transactions at once. In other words, you","must sell the stock before you buy it again.\n\n","If no profit can be made, then the answer should be 0"].join(" "),difficulty:5,gen:()=>{const e=Object(n.a)(3,50),t=[];t.length=e;for(let a=0;a{let a=Number.MIN_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER,r=0,i=0;for(const t of e)i=Math.max(i,n+t),n=Math.max(n,r-t),r=Math.max(r,a+t),a=Math.max(a,-1*t);return i.toString()===t}},{desc:e=>["You are given the following array with two elements:\n\n",`[${e[0]}, [${e[1]}]]\n\n`,"The first element is an integer k. The second element is an","array of stock prices (which are numbers) where the i-th element","represents the stock price on day i.\n\n","Determine the maximum possible profit you can earn using at most","k transactions. A transaction is defined as buying and then selling","one share of the stock. Note that you cannot engage in multiple","transactions at once. In other words, you must sell the stock before","you can buy it again.\n\n","If no profit can be made, then the answer should be 0."].join(" "),difficulty:8,gen:()=>{const e=Object(n.a)(2,10),t=Object(n.a)(3,50),a=[];a.length=t;for(let e=0;e{const a=e[0],n=e[1],r=n.length;if(r<2)return 0===parseInt(t);if(a>r/2){let e=0;for(let t=1;t0;--e)o[e]=Math.max(o[e],i[e]+s),i[e]=Math.max(i[e],o[e-1]-s)}return parseInt(t)===o[a]}},{desc:e=>{function t(e,a=0){const n=e.length;if(a>=n)return"";let r=[" ".repeat(n-a+1),"[",e[a].toString(),"]"].join("");return a 3 -> 5 -> 1)."].join(" ")},difficulty:5,gen:()=>{const e=[],t=Object(n.a)(3,12);e.length=t;for(let a=0;a{const a=e.length,n=e[a-1].slice();for(let t=a-2;t>-1;--t)for(let a=0;a{const t=e[0],a=e[1];return["You are in a grid with",`${t} rows and ${a} columns, and you are`,"positioned in the top-left corner of that grid. You are trying to","reach the bottom-right corner of the grid, but you can only","move down or right on each step. Determine how many","unique paths there are from start to finish.\n\n","NOTE: The data returned for this contract is an array","with the number of rows and columns:\n\n",`[${t}, ${a}]`].join(" ")},difficulty:3,gen:()=>[Object(n.a)(2,14),Object(n.a)(2,14)],name:"Unique Paths in a Grid I",numTries:10,solver:(e,t)=>{const a=e[0],n=e[1],r=[];r.length=a;for(let e=0;e{let t="";for(const a of e)t+=a.toString()+",\n";return["You are located in the top-left corner of the following grid:\n\n",t+"\n","You are trying reach the bottom-right corner of the grid, but you can only","move down or right on each step. Furthermore, there are obstacles on the grid","that you cannot move onto. These obstacles are denoted by '1', while empty","spaces are denoted by 0.\n\n","Determine how many unique paths there are from start to finish.\n\n","NOTE: The data returned for this contract is an 2D array of numbers representing the grid."].join(" ")},difficulty:5,gen:()=>{const e=Object(n.a)(2,12),t=Object(n.a)(2,12),a=[];a.length=e;for(let n=0;n{const a=[];a.length=e.length;for(let t=0;t0?a[e-1][t]:0)+(t>0?a[e][t-1]:0);return a[a.length-1][a[0].length-1]===parseInt(t)}},{desc:e=>["Given the following string:\n\n",e+"\n\n","remove the minimum number of invalid parentheses in order to validate","the string. If there are multiple minimal ways to validate the string,","provide all of the possible results. The answer should be provided","as an array of strings. If it is impossible to validate the string","the result should be an array with only an empty string.\n\n","IMPORTANT: The string may contain letters, not just parentheses.","Examples:\n",'"()())()" -> [()()(), (())()]\n','"(a)())()" -> [(a)()(), (a())()]\n','")( -> [""]'].join(" "),difficulty:10,gen:()=>{const e=Object(n.a)(6,20),t=[];t.length=e,Math.random()<.8?t[0]="(":t[0]=")";for(let a=1;a{let a=0,n=0;const i=[];for(let t=0;t0?--a:++n);!function e(t,a,n,r,i,o,s){if(i.length!==a)"("===i[a]?(n>0&&e(t,a+1,n-1,r,i,o,s),e(t+1,a+1,n,r,i,o+i[a],s)):")"===i[a]?(r>0&&e(t,a+1,n,r-1,i,o,s),t>0&&e(t-1,a+1,n,r,i,o+i[a],s)):e(t,a+1,n,r,i,o+i[a],s);else if(0===n&&0===r&&0===t){for(let e=0;e{const t=e[0],a=e[1];return["You are given the following string which contains only digits between 0 and 9:\n\n",t+"\n\n",`You are also given a target number of ${a}. Return all possible ways`,"you can add the +, -, and * operators to the string such that it evaluates","to the target number.\n\n","The provided answer should be an array of strings containing the valid expressions.","The data provided by this problem is an array with two elements. The first element","is the string of digits, while the second element is the target number:\n\n",`["${t}", ${a}]\n\n`,"NOTE: Numbers in the expression cannot have leading 0's. In other words,",'"1+01" is not a valid expression',"Examples:\n\n",'Input: digits = "123", target = 6\n',"Output: [1+2+3, 1*2*3]\n\n",'Input: digits = "105", target = 5\n',"Output: [1*0+5, 10-5]"].join(" ")},difficulty:10,gen:()=>{const e=Object(n.a)(4,12),t=[];t.length=e;for(let e=0;e{const a=e[0],n=e[1];const o=r(t).split(",");for(let e=0;e(document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)})),r.a.createElement("div",{className:"popup-box-content",id:e.id+"-content"},r.a.createElement(e.content,e.props))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(79),o=a(83),s=a(127);function l(e){const[t,a]=Object(n.useState)("");const l=o.d[e.c.type],c=[];for(const[t,a]of l.desc(e.c.data).split("\n").entries())c.push(r.a.createElement("span",{key:t,dangerouslySetInnerHTML:{__html:a+"
"}}));return r.a.createElement("div",null,r.a.createElement(s.b,{value:e.c.type,tag:s.a.Tag_h1}),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",null,"You are attempting to solve a Coding Contract. You have ",e.c.getMaxNumTries()-e.c.tries," tries remaining, after which the contract will self-destruct."),r.a.createElement("br",null),r.a.createElement("p",null,c),r.a.createElement("br",null),r.a.createElement("input",{className:"text-input",style:{width:"50%",marginTop:"8px"},autoFocus:!0,placeholder:"Enter Solution here",value:t,onChange:function(e){a(e.target.value)},onKeyDown:function(a){const n=a.target.value;a.keyCode===i.a.ENTER&&""!==n&&(a.preventDefault(),e.onAttempt(t))}}),r.a.createElement("button",{className:"std-button",onClick:()=>e.onAttempt(t)},"Solve"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));class n{constructor(e,t,a){var n,r,i;i="",(r="name")in(n=this)?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,this.name=e,this.create=t,this.run=a}htmlID(){return"create-program-"+(this.name.endsWith(".exe")?this.name.slice(0,-".exe".length):this.name)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(4),r=a(101),i=a(94),o=a(14),s=a(38),l=a(3),c=a(7),u=a(22),m=a(723),h=a(85);function p(e){return function(t){return t.hacking_skill>=e}}const d=[{key:"NukeProgram",name:"NUKE.exe",create:{level:1,tooltip:"This virus is used to gain root access to a machine if enough ports are opened.",req:p(1),time:n.a.MillisecondsPerFiveMinutes},run:(e,t,a,n)=>{if(n instanceof r.a){if(!n.hasAdminRights)return n.openPortCount>=a.getCurrentServer().numOpenPortsRequired?(n.hasAdminRights=!0,void t.print("NUKE successful! Gained root access to "+a.getCurrentServer().hostname)):void t.print("NUKE unsuccessful. Not enough ports have been opened");t.print("You already have root access to this computer. There is no reason to run NUKE.exe")}else t.error("Cannot nuke this kind of server.")}},{key:"BruteSSHProgram",name:"BruteSSH.exe",create:{level:50,tooltip:"This program executes a brute force attack that opens SSH ports",req:p(50),time:2*n.a.MillisecondsPerFiveMinutes},run:(e,t,a,n)=>{n instanceof r.a?n.sshPortOpen?t.print("SSH Port (22) is already open!"):(n.sshPortOpen=!0,t.print("Opened SSH Port(22)!"),n.openPortCount++):t.error("Cannot run BruteSSH.exe on this kind of server.")}},{key:"FTPCrackProgram",name:"FTPCrack.exe",create:{level:100,tooltip:"This program cracks open FTP ports",req:p(100),time:n.a.MillisecondsPerHalfHour},run:(e,t,a,n)=>{n instanceof r.a?n.ftpPortOpen?t.print("FTP Port (21) is already open!"):(n.ftpPortOpen=!0,t.print("Opened FTP Port (21)!"),n.openPortCount++):t.error("Cannot run FTPCrack.exe on this kind of server.")}},{key:"RelaySMTPProgram",name:"relaySMTP.exe",create:{level:250,tooltip:"This program opens SMTP ports by redirecting data",req:p(250),time:n.a.MillisecondsPer2Hours},run:(e,t,a,n)=>{n instanceof r.a?n.smtpPortOpen?t.print("SMTP Port (25) is already open!"):(n.smtpPortOpen=!0,t.print("Opened SMTP Port (25)!"),n.openPortCount++):t.error("Cannot run relaySMTP.exe on this kind of server.")}},{key:"HTTPWormProgram",name:"HTTPWorm.exe",create:{level:500,tooltip:"This virus opens up HTTP ports",req:p(500),time:n.a.MillisecondsPer4Hours},run:(e,t,a,n)=>{n instanceof r.a?n.httpPortOpen?t.print("HTTP Port (80) is already open!"):(n.httpPortOpen=!0,t.print("Opened HTTP Port (80)!"),n.openPortCount++):t.error("Cannot run HTTPWorm.exe on this kind of server.")}},{key:"SQLInjectProgram",name:"SQLInject.exe",create:{level:750,tooltip:"This virus opens SQL ports",req:p(750),time:n.a.MillisecondsPer8Hours},run:(e,t,a,n)=>{n instanceof r.a?n.sqlPortOpen?t.print("SQL Port (1433) is already open!"):(n.sqlPortOpen=!0,t.print("Opened SQL Port (1433)!"),n.openPortCount++):t.error("Cannot run SQLInject.exe on this kind of server.")}},{key:"DeepscanV1",name:"DeepscanV1.exe",create:{level:75,tooltip:"This program allows you to use the scan-analyze command with a depth up to 5",req:p(75),time:n.a.MillisecondsPerQuarterHour},run:(e,t)=>{t.print("This executable cannot be run."),t.print("DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5.")}},{key:"DeepscanV2",name:"DeepscanV2.exe",create:{level:400,tooltip:"This program allows you to use the scan-analyze command with a depth up to 10",req:p(400),time:n.a.MillisecondsPer2Hours},run:(e,t)=>{t.print("This executable cannot be run."),t.print("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10.")}},{key:"ServerProfiler",name:"ServerProfiler.exe",create:{level:75,tooltip:"This program is used to display hacking and Netscript-related information about servers",req:p(75),time:n.a.MillisecondsPerHalfHour},run:(e,t,a,n,r)=>{if(1!==r.length)return void t.print("Must pass a server hostname or IP as an argument for ServerProfiler.exe");const l=Object(s.b)(r[0]);null!=l?l instanceof i.a?t.print("ServerProfiler.exe cannot be run on a Hacknet Server."):(t.print(l.hostname+":"),t.print("Server base security level: "+l.baseDifficulty),t.print("Server current security level: "+l.hackDifficulty),t.print("Server growth rate: "+l.serverGrowth),t.print("Netscript hack() execution time: "+Object(o.b)(1e3*Object(h.d)(l,a),!0)),t.print("Netscript grow() execution time: "+Object(o.b)(1e3*Object(h.a)(l,a),!0)),t.print("Netscript weaken() execution time: "+Object(o.b)(1e3*Object(h.f)(l,a),!0))):t.print("Invalid server IP/hostname")}},{key:"AutoLink",name:"AutoLink.exe",create:{level:25,tooltip:"This program allows you to directly connect to other servers through the 'scan-analyze' command",req:p(25),time:n.a.MillisecondsPerQuarterHour},run:(e,t)=>{t.print("This executable cannot be run."),t.print("AutoLink.exe lets you automatically connect to other servers when using 'scan-analyze'."),t.print("When using scan-analyze, click on a server's hostname to connect to it.")}},{key:"BitFlume",name:"b1t_flum3.exe",create:{level:1,tooltip:"This program creates a portal to the BitNode Nexus (allows you to restart and switch BitNodes)",req:function(e){return e.sourceFiles.length>0&&e.hacking_skill>=1},time:n.a.MillisecondsPerFiveMinutes/20},run:(e,t,a)=>{Object(u.a)("bitflume-popup",m.a,{player:a,router:e,popupId:"bitflume-popup"})}},{key:"Flight",name:"fl1ght.exe",create:null,run:(e,t,a)=>{const n=Math.round(30*c.a.DaedalusAugsRequirement);if(!(a.augmentations.length>=n&&a.money.gt(1e11)&&a.hacking_skill>=2500))return t.print(`Augmentations: ${a.augmentations.length} / ${n}`),t.print(`Money: ${l.a.formatMoney(a.money.toNumber())} / $100b`),void t.print(`Hacking skill: ${a.hacking_skill} / 2500`);t.print("We will contact you."),t.print("-- Daedalus --")}}]},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function r(e){let t="";for(let a=0;a=r.length)&&(this.state=0),++this.state,this.state>=r.length&&(this.state=0)}toJSON(){return Object(n.b)("CorporationState",this)}static fromJSON(e){return Object(n.a)(i,e.data)}}n.c.constructors.CorporationState=i},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(124),r=a(49);const i={};!function(){let e,t,a;e="The Beginner's Guide to Hacking",t=r.a.HackersStartingHandbook,a="Some resources:

Learn to Program

For Experienced JavaScript Developers: NetscriptJS

Netscript Documentation

When starting out, hacking is the most profitable way to earn money and progress. This is a brief collection of tips/pointers on how to make the most out of your hacking scripts.

-hack() and grow() both work by percentages. hack() steals a certain percentage of the money on a server, and grow() increases the amount of money on a server by some percentage (multiplicatively)

-Because hack() and grow() work by percentages, they are more effective if the target server has a high amount of money. Therefore, you should try to increase the amount of money on a server (using grow()) to a certain amount before hacking it. Two import Netscript functions for this are getServerMoneyAvailable() and getServerMaxMoney()

-Keep security level low. Security level affects everything when hacking. Two important Netscript functions for this are getServerSecurityLevel() and getServerMinSecurityLevel()

-Purchase additional servers by visiting 'Alpha Enterprises' in the city. They are relatively cheap and give you valuable RAM to run more scripts early in the game

-Prioritize upgrading the RAM on your home computer. This can also be done at 'Alpha Enterprises'

-Many low level servers have free RAM. You can use this RAM to run your scripts. Use the scp Terminal or Netscript command to copy your scripts onto these servers and then run them.",i[t]=new n.a(e,t,a),e="The Complete Handbook for Creating a Successful Corporation",t=r.a.CorporationManagementHandbook,a="Getting Started with Corporations
To get started, visit the City Hall in Sector-12 in order to create a Corporation. This requires $150b of your own money, but this $150b will get put into your Corporation's funds. After creating your Corporation, you will see it listed as one of the locations in the city. Click on your Corporation in order to manage it.

Your Corporation can have many different divisions, each in a different Industry. There are many different types of Industries, each with different properties. To create your first division, click the 'Expand into new Industry' button at the top of the management UI. The Agriculture and Software industries are recommended for your first division.

The first thing you'll need to do is hire some employees. Employees can be assigned to five different positions. Each position has a different effect on various aspects of your Corporation. It is recommended to have at least one employee at each position.

Each industry uses some combination of Materials in order to produce other Materials and/or create Products. Specific information about this is displayed in each of your divisions' UI.

Products are special, industry-specific objects. They are different than Materials because you must manually choose to develop them, and you can choose to develop any number of Products. Developing a Product takes time, but a Product typically generates significantly more revenue than any Material. Not all industries allow you to create Products. To create a Product, look for a button in the top-left panel of the division UI (e.g. For the Software Industry, the button says 'Develop Software').

To get your supply chain system started, purchase the Materials that your industry needs to produce other Materials/Products. This can be done by clicking the 'Buy' button next to the corresponding Material(s). After you have the required Materials, you will immediately start production. The amount of Materials/Products you produce is based on a variety of factors, one of which is your employees and their productivity.

Once you start producing Materials/Products, you can sell them in order to start earning revenue. This can be done by clicking the 'Sell' button next to the corresponding Material or Product. The amount of Material/Product you sell is dependent on a wide variety of different factors.

These are the basics of getting your Corporation up and running! Now, you can start purchasing upgrades to improve your bottom line. If you need money, consider looking for seed investors, who will give you money in exchange for stock shares. Otherwise, once you feel you are ready, take your Corporation public! Once your Corporation goes public, you can no longer find investors. Instead, your Corporation will be publicly traded and its stock price will change based on how well it's performing financially. You can then sell your stock shares in order to make money.

Tips/Pointers
-The 'Smart Supply' upgrade is extremely useful. Consider purchasing it as soon as possible.

-Purchasing Hardware, Robots, AI Cores, and Real Estate can potentially increase your production. The effects of these depend on what industry you are in.

-In order to optimize your production, you will need a good balance of Operators, Managers, and Engineers

-Different employees excel in different jobs. For example, the highly intelligent employees will probably do best if they are assigned to do Engineering work or Research & Development.

-If your employees have low morale, energy, or happiness, their production will greatly suffer.

-Tech is important, but don't neglect sales! Having several Businessmen can boost your sales and your bottom line.

-Don't forget to advertise your company. You won't have any business if nobody knows you.

-Having company awareness is great, but what's really important is your company's popularity. Try to keep your popularity as high as possible to see the biggest benefit for your sales

-Remember, you need to spend money to make money!

-Corporations do not reset when installing Augmentations, but they do reset when destroying a BitNode",i[t]=new n.a(e,t,a),e="A Brief History of Synthoids",t=r.a.HistoryOfSynthoids,a="Synthetic androids, or Synthoids for short, are genetically engineered robots and, short of Augmentations, are composed entirely of organic substances. For this reason, Synthoids are virtually identical to humans in form, composition, and appearance.

Synthoids were first designed and manufactured by OmniTek Incorporated sometime around the middle of the century. Their original purpose was to be used for manual labor and as emergency responders for disasters. As such, they were initially programmed only for their specific tasks. Each iteration that followed improved upon the intelligence and capabilities of the Synthoids. By the 6th iteration, called MK-VI, the Synthoids were so smart and capable enough of making their own decisions that many argued OmniTek had created the first sentient AI. These MK-VI Synthoids were produced in mass quantities (estimates up to 50 billion) with the hopes of increasing society's productivity and bolstering the global economy. Stemming from humanity's desire for technological advancement, optimism and excitement about the future had never been higher.

All of that excitement and optimism quickly turned to fear, panic, and dread in 2070, when a terrorist group called Ascendis Totalis hacked into OmniTek and uploaded a rogue AI into severeal of their Synthoid manufacturing facilities. This hack went undetected and for months OmniTek unknowingly churned out legions of Synthoids embedded with this rogue AI. Then, on December 24th, 2070, Omnica activated dormant protocols in the rogue AI, causing all of the infected Synthoids to immediately launch a military campaign to seek and destroy all of humanity.

What ensued was the deadlist conflict in human history. This crisis, now commonly known as the Synthoid Uprising, resulted in almost ten billion deaths over the course of a year. Despite the nations of the world banding together to combat the threat, the MK-VI Synthoids were simply stronger, faster, more intelligent, and more adaptable than humans, outsmarting them at every turn.

It wasn't until the sacrifice of an elite international military taskforce, called the Bladeburners, that humanity was finally able to defeat the Synthoids. The Bladeburners' final act was a suicide bombing mission that destroyed a large portion of the MK-VI Synthoids, including many of its leaders. In the following weeks militaries from around the world were able to round up and shut down the remaining rogue MK-VI Synthoids, ending the Synthoid Uprising.

In the aftermath of the bloodshed, the Synthoid Accords were drawn up. These Accords banned OmniTek Incorporated from manufacturing any Synthoids beyond the MK-III series. They also banned any other corporation from constructing androids with advanced, near-sentient AI. MK-VI Synthoids that did not have the rogue Ascendis Totalis AI were allowed to continue their existence, but they were stripped of all rights and protections as they were not considered humans. They were also banned from doing anything that may pose a global security threat, such as working for any military/defense organization or conducting any bioengineering, computing, or robotics related research.

Unfortunately, many believe that not all of the rogue MK-VI Synthoids from the Uprising were found and destroyed, and that many of them are blending in as normal humans in society today. In response, many nations have created Bladeburner divisions, special military branches that are tasked with investigating and dealing with any Synthoid threads.

To this day, tensions still exist between the remaining Synthoids and humans as a result of the Uprising.

Nobody knows what happened to the terrorist group Ascendis Totalis.",i[t]=new n.a(e,t,a),e="A Green Tomorrow",t=r.a.AGreenTomorrow,a="Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to combat global warming and climate change. The shift towards renewable energy was a big success, or so it seemed. In 2045 a staggering 80% of the world's energy came from non-renewable fossil fuels. Now, about three decades later, that number is down to only 15%. Most of the world's energy now comes from nuclear power and renewable sources such as solar and geothermal energy. Unfortunately, these efforts were not the huge success that they seem to be.

Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and the rise of increasingly advanced (and power-hungry) technology that has become ubiquitous in our lives. So, despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, the total amount of energy we are producing from fossil fuels has actually increased.

The grim effects of our species' irresponsible use of energy and neglect of our mother world have become increasingly apparent. Last year a temperature of 190F was recorded in the Death Valley desert, which is over 50% higher than the highest recorded temperature at the beginning of the century. In the last two decades numerous major cities such as Manhattan, Boston, and Los Angeles have been partially or fully submerged by rising sea levels. In the present day, over 75% of the world's agriculture is done in climate-controlled vertical farms, as most traditional farmland has become unusable due to severe climate conditions.

Despite all of this, the greedy and corrupt corporations that rule the world have done nothing to address these problems that threaten our species. And so it's up to us, the common people. Each and every one of us can make a difference by doing what these corporations won't: taking responsibility. If we don't, pretty soon there won't be an Earth left to save. We are the last hope for a green tomorrow.",i[t]=new n.a(e,t,a),e="Alpha and Omega",t=r.a.AlphaOmega,a="Then we saw a new Heaven and a new Earth, for our first Heaven and Earth had gone away, and our sea was no more. And we saw a new holy city, new Aeria, coming down out of this new Heaven, prepared as a bride adorned for her husband. And we heard a loud voice saying, 'Behold, the new dwelling place of the Gods. We will dwell with them, and they will be our people, and we will be with them as their Gods. We will wipe away every tear from their eyes, and death shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things have passed away.'

And once we were seated on the throne we said 'Behold, I am making all things new.' Also we said, 'Write this down, for these words are trustworthy and true.' And we said to you, 'It is done! I am the Alpha and the Omega, the beginning and the end. To the thirsty I will give from the spring of the water of life without payment. The one who conquers will have this heritage, and we will be his God and he will be our son. But as for the cowardly, the faithless, the detestable, as for murderers, the sexually immoral, sorcerers, idolaters, and all liars, their portion will be in the lake that burns with fire and sulfur, for it is the second true death.'",i[t]=new n.a(e,t,a),e="Are We Living in a Computer Simulation?",t=r.a.SimulatedReality,a="The idea that we are living in a virtual world is not new. It's a trope that has been explored constantly in literature and pop culture. However, it is also a legitimate scientific hypothesis that many notable physicists and philosophers have debated for years.

Proponents for this simulated reality theory often point to how advanced our technology has become, as well as the incredibly fast pace at which it has advanced over the past decades. The amount of computing power available to us has increased over 100-fold since 2060 due to the development of nanoprocessors and quantum computers. Artifical Intelligence has advanced to the point where our entire lives are controlled by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. If we consider the pace at which this technology has advanced and assume that these developments continue, it's reasonable to assume that at some point in the future our technology would be advanced enough that we could create simulations that are indistinguishable from reality. However, if continued technological advancement is a reasonable outcome, then it is very likely that such a scenario has already happened.

Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species that already has such technology. Who's to say that they haven't already created such a virtual reality: our own?",i[t]=new n.a(e,t,a),e="Beyond Man",t=r.a.BeyondMan,a="Humanity entered a 'transhuman' era a long time ago. And despite the protests and criticisms of many who cried out against human augmentation at the time, the transhuman movement continued and prospered. Proponents of the movement ignored the critics, arguing that it was in our inherent nature to better ourselves. To improve. To be more than we were. They claimed that not doing so would be to go against every living organism's biological purpose: evolution and survival of the fittest.

And here we are today, with technology that is advanced enough to augment humans to a state that can only be described as posthuman. But what do we have to show for it when this augmentation technology is only available to the so-called 'elite'? Are we really better off than before when only 5% of the world's population has access to this technology? When the powerful corporations and organizations of the world keep it all to themselves, have we really evolved?

Augmentation technology has only further increased the divide between the rich and the poor, between the powerful and the oppressed. We have not become 'more than human'. We have not evolved from nature's original design. We are still the greedy, corrupted, and evil men that we always were.",i[t]=new n.a(e,t,a),e="Brighter than the Sun",t=r.a.BrighterThanTheSun,a="When people think about the corporations that dominate the East, they typically think of KuaiGong International, which holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.

TaiYang Digital is a Chinese internet-technology corporation that provides services such as online advertising, search engines, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word for 'sun'. In Chinese culture, the sun is a 'yang' symbol associated with life, heat, masculinity, and heaven.

The company was founded less than 5 years ago and is already the third highest valued company in all of Asia. In 2076 it generated a total revenue of over 10 trillion yuan. It's services are used daily by over a billion people worldwide.

TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is something you'd commonly see in the first half of the century, especially for tech companies. However in the last two decades the number of corporations has significantly declined as the largest entities quickly took over the economy. Corporations such as ECorp, MegaCorp, and KuaiGong have established such strong monopolies in their market sectors that they have effectively killed off all of the smaller and new corporations that have tried to start up over the years. This is what makes the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have a bright future ahead of them.",i[t]=new n.a(e,t,a),e="Democracy is Dead: The Fall of an Empire",t=r.a.DemocracyIsDead,a="They rose from the shadows in the street.
From the places where the oppressed meet.
Their cries echoed loudly through the air.
As they once did in Tiananmen Square.
Loudness in the silence, Darkness in the light.
They came forth with power and might.
Once the beacon of democracy, America was first.
Its pillars of society destroyed and dispersed.
Soon the cries rose everywhere, with revolt and riot.
Until one day, finally, all was quiet.
From the ashes rose a new order, corporatocracy was its name.
Rome, Mongol, Byzantine, all of history is just the same.
For man will never change in a fundamental way.
And now democracy is dead, in the USA.",i[t]=new n.a(e,t,a),e="Figures Show Rising Crime Rates in Sector-12",t=r.a.Sector12Crime,a="A recent study by analytics company Wilson Inc. shows a significant rise in criminal activity in Sector-12. Perhaps the most alarming part of the statistic is that most of the rise is in violent crime such as homicide and assault. According to the study, the city saw a total of 21,406 reported homicides in 2076, which is over a 20% increase compared to 2075.

CIA director David Glarow says its too early to know whether these figures indicate the beginning of a sustained increase in crime rates, or whether the year was just an unfortunate outlier. He states that many intelligence and law enforcement agents have noticed an increase in organized crime activites, and believes that these figures may be the result of an uprising from criminal organizations such as The Syndicate or the Slum Snakes.",i[t]=new n.a(e,t,a),e="Man and the Machine",t=r.a.ManAndMachine,a="In 2005 Ray Kurzweil popularized his theory of the Singularity. He predicted that the rate of technological advancement would continue to accelerate faster and faster until one day machines would be become infinitely more intelligent than humans. This point, called the Singularity, would result in a drastic transformation of the world as we know it. He predicted that the Singularity would arrive by 2045. And yet here we are, more than three decades later, where most would agree that we have not yet reached a point where computers and machines are vastly more intelligent than we are. So what gives?

The answer is that we have reached the Singularity, just not in the way we expected. The artifical superintelligence that was predicted by Kurzweil and others exists in the world today - in the form of Augmentations. Yes, those Augmentations that the rich and powerful keep to themselves enable humans to become superintelligent beings. The Singularity did not lead to a world where our machines are infinitely more intelligent than us, it led to a world where man and machine can merge to become something greater. Most of the world just doesn't know it yet.",i[t]=new n.a(e,t,a),e="Secret Societies",t=r.a.SecretSocieties,a="The idea of secret societies has long intrigued the general public by inspiring curiosity, fascination, and distrust. People have long wondered about who these secret society members are and what they do, with the most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world may never know for sure, it is likely that many secret societies do actually exist, even today.

However, the secret societies of the modern world are nothing like those that (supposedly) existed decades and centuries ago. The Freemasons, Knights Templar, and Illuminati, while they may have been around at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in our everyday lives and the fact that so much of the world is now digital has given rise to a new breed of secret societies: Internet-based ones.

Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's world. Some of these, such as The Black Hand, are black hat groups that claim they are trying to help the oppressed by attacking the elite and powerful. Others, such as NiteSec, are hacktivist groups that try to push political and social agendas. Perhaps the most intriguing hacker group is the mysterious Bitrunners, whose purpose still remains unknown.",i[t]=new n.a(e,t,a),e="Space: The Failed Frontier",t=r.a.TheFailedFrontier,a="Humans have long dreamed about spaceflight. With enduring interest, we were driven to explore the unknown and discover new worlds. We dreamed about conquering the stars. And in our quest, we pushed the boundaries of our scientific limits, and then pushed further. Space exploration lead to the development of many important technologies and new industries.

But sometime in the middle of the 21st century, all of that changed. Humanity lost its ambitions and aspirations of exploring the cosmos. The once-large funding for agencies like NASA and the European Space Agency gradually whittled away until their eventual disbanding in the 2060's. Not even militaries are fielding flights into space nowadays. The only remnants of the once great mission for cosmic conquest are the countless satellites in near-earth orbit, used for communications, espionage, and other corporate interests.

And as we continue to look at the state of space technology, it becomes more and more apparent that we will never return to that golden age of space exploration, that age where everyone dreamed of going beyond earth for the sake of discovery.",i[t]=new n.a(e,t,a),e="Coded Intelligence: Myth or Reality?",t=r.a.CodedIntelligence,a="Tremendous progress has been made in the field of Artificial Intelligence over the past few decades. Our autonomous vehicles and transporation systems. The electronic personal assistants that control our everyday lives. Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create human intelligence.

We've certainly come close to artificial intelligence that is similar to humans. For example OmniTek Incorporated's CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.

Many neuroscientists believe that we won't ever reach the point of creating artificial human intelligence. 'At the end of the the day, AI comes down to 1's and 0's, while the human brain does not. We'll never see AI that is identical to that of humans.'",i[t]=new n.a(e,t,a),e="Synthetic Muscles",t=r.a.SyntheticMuscles,a="Initial versions of synthetic muscles weren't made of anything organic but were actually crude devices made to mimic human muscle function. Some of the early iterations were actually made of common materials such as fishing lines and sewing threads due to their high strength for a cheap cost.

As technology progressed, however, advances in biomedical engineering paved the way for a new method of creating synthetic muscles. Instead of creating something that closely imitated the functionality of human muscle, scientists discovered a way of forcing the human body itself to augment its own muscle tissue using both synthetic and organic materials. This is typically done using gene therapy or chemical injections.",i[t]=new n.a(e,t,a),e="Tensions rise in global tech race",t=r.a.TensionsInTechRace,a="Have we entered a new Cold War? Is WWIII just beyond the horizon?

After rumors came out that OmniTek Incorporated had begun developing advanced robotic supersoldiers, geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. In a rare show of cooperation between corporations, MegaCorp and ECorp have reportedly launched hundreds of new surveillance and espionage satellites. Defense contractors such as DeltaOne and AeroCorp have been working with the CIA and NSA to prepare for conflict. Meanwhile, the rest of the world sits in earnest hoping that it never reaches full-scale war. With today's technology and firepower, a World War would assuredly mean the end of human civilization.",i[t]=new n.a(e,t,a),e="The Cost of Immortality",t=r.a.CostOfImmortality,a="Evolution and advances in medical and augmentation technology has lead to drastic improvements in human mortality rates. Recent figures show that the life expectancy for humans that live in a first-world country is about 130 years of age, almost double of what it was at the turn of the century. However, this increase in average lifespan has had some significant effects on society and culture.

Due to longer lifespans and a better quality of life, many adults are holding off on having kids until much later. As a result, the percentage of youth in first-world countries has been decreasing, while the number of senior citizens is significantly increasing.

Perhaps the most alarming result of all of this is the rapidly shrinking workforce. Despite the increase in life expectancy, the typical retirement age for workers in America has remained about the same, meaning a larger and larger percentage of people in America are retirees. Furthermore, many young adults are holding off on joining the workforce because they feel that they have plenty of time left in their lives for employment, and want to 'enjoy life while they're young.' For most industries, this shrinking workforce is not a major issue as most things are handled by robots anyways. However, there are still several key industries such as engineering and education that have not been automated, and these remain in danger to this cultural phenomenon.",i[t]=new n.a(e,t,a),e="The Hidden World",t=r.a.TheHiddenWorld,a="WAKE UP SHEEPLE

THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY

THE ILLUMINATI ARE THE SECRET RULERS OF THE WORLD!

Yes, the Illuminati of legends. The ancient secret society that controls the entire world from the shadows with their invisible hand. The group of the rich and wealthy that have penetrated every major government, financial agency, and corporation in the last three hundred years.

OPEN YOUR EYES

It was the Illuminati that brought an end to democracy in the world. They are the driving force behind everything that happens.

THEY ARE ALL AROUND YOU

After destabilizing the world's governments, they are now entering the final stage of their master plan. They will secretly initiate global crises. Terrorism. Pandemics. World War. And out of the chaos that ensues they will build their New World Order.",i[t]=new n.a(e,t,a),e="The New God",t=r.a.TheNewGod,a="Everyone has a moment in their life when they wonder about the bigger questions.

What's the point of all this? What is my purpose?

Some people dare to think even bigger.

What will the fate of the human race be?

We live in an era vastly different from that of 15 or even 20 years ago. We have gone beyond the limits of humanity. We have stripped ourselves of the tyranny of flesh.

The Singularity is here. The merging of man and machine. This is where humanity evolves into ",i[t]=new n.a(e,t,a),e="The New Triads",t=r.a.NewTriads,a="The Triads were an ancient transnational crime syndicate based in China, Hong Kong, and other Asian territories. They were often considered one of the first and biggest criminal secret societies. While most of the branches of the Triads have been destroyed over the past few decades, the crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. The most notable of these is the Tetrads.

It is widely believed that the Tetrads are a rogue group that splintered off from the Triads sometime in the mid 21st century. The founders of the Tetrads, all of whom were ex-Triad members, believed that the Triads were losing their purpose and direction. The Tetrads started off as a small group that mainly engaged in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the continent.

Not much else is known about the Tetrads, or about the efforts the Asian governments and corporations are making to take down this large new crime organization. Many believe that the Tetrads have infiltrated the governments and powerful corporations in Asia, which has helped faciliate their recent rapid rise.",i[t]=new n.a(e,t,a),e="The Secret War",t=r.a.TheSecretWar,a="",i[t]=new n.a(e,t,a)}()},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(727),r=a(728),i=a(1103),o=a(1104),s=a(1105),l=a(1108),c=a(316),u=a(23),m=a(319),h=a(20),p=a(82);function d(){this.hacking_skill=1,this.hp=10,this.max_hp=10,this.strength=1,this.defense=1,this.dexterity=1,this.agility=1,this.charisma=1,this.intelligence=0,this.hacking_chance_mult=1,this.hacking_speed_mult=1,this.hacking_money_mult=1,this.hacking_grow_mult=1,this.hacking_exp=0,this.strength_exp=0,this.defense_exp=0,this.dexterity_exp=0,this.agility_exp=0,this.charisma_exp=0,this.intelligence_exp=0,this.hacking_mult=1,this.strength_mult=1,this.defense_mult=1,this.dexterity_mult=1,this.agility_mult=1,this.charisma_mult=1,this.hacking_exp_mult=1,this.strength_exp_mult=1,this.defense_exp_mult=1,this.dexterity_exp_mult=1,this.agility_exp_mult=1,this.charisma_exp_mult=1,this.company_rep_mult=1,this.faction_rep_mult=1,this.money=new p.a(1e3),this.homeComputer="",this.city=u.a.Sector12,this.location="",this.jobs={},this.companyName="",this.currentServer="",this.purchasedServers=[],this.hacknetNodes=[],this.hashManager=new c.a,this.factions=[],this.factionInvitations=[],this.queuedAugmentations=[],this.augmentations=[],this.sourceFiles=[],this.numPeopleKilled=0,this.karma=0,this.crime_money_mult=1,this.crime_success_mult=1,this.isWorking=!1,this.focus=!1,this.workType="",this.currentWorkFactionName="",this.currentWorkFactionDescription="",this.workHackExpGainRate=0,this.workStrExpGainRate=0,this.workDefExpGainRate=0,this.workDexExpGainRate=0,this.workAgiExpGainRate=0,this.workChaExpGainRate=0,this.workRepGainRate=0,this.workMoneyGainRate=0,this.workMoneyLossRate=0,this.workHackExpGained=0,this.workStrExpGained=0,this.workDefExpGained=0,this.workDexExpGained=0,this.workAgiExpGained=0,this.workChaExpGained=0,this.workRepGained=0,this.workMoneyGained=0,this.createProgramName="",this.createProgramReqLvl=0,this.className="",this.crimeType="",this.timeWorked=0,this.timeWorkedCreateProgram=0,this.timeNeededToCompleteWork=0,this.work_money_mult=1,this.hacknet_node_money_mult=1,this.hacknet_node_purchase_cost_mult=1,this.hacknet_node_ram_cost_mult=1,this.hacknet_node_core_cost_mult=1,this.hacknet_node_level_cost_mult=1,this.hasWseAccount=!1,this.hasTixApiAccess=!1,this.has4SData=!1,this.has4SDataTixApi=!1,this.gang=null,this.corporation=null,this.bladeburner=null,this.bladeburner_max_stamina_mult=1,this.bladeburner_stamina_gain_mult=1,this.bladeburner_analysis_mult=1,this.bladeburner_success_chance_mult=1,this.sleeves=[],this.resleeves=[],this.sleevesFromCovenant=0,this.bitNodeN=1,this.firstFacInvRecvd=!1,this.firstAugPurchased=!1,this.firstTimeTraveled=!1,this.firstProgramAvailable=!1,this.lastUpdate=0,this.totalPlaytime=0,this.playtimeSinceLastAug=0,this.playtimeSinceLastBitnode=0,this.moneySourceA=new m.a,this.moneySourceB=new m.a,this.scriptProdSinceLastAug=0,this.exploits=[]}Object.assign(d.prototype,s,l,r,i,o,n),d.prototype.toJSON=function(){return Object(h.b)("PlayerObject",this)},d.fromJSON=function(e){return Object(h.a)(d,e.data)},h.c.constructors.PlayerObject=d},function(e,t,a){"use strict";a.r(t),a.d(t,"hasAugmentation",(function(){return r}));var n=a(29);function r(e){const t=e instanceof n.a?e.name:e;for(const e of this.augmentations)if(e.name===t)return!0;for(const e of this.queuedAugmentations)if(e.name===t)return!0;return!1}},function(e,t,a){"use strict";a.r(t),a.d(t,"canAccessBladeburner",(function(){return i})),a.d(t,"inBladeburner",(function(){return o})),a.d(t,"startBladeburner",(function(){return s}));var n=a(183),r=a(53);function i(){return 8!==this.bitNodeN&&(6===this.bitNodeN||7===this.bitNodeN||r.a[6]>0||r.a[7]>0)}function o(){return null!=this.bladeburner&&this.bladeburner instanceof n.a}function s(){this.bladeburner=new n.a(this)}},function(e,t,a){"use strict";function n(e){for(const t in e)e.hasOwnProperty(t)&&delete e[t]}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return C}));var n=a(25),r=a(8);const i={},o={},s={},l={},c={},u={},m={},h={},p={},d={},f={},g={},y={},b={},E={},v={},k={},_={},w={};n.j.forEach(e=>{i[e]=!0,c[e]=!0}),n.d.forEach(e=>{o[e]=!0,c[e]=!0}),n.f.forEach(e=>{s[e]=!0,c[e]=!0}),c[n.i[0]]=!0,l[n.i[0]]=!0,n.b.forEach(e=>{u[e]=!0}),n.h.forEach(e=>{h[e]=!0}),n.a.forEach(e=>{m[e]=!0}),n.k.forEach(e=>{p[e]=!0}),n.c.forEach(e=>{d[e]=!0});for(let e=0;e{t.innerText="",t.style.display="none",t.classList.remove("status-text")},3e3)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(23),r=a(8),i=a(45);const o=[{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:12,startingSecurityLevel:8.18},name:r.a.AevumAeroCorp,types:[i.a.Company]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:15,startingSecurityLevel:8.19},name:r.a.AevumBachmanAndAssociates,types:[i.a.Company]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:18,startingSecurityLevel:9.55},name:r.a.AevumClarkeIncorporated,types:[i.a.Company]},{city:n.a.Aevum,costMult:3,expMult:2,name:r.a.AevumCrushFitnessGym,types:[i.a.Gym]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:37,startingSecurityLevel:17.02},name:r.a.AevumECorp,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:512,techVendorMinRam:128},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:15.54},name:r.a.AevumFulcrumTechnologies,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:1024,techVendorMinRam:256},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:12,startingSecurityLevel:7.89},name:r.a.AevumGalacticCybersystems,types:[i.a.Company]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:6,startingSecurityLevel:3.29},name:r.a.AevumNetLinkTechnologies,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:64,techVendorMinRam:8},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:6,startingSecurityLevel:5.35},name:r.a.AevumPolice,types:[i.a.Company]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:5,startingSecurityLevel:5.02},name:r.a.AevumRhoConstruction,types:[i.a.Company]},{city:n.a.Aevum,costMult:10,expMult:5,name:r.a.AevumSnapFitnessGym,types:[i.a.Gym]},{city:n.a.Aevum,costMult:4,expMult:3,name:r.a.AevumSummitUniversity,types:[i.a.University]},{city:n.a.Aevum,infiltrationData:{maxClearanceLevel:7,startingSecurityLevel:5.85},name:r.a.AevumWatchdogSecurity,types:[i.a.Company]},{city:n.a.Aevum,name:r.a.AevumCasino,types:[i.a.Casino]},{city:n.a.Chongqing,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:16.25},name:r.a.ChongqingKuaiGongInternational,types:[i.a.Company]},{city:n.a.Chongqing,infiltrationData:{maxClearanceLevel:18,startingSecurityLevel:12.59},name:r.a.ChongqingSolarisSpaceSystems,types:[i.a.Company]},{city:n.a.Ishima,infiltrationData:{maxClearanceLevel:12,startingSecurityLevel:5.02},name:r.a.IshimaNovaMedical,types:[i.a.Company]},{city:n.a.Ishima,infiltrationData:{maxClearanceLevel:10,startingSecurityLevel:3.2},name:r.a.IshimaOmegaSoftware,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:128,techVendorMinRam:4},{city:n.a.Ishima,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:5.38},name:r.a.IshimaStormTechnologies,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:512,techVendorMinRam:32},{city:n.a.NewTokyo,infiltrationData:{maxClearanceLevel:17,startingSecurityLevel:7.18},name:r.a.NewTokyoDefComm,types:[i.a.Company]},{city:n.a.NewTokyo,infiltrationData:{maxClearanceLevel:20,startingSecurityLevel:5.9},name:r.a.NewTokyoGlobalPharmaceuticals,types:[i.a.Company]},{city:n.a.NewTokyo,infiltrationData:{maxClearanceLevel:5,startingSecurityLevel:2.5},name:r.a.NewTokyoNoodleBar,types:[i.a.Company,i.a.Special]},{city:n.a.NewTokyo,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:5.52},name:r.a.NewTokyoVitaLife,types:[i.a.Company,i.a.Special]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:10,startingSecurityLevel:3.62},name:r.a.Sector12AlphaEnterprises,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:8,techVendorMinRam:2},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:10.59},name:r.a.Sector12BladeIndustries,types:[i.a.Company]},{city:n.a.Sector12,name:r.a.Sector12CIA,types:[i.a.Company]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:15,startingSecurityLevel:4.66},name:r.a.Sector12CarmichaelSecurity,types:[i.a.Company]},{city:n.a.Sector12,name:r.a.Sector12CityHall,types:[i.a.Special]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:12,startingSecurityLevel:5.9},name:r.a.Sector12DeltaOne,types:[i.a.Company]},{city:n.a.Sector12,name:r.a.Sector12FoodNStuff,types:[i.a.Company]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:8.18},name:r.a.Sector12FourSigma,types:[i.a.Company]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:17,startingSecurityLevel:6.02},name:r.a.Sector12IcarusMicrosystems,types:[i.a.Company]},{city:n.a.Sector12,expMult:1,costMult:1,name:r.a.Sector12IronGym,types:[i.a.Gym]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:5,startingSecurityLevel:3.13},name:r.a.Sector12JoesGuns,types:[i.a.Company]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:31,startingSecurityLevel:16.36},name:r.a.Sector12MegaCorp,types:[i.a.Company]},{city:n.a.Sector12,name:r.a.Sector12NSA,types:[i.a.Company,i.a.Special]},{city:n.a.Sector12,costMult:20,expMult:10,name:r.a.Sector12PowerhouseGym,types:[i.a.Gym]},{city:n.a.Sector12,costMult:3,expMult:2,name:r.a.Sector12RothmanUniversity,types:[i.a.University]},{city:n.a.Sector12,infiltrationData:{maxClearanceLevel:12,startingSecurityLevel:5.9},name:r.a.Sector12UniversalEnergy,types:[i.a.Company]},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:15,startingSecurityLevel:3.59},name:r.a.VolhavenCompuTek,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:256,techVendorMinRam:8},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:18,startingSecurityLevel:7.28},name:r.a.VolhavenHeliosLabs,types:[i.a.Company]},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:15,startingSecurityLevel:4.35},name:r.a.VolhavenLexoCorp,types:[i.a.Company]},{city:n.a.Volhaven,costMult:7,expMult:4,name:r.a.VolhavenMilleniumFitnessGym,types:[i.a.Gym]},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:50,startingSecurityLevel:8.53},name:r.a.VolhavenNWO,types:[i.a.Company]},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:25,startingSecurityLevel:7.74},name:r.a.VolhavenOmniTekIncorporated,types:[i.a.Company,i.a.TechVendor],techVendorMaxRam:1024,techVendorMinRam:128},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:22,startingSecurityLevel:6},name:r.a.VolhavenOmniaCybersystems,types:[i.a.Company]},{city:n.a.Volhaven,infiltrationData:{maxClearanceLevel:18,startingSecurityLevel:4.77},name:r.a.VolhavenSysCoreSecurities,types:[i.a.Company]},{city:n.a.Volhaven,costMult:5,expMult:4,name:r.a.VolhavenZBInstituteOfTechnology,types:[i.a.University]},{city:null,name:r.a.Hospital,types:[i.a.Hospital]},{city:null,name:r.a.Slums,types:[i.a.Slums]},{city:null,name:r.a.TravelAgency,types:[i.a.TravelAgency]},{city:null,name:r.a.WorldStockExchange,types:[i.a.StockMarket]}]},function(e,t,a){"use strict";a.d(t,"a",(function(){return A}));var n=a(0),r=a.n(n),i=a(221),o=a(9),s=a(116),l=a(37),c=a(753),u=a.n(c),m=a(752),h=a.n(m),p=a(312),d=a(127),f=a(63),g=a(426),y=a.n(g),b=a(286),E=a.n(b),v=a(427),k=a.n(v),_=a(485),w=a.n(_),C=a(484),S=a.n(C),x=a(486),O=a.n(x),T=a(142),M=a(277),P=a(35);const R=Object(T.a)(e=>Object(M.a)({textfield:{borderBottom:"1px solid "+e.palette.primary.main},code:{whiteSpace:"pre",backgroundColor:e.palette.background.paper}}));function A(){const e=R(),t={[P.f.Start]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Welcome to Bitburner, a cyberpunk-themed incremental RPG! The game takes place in a dark, dystopian future... The year is 2077...",r.a.createElement("br",null),r.a.createElement("br",null),"This tutorial will show you the basics of the game. You may skip the tutorial at any time.")),canNext:!0},[P.f.GoToCharacterPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Let's start by heading to the Stats page. Click"),r.a.createElement(f.a,null,r.a.createElement(y.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Stats")),r.a.createElement(o.a,null,"on the main navigation menu (left-hand side of the screen)")),canNext:!1},[P.f.CharacterPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,null,r.a.createElement(y.a,{color:"primary"}),r.a.createElement(o.a,{color:"primary"},"Stats")),r.a.createElement(o.a,null,"shows a lot of important information about your progress, such as your skills, money, and bonuses.")),canNext:!0},[P.f.CharacterGoToTerminalPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Let's head to your computer's terminal by clicking"),r.a.createElement(f.a,null,r.a.createElement(E.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Terminal")),r.a.createElement(o.a,null,"on the main navigation menu.")),canNext:!1},[P.f.TerminalIntro]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,null,r.a.createElement(E.a,{color:"primary"}),r.a.createElement(o.a,{color:"primary"},"Terminal")),r.a.createElement(o.a,null,"is used to interface with your home computer as well as all of the other machines around the world.")),canNext:!0},[P.f.TerminalHelp]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Let's try it out. Start by entering"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> help"),r.a.createElement(o.a,null,"(Don't forget to press Enter after typing the command)")),canNext:!1},[P.f.TerminalLs]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> help"),r.a.createElement(o.a,null,"displays a list of all available Terminal commands, how to use them, and a description of what they do."," ",r.a.createElement("br",null),r.a.createElement("br",null),"Let's try another command. Enter"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> ls")),canNext:!1},[P.f.TerminalScan]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> ls"),r.a.createElement(o.a,null," ","is a basic command that shows files on the computer. Right now, it shows that you have a program called"," ","NUKE.exe on your computer. We'll get to what this does later. ",r.a.createElement("br",null),r.a.createElement("br",null),"Using your home computer's terminal, you can connect to other machines throughout the world. Let's do that now by first entering"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan")),canNext:!1},[P.f.TerminalScanAnalyze1]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan"),r.a.createElement(o.a,null,"shows all available network connections. In other words, it displays a list of all servers that can be connected to from your current machine. A server is identified by its hostname. ",r.a.createElement("br",null),r.a.createElement("br",null),"That's great and all, but there's so many servers. Which one should you go to?"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan-analyze"),r.a.createElement(o.a,null,"gives some more detailed information about servers on the network. Try it now!")),canNext:!1},[P.f.TerminalScanAnalyze2]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan-analyze"),r.a.createElement(o.a,null,"shows more detailed information about each server that you can connect to (servers that are a distance of one node away). ",r.a.createElement("br",null),r.a.createElement("br",null)," It is also possible to run scan-analyze with a higher depth. Let's try a depth of two with the following command:"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan-analyze 2")),canNext:!1},[P.f.TerminalConnect]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Now you can see information about all servers that are up to two nodes away, as well as figure out how to navigate to those servers through the network. You can only connect to a server that is one node away. To connect to a machine, use"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> connect hostname"),r.a.createElement(o.a,null,"From the results of "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> scan-analyze 2"),r.a.createElement(o.a,null," ","we can see that the n00dles server is only one node away. Let's connect so it now using:"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> connect n00dles")),canNext:!1},[P.f.TerminalAnalyze]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"You are now connected to another machine! What can you do now? You can hack it!",r.a.createElement("br",null),r.a.createElement("br",null)," In the year 2077, currency has become digital and decentralized. People and corporations store their money on servers and computers. Using your hacking abilities, you can hack servers to steal money and gain experience. ",r.a.createElement("br",null),r.a.createElement("br",null),"Before you try to hack a server, you should run diagnostics using"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[n00dles ~/]> analyze")),canNext:!1},[P.f.TerminalNuke]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"When "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[n00dles ~/]> analyze"),r.a.createElement(o.a,null,"finishes running it will show useful information about hacking the server. ",r.a.createElement("br",null),r.a.createElement("br",null)," For this server, the required hacking skill is only 1, which means you can hack it right now. However, in order to hack a server you must first gain root access. The NUKE.exe program that we saw earlier on your home computer is a virus that will grant you root access to a machine if there are enough open ports."),r.a.createElement(o.a,{classes:{root:e.textfield}},"[n00dles ~/]> analyze"),r.a.createElement(o.a,null," ","shows that there do not need to be any open ports on this machine for the NUKE virus to work, so go ahead and run the virus using"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[n00dles ~/]> run NUKE.exe"),r.a.createElement(o.a,null)),canNext:!0},[P.f.TerminalManualHack]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"You now have root access! You can hack the server using "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> hack"),r.a.createElement(o.a,null," Try doing that now.")),canNext:!0},[P.f.TerminalHackingMechanics]:{content:r.a.createElement(o.a,null,"You are now attempting to hack the server. Performing a hack takes time and only has a certain percentage chance of success. This time and success chance is determined by a variety of factors, including your hacking skill and the server's security level.",r.a.createElement("br",null),r.a.createElement("br",null),"If your attempt to hack the server is successful, you will steal a certain percentage of the server's total money. This percentage is affected by your hacking skill and the server's security level.",r.a.createElement("br",null),r.a.createElement("br",null),"The amount of money on a server is not limitless. So, if you constantly hack a server and deplete its money, then you will encounter diminishing returns in your hacking."),canNext:!0},[P.f.TerminalGoHome]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"From any server you can get back home using"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> home"),r.a.createElement(o.a,null,"Let's head home before creating our first script!")),canNext:!0},[P.f.TerminalCreateScript]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Hacking is the core mechanic of the game and is necessary for progressing. However, you don't want to be hacking manually the entire time. You can automate your hacking by writing scripts!",r.a.createElement("br",null),r.a.createElement("br",null),"To create a new script or edit an existing one, you can use"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> nano"),r.a.createElement(o.a,null,"Scripts must end with the .script extension. Let's make a script now by entering "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> nano n00dles.script"),r.a.createElement(o.a,null,"after the hack command finishes running (Sidenote: Pressing ctrl + c will end a command like hack early)")),canNext:!1},[P.f.TerminalTypeScript]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"This is the script editor. You can use it to program your scripts. Scripts are written in a simplified version of javascript. Copy and paste the following code into the script editor: ",r.a.createElement("br",null)),r.a.createElement(o.a,{classes:{root:e.code}},r.a.createElement(d.b,{value:"while(true) {\n hack('n00dles');\n}"})),r.a.createElement(o.a,null,"For anyone with basic programming experience, this code should be straightforward. This script will continuously hack the n00dles server.",r.a.createElement("br",null),r.a.createElement("br",null),"To save and close the script editor, press the button in the bottom left, or press ctrl + b.")),canNext:!1},[P.f.TerminalFree]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Now we'll run the script. Scripts require a certain amount of RAM to run, and can be run on any machine which you have root access to. Different servers have different amounts of RAM. You can also purchase more RAM for your home server.",r.a.createElement("br",null),r.a.createElement("br",null),"To check how much RAM is available on this machine, enter"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> free")),canNext:!1},[P.f.TerminalRunScript]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"We have 8GB of free RAM on this machine, which is enough to run our script. Let's run our script using"),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> run n00dles.script")),canNext:!1},[P.f.TerminalGoToActiveScriptsPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Your script is now running! It will continuously run in the background and will automatically stop if the code ever completes (the n00dles.script will never complete because it runs an infinite loop). ",r.a.createElement("br",null),r.a.createElement("br",null),"These scripts can passively earn you income and hacking experience. Your scripts will also earn money and experience while you are offline, although at a slightly slower rate. ",r.a.createElement("br",null),r.a.createElement("br",null),"Let's check out some statistics for our running scripts by clicking"," "),r.a.createElement(f.a,null,r.a.createElement(S.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Active Scripts"))),canNext:!1},[P.f.ActiveScriptsPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"This page displays information about all of your scripts that are running across every server. You can use this to gauge how well your scripts are doing. Let's go back to"),r.a.createElement(f.a,null,r.a.createElement(E.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Terminal"))),canNext:!1},[P.f.ActiveScriptsToTerminal]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"One last thing about scripts, each active script contains logs that detail what it's doing. We can check these logs using the tail command. Do that now for the script we just ran by typing"," "),r.a.createElement(o.a,{classes:{root:e.textfield}},"[home ~/]> tail n00dles.script")),canNext:!1},[P.f.TerminalTailScript]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"The log for this script won't show much right now (it might show nothing at all) because it just started running...but check back again in a few minutes! ",r.a.createElement("br",null),r.a.createElement("br",null),"This covers the basics of hacking. To learn more about writing scripts, select"),r.a.createElement(f.a,null,r.a.createElement(k.a,{color:"primary"}),r.a.createElement(o.a,{color:"primary"},"Tutorial")),r.a.createElement(o.a,null,"in the main navigation menu to look at the documentation. If you are an experienced JavaScript developer, I would highly suggest you check out the section on NetscriptJS/Netscript 2.0, it's faster and more powerful.",r.a.createElement("br",null),r.a.createElement("br",null),"For now, let's move on to something else!")),canNext:!0},[P.f.GoToHacknetNodesPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"Hacking is not the only way to earn money. One other way to passively earn money is by purchasing and upgrading Hacknet Nodes. Let's go to"),r.a.createElement(f.a,null,r.a.createElement(w.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Hacknet")),r.a.createElement(o.a,null,"through the main navigation menu now.")),canNext:!0},[P.f.HacknetNodesIntroduction]:{content:r.a.createElement(o.a,null,"here you can purchase new Hacknet Nodes and upgrade your existing ones. Let's purchase a new one now."),canNext:!0},[P.f.HacknetNodesGoToWorldPage]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"You just purchased a Hacknet Node! This Hacknet Node will passively earn you money over time, both online and offline. When you get enough money, you can upgrade your newly-purchased Hacknet Node below.",r.a.createElement("br",null),r.a.createElement("br",null),"Let's go to"),r.a.createElement(f.a,null,r.a.createElement(O.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"City"))),canNext:!0},[P.f.WorldDescription]:{content:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,null,"This page lists all of the different locations you can currently travel to. Each location has something that you can do. There's a lot of content out in the world, make sure you explore and discover!",r.a.createElement("br",null),r.a.createElement("br",null),"Lastly, click on"),r.a.createElement(f.a,null,r.a.createElement(k.a,{color:"error"}),r.a.createElement(o.a,{color:"error"},"Tutorial"))),canNext:!0},[P.f.TutorialPageInfo]:{content:r.a.createElement(o.a,null,"This page contains a lot of different documentation about the game's content and mechanics. I know it's a lot, but I highly suggest you read (or at least skim) through this before you start playing . That's the end of the tutorial. Hope you enjoy the game!"),canNext:!0},[P.f.End]:{content:r.a.createElement(o.a,null),canNext:!0}},a=Object(n.useState)(!1)[1];function c(){a(e=>!e)}Object(n.useEffect)(()=>p.a.subscribe(c),[]);const m=P.a.currStep,g=t[m];if(void 0===g)throw new Error("error in the tutorial");return r.a.createElement(i.a,{square:!0,sx:{maxWidth:"70vw",p:2}},g.content,m!==P.f.TutorialPageInfo&&r.a.createElement(r.a.Fragment,null,r.a.createElement(s.a,{onClick:P.d,"aria-label":"previous"},r.a.createElement(h.a,null)),g.canNext&&r.a.createElement(s.a,{onClick:P.c,"aria-label":"next"},r.a.createElement(u.a,null))),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(l.a,{onClick:P.b},m!==P.f.TutorialPageInfo?"SKIP TUTORIAL":"FINISH TUTORIAL"))}},,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a.n(n),i=a(142),o=a(92),s=a(328),l=a(1477),c=a(755),u=a.n(c),m=a(756),h=a.n(m),p=a(47),d=a(27);const f=Object(i.a)({nobackground:{backgroundColor:"#0000"}});function g({children:e}){const[t,a]=Object(n.useState)(!0),i=f(),c=p.b.Router();if(c.page()===d.a.BitVerse||c.page()===d.a.HackingMission||c.page()===d.a.Loading)return r.a.createElement(r.a.Fragment,null);let m;return m=t?r.a.createElement(u.a,{color:"primary"}):r.a.createElement(h.a,{color:"primary"}),r.a.createElement("div",{style:{position:"fixed",top:0,right:0,zIndex:1500}},r.a.createElement(o.a,{display:"flex",justifyContent:"flex-end",flexDirection:"column"},r.a.createElement(s.a,{in:t},e),r.a.createElement(o.a,{display:"flex",justifyContent:"flex-end"},r.a.createElement(l.a,{classes:{root:i.nobackground},onClick:()=>a(e=>!e)},m))))}},,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return Pe}));var n=a(0),r=a.n(n),i=a(12),o=a(17),s=a(277),l=a(142),c=a(1478),u=a(370),m=a(552),h=a(761),p=a.n(h),d=a(760),f=a.n(d),g=a(63),y=a(117),b=a(103),E=a(9),v=a(328),k=a(638),_=a(763),w=a.n(_),C=a(286),S=a.n(C),x=a(764),O=a.n(x),T=a(484),M=a.n(T),P=a(765),R=a.n(P),A=a(426),N=a.n(A),I=a(767),j=a.n(I),F=a(488),D=a.n(F),B=a(485),L=a.n(B),G=a(768),W=a.n(G),H=a(486),U=a.n(H),q=a(770),K=a.n(q),$=a(771),z=a.n($),Y=a(772),V=a.n(Y),J=a(773),Q=a.n(J),X=a(774),Z=a.n(X),ee=a(775),te=a.n(ee),ae=a(777),ne=a.n(ae),re=a(427),ie=a.n(re),oe=a(778),se=a.n(oe),le=a(766),ce=a.n(le),ue=a(769),me=a.n(ue),he=a(776),pe=a.n(he),de=a(287),fe=a.n(de),ge=a(75),ye=a.n(ge),be=a(27),Ee=a(4),ve=a(35),ke=a(487),_e=a(18),we=a(207),Ce=a(134),Se=a(79);const xe=e=>({width:e.spacing(31),transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}),Oe=e=>({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:`calc(${e.spacing(2)} + 1px)`,[e.breakpoints.up("sm")]:{width:`calc(${e.spacing(7)} + 1px)`}}),Te=Object(o.a)(c.a,{shouldForwardProp:e=>"open"!==e})(({theme:e,open:t})=>({width:e.spacing(31),whiteSpace:"nowrap",boxSizing:"border-box",...t&&{...xe(e),"& .MuiDrawer-paper":xe(e)},...!t&&{...Oe(e),"& .MuiDrawer-paper":Oe(e)}})),Me=Object(l.a)(e=>Object(s.a)({active:{borderLeft:"3px solid "+e.palette.primary.main},listitem:{}}));function Pe(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(a,200);return()=>clearInterval(e)},[]);const[o,s]=Object(n.useState)(!0),[l,c]=Object(n.useState)(!0),[h,d]=Object(n.useState)(!0),[_,C]=Object(n.useState)(!0),x=ve.a.currStep===ve.f.CharacterGoToTerminalPage||ve.a.currStep===ve.f.ActiveScriptsPage,T=ve.a.currStep===ve.f.GoToCharacterPage,P=ve.a.currStep===ve.f.TerminalGoToActiveScriptsPage,A=ve.a.currStep===ve.f.GoToHacknetNodesPage,I=ve.a.currStep===ve.f.HacknetNodesGoToWorldPage,F=ve.a.currStep===ve.f.WorldDescription,B=e.player.queuedAugmentations.length,G=e.player.factionInvitations.length,H=Object(ke.a)(e.player).length,q=H>0||e.player.augmentations.length>0||e.player.queuedAugmentations.length>0||e.player.sourceFiles.length>0,$=e.player.factionInvitations.length>0||e.player.factions.length>0||e.player.augmentations.length>0||e.player.queuedAugmentations.length>0||e.player.sourceFiles.length>0,Y=e.player.augmentations.length>0||e.player.queuedAugmentations.length>0||e.player.sourceFiles.length>0,J=e.player.sleeves.length>0,X=!!e.player.corporation,ee=!!e.player.gang,ae=""!==e.player.companyName,re=e.player.hasWseAccount,oe=!!e.player.bladeburner;function le(){e.router.toTerminal(),x&&Object(ve.c)()}function ue(){e.router.toScriptEditor()}function he(){e.router.toStats(),T&&Object(ve.c)()}function de(){e.router.toActiveScripts(),P&&Object(ve.c)()}function ge(){e.router.toCreateProgram()}function xe(){e.router.toFactions()}function Oe(){e.router.toAugmentations()}function Pe(){e.router.toHacknetNodes(),A&&Object(ve.c)()}function Re(){e.router.toCity(),I&&Object(ve.c)()}function Ae(){e.router.toTravel()}function Ne(){e.router.toJob()}function Ie(){e.router.toBladeburner()}function je(){e.router.toGang()}function Fe(){e.router.toTutorial(),F&&Object(ve.c)()}Object(n.useEffect)(()=>{function t(t){if(!_e.a.DisableHotkeys&&!(e.player.isWorking||we.b||Ce.c))if(t.keyCode==Se.a.T&&t.altKey)t.preventDefault(),le();else if(t.keyCode===Se.a.C&&t.altKey)t.preventDefault(),he();else if(t.keyCode===Se.a.E&&t.altKey)t.preventDefault(),ue();else if(t.keyCode===Se.a.S&&t.altKey)t.preventDefault(),de();else if(t.keyCode===Se.a.H&&t.altKey)t.preventDefault(),Pe();else if(t.keyCode===Se.a.W&&t.altKey)t.preventDefault(),Re();else if(t.keyCode===Se.a.J&&t.altKey)t.preventDefault(),Ne();else if(t.keyCode===Se.a.R&&t.altKey)t.preventDefault(),Ae();else if(t.keyCode===Se.a.P&&t.altKey)t.preventDefault(),ge();else if(t.keyCode===Se.a.F&&t.altKey){if(e.page==be.a.Terminal&&_e.a.EnableBashHotkeys)return;t.preventDefault(),xe()}else t.keyCode===Se.a.A&&t.altKey?(t.preventDefault(),Oe()):t.keyCode===Se.a.U&&t.altKey?(t.preventDefault(),Fe()):t.keyCode===Se.a.B&&t.altKey?(t.preventDefault(),Ie()):t.keyCode===Se.a.G&&t.altKey&&(t.preventDefault(),je())}return document.addEventListener("keypress",t),()=>document.removeEventListener("keypress",t)},[]);const De=Me(),[Be,Le]=Object(n.useState)(!0);return r.a.createElement(Te,{open:Be,anchor:"left",variant:"permanent"},r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,onClick:()=>Le(e=>!e)},r.a.createElement(y.a,null,Be?r.a.createElement(p.a,{color:"primary"}):r.a.createElement(f.a,{color:"primary"})),r.a.createElement(b.a,{primary:r.a.createElement(E.a,null,"Bitburner v",Ee.a.Version)})),r.a.createElement(m.a,null),r.a.createElement(u.a,null,r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,onClick:()=>s(e=>!e)},r.a.createElement(y.a,null,r.a.createElement(w.a,{color:"primary"})),r.a.createElement(b.a,{primary:r.a.createElement(E.a,null,"Hacking")}),o?r.a.createElement(fe.a,{color:"primary"}):r.a.createElement(ye.a,{color:"primary"})),r.a.createElement(v.a,{in:o,timeout:"auto",unmountOnExit:!0},r.a.createElement(u.a,null,r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Terminal",className:Object(i.a)({[De.active]:e.page===be.a.Terminal}),onClick:le},r.a.createElement(y.a,null,r.a.createElement(S.a,{color:x?"error":e.page!==be.a.Terminal?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:x?"error":e.page!==be.a.Terminal?"secondary":"primary"},"Terminal"))),r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Create Scripts",className:Object(i.a)({[De.active]:e.page===be.a.CreateScript}),onClick:ue},r.a.createElement(y.a,null,r.a.createElement(O.a,{color:e.page!==be.a.CreateScript?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.CreateScript?"secondary":"primary"},"Create Script"))),r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Active Scripts",className:Object(i.a)({[De.active]:e.page===be.a.ActiveScripts}),onClick:de},r.a.createElement(y.a,null,r.a.createElement(M.a,{color:P?"error":e.page!==be.a.ActiveScripts?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:P?"error":e.page!==be.a.ActiveScripts?"secondary":"primary"},"Active Scripts"))),q&&r.a.createElement(g.a,{button:!0,key:"Create Program",className:Object(i.a)({[De.active]:e.page===be.a.CreateProgram}),onClick:ge},r.a.createElement(y.a,null,r.a.createElement(k.a,{badgeContent:H>0?H:void 0,color:"error"},r.a.createElement(R.a,{color:e.page!==be.a.CreateProgram?"secondary":"primary"}))),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.CreateProgram?"secondary":"primary"},"Create Program"))))),r.a.createElement(m.a,null),r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,onClick:()=>c(e=>!e)},r.a.createElement(y.a,null,r.a.createElement(ce.a,{color:"primary"})),r.a.createElement(b.a,{primary:r.a.createElement(E.a,null,"Character")}),l?r.a.createElement(fe.a,{color:"primary"}):r.a.createElement(ye.a,{color:"primary"})),r.a.createElement(v.a,{in:l,timeout:"auto",unmountOnExit:!0},r.a.createElement(g.a,{button:!0,key:"Stats",className:Object(i.a)({[De.active]:e.page===be.a.Stats}),onClick:he},r.a.createElement(y.a,null,r.a.createElement(N.a,{color:T?"error":e.page!==be.a.Stats?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:T?"error":e.page!==be.a.Stats?"secondary":"primary"},"Stats"))),$&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Factions",className:Object(i.a)({[De.active]:[be.a.Factions,be.a.Faction].includes(e.page)}),onClick:xe},r.a.createElement(y.a,null,r.a.createElement(k.a,{badgeContent:0!==G?G:void 0,color:"error"},r.a.createElement(j.a,{color:[be.a.Factions,be.a.Faction].includes(e.page)?"primary":"secondary"}))),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:[be.a.Factions,be.a.Faction].includes(e.page)?"primary":"secondary"},"Factions"))),Y&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Augmentations",className:Object(i.a)({[De.active]:e.page===be.a.Augmentations}),onClick:Oe},r.a.createElement(y.a,null,r.a.createElement(k.a,{badgeContent:0!==B?B:void 0,color:"error"},r.a.createElement(D.a,{style:{transform:"rotate(-90deg)"},color:e.page!==be.a.Augmentations?"secondary":"primary"}))),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Augmentations?"secondary":"primary"},"Augmentations"))),r.a.createElement(g.a,{button:!0,key:"Hacknet",className:Object(i.a)({[De.active]:e.page===be.a.Hacknet}),onClick:Pe},r.a.createElement(y.a,null,r.a.createElement(L.a,{color:A?"error":e.page!==be.a.Hacknet?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:A?"error":e.page!==be.a.Hacknet?"secondary":"primary"},"Hacknet"))),J&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Sleeves",className:Object(i.a)({[De.active]:e.page===be.a.Sleeves}),onClick:function(){e.router.toSleeves()}},r.a.createElement(y.a,null,r.a.createElement(W.a,{color:e.page!==be.a.Sleeves?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Sleeves?"secondary":"primary"},"Sleeves")))),r.a.createElement(m.a,null),r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,onClick:()=>d(e=>!e)},r.a.createElement(y.a,null,r.a.createElement(me.a,{color:"primary"})),r.a.createElement(b.a,{primary:r.a.createElement(E.a,null,"World")}),h?r.a.createElement(fe.a,{color:"primary"}):r.a.createElement(ye.a,{color:"primary"})),r.a.createElement(v.a,{in:h,timeout:"auto",unmountOnExit:!0},r.a.createElement(g.a,{button:!0,key:"City",className:Object(i.a)({[De.active]:e.page===be.a.City||e.page===be.a.Resleeves||e.page===be.a.Location}),onClick:Re},r.a.createElement(y.a,null,r.a.createElement(U.a,{color:I?"error":e.page!==be.a.City?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:I?"error":e.page!==be.a.City?"secondary":"primary"},"City"))),r.a.createElement(g.a,{button:!0,key:"Travel",className:Object(i.a)({[De.active]:e.page===be.a.Travel}),onClick:Ae},r.a.createElement(y.a,null,r.a.createElement(K.a,{color:e.page!==be.a.Travel?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Travel?"secondary":"primary"},"Travel"))),ae&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Job",className:Object(i.a)({[De.active]:e.page===be.a.Job}),onClick:Ne},r.a.createElement(y.a,null,r.a.createElement(z.a,{color:e.page!==be.a.Job?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Job?"secondary":"primary"},"Job"))),re&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Stock Market",className:Object(i.a)({[De.active]:e.page===be.a.StockMarket}),onClick:function(){e.router.toStockMarket()}},r.a.createElement(y.a,null,r.a.createElement(V.a,{color:e.page!==be.a.StockMarket?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.StockMarket?"secondary":"primary"},"Stock Market"))),oe&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Bladeburner",className:Object(i.a)({[De.active]:e.page===be.a.Bladeburner}),onClick:Ie},r.a.createElement(y.a,null,r.a.createElement(Q.a,{color:e.page!==be.a.Bladeburner?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Bladeburner?"secondary":"primary"},"Bladeburner"))),X&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Corp",className:Object(i.a)({[De.active]:e.page===be.a.Corporation}),onClick:function(){e.router.toCorporation()}},r.a.createElement(y.a,null,r.a.createElement(Z.a,{color:e.page!==be.a.Corporation?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Corporation?"secondary":"primary"},"Corp"))),ee&&r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,key:"Gang",className:Object(i.a)({[De.active]:e.page===be.a.Gang}),onClick:je},r.a.createElement(y.a,null,r.a.createElement(te.a,{color:e.page!==be.a.Gang?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Gang?"secondary":"primary"},"Gang")))),r.a.createElement(m.a,null),r.a.createElement(g.a,{classes:{root:De.listitem},button:!0,onClick:()=>C(e=>!e)},r.a.createElement(y.a,null,r.a.createElement(pe.a,{color:"primary"})),r.a.createElement(b.a,{primary:r.a.createElement(E.a,null,"Help")}),_?r.a.createElement(fe.a,{color:"primary"}):r.a.createElement(ye.a,{color:"primary"})),r.a.createElement(v.a,{in:_,timeout:"auto",unmountOnExit:!0},r.a.createElement(g.a,{button:!0,key:"Milestones",className:Object(i.a)({[De.active]:e.page===be.a.Milestones}),onClick:function(){e.router.toMilestones()}},r.a.createElement(y.a,null,r.a.createElement(ne.a,{color:e.page!==be.a.Milestones?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Milestones?"secondary":"primary"},"Milestones"))),r.a.createElement(g.a,{button:!0,key:"Tutorial",className:Object(i.a)({[De.active]:e.page===be.a.Tutorial}),onClick:Fe},r.a.createElement(y.a,null,r.a.createElement(ie.a,{color:F?"error":e.page!==be.a.Tutorial?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:F?"error":e.page!==be.a.Tutorial?"secondary":"primary"},"Tutorial"))),r.a.createElement(g.a,{button:!0,key:"Options",className:Object(i.a)({[De.active]:e.page===be.a.Options}),onClick:function(){e.router.toGameOptions()}},r.a.createElement(y.a,null,r.a.createElement(se.a,{color:e.page!==be.a.Options?"secondary":"primary"})),r.a.createElement(b.a,null,r.a.createElement(E.a,{color:e.page!==be.a.Options?"secondary":"primary"},"Options"))),!1)))}},,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a(780),i=a(786),o=a(787),s=a(1),l=a(26),c=a(311);class u extends n.Component{constructor(e){super(e),this.state={rerender:!1},this.export=this.export.bind(this)}export(){this.props.exportGameFn(),this.setState({rerender:!this.state.rerender})}render(){return n.createElement(n.Fragment,null,n.createElement("div",{className:"augmentations-content"},n.createElement("h1",null,"Purchased Augmentations"),n.createElement("p",null,"Below is a list of all Augmentations you have purchased but not yet installed. Click the button below to install them."),n.createElement("p",null,"WARNING: Installing your Augmentations resets most of your progress, including:"),n.createElement("br",null),n.createElement("p",null,"- Stats/Skill levels and Experience"),n.createElement("p",null,"- Money"),n.createElement("p",null,"- Scripts on every computer but your home computer"),n.createElement("p",null,"- Purchased servers"),n.createElement("p",null,"- Hacknet Nodes"),n.createElement("p",null,"- Faction/Company reputation"),n.createElement("p",null,"- Stocks"),n.createElement("br",null),n.createElement("p",null,"Installing Augmentations lets you start over with the perks and benefits granted by all of the Augmentations you have ever installed. Also, you will keep any scripts and RAM/Core upgrades on your home computer (but you will lose all programs besides NUKE.exe)"),n.createElement(l.a,{onClick:this.props.installAugmentationsFn,text:"Install Augmentations",tooltip:"'I never asked for this'"}),n.createElement(l.a,{addClasses:"flashing-button",onClick:this.export,text:"Backup Save "+(Object(c.b)()?"(+1 favor to all factions)":""),tooltip:"It's always a good idea to backup/export your save!"}),n.createElement(o.a,null),n.createElement("h1",null,"Installed Augmentations"),n.createElement("p",null,`List of all Augmentations ${s.a.sourceFiles.length>0?"and Source Files ":""} that have been installed. You have gained the effects of these.`),n.createElement(r.a,null),n.createElement("br",null)," ",n.createElement("br",null),n.createElement(i.a,null)))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a(781),i=a(782),o=a(783),s=a(785),l=a(18),c=a(147);class u extends n.Component{constructor(e){super(e),this.state={rerenderFlag:!1},this.collapseAllHeaders=this.collapseAllHeaders.bind(this),this.expandAllHeaders=this.expandAllHeaders.bind(this),this.sortByAcquirementTime=this.sortByAcquirementTime.bind(this),this.sortInOrder=this.sortInOrder.bind(this),this.listRef=n.createRef()}collapseAllHeaders(){const e=this.listRef.current;if(null==e)return;const t=e.getElementsByClassName("accordion-header");for(let e=0;e({rerenderFlag:!e.rerenderFlag}))}sortByAcquirementTime(){l.a.OwnedAugmentationsOrder=c.a.AcquirementTime,this.rerender()}sortInOrder(){l.a.OwnedAugmentationsOrder=c.a.Alphabetically,this.rerender()}render(){return n.createElement(n.Fragment,null,n.createElement(i.a,{collapseAllButtonsFn:this.collapseAllHeaders,expandAllButtonsFn:this.expandAllHeaders,sortByAcquirementTimeFn:this.sortByAcquirementTime,sortInOrderFn:this.sortInOrder}),n.createElement("ul",{className:"augmentations-list",ref:this.listRef},n.createElement(s.a,null),n.createElement(o.a,null),n.createElement(r.a,null)))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a(1),i=a(19),o=a(5),s=a(18),l=a(147),c=a(489);function u(){const e=r.a.augmentations.slice();s.a.OwnedAugmentationsOrder===l.a.Alphabetically&&e.sort((e,t)=>e.name<=t.name?-1:1);const t=e.map(e=>{const t=i.a[e.name];let a=null;return e.name===o.a.NeuroFluxGovernor&&(a=e.level),n.createElement("li",{key:e.name},n.createElement(c.a,{aug:t,level:a}))});return n.createElement(n.Fragment,null,t)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(26);function i(e){return n.createElement(n.Fragment,null,n.createElement(r.a,{onClick:e.expandAllButtonsFn,text:"Expand All"}),n.createElement(r.a,{onClick:e.collapseAllButtonsFn,text:"Collapse All"}),n.createElement(r.a,{onClick:e.sortInOrderFn,text:"Sort in Order",tooltip:"Sorts the Augmentations alphabetically and Source-Files in numeral order"}),n.createElement(r.a,{onClick:e.sortByAcquirementTimeFn,text:"Sort by Acquirement Time",tooltip:"Sorts the Augmentations and Source-Files based on when you acquired them (same as default)"}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a(1),i=a(18),o=a(147),s=a(300),l=a(784);function c(){const e=r.a.sourceFiles.slice();i.a.OwnedAugmentationsOrder===o.a.Alphabetically&&e.sort((e,t)=>e.n-t.n);const t=e.map(e=>{const t="SourceFile"+e.n,a=s.a[t];return null==a?(console.error("Invalid source file number: "+e.n),null):n.createElement("li",{key:e.n},n.createElement(l.a,{level:e.lvl,sf:a}))});return n.createElement(n.Fragment,null,t)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(234);function i(e){const t=12===e.sf.n?"∞":"3";return n.createElement(r.a,{headerContent:n.createElement(n.Fragment,null,e.sf.name,n.createElement("br",null),`Level ${e.level} / ${t}`),panelContent:n.createElement("p",{dangerouslySetInnerHTML:{__html:e.sf.info}})})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a(1),i=a(235),o=a(234);function s(){const e=r.a.exploits;return 0===e.length?n.createElement(n.Fragment,null):n.createElement("li",{key:-1},n.createElement(o.a,{headerContent:n.createElement(n.Fragment,null,"Source-File -1: Exploits in the BitNodes",n.createElement("br",null),"Level ",e.length," / ?"),panelContent:n.createElement(n.Fragment,null,n.createElement("p",null,"This Source-File can only be acquired with obscure knowledge of the game, javascript, and the web ecosystem."),n.createElement("p",null,"It increases all of the player's multipliers by 0.1%"),n.createElement("br",null),n.createElement("p",null,"You have found the following exploits:"),n.createElement("ul",null,e.map(e=>n.createElement("li",{key:e},"* ",Object(i.b)(e)))))}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a(1),i=a(3),o=a(19);function s(){const e=function(){const e={};for(const t of r.a.queuedAugmentations){const a=o.a[t.name];for(const t in a.mults){const n=e[t]?e[t]:1;e[t]=n*a.mults[t]}}return e}();function t(e){return n.createElement("table",null,n.createElement("tbody",null,e.map(e=>n.createElement("tr",{key:e[0]},n.createElement("td",{key:"0"},n.createElement("span",null,e[0]," multiplier: ")),n.createElement("td",{key:"1",style:{textAlign:"right"}},i.a.formatPercentage(e[1])),function(e){let t=[];return e&&(t=[n.createElement("td",{key:"2"}," ","=>"," "),n.createElement("td",{key:"3"},i.a.formatPercentage(e))]),t}(e[2])))))}return n.createElement(n.Fragment,null,n.createElement("p",null,n.createElement("strong",null,n.createElement("u",null,"Multipliers:"))),n.createElement("br",null),t([["Hacking Chance ",r.a.hacking_chance_mult,r.a.hacking_chance_mult*e.hacking_chance_mult],["Hacking Speed ",r.a.hacking_speed_mult,r.a.hacking_speed_mult*e.hacking_speed_mult],["Hacking Money ",r.a.hacking_money_mult,r.a.hacking_money_mult*e.hacking_money_mult],["Hacking Growth ",r.a.hacking_grow_mult,r.a.hacking_grow_mult*e.hacking_grow_mult]]),n.createElement("br",null),t([["Hacking Level ",r.a.hacking_mult,r.a.hacking_mult*e.hacking_mult],["Hacking Experience ",r.a.hacking_exp_mult,r.a.hacking_exp_mult*e.hacking_exp_mult]]),n.createElement("br",null),t([["Strength Level ",r.a.strength_mult,r.a.strength_mult*e.strength_mult],["Strength Experience ",r.a.strength_exp_mult,r.a.strength_exp_mult*e.strength_exp_mult]]),n.createElement("br",null),t([["Defense Level ",r.a.defense_mult,r.a.defense_mult*e.defense_mult],["Defense Experience ",r.a.defense_exp_mult,r.a.defense_exp_mult*e.defense_exp_mult]]),n.createElement("br",null),t([["Dexterity Level ",r.a.dexterity_mult,r.a.dexterity_mult*e.dexterity_mult],["Dexterity Experience ",r.a.dexterity_exp_mult,r.a.dexterity_exp_mult*e.dexterity_exp_mult]]),n.createElement("br",null),t([["Agility Level ",r.a.agility_mult,r.a.agility_mult*e.agility_mult],["Agility Experience ",r.a.agility_exp_mult,r.a.agility_exp_mult*e.agility_exp_mult]]),n.createElement("br",null),t([["Charisma Level ",r.a.charisma_mult,r.a.charisma_mult*e.charisma_mult],["Charisma Experience ",r.a.charisma_exp_mult,r.a.charisma_exp_mult*e.charisma_exp_mult]]),n.createElement("br",null),t([["Hacknet Node production ",r.a.hacknet_node_money_mult,r.a.hacknet_node_money_mult*e.hacknet_node_money_mult],["Hacknet Node purchase cost ",r.a.hacknet_node_purchase_cost_mult,r.a.hacknet_node_purchase_cost_mult*e.hacknet_node_purchase_cost_mult],["Hacknet Node RAM upgrade cost ",r.a.hacknet_node_ram_cost_mult,r.a.hacknet_node_ram_cost_mult*e.hacknet_node_ram_cost_mult],["Hacknet Node Core purchase cost ",r.a.hacknet_node_core_cost_mult,r.a.hacknet_node_core_cost_mult*e.hacknet_node_core_cost_mult],["Hacknet Node level upgrade cost ",r.a.hacknet_node_level_cost_mult,r.a.hacknet_node_level_cost_mult*e.hacknet_node_level_cost_mult]]),n.createElement("br",null),t([["Company reputation gain ",r.a.company_rep_mult,r.a.company_rep_mult*e.company_rep_mult],["Faction reputation gain ",r.a.faction_rep_mult,r.a.faction_rep_mult*e.faction_rep_mult],["Salary ",r.a.work_money_mult,r.a.work_money_mult*e.work_money_mult]]),n.createElement("br",null),t([["Crime success ",r.a.crime_success_mult,r.a.crime_success_mult*e.crime_success_mult],["Crime money ",r.a.crime_money_mult,r.a.crime_money_mult*e.crime_money_mult]]),n.createElement("br",null),n.createElement((function(){return r.a.canAccessBladeburner()?n.createElement(n.Fragment,null,t([["Bladeburner Success Chance",r.a.bladeburner_success_chance_mult,r.a.bladeburner_success_chance_mult*e.bladeburner_success_chance_mult],["Bladeburner Max Stamina",r.a.bladeburner_max_stamina_mult,r.a.bladeburner_max_stamina_mult*e.bladeburner_max_stamina_mult],["Bladeburner Stamina Gain",r.a.bladeburner_stamina_gain_mult,r.a.bladeburner_stamina_gain_mult*e.bladeburner_stamina_gain_mult],["Bladeburner Field Analysis",r.a.bladeburner_analysis_mult,r.a.bladeburner_analysis_mult*e.bladeburner_analysis_mult]]),n.createElement("br",null)):n.createElement(n.Fragment,null)}),null))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(19),i=a(5),o=a(1),s=a(489);function l(){const e=[];let t=-1;for(let e=o.a.queuedAugmentations.length-1;e>=0;e--)if(o.a.queuedAugmentations[e].name===i.a.NeuroFluxGovernor){t=e;break}for(let a=0;a0&&i.a.createElement(E.a,{player:e.player}),i.a.createElement(v.a,{player:e.player,engine:e.engine}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(15);function h(e){function t(t){return function(){e.player.gainMoney(t)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"General")),r.a.createElement(s.a,null,r.a.createElement("div",null,r.a.createElement(u.a,{onClick:t(1e6)},r.a.createElement("pre",null,"+ ",r.a.createElement(m.a,{money:1e6}))),r.a.createElement(u.a,{onClick:t(1e9)},r.a.createElement("pre",null,"+ ",r.a.createElement(m.a,{money:1e9}))),r.a.createElement(u.a,{onClick:t(1e12)},r.a.createElement("pre",null,"+ ",r.a.createElement(m.a,{money:1e12}))),r.a.createElement(u.a,{onClick:t(1e15)},r.a.createElement("pre",null,"+ ",r.a.createElement(m.a,{money:1e15}))),r.a.createElement(u.a,{onClick:t(1/0)},r.a.createElement("pre",null,"+ ",r.a.createElement(m.a,{money:1/0}))),r.a.createElement(u.a,{onClick:function(){e.player.getHomeComputer().maxRam*=2}},"+ RAM")),r.a.createElement("div",null,r.a.createElement(u.a,{onClick:function(){e.router.toBitVerse(!0,!0)}},"Quick b1t_flum3.exe"),r.a.createElement(u.a,{onClick:function(){e.router.toBitVerse(!0,!1)}},"Run b1t_flum3.exe"),r.a.createElement(u.a,{onClick:function(){e.router.toBitVerse(!1,!0)}},"Quick w0rld_d34m0n"),r.a.createElement(u.a,{onClick:function(){e.router.toBitVerse(!1,!1)}},"Hack w0rld_d34m0n"))))}},,function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(120);const h=1e27;function p(e){function t(t,a){return function(n){switch(t){case"hacking":n&&e.player.gainHackingExp(n*a);break;case"strength":n&&e.player.gainStrengthExp(n*a);break;case"defense":n&&e.player.gainDefenseExp(n*a);break;case"dexterity":n&&e.player.gainDexterityExp(n*a);break;case"agility":n&&e.player.gainAgilityExp(n*a);break;case"charisma":n&&e.player.gainCharismaExp(n*a);break;case"intelligence":n&&e.player.gainIntelligenceExp(n*a)}e.player.updateSkillLevels()}}function a(t){return function(a){e.player.karma+=a*t}}function n(t){return function(){switch(t){case"hacking":e.player.hacking_exp=0;break;case"strength":e.player.strength_exp=0;break;case"defense":e.player.defense_exp=0;break;case"dexterity":e.player.dexterity_exp=0;break;case"agility":e.player.agility_exp=0;break;case"charisma":e.player.charisma_exp=0;break;case"intelligence":e.player.intelligence_exp=0}e.player.updateSkillLevels()}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Experience / Stats")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"All:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.gainHackingExp(h),e.player.gainStrengthExp(h),e.player.gainDefenseExp(h),e.player.gainDexterityExp(h),e.player.gainAgilityExp(h),e.player.gainCharismaExp(h),e.player.gainIntelligenceExp(h),e.player.updateSkillLevels()}},"Tons of exp"),r.a.createElement(u.a,{onClick:function(){e.player.hacking_exp=0,e.player.strength_exp=0,e.player.defense_exp=0,e.player.dexterity_exp=0,e.player.agility_exp=0,e.player.charisma_exp=0,e.player.intelligence_exp=0,e.player.updateSkillLevels()}},"Reset"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Hacking:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"hacking",placeholder:"exp",tons:()=>t("hacking",1)(h),add:t("hacking",1),subtract:t("hacking",-1),reset:n("hacking")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Strength:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"strength",placeholder:"exp",tons:()=>t("strength",1)(h),add:t("strength",1),subtract:t("strength",-1),reset:n("strength")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Defense:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"defense",placeholder:"exp",tons:()=>t("defense",1)(h),add:t("defense",1),subtract:t("defense",-1),reset:n("defense")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Dexterity:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"dexterity",placeholder:"exp",tons:()=>t("dexterity",1)(h),add:t("dexterity",1),subtract:t("dexterity",-1),reset:n("dexterity")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Agility:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"agility",placeholder:"exp",tons:()=>t("agility",1)(h),add:t("agility",1),subtract:t("agility",-1),reset:n("agility")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Charisma:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"charisma",placeholder:"exp",tons:()=>t("charisma",1)(h),add:t("charisma",1),subtract:t("charisma",-1),reset:n("charisma")}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Intelligence:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"intelligence",placeholder:"exp",tons:()=>t("intelligence",1)(h),add:t("intelligence",1),subtract:t("intelligence",-1),reset:n("intelligence")})),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){0===e.player.intelligence&&(e.player.intelligence=1,e.player.updateSkillLevels())}},"Enable")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.intelligence_exp=0,e.player.intelligence=0,e.player.updateSkillLevels()}},"Disable"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text text-center"},"Karma:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"karma",placeholder:"amt",tons:()=>t("intelligence",1)(1e5),add:a(1),subtract:a(-1),reset:function(){e.player.karma=0}})))))))}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return _}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(290),h=a(120),p=a(24),d=a(1161),f=a(125),g=a(116),y=a(497),b=a.n(y),E=a(384),v=a.n(E),k=a(1162);function _(e){const[t,a]=Object(n.useState)("Illuminati");function l(e){return function(a){const n=p.a[t];null==n||isNaN(a)||(n.playerReputation+=a*e)}}function y(e){return function(a){const n=p.a[t];null==n||isNaN(a)||(n.favor+=a*e)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Factions")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Faction:")),r.a.createElement("td",null,r.a.createElement(d.a,null,r.a.createElement(k.a,{id:"factions-select"},"Faction"),r.a.createElement(m.a,{labelId:"factions-select",id:"factions-dropdown",className:"dropdown exp-input",onChange:function(e){a(e.target.value)},value:t,startAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(g.a,{onClick:function(){for(const t in p.a)e.player.receiveInvite(p.a[t].name)},size:"large","arial-label":"receive-all-invitation"},r.a.createElement(b.a,null)),r.a.createElement(g.a,{onClick:function(){e.player.receiveInvite(t)},size:"large","arial-label":"receive-one-invitation"},r.a.createElement(v.a,null)))},Object.values(p.a).map(e=>r.a.createElement(f.a,{key:e.name,value:e.name},e.name)))))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Reputation:")),r.a.createElement("td",null,r.a.createElement(h.a,{label:"reputation",placeholder:"amt",tons:()=>l(1)(1e12),add:l(1),subtract:l(-1),reset:function(){const e=p.a[t];null!=e&&(e.playerReputation=0)}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Favor:")),r.a.createElement("td",null,r.a.createElement(h.a,{label:"favor",placeholder:"amt",tons:()=>y(1)(2e3),add:y(1),subtract:y(-1),reset:function(){const e=p.a[t];null!=e&&(e.favor=0)}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"All Reputation:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in p.a)p.a[e].playerReputation=1e12}},"Tons"),r.a.createElement(u.a,{onClick:function(){for(const e in p.a)p.a[e].playerReputation=0}},"Reset"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"All Favor:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in p.a)p.a[e].favor=1e12}},"Tons"),r.a.createElement(u.a,{onClick:function(){for(const e in p.a)p.a[e].favor=0}},"Reset")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return v}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(290),m=a(5),h=a(125),p=a(116),d=a(497),f=a.n(d),g=a(384),y=a.n(g),b=a(496),E=a.n(b);function v(e){const[t,a]=Object(n.useState)("Augmented Targeting I");return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Augmentations")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Aug:")),r.a.createElement("td",null,r.a.createElement(u.a,{onChange:function(e){a(e.target.value)},value:t,startAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(p.a,{onClick:function(){for(const t in m.a){const a=m.a[t];e.player.queueAugmentation(a)}},size:"large"},r.a.createElement(f.a,null)),r.a.createElement(p.a,{onClick:function(){e.player.queueAugmentation(t)},size:"large"},r.a.createElement(y.a,null))),endAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(p.a,{onClick:function(){e.player.augmentations=[]},size:"large"},r.a.createElement(E.a,null)))},Object.values(m.a).map(e=>r.a.createElement(h.a,{key:e,value:e},e)))))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(498),h=a(639);const p=[1,2,3,4,5,6,7,8,9,10,11,12];function d(e){function t(t,a){return function(){if(0!==a)if(e.player.sourceFiles.some(e=>e.n===t))for(let n=0;ne.n!==t)}}function a(e){return()=>{for(let a=0;ar.a.createElement("tr",{key:"sf-"+e},r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"SF-",e,":")),r.a.createElement("td",null,r.a.createElement(h.a,null,r.a.createElement(u.a,{onClick:t(e,0)},"0"),r.a.createElement(u.a,{onClick:t(e,1)},"1"),r.a.createElement(u.a,{onClick:t(e,2)},"2"),r.a.createElement(u.a,{onClick:t(e,3)},"3")))))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(290),h=a(58),p=a(125);function d(e){const[t,a]=Object(n.useState)("NUKE.exe");return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Programs")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Program:")),r.a.createElement("td",null,r.a.createElement(m.a,{onChange:function(e){a(e.target.value)},value:t},Object.values(h.a).map(e=>r.a.createElement(p.a,{key:e.name,value:e.name},e.name))))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Add:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.hasProgram(t)||e.player.getHomeComputer().programs.push(t)}},"One"),r.a.createElement(u.a,{onClick:function(){for(const t in h.a)e.player.hasProgram(h.a[t].name)||e.player.getHomeComputer().programs.push(h.a[t].name)}},"All")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(290),h=a(32),p=a(94),d=a(38),f=a(125);function g(){const[e,t]=Object(n.useState)("home");return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Servers")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Server:")),r.a.createElement("td",{colSpan:2},r.a.createElement(m.a,{id:"dev-servers-dropdown",className:"dropdown",onChange:function(e){t(e.target.value)},value:e},Object.values(h.b).map(e=>r.a.createElement(f.a,{key:e.hostname,value:e.hostname},e.hostname))))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Root:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){const t=Object(d.a)(e);null!==t&&(t instanceof p.a||(t.hasAdminRights=!0,t.sshPortOpen=!0,t.ftpPortOpen=!0,t.smtpPortOpen=!0,t.httpPortOpen=!0,t.sqlPortOpen=!0,t.openPortCount=5))}},"Root one")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in h.b){const t=h.b[e];if(t instanceof p.a)return;t.hasAdminRights=!0,t.sshPortOpen=!0,t.ftpPortOpen=!0,t.smtpPortOpen=!0,t.httpPortOpen=!0,t.sqlPortOpen=!0,t.openPortCount=5}}},"Root all"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Security:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){const t=Object(d.a)(e);null!==t&&(t instanceof p.a||(t.hackDifficulty=t.minDifficulty))}},"Min one")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in h.b){const t=h.b[e];t instanceof p.a||(t.hackDifficulty=t.minDifficulty)}}},"Min all"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Money:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){const t=Object(d.a)(e);null!==t&&(t instanceof p.a||(t.moneyAvailable=t.moneyMax))}},"Max one")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in h.b){const t=h.b[e];t instanceof p.a||(t.moneyAvailable=t.moneyMax)}}},"Max all")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(290),h=a(51),p=a(125),d=a(120);function f(){const[e,t]=Object(n.useState)("ECorp");function a(t){return function(a){const n=h.a[e];null==n||isNaN(a)||(n.playerReputation+=a*t)}}function l(t){return function(a){const n=h.a[e];null==n||isNaN(a)||(n.favor+=a*t)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Companies")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Company:")),r.a.createElement("td",{colSpan:3},r.a.createElement(m.a,{id:"dev-companies-dropdown",className:"dropdown",onChange:function(e){t(e.target.value)},value:e},Object.values(h.a).map(e=>r.a.createElement(p.a,{key:e.name,value:e.name},e.name))))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Reputation:")),r.a.createElement("td",null,r.a.createElement(d.a,{label:"reputation",placeholder:"amt",tons:()=>a(1)(1e12),add:a(1),subtract:a(-1),reset:function(){h.a[e].playerReputation=0}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Favor:")),r.a.createElement("td",null,r.a.createElement(d.a,{label:"favor",placeholder:"amt",tons:()=>l(1)(2e3),add:l(1),subtract:l(-1),reset:function(){h.a[e].favor=0}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"All Reputation:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in h.a)h.a[e].playerReputation=1e12}},"Tons"),r.a.createElement(u.a,{onClick:function(){for(const e in h.a)h.a[e].playerReputation=0}},"Reset"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"All Favor:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(const e in h.a)h.a[e].favor=1e12}},"Tons"),r.a.createElement(u.a,{onClick:function(){for(const e in h.a)h.a[e].favor=0}},"Reset")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(120);function m(e){function t(t){return function(a){e.player.bladeburner&&e.player.bladeburner.changeRank(e.player,a*t)}}function a(t){return function(a){e.player.bladeburner&&(e.player.bladeburner.storedCycles+=a*t)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Bladeburner")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Rank:")),r.a.createElement("td",null,r.a.createElement(u.a,{label:"rank",placeholder:"amt",tons:function(){e.player.bladeburner&&e.player.bladeburner.changeRank(e.player,1e27)},add:t(1),subtract:t(-1),reset:function(){e.player.bladeburner.rank=0,e.player.bladeburner.maxRank=0}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Cycles:")),r.a.createElement("td",null,r.a.createElement(u.a,{label:"cycles",placeholder:"amt",tons:function(){e.player.bladeburner&&(e.player.bladeburner.storedCycles+=1e27)},add:a(1),subtract:a(-1),reset:function(){e.player.bladeburner&&(e.player.bladeburner.storedCycles=0)}})))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(120);function m(e){function t(t){return function(a){e.player.gang&&(e.player.gang.storedCycles+=a*t)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Gang")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Cycles:")),r.a.createElement("td",null,r.a.createElement(u.a,{label:"cycles",placeholder:"amt",tons:function(){e.player.gang&&(e.player.gang.storedCycles=1e27)},add:t(1),subtract:t(-1),reset:function(){e.player.gang&&(e.player.gang.storedCycles=0)}})))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(120);function h(e){function t(t){return function(a){e.player.corporation&&(e.player.corporation.storedCycles+=a*t)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Corporation")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.corporation&&(e.player.corporation.funds=e.player.corporation.funds.plus(1e99))}},"Tons of funds"),r.a.createElement(u.a,{onClick:function(){e.player.corporation&&(e.player.corporation.funds=e.player.corporation.funds.minus(e.player.corporation.funds))}},"Reset funds"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Cycles:")),r.a.createElement("td",null,r.a.createElement(m.a,{label:"cycles",placeholder:"amt",tons:function(){e.player.corporation&&(e.player.corporation.storedCycles=1e27)},add:t(1),subtract:t(-1),reset:function(){e.player.corporation&&(e.player.corporation.storedCycles=0)}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.corporation&&e.player.corporation.divisions.forEach(e=>{Object.keys(e.products).forEach(t=>{const a=e.products[t];if(void 0===a)throw new Error("Impossible product undefined");a.prog=99.9})})}},"Finish products"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){e.player.corporation&&e.player.corporation.divisions.forEach(e=>{e.sciResearch.qty+=1e10})}},"Tons of research")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(290),h=a(125),p=a(310),d=a(83);function f(){const[e,t]=Object(n.useState)("Find Largest Prime Factor");return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Coding Contracts")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(u.a,{onClick:p.b},"Generate Random Contract"),r.a.createElement(u.a,{onClick:p.c},"Generate Random Contract on Home Comp"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement(m.a,{onChange:function(e){t(e.target.value)},value:e},Object.values(d.d).map(e=>r.a.createElement(h.a,{key:e.name,value:e.name},e.name))),r.a.createElement(u.a,{onClick:function(){Object(p.a)({problemType:e,server:"home"})}},"Generate Specified Contract Type on Home Comp")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37),m=a(329),h=a(15),p=a(11),d=a(80),f=a(112);function g(){const[e,t]=Object(n.useState)(0),[a,l]=Object(n.useState)("");function g(e){const t=a.replace(/\s/g,"");let n=()=>!0;""!==t&&"all"!==t&&(n=function(e){return t.split(",").includes(e)});for(const t in d.a)if(d.a.hasOwnProperty(t)){const a=d.a[t];a instanceof f.a&&n(a.symbol)&&e(a)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Stock Market")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Symbol:")),r.a.createElement("td",null,r.a.createElement(m.a,{placeholder:"symbol/'all'",onChange:function(e){l(e.target.value)}}))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Price:")),r.a.createElement("td",null,r.a.createElement(m.a,{placeholder:"$$$",onChange:function(e){t(parseFloat(e.target.value))}}),r.a.createElement(u.a,{onClick:function(){isNaN(e)||g(t=>{t.price=e})}},"Set"))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Caps:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){const e=[];g(t=>{e.push(r.a.createElement("tr",{key:t.symbol},r.a.createElement("td",null,t.symbol),r.a.createElement("td",{style:{textAlign:"right"}},r.a.createElement(h.a,{money:t.cap}))))}),Object(p.a)(r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("th",null,"Stock"),r.a.createElement("th",null,"Price cap")),e)))}},"View stock caps")))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(171),o=a(172),s=a(173),l=a(75),c=a.n(l),u=a(37);function m(e){return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Sleeves")),r.a.createElement(s.a,null,r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("span",{className:"text"},"Shock:")),r.a.createElement("td",null,r.a.createElement(u.a,{onClick:function(){for(let t=0;t{e.player.lastUpdate-=t,e.engine._lastUpdate-=t,m.b.saveGame(),setTimeout(()=>location.reload(),1e3)}}return r.a.createElement(i.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(o.a,{expandIcon:r.a.createElement(c.a,null)},r.a.createElement("h2",null,"Time skip")),r.a.createElement(s.a,null,r.a.createElement(u.a,{onClick:t(6e4)},"1 minute"),r.a.createElement(u.a,{onClick:t(36e5)},"1 hour"),r.a.createElement(u.a,{onClick:t(864e5)},"1 day")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(841),o=a(845),s=a(846),l=a(47);function c(e){const t=l.b.Player(),a=l.b.Router();return r.a.createElement("div",{className:"bladeburner-container"},r.a.createElement("div",{style:{height:"60%",display:"block",position:"relative"}},r.a.createElement("div",{style:{height:"100%",width:"30%",display:"inline-block",border:"1px solid white"}},r.a.createElement(i.a,{bladeburner:e.bladeburner,player:t,router:a})),r.a.createElement(o.a,{bladeburner:e.bladeburner,player:t})),r.a.createElement("div",{style:{width:"70%",display:"block",border:"1px solid white",marginTop:"6px",padding:"6px",position:"relative"}},r.a.createElement(s.a,{bladeburner:e.bladeburner,player:t})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a.n(n),i=a(14),o=a(46),s=a(15),l=a(196),c=a(3),u=a(11),m=a(22),h=a(24),p=a(97),d=a(844);function f(e){const t=Object(n.useState)(!1)[1];return Object(n.useEffect)(()=>{const e=setInterval(()=>t(e=>!e),1e3);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Rank: ",Object(i.c)(e.bladeburner.rank,2),r.a.createElement("span",{className:"tooltiptext"},"Your rank within the Bladeburner division.")),r.a.createElement("br",null),r.a.createElement("p",null,"Stamina: ",Object(i.c)(e.bladeburner.stamina,3)," / ",Object(i.c)(e.bladeburner.maxStamina,3)),r.a.createElement("div",{className:"help-tip",onClick:function(){Object(u.a)("Performing actions will use up your stamina.

Your max stamina is determined primarily by your agility stat.

Your stamina gain rate is determined by both your agility and your max stamina. Higher max stamina leads to a higher gain rate.

Once your stamina falls below 50% of its max value, it begins to negatively affect the success rate of your contracts/operations. This penalty is shown in the overview panel. If the penalty is 15%, then this means your success rate would be multipled by 85% (100 - 15).

Your max stamina and stamina gain rate can also be increased by training, or through skills and Augmentation upgrades.")}},"?"),r.a.createElement("br",null),r.a.createElement("p",null,"Stamina Penalty: ",Object(i.c)(100*(1-e.bladeburner.calculateStaminaPenalty()),1),"%"),r.a.createElement("br",null),r.a.createElement("p",null,"Team Size: ",Object(i.c)(e.bladeburner.teamSize,0)),r.a.createElement("p",null,"Team Members Lost: ",Object(i.c)(e.bladeburner.teamLost,0)),r.a.createElement("br",null),r.a.createElement("p",null,"Num Times Hospitalized: ",e.bladeburner.numHosp),r.a.createElement("p",null,"Money Lost From Hospitalizations: ",r.a.createElement(s.a,{money:e.bladeburner.moneyLost})),r.a.createElement("br",null),r.a.createElement("p",null,"Current City: ",e.bladeburner.city),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Est. Synthoid Population: ",c.a.formatPopulation(e.bladeburner.getCurrentCity().popEst),r.a.createElement("span",{className:"tooltiptext"},"This is your Bladeburner division's estimate of how many Synthoids exist in your current city.")),r.a.createElement("div",{className:"help-tip",onClick:function(){Object(u.a)("The success rate of your contracts/operations depends on the population of Synthoids in your current city. The success rate that is shown to you is only an estimate, and it is based on your Synthoid population estimate.

Therefore, it is important that this Synthoid population estimate is accurate so that you have a better idea of your success rate for contracts/operations. Certain actions will increase the accuracy of your population estimate.

The Synthoid populations of cities can change due to your actions or random events. If random events occur, they will be logged in the Bladeburner Console.")}},"?"),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Est. Synthoid Communities: ",Object(i.c)(e.bladeburner.getCurrentCity().comms,0),r.a.createElement("span",{className:"tooltiptext"},"This is your Bladeburner divison's estimate of how many Synthoid communities exist in your current city.")),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"City Chaos: ",Object(i.c)(e.bladeburner.getCurrentCity().chaos),r.a.createElement("span",{className:"tooltiptext"},"The city's chaos level due to tensions and conflicts between humans and Synthoids. Having too high of a chaos level can make contracts and operations harder.")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Bonus time:"," ",Object(i.b)(e.bladeburner.storedCycles/o.a.CyclesPerSecond*1e3),r.a.createElement("br",null),r.a.createElement("span",{className:"tooltiptext"},"You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by browser). Bonus time makes the Bladeburner mechanic progress faster, up to 5x the normal speed.")),r.a.createElement("p",null,"Skill Points: ",Object(i.c)(e.bladeburner.skillPoints,0)),r.a.createElement("br",null),r.a.createElement(l.a,{rows:[["Aug. Success Chance mult: ",Object(i.c)(100*e.player.bladeburner_success_chance_mult,1)+"%"],["Aug. Max Stamina mult: ",Object(i.c)(100*e.player.bladeburner_max_stamina_mult,1)+"%"],["Aug. Stamina Gain mult: ",Object(i.c)(100*e.player.bladeburner_stamina_gain_mult,1)+"%"],["Aug. Field Analysis mult: ",Object(i.c)(100*e.player.bladeburner_analysis_mult,1)+"%"]]}),r.a.createElement("br",null),r.a.createElement("a",{onClick:function(){const t="bladeburner-travel-popup";Object(m.a)(t,d.a,{bladeburner:e.bladeburner,popupId:t})},className:"a-link-button",style:{display:"inline-block"}},"Travel"),r.a.createElement("a",{onClick:function(){const t=h.a.Bladeburners;t.isMember?e.router.toFaction(t):e.bladeburner.rank>=o.a.RankNeededForFaction?(Object(p.d)(t),Object(u.a)("Congratulations! You were accepted into the Bladeburners faction")):Object(u.a)("You need a rank of 25 to join the Bladeburners Faction!")},className:"a-link-button tooltip",style:{display:"inline-block"}},r.a.createElement("span",{className:"tooltiptext"},"Apply to the Bladeburner Faction, or go to the faction page if you are already a member"),"Faction"),r.a.createElement("br",null),r.a.createElement("br",null))}},,,function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(22),o=a(385),s=a(23),l=a(18);function c(e){function t(t){e.bladeburner.city=t,Object(i.b)(e.popupId)}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Travel to a different city for your Bladeburner activities. This does not cost any money. The city you are in for your Bladeburner duties does not affect your location in the game otherwise."),l.a.DisableASCIIArt?Object.values(s.a).map(e=>r.a.createElement("button",{key:e,className:"std-button",onClick:()=>t(e)},e)):r.a.createElement(o.a,{currentCity:e.bladeburner.city,onTravel:e=>t(e)}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n);function i(e){return r.a.createElement("tr",null,r.a.createElement("td",{className:"bladeburner-console-line",style:{color:"var(--my-font-color)",whiteSpace:"pre-wrap"}},e.content))}function o(e){const t=Object(n.useRef)(null),a=Object(n.useState)(!1)[1],[o,s]=Object(n.useState)(e.bladeburner.consoleHistory.length);function l(){t.current&&(t.current.scrollTop=t.current.scrollHeight)}function c(){a(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(c,1e3),t=setInterval(l,100);return()=>{clearInterval(e),clearInterval(t)}},[]),r.a.createElement("div",{ref:t,className:"bladeburner-console-div"},r.a.createElement("table",{className:"bladeburner-console-table"},r.a.createElement("tbody",null,e.bladeburner.consoleLogs.map((e,t)=>r.a.createElement(i,{key:t,content:e})),r.a.createElement("tr",{key:"input",id:"bladeburner-console-input-row",className:"bladeburner-console-input-row"},r.a.createElement("td",{className:"bladeburner-console-input-cell"},r.a.createElement("pre",null,"> "),r.a.createElement("input",{autoFocus:!0,className:"bladeburner-console-input",tabIndex:1,type:"text",onKeyDown:function(t){if(13===t.keyCode){t.preventDefault();const a=t.currentTarget.value;t.currentTarget.value="",a.length>0&&(e.bladeburner.postToConsole("> "+a),e.bladeburner.executeConsoleCommands(e.player,a),s(e.bladeburner.consoleHistory.length),c())}const a=e.bladeburner.consoleHistory;if(38===t.keyCode){let e=o;const n=a.length;if(0===n)return;(e<0||e>n)&&s(n),0!==e&&(e-=1),s(e);const r=a[e];t.currentTarget.value=r}if(40===t.keyCode){const e=o,n=a.length;if(0==n)return;if((e<0||e>n)&&s(n),e==n||e==n-1)s(n),t.currentTarget.value="";else{s(o+1);const e=a[o+1];t.currentTarget.value=e}}}}))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(847),o=a(850),s=a(853),l=a(856),c=a(859),u=a(228);function m(e){const[t,a]=Object(n.useState)("General"),m=Object(n.useState)(!1)[1];function h(e){return r.a.createElement("a",{onClick:()=>a(e.name),className:t!==e.name?"bladeburner-nav-button noselect":"bladeburner-nav-button-inactive noselect"},e.name)}return Object(n.useEffect)(()=>{const e=setInterval(()=>m(e=>!e),1e3);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement(h,{name:"General"}),r.a.createElement(h,{name:"Contracts"}),r.a.createElement(h,{name:"Operations"}),r.a.createElement(h,{name:"BlackOps"}),r.a.createElement(h,{name:"Skills"}),r.a.createElement("div",{style:{display:"block",margin:"4px",padding:"4px"}},"General"===t&&r.a.createElement(i.a,{bladeburner:e.bladeburner,player:e.player}),"Contracts"===t&&r.a.createElement(o.a,{bladeburner:e.bladeburner,player:e.player}),"Operations"===t&&r.a.createElement(s.a,{bladeburner:e.bladeburner,player:e.player}),"BlackOps"===t&&r.a.createElement(l.a,{bladeburner:e.bladeburner,player:e.player}),"Skills"===t&&r.a.createElement(c.a,{bladeburner:e.bladeburner})),r.a.createElement("span",{className:"text"},u.b," = This action requires stealth, ",u.a," = This action involves retirement"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(848);function i(e){return n.createElement(n.Fragment,null,n.createElement("p",{style:{display:"block",margin:"4px",padding:"4px"}},"These are generic actions that will assist you in your Bladeburner duties. They will not affect your Bladeburner rank in any way."),n.createElement(r.a,{bladeburner:e.bladeburner,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(849),o=a(216);function s(e){const t=[];for(const e in o.a)o.a.hasOwnProperty(e)&&t.push(o.a[e]);return r.a.createElement(r.a.Fragment,null,t.map(t=>r.a.createElement("li",{key:t.name,className:"bladeburner-action"},r.a.createElement(i.a,{bladeburner:e.bladeburner,action:t,player:e.player}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(34),o=a(143),s=a(14),l=a(127);function c(e){const t=Object(n.useState)(!1)[1],a=e.action.name===e.bladeburner.action.name,c=Math.min(e.bladeburner.actionTimeCurrent+e.bladeburner.actionTimeOverflow,e.bladeburner.actionTimeToComplete),u=function(){switch(e.action.name){case"Training":case"Field Analysis":return 30;case"Diplomacy":case"Hyperbolic Regeneration Chamber":return 60;case"Recruitment":return e.bladeburner.getRecruitmentTime(e.player)}return-1}(),m="Recruitment"===e.action.name?Math.max(0,Math.min(e.bladeburner.getRecruitmentSuccessChance(e.player),1)):-1;return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",{style:{display:"inline-block"}},a?r.a.createElement(r.a.Fragment,null,r.a.createElement(l.b,{value:e.action.name})," (IN PROGRESS - ",Object(s.c)(c,0)," /"," ",Object(s.c)(e.bladeburner.actionTimeToComplete,0),")"):r.a.createElement(l.b,{value:e.action.name})),a?r.a.createElement("p",{style:{display:"block"}},Object(o.a)({progress:c/e.bladeburner.actionTimeToComplete})):r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{onClick:function(){e.bladeburner.action.type=i.a[e.action.name],e.bladeburner.action.name=e.action.name,e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},className:"a-link-button",style:{margin:"3px",padding:"3px"}},"Start")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{style:{display:"inline-block"},dangerouslySetInnerHTML:{__html:e.action.desc}}),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{style:{display:"inline-block"}},"Time Required: ",Object(s.b)(1e3*u),-1!==m&&r.a.createElement(r.a.Fragment,null,r.a.createElement("br",null),"Estimated success chance: ",Object(s.c)(100*m,1),"%")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(851);function i(e){return n.createElement(n.Fragment,null,n.createElement("p",{style:{display:"block",margin:"4px",padding:"4px"}},"Complete contracts in order to increase your Bladeburner rank and earn money. Failing a contract will cause you to lose HP, which can lead to hospitalization.",n.createElement("br",null),n.createElement("br",null),"You can unlock higher-level contracts by successfully completing them. Higher-level contracts are more difficult, but grant more rank, experience, and money."),n.createElement(r.a,{bladeburner:e.bladeburner,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(852);function o(e){const t=Object.keys(e.bladeburner.contracts),a=e.bladeburner.contracts;return r.a.createElement(r.a.Fragment,null,t.map(t=>r.a.createElement("li",{key:t,className:"bladeburner-action"},r.a.createElement(i.a,{bladeburner:e.bladeburner,action:a[t],player:e.player}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(34),o=a(143),s=a(14),l=a(228),c=a(46),u=a(386),m=a(127);function h(e){const t=Object(n.useState)(!1)[1],a=e.bladeburner.action.type===i.a.Contract&&e.action.name===e.bladeburner.action.name,h=e.action.getEstSuccessChance(e.bladeburner),p=Math.min(e.bladeburner.actionTimeCurrent+e.bladeburner.actionTimeOverflow,e.bladeburner.actionTimeToComplete),d=e.action.level>=e.action.maxLevel,f=e.action.getActionTime(e.bladeburner),g=`bladeburner-${e.action.name}-autolevel-checkbox`;return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",{style:{display:"inline-block"}},a?r.a.createElement(r.a.Fragment,null,r.a.createElement(m.b,{value:e.action.name})," (IN PROGRESS - ",Object(s.c)(p,0)," /"," ",Object(s.c)(e.bladeburner.actionTimeToComplete,0),")"):r.a.createElement(m.b,{value:e.action.name})),a?r.a.createElement("p",{style:{display:"block"}},Object(o.a)({progress:p/e.bladeburner.actionTimeToComplete})):r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{onClick:function(){e.bladeburner.action.type=i.a.Contract,e.bladeburner.action.name=e.action.name,e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},className:"a-link-button",style:{margin:"3px",padding:"3px"}},"Start")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{className:"tooltip",style:{display:"inline-block"}},r.a.createElement("span",{className:"tooltiptext"},e.action.getSuccessesNeededForNextLevel(c.a.ContractSuccessesPerLevel)," successes needed for next level"),"Level: ",e.action.level," / ",e.action.maxLevel),r.a.createElement("a",{onClick:function(){++e.action.level,a&&e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},style:{padding:"2px",margin:"2px"},className:"tooltip "+(d?"a-link-button-inactive":"a-link-button")},a&&r.a.createElement("span",{className:"tooltiptext"},"WARNING: changing the level will restart the Operation"),"↑"),r.a.createElement("a",{onClick:function(){--e.action.level,a&&e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},style:{padding:"2px",margin:"2px"},className:"tooltip "+(e.action.level<=1?"a-link-button-inactive":"a-link-button")},a&&r.a.createElement("span",{className:"tooltiptext"},"WARNING: changing the level will restart the Operation"),"↓"),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{style:{display:"inline-block"}},r.a.createElement("span",{dangerouslySetInnerHTML:{__html:e.action.desc}}),r.a.createElement("br",null),r.a.createElement("br",null),"Estimated success chance: ",r.a.createElement(u.a,{chance:h})," ",e.action.isStealth?l.b:r.a.createElement(r.a.Fragment,null),e.action.isKill?l.a:r.a.createElement(r.a.Fragment,null),r.a.createElement("br",null),"Time Required: ",Object(s.b)(1e3*f),r.a.createElement("br",null),"Contracts remaining: ",Math.floor(e.action.count),r.a.createElement("br",null),"Successes: ",e.action.successes,r.a.createElement("br",null),"Failures: ",e.action.failures),r.a.createElement("br",null),r.a.createElement("label",{className:"tooltip",style:{color:"white"},htmlFor:g},"Autolevel:",r.a.createElement("span",{className:"tooltiptext"},"Automatically increase operation level when possible")),r.a.createElement("input",{type:"checkbox",id:g,checked:e.action.autoLevel,onChange:function(a){e.action.autoLevel=a.target.checked,t(e=>!e)}}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(854);function i(e){return n.createElement(n.Fragment,null,n.createElement("p",{style:{display:"block",margin:"4px",padding:"4px"}},"Carry out operations for the Bladeburner division. Failing an operation will reduce your Bladeburner rank. It will also cause you to lose HP, which can lead to hospitalization. In general, operations are harder and more punishing than contracts, but are also more rewarding.",n.createElement("br",null),n.createElement("br",null),"Operations can affect the chaos level and Synthoid population of your current city. The exact effects vary between different Operations.",n.createElement("br",null),n.createElement("br",null),"For operations, you can use a team. You must first recruit team members. Having a larger team will improves your chances of success.",n.createElement("br",null),n.createElement("br",null),"You can unlock higher-level operations by successfully completing them. Higher-level operations are more difficult, but grant more rank and experience."),n.createElement(r.a,{bladeburner:e.bladeburner,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(855);function o(e){const t=Object.keys(e.bladeburner.operations),a=e.bladeburner.operations;return r.a.createElement(r.a.Fragment,null,t.map(t=>r.a.createElement("li",{key:t,className:"bladeburner-action"},r.a.createElement(i.a,{bladeburner:e.bladeburner,action:a[t],player:e.player}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(34),o=a(143),s=a(14),l=a(228),c=a(46),u=a(22),m=a(500),h=a(386),p=a(127);function d(e){const t=Object(n.useState)(!1)[1],a=e.bladeburner.action.type===i.a.Operation&&e.action.name===e.bladeburner.action.name,d=e.action.getEstSuccessChance(e.bladeburner),f=Math.min(e.bladeburner.actionTimeCurrent+e.bladeburner.actionTimeOverflow,e.bladeburner.actionTimeToComplete),g=e.action.level>=e.action.maxLevel,y=e.action.getActionTime(e.bladeburner),b=`bladeburner-${e.action.name}-autolevel-checkbox`;return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",{style:{display:"inline-block"}},a?r.a.createElement(r.a.Fragment,null,r.a.createElement(p.b,{value:e.action.name})," (IN PROGRESS - ",Object(s.c)(f,0)," /"," ",Object(s.c)(e.bladeburner.actionTimeToComplete,0),")"):r.a.createElement(p.b,{value:e.action.name})),a?r.a.createElement("p",{style:{display:"block"}},Object(o.a)({progress:f/e.bladeburner.actionTimeToComplete})):r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{onClick:function(){e.bladeburner.action.type=i.a.Operation,e.bladeburner.action.name=e.action.name,e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},className:"a-link-button",style:{margin:"3px",padding:"3px"}},"Start"),r.a.createElement("a",{onClick:function(){const t="bladeburner-operation-set-team-size-popup";Object(u.a)(t,m.a,{bladeburner:e.bladeburner,action:e.action,popupId:t})},style:{margin:"3px",padding:"3px"},className:"a-link-button"},"Set Team Size (Curr Size: ",Object(s.c)(e.action.teamCount,0),")")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{className:"tooltip",style:{display:"inline-block"}},r.a.createElement("span",{className:"tooltiptext"},e.action.getSuccessesNeededForNextLevel(c.a.OperationSuccessesPerLevel)," successes needed for next level"),"Level: ",e.action.level," / ",e.action.maxLevel),r.a.createElement("a",{onClick:function(){++e.action.level,a&&e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},style:{padding:"2px",margin:"2px"},className:"tooltip "+(g?"a-link-button-inactive":"a-link-button")},a&&r.a.createElement("span",{className:"tooltiptext"},"WARNING: changing the level will restart the Operation"),"↑"),r.a.createElement("a",{onClick:function(){--e.action.level,a&&e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)},style:{padding:"2px",margin:"2px"},className:"tooltip "+(e.action.level<=1?"a-link-button-inactive":"a-link-button")},a&&r.a.createElement("span",{className:"tooltiptext"},"WARNING: changing the level will restart the Operation"),"↓"),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("pre",{style:{display:"inline-block"}},r.a.createElement("span",{dangerouslySetInnerHTML:{__html:e.action.desc}}),r.a.createElement("br",null),r.a.createElement("br",null),"Estimated success chance: ",r.a.createElement(h.a,{chance:d})," ",e.action.isStealth?l.b:r.a.createElement(r.a.Fragment,null),e.action.isKill?l.a:r.a.createElement(r.a.Fragment,null),r.a.createElement("br",null),"Time Required: ",Object(s.b)(1e3*y),r.a.createElement("br",null),"Operations remaining: ",Math.floor(e.action.count),r.a.createElement("br",null),"Successes: ",e.action.successes,r.a.createElement("br",null),"Failures: ",e.action.failures),r.a.createElement("br",null),r.a.createElement("label",{className:"tooltip",style:{color:"white"},htmlFor:b},"Autolevel:",r.a.createElement("span",{className:"tooltiptext"},"Automatically increase operation level when possible")),r.a.createElement("input",{type:"checkbox",id:b,checked:e.action.autoLevel,onChange:function(a){e.action.autoLevel=a.target.checked,t(e=>!e)}}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(857);function i(e){return n.createElement(n.Fragment,null,n.createElement("p",{style:{display:"block",margin:"4px",padding:"4px"}},"Black Operations (Black Ops) are special, one-time covert operations. Each Black Op must be unlocked successively by completing the one before it.",n.createElement("br",null),n.createElement("br",null),n.createElement("b",null,"Your ultimate goal to climb through the ranks of Bladeburners is to complete all of the Black Ops."),n.createElement("br",null),n.createElement("br",null),"Like normal operations, you may use a team for Black Ops. Failing a black op will incur heavy HP and rank losses."),n.createElement(r.a,{bladeburner:e.bladeburner,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(215),o=a(858);function s(e){let t=[];for(const e in i.a)i.a.hasOwnProperty(e)&&t.push(i.a[e]);return t.sort((function(e,t){return e.reqdRank-t.reqdRank})),t=t.filter((a,n)=>!(null==e.bladeburner.blackops[t[n].name]&&0!==n&&null==e.bladeburner.blackops[t[n-1].name])),t=t.reverse(),r.a.createElement(r.a.Fragment,null,t.map(t=>r.a.createElement("li",{key:t.name,className:"bladeburner-action"},r.a.createElement(o.a,{bladeburner:e.bladeburner,action:t,player:e.player}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(14),o=a(34),s=a(143),l=a(228),c=a(22),u=a(500),m=a(386),h=a(127);function p(e){const t=Object(n.useState)(!1)[1];if(null!=e.bladeburner.blackops[e.action.name])return r.a.createElement("h2",{style:{display:"block"}},e.action.name," (COMPLETED)");const a=e.bladeburner.action.type===o.a.BlackOperation&&e.action.name===e.bladeburner.action.name,p=e.action.getEstSuccessChance(e.bladeburner),d=e.action.getActionTime(e.bladeburner),f=e.bladeburner.rank>=e.action.reqdRank,g=Math.min(e.bladeburner.actionTimeCurrent+e.bladeburner.actionTimeOverflow,e.bladeburner.actionTimeToComplete);return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",{style:{display:"inline-block"}},a?r.a.createElement(r.a.Fragment,null,r.a.createElement(h.b,{value:e.action.name})," (IN PROGRESS - ",Object(i.c)(g,0)," /"," ",Object(i.c)(e.bladeburner.actionTimeToComplete,0),")"):r.a.createElement(h.b,{value:e.action.name})),a?r.a.createElement("p",{style:{display:"block"}},Object(s.a)({progress:g/e.bladeburner.actionTimeToComplete})):r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{className:f?"a-link-button":"a-link-button-inactive",style:{margin:"3px",padding:"3px"},onClick:function(){e.bladeburner.action.type=o.a.BlackOperation,e.bladeburner.action.name=e.action.name,e.bladeburner.startAction(e.player,e.bladeburner.action),t(e=>!e)}},"Start"),r.a.createElement("a",{onClick:function(){const t="bladeburner-operation-set-team-size-popup";Object(c.a)(t,u.a,{bladeburner:e.bladeburner,action:e.action,popupId:t})},style:{margin:"3px",padding:"3px"},className:"a-link-button"},"Set Team Size (Curr Size: ",Object(i.c)(e.action.teamCount,0),")")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"inline-block"},dangerouslySetInnerHTML:{__html:e.action.desc}}),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"block",color:f?"white":"red"}},"Required Rank: ",Object(i.c)(e.action.reqdRank,0)),r.a.createElement("br",null),r.a.createElement("pre",{style:{display:"inline-block"}},"Estimated Success Chance: ",r.a.createElement(m.a,{chance:p})," ",e.action.isStealth?l.b:r.a.createElement(r.a.Fragment,null),e.action.isKill?l.a:r.a.createElement(r.a.Fragment,null),r.a.createElement("br",null),"Time Required: ",Object(i.b)(1e3*d)))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(860),o=a(46),s=a(14);function l(e){const t=Object(n.useState)(!1)[1],a=e.bladeburner.skillMultipliers;function l(e){return e&&1!==e}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("strong",null,"Skill Points: ",Object(s.c)(e.bladeburner.skillPoints,0))),r.a.createElement("p",null,"You will gain one skill point every ",o.a.RanksPerSkillPoint," ranks.",r.a.createElement("br",null),r.a.createElement("br",null),"Note that when upgrading a skill, the benefit for that skill is additive. However, the effects of different skills with each other is multiplicative.",r.a.createElement("br",null)),r.a.createElement("br",null),l(a.successChanceAll)&&r.a.createElement("p",null,"Total Success Chance: x",Object(s.c)(a.successChanceAll,3)),l(a.successChanceStealth)&&r.a.createElement("p",null,"Stealth Success Chance: x",Object(s.c)(a.successChanceStealth,3)),l(a.successChanceKill)&&r.a.createElement("p",null,"Retirement Success Chance: x",Object(s.c)(a.successChanceKill,3)),l(a.successChanceContract)&&r.a.createElement("p",null,"Contract Success Chance: x",Object(s.c)(a.successChanceContract,3)),l(a.successChanceOperation)&&r.a.createElement("p",null,"Operation Success Chance: x",Object(s.c)(a.successChanceOperation,3)),l(a.successChanceEstimate)&&r.a.createElement("p",null,"Synthoid Data Estimate: x",Object(s.c)(a.successChanceEstimate,3)),l(a.actionTime)&&r.a.createElement("p",null,"Action Time: x",Object(s.c)(a.actionTime,3)),l(a.effHack)&&r.a.createElement("p",null,"Hacking Skill: x",Object(s.c)(a.effHack,3)),l(a.effStr)&&r.a.createElement("p",null,"Strength: x",Object(s.c)(a.effStr,3)),l(a.effDef)&&r.a.createElement("p",null,"Defense: x",Object(s.c)(a.effDef,3)),l(a.effDex)&&r.a.createElement("p",null,"Dexterity: x",Object(s.c)(a.effDex,3)),l(a.effAgi)&&r.a.createElement("p",null,"Agility: x",Object(s.c)(a.effAgi,3)),l(a.effCha)&&r.a.createElement("p",null,"Charisma: x",Object(s.c)(a.effCha,3)),l(a.effInt)&&r.a.createElement("p",null,"Intelligence: x",Object(s.c)(a.effInt,3)),l(a.stamina)&&r.a.createElement("p",null,"Stamina: x",Object(s.c)(a.stamina,3)),l(a.money)&&r.a.createElement("p",null,"Contract Money: x",Object(s.c)(a.money,3)),l(a.expGain)&&r.a.createElement("p",null,"Exp Gain: x",Object(s.c)(a.expGain,3)),r.a.createElement("br",null),r.a.createElement(i.a,{bladeburner:e.bladeburner,onUpgrade:()=>t(e=>!e)}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a(861),i=a(200);function o(e){return n.createElement(n.Fragment,null,Object.keys(i.a).map(t=>n.createElement("li",{key:t,className:"bladeburner-action"},n.createElement(r.a,{bladeburner:e.bladeburner,skill:i.a[t],onUpgrade:e.onUpgrade}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(127),o=a(14);function s(e){const t=e.skill.name;let a=0;e.bladeburner.skills[t]&&!isNaN(e.bladeburner.skills[t])&&(a=e.bladeburner.skills[t]);const n=e.skill.calculateCost(a),s=e.bladeburner.skillPoints>=n,l=!!e.skill.maxLvl&&a>=e.skill.maxLvl;return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",{style:{display:"inline-block"}},r.a.createElement(i.b,{value:e.skill.name})),r.a.createElement("a",{onClick:function(){e.bladeburner.skillPoints{const e=setInterval(()=>m(e=>!e),1e3);return()=>clearInterval(e)},[]),r.a.createElement("div",{className:"gang-container"},r.a.createElement("a",{className:"a-link-button",style:{display:"inline-block"},onClick:function(){a.toFaction(l.a[e.gang.facName])}},"Back"),r.a.createElement("a",{className:c?"a-link-button-inactive":"a-link-button",style:{display:"inline-block"},onClick:()=>u(!0)},"Gang Management"),r.a.createElement("a",{className:c?"a-link-button":"a-link-button-inactive",style:{display:"inline-block"},onClick:()=>u(!1)},"Gang Territory"),c?r.a.createElement(i.a,{gang:e.gang,player:t}):r.a.createElement(o.a,{gang:e.gang}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(864),o=a(866);function s(e){return r.a.createElement("div",{style:{display:"block"}},r.a.createElement("p",{className:"noselect",style:{width:"70%"}},"This page is used to manage your gang members and get an overview of your gang's stats.",r.a.createElement("br",null),r.a.createElement("br",null),"If a gang member is not earning much money or respect, the task that you have assigned to that member might be too difficult. Consider training that member's stats or choosing an easier task. The tasks closer to the top of the dropdown list are generally easier. Alternatively, the gang member's low production might be due to the fact that your wanted level is too high. Consider assigning a few members to the '",e.gang.isHackingGang?"Ethical Hacking":"Vigilante Justice","' task to lower your wanted level.",r.a.createElement("br",null),r.a.createElement("br",null),"Installing Augmentations does NOT reset your progress with your Gang. Furthermore, after installing Augmentations, you will automatically be a member of whatever Faction you created your gang with.",r.a.createElement("br",null),r.a.createElement("br",null),"You can also manage your gang programmatically through Netscript using the Gang API"),r.a.createElement("br",null),r.a.createElement(i.a,{gang:e.gang}),r.a.createElement("br",null),r.a.createElement(o.a,{gang:e.gang,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(24),o=a(14),s=a(3),l=a(138),c=a(81),u=a(67),m=a(865);function h(e){const t=100*u.a[e.gang.facName].territory;let a;return a=t<=0?Object(o.c)(0,2):t>=100?Object(o.c)(100,2):Object(o.c)(t,2),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Respect: ",s.a.formatRespect(e.gang.respect)," (",s.a.formatRespect(5*e.gang.respectGainRate)," / sec)",r.a.createElement("span",{className:"tooltiptext"},"Represents the amount of respect your gang has from other gangs and criminal organizations. Your respect affects the amount of money your gang members will earn, and also determines how much reputation you are earning with your gang's corresponding Faction.")),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Wanted Level: ",s.a.formatWanted(e.gang.wanted)," (",s.a.formatWanted(5*e.gang.wantedGainRate)," / sec)",r.a.createElement("span",{className:"tooltiptext"},"Represents how much the gang is wanted by law enforcement. The higher your gang's wanted level, the harder it will be for your gang members to make money and earn respect. Note that the minimum wanted level is 1.")),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Wanted Level Penalty: -",Object(o.c)(100*(1-e.gang.getWantedPenalty()),2),"%",r.a.createElement("span",{className:"tooltiptext"},"Penalty for respect and money gain rates due to Wanted Level")),r.a.createElement("br",null),r.a.createElement("div",null,r.a.createElement("p",{style:{display:"inline-block"}},"Money gain rate: ",r.a.createElement(l.a,{money:5*e.gang.moneyGainRate}))),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Territory: ",a,"%",r.a.createElement("span",{className:"tooltiptext"},"The percentage of total territory your Gang controls")),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"inline-block"}},"Faction reputation: ",Object(c.a)(i.a[e.gang.facName].playerReputation)),r.a.createElement("br",null),r.a.createElement(m.a,{gang:e.gang}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a(4),i=a(14);function o(e){const t=1e3/r.a._idleSpeed;if(e.gang.storedCycles/t*1e3<=5e3)return n.createElement(n.Fragment,null);const a=e.gang.storedCycles/t*1e3;return n.createElement(n.Fragment,null,n.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Bonus time: ",Object(i.b)(a),n.createElement("span",{className:"tooltiptext noselect"},"You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by the browser). Bonus time makes the Gang mechanic progress faster, up to 5x the normal speed.")),n.createElement("br",null))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(867),o=a(869),s=a(22),l=a(876);function c(e){const[t,a]=Object(n.useState)(""),c=Object(n.useState)(!1)[1];const u=e.gang.members.filter(e=>e.name.indexOf(t)>-1||e.task.indexOf(t)>-1);return r.a.createElement(r.a.Fragment,null,r.a.createElement(l.a,{onRecruit:()=>c(e=>!e),gang:e.gang}),r.a.createElement("br",null),r.a.createElement("input",{className:"text-input noselect",placeholder:"Filter gang member",style:{margin:"5px",padding:"5px"},value:t,onChange:function(e){a(e.target.value)}}),r.a.createElement("a",{className:"a-link-button",style:{display:"inline-block"},onClick:function(){Object(s.a)("gang-upgrade-popup",i.a,{gang:e.gang,player:e.player,popupId:"gang-upgrade-popup"})}},"Manage Equipment"),r.a.createElement("ul",null,u.map(t=>r.a.createElement("li",{key:t.name},r.a.createElement(o.a,{gang:e.gang,member:t})))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(14),o=a(3),s=a(167),l=a(15),c=a(22),u=a(136);function m(e){const t=Object.keys(s.a).filter(t=>{const a=s.a[t];return!e.player.money.gt(e.gang.getUpgradeCost(a))&&(a.type===e.type&&!e.upgrades.includes(t))}).map(e=>s.a[e]);return 0===t.length?r.a.createElement(r.a.Fragment,null):r.a.createElement("p",null,"Next at ",r.a.createElement(l.a,{money:t[0].cost}))}function h(e){const t=Object(n.useState)(!1)[1];function a(t,a){return Object.keys(s.a).filter(n=>{const r=s.a[n];return!e.player.money.lt(e.gang.getUpgradeCost(r))&&(r.type===a&&!t.includes(n))}).map(e=>s.a[e])}const o=a(e.member.upgrades,u.a.Weapon),c=a(e.member.upgrades,u.a.Armor),h=a(e.member.upgrades,u.a.Vehicle),p=a(e.member.upgrades,u.a.Rootkit),d=a(e.member.augmentations,u.a.Augmentation);function f(e){const t=s.a[e];return r.a.createElement("div",{key:e,className:"gang-owned-upgrade tooltip"},t.name,r.a.createElement("span",{className:"tooltiptext",dangerouslySetInnerHTML:{__html:t.desc}}))}function g(a,n=!1){return r.a.createElement("a",{key:a.name,className:"a-link-button tooltip",style:{margin:"2px",padding:"2px",display:"block",fontSize:"11px"},onClick:function(){e.member.buyUpgrade(a,e.player,e.gang),t(e=>!e)}},a.name," - ",r.a.createElement(l.a,{money:e.gang.getUpgradeCost(a),player:e.player}),r.a.createElement("span",{className:n?"tooltiptextleft":"tooltiptext",dangerouslySetInnerHTML:{__html:a.desc}}))}const y=e.member.calculateAscensionMult(e.member.hack_asc_points),b=e.member.calculateAscensionMult(e.member.str_asc_points),E=e.member.calculateAscensionMult(e.member.def_asc_points),v=e.member.calculateAscensionMult(e.member.dex_asc_points),k=e.member.calculateAscensionMult(e.member.agi_asc_points),_=e.member.calculateAscensionMult(e.member.cha_asc_points);return r.a.createElement("div",{style:{border:"1px solid white"}},r.a.createElement("h1",null,e.member.name,"(",e.member.task,")"),r.a.createElement("pre",{style:{fontSize:"14px",display:"inline-block",width:"20%"}},"Hack: ",e.member.hack," (x",Object(i.c)(e.member.hack_mult*y,2),")",r.a.createElement("br",null),"Str: ",e.member.str," (x",Object(i.c)(e.member.str_mult*b,2),")",r.a.createElement("br",null),"Def: ",e.member.def," (x",Object(i.c)(e.member.def_mult*E,2),")",r.a.createElement("br",null),"Dex: ",e.member.dex," (x",Object(i.c)(e.member.dex_mult*v,2),")",r.a.createElement("br",null),"Agi: ",e.member.agi," (x",Object(i.c)(e.member.agi_mult*k,2),")",r.a.createElement("br",null),"Cha: ",e.member.cha," (x",Object(i.c)(e.member.cha_mult*_,2),")"),r.a.createElement("div",{className:"gang-owned-upgrades-div noselect"},"Purchased Upgrades: ",e.member.upgrades.map(e=>f(e)),e.member.augmentations.map(e=>f(e))),r.a.createElement("div",{className:"noselect",style:{width:"20%",display:"inline-block"}},r.a.createElement("h2",null,"Weapons"),o.map(e=>g(e)),r.a.createElement(m,{gang:e.gang,type:u.a.Weapon,player:e.player,upgrades:e.member.upgrades})),r.a.createElement("div",{className:"noselect",style:{width:"20%",display:"inline-block"}},r.a.createElement("h2",null,"Armor"),c.map(e=>g(e)),r.a.createElement(m,{gang:e.gang,type:u.a.Armor,player:e.player,upgrades:e.member.upgrades})),r.a.createElement("div",{className:"noselect",style:{width:"20%",display:"inline-block"}},r.a.createElement("h2",null,"Vehicles"),h.map(e=>g(e)),r.a.createElement(m,{gang:e.gang,type:u.a.Vehicle,player:e.player,upgrades:e.member.upgrades})),r.a.createElement("div",{className:"noselect",style:{width:"20%",display:"inline-block"}},r.a.createElement("h2",null,"Rootkits"),p.map(e=>g(e,!0)),r.a.createElement(m,{gang:e.gang,type:u.a.Rootkit,player:e.player,upgrades:e.member.upgrades})),r.a.createElement("div",{className:"noselect",style:{width:"20%",display:"inline-block"}},r.a.createElement("h2",null,"Augmentations"),d.map(e=>g(e,!0)),r.a.createElement(m,{gang:e.gang,type:u.a.Augmentation,player:e.player,upgrades:e.member.upgrades})))}function p(e){const t=Object(n.useState)(!1)[1],[a,i]=Object(n.useState)("");function s(t){27===t.keyCode&&Object(c.b)(e.popupId)}return Object(n.useEffect)(()=>{window.addEventListener("keydown",s);const e=setInterval(()=>t(e=>!e),1e3);return()=>{clearInterval(e),window.removeEventListener("keydown",s)}},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement("input",{className:"text-input noselect",value:a,placeholder:"Filter gang member",onChange:e=>i(e.target.value)}),r.a.createElement("p",{className:"tooltip",style:{marginLeft:"6px",display:"inline-block"}},"Discount: -",o.a.formatPercentage(1-1/e.gang.getDiscount()),r.a.createElement("span",{className:"tooltiptext noselect"},"You get a discount on equipment and upgrades based on your gang's respect and power. More respect and power leads to more discounts.")),e.gang.members.map(t=>r.a.createElement(h,{key:t.name,player:e.player,gang:e.gang,member:t})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(136),r=a(3);class i{constructor(e="",t=0,a=n.a.Weapon,r={}){this.name=e,this.cost=t,this.type=a,this.mults=r,this.desc=this.createDescription()}createDescription(){const e=["Effects:"];return null!=this.mults.str&&(e.push(`+${r.a.formatPercentage(this.mults.str-1,0)} strength skill`),e.push(`+${r.a.formatPercentage((this.mults.str-1)/4,2)} strength exp`)),null!=this.mults.def&&(e.push(`+${r.a.formatPercentage(this.mults.def-1,0)} defense skill`),e.push(`+${r.a.formatPercentage((this.mults.def-1)/4,2)} defense exp`)),null!=this.mults.dex&&(e.push(`+${r.a.formatPercentage(this.mults.dex-1,0)} dexterity skill`),e.push(`+${r.a.formatPercentage((this.mults.dex-1)/4,2)} dexterity exp`)),null!=this.mults.agi&&(e.push(`+${r.a.formatPercentage(this.mults.agi-1,0)} agility skill`),e.push(`+${r.a.formatPercentage((this.mults.agi-1)/4,2)} agility exp`)),null!=this.mults.cha&&(e.push(`+${r.a.formatPercentage(this.mults.cha-1,0)} charisma skill`),e.push(`+${r.a.formatPercentage((this.mults.cha-1)/4,2)} charisma exp`)),null!=this.mults.hack&&(e.push(`+${r.a.formatPercentage(this.mults.hack-1,0)} hacking skill`),e.push(`+${r.a.formatPercentage((this.mults.hack-1)/4,2)} hacking exp`)),e.join("
")}getType(){switch(this.type){case n.a.Weapon:return"Weapon";case n.a.Armor:return"Armor";case n.a.Vehicle:return"Vehicle";case n.a.Rootkit:return"Rootkit";case n.a.Augmentation:return"Augmentation";default:return""}}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(234),o=a(870);function s(e){return r.a.createElement(i.a,{panelInitiallyOpened:!0,headerContent:r.a.createElement(r.a.Fragment,null,e.member.name),panelContent:r.a.createElement(o.a,{gang:e.gang,member:e.member})})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(871),o=a(873),s=a(874);function l(e){const t=Object(n.useState)(!1)[1];return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"gang-member-info-div tooltip"},r.a.createElement(i.a,{onAscend:()=>t(e=>!e),gang:e.gang,member:e.member})),r.a.createElement("div",{className:"gang-member-info-div"},r.a.createElement(o.a,{onTaskChange:()=>t(e=>!e),gang:e.gang,member:e.member})),r.a.createElement("div",{className:"gang-member-info-div"},r.a.createElement(s.a,{member:e.member})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(11),o=a(14),s=a(3),l=a(22),c=a(872);function u(e){const t={hack:e.member.calculateAscensionMult(e.member.hack_asc_points),str:e.member.calculateAscensionMult(e.member.str_asc_points),def:e.member.calculateAscensionMult(e.member.def_asc_points),dex:e.member.calculateAscensionMult(e.member.dex_asc_points),agi:e.member.calculateAscensionMult(e.member.agi_asc_points),cha:e.member.calculateAscensionMult(e.member.cha_asc_points)};return r.a.createElement(r.a.Fragment,null,r.a.createElement("span",{className:"tooltiptext smallfont"},"Hk: x",s.a.formatMultiplier(e.member.hack_mult*t.hack),"(x",s.a.formatMultiplier(e.member.hack_mult)," Eq, x",s.a.formatMultiplier(t.hack)," Asc)",r.a.createElement("br",null),"St: x",s.a.formatMultiplier(e.member.str_mult*t.str),"(x",s.a.formatMultiplier(e.member.str_mult)," Eq, x",s.a.formatMultiplier(t.str)," Asc)",r.a.createElement("br",null),"Df: x",s.a.formatMultiplier(e.member.def_mult*t.def),"(x",s.a.formatMultiplier(e.member.def_mult)," Eq, x",s.a.formatMultiplier(t.def)," Asc)",r.a.createElement("br",null),"Dx: x",s.a.formatMultiplier(e.member.dex_mult*t.dex),"(x",s.a.formatMultiplier(e.member.dex_mult)," Eq, x",s.a.formatMultiplier(t.dex)," Asc)",r.a.createElement("br",null),"Ag: x",s.a.formatMultiplier(e.member.agi_mult*t.agi),"(x",s.a.formatMultiplier(e.member.agi_mult)," Eq, x",s.a.formatMultiplier(t.agi)," Asc)",r.a.createElement("br",null),"Ch: x",s.a.formatMultiplier(e.member.cha_mult*t.cha),"(x",s.a.formatMultiplier(e.member.cha_mult)," Eq, x",s.a.formatMultiplier(t.cha)," Asc)"),r.a.createElement("pre",null,"Hacking: ",Object(o.c)(e.member.hack,0)," (",s.a.formatExp(e.member.hack_exp)," exp)",r.a.createElement("br",null),"Strength: ",Object(o.c)(e.member.str,0)," (",s.a.formatExp(e.member.str_exp)," exp)",r.a.createElement("br",null),"Defense: ",Object(o.c)(e.member.def,0)," (",s.a.formatExp(e.member.def_exp)," exp)",r.a.createElement("br",null),"Dexterity: ",Object(o.c)(e.member.dex,0)," (",s.a.formatExp(e.member.dex_exp)," exp)",r.a.createElement("br",null),"Agility: ",Object(o.c)(e.member.agi,0)," (",s.a.formatExp(e.member.agi_exp)," exp)",r.a.createElement("br",null),"Charisma: ",Object(o.c)(e.member.cha,0)," (",s.a.formatExp(e.member.cha_exp)," exp)",r.a.createElement("br",null)),r.a.createElement("br",null),e.member.canAscend()&&r.a.createElement(r.a.Fragment,null,r.a.createElement("button",{className:"accordion-button noselect",onClick:function(){const t="gang-management-ascend-member "+e.member.name;Object(l.a)(t,c.a,{member:e.member,gang:e.gang,popupId:t,onAscend:e.onAscend})}},"Ascend"),r.a.createElement("div",{className:"help-tip noselect",style:{marginTop:"5px"},onClick:function(){Object(i.a)(r.a.createElement(r.a.Fragment,null,"Ascending a Gang Member resets the member's progress and stats in exchange for a permanent boost to their stat multipliers.",r.a.createElement("br",null),r.a.createElement("br",null),"The additional stat multiplier that the Gang Member gains upon ascension is based on the amount of exp they have.",r.a.createElement("br",null),r.a.createElement("br",null),"Upon ascension, the member will lose all of its non-Augmentation Equipment and your gang will lose respect equal to the total respect earned by the member."))}},"?")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(3),o=a(22),s=a(11);function l(e){const t=Object(n.useState)(!1)[1];Object(n.useEffect)(()=>{const e=setInterval(()=>t(e=>!e),1e3);return()=>clearInterval(e)},[]);const a=e.member.getCurrentAscensionMults(),l=e.member.getAscensionMultsAfterAscend();return r.a.createElement(r.a.Fragment,null,r.a.createElement("pre",null,"Are you sure you want to ascend this member? They will lose all of",r.a.createElement("br",null),"their non-Augmentation upgrades and their stats will reset back to 1.",r.a.createElement("br",null),r.a.createElement("br",null),"Furthermore, your gang will lose ",i.a.formatRespect(e.member.earnedRespect)," respect",r.a.createElement("br",null),r.a.createElement("br",null),"In return, they will gain the following permanent boost to stat multipliers:",r.a.createElement("br",null),"Hacking: x",i.a.format(a.hack,"0.000")," => x",i.a.format(l.hack,"0.000"),r.a.createElement("br",null),"Strength: x",i.a.format(a.str,"0.000")," => x",i.a.format(l.str,"0.000"),r.a.createElement("br",null),"Defense: x",i.a.format(a.def,"0.000")," => x",i.a.format(l.def,"0.000"),r.a.createElement("br",null),"Dexterity: x",i.a.format(a.dex,"0.000")," => x",i.a.format(l.dex,"0.000"),r.a.createElement("br",null),"Agility: x",i.a.format(a.agi,"0.000")," => x",i.a.format(l.agi,"0.000"),r.a.createElement("br",null),"Charisma: x",i.a.format(a.cha,"0.000")," => x",i.a.format(l.cha,"0.000"),r.a.createElement("br",null)),r.a.createElement("button",{className:"std-button",onClick:function(){e.onAscend();const t=e.gang.ascendMember(e.member);Object(s.a)(r.a.createElement("p",null,"You ascended ",e.member.name,"!",r.a.createElement("br",null),r.a.createElement("br",null),"Your gang lost ",i.a.formatRespect(t.respect)," respect.",r.a.createElement("br",null),r.a.createElement("br",null),e.member.name," gained the following stat multipliers for ascending:",r.a.createElement("br",null),"Hacking: x",i.a.format(t.hack,"0.000"),r.a.createElement("br",null),"Strength: x",i.a.format(t.str,"0.000"),r.a.createElement("br",null),"Defense: x",i.a.format(t.def,"0.000"),r.a.createElement("br",null),"Dexterity: x",i.a.format(t.dex,"0.000"),r.a.createElement("br",null),"Agility: x",i.a.format(t.agi,"0.000"),r.a.createElement("br",null),"Charisma: x",i.a.format(t.cha,"0.000"),r.a.createElement("br",null))),Object(o.b)(e.popupId)}},"Ascend"),r.a.createElement("button",{className:"std-button",onClick:function(){Object(o.b)(e.popupId)}},"Cancel"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(3),o=a(196),s=a(138);function l(e){const[t,a]=Object(n.useState)(e.member.task);const l=e.gang.getAllTaskNames(),c=[["Money:",r.a.createElement(s.a,{money:5*e.member.calculateMoneyGain(e.gang)})],["Respect:",i.a.formatRespect(5*e.member.calculateRespectGain(e.gang))+" / sec"],["Wanted Level:",i.a.formatWanted(5*e.member.calculateWantedLevelGain(e.gang))+" / sec"],["Total Respect:",""+i.a.formatRespect(e.member.earnedRespect)]];return r.a.createElement(r.a.Fragment,null,r.a.createElement("select",{onChange:function(t){const n=t.target.value;e.member.assignToTask(n),a(n),e.onTaskChange()},className:"dropdown noselect",value:t},r.a.createElement("option",{key:0,value:"---"},"---"),l.map((e,t)=>r.a.createElement("option",{key:t+1,value:e},e))),r.a.createElement("div",null,r.a.createElement(o.a,{rows:c})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(190);function o(e){const t=i.a[e.member.task],a=t?t.desc:i.a.Unassigned.desc;return r.a.createElement("p",{className:"inline noselect",dangerouslySetInnerHTML:{__html:a}})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));const n=[{desc:"This gang member is currently idle",isCombat:!0,isHacking:!0,name:"Unassigned",params:{hackWeight:100}},{desc:"Assign this gang member to create and distribute ransomware

Earns money - Slightly increases respect - Slightly increases wanted level",isCombat:!1,isHacking:!0,name:"Ransomware",params:{baseRespect:5e-5,baseWanted:1e-4,baseMoney:1,hackWeight:100,difficulty:1}},{desc:"Assign this gang member to attempt phishing scams and attacks

Earns money - Slightly increases respect - Slightly increases wanted level",isCombat:!1,isHacking:!0,name:"Phishing",params:{baseRespect:8e-5,baseWanted:.003,baseMoney:2.5,hackWeight:85,chaWeight:15,difficulty:3.5}},{desc:"Assign this gang member to attempt identity theft

Earns money - Increases respect - Increases wanted level",isCombat:!1,isHacking:!0,name:"Identity Theft",params:{baseRespect:1e-4,baseWanted:.075,baseMoney:6,hackWeight:80,chaWeight:20,difficulty:5}},{desc:"Assign this gang member to carry out DDoS attacks

Increases respect - Increases wanted level",isCombat:!1,isHacking:!0,name:"DDoS Attacks",params:{baseRespect:4e-4,baseWanted:.2,hackWeight:100,difficulty:8}},{desc:"Assign this gang member to create and distribute malicious viruses

Increases respect - Increases wanted level",isCombat:!1,isHacking:!0,name:"Plant Virus",params:{baseRespect:6e-4,baseWanted:.4,hackWeight:100,difficulty:12}},{desc:"Assign this gang member to commit financial fraud and digital counterfeiting

Earns money - Slightly increases respect - Slightly increases wanted level",isCombat:!1,isHacking:!0,name:"Fraud & Counterfeiting",params:{baseRespect:4e-4,baseWanted:.3,baseMoney:15,hackWeight:80,chaWeight:20,difficulty:20}},{desc:"Assign this gang member to launder money

Earns money - Increases respect - Increases wanted level",isCombat:!1,isHacking:!0,name:"Money Laundering",params:{baseRespect:.001,baseWanted:1.25,baseMoney:120,hackWeight:75,chaWeight:25,difficulty:25}},{desc:"Assign this gang member to commit acts of cyberterrorism

Greatly increases respect - Greatly increases wanted level",isCombat:!1,isHacking:!0,name:"Cyberterrorism",params:{baseRespect:.01,baseWanted:6,hackWeight:80,chaWeight:20,difficulty:36}},{desc:"Assign this gang member to be an ethical hacker for corporations

Earns money - Lowers wanted level",isCombat:!1,isHacking:!0,name:"Ethical Hacking",params:{baseWanted:-.001,baseMoney:1,hackWeight:90,chaWeight:10,difficulty:1}},{desc:"Assign this gang member to mug random people on the streets

Earns money - Slightly increases respect - Very slightly increases wanted level",isCombat:!0,isHacking:!1,name:"Mug People",params:{baseRespect:5e-5,baseWanted:5e-5,baseMoney:1.2,strWeight:25,defWeight:25,dexWeight:25,agiWeight:10,chaWeight:15,difficulty:1}},{desc:"Assign this gang member to sell drugs

Earns money - Slightly increases respect - Slightly increases wanted level - Scales slightly with territory",isCombat:!0,isHacking:!1,name:"Deal Drugs",params:{baseRespect:6e-5,baseWanted:.002,baseMoney:5,agiWeight:20,dexWeight:20,chaWeight:60,difficulty:3.5,territory:{money:1.2,respect:1,wanted:1.15}}},{desc:"Assign this gang member to extort civilians in your territory

Earns money - Slightly increases respect - Increases wanted - Scales heavily with territory",isCombat:!0,isHacking:!1,name:"Strongarm Civilians",params:{baseRespect:4e-5,baseWanted:.02,baseMoney:2.5,hackWeight:10,strWeight:25,defWeight:25,dexWeight:20,agiWeight:10,chaWeight:10,difficulty:5,territory:{money:1.6,respect:1.1,wanted:1.5}}},{desc:"Assign this gang member to run cons

Earns money - Increases respect - Increases wanted level",isCombat:!0,isHacking:!1,name:"Run a Con",params:{baseRespect:12e-5,baseWanted:.05,baseMoney:15,strWeight:5,defWeight:5,agiWeight:25,dexWeight:25,chaWeight:40,difficulty:14}},{desc:"Assign this gang member to commit armed robbery on stores, banks and armored cars

Earns money - Increases respect - Increases wanted level",isCombat:!0,isHacking:!1,name:"Armed Robbery",params:{baseRespect:14e-5,baseWanted:.1,baseMoney:38,hackWeight:20,strWeight:15,defWeight:15,agiWeight:10,dexWeight:20,chaWeight:20,difficulty:20}},{desc:"Assign this gang member to traffick illegal arms

Earns money - Increases respect - Increases wanted level - Scales heavily with territory",isCombat:!0,isHacking:!1,name:"Traffick Illegal Arms",params:{baseRespect:2e-4,baseWanted:.24,baseMoney:58,hackWeight:15,strWeight:20,defWeight:20,dexWeight:20,chaWeight:25,difficulty:32,territory:{money:1.4,respect:1.3,wanted:1.25}}},{desc:"Assign this gang member to threaten and black mail high-profile targets

Earns money - Slightly increases respect - Slightly increases wanted level",isCombat:!0,isHacking:!1,name:"Threaten & Blackmail",params:{baseRespect:2e-4,baseWanted:.125,baseMoney:24,hackWeight:25,strWeight:25,dexWeight:25,chaWeight:25,difficulty:28}},{desc:"Assign this gang member to engage in human trafficking operations

Earns money - Increases respect - Increases wanted level - Scales heavily with territory",isCombat:!0,isHacking:!1,name:"Human Trafficking",params:{baseRespect:.004,baseWanted:1.25,baseMoney:120,hackWeight:30,strWeight:5,defWeight:5,dexWeight:30,chaWeight:30,difficulty:36,territory:{money:1.5,respect:1.5,wanted:1.6}}},{desc:"Assign this gang member to commit acts of terrorism

Greatly increases respect - Greatly increases wanted level - Scales heavily with territory",isCombat:!0,isHacking:!1,name:"Terrorism",params:{baseRespect:.01,baseWanted:6,hackWeight:20,strWeight:20,defWeight:20,dexWeight:20,chaWeight:20,difficulty:36,territory:{money:1,respect:2,wanted:2}}},{desc:"Assign this gang member to be a vigilante and protect the city from criminals

Decreases wanted level",isCombat:!0,isHacking:!0,name:"Vigilante Justice",params:{baseWanted:-.001,hackWeight:20,strWeight:20,defWeight:20,dexWeight:20,agiWeight:20,difficulty:1,territory:{money:1,respect:1,wanted:.9}}},{desc:"Assign this gang member to increase their combat stats (str, def, dex, agi)",isCombat:!0,isHacking:!0,name:"Train Combat",params:{strWeight:25,defWeight:25,dexWeight:25,agiWeight:25,difficulty:100}},{desc:"Assign this gang member to train their hacking skills",isCombat:!0,isHacking:!0,name:"Train Hacking",params:{hackWeight:100,difficulty:45}},{desc:"Assign this gang member to train their charisma",isCombat:!0,isHacking:!0,name:"Train Charisma",params:{chaWeight:100,difficulty:8}},{desc:"Assign this gang member to engage in territorial warfare with other gangs. Members assigned to this task will help increase your gang's territory and will defend your territory from being taken.",isCombat:!0,isHacking:!0,name:"Territory Warfare",params:{hackWeight:15,strWeight:20,defWeight:20,dexWeight:20,agiWeight:20,chaWeight:5,difficulty:5}}]},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(877),o=a(243),s=a(14),l=a(22);function c(e){if(e.gang.members.length>=o.a.MaximumGangMembers)return r.a.createElement(r.a.Fragment,null);if(!e.gang.canRecruitMember()){const t=e.gang.getRespectNeededToRecruitMember();return r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{className:"a-link-button-inactive",style:{display:"inline-block",margin:"10px"}},"Recruit Gang Member"),r.a.createElement("p",{style:{margin:"10px",color:"red",display:"inline-block"}},Object(s.c)(t,2)," respect needed to recruit next member"))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("a",{className:"a-link-button",onClick:function(){const t="recruit-gang-member-popup";Object(l.a)(t,i.a,{gang:e.gang,popupId:t,onRecruit:e.onRecruit})},style:{display:"inline-block",margin:"10px"}},"Recruit Gang Member"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(22),o=a(11);function s(e){const[t,a]=Object(n.useState)("");function s(){""!==t?e.gang.canRecruitMember()?e.gang.recruitMember(t)?(e.onRecruit(),Object(i.b)(e.popupId)):Object(o.a)("You already have a gang member with this name!"):Object(o.a)("You cannot recruit another Gang member!"):Object(o.a)("You must enter a name for your Gang member!")}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"noselect"},"Enter a name for your new Gang member:"),r.a.createElement("br",null),r.a.createElement("input",{autoFocus:!0,onKeyUp:function(e){13===e.keyCode&&s()},onChange:function(e){a(e.target.value)},className:"text-input noselect",type:"text",placeholder:"unique name"}),r.a.createElement("a",{className:"std-button",onClick:s},"Recruit Gang Member"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(3),o=a(11),s=a(14),l=a(67);function c(e){function t(e){const t=100*e;return t<=0?Object(s.c)(0,2):t>=100?Object(s.c)(100,2):Object(s.c)(t,2)}const a=l.a[e.gang.facName].power;const n=Object.keys(l.a).filter(t=>t!=e.gang.facName);return r.a.createElement("div",{style:{width:"70%"}},r.a.createElement("p",{className:"noselect"},"This page shows how much territory your Gang controls. This statistic is listed as a percentage, which represents how much of the total territory you control.",r.a.createElement("br",null),r.a.createElement("br",null),"Every ~20 seconds, your gang has a chance to 'clash' with other gangs. Your chance to win a clash depends on your gang's power, which is listed in the display below. Your gang's power slowly accumulates over time. The accumulation rate is determined by the stats of all Gang members you have assigned to the 'Territory Warfare' task. Gang members that are not assigned to this task do not contribute to your gang's power. Your gang also loses a small amount of power whenever you lose a clash.",r.a.createElement("br",null),r.a.createElement("br",null),"NOTE: Gang members assigned to 'Territory Warfare' can be killed during clashes. This can happen regardless of whether you win or lose the clash. A gang member being killed results in both respect and power loss for your gang.",r.a.createElement("br",null),r.a.createElement("br",null),"The amount of territory you have affects all aspects of your Gang members' production, including money, respect, and wanted level. It is very beneficial to have high territory control.",r.a.createElement("br",null),r.a.createElement("br",null)),r.a.createElement("input",{checked:e.gang.territoryWarfareEngaged,id:"warfare",type:"checkbox",style:{display:"inline-block",margin:"2px"},onChange:t=>e.gang.territoryWarfareEngaged=t.target.checked}),r.a.createElement("label",{htmlFor:"warfare",className:"tooltip noselect",style:{color:"white",display:"inline-block"}},"Engage in Territory Warfare",r.a.createElement("span",{className:"tooltiptext",style:{display:"inline-block"}},"Engaging in Territory Warfare sets your clash chance to 100%. Disengaging will cause your clash chance to gradually decrease until it reaches 0%.")),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"inline-block"}},"Territory Clash Chance: ",i.a.formatPercentage(e.gang.territoryClashChance,3)),r.a.createElement("div",{className:"help-tip noselect",style:{display:"inline-block"},onClick:function(){Object(o.a)("This percentage represents the chance you have of 'clashing' with with another gang. If you do not wish to gain/lose territory, then keep this percentage at 0% by not engaging in territory warfare.")}},"?"),r.a.createElement("br",null),r.a.createElement("input",{checked:e.gang.notifyMemberDeath,id:"notify",type:"checkbox",style:{display:"inline-block",margin:"2px"},onChange:t=>e.gang.notifyMemberDeath=t.target.checked}),r.a.createElement("label",{htmlFor:"warfare",className:"tooltip noselect",style:{color:"white",display:"inline-block"}},"Notify about Gang Member Deaths",r.a.createElement("span",{className:"tooltiptext",style:{display:"inline-block"}},"If this is enabled, then you will receive a pop-up notifying you whenever one of your Gang Members dies in a territory clash.")),r.a.createElement("br",null),r.a.createElement("fieldset",{style:{display:"block",margin:"6px"}},r.a.createElement("p",null,r.a.createElement("b",null,r.a.createElement("u",null,e.gang.facName)),r.a.createElement("br",null),"Power: ",Object(s.c)(l.a[e.gang.facName].power,6),r.a.createElement("br",null),"Territory: ",t(l.a[e.gang.facName].territory),"%",r.a.createElement("br",null),r.a.createElement("br",null),n.map(e=>function(e){const n=l.a[e].power,o=a/(n+a);return r.a.createElement("span",{key:e},r.a.createElement("u",null,e),r.a.createElement("br",null),"Power: ",Object(s.c)(n,6),r.a.createElement("br",null),"Territory: ",t(l.a[e].territory),"%",r.a.createElement("br",null),"Chance to win clash with this gang: ",i.a.formatPercentage(o,3),r.a.createElement("br",null),r.a.createElement("br",null))}(e)))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(534),o=a(880),s=a(22),l=a(884),c=a(44);function u(e){if(0===Object.keys(c.a).sort().filter(t=>void 0===e.corp.divisions.find(e=>e.type===t)).sort().length)return r.a.createElement(r.a.Fragment,null);return r.a.createElement(i.a,{current:!1,onClick:function(){const t="cmpy-mgmt-expand-industry-popup";Object(s.a)(t,o.a,{corp:e.corp,setDivisionName:e.setDivisionName,popupId:t})},text:"Expand into new Industry"})}function m(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}const[o,s]=Object(n.useState)("Overview");return Object(n.useEffect)(()=>{const e=setInterval(a,1e3);return()=>clearInterval(e)},[]),r.a.createElement("div",{className:"cmpy-mgmt-container"},r.a.createElement("div",null,r.a.createElement(i.a,{current:"Overview"===o,key:"overview",onClick:()=>s("Overview"),text:e.corp.name}),e.corp.divisions.map(e=>r.a.createElement(i.a,{current:e.name===o,key:e.name,onClick:()=>s(e.name),text:e.name})),r.a.createElement(u,{corp:e.corp,setDivisionName:s})),r.a.createElement(l.a,{rerender:a,corp:e.corp,divisionName:o,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(44),l=a(57);function c(e){const t=Object.keys(s.a).sort().filter(t=>void 0===e.corp.divisions.find(e=>e.type===t)).sort(),[a,c]=Object(n.useState)(t.length>0?t[0]:""),[u,m]=Object(n.useState)("");function h(){try{Object(l.l)(e.corp,a,u)}catch(e){return void Object(i.a)(e+"")}e.setDivisionName(u),Object(o.b)(e.popupId)}const p=s.b[a];if(void 0===p)throw new Error(`Trying to create an industry that doesn't exists: '${a}'`);return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Create a new division to expand into a new industry:"),r.a.createElement("select",{className:"dropdown",defaultValue:a,onChange:function(e){c(e.target.value)}},t.map(e=>r.a.createElement("option",{key:e,value:e},e))),r.a.createElement("p",null,p(e.corp)),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",null,"Division name:"),r.a.createElement("input",{autoFocus:!0,value:u,onChange:function(e){m(e.target.value)},onKeyDown:function(e){13===e.keyCode&&h()},type:"text",className:"text-input",style:{display:"block"},maxLength:30,pattern:"[a-zA-Z0-9-_]"}),r.a.createElement("span",{onClick:h,className:"popup-box-button"},"Create Division"))}},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return Industry}));var _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(20),_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(23),decimal_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(82),_IndustryData__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(44),_data_Constants__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(36),_EmployeePositions__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(39),_Material__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(148),_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(21),_utils_calculateEffectWithFactors__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(882),_OfficeSpace__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(313),_Product__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(352),_utils_DialogBox__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(11),_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(95),_MaterialSizes__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(154),_Warehouse__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(188),_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(314),_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(14);function _defineProperty(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class Industry{constructor(e={}){_defineProperty(this,"name",""),_defineProperty(this,"type",_IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Agriculture),_defineProperty(this,"sciResearch",new _Material__WEBPACK_IMPORTED_MODULE_6__.a({name:"Scientific Research"})),_defineProperty(this,"researched",{}),_defineProperty(this,"reqMats",{}),_defineProperty(this,"prodMats",[]),_defineProperty(this,"products",{}),_defineProperty(this,"makesProducts",!1),_defineProperty(this,"awareness",0),_defineProperty(this,"popularity",0),_defineProperty(this,"startingCost",0),_defineProperty(this,"reFac",0),_defineProperty(this,"sciFac",0),_defineProperty(this,"hwFac",0),_defineProperty(this,"robFac",0),_defineProperty(this,"aiFac",0),_defineProperty(this,"advFac",0),_defineProperty(this,"prodMult",0),_defineProperty(this,"upgrades",Array(Object.keys(_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_15__.a).length).fill(0)),_defineProperty(this,"state","START"),_defineProperty(this,"newInd",!0),_defineProperty(this,"offices",{[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Aevum]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Chongqing]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Sector12]:new _OfficeSpace__WEBPACK_IMPORTED_MODULE_9__.a({loc:_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Sector12,size:_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.OfficeInitialSize}),[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.NewTokyo]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Ishima]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Volhaven]:0}),this.name=e.name?e.name:"",this.type=e.type?e.type:_IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Agriculture,this.lastCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.lastCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.warehouses={[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Aevum]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Chongqing]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Sector12]:new _Warehouse__WEBPACK_IMPORTED_MODULE_14__.a({corp:e.corp,industry:this,loc:_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Sector12,size:_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.WarehouseInitialSize}),[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.NewTokyo]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Ishima]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_1__.a.Volhaven]:0},this.init()}init(){const e=_IndustryData__WEBPACK_IMPORTED_MODULE_3__.d[this.type];if(void 0===e)throw new Error(`Invalid industry: "${this.type}"`);switch(this.startingCost=e,this.type){case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Energy:this.reFac=.65,this.sciFac=.7,this.robFac=.05,this.aiFac=.3,this.advFac=.08,this.reqMats={Hardware:.1,Metal:.2},this.prodMats=["Energy"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Utilities:case"Utilities":this.reFac=.5,this.sciFac=.6,this.robFac=.4,this.aiFac=.4,this.advFac=.08,this.reqMats={Hardware:.1,Metal:.1},this.prodMats=["Water"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Agriculture:this.reFac=.72,this.sciFac=.5,this.hwFac=.2,this.robFac=.3,this.aiFac=.3,this.advFac=.04,this.reqMats={Water:.5,Energy:.5},this.prodMats=["Plants","Food"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Fishing:this.reFac=.15,this.sciFac=.35,this.hwFac=.35,this.robFac=.5,this.aiFac=.2,this.advFac=.08,this.reqMats={Energy:.5},this.prodMats=["Food"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Mining:this.reFac=.3,this.sciFac=.26,this.hwFac=.4,this.robFac=.45,this.aiFac=.45,this.advFac=.06,this.reqMats={Energy:.8},this.prodMats=["Metal"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Food:this.sciFac=.12,this.hwFac=.15,this.robFac=.3,this.aiFac=.25,this.advFac=.25,this.reFac=.05,this.reqMats={Food:.5,Water:.5,Energy:.2},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Tobacco:this.reFac=.15,this.sciFac=.75,this.hwFac=.15,this.robFac=.2,this.aiFac=.15,this.advFac=.2,this.reqMats={Plants:1,Water:.2},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Chemical:this.reFac=.25,this.sciFac=.75,this.hwFac=.2,this.robFac=.25,this.aiFac=.2,this.advFac=.07,this.reqMats={Plants:1,Energy:.5,Water:.5},this.prodMats=["Chemicals"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Pharmaceutical:this.reFac=.05,this.sciFac=.8,this.hwFac=.15,this.robFac=.25,this.aiFac=.2,this.advFac=.16,this.reqMats={Chemicals:2,Energy:1,Water:.5},this.prodMats=["Drugs"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Computer:case"Computer":this.reFac=.2,this.sciFac=.62,this.robFac=.36,this.aiFac=.19,this.advFac=.17,this.reqMats={Metal:2,Energy:1},this.prodMats=["Hardware"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Robotics:this.reFac=.32,this.sciFac=.65,this.aiFac=.36,this.advFac=.18,this.hwFac=.19,this.reqMats={Hardware:5,Energy:3},this.prodMats=["Robots"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Software:this.sciFac=.62,this.advFac=.16,this.hwFac=.25,this.reFac=.15,this.aiFac=.18,this.robFac=.05,this.reqMats={Hardware:.5,Energy:.5},this.prodMats=["AICores"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Healthcare:this.reFac=.1,this.sciFac=.75,this.advFac=.11,this.hwFac=.1,this.robFac=.1,this.aiFac=.1,this.reqMats={Robots:10,AICores:5,Energy:5,Water:5},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.RealEstate:this.robFac=.6,this.aiFac=.6,this.advFac=.25,this.sciFac=.05,this.hwFac=.05,this.reqMats={Metal:5,Energy:5,Water:2,Hardware:4},this.prodMats=["RealEstate"],this.makesProducts=!0;break;default:return void console.error("Invalid Industry Type passed into Industry.init(): "+this.type)}}getProductDescriptionText(){if(!this.makesProducts)return"";switch(this.type){case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Food:return"create and manage restaurants";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Tobacco:return"create tobacco and tobacco-related products";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Pharmaceutical:return"develop new pharmaceutical drugs";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Computer:case"Computer":return"create new computer hardware and networking infrastructures";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Robotics:return"build specialized robots and robot-related products";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Software:return"develop computer software";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.Healthcare:return"build and manage hospitals";case _IndustryData__WEBPACK_IMPORTED_MODULE_3__.a.RealEstate:return"develop and manage real estate properties";default:return console.error("Invalid industry type in Industry.getProductDescriptionText"),""}}getMaximumNumberProducts(){if(!this.makesProducts)return 0;let e=0;return this.hasResearch("uPgrade: Capacity.I")&&++e,this.hasResearch("uPgrade: Capacity.II")&&++e,_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.BaseMaxProducts+e}hasMaximumNumberProducts(){return Object.keys(this.products).length>=this.getMaximumNumberProducts()}calculateProductionFactors(){let e=0;for(let t=0;t<_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities.length;++t){const a=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities[t],n=this.warehouses[a];if(!(n instanceof _Warehouse__WEBPACK_IMPORTED_MODULE_14__.a))continue;const r=n.materials,i=Math.pow(.002*r.RealEstate.qty+1,this.reFac)*Math.pow(.002*r.Hardware.qty+1,this.hwFac)*Math.pow(.002*r.Robots.qty+1,this.robFac)*Math.pow(.002*r.AICores.qty+1,this.aiFac);e+=Math.pow(i,.73)}this.prodMult=e<1?1:e}updateWarehouseSizeUsed(e){e.updateMaterialSizeUsed();for(const t in this.products)if(this.products.hasOwnProperty(t)){const a=this.products[t];if(void 0===a)continue;e.sizeUsed+=a.data[e.loc][0]*a.siz,a.data[e.loc][0]>0&&(e.breakdown+=t+": "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_16__.c)(a.data[e.loc][0]*a.siz,0)+"
")}}process(e=1,t,a){if(this.state=t,"START"===t){(isNaN(this.thisCycleRevenue)||isNaN(this.thisCycleExpenses))&&(console.error("NaN in Corporation's computed revenue/expenses"),Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_11__.a)("Something went wrong when compting Corporation's revenue/expenses. This is a bug. Please report to game developer"),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0)),this.lastCycleRevenue=this.thisCycleRevenue.dividedBy(e*_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle),this.lastCycleExpenses=this.thisCycleExpenses.dividedBy(e*_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_2__.a(0),this.lastCycleRevenue.gt(0)&&(this.newInd=!1);let t=0;for(const n in this.offices){const r=this.offices[n];0!==r&&(r instanceof _OfficeSpace__WEBPACK_IMPORTED_MODULE_9__.a&&(t+=r.process(e,a,this)))}this.thisCycleExpenses=this.thisCycleExpenses.plus(t),this.processMaterialMarket(),this.processProductMarket(e),this.popularity-=1e-4*e,this.popularity=Math.max(0,this.popularity);const n=a.getDreamSenseGain(),r=4*n;return void(n>0&&(this.popularity+=n*e,this.awareness+=r*e))}let n=this.processMaterials(e,a);Array.isArray(n)&&(this.thisCycleRevenue=this.thisCycleRevenue.plus(n[0]),this.thisCycleExpenses=this.thisCycleExpenses.plus(n[1])),n=this.processProducts(e,a),Array.isArray(n)&&(this.thisCycleRevenue=this.thisCycleRevenue.plus(n[0]),this.thisCycleExpenses=this.thisCycleExpenses.plus(n[1]))}processMaterialMarket(){const e=this.reqMats,t=this.prodMats;for(let a=0;a<_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities.length;++a)if(this.warehouses[_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities[a]]instanceof _Warehouse__WEBPACK_IMPORTED_MODULE_14__.a){const n=this.warehouses[_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities[a]];if(0===n)continue;for(const t in e)e.hasOwnProperty(t)&&n.materials[t].processMarket();for(let e=0;e0&&(t.qty+=a,expenses+=a*t.bCost),this.updateWarehouseSizeUsed(warehouse))}const e={};for(const t in warehouse.materials){if(!warehouse.materials.hasOwnProperty(t))continue;if(!warehouse.smartSupplyEnabled||!Object.keys(this.reqMats).includes(t))continue;const a=warehouse.materials[t],n=this.reqMats[t];if(void 0===n)throw new Error(`reqMat "${t}" is undefined`);a.buy=n*warehouse.smartSupplyStore;let r=a.buy*_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles;const i=Math.floor((warehouse.size-warehouse.sizeUsed)/_MaterialSizes__WEBPACK_IMPORTED_MODULE_13__.a[t]);r=Math.min(r,i),r>0&&(e[t]=r)}let t=1e99;for(const a in e){const n=e[a];if(void 0===n)throw new Error("Somehow smartbuy matname is undefined");const r=this.reqMats[a];if(void 0===r)throw new Error(`reqMat "${a}" is undefined`);const i=n/r;in)for(const t in e){const r=e[t];if(void 0===r)throw new Error("Somehow smartbuy matname is undefined");e[t]=Math.floor(r*n/a)}for(const t in e){if(!warehouse.smartSupplyUseLeftovers[t])continue;const a=warehouse.materials[t],n=e[t];if(void 0===n)throw new Error("Somehow smartbuy matname is undefined");e[t]=Math.max(0,n-a.qty)}for(const t in e){const a=warehouse.materials[t],n=e[t];if(void 0===n)throw new Error("Somehow smartbuy matname is undefined");a.qty+=n,expenses+=n*a.bCost}break}case"PRODUCTION":if(warehouse.smartSupplyStore=0,this.prodMats.length>0){const e=warehouse.materials[this.prodMats[0]],t=this.getOfficeProductivity(office)*this.prodMult*corporation.getProductionMultiplier()*this.getProductionMultiplier();let a;a=e.prdman[0]?Math.min(t,e.prdman[1]):t,a*=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles;let n=0;for(let e=0;e0){const e=Math.floor((warehouse.size-warehouse.sizeUsed)/n);a=Math.min(e,a)}a<0&&(a=0),warehouse.smartSupplyStore+=a/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles);let r=1;for(const e in this.reqMats)if(this.reqMats.hasOwnProperty(e)){const t=this.reqMats[e];if(void 0===t)continue;const n=t*a;warehouse.materials[e].qty0&&a>0){for(const e in this.reqMats){const t=this.reqMats[e];if(void 0===t)continue;const n=t*a*r;warehouse.materials[e].qty-=n,warehouse.materials[e].prd=0,warehouse.materials[e].prd-=n/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles)}for(let e=0;emat.bCost?sCost-mat.bCost>markupLimit&&(markup=Math.pow(markupLimit/(sCost-mat.bCost),2)):sCost=0?(mat.qty-=sellAmt,revenue+=sellAmt*sCost,mat.sll=sellAmt/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles)):mat.sll=0}break;case"EXPORT":for(const matName in warehouse.materials)if(warehouse.materials.hasOwnProperty(matName)){const mat=warehouse.materials[matName];mat.totalExp=0;for(let expI=0;expI=a.size)return[0,0];{const e=Math.floor((a.size-a.sizeUsed)/_MaterialSizes__WEBPACK_IMPORTED_MODULE_13__.a[matName]);amt=Math.min(e,amt)}a.materials[matName].imp+=amt/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles),a.materials[matName].qty+=amt,a.materials[matName].qlt=mat.qlt,mat.qty-=amt,mat.totalExp+=amt,t.updateWarehouseSizeUsed(a);break}}}mat.totalExp/=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles}break;case"START":break;default:console.error("Invalid state: "+this.state)}this.updateWarehouseSizeUsed(warehouse)}office instanceof _OfficeSpace__WEBPACK_IMPORTED_MODULE_9__.a&&(this.sciResearch.qty+=.004*Math.pow(office.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_5__.a.RandD],.5)*corporation.getScientificResearchMultiplier()*this.getScientificResearchMultiplier())}}return[revenue,expenses]}processProducts(e=1,t){let a=0;if("PRODUCTION"===this.state)for(const t in this.products){const a=this.products[t];if(void 0!==a&&!a.fin){const t=a.createCity,n=this.offices[t];if(0===n)continue;const r=n.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_5__.a.Engineer],i=n.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_5__.a.Management],o=n.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_5__.a.Operations],s=r+i+o;if(s<=0)break;const l=1+i/(1.2*s),c=(Math.pow(r,.34)+Math.pow(o,.2))*l;a.createProduct(e,c),a.prog>=100&&a.finishProduct(n.employeeProd,this);break}}for(const n in this.products)if(this.products.hasOwnProperty(n)){const r=this.products[n];r instanceof _Product__WEBPACK_IMPORTED_MODULE_10__.a&&r.fin&&(a+=this.processProduct(e,r,t))}return[a,0]}processProduct(marketCycles=1,product,corporation){let totalProfit=0;for(let i=0;i<_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities.length;++i){const city=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.Cities[i],office=this.offices[city];if(0===office)continue;const warehouse=this.warehouses[city];if(warehouse instanceof _Warehouse__WEBPACK_IMPORTED_MODULE_14__.a)switch(this.state){case"PRODUCTION":{const e=this.getOfficeProductivity(office,{forProduct:!0})*corporation.getProductionMultiplier()*this.prodMult*this.getProductionMultiplier()*this.getProductProductionMultiplier();let t;t=product.prdman[city][0]?Math.min(e,product.prdman[city][1]):e,t*=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles;let a=product.siz;for(const e in product.reqMats)if(product.reqMats.hasOwnProperty(e)){const t=product.reqMats[e];a-=_MaterialSizes__WEBPACK_IMPORTED_MODULE_13__.a[e]*t}if(a>0){const e=Math.floor((warehouse.size-warehouse.sizeUsed)/a);t=Math.min(e,t)}warehouse.smartSupplyStore+=t/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles);let n=1;for(const e in product.reqMats)if(product.reqMats.hasOwnProperty(e)){const a=product.reqMats[e]*t;warehouse.materials[e].qty0&&t>0){for(const e in product.reqMats)if(product.reqMats.hasOwnProperty(e)){const a=product.reqMats[e]*t*n;warehouse.materials[e].qty-=a,warehouse.materials[e].prd-=a/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles)}product.data[city][0]+=t*n}product.data[city][1]=t*n/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles);break}case"SALE":{product.pCost=0;for(const e in product.reqMats)product.reqMats.hasOwnProperty(e)&&(product.pCost+=product.reqMats[e]*warehouse.materials[e].bCost);product.pCost*=_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.ProductProductionCostRatio;const businessFactor=this.getBusinessFactor(office),advertisingFactor=this.getAdvertisingFactors()[0],marketFactor=this.getMarketFactor(product),markupLimit=product.rat/product.mku;let sCost;if(product.marketTa2){const e=product.data[city][1],t=markupLimit,a=e,n=.5*Math.pow(product.rat,.65)*marketFactor*corporation.getSalesMultiplier()*businessFactor*advertisingFactor*this.getSalesMultiplier(),r=Math.sqrt(a/n);let i;0===n||0===r?0===a?i=0:(i=product.pCost+markupLimit,console.warn("In Corporation, found illegal 0s when trying to calculate MarketTA2 sale cost")):i=t/r+product.pCost,product.marketTa2Price[city]=i,sCost=i}else if(product.marketTa1)sCost=product.pCost+markupLimit;else if(Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_12__.a)(product.sCost)){const sCostString=product.sCost;0===product.mku&&(console.error("mku is zero, reverting to 1 to avoid Infinity"),product.mku=1),sCost=sCostString.replace(/MP/g,product.pCost+product.rat/product.mku+""),sCost=eval(sCost)}else sCost=product.sCost;let markup=1;sCost>product.pCost&&sCost-product.pCost>markupLimit&&(markup=markupLimit/(sCost-product.pCost));const maxSell=.5*Math.pow(product.rat,.65)*marketFactor*corporation.getSalesMultiplier()*Math.pow(markup,2)*businessFactor*advertisingFactor*this.getSalesMultiplier();let sellAmt;if(product.sllman[city][0]&&Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_12__.a)(product.sllman[city][1])){let tmp=product.sllman[city][1].replace(/MAX/g,maxSell);tmp=tmp.replace(/PROD/g,product.data[city][1]);try{tmp=eval(tmp)}catch(e){Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_11__.a)("Error evaluating your sell price expression for "+product.name+" in "+this.name+"'s "+city+" office. Sell price is being set to MAX"),tmp=maxSell}sellAmt=Math.min(maxSell,tmp)}else sellAmt=product.sllman[city][0]&&product.sllman[city][1]>0?Math.min(maxSell,product.sllman[city][1]):!1===product.sllman[city][0]?0:maxSell;sellAmt<0&&(sellAmt=0),sellAmt=sellAmt*_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles,sellAmt=Math.min(product.data[city][0],sellAmt),sellAmt&&sCost?(product.data[city][0]-=sellAmt,totalProfit+=sellAmt*sCost,product.data[city][2]=sellAmt/(_data_Constants__WEBPACK_IMPORTED_MODULE_4__.a.SecsPerMarketCycle*marketCycles)):product.data[city][2]=0;break}case"START":case"PURCHASE":case"EXPORT":break;default:console.error("Invalid State: "+this.state)}}return totalProfit}discontinueProduct(e){for(const t in this.products)this.products.hasOwnProperty(t)&&e===this.products[t]&&delete this.products[t]}upgrade(e,t){const a=t.corporation,n=t.office,r=e[0];for(;this.upgrades.length<=r;)this.upgrades.push(0);switch(++this.upgrades[r],r){case 0:for(let e=0;e=1)&&console.warn(`Exponential factor is ${t}. This is not an intended value for it`),a<1&&console.warn(`Linear factor is ${a}. This is not an intended value for it`),Math.pow(e,t)+e/a}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(44);const r={[n.a.Food]:{Quality:.7,Durability:.1,Aesthetics:.2},[n.a.Tobacco]:{Quality:.4,Durability:.2,Reliability:.2,Aesthetics:.2},[n.a.Pharmaceutical]:{Quality:.2,Performance:.2,Durability:.1,Reliability:.3,Features:.2},[n.a.Computer]:{Quality:.15,Performance:.25,Durability:.25,Reliability:.2,Aesthetics:.05,Features:.1},Computer:{Quality:.15,Performance:.25,Durability:.25,Reliability:.2,Aesthetics:.05,Features:.1},[n.a.Robotics]:{Quality:.1,Performance:.2,Durability:.2,Reliability:.2,Aesthetics:.1,Features:.2},[n.a.Software]:{Quality:.2,Performance:.2,Reliability:.2,Durability:.2,Features:.2},[n.a.Healthcare]:{Quality:.4,Performance:.1,Durability:.1,Reliability:.3,Features:.1},[n.a.RealEstate]:{Quality:.2,Durability:.25,Reliability:.1,Aesthetics:.35,Features:.1}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(885),o=a(912),s=a(23);function l(e){const t="Overview"!==e.divisionName?e.corp.divisions.find(t=>t.name===e.divisionName):void 0;return void 0===t?r.a.createElement("div",{id:"cmpy-mgmt-panel"},r.a.createElement(o.a,e)):r.a.createElement("div",{id:"cmpy-mgmt-panel"},r.a.createElement(i.a,{rerender:e.rerender,division:t,corp:e.corp,city:s.a.Sector12,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(607),o=a(886),s=a(22),l=a(887);function c(e){return 0===Object.keys(e.division.offices).filter(t=>0===e.division.offices[t]).length?r.a.createElement(r.a.Fragment,null):r.a.createElement(i.a,{current:!1,key:"Expand into new City",name:"Expand into new City",onClick:function(){const t="cmpy-mgmt-expand-city-popup";Object(s.a)(t,o.a,{popupId:t,corp:e.corp,division:e.division,cityStateSetter:e.setCity})}})}function u(e){const[t,a]=Object(n.useState)(e.city),o=e.division.offices[t];return 0===o?(a("Sector-12"),r.a.createElement(r.a.Fragment,null)):r.a.createElement(r.a.Fragment,null,Object.values(e.division.offices).map(e=>0!==e&&r.a.createElement(i.a,{current:t===e.loc,key:e.loc,name:e.loc,onClick:()=>a(e.loc)})),r.a.createElement(c,{corp:e.corp,division:e.division,setCity:a}),r.a.createElement(l.a,{rerender:e.rerender,corp:e.corp,division:e.division,city:t,warehouse:e.division.warehouses[t],office:o,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(36),o=a(22),s=a(11),l=a(57),c=a(102);function u(e){const t=Object(n.useRef)(null);return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Would you like to expand into a new city by opening an office? This would cost"," ",r.a.createElement(c.a,{money:i.a.OfficeInitialCost,corp:e.corp})),r.a.createElement("select",{ref:t,className:"dropdown",style:{margin:"5px"}},Object.keys(e.division.offices).filter(t=>0===e.division.offices[t]).map(e=>r.a.createElement("option",{key:e,value:e},e))),r.a.createElement("button",{className:"std-button",style:{display:"inline-block"},onClick:function(){if(null!==t.current){try{Object(l.k)(e.corp,e.division,t.current.value)}catch(e){return void Object(s.a)(e+"")}Object(s.a)(`Opened a new office in ${t.current.value}!`),e.cityStateSetter(t.current.value),Object(o.b)(e.popupId)}},disabled:e.corp.funds.lt(0)},"Confirm"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(888),o=a(892),s=a(896);function l(e){return r.a.createElement("div",null,r.a.createElement("div",{className:"cmpy-mgmt-industry-left-panel"},r.a.createElement(o.a,{rerender:e.rerender,player:e.player,corp:e.corp,division:e.division,currentCity:e.city,office:e.office}),r.a.createElement(i.a,{rerender:e.rerender,player:e.player,corp:e.corp,division:e.division,office:e.office})),r.a.createElement("div",{className:"cmpy-mgmt-industry-right-panel"},r.a.createElement(s.a,{rerender:e.rerender,player:e.player,corp:e.corp,currentCity:e.city,division:e.division,warehouse:e.warehouse})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(0),r=a.n(n),i=a(39),o=a(3),s=a(608),l=a(22),c=a(889),u=a(890),m=a(891),h=a(15);function p(e,t){let a=0;for(let n=0;ne.switchMode(e=>!e)},"Switch to Auto Mode",r.a.createElement("span",{className:"tooltiptext"},"Switch to Automatic Assignment Mode, which will automatically assign employees to your selected jobs. You simply have to select the number of assignments for each job")):r.a.createElement("button",{className:"std-button tooltip",onClick:()=>e.switchMode(e=>!e)},"Switch to Manual Mode",r.a.createElement("span",{className:"tooltiptext"},"Switch to Manual Assignment Mode, which allows you to specify which employees should get which jobs"))}function f(e){const[t,a]=Object(n.useState)(e.office.employees.length>0?e.office.employees[0]:null),l=[];for(let t=0;t0?"std-button":"a-link-button-inactive",onClick:function(){a<=0?console.warn("Cannot assign employee. No unassigned employees available"):(e.office.assignEmployeeToJob(e.job),e.office.calculateEmployeeProductivity(e.corp,e.division),e.rerender())}},"+"),r.a.createElement("button",{className:t>0?"std-button":"a-link-button-inactive",onClick:function(){e.office.unassignEmployeeFromJob(e.job),e.office.calculateEmployeeProductivity(e.corp,e.division),e.rerender()}},"-"),r.a.createElement("br",null))}function y(e){const t=p(e.office.employees,i.a.Unassigned),a=1===e.corp.unlockUpgrades[4];let n=0,s=0,l=0,c=0;for(let t=0;t0&&(u=n/e.office.employees.length,m=s/e.office.employees.length,d=l/e.office.employees.length),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("strong",null,"Unassigned Employees: ",t)),r.a.createElement("br",null),r.a.createElement("table",null,r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",null,"Avg Employee Morale:")),r.a.createElement("td",null,r.a.createElement("p",null,o.a.format(u,"0.000")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",null,"Avg Employee Happiness:")),r.a.createElement("td",null,r.a.createElement("p",null,o.a.format(m,"0.000")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",null,"Avg Employee Energy:")),r.a.createElement("td",null,r.a.createElement("p",null,o.a.format(d,"0.000")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",null,"Total Employee Salary:")),r.a.createElement("td",null,r.a.createElement("p",null,r.a.createElement(h.a,{money:c})))),a&&r.a.createElement(r.a.Fragment,null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Material Production:",r.a.createElement("span",{className:"tooltiptext"},"The base amount of material this office can produce. Does not include production multipliers from upgrades and materials. This value is based off the productivity of your Operations, Engineering, and Management employees"))),r.a.createElement("td",null,r.a.createElement("p",null,o.a.format(e.division.getOfficeProductivity(e.office),"0.000")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Product Production:",r.a.createElement("span",{className:"tooltiptext"},"The base amount of any given Product this office can produce. Does not include production multipliers from upgrades and materials. This value is based off the productivity of your Operations, Engineering, and Management employees"))),r.a.createElement("td",null,r.a.createElement("p",null,o.a.format(e.division.getOfficeProductivity(e.office,{forProduct:!0}),"0.000")))),r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("p",{className:"tooltip",style:{display:"inline-block"}},"Business Multiplier:",r.a.createElement("span",{className:"tooltiptext"},"The effect this office's 'Business' employees has on boosting sales"))),r.a.createElement("td",null,r.a.createElement("p",null,"x",o.a.format(e.division.getBusinessFactor(e.office),"0.000"))))))),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.Operations,desc:"Manages supply chain operations. Improves the amount of Materials and Products you produce."}),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.Engineer,desc:"Develops and maintains products and production systems. Increases the quality of everything you produce. Also increases the amount you produce (not as much as Operations, however)"}),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.Business,desc:"Handles sales and finances. Improves the amount of Materials and Products you can sell."}),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.Management,desc:"Leads and oversees employees and office operations. Improves the effectiveness of Engineer and Operations employees."}),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.RandD,desc:"Research new innovative ways to improve the company. Generates Scientific Research."}),r.a.createElement(g,{rerender:e.rerender,office:e.office,corp:e.corp,division:e.division,player:e.player,job:i.a.Training,desc:"Set employee to training, which will increase some of their stats. Employees in training do not affect any company operations."}))}function b(e){const[t,a]=Object(n.useState)(!1),i={fontSize:"13px"};let o="tooltip";e.office.atCapacity()?o+=" a-link-button-inactive":(o+=" std-button",0===e.office.employees.length&&(o+=" flashing-button"));let s="tooltip";return e.office.atCapacity()?s+=" a-link-button-inactive":s+=" std-button",r.a.createElement("div",{className:"cmpy-mgmt-employee-panel"},r.a.createElement("h1",{style:{margin:"4px 0px 5px 0px"}},"Office Space"),r.a.createElement("p",null,"Size: ",e.office.employees.length," / ",e.office.size," employees"),r.a.createElement("button",{className:o,onClick:function(){const t="cmpy-mgmt-hire-employee-popup";Object(l.a)(t,u.a,{rerender:e.rerender,office:e.office,corp:e.corp,popupId:t,player:e.player})},style:i},"Hire Employee",0===e.office.employees.length&&r.a.createElement("span",{className:"tooltiptext"},"You'll need to hire some employees to get your operations started! It's recommended to have at least one employee in every position")),r.a.createElement("button",{className:s,onClick:function(){e.office.atCapacity()||(e.office.hireRandomEmployee(),e.rerender())},style:i},"Autohire Employee",r.a.createElement("span",{className:"tooltiptext"},"Automatically hires an employee and gives him/her a random name")),r.a.createElement("br",null),r.a.createElement("button",{className:"std-button tooltip",onClick:function(){const t="cmpy-mgmt-upgrade-office-size-popup";Object(l.a)(t,c.a,{rerender:e.rerender,office:e.office,corp:e.corp,popupId:t,player:e.player})},style:i,disabled:e.corp.funds.lt(0)},"Upgrade size",r.a.createElement("span",{className:"tooltiptext"},"Upgrade the office's size so that it can hold more employees!")),!e.division.hasResearch("AutoPartyManager")&&r.a.createElement("button",{className:"std-button tooltip",onClick:function(){const t="cmpy-mgmt-throw-office-party-popup";Object(l.a)(t,m.a,{office:e.office,corp:e.corp,popupId:t})},style:i,disabled:e.corp.funds.lt(0)},"Throw Party",r.a.createElement("span",{className:"tooltiptext"},'"Throw an office party to increase your employee\'s morale and happiness"')),r.a.createElement("br",null),r.a.createElement("div",null,r.a.createElement(d,{manualMode:t,switchMode:a})),t?r.a.createElement(f,{rerender:e.rerender,corp:e.corp,division:e.division,office:e.office,player:e.player}):r.a.createElement(y,{rerender:e.rerender,corp:e.corp,division:e.division,office:e.office,player:e.player}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(22),o=a(3),s=a(11),l=a(36),c=a(57);function u(e){const t=Math.round(e.office.size/l.a.OfficeInitialSize),a=l.a.OfficeInitialCost*Math.pow(1.09,t);let n=0;for(let e=0;e<5;++e)n+=Math.pow(1.09,t+e);const u=l.a.OfficeInitialCost*n,m=e.corp.funds.dividedBy(l.a.OfficeInitialCost).toNumber();let h=1;for(n=Math.pow(1.09,t);h<50&&!(n>=m);){const e=Math.pow(1.09,t+h);if(n+e>m)break;n+=e,++h}const p=l.a.OfficeInitialCost*n;function d(t,a){e.corp.funds.lt(t)?Object(s.a)("You don't have enough company funds to purchase this upgrade!"):(Object(c.y)(e.corp,e.office,a),Object(s.a)("Office space increased! It can now hold "+e.office.size+" employees"),e.rerender()),Object(i.b)(e.popupId)}function f(e){return r.a.createElement("button",{className:"tooltip "+(e.corp.funds.lt(e.cost)?"a-link-button-inactive":"a-link-button"),style:{display:"inline-block",margin:"4px"},onClick:()=>d(e.cost,e.size)},"by ",e.size,r.a.createElement("span",{className:"tooltiptext"},o.a.formatMoney(e.cost)))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Increase the size of your office space to fit additional employees!"),r.a.createElement("p",null,"Upgrade size: "),r.a.createElement(f,{corp:e.corp,cost:a,size:l.a.OfficeInitialSize}),r.a.createElement(f,{corp:e.corp,cost:u,size:5*l.a.OfficeInitialSize}),r.a.createElement(f,{corp:e.corp,cost:p,size:h*l.a.OfficeInitialSize}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(22),o=a(3),s=a(36),l=a(21),c=a(14),u=a(396),m=a(11);function h(e){const[t,a]=Object(n.useState)("");function o(){for(let a=0;a
This division's production multiplier is calculated by summing the individual production multiplier of each of its office locations. This production multiplier is applied to each office. Therefore, it is beneficial to expand into new cities as this can greatly increase the production multiplier of your entire Division.

Below are approximations for how effective each material is at boosting this industry's production multiplier (Bigger bars = more effective):

Hardware:    ${t(e.division.hwFac)}
Robots:      ${t(e.division.robFac)}
AI Cores:    ${t(e.division.aiFac)}
Real Estate: `+t(e.division.reFac))}},"?"),r.a.createElement("br",null)," ",r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip"},"Scientific Research: ",s.a.format(e.division.sciResearch.qty,"0.000a"),r.a.createElement("span",{className:"tooltiptext"},"Scientific Research increases the quality of the materials and products that you produce.")),r.a.createElement("button",{className:"help-tip",onClick:function(){const t="corporation-research-popup-box";Object(h.a)(t,m.a,{industry:e.division,popupId:t})}},"Research"))}(),r.a.createElement("br",null),r.a.createElement("u",{className:"industry-purchases-and-upgrades-header"},"Purchases & Upgrades"),r.a.createElement("br",null),function(){const a=[];for(const i in o.a){const s=o.a[i];if(e.division.hasResearch("AutoBrew")&&"Coffee"===s[4])continue;const l=s[0],c=s[1],u=s[2];let m=0;switch(l){case 0:m=e.office.employees.length*c;break;default:m=c*Math.pow(u,e.division.upgrades[l])}function n(){e.corp.funds.lt(m)||(e.corp.funds=e.corp.funds.minus(m),e.division.upgrade(s,{corporation:e.corp,office:e.office}),e.rerender())}a.push(t({key:i,onClick:n,text:r.a.createElement(r.a.Fragment,null,s[4]," - ",r.a.createElement(d.a,{money:m,corp:e.corp})),tooltip:s[5]}))}return a}()," ",r.a.createElement("br",null),e.division.makesProducts&&a)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(44),l=a(57);function c(e){const t=Object.keys(e.division.offices).filter(t=>0!==e.division.offices[t]),[a,c]=Object(n.useState)(t.length>0?t[0]:""),[u,m]=Object(n.useState)(""),[h,p]=Object(n.useState)(null),[d,f]=Object(n.useState)(null);if(e.division.hasMaximumNumberProducts())return r.a.createElement(r.a.Fragment,null);function g(){if(null!==h&&null!==d){try{Object(l.j)(e.corp,e.division,a,u,h,d)}catch(e){Object(i.a)(e+"")}Object(o.b)(e.popupId)}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{dangerouslySetInnerHTML:{__html:e.popupText}}),r.a.createElement("select",{className:"dropdown",style:{margin:"5px"},onChange:function(e){c(e.target.value)},defaultValue:a},t.map(e=>r.a.createElement("option",{key:e,value:e},e))),r.a.createElement("input",{onChange:function(e){m(e.target.value)},className:"text-input",style:{margin:"5px"},placeholder:(y=e.division.type,y===s.a.Food?"Restaurant Name":y===s.a.Healthcare?"Hospital Name":y===s.a.RealEstate?"Property Name":"Product Name")}),r.a.createElement("br",null),r.a.createElement("input",{onChange:function(e){""===e.target.value?p(null):p(parseFloat(e.target.value))},autoFocus:!0,type:"number",className:"text-input",style:{margin:"5px"},placeholder:"Design investment"}),r.a.createElement("input",{onChange:function(e){""===e.target.value?f(null):f(parseFloat(e.target.value))},onKeyDown:function(e){13===e.keyCode&&g()},type:"number",className:"text-input",style:{margin:"5px"},placeholder:"Marketing investment"}),r.a.createElement("button",{className:"std-button",onClick:g},"Develop Product"));var y}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(44),l=a(36),c=a(895),u=a(57);function m(e){const t=s.c[e.industry.type];return void 0===t?r.a.createElement(r.a.Fragment,null):(Object(n.useEffect)(()=>{{const t=document.getElementById(e.popupId+"-content");null!=t&&(t.style.minHeight="80vh")}const a=t.createTreantMarkup();a.chart.container="#"+e.popupId+"-content",a.chart.nodeAlign="BOTTOM",a.chart.rootOrientation="WEST",a.chart.siblingSeparation=40,a.chart.connectors={type:"step",style:{"arrow-end":"block-wide-long",stroke:"white","stroke-width":2}},Object(c.Treant)(a);const n=t.getAllNodes();for(let t=0;t{try{Object(u.n)(e.industry,n[t])}catch(e){return void Object(i.a)(e+"")}Object(i.a)(`Researched ${n[t]}. It may take a market cycle (~${l.a.SecsPerMarketCycle} seconds) before the effects of the Research apply.`),Object(o.b)(e.popupId)}):console.warn("Could not find Research Tree div for "+a)}}),r.a.createElement("div",{id:e.popupId},r.a.createElement("div",null,"Research points: ",e.industry.sciResearch.qty,r.a.createElement("br",null),"Multipliers from research:",r.a.createElement("br",null),"* Advertising Multiplier: x",t.getAdvertisingMultiplier(),r.a.createElement("br",null),"* Employee Charisma Multiplier: x",t.getEmployeeChaMultiplier(),r.a.createElement("br",null),"* Employee Creativity Multiplier: x",t.getEmployeeCreMultiplier(),r.a.createElement("br",null),"* Employee Efficiency Multiplier: x",t.getEmployeeEffMultiplier(),r.a.createElement("br",null),"* Employee Intelligence Multiplier: x",t.getEmployeeIntMultiplier(),r.a.createElement("br",null),"* Production Multiplier: x",t.getProductionMultiplier(),r.a.createElement("br",null),"* Sales Multiplier: x",t.getSalesMultiplier(),r.a.createElement("br",null),"* Scientific Research Multiplier: x",t.getScientificResearchMultiplier(),r.a.createElement("br",null),"* Storage Multiplier: x",t.getStorageMultiplier())))}},,function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return IndustryWarehouse}));var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),react__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__),_data_Constants__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(36),_OfficeSpace__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(313),_Material__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(148),_Product__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(352),_Warehouse__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(188),_DiscontinueProductPopup__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(897),_ExportPopup__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(898),_LimitProductProductionPopup__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(899),_MaterialMarketTaPopup__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(900),_SellMaterialPopup__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(901),_SellProductPopup__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(902),_PurchaseMaterialPopup__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(903),_ProductMarketTaPopup__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(904),_SmartSupplyPopup__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(905),_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(3),_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(22),_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(95),_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(15),_MoneyCost__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__(102),_Helpers__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__(906),_IndustryProductEquation__WEBPACK_IMPORTED_MODULE_21__=__webpack_require__(907),_Actions__WEBPACK_IMPORTED_MODULE_22__=__webpack_require__(57);function ProductComponent(props){const corp=props.corp,division=props.division,city=props.city,product=props.product,nf="0.000",nfB="0.000a",hasUpgradeDashboard=division.hasResearch("uPgrade: Dashboard"),totalGain=product.data[city][1]-product.data[city][2];let sellButtonText;if(sellButtonText=product.sllman[city][0]?Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_17__.a)(product.sllman[city][1])?react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.data[city][2],nfB),"/",product.sllman[city][1],")"):react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.data[city][2],nfB),"/",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.sllman[city][1],nfB),")"):react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (0.000/0.000)"),product.marketTa2)sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:product.marketTa2Price[city]}));else if(product.marketTa1){const e=product.rat/product.mku;sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:product.pCost+e}))}else if(product.sCost)if(Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_17__.a)(product.sCost)){const sCost=product.sCost.replace(/MP/g,product.pCost+"");sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:eval(sCost)}))}else sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:product.sCost}));function openSellProductPopup(){const e="cmpy-mgmt-limit-product-production-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_SellProductPopup__WEBPACK_IMPORTED_MODULE_11__.a,{product:product,city:city,popupId:e})}let limitProductionButtonText="Limit Production";function openLimitProductProdutionPopup(){const e="cmpy-mgmt-limit-product-production-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_LimitProductProductionPopup__WEBPACK_IMPORTED_MODULE_8__.a,{product:product,city:city,popupId:e})}function openDiscontinueProductPopup(){const e="cmpy-mgmt-discontinue-product-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_DiscontinueProductPopup__WEBPACK_IMPORTED_MODULE_6__.a,{rerender:props.rerender,product:product,industry:division,corp:props.corp,popupId:e,player:props.player})}function openProductMarketTaPopup(){const e="cmpy-mgmt-marketta-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_ProductMarketTaPopup__WEBPACK_IMPORTED_MODULE_13__.a,{product:product,industry:division,popupId:e})}return product.prdman[city][0]&&(limitProductionButtonText+=" ("+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.prdman[city][1],nf)+")"),product.fin?react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{className:"cmpy-mgmt-warehouse-product-div"},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},product.name,": ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.data[city][0],nfB)," (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(totalGain,nfB),"/s)",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"Prod: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.data[city][1],nfB),"/s",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Sell: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.data[city][2],nfB)," /s")),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},"Rating: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.rat,nf),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"Quality: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.qlt,nf)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Performance: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.per,nf)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Durability: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.dur,nf)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Reliability: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.rel,nf)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Aesthetics: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.aes,nf)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Features: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.fea,nf),1===corp.unlockUpgrades[2]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),1===corp.unlockUpgrades[2]&&"Demand: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.dmd,nf),1===corp.unlockUpgrades[3]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),1===corp.unlockUpgrades[3]&&"Competition: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.cmp,nf))),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},"Est. Production Cost:"," ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.formatMoney(product.pCost/_data_Constants__WEBPACK_IMPORTED_MODULE_1__.a.ProductProductionCostRatio),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"An estimate of the material cost it takes to create this Product.")),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},"Est. Market Price: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.formatMoney(product.pCost),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"An estimate of how much consumers are willing to pay for this product. Setting the sale price above this may result in less sales. Setting the sale price below this may result in more sales.")),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openSellProductPopup},sellButtonText),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openLimitProductProdutionPopup},limitProductionButtonText),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openDiscontinueProductPopup},"Discontinue"),division.hasResearch("Market-TA.I")&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openProductMarketTaPopup},"Market-TA"))):react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{className:"cmpy-mgmt-warehouse-product-div"},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,"Designing ",product.name," (req. Operations/Engineers in ",product.createCity,")..."),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(product.prog,"0.00"),"% complete"),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),hasUpgradeDashboard&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openSellProductPopup},sellButtonText),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openLimitProductProdutionPopup},limitProductionButtonText),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openDiscontinueProductPopup},"Discontinue"),division.hasResearch("Market-TA.I")&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openProductMarketTaPopup},"Market-TA")))}function MaterialComponent(props){const corp=props.corp,division=props.division,warehouse=props.warehouse,city=props.city,mat=props.mat,markupLimit=mat.getMarkupLimit(),office=division.offices[city];if(!(office instanceof _OfficeSpace__WEBPACK_IMPORTED_MODULE_2__.a))throw new Error(`Could not get OfficeSpace object for this city (${city})`);const nf="0.000",nfB="0.000a",totalGain=mat.buy+mat.prd+mat.imp-mat.sll-mat.totalExp,tutorial=division.newInd&&Object.keys(division.reqMats).includes(mat.name)&&0===mat.buy&&0===mat.imp,purchaseButtonText=`Buy (${_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.buy,nfB)})`,purchaseButtonClass=tutorial?"std-button flashing-button tooltip":"std-button";function openPurchaseMaterialPopup(){const e="cmpy-mgmt-material-purchase-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_PurchaseMaterialPopup__WEBPACK_IMPORTED_MODULE_12__.a,{mat:mat,industry:division,warehouse:warehouse,corp:props.corp,popupId:e})}function openExportPopup(){const e="cmpy-mgmt-export-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_ExportPopup__WEBPACK_IMPORTED_MODULE_7__.a,{mat:mat,corp:props.corp,popupId:e})}let sellButtonText;if(mat.sllman[0]){if(sellButtonText=Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_17__.a)(mat.sllman[1])?react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.sll,nfB),"/",mat.sllman[1],")"):react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.sll,nfB),"/",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.sllman[1],nfB),")"),mat.marketTa2)sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:mat.marketTa2Price}));else if(mat.marketTa1)sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:mat.bCost+markupLimit}));else if(mat.sCost)if(Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_17__.a)(mat.sCost)){const sCost=mat.sCost.replace(/MP/g,mat.bCost+"");sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:eval(sCost)}))}else sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,sellButtonText," @ ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_18__.a,{money:mat.sCost}))}else sellButtonText=react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,"Sell (0.000/0.000)");function openSellMaterialPopup(){const e="cmpy-mgmt-material-sell-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_SellMaterialPopup__WEBPACK_IMPORTED_MODULE_10__.a,{mat:mat,corp:props.corp,popupId:e})}function openMaterialMarketTaPopup(){const e="cmpy-mgmt-export-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(e,_MaterialMarketTaPopup__WEBPACK_IMPORTED_MODULE_9__.a,{mat:mat,industry:division,corp:props.corp,popupId:e})}function shouldFlash(){return props.division.prodMats.includes(props.mat.name)&&!mat.sllman[0]}return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{className:"cmpy-mgmt-warehouse-material-div"},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{style:{display:"inline-block"}},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},mat.name,": ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.qty,nfB)," (",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(totalGain,nfB),"/s)",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"Buy: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.buy,nfB)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Prod: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.prd,nfB)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Sell: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.sll,nfB)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Export: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.totalExp,nfB)," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),"Import: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.imp,nfB),1===corp.unlockUpgrades[2]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),1===corp.unlockUpgrades[2]&&"Demand: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.dmd,nf),1===corp.unlockUpgrades[3]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),1===corp.unlockUpgrades[3]&&"Competition: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.cmp,nf))),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},"MP: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.formatMoney(mat.bCost),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"Market Price: The price you would pay if you were to buy this material on the market"))," ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip"},"Quality: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.format(mat.qlt,"0.00a"),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"The quality of your material. Higher quality will lead to more sales"))),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{style:{display:"inline-block"}},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:purchaseButtonClass,onClick:openPurchaseMaterialPopup,disabled:props.warehouse.smartSupplyEnabled&&Object.keys(props.division.reqMats).includes(props.mat.name)},purchaseButtonText,tutorial&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext"},"Purchase your required materials to get production started!")),1===corp.unlockUpgrades[0]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openExportPopup},"Export"),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button"+(shouldFlash()?" flashing-button":""),onClick:openSellMaterialPopup},sellButtonText),division.hasResearch("Market-TA.I")&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:openMaterialMarketTaPopup},"Market-TA")))}function IndustryWarehouse(e){return e.warehouse instanceof _Warehouse__WEBPACK_IMPORTED_MODULE_5__.a?function(){if(0===e.warehouse)return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null);const t={color:e.warehouse.sizeUsed>=e.warehouse.size?"red":"white",margin:"5px"},a=_data_Constants__WEBPACK_IMPORTED_MODULE_1__.a.WarehouseUpgradeBaseCost*Math.pow(1.07,e.warehouse.level+1),n=e.corp.funds.gt(a)?"std-button":"a-link-button-inactive",r=[];for(const t in e.division.reqMats)if(e.division.reqMats.hasOwnProperty(t)){const a=[" *",e.division.reqMats[t],t].join(" ");r.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{key:t},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,a)))}let i;switch(e.division.state){case"START":i="Current state: Preparing...";break;case"PURCHASE":i="Current state: Purchasing materials...";break;case"PRODUCTION":i="Current state: Producing materials and/or products...";break;case"SALE":i="Current state: Selling materials and/or products...";break;case"EXPORT":i="Current state: Exporting materials and/or products...";break;default:console.error("Invalid state: "+e.division.state)}const o=[];for(const t in e.warehouse.materials)e.warehouse.materials[t]instanceof _Material__WEBPACK_IMPORTED_MODULE_3__.a&&Object(_Helpers__WEBPACK_IMPORTED_MODULE_20__.a)(t,e.division)&&o.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(MaterialComponent,{rerender:e.rerender,city:e.currentCity,corp:e.corp,division:e.division,key:t,mat:e.warehouse.materials[t],warehouse:e.warehouse}));const s=[];if(e.division.makesProducts&&Object.keys(e.division.products).length>0)for(const t in e.division.products){const a=e.division.products[t];a instanceof _Product__WEBPACK_IMPORTED_MODULE_4__.a&&s.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ProductComponent,{rerender:e.rerender,player:e.player,city:e.currentCity,corp:e.corp,division:e.division,key:t,product:a}))}return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{className:"cmpy-mgmt-warehouse-panel"},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",{className:"tooltip",style:t},"Storage: ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.formatBigNumber(e.warehouse.sizeUsed)," /"," ",_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_15__.a.formatBigNumber(e.warehouse.size),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span",{className:"tooltiptext",dangerouslySetInnerHTML:{__html:e.warehouse.breakdown}})),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:n,onClick:function(){null!==e.division&&0!==e.warehouse&&(++e.warehouse.level,e.warehouse.updateSize(e.corp,e.division),e.corp.funds=e.corp.funds.minus(a),e.rerender())}},"Upgrade Warehouse Size - ",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_MoneyCost__WEBPACK_IMPORTED_MODULE_19__.a,{money:a,corp:e.corp})),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,"This industry uses the following equation for it's production: "),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_IndustryProductEquation__WEBPACK_IMPORTED_MODULE_21__.a,{division:e.division}),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,"To get started with production, purchase your required materials or import them from another of your company's divisions."),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br",null),react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p",null,i),e.corp.unlockUpgrades[1]&&react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment,null,react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:function(){if(0===e.warehouse)return;const t="cmpy-mgmt-smart-supply-popup";Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_16__.a)(t,_SmartSupplyPopup__WEBPACK_IMPORTED_MODULE_14__.a,{division:e.division,warehouse:e.warehouse,corp:e.corp,player:e.player,popupId:t})}},"Configure Smart Supply")),o,s)}():react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{className:"cmpy-mgmt-warehouse-panel"},react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button",{className:"std-button",onClick:()=>{return t=e.division,a=e.currentCity,Object(_Actions__WEBPACK_IMPORTED_MODULE_22__.m)(e.corp,t,a),void e.rerender();var t,a},disabled:e.corp.funds.lt(_data_Constants__WEBPACK_IMPORTED_MODULE_1__.a.WarehouseInitialCost)},"Purchase Warehouse (",react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_MoneyCost__WEBPACK_IMPORTED_MODULE_19__.a,{money:_data_Constants__WEBPACK_IMPORTED_MODULE_1__.a.WarehouseInitialCost,corp:e.corp}),")"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(22);function o(e){return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Are you sure you want to do this? Discontinuing a product removes it completely and permanently. You will no longer produce this product and all of its existing stock will be removed and left unsold"),r.a.createElement("button",{className:"popup-box-button",onClick:function(){e.industry.discontinueProduct(e.product),Object(i.b)(e.popupId),e.rerender()}},"Discontinue"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(57);function l(e){if(0===e.corp.divisions.length)throw new Error("Export popup created with no divisions.");if(0===Object.keys(e.corp.divisions[0].warehouses).length)throw new Error("Export popup created in a division with no warehouses.");const[t,a]=Object(n.useState)(e.corp.divisions[0].name),[l,c]=Object(n.useState)(Object.keys(e.corp.divisions[0].warehouses)[0]),[u,m]=Object(n.useState)(""),h=Object(n.useState)(!1)[1];function p(t){for(let a=0;a!e)}const d=e.corp.divisions.find(e=>e.name===t);if(void 0===d)throw new Error(`Export popup somehow ended up with undefined division '${d}'`);const f=Object.keys(d.warehouses).filter(e=>0!==d.warehouses[e]);return f.length>0&&!f.includes(l)&&c(f[0]),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Select the industry and city to export this material to, as well as how much of this material to export per second. You can set the export amount to 'MAX' to export all of the materials in this warehouse."),r.a.createElement("select",{className:"dropdown",onChange:function(e){a(e.target.value)},defaultValue:t},e.corp.divisions.map(e=>r.a.createElement("option",{key:e.name,value:e.name},e.name))),r.a.createElement("select",{className:"dropdown",onChange:function(e){c(e.target.value)},defaultValue:l},f.map(e=>{if(0!==d.warehouses[e])return r.a.createElement("option",{key:e,value:e},e)})),r.a.createElement("input",{className:"text-input",placeholder:"Export amount / s",onChange:function(e){m(e.target.value)}}),r.a.createElement("button",{className:"std-button",style:{display:"inline-block"},onClick:function(){try{Object(s.e)(t,l,e.mat,u)}catch(e){Object(i.a)(e+"")}Object(o.b)(e.popupId)}},"Export"),r.a.createElement("p",null,"Below is a list of all current exports of this material from this warehouse. Clicking on one of the exports below will REMOVE that export."),e.mat.exp.map((e,t)=>r.a.createElement("div",{key:t,className:"cmpy-mgmt-existing-export",onClick:()=>p(e)},"Industry: ",e.ind,r.a.createElement("br",null),"City: ",e.city,r.a.createElement("br",null),"Amount/s: ",e.amt)))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(22),o=a(57);function s(e){const[t,a]=Object(n.useState)(null);function s(){let a=t;null===a&&(a=-1),Object(o.i)(e.product,e.city,a),Object(i.b)(e.popupId)}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter a limit to the amount of this product you would like to product per second. Leave the box empty to set no limit."),r.a.createElement("input",{autoFocus:!0,className:"text-input",style:{margin:"5px"},placeholder:"Limit",type:"number",onChange:function(e){""===e.target.value?a(null):a(parseFloat(e.target.value))},onKeyDown:function(e){13===e.keyCode&&s()}}),r.a.createElement("button",{className:"std-button",style:{margin:"5px",display:"inline-block"},onClick:s},"Limit production"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(3);function o(e){if(!e.industry.hasResearch("Market-TA.II"))return r.a.createElement(r.a.Fragment,null);const[t,a]=Object(n.useState)(e.mat.bCost),o=Object(n.useState)(!1)[1];const s=e.mat.getMarkupLimit();const l=t;let c=1;return l>e.mat.bCost?l-e.mat.bCost>s&&(c=Math.pow(s/(l-e.mat.bCost),2)):l!e)},checked:e.mat.marketTa2,style:{margin:"3px"}})),r.a.createElement("p",null,"Note that Market-TA.II overrides Market-TA.I. This means that if both are enabled, then Market-TA.II will take effect, not Market-TA.I"))}function s(e){const t=Object(n.useState)(!1)[1];const a=e.mat.getMarkupLimit();return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("u",null,r.a.createElement("strong",null,"Market-TA.I")),r.a.createElement("br",null),"The maximum sale price you can mark this up to is ",i.a.formatMoney(e.mat.bCost+a),". This means that if you set the sale price higher than this, you will begin to experience a loss in number of sales"),r.a.createElement("div",{style:{display:"block"}},r.a.createElement("label",{className:"tooltip",htmlFor:"cmpy-mgmt-marketa1-checkbox",style:{color:"white"}},"Use Market-TA.I for Auto-Sale Price",r.a.createElement("span",{className:"tooltiptext"},"If this is enabled, then this Material will automatically be sold at the price identified by Market-TA.I (i.e. the price shown above)")),r.a.createElement("input",{id:"cmpy-mgmt-marketa1-checkbox",type:"checkbox",onChange:function(a){e.mat.marketTa1=a.target.checked,t(e=>!e)},checked:e.mat.marketTa1,style:{margin:"3px"}})),r.a.createElement(o,{mat:e.mat,industry:e.industry}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(57);function l(e){const[t,a]=Object(n.useState)(e.mat.sllman[1]?e.mat.sllman[1]+"":""),[l,c]=Object(n.useState)(function(e){let t=e.sCost?e.sCost+"":"";return e.marketTa2?t+=" (Market-TA.II)":e.marketTa1&&(t+=" (Market-TA.I)"),t}(e.mat));function u(){try{Object(s.o)(e.mat,t,l)}catch(e){Object(i.a)(e+"")}Object(o.b)(e.popupId)}function m(e){13===e.keyCode&&u()}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the maximum amount of ",e.mat.name," you would like to sell per second, as well as the price at which you would like to sell at.",r.a.createElement("br",null),r.a.createElement("br",null),"If the sell amount is set to 0, then the material will not be sold. If the sell price if set to 0, then the material will be discarded",r.a.createElement("br",null),r.a.createElement("br",null),"Setting the sell amount to 'MAX' will result in you always selling the maximum possible amount of the material.",r.a.createElement("br",null),r.a.createElement("br",null),"When setting the sell amount, you can use the 'PROD' variable to designate a dynamically changing amount that depends on your production. For example, if you set the sell amount to 'PROD-5' then you will always sell 5 less of the material than you produce.",r.a.createElement("br",null),r.a.createElement("br",null),"When setting the sell price, you can use the 'MP' variable to designate a dynamically changing price that depends on the market price. For example, if you set the sell price to 'MP+10' then it will always be sold at $10 above the market price."),r.a.createElement("br",null),r.a.createElement("input",{className:"text-input",value:t,autoFocus:!0,type:"text",placeholder:"Sell amount",style:{marginTop:"4px"},onChange:function(e){a(e.target.value)},onKeyDown:m}),r.a.createElement("input",{className:"text-input",value:l,type:"text",placeholder:"Sell price",style:{marginTop:"4px"},onChange:function(e){c(e.target.value)},onKeyDown:m}),r.a.createElement("button",{className:"std-button",onClick:u},"Confirm"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(57);function l(e){const[t,a]=Object(n.useState)(!0),[l,c]=Object(n.useState)(e.product.sllman[e.city][1]?e.product.sllman[e.city][1]:""),[u,m]=Object(n.useState)(function(e){let t=e.sCost?e.sCost+"":"";return e.marketTa2?t+=" (Market-TA.II)":e.marketTa1&&(t+=" (Market-TA.I)"),t}(e.product));function h(){try{Object(s.p)(e.product,e.city,l,u,t)}catch(e){Object(i.a)(e+"")}Object(o.b)(e.popupId)}function p(e){13===e.keyCode&&h()}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the maximum amount of ",e.product.name," you would like to sell per second, as well as the price at which you would like to sell it at.",r.a.createElement("br",null),r.a.createElement("br",null),"If the sell amount is set to 0, then the product will not be sold. If the sell price is set to 0, then the product will be discarded.",r.a.createElement("br",null),r.a.createElement("br",null),"Setting the sell amount to 'MAX' will result in you always selling the maximum possible amount of the material.",r.a.createElement("br",null),r.a.createElement("br",null),"When setting the sell amount, you can use the 'PROD' variable to designate a dynamically changing amount that depends on your production. For example, if you set the sell amount to 'PROD-1' then you will always sell 1 less of the material than you produce.",r.a.createElement("br",null),r.a.createElement("br",null),"When setting the sell price, you can use the 'MP' variable to set a dynamically changing price that depends on the Product's estimated market price. For example, if you set it to 'MP*5' then it will always be sold at five times the estimated market price."),r.a.createElement("br",null),r.a.createElement("input",{className:"text-input",value:l,autoFocus:!0,type:"text",placeholder:"Sell amount",style:{marginTop:"4px"},onChange:function(e){c(e.target.value)},onKeyDown:p}),r.a.createElement("input",{className:"text-input",value:u,type:"text",placeholder:"Sell price",style:{marginTop:"4px"},onChange:function(e){m(e.target.value)},onKeyDown:p}),r.a.createElement("button",{className:"std-button",onClick:h},"Confirm"),r.a.createElement("div",{style:{border:"1px solid white",display:"inline-block"}},r.a.createElement("label",{htmlFor:e.popupId+"-checkbox"},"Use same 'Sell Amount' for all cities"),r.a.createElement("input",{checked:t,onChange:function(e){a(e.target.checked)},id:e.popupId+"-checkbox",style:{margin:"2px"},type:"checkbox"})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(154),l=a(3),c=a(57);function u(e){const t=parseFloat(e.amount),a=t*e.mat.bCost,n=s.a[e.mat.name];return t*n>(e.warehouse.size-e.warehouse.sizeUsed)/n?r.a.createElement(r.a.Fragment,null,"Not enough warehouse space to purchase this amount"):isNaN(a)?r.a.createElement(r.a.Fragment,null,"Invalid put for Bulk Purchase amount"):r.a.createElement(r.a.Fragment,null,"Purchasing ",l.a.format(t,"0,0.00")," of ",e.mat.name," will cost"," ",l.a.formatMoney(a))}function m(e){const[t,a]=Object(n.useState)("");function l(){const a=parseFloat(t),n=s.a[e.mat.name];if(a*n>(e.warehouse.size-e.warehouse.sizeUsed)/n)Object(i.a)("You do not have enough warehouse size to fit this purchase");else if(isNaN(a))Object(i.a)("Invalid input amount");else{const t=a*e.mat.bCost;if(!e.corp.funds.gt(t))return void Object(i.a)("You cannot afford this purchase.");e.corp.funds=e.corp.funds.minus(t),e.mat.qty+=a,Object(o.b)(e.popupId)}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the amount of ",e.mat.name," you would like to bulk purchase. This purchases the specified amount instantly (all at once)."),r.a.createElement(u,{warehouse:e.warehouse,mat:e.mat,amount:t}),r.a.createElement("input",{onChange:function(e){a(e.target.value)},type:"number",placeholder:"Bulk Purchase amount",style:{margin:"5px"},onKeyDown:function(e){13===e.keyCode&&l()}}),r.a.createElement("button",{className:"std-button",onClick:l},"Confirm Bulk Purchase"))}function h(e){const[t,a]=Object(n.useState)(e.mat.buy?e.mat.buy:null);function s(){if(null!==t){try{Object(c.c)(e.mat,t)}catch(e){Object(i.a)(e+"")}Object(o.b)(e.popupId)}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the amount of ",e.mat.name," you would like to purchase per second. This material's cost changes constantly."),r.a.createElement("input",{onChange:function(e){a(parseFloat(e.target.value))},className:"text-input",autoFocus:!0,placeholder:"Purchase amount",type:"number",style:{margin:"5px"},onKeyDown:function(e){13===e.keyCode&&s()}}),r.a.createElement("button",{onClick:s,className:"std-button"},"Confirm"),r.a.createElement("button",{onClick:function(){e.mat.buy=0,Object(o.b)(e.popupId)},className:"std-button"},"Clear Purchase"),e.industry.hasResearch("Bulk Purchasing")&&r.a.createElement(m,{corp:e.corp,mat:e.mat,industry:e.industry,warehouse:e.warehouse,popupId:e.popupId}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(3);function o(e){const t=e.product.rat/e.product.mku,[a,o]=Object(n.useState)(e.product.pCost),s=Object(n.useState)(!1)[1];const l=a;let c=1;return l>e.product.pCost&&l-e.product.pCost>t&&(c=t/(l-e.product.pCost)),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("br",null),r.a.createElement("u",null,r.a.createElement("strong",null,"Market-TA.II")),r.a.createElement("br",null),"If you sell at ",i.a.formatMoney(l),", then you will sell"," ",i.a.format(c,"0.00000"),"x as much compared to if you sold at market price."),r.a.createElement("input",{className:"text-input",onChange:function(e){o(parseFloat(e.target.value))},value:a,type:"number",style:{marginTop:"4px"}}),r.a.createElement("div",{style:{display:"block"}},r.a.createElement("label",{className:"tooltip",htmlFor:"cmpy-mgmt-marketa2-checkbox",style:{color:"white"}},"Use Market-TA.II for Auto-Sale Price",r.a.createElement("span",{className:"tooltiptext"},"If this is enabled, then this Product will automatically be sold at the optimal price such that the amount sold matches the amount produced. (i.e. the highest possible price, while still ensuring that all produced materials will be sold).")),r.a.createElement("input",{className:"text-input",onChange:function(t){e.product.marketTa2=t.target.checked,s(e=>!e)},id:"cmpy-mgmt-marketa2-checkbox",style:{margin:"3px"},type:"checkbox",checked:e.product.marketTa2})),r.a.createElement("p",null,"Note that Market-TA.II overrides Market-TA.I. This means that if both are enabled, then Market-TA.II will take effect, not Market-TA.I"))}function s(e){const t=e.product.rat/e.product.mku,a=Object(n.useState)(!1)[1];return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("u",null,r.a.createElement("strong",null,"Market-TA.I")),r.a.createElement("br",null),"The maximum sale price you can mark this up to is"," ",i.a.formatMoney(e.product.pCost+t),". This means that if you set the sale price higher than this, you will begin to experience a loss in number of sales."),r.a.createElement("div",{style:{display:"block"}},r.a.createElement("label",{className:"tooltip",htmlFor:"cmpy-mgmt-marketa1-checkbox",style:{color:"white"}},"Use Market-TA.I for Auto-Sale Price",r.a.createElement("span",{className:"tooltiptext"},"If this is enabled, then this Product will automatically be sold at the price identified by Market-TA.I (i.e. the price shown above).")),r.a.createElement("input",{onChange:function(t){e.product.marketTa1=t.target.checked,a(e=>!e)},className:"text-input",id:"cmpy-mgmt-marketa1-checkbox",style:{margin:"3px"},type:"checkbox",checked:e.product.marketTa1})),e.industry.hasResearch("Market-TA.II")&&r.a.createElement(o,{product:e.product,industry:e.industry,popupId:e.popupId}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(57),o=a(148),s=a(11);function l(e){const[t,a]=Object(n.useState)(!!e.warehouse.smartSupplyUseLeftovers[e.matName]);const o=e.matName+"-use-leftovers";return r.a.createElement("div",{key:e.matName},r.a.createElement("label",{style:{color:"white"},htmlFor:o},e.warehouse.materials[e.matName].name),r.a.createElement("input",{type:"checkbox",id:o,onChange:function(t){try{const a=e.warehouse.materials[e.matName];Object(i.v)(e.warehouse,a,t.target.checked)}catch(e){Object(s.a)(e+"")}a(t.target.checked)},style:{margin:"3px"},checked:t}),r.a.createElement("br",null))}function c(e){const t=Object(n.useState)(!1)[1];const a=[];for(const t in e.warehouse.materials)e.warehouse.materials[t]instanceof o.a&&Object.keys(e.division.reqMats).includes(t)&&a.push(r.a.createElement(l,{key:t,warehouse:e.warehouse,matName:t}));return r.a.createElement(r.a.Fragment,null,r.a.createElement("label",{style:{color:"white"},htmlFor:"cmpy-mgmt-smart-supply-checkbox"},"Enable Smart Supply"),r.a.createElement("input",{type:"checkbox",id:"cmpy-mgmt-smart-supply-checkbox",onChange:function(a){Object(i.u)(e.warehouse,a.target.checked),t(e=>!e)},style:{margin:"3px"},checked:e.warehouse.smartSupplyEnabled}),r.a.createElement("br",null),r.a.createElement("p",null,"Use materials already in the warehouse instead of buying new ones, if available:"),a)}},function(e,t,a){"use strict";function n(e,t){return!!Object.keys(t.reqMats).includes(e)||(!!t.prodMats.includes(e)||!!["Hardware","Robots","AICores","RealEstate"].includes(e))}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(208);function o(e){const t=[];for(const a of Object.keys(e.division.reqMats)){const n=e.division.reqMats[a];void 0!==n&&t.push(String.raw`${n}\text{ }${a}`)}const a=e.division.prodMats.slice();return e.division.makesProducts&&a.push(e.division.type),r.a.createElement("span",{className:"text"},r.a.createElement(i.a,{display:!1,tex:t.join("+")+String.raw`\Rightarrow`+a.map(e=>String.raw`1\text{ }${e}`).join("+")}))}},,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return _}));var n=a(0),r=a.n(n),i=a(913),o=a(914),s=a(915),l=a(916),c=a(917),u=a(918),m=a(919),h=a(920),p=a(921),d=a(36),f=a(377),g=a(378),y=a(4),b=a(3),E=a(14),v=a(22),k=a(15);function _({corp:e,player:t,rerender:a}){const n=e.revenue.minus(e.expenses).toNumber();return r.a.createElement("div",null,r.a.createElement("p",null,"Total Funds: ",r.a.createElement(k.a,{money:e.funds.toNumber()}),r.a.createElement("br",null),"Total Revenue: ",r.a.createElement(k.a,{money:e.revenue.toNumber()})," / s",r.a.createElement("br",null),"Total Expenses: ",r.a.createElement(k.a,{money:e.expenses.toNumber()})," / s",r.a.createElement("br",null),"Total Profits: ",r.a.createElement(k.a,{money:n})," / s",r.a.createElement("br",null),r.a.createElement(T,{corp:e,profit:n}),"Publicly Traded: ",e.public?"Yes":"No",r.a.createElement("br",null),"Owned Stock Shares: ",b.a.format(e.numShares,"0.000a"),r.a.createElement("br",null),"Stock Price: ",e.public?r.a.createElement(k.a,{money:e.sharePrice}):"N/A",r.a.createElement("br",null)),r.a.createElement("p",{className:"tooltip"},"Total Stock Shares: ",b.a.format(e.totalShares,"0.000a"),r.a.createElement("span",{className:"tooltiptext"},"Outstanding Shares: ",b.a.format(e.issuedShares,"0.000a"),r.a.createElement("br",null),"Private Shares: ",b.a.format(e.totalShares-e.issuedShares-e.numShares,"0.000a"))),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(M,{name:"Production Multiplier: ",mult:e.getProductionMultiplier()}),r.a.createElement(M,{name:"Storage Multiplier: ",mult:e.getStorageMultiplier()}),r.a.createElement(M,{name:"Advertising Multiplier: ",mult:e.getAdvertisingMultiplier()}),r.a.createElement(M,{name:"Empl. Creativity Multiplier: ",mult:e.getEmployeeCreMultiplier()}),r.a.createElement(M,{name:"Empl. Charisma Multiplier: ",mult:e.getEmployeeChaMultiplier()}),r.a.createElement(M,{name:"Empl. Intelligence Multiplier: ",mult:e.getEmployeeIntMultiplier()}),r.a.createElement(M,{name:"Empl. Efficiency Multiplier: ",mult:e.getEmployeeEffMultiplier()}),r.a.createElement(M,{name:"Sales Multiplier: ",mult:e.getSalesMultiplier()}),r.a.createElement(M,{name:"Scientific Research Multiplier: ",mult:e.getScientificResearchMultiplier()}),r.a.createElement("br",null),r.a.createElement(P,{corp:e}),r.a.createElement("div",null,r.a.createElement(x,{className:"a-link-button",display:"inline-block",onClick:()=>e.getStarterGuide(t),text:"Getting Started Guide",tooltip:"Get a copy of and read 'The Complete Handbook for Creating a Successful Corporation.' This is a .lit file that guides you through the beginning of setting up a Corporation and provides some tips/pointers for helping you get started with managing it."}),e.public?r.a.createElement(S,{corp:e,player:t,rerender:a}):r.a.createElement(w,{corp:e,player:t,rerender:a}),r.a.createElement(O,{corp:e,player:t})),r.a.createElement("br",null),r.a.createElement(C,{corp:e,player:t,rerender:a}))}function w({corp:e,player:t,rerender:a}){const n=e.fundingRound<4,i=n?"std-button":"a-link-button-inactive",o=n?"Search for private investors who will give you startup funding in exchangefor equity (stock shares) in your company":void 0;return r.a.createElement(r.a.Fragment,null,r.a.createElement(x,{className:i,onClick:function(){const n="cmpy-mgmt-find-investors-popup";Object(v.a)(n,h.a,{rerender:a,player:t,popupId:n,corp:e})},text:"Find Investors",tooltip:o,display:"inline-block"}),r.a.createElement(x,{className:"std-button",onClick:function(){const n="cmpy-mgmt-go-public-popup";Object(v.a)(n,p.a,{rerender:a,player:t,popupId:n,corp:e})},display:"inline-block",text:"Go Public",tooltip:"Become a publicly traded and owned entity. Going public involves issuing shares for an IPO. Once you are a public company, your shares will be traded on the stock market."}),r.a.createElement("br",null))}function C({corp:e,player:t,rerender:a}){return e.divisions.length<=0?r.a.createElement("h1",null,"Upgrades are unlocked once you create an industry."):r.a.createElement("div",{className:"cmpy-mgmt-upgrade-container"},r.a.createElement("h1",{className:"cmpy-mgmt-upgrade-header"}," Unlocks "),Object.values(f.a).filter(t=>0===e.unlockUpgrades[t[0]]).map(n=>r.a.createElement(o.a,{rerender:a,player:t,corp:e,upgradeData:n,key:n[0]})),r.a.createElement("h1",{className:"cmpy-mgmt-upgrade-header"}," Upgrades "),e.upgrades.map((e,t)=>g.a[t]).map(n=>r.a.createElement(i.a,{rerender:a,player:t,corp:e,upgrade:n,key:n[0]})))}function S({corp:e,player:t,rerender:a}){const n=e.shareSaleCooldown>0,i=n?"a-link-button-inactive":"std-button",o=n?"Cannot sell shares for "+e.convertCooldownToString(e.shareSaleCooldown):"Sell your shares in the company. The money earned from selling your shares goes into your personal account, not the Corporation's. This is one of the only ways to profit from your business venture.",s=e.issueNewSharesCooldown>0,h=s?"a-link-button-inactive":"std-button",p=s?"Cannot issue new shares for "+e.convertCooldownToString(e.issueNewSharesCooldown):"Issue new equity shares to raise capital.";return r.a.createElement(r.a.Fragment,null,r.a.createElement(x,{className:i,display:"inline-block",onClick:function(){const n="cmpy-mgmt-sell-shares-popup";Object(v.a)(n,l.a,{corp:e,player:t,popupId:n,rerender:a})},text:"Sell Shares",tooltip:o}),r.a.createElement(x,{className:"std-button",display:"inline-block",onClick:function(){const n="corp-buyback-shares-popup";Object(v.a)(n,c.a,{rerender:a,player:t,popupId:n,corp:e})},text:"Buyback shares",tooltip:"Buy back shares you that previously issued or sold at market price."}),r.a.createElement("br",null),r.a.createElement(x,{className:h,display:"inline-block",onClick:function(){const t="cmpy-mgmt-issue-new-shares-popup";Object(v.a)(t,m.a,{popupId:t,corp:e})},text:"Issue New Shares",tooltip:p}),r.a.createElement(x,{className:"std-button",display:"inline-block",onClick:function(){const t="cmpy-mgmt-issue-dividends-popup";Object(v.a)(t,u.a,{popupId:t,corp:e})},text:"Issue Dividends",tooltip:"Manage the dividends that are paid out to shareholders (including yourself)"}),r.a.createElement("br",null))}function x({className:e="std-button",text:t,display:a,tooltip:n,onClick:i}){const o=null!=n;return o&&(e+=" tooltip"),r.a.createElement("button",{className:e,onClick:i,style:{display:a||"block"}},t,o&&r.a.createElement("span",{className:"tooltiptext"},n))}function O({player:e,corp:t}){const a=t.determineValuation()>=d.a.BribeThreshold||!0,n=a?"a-link-button":"a-link-button-inactive";return r.a.createElement(x,{className:n,display:"inline-block",onClick:function(){Object(v.a)("corp-bribe-popup",s.a,{player:e,popupId:"corp-bribe-popup",corp:t})},text:"Bribe Factions",tooltip:a?"Use your Corporations power and influence to bribe Faction leaders in exchange for reputation":"Your Corporation is not powerful enough to bribe Faction leaders"})}function T({corp:e,profit:t}){if(e.dividendPercentage<=0||t<=0)return r.a.createElement(r.a.Fragment,null);const a=e.dividendPercentage/100*t,n=t-a,i=a/e.totalShares,o=e.numShares*i;return r.a.createElement(r.a.Fragment,null,"Retained Profits (after dividends): ",r.a.createElement(k.a,{money:n})," / s",r.a.createElement("br",null),r.a.createElement("br",null),"Dividend Percentage: ",b.a.format(e.dividendPercentage/100,"0%"),r.a.createElement("br",null),"Dividends per share: ",r.a.createElement(k.a,{money:i})," / s",r.a.createElement("br",null),"Your earnings as a shareholder (Pre-Tax): ",r.a.createElement(k.a,{money:o})," / s",r.a.createElement("br",null),"Dividend Tax Rate: ",e.dividendTaxPercentage,"%",r.a.createElement("br",null),"Your earnings as a shareholder (Post-Tax):"," ",r.a.createElement(k.a,{money:o*(1-e.dividendTaxPercentage/100)})," / s",r.a.createElement("br",null),r.a.createElement("br",null))}function M({name:e,mult:t}){return t<=1?r.a.createElement(r.a.Fragment,null):r.a.createElement("p",null,e,b.a.format(t,"0.000"),r.a.createElement("br",null))}function P({corp:e}){const t=e.storedCycles*y.a.MilliPerCycle;return t<=15e3?r.a.createElement(r.a.Fragment,null):r.a.createElement("p",null,"Bonus time: ",Object(E.b)(t),r.a.createElement("br",null),r.a.createElement("br",null))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(57),s=a(102);function l(e){const t=e.upgrade,a=e.corp.upgrades[t[0]],n=t[1],l=t[2],c=n*Math.pow(l,a),u=r.a.createElement(r.a.Fragment,null,t[4]," - ",r.a.createElement(s.a,{money:c,corp:e.corp})),m=t[5];return r.a.createElement("button",{className:"cmpy-mgmt-upgrade-div tooltip",style:{width:"45%"},onClick:function(){if(!e.corp.funds.lt(c)){try{Object(o.h)(e.corp,e.upgrade)}catch(e){Object(i.a)(e+"")}e.rerender()}}},u,r.a.createElement("span",{className:"tooltiptext"},m))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(57),s=a(102);function l(e){const t=e.upgradeData,a=r.a.createElement(r.a.Fragment,null,t[2]," - ",r.a.createElement(s.a,{money:t[1],corp:e.corp})),n=t[3];return r.a.createElement("button",{className:"cmpy-mgmt-upgrade-div tooltip",style:{width:"45%"},onClick:function(){if(!e.corp.funds.lt(t[1])){try{Object(o.x)(e.corp,e.upgradeData)}catch(e){Object(i.a)(e+"")}e.rerender()}}},a,r.a.createElement("span",{className:"tooltiptext"},n))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(24),o=a(36),s=a(3),l=a(22),c=a(11);function u(e){const[t,a]=Object(n.useState)(0),[u,m]=Object(n.useState)(0),[h,p]=Object(n.useState)(e.player.factions.length>0?e.player.factions[0]:"");function d(t,a){return(t+a*e.corp.sharePrice)/o.a.BribeToRepRatio}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"You can use Corporation funds or stock shares to bribe Faction Leaders in exchange for faction reputation."),r.a.createElement("select",{className:"dropdown",style:{margin:"3px"},defaultValue:h,onChange:function(e){p(e.target.value)}},e.player.factions.map(e=>{if(i.a[e].getInfo().offersWork())return r.a.createElement("option",{key:e,value:e},e)})),r.a.createElement("p",null,function(t,a){return 0===t&&0===a?"":isNaN(t)||isNaN(a)||t<0||a<0?"ERROR: Invalid value(s) entered":e.corp.funds.lt(t)?"ERROR: You do not have this much money to bribe with":a>e.corp.numShares?"ERROR: You do not have this many shares to bribe with":"You will gain "+s.a.formatReputation(d(t,a))+" reputation with "+h+" with this bribe"}(t||0,u||0)),r.a.createElement("input",{className:"text-input",onChange:function(e){a(parseFloat(e.target.value))},placeholder:"Corporation funds",style:{margin:"5px"}}),r.a.createElement("input",{className:"text-input",onChange:function(e){m(parseFloat(e.target.value))},placeholder:"Stock Shares",style:{margin:"5px"}}),r.a.createElement("button",{className:"a-link-button",onClick:()=>function(t,a){const n=i.a[h];if(null==n&&Object(c.a)("ERROR: You must select a faction to bribe"),isNaN(t)||isNaN(a)||t<0||a<0);else if(e.corp.funds.lt(t));else if(a>e.corp.numShares);else{const r=d(t,a);Object(c.a)("You gained "+s.a.formatReputation(r)+" reputation with "+n.name+" by bribing them."),n.playerReputation+=r,e.corp.funds=e.corp.funds.minus(t),e.corp.numShares-=a,Object(l.b)(e.popupId)}}(t||0,u||0),style:{display:"inline-block"}},"Bribe"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(3),o=a(11),s=a(22),l=a(36);function c(e){const[t,a]=Object(n.useState)(null);function c(){if(null!==t)if(isNaN(t)||t<=0)Object(o.a)("ERROR: Invalid value for number of shares");else if(t>e.corp.numShares)Object(o.a)("ERROR: You don't have this many shares to sell");else{const a=e.corp.calculateShareSale(t),n=a[0],r=a[1],c=a[2];if(e.corp.numShares-=t,isNaN(e.corp.issuedShares)){console.error("Corporation issuedShares is NaN: "+e.corp.issuedShares);const t=e.corp.issuedShares;isNaN(t)?e.corp.issuedShares=0:e.corp.issuedShares=t}e.corp.issuedShares+=t,e.corp.sharePrice=r,e.corp.shareSalesUntilPriceUpdate=c,e.corp.shareSaleCooldown=l.a.SellSharesCooldown,e.player.gainMoney(n),e.player.recordMoneySource(n,"corporation"),Object(s.b)(e.popupId),Object(o.a)(`Sold ${i.a.formatMoney(t)} shares for `+i.a.formatMoney(n)+". "+`The corporation's stock price fell to ${i.a.formatMoney(e.corp.sharePrice)} as a result of dilution.`),e.rerender()}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the number of shares you would like to sell. The money from selling your shares will go directly to you (NOT your Corporation).",r.a.createElement("br",null),r.a.createElement("br",null),"Selling your shares will cause your corporation's stock price to fall due to dilution. Furthermore, selling a large number of shares all at once will have an immediate effect in reducing your stock price.",r.a.createElement("br",null),r.a.createElement("br",null),"The current price of your company's stock is ",i.a.formatMoney(e.corp.sharePrice)),r.a.createElement((function(e){if(null===e.shares)return r.a.createElement(r.a.Fragment,null);if(isNaN(e.shares)||e.shares<=0)return r.a.createElement(r.a.Fragment,null,"ERROR: Invalid value entered for number of shares to sell");if(e.shares>e.corp.numShares)return r.a.createElement(r.a.Fragment,null,"You don't have this many shares to sell!");{const t=e.corp.calculateShareSale(e.shares)[0];return r.a.createElement(r.a.Fragment,null,"Sell ",e.shares," shares for a total of ",i.a.formatMoney(t))}}),{shares:t,corp:e.corp}),r.a.createElement("br",null),r.a.createElement("input",{autoFocus:!0,className:"text-input",type:"number",placeholder:"Shares to sell",style:{margin:"5px"},onChange:function(e){""===e.target.value?a(null):a(Math.round(parseFloat(e.target.value)))},onKeyDown:function(e){13===e.keyCode&&c()}}),r.a.createElement("button",{onClick:c,className:"a-link-button",style:{display:"inline-block"}},"Sell shares"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(22),o=a(3),s=a(11);function l(e){const[t,a]=Object(n.useState)(null);const l=1.1*e.corp.sharePrice;function c(){if(null===t)return;const a=1.1*e.corp.sharePrice;if(isNaN(t)||t<=0)Object(s.a)("ERROR: Invalid value for number of shares");else if(t>e.corp.issuedShares)Object(s.a)("ERROR: There are not this many oustanding shares to buy back");else if(t*a>e.player.money)Object(s.a)("ERROR: You do not have enough money to purchase this many shares (you need "+o.a.format(t*a,"$0.000a")+")");else{if(e.corp.numShares+=t,isNaN(e.corp.issuedShares)){console.warn("Corporation issuedShares is NaN: "+e.corp.issuedShares),console.warn("Converting to number now");const t=e.corp.issuedShares;isNaN(t)?e.corp.issuedShares=0:e.corp.issuedShares=t}e.corp.issuedShares-=t,e.player.loseMoney(t*a),Object(i.b)(e.popupId),e.rerender()}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the number of outstanding shares you would like to buy back. These shares must be bought at a 10% premium. However, repurchasing shares from the market tends to lead to an increase in stock price.",r.a.createElement("br",null),r.a.createElement("br",null),"To purchase these shares, you must use your own money (NOT your Corporation's funds).",r.a.createElement("br",null),r.a.createElement("br",null),"The current buyback price of your company's stock is ",o.a.formatMoney(l),". Your company currently has ",o.a.formatBigNumber(e.corp.issuedShares)," outstanding stock shares."),r.a.createElement((function(){return null===t?r.a.createElement(r.a.Fragment,null):isNaN(t)||t<=0?r.a.createElement(r.a.Fragment,null,"ERROR: Invalid value entered for number of shares to buyback"):t>e.corp.issuedShares?r.a.createElement(r.a.Fragment,null,"There are not this many shares available to buy back. There are only"," ",o.a.formatBigNumber(e.corp.issuedShares)," outstanding shares."):r.a.createElement(r.a.Fragment,null,"Purchase ",t," shares for a total of ",o.a.formatMoney(t*l))}),null),r.a.createElement("br",null),r.a.createElement("input",{autoFocus:!0,className:"text-input",type:"number",placeholder:"Shares to buyback",style:{margin:"5px"},onChange:function(e){""===e.target.value?a(null):a(Math.round(parseFloat(e.target.value)))},onKeyDown:function(e){13===e.keyCode&&c()}}),r.a.createElement("button",{onClick:c,className:"a-link-button",style:{display:"inline-block"}},"Buy shares"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(22),o=a(11),s=a(36),l=a(57);function c(e){const[t,a]=Object(n.useState)(null);function c(){if(null!==t){try{Object(l.g)(e.corp,t/100)}catch(e){Object(o.a)(e+"")}Object(i.b)(e.popupId)}}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Dividends are a distribution of a portion of the corporation's profits to the shareholders. This includes yourself, as well.",r.a.createElement("br",null),r.a.createElement("br",null),"In order to issue dividends, simply allocate some percentage of your corporation's profits to dividends. This percentage must be an integer between 0 and ",s.a.DividendMaxPercentage,". (A percentage of 0 means no dividends will be issued",r.a.createElement("br",null),r.a.createElement("br",null),"Two important things to note:",r.a.createElement("br",null),"* Issuing dividends will negatively affect your corporation's stock price",r.a.createElement("br",null),"* Dividends are taxed. Taxes start at 50%, but can be decreased",r.a.createElement("br",null),r.a.createElement("br",null),"Example: Assume your corporation makes $100m / sec in profit and you allocate 40% of that towards dividends. That means your corporation will gain $60m / sec in funds and the remaining $40m / sec will be paid as dividends. Since your corporation starts with 1 billion shares, every shareholder will be paid $0.04 per share per second before taxes."),r.a.createElement("input",{autoFocus:!0,onChange:function(e){""===e.target.value?a(null):a(parseFloat(e.target.value))},onKeyDown:function(e){13===e.keyCode&&c()},className:"text-input",placeholder:"Dividend %",type:"number",style:{margin:"5px"}}),r.a.createElement("button",{onClick:c,className:"std-button",style:{display:"inline-block"}},"Allocate Dividend Percentage"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(3),o=a(11),s=a(22),l=a(21),c=a(36);function u(e){if(null===e.shares)return r.a.createElement(r.a.Fragment,null);const t=Math.round(.9*e.corp.sharePrice),a=Math.round(.2*e.corp.totalShares),n=a-a%1e6;let o=e.shares;return isNaN(o)?r.a.createElement("p",null,"Invalid input"):(o/=1e7,o=1e7*Math.round(o),o<1e7?r.a.createElement("p",null,"Must issue at least 10 million new shares"):o>n?r.a.createElement("p",null,"You cannot issue that many shares"):r.a.createElement("p",null,"Issue $",i.a.format(o,"0.000a")," new shares for"," ",i.a.formatMoney(o*t),"?"))}function m(e){const[t,a]=Object(n.useState)(null),m=Math.round(.2*e.corp.totalShares),h=m-m%1e6;function p(){if(null===t)return;const a=Math.round(.9*e.corp.sharePrice);let n=t;if(isNaN(n))return void Object(o.a)("Invalid input for number of new shares");if(n=1e7*Math.round(n/1e7),n<1e7||n>h)return void Object(o.a)("Invalid input for number of new shares");const r=n*a;e.corp.issueNewSharesCooldown=c.a.IssueNewSharesCooldown,e.corp.totalShares+=n;let u=Object(l.a)(0,Math.round(n/2));u=1e6*Math.round(u/1e6),e.corp.issuedShares+=n-u,e.corp.funds=e.corp.funds.plus(r),e.corp.immediatelyUpdateSharePrice(),Object(s.b)(e.popupId),Object(o.a)(`Issued ${i.a.format(n,"0.000a")} and raised ${i.a.formatMoney(r)}. ${i.a.format(u,"0.000a")} of these shares were bought by private investors.

Stock price decreased to `+i.a.formatMoney(e.corp.sharePrice))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"You can issue new equity shares (i.e. stocks) in order to raise capital for your corporation.",r.a.createElement("br",null),r.a.createElement("br",null)," * You can issue at most ",i.a.formatMoney(h)," new shares",r.a.createElement("br",null)," * New shares are sold at a 10% discount",r.a.createElement("br",null)," * You can only issue new shares once every 12 hours",r.a.createElement("br",null)," * Issuing new shares causes dilution, resulting in a decrease in stock price and lower dividends per share",r.a.createElement("br",null)," * Number of new shares issued must be a multiple of 10 million",r.a.createElement("br",null),r.a.createElement("br",null),"When you choose to issue new equity, private shareholders have first priority for up to 50% of the new shares. If they choose to exercise this option, these newly issued shares become private, restricted shares, which means you cannot buy them back."),r.a.createElement(u,{corp:e.corp,shares:t}),r.a.createElement("input",{className:"text-input",autoFocus:!0,placeholder:"# New Shares",style:{margin:"5px"},onChange:function(e){""===e.target.value?a(null):a(parseFloat(e.target.value))},onKeyDown:function(e){13===e.keyCode&&p()}}),r.a.createElement("button",{onClick:p,className:"std-button",style:{display:"inline-block"}},"Issue New Shares"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(22),o=a(3),s=a(36);function l(e){const t=e.corp.determineValuation();let a=0,n=4;switch(e.corp.fundingRound){case 0:a=.1,n=4;break;case 1:a=.35,n=3;break;case 2:a=.25,n=3;break;case 3:a=.2,n=2.5;break;default:return r.a.createElement(r.a.Fragment,null)}const l=t*a*n,c=Math.floor(s.a.INITIALSHARES*a);return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"An investment firm has offered you ",o.a.formatMoney(l)," in funding in exchange for a"," ",o.a.format(100*a,"0.000a"),"% stake in the company (",o.a.format(c,"0.000a")," shares).",r.a.createElement("br",null),r.a.createElement("br",null),"Do you accept or reject this offer?",r.a.createElement("br",null),r.a.createElement("br",null),"Hint: Investment firms will offer more money if your corporation is turning a profit"),r.a.createElement("button",{onClick:function(){e.corp.fundingRound++,e.corp.addFunds(l),e.corp.numShares-=c,e.rerender(),Object(i.b)(e.popupId)},className:"std-button"},"Accept"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(11),o=a(22),s=a(3);function l(e){const[t,a]=Object(n.useState)(""),l=e.corp.determineValuation()/e.corp.totalShares;function c(){const a=parseFloat(t),n=e.corp.determineValuation()/e.corp.totalShares;isNaN(a)?Object(i.a)("Invalid value for number of issued shares"):a>e.corp.numShares?Object(i.a)("Error: You don't have that many shares to issue!"):(e.corp.public=!0,e.corp.sharePrice=n,e.corp.issuedShares=a,e.corp.numShares-=a,e.corp.addFunds(a*n),e.rerender(),Object(i.a)(`You took your ${e.corp.name} public and earned `+s.a.formatMoney(a*n)+" in your IPO"),Object(o.b)(e.popupId))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Enter the number of shares you would like to issue for your IPO. These shares will be publicly sold and you will no longer own them. Your Corporation will receive ",s.a.formatMoney(l)," per share (the IPO money will be deposited directly into your Corporation's funds).",r.a.createElement("br",null),r.a.createElement("br",null),"You have a total of ",s.a.format(e.corp.numShares,"0.000a")," of shares that you can issue."),r.a.createElement("input",{className:"text-input",value:t,onChange:function(e){a(e.target.value)},autoFocus:!0,type:"number",placeholder:"Shares to issue",onKeyDown:function(e){13===e.keyCode&&c()}}),r.a.createElement("button",{className:"std-button",onClick:c},"Go Public"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(923),o=a(924),s=a(47);function l(e){const t=s.b.Player(),a=s.b.Router(),[l,c]=Object(n.useState)(!1);if(void 0===e.location.infiltrationData)throw new Error("Trying to do infiltration on invalid location.");const u=e.location.infiltrationData.startingSecurityLevel,m=function(e,t){const a=e.strength+e.defense+e.dexterity+e.agility+e.charisma,n=t-Math.pow(a,.9)/250-e.intelligence/1600;return n<0?0:n>3?3:n}(t,u);return l?r.a.createElement(o.a,{StartingDifficulty:u,Difficulty:m,MaxLevel:e.location.infiltrationData.maxClearanceLevel}):r.a.createElement(i.a,{Location:e.location,Difficulty:m,MaxLevel:e.location.infiltrationData.maxClearanceLevel,start:()=>c(!0),cancel:function(){a.toCity()}})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(26),o=a(54);function s(e,t){let a="";return t<=0?t=0:t>13?t=13:(t--,a=">"),r.a.createElement("span",{style:{color:e}},"=".repeat(t),a," ".repeat(13-a.length-t))}function l(e){return r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{container:!0,spacing:3},r.a.createElement(o.a,{item:!0,xs:10},r.a.createElement("h1",null,"Infiltrating ",e.Location.name)),r.a.createElement(o.a,{item:!0,xs:10},r.a.createElement("h2",null,"Maximum level: ",e.MaxLevel)),r.a.createElement(o.a,{item:!0,xs:10},r.a.createElement("pre",null,"[",0===(t=e.Difficulty)?r.a.createElement("span",{style:{color:"white"}},">"," ".repeat(38)):r.a.createElement(r.a.Fragment,null,s("white",13*t),s("orange",13*(t-1)),s("red",13*(t-2))),"]"),r.a.createElement("pre",null," ^ ^ ^ ^"),r.a.createElement("pre",null," Trivial Normal Hard Impossible")),r.a.createElement(o.a,{item:!0,xs:10},r.a.createElement("p",null,"Infiltration is a series of short minigames that get progressively harder. You take damage for failing them. Reaching the maximum level rewards you with intel you can trade for money or reputation."),r.a.createElement("br",null),r.a.createElement("p",null,"The minigames you play are randomly selected. It might take you few tries to get used to them."),r.a.createElement("br",null),r.a.createElement("p",null,"No game require use of the mouse."),r.a.createElement("br",null),r.a.createElement("p",null,"Spacebar is the default action/confirm button."),r.a.createElement("br",null),r.a.createElement("p",null,"Everything that uses arrow can also use WASD"),r.a.createElement("br",null),r.a.createElement("p",null,"Sometimes the rest of the keyboard is used.")),r.a.createElement(o.a,{item:!0,xs:3},r.a.createElement(i.a,{onClick:e.start,text:"Start"})),r.a.createElement(o.a,{item:!0,xs:3},r.a.createElement(i.a,{onClick:e.cancel,text:"Cancel"}))));var t}},function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n,r=a(47),i=a(0),o=a.n(i),s=a(54),l=a(925),c=a(926),u=a(928),m=a(929),h=a(930),p=a(931),d=a(932),f=a(933),g=a(934),y=a(935);!function(e){e[e.Countdown=0]="Countdown",e[e.Minigame=1]="Minigame",e[e.Result=2]="Result",e[e.Sell=3]="Sell"}(n||(n={}));const b=[u.a,c.a,m.a,h.a,p.a,d.a,f.a,g.a];function E(e){const t=r.b.Player(),a=r.b.Router(),[c,u]=Object(i.useState)(1),[m,h]=Object(i.useState)(n.Countdown),[p,d]=Object(i.useState)(""),[f,g]=Object(i.useState)({lastGames:[-1,-1],id:Math.floor(Math.random()*b.length)});function E(){let e=f.lastGames[0];const t=[f.lastGames[0],f.lastGames[1],f.id];for(;t.includes(e);)e=Math.floor(Math.random()*b.length);return e}function v(){g({lastGames:[f.lastGames[1],f.id],id:E()})}function k(e){d(t=>{let a=t;return a+=e?"✓":"✗",a.length>15&&(a=a.slice(1)),a})}let _;switch(m){case n.Countdown:_=o.a.createElement(l.a,{onFinish:()=>h(n.Minigame)});break;case n.Minigame:{const r=b[f.id];_=o.a.createElement(r,{onSuccess:function(){k(!0),c===e.MaxLevel?h(n.Sell):(h(n.Countdown),u(c+1)),v()},onFailure:function(r){h(n.Countdown),k(!1);const i=null!=r&&r.automated?t.hp:3*e.StartingDifficulty;t.takeDamage(i)?a.toCity():v()},difficulty:e.Difficulty+c/50});break}case n.Sell:_=o.a.createElement(y.a,{StartingDifficulty:e.StartingDifficulty,Difficulty:e.Difficulty,MaxLevel:e.MaxLevel})}return o.a.createElement(o.a.Fragment,null,o.a.createElement(s.a,{container:!0,spacing:3},o.a.createElement(s.a,{item:!0,xs:3},o.a.createElement("h3",null,"Level: ",c," / ",e.MaxLevel),o.a.createElement((function(){return o.a.createElement("h4",null,o.a.createElement("span",{style:{color:"gray"}},p.slice(0,p.length-1)),p[p.length-1])}),null)),o.a.createElement(s.a,{item:!0,xs:12},_)))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(54);function o(e){const[t,a]=Object(n.useState)(3);return Object(n.useEffect)(()=>{0!==t?setTimeout(()=>a(t-1),200):e.onFinish()}),r.a.createElement(r.a.Fragment,null,r.a.createElement(i.a,{container:!0,spacing:3},r.a.createElement(i.a,{item:!0,xs:12},r.a.createElement("h1",null,"Get Ready!"),r.a.createElement("h1",null,t))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(206),c=a(162),u=a(502);const m={Trivial:{timer:8e3,min:2,max:3},Normal:{timer:6e3,min:4,max:5},Hard:{timer:4e3,min:4,max:6},Impossible:{timer:2500,min:7,max:7}};function h(e){const t={timer:0,min:0,max:0};Object(c.a)(m,e.difficulty,t);const a=t.timer,[h,p]=Object(n.useState)(""),[d]=Object(n.useState)(function(e){let t="";const a=Object(l.b)(e.min,e.max);for(let e=0;e":"":"]"}(t);a&&(!function(e,t){return"["===e&&"]"===t||"<"===e&&">"===t||"("===e&&")"===t||"{"===e&&"}"===t}(d[d.length-h.length-1],a)?e.onFailure():d.length!==h.length+1?p(h+a):e.onSuccess())},onFailure:e.onFailure})))}},,function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(162);const c={Trivial:{window:600},Normal:{window:325},Hard:{window:250},Impossible:{window:150}};function u(e){const t={window:0};Object(l.a)(c,e.difficulty,t);const[a,u]=Object(n.useState)(!0);return Object(n.useEffect)(()=>{let e=-1;const a=window.setTimeout(()=>{u(!1),e=window.setTimeout(()=>u(!0),t.window)},3250*Math.random()+1500);return()=>{clearInterval(a),-1!==e&&clearInterval(e)}},[]),r.a.createElement(i.a,{container:!0,spacing:3},r.a.createElement(s.a,{millis:5e3,onExpire:e.onFailure}),r.a.createElement(i.a,{item:!0,xs:12},r.a.createElement("h1",{className:"noselect"},"Slash when his guard is down!"),r.a.createElement("p",{style:{fontSize:"5em"}},a?"!Guarding!":"!ATTACKING!"),r.a.createElement(o.a,{onKeyDown:function(t){t.preventDefault(),32===t.keyCode&&(a?e.onFailure():e.onSuccess())},onFailure:e.onFailure})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(206),c=a(162),u=a(502);const m={Trivial:{timer:16e3,min:3,max:4},Normal:{timer:12500,min:2,max:3},Hard:{timer:15e3,min:3,max:4},Impossible:{timer:8e3,min:4,max:4}};function h(e){const t={timer:0,min:0,max:0};Object(c.a)(m,e.difficulty,t);const a=t.timer,[h]=Object(n.useState)(function(e){const t=Object(l.b)(e.min,e.max);let a="";for(let e=0;e0&&(a+=" "),a+=p[Math.floor(Math.random()*p.length)];return a}(t)),[d,f]=Object(n.useState)("");return r.a.createElement(i.a,{container:!0,spacing:3},r.a.createElement(s.a,{millis:a,onExpire:e.onFailure}),r.a.createElement(i.a,{item:!0,xs:12},r.a.createElement("h1",{className:"noselect"},"Type it backward"),r.a.createElement(o.a,{onKeyDown:function(t){if(t.preventDefault(),16===t.keyCode)return;const a=d+t.key.toUpperCase();h.startsWith(a)?h===a?e.onSuccess():f(a):e.onFailure()},onFailure:e.onFailure})),r.a.createElement(i.a,{item:!0,xs:6},r.a.createElement("p",{style:{transform:"scaleX(-1)"}},h)),r.a.createElement(i.a,{item:!0,xs:6},r.a.createElement("p",null,d,r.a.createElement(u.a,null))))}const p=["ALGORITHM","ANALOG","APP","APPLICATION","ARRAY","BACKUP","BANDWIDTH","BINARY","BIT","BITE","BITMAP","BLOG","BLOGGER","BOOKMARK","BOOT","BROADBAND","BROWSER","BUFFER","BUG","BUS","BYTE","CACHE","CAPS LOCK","CAPTCHA","CD","CD-ROM","CLIENT","CLIPBOARD","CLOUD","COMPUTING","COMMAND","COMPILE","COMPRESS","COMPUTER","CONFIGURE","COOKIE","COPY","CPU","CYBERCRIME","CYBERSPACE","DASHBOARD","DATA","MINING","DATABASE","DEBUG","DECOMPRESS","DELETE","DESKTOP","DEVELOPMENT","DIGITAL","DISK","DNS","DOCUMENT","DOMAIN","DOMAIN NAME","DOT","DOT MATRIX","DOWNLOAD","DRAG","DVD","DYNAMIC","EMAIL","EMOTICON","ENCRYPT","ENCRYPTION","ENTER","EXABYTE","FAQ","FILE","FINDER","FIREWALL","FIRMWARE","FLAMING","FLASH","FLASH DRIVE","FLOPPY DISK","FLOWCHART","FOLDER","FONT","FORMAT","FRAME","FREEWARE","GIGABYTE","GRAPHICS","HACK","HACKER","HARDWARE","HOME PAGE","HOST","HTML","HYPERLINK","HYPERTEXT","ICON","INBOX","INTEGER","INTERFACE","INTERNET","IP ADDRESS","ITERATION","JAVA","JOYSTICK","JUNKMAIL","KERNEL","KEY","KEYBOARD","KEYWORD","LAPTOP","LASER PRINTER","LINK","LINUX","LOG OUT","LOGIC","LOGIN","LURKING","MACINTOSH","MACRO","MAINFRAME","MALWARE","MEDIA","MEMORY","MIRROR","MODEM","MONITOR","MOTHERBOARD","MOUSE","MULTIMEDIA","NET","NETWORK","NODE","NOTEBOOK","COMPUTER","OFFLINE","ONLINE","OPENSOURCE","OPERATING","SYSTEM","OPTION","OUTPUT","PAGE","PASSWORD","PASTE","PATH","PHISHING","PIRACY","PIRATE","PLATFORM","PLUGIN","PODCAST","POPUP","PORTAL","PRINT","PRINTER","PRIVACY","PROCESS","PROGRAM","PROGRAMMER","PROTOCOL","QUEUE","QWERTY","RAM","REALTIME","REBOOT","RESOLUTION","RESTORE","ROM","ROOT","ROUTER","RUNTIME","SAVE","SCAN","SCANNER","SCREEN","SCREENSHOT","SCRIPT","SCROLL","SCROLL","SEARCH","ENGINE","SECURITY","SERVER","SHAREWARE","SHELL","SHIFT","SHIFT KEY","SNAPSHOT","SOCIAL NETWORKING","SOFTWARE","SPAM","SPAMMER","SPREADSHEET","SPYWARE","STATUS","STORAGE","SUPERCOMPUTER","SURF","SYNTAX","TABLE","TAG","TERMINAL","TEMPLATE","TERABYTE","TEXT EDITOR","THREAD","TOOLBAR","TRASH","TROJAN HORSE","TYPEFACE","UNDO","UNIX","UPLOAD","URL","USER","USER INTERFACE","USERNAME","UTILITY","VERSION","VIRTUAL","VIRTUAL MEMORY","VIRUS","WEB","WEBMASTER","WEBSITE","WIDGET","WIKI","WINDOW","WINDOWS","WIRELESS","PROCESSOR","WORKSTATION","WEB","WORM","WWW","XML","ZIP"]},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(162);const c={Trivial:{timer:12e3,size:6},Normal:{timer:9e3,size:8},Hard:{timer:5e3,size:9},Impossible:{timer:2500,size:12}};function u(e){const t={timer:0,size:0};Object(l.a)(c,e.difficulty,t);const a=t.timer,[u]=Object(n.useState)(function(e){const t=[];t.push(m[Math.floor(Math.random()*m.length)]);for(let a=0;a0;t--){const a=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[a],e[a]=n}}(t),t}(t)),[p,d]=Object(n.useState)(0);return r.a.createElement(i.a,{container:!0,spacing:3},r.a.createElement(s.a,{millis:a,onExpire:e.onFailure}),r.a.createElement(i.a,{item:!0,xs:12},r.a.createElement("h1",null,"Say something nice about the guard."),r.a.createElement(o.a,{onKeyDown:function(t){t.preventDefault();const a=t.keyCode;if(32===a)return void(m.includes(u[p])?e.onSuccess():e.onFailure());let n=p;for([38,87,68,39].includes(a)&&n++,[65,37,83,40].includes(a)&&n--;n<0;)n+=u.length;for(;n>u.length-1;)n-=u.length;d(n)},onFailure:e.onFailure})),r.a.createElement(i.a,{item:!0,xs:6},r.a.createElement("h2",{style:{fontSize:"2em"}},"↑"),r.a.createElement("h2",{style:{fontSize:"2em"}},u[p]),r.a.createElement("h2",{style:{fontSize:"2em"}},"↓")))}const m=["affectionate","agreeable","bright","charming","creative","determined","energetic","friendly","funny","generous","polite","likable","diplomatic","helpful","giving","kind","hardworking","patient","dynamic","loyal"],h=["aggressive","aloof","arrogant","big-headed","boastful","boring","bossy","careless","clingy","couch potato","cruel","cynical","grumpy","hot air","know it all","obnoxious","pain in the neck","picky","tactless","thoughtless"]},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(206),c=a(162);const u={Trivial:{timer:13e3,min:6,max:8},Normal:{timer:7e3,min:7,max:8},Hard:{timer:5e3,min:8,max:9},Impossible:{timer:3e3,min:9,max:10}};function m(e){const t={timer:0,min:0,max:0};Object(c.a)(u,e.difficulty,t);const a=t.timer,[m]=Object(n.useState)(function(e){const t=["←","→","↑","↓"];let a="";for(let n=0;n=m.length&&e.onSuccess()):e.onFailure()},onFailure:e.onFailure})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(162),c=a(206);const u={Trivial:{timer:12500,width:3,height:3,symbols:6},Normal:{timer:15e3,width:4,height:4,symbols:7},Hard:{timer:12500,width:5,height:5,symbols:8},Impossible:{timer:1e4,width:6,height:6,symbols:9}};function m(e){const t={timer:0,width:0,height:0,symbols:0};Object(l.a)(u,e.difficulty,t);const a=t.timer,[m]=Object(n.useState)(function(e){const t=[];for(let a=0;at==d?r.a.createElement("span",{key:""+t,style:{fontSize:"1em",color:"blue"}},e," "):r.a.createElement("span",{key:""+t,style:{fontSize:"1em"}},e," "))),r.a.createElement("br",null),m.map((e,t)=>r.a.createElement("div",{key:t},r.a.createElement("pre",null,e.map((e,a)=>a==g[0]&&t==g[1]?r.a.createElement("span",{key:`${a}${t}`,style:{fontSize:"2em",color:"blue"}},e," "):r.a.createElement("span",{key:`${a}${t}`,style:{fontSize:"2em"}},e," "))),r.a.createElement("br",null))),r.a.createElement(o.a,{onKeyDown:function(t){t.preventDefault();const a=[0,0];switch(Object(c.a)(t)){case"↑":a[1]--;break;case"←":a[0]--;break;case"↓":a[1]++;break;case"→":a[0]++}const n=[g[0]+a[0],g[1]+a[1]];if(n[0]=(n[0]+m[0].length)%m[0].length,n[1]=(n[1]+m.length)%m.length,y(n),32==t.keyCode){if(m[g[1]][g[0]]!==p[d])return void e.onFailure();f(d+1),p.length===d+1&&e.onSuccess()}},onFailure:e.onFailure})))}function h(){return"ABCDEF0123456789"[Math.floor(16*Math.random())]}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(54),o=a(160),s=a(161),l=a(162),c=a(206);const u={Trivial:{timer:15e3,width:3,height:3,mines:4},Normal:{timer:15e3,width:4,height:4,mines:7},Hard:{timer:15e3,width:5,height:5,mines:11},Impossible:{timer:15e3,width:6,height:6,mines:15}};function m(e){const t={timer:0,width:0,height:0,mines:0};Object(l.a)(u,e.difficulty,t);const a=t.timer,[m]=Object(n.useState)(function(e){const t=h(e);for(let a=0;a{const e=setTimeout(()=>b(!1),2e3);return()=>clearInterval(e)},[]),r.a.createElement(i.a,{container:!0,spacing:3},r.a.createElement(s.a,{millis:a,onExpire:e.onFailure}),r.a.createElement(i.a,{item:!0,xs:12},r.a.createElement("h1",{className:"noselect"},y?"Remember all the mines!":"Mark all the mines!"),m.map((e,t)=>r.a.createElement("div",{key:t},r.a.createElement("pre",null,e.map((e,a)=>y?m[t][a]?r.a.createElement("span",{key:a},"[?] "):r.a.createElement("span",{key:a},"[ ] "):a==f[0]&&t==f[1]?r.a.createElement("span",{key:a},"[X] "):p[t][a]?r.a.createElement("span",{key:a},"[.] "):r.a.createElement("span",{key:a},"[ ] "))),r.a.createElement("br",null))),r.a.createElement(o.a,{onKeyDown:function(t){if(t.preventDefault(),y)return;const a=[0,0];switch(Object(c.a)(t)){case"↑":a[1]--;break;case"←":a[0]--;break;case"↓":a[1]++;break;case"→":a[0]++}const n=[f[0]+a[0],f[1]+a[1]];if(n[0]=(n[0]+m[0].length)%m[0].length,n[1]=(n[1]+m.length)%m.length,g(n),32==t.keyCode){if(!m[f[1]][f[0]])return void e.onFailure();d(t=>(t[f[1]][f[0]]=!0,function(e,t){function a(e){return e.flat().reduce((e,t)=>e+(t?1:0),0)}return a(e)===a(t)}(m,t)&&e.onSuccess(),t))}},onFailure:e.onFailure})))}function h(e){const t=[];for(let a=0;ar.a.createElement("h3",{key:t},e.toString())),r.a.createElement("pre",null,new Array(p.length).fill(0).map((e,t)=>r.a.createElement("span",{key:t}," ",t+1,"    "))),new Array(8).fill(0).map((e,t)=>r.a.createElement("div",{key:t},r.a.createElement("pre",null,p.map((e,a)=>3!==t&&4!==t||!d[a]?r.a.createElement("span",{key:a,style:{color:e.colors[t%e.colors.length]}},"|",e.tpe,"|   "):r.a.createElement("span",{key:a},"      "))))),r.a.createElement(o.a,{onKeyDown:function(t){t.preventDefault();const a=parseInt(t.key);a<1||a>p.length||isNaN(a)||y(t=>{const n=[...t];n[a-1]=!0,b.some(e=>e.shouldCut(p[a-1],a-1))||e.onFailure();const r=[];for(let e=0;ee===n[t])&&e.onSuccess(),n})},onFailure:e.onFailure})))}function f(e){const t=Math.floor(Math.random()*e.length);return{toString:()=>`Cut wires number ${t+1}.`,shouldCut:(e,a)=>t===a}}function g(e){const t=e[Math.floor(Math.random()*e.length)].colors[0];return{toString:()=>`Cut all wires colored ${p[t]}.`,shouldCut:e=>e.colors.includes(t)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(24),r=a(0),i=a.n(r),o=a(26),s=a(54),l=a(15),c=a(81),u=a(7),m=a(47);function h(e){const t=m.b.Player(),a=m.b.Router(),[h,p]=Object(r.useState)("none");function d(){a.toCity()}const f=e.MaxLevel*Math.pow(1.01,e.MaxLevel),g=Math.pow(e.Difficulty+1,1.1)*Math.pow(e.StartingDifficulty,1.2)*30*f*u.a.InfiltrationRep,y=Math.pow(e.Difficulty+1,2)*Math.pow(e.StartingDifficulty,3)*3e3*f*u.a.InfiltrationMoney;return i.a.createElement(i.a.Fragment,null,i.a.createElement(s.a,{container:!0,spacing:3},i.a.createElement(s.a,{item:!0,xs:10},i.a.createElement("h1",null,"Infiltration successful!")),i.a.createElement(s.a,{item:!0,xs:10},i.a.createElement("h2",null,"You can trade the confidential information you found for money or reputation."),i.a.createElement("select",{className:"dropdown",onChange:function(e){p(e.target.value)}},i.a.createElement("option",{key:"none",value:"none"},"none"),t.factions.filter(e=>n.a[e].getInfo().offersWork()).map(e=>i.a.createElement("option",{key:e,value:e},e))),i.a.createElement(o.a,{onClick:function(){"none"!==h&&(n.a[h].playerReputation+=g,d())},text:i.a.createElement(i.a.Fragment,null,"Trade for ",Object(c.a)(g)," reputation")})),i.a.createElement(s.a,{item:!0,xs:3},i.a.createElement(o.a,{onClick:function(){t.gainMoney(y),t.recordMoneySource(y,"infiltration"),d()},text:i.a.createElement(i.a.Fragment,null,"Sell for ",i.a.createElement(l.a,{money:y}))})),i.a.createElement(s.a,{item:!0,xs:3},i.a.createElement(o.a,{onClick:d,text:"Quit"}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(503),o=a(938);const s={Cost:"Cost",Hacking:"Hacking Level",Strength:"Strength Level",Defense:"Defense Level",Dexterity:"Dexterity Level",Agility:"Agility Level",Charisma:"Charisma Level",AverageCombatStats:"Average Combat Stats",AverageAllStats:"Average Stats",TotalNumAugmentations:"Number of Augmentations"};function l(...e){let t=0;for(let a=0;ae.getCost()-t.getCost(),Hacking:(e,t)=>e.hacking_skill-t.hacking_skill,Strength:(e,t)=>e.strength-t.strength,Defense:(e,t)=>e.defense-t.defense,Dexterity:(e,t)=>e.dexterity-t.dexterity,Agility:(e,t)=>e.agility-t.agility,Charisma:(e,t)=>e.charisma-t.charisma,AverageCombatStats:(e,t)=>l(e.strength,e.defense,e.dexterity,e.agility)-l(t.strength,t.defense,t.dexterity,t.agility),AverageAllStats:(e,t)=>l(e.hacking_skill,e.strength,e.defense,e.dexterity,e.agility,e.charisma)-l(t.hacking_skill,t.strength,t.defense,t.dexterity,t.agility,t.charisma),TotalNumAugmentations:(e,t)=>e.augmentations.length-t.augmentations.length};function u(e){const[t,a]=Object(n.useState)(s.Cost);0===e.player.resleeves.length&&(e.player.resleeves=Object(i.a)());const l=c[t];if(void 0===l)throw new Error(`sort function '${t}' is undefined`);return e.player.resleeves.sort(l),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{style:{display:"block",width:"75%"}},"Re-sleeving is the process of digitizing and transferring your consciousness into a new human body, or 'sleeve'. Here at VitaLife, you can purchase new specially-engineered bodies for the re-sleeve process. Many of these bodies even come with genetic and cybernetic Augmentations!",r.a.createElement("br",null),r.a.createElement("br",null),"Re-sleeving will change your experience for every stat. It will also REMOVE all of your currently-installed Augmentations, and replace them with the ones provided by the purchased sleeve. However, Augmentations that you have purchased but not installed will NOT be removed. If you have purchased an Augmentation and then re-sleeve into a body which already has that Augmentation, it will be removed (since you cannot have duplicate Augmentations).",r.a.createElement("br",null),r.a.createElement("br",null),"NOTE: The stats and multipliers displayed on this page do NOT include your bonuses from Source-File."),r.a.createElement("p",{style:{display:"inline-block"}},"Sort By: "),r.a.createElement("select",{className:"dropdown",defaultValue:t,onChange:function(e){a(e.target.value)}},Object.keys(s).map(e=>r.a.createElement("option",{key:e,value:e},s[e]))),e.player.resleeves.map((t,a)=>r.a.createElement(o.a,{key:a,player:e.player,resleeve:t})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(168),r=a(19),i=a(20);class o extends n.a{constructor(){super()}getCost(){const e=this.hacking_exp+this.strength_exp+this.defense_exp+this.dexterity_exp+this.agility_exp+this.charisma_exp;let t=0;for(let e=0;er.a.createElement("option",{key:e.name,value:e.name},e.name))),r.a.createElement("p",null,void 0!==u&&u.info)),r.a.createElement("div",{className:"resleeve-panel",style:{width:"20%"}},r.a.createElement("p",null,"It costs ",r.a.createElement(s.a,{money:m,player:e.player})," to purchase this Sleeve."),r.a.createElement("button",{className:"std-button",onClick:function(){Object(o.b)(e.resleeve,e.player)&&Object(c.a)(r.a.createElement(r.a.Fragment,null,"You re-sleeved for ",r.a.createElement(s.a,{money:m}),"!"))}},"Purchase")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return w}));var n=a(0),r=a.n(n),i=a(47),o=a(4),s=a(3),l=a(81),c=a(430),u=a(138),m=a(15),h=a(14),p=a(24),d=a(184),f=a(51),g=a(205),y=a(8),b=a(9),E=a(54),v=a(37),k=a(143);const _=1e3/o.a.MilliPerCycle;function w(){const e=Object(n.useState)(!1)[1];function t(){e(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(t,o.a.MilliPerCycle);return()=>clearInterval(e)},[]);const a=i.b.Player(),w=i.b.Router(),C=p.a[a.currentWorkFactionName];if(a.workType==o.a.WorkTypeFaction){function S(){w.toFaction(C),a.finishFactionWork(!0)}function x(){w.toFaction(C),a.stopFocusing()}return r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,"You are currently ",a.currentWorkFactionDescription," for your faction ",C.name,r.a.createElement("br",null),"(Current Faction Reputation: ",Object(l.a)(C.playerReputation),"). ",r.a.createElement("br",null),"You have been doing this for ",Object(h.b)(a.timeWorked),r.a.createElement("br",null),r.a.createElement("br",null),"You have earned: ",r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(m.a,{money:a.workMoneyGained})," (",r.a.createElement(u.a,{money:a.workMoneyGainRate*_}),")"," ",r.a.createElement("br",null),r.a.createElement("br",null),Object(l.a)(a.workRepGained)," (",Object(c.a)(a.workRepGainRate*_),") reputation for this faction ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workHackExpGained)," (",s.a.formatExp(a.workHackExpGainRate*_)," / sec) hacking exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workStrExpGained)," (",s.a.formatExp(a.workStrExpGainRate*_)," / sec) strength exp ",r.a.createElement("br",null),s.a.formatExp(a.workDefExpGained)," (",s.a.formatExp(a.workDefExpGainRate*_)," / sec) defense exp ",r.a.createElement("br",null),s.a.formatExp(a.workDexExpGained)," (",s.a.formatExp(a.workDexExpGainRate*_)," / sec) dexterity exp ",r.a.createElement("br",null),s.a.formatExp(a.workAgiExpGained)," (",s.a.formatExp(a.workAgiExpGainRate*_)," / sec) agility exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workChaExpGained)," (",s.a.formatExp(a.workChaExpGainRate*_)," / sec) charisma exp ",r.a.createElement("br",null),r.a.createElement("br",null),"You will automatically finish after working for 20 hours. You can cancel earlier if you wish.",r.a.createElement("br",null),"There is no penalty for cancelling earlier.")),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{sx:{mx:2},onClick:S},"Stop Faction Work"),r.a.createElement(v.a,{onClick:x},"Do something else simultaneously")))}const O=a.className;if(""!==a.className){function S(){a.finishClass(!0),w.toCity()}function x(){a.stopFocusing(),w.toCity()}let e="";return e=O==o.a.ClassGymStrength||O==o.a.ClassGymDefense||O==o.a.ClassGymDexterity||O==o.a.ClassGymAgility?"Stop training at gym":"Stop taking course",r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,"You have been ",O," for ",Object(h.b)(a.timeWorked),r.a.createElement("br",null),r.a.createElement("br",null),"This has cost you: ",r.a.createElement("br",null),r.a.createElement(m.a,{money:-a.workMoneyGained})," (",r.a.createElement(u.a,{money:a.workMoneyLossRate*_}),")"," ",r.a.createElement("br",null),r.a.createElement("br",null),"You have gained: ",r.a.createElement("br",null),s.a.formatExp(a.workHackExpGained)," (",s.a.formatExp(a.workHackExpGainRate*_)," / sec) hacking exp ",r.a.createElement("br",null),s.a.formatExp(a.workStrExpGained)," (",s.a.formatExp(a.workStrExpGainRate*_)," / sec) strength exp ",r.a.createElement("br",null),s.a.formatExp(a.workDefExpGained)," (",s.a.formatExp(a.workDefExpGainRate*_)," / sec) defense exp ",r.a.createElement("br",null),s.a.formatExp(a.workDexExpGained)," (",s.a.formatExp(a.workDexExpGainRate*_)," / sec) dexterity exp ",r.a.createElement("br",null),s.a.formatExp(a.workAgiExpGained)," (",s.a.formatExp(a.workAgiExpGainRate*_)," / sec) agility exp ",r.a.createElement("br",null),s.a.formatExp(a.workChaExpGained)," (",s.a.formatExp(a.workChaExpGainRate*_)," / sec) charisma exp ",r.a.createElement("br",null),"You may cancel at any time")),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{onClick:S},e)))}if(a.workType==o.a.WorkTypeCompany){const e=f.a[a.companyName];let t=0;if(null==e||!(e instanceof d.a))throw new Error("Could not find Company: "+a.companyName);function S(){a.finishWork(!0),w.toJob()}function x(){a.stopFocusing(),w.toJob()}t=e.playerReputation;const n=a.jobs[a.companyName],i=.5===a.cancelationPenalty()?"half":"three-quarters";return r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,"You are currently working as a ",n," at ",a.companyName," (Current Company Reputation:"," ",Object(l.a)(t),")",r.a.createElement("br",null),r.a.createElement("br",null),"You have been working for ",Object(h.b)(a.timeWorked),r.a.createElement("br",null),r.a.createElement("br",null),"You have earned: ",r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(m.a,{money:a.workMoneyGained})," (",r.a.createElement(u.a,{money:a.workMoneyGainRate*_}),")"," ",r.a.createElement("br",null),r.a.createElement("br",null),Object(l.a)(a.workRepGained)," (",Object(c.a)(a.workRepGainRate*_),") reputation for this company ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workHackExpGained)," (",s.a.formatExp(a.workHackExpGainRate*_)+" / sec",") hacking exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workStrExpGained)," (",s.a.formatExp(a.workStrExpGainRate*_)+" / sec",") strength exp ",r.a.createElement("br",null),s.a.formatExp(a.workDefExpGained)," (",s.a.formatExp(a.workDefExpGainRate*_)+" / sec",") defense exp ",r.a.createElement("br",null),s.a.formatExp(a.workDexExpGained)," (",s.a.formatExp(a.workDexExpGainRate*_)+" / sec",") dexterity exp ",r.a.createElement("br",null),s.a.formatExp(a.workAgiExpGained)," (",s.a.formatExp(a.workAgiExpGainRate*_)+" / sec",") agility exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workChaExpGained)," (",s.a.formatExp(a.workChaExpGainRate*_)+" / sec",") charisma exp ",r.a.createElement("br",null),r.a.createElement("br",null),"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, but you will only gain ",i," of the reputation you've earned so far.")),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{sx:{mx:2},onClick:S},"Stop Working"),r.a.createElement(v.a,{onClick:x},"Do something else simultaneously")))}if(a.workType==o.a.WorkTypeCompanyPartTime){function S(){a.finishWork(!0),w.toJob()}function x(){a.stopFocusing(),w.toJob()}const e=f.a[a.companyName];let t=0;if(null==e||!(e instanceof d.a))throw new Error("Could not find Company: "+a.companyName);t=e.playerReputation;const n=a.jobs[a.companyName];return r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,"You are currently working as a ",n," at ",a.companyName," (Current Company Reputation:"," ",Object(l.a)(t),")",r.a.createElement("br",null),r.a.createElement("br",null),"You have been working for ",Object(h.b)(a.timeWorked),r.a.createElement("br",null),r.a.createElement("br",null),"You have earned: ",r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(m.a,{money:a.workMoneyGained})," (",r.a.createElement(u.a,{money:a.workMoneyGainRate*_}),")"," ",r.a.createElement("br",null),r.a.createElement("br",null),Object(l.a)(a.workRepGained)," (",Object(l.a)(s.a.formatExp(a.workRepGainRate*_)+" / sec"),") reputation for this company ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workHackExpGained)," (",s.a.formatExp(a.workHackExpGainRate*_)+" / sec",") hacking exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workStrExpGained)," (",s.a.formatExp(a.workStrExpGainRate*_)+" / sec",") strength exp ",r.a.createElement("br",null),s.a.formatExp(a.workDefExpGained)," (",s.a.formatExp(a.workDefExpGainRate*_)+" / sec",") defense exp ",r.a.createElement("br",null),s.a.formatExp(a.workDexExpGained)," (",s.a.formatExp(a.workDexExpGainRate*_)+" / sec",") dexterity exp ",r.a.createElement("br",null),s.a.formatExp(a.workAgiExpGained)," (",s.a.formatExp(a.workAgiExpGainRate*_)+" / sec",") agility exp ",r.a.createElement("br",null),r.a.createElement("br",null),s.a.formatExp(a.workChaExpGained)," (",s.a.formatExp(a.workChaExpGainRate*_)+" / sec",") charisma exp ",r.a.createElement("br",null),r.a.createElement("br",null),"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, and there will be no penalty because this is a part-time job.")),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{sx:{mx:2},onClick:S},"Stop Working"),r.a.createElement(v.a,{onClick:x},"Do something else simultaneously")))}if(""!==a.crimeType){const e=Math.round(a.timeWorked/a.timeNeededToCompleteWork*100);let t=Math.round(e/5);t<0&&(t=0),t>20&&(t=20);const n=Object(k.a)({progress:(t+1)/20,totalTicks:20});return r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,r.a.createElement("p",null,"You are attempting to ",a.crimeType,"."),r.a.createElement("br",null),r.a.createElement("p",null,"Time remaining: ",Object(h.b)(a.timeNeededToCompleteWork-a.timeWorked)),r.a.createElement("br",null),r.a.createElement("pre",null,n))),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{onClick:()=>{w.toLocation(g.a[y.a.Slums]),a.finishCrime(!0)}},"Cancel crime")))}return""!==a.createProgramName?r.a.createElement(E.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",style:{minHeight:"100vh"}},r.a.createElement(E.a,{item:!0},r.a.createElement(b.a,null,"You are currently working on coding ",a.createProgramName,".",r.a.createElement("br",null),r.a.createElement("br",null),"You have been working for ",Object(h.b)(a.timeWorked),r.a.createElement("br",null),r.a.createElement("br",null),"The program is ",(a.timeWorkedCreateProgram/a.timeNeededToCompleteWork*100).toFixed(2),"% complete. ",r.a.createElement("br",null),"If you cancel, your work will be saved and you can come back to complete the program later.")),r.a.createElement(E.a,{item:!0},r.a.createElement(v.a,{onClick:()=>{a.finishCreateProgramWork(!0),w.toTerminal()}},"Cancel work on creating program"))):r.a.createElement(r.a.Fragment,null)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return R}));var n=a(0),r=a.n(n),i=a(142),o=a(277),s=a(9),l=a(452),c=a(54),u=a(246),m=a(247),h=a(290),p=a(125),d=a(37),f=a(92),g=a(370),y=a(63),b=a(149),E=a(93),v=a(980),k=a.n(v),_=a(981),w=a.n(_),C=a(941),S=a(11),x=a(944),O=a(945),T=a(18),M=a(348);const P=Object(i.a)(e=>Object(o.a)({root:{width:50,padding:e.spacing(2),userSelect:"none"}}));function R(e){const t=P(),a=Object(n.useRef)(null),[i,o]=Object(n.useState)(T.a.CodeInstructionRunTime),[v,_]=Object(n.useState)(T.a.MaxLogCapacity),[R,A]=Object(n.useState)(T.a.MaxPortCapacity),[N,I]=Object(n.useState)(T.a.MaxTerminalCapacity),[j,F]=Object(n.useState)(T.a.AutosaveInterval),[D,B]=Object(n.useState)(T.a.SuppressMessages),[L,G]=Object(n.useState)(T.a.SuppressFactionInvites),[W,H]=Object(n.useState)(T.a.SuppressTravelConfirmation),[U,q]=Object(n.useState)(T.a.SuppressBuyAugmentationConfirmation),[K,$]=Object(n.useState)(T.a.SuppressHospitalizationPopup),[z,Y]=Object(n.useState)(T.a.SuppressBladeburnerPopup),[V,J]=Object(n.useState)(T.a.DisableHotkeys),[Q,X]=Object(n.useState)(T.a.DisableASCIIArt),[Z,ee]=Object(n.useState)(T.a.DisableTextEffects),[te,ae]=Object(n.useState)(T.a.EnableBashHotkeys),[ne,re]=Object(n.useState)(T.a.EnableTimestamps),[ie,oe]=Object(n.useState)(T.a.Locale),[se,le]=Object(n.useState)(!1),[ce,ue]=Object(n.useState)(!1),[me,he]=Object(n.useState)(!1);return r.a.createElement("div",{className:t.root,style:{width:"90%"}},r.a.createElement(s.a,{variant:"h4",gutterBottom:!0},"Options"),r.a.createElement(c.a,{container:!0,spacing:3},r.a.createElement(c.a,{item:!0,xs:12,sm:6},r.a.createElement(g.a,null,r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"The minimum number of milliseconds it takes to execute an operation in Netscript. Setting this too low can result in poor performance if you have many scripts running.")},r.a.createElement(s.a,null,"Netscript exec time (ms)")),r.a.createElement(l.a,{value:i,onChange:function(e,t){o(t),T.a.CodeInstructionRunTime=t},step:1,min:10,max:100,valueLabelDisplay:"auto"})),r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"The maximum number of lines a script's logs can hold. Setting this too high can cause the game to use a lot of memory if you have many scripts running.")},r.a.createElement(s.a,null,"Netscript log size")),r.a.createElement(l.a,{value:v,onChange:function(e,t){_(t),T.a.MaxLogCapacity=t},step:1,min:20,max:100,valueLabelDisplay:"auto"})),r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"The maximum number of entries that can be written to a port using Netscript's write() function. Setting this too high can cause the game to use a lot of memory.")},r.a.createElement(s.a,null,"Netscript port size")),r.a.createElement(l.a,{value:R,onChange:function(e,t){A(t),T.a.MaxPortCapacity=t},step:1,min:20,max:100,valueLabelDisplay:"auto"})),r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"The maximum number of entries that can be written to a the terminal. Setting this too high can cause the game to use a lot of memory.")},r.a.createElement(s.a,null,"Terminal capacity")),r.a.createElement(l.a,{value:N,onChange:function(e,t){I(t),T.a.MaxTerminalCapacity=t},step:50,min:50,max:500,valueLabelDisplay:"auto",marks:!0})),r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"The time (in seconds) between each autosave. Set to 0 to disable autosave.")},r.a.createElement(s.a,null,"Autosave interval (s)")),r.a.createElement(l.a,{value:j,onChange:function(e,t){F(t),T.a.AutosaveInterval=t},step:30,min:0,max:600,valueLabelDisplay:"auto",marks:!0})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:D,onChange:function(e){B(e.target.checked),T.a.SuppressMessages=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, then any messages you receive will not appear as popups on the screen. They will still get sent to your home computer as '.msg' files and can be viewed with the 'cat' Terminal command.")},r.a.createElement(s.a,null,"Suppress messages"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:L,onChange:function(e){G(e.target.checked),T.a.SuppressFactionInvites=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, then any faction invites you receive will not appear as popups on the screen. Your outstanding faction invites can be viewed in the 'Factions' page.")},r.a.createElement(s.a,null,"Suppress faction invites"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:W,onChange:function(e){H(e.target.checked),T.a.SuppressTravelConfirmation=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, the confirmation message before traveling will not show up. You will automatically be deducted the travel cost as soon as you click.")},r.a.createElement(s.a,null,"Suppress travel confirmations"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:U,onChange:function(e){q(e.target.checked),T.a.SuppressBuyAugmentationConfirmation=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, the confirmation message before buying augmentation will not show up.")},r.a.createElement(s.a,null,"Suppress buy augmentation confirmation"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:K,onChange:function(e){$(e.target.checked),T.a.SuppressHospitalizationPopup=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, a popup message will no longer be shown when you are hospitalized after taking too much damage.")},r.a.createElement(s.a,null,"Suppress hospitalization popup"))})),!!e.player.bladeburner&&r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:z,onChange:function(e){Y(e.target.checked),T.a.SuppressBladeburnerPopup=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, then having your Bladeburner actions interrupted by being busy with something else will not display a popup message.")},r.a.createElement(s.a,null,"Suppress bladeburner popup"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:V,onChange:function(e){J(e.target.checked),T.a.DisableHotkeys=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,'If this is set, then most hotkeys (keyboard shortcuts) in the game are disabled. This includes Terminal commands, hotkeys to navigate between different parts of the game, and the "Save and Close (Ctrl + b)" hotkey in the Text Editor.')},r.a.createElement(s.a,null,"Disable hotkeys"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:Q,onChange:function(e){X(e.target.checked),T.a.DisableASCIIArt=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set all ASCII art will be disabled.")},r.a.createElement(s.a,null,"Disable ascii art"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:Z,onChange:function(e){ee(e.target.checked),T.a.DisableTextEffects=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If this is set, text effects will not be displayed. This can help if text is difficult to read in certain areas.")},r.a.createElement(s.a,null,"Disable text effects"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:te,onChange:function(e){ae(e.target.checked),T.a.EnableBashHotkeys=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"Improved Bash emulation mode. Setting this to 1 enables several new Terminal shortcuts and features that more closely resemble a real Bash-style shell. Note that when this mode is enabled, the default browser shortcuts are overriden by the new Bash shortcuts.")},r.a.createElement(s.a,null,"Enable bash hotkeys"))})),r.a.createElement(y.a,null,r.a.createElement(u.a,{control:r.a.createElement(m.a,{checked:ne,onChange:function(e){re(e.target.checked),T.a.EnableTimestamps=e.target.checked}}),label:r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"Terminal commands and log entries will be timestamped. The timestamp will have the format: M/D h:m")},r.a.createElement(s.a,null,"Enable timestamps"))})),r.a.createElement(y.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"Sets the locale for displaying numbers.")},r.a.createElement(s.a,null,"Locale ")),r.a.createElement(h.a,{value:ie,onChange:function(e){oe(e.target.value),T.a.Locale=e.target.value}},r.a.createElement(p.a,{value:"en"},"en"),r.a.createElement(p.a,{value:"bg"},"bg"),r.a.createElement(p.a,{value:"cs"},"cs"),r.a.createElement(p.a,{value:"da-dk"},"da-dk"),r.a.createElement(p.a,{value:"de"},"de"),r.a.createElement(p.a,{value:"en-au"},"en-au"),r.a.createElement(p.a,{value:"en-gb"},"en-gb"),r.a.createElement(p.a,{value:"es"},"es"),r.a.createElement(p.a,{value:"fr"},"fr"),r.a.createElement(p.a,{value:"hu"},"hu"),r.a.createElement(p.a,{value:"it"},"it"),r.a.createElement(p.a,{value:"lv"},"lv"),r.a.createElement(p.a,{value:"no"},"no"),r.a.createElement(p.a,{value:"pl"},"pl"),r.a.createElement(p.a,{value:"ru"},"ru")))),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("form",{action:"https://www.paypal.com/cgi-bin/webscr",method:"post",target:"_blank"},r.a.createElement("input",{type:"hidden",name:"cmd",value:"_s-xclick"}),r.a.createElement("input",{type:"hidden",name:"encrypted",value:"-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYA2Y2VGE75oWct89z//G2YEJKmzx0uDTXNrpje9ThxmUnBLFZCY+I11Pors7lGRvFqo5okwnu41CfYMPHDxpAgyYyQndMX9pWUX0gLfBMm2BaHwsNBCwt34WmpQqj7TGsQ+aw9NbmkxiJltGnOa+6/gy10mPZAA3HxiieLeCKkGgDELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQI72F1YSzHUd2AgaDMekHU3AKT93Ey9wkB3486bV+ngFSD6VOHrPweH9QATsp+PMe9QM9vmq+s2bGtTbZaYrFqM3M97SnQ0l7IQ5yuOzdZhRdfysu5uJ8dnuHUzq4gLSzqMnZ6/3c+PoHB8AS1nYHUVL4U0+ogZsO1s97IAQyfck9SaoFlxVtqQhkb8752MkQJJvGu3ZQSQGcVC4hFDPk8prXqyq4BU/k/EliwoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTcwNzI1MDExODE2WjAjBgkqhkiG9w0BCQQxFgQUNo8efiZ7sk7nwKM/6B6Z7sU8hIIwDQYJKoZIhvcNAQEBBQAEgYB+JB4vZ/r48815/1HF/xK3+rOx7bPz3kAXmbhW/mkoF4OUbzqMeljvDIA9q/BDdlCLtxFOw9XlftTzv0eZCW/uCIiwu5wTzPIfPY1SI8WHe4cJbP2f2EYxIVs8D7OSirbW4yVa0+gACaLLj0rzIzNN8P/5PxgB03D+jwkcJABqng==-----END PKCS7-----"}),r.a.createElement("input",{type:"image",src:"https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif",name:"submit",alt:"PayPal - The safer, easier way to pay online!"}))),r.a.createElement(c.a,{item:!0,xs:12,sm:6},r.a.createElement(f.a,null,r.a.createElement(d.a,{onClick:()=>e.save()},"Save Game"),r.a.createElement(d.a,{onClick:()=>ue(!0)},"Delete Game")),r.a.createElement(f.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"export")},r.a.createElement(d.a,{onClick:()=>e.export()},r.a.createElement(k.a,{color:"primary"}),"Export")),r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"import")},r.a.createElement(d.a,{onClick:function(){if(!(window.File&&window.FileReader&&window.FileList&&window.Blob))return;const e=a.current;if(null===e)throw new Error("import input should not be null");e.click()}},r.a.createElement(w.a,{color:"primary"}),"Import",r.a.createElement("input",{ref:a,id:"import-game-file-selector",type:"file",hidden:!0,onChange:function(e){const t=e.target.files;if(null===t)return;const a=t[0];if(!a)return void Object(S.a)("Invalid file selected");const n=new FileReader;n.onload=function(e){const t=e.target;if(null===t)return void console.error("error importing file");const a=t.result;if("string"!=typeof a||null===a)return void console.error("FileReader event was not type string");const n=a;Object(M.c)(n).then(()=>location.reload())},n.readAsText(a)}})))),r.a.createElement(f.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"Forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After using this, save the game and then reload the page. This is different then normal kill in that normal kill will tell the script to shut down while force kill just removes the references to it (and it should crash on it's own). This will not remove the files on your computer. Just forcefully kill all running instance of all scripts.")},r.a.createElement(d.a,{onClick:()=>e.forceKill()},"Force kill all active scripts"))),r.a.createElement(f.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"Perform a soft reset. Resets everything as if you had just purchased an Augmentation.")},r.a.createElement(d.a,{onClick:()=>e.softReset()},"Soft Reset"))),r.a.createElement(f.a,null,r.a.createElement(E.a,{title:r.a.createElement(s.a,null,"If your save file is extremely big you can use this button to view a map of all the files on every server. Be careful there might be spoilers.")},r.a.createElement(d.a,{onClick:()=>le(!0)},"Diagnose files")),r.a.createElement(d.a,{onClick:()=>he(!0)},"Theme editor")),r.a.createElement(f.a,null,r.a.createElement(b.a,{href:"https://github.com/danielyxie/bitburner/issues/new",target:"_blank"},r.a.createElement(s.a,null,"Report bug")),r.a.createElement(b.a,{href:"https://bitburner.readthedocs.io/en/latest/changelog.html",target:"_blank"},r.a.createElement(s.a,null,"Changelog")),r.a.createElement(b.a,{href:"https://bitburner.readthedocs.io/en/latest/index.html",target:"_blank"},r.a.createElement(s.a,null,"Documentation")),r.a.createElement(b.a,{href:"https://discord.gg/TFc3hKD",target:"_blank"},r.a.createElement(s.a,null,"Discord")),r.a.createElement(b.a,{href:"https://www.reddit.com/r/bitburner",target:"_blank"},r.a.createElement(s.a,null,"Reddit"))))),r.a.createElement(C.a,{open:se,onClose:()=>le(!1)}),r.a.createElement(x.a,{onConfirm:()=>{ue(!1),Object(M.a)().then(()=>location.reload()).catch(e=>console.error("Could not delete game: "+e))},open:ce,onClose:()=>ue(!1),confirmationText:"Really delete your game? (It's permanent!)"}),r.a.createElement(O.a,{open:me,onClose:()=>he(!1)}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return _}));var n=a(0),r=a.n(n),i=a(32),o=a(304),s=a(3),l=a(330),c=a(278),u=a(52),m=a(1495),h=a(1496),p=a(78),d=a(9),f=a(221),g=a(171),y=a(172),b=a(173),E=a(75),v=a.n(E);function k(e){const t=i.b[e.ip];let a=0;for(const e of t.scripts)a+=e.code.length;for(const e of t.textFiles)a+=e.text.length;if(0===a)return r.a.createElement(r.a.Fragment,null);const n=[];for(const e of t.scripts)n.push({name:e.filename,size:e.code.length});for(const e of t.textFiles)n.push({name:e.fn,size:e.text.length});return n.sort((e,t)=>t.size-e.size),r.a.createElement(g.a,{TransitionProps:{unmountOnExit:!0}},r.a.createElement(y.a,{expandIcon:r.a.createElement(v.a,null)},r.a.createElement(d.a,null,t.hostname," (",s.a.formatBigNumber(a),"b)")),r.a.createElement(b.a,null,r.a.createElement(m.a,{component:f.a},r.a.createElement(l.a,null,r.a.createElement(h.a,null,r.a.createElement(p.a,null,r.a.createElement(u.a,null,r.a.createElement(d.a,null,"Filename")),r.a.createElement(u.a,{align:"right"},r.a.createElement(d.a,null,"Size")))),r.a.createElement(c.a,null,n.map(e=>r.a.createElement(p.a,{key:e.name},r.a.createElement(u.a,{component:"th",scope:"row"},r.a.createElement(d.a,null,e.name)),r.a.createElement(u.a,{align:"right"},r.a.createElement(d.a,null,s.a.formatBigNumber(e.size),"b"))))))),r.a.createElement("ul",null)))}function _(e){const t=[];for(const e of Object.keys(i.b))t.push(e);return r.a.createElement(o.a,{open:e.open,onClose:e.onClose},r.a.createElement(r.a.Fragment,null,r.a.createElement(d.a,null,"Welcome to the file diagnostic! If your save file is really big it's likely because you have too many text/scripts. This tool can help you narrow down where they are."),t.map(e=>r.a.createElement(k,{key:e,ip:e}))))}},,,function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(304),o=a(37),s=a(9);function l(e){return r.a.createElement(i.a,{open:e.open,onClose:e.onClose},r.a.createElement(r.a.Fragment,null,r.a.createElement(s.a,null,e.confirmationText),r.a.createElement(o.a,{onClick:()=>{e.onConfirm()}},"Confirm")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(0),r=a.n(n),i=a(304),o=a(37),s=a(9),l=a(329),c=a(977),u=a.n(c),m=a(116),h=a(384),p=a.n(h),d=a(946),f=a(318),g=a(18);function y({name:e}){const[t,a]=Object(n.useState)(g.a.theme[e]);if(void 0===t)return r.a.createElement(r.a.Fragment,null);const i=t.match(/#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})/g);return r.a.createElement(r.a.Fragment,null,r.a.createElement(l.a,{sx:{mx:1},label:e,value:t,onChange:function(e){a(e.target.value)},variant:"standard",InputProps:{startAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(d.a,{hideTextfield:!0,value:t,onChange:function(e){a("#"+e.hex.toLowerCase())}})),endAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(m.a,{onClick:function(){i&&(g.a.theme[e]=t,f.b.emit())},disabled:!i},r.a.createElement(u.a,{color:i?"primary":"error"})),r.a.createElement(m.a,{onClick:function(){g.a.theme[e]=g.b.theme[e],a(g.b.theme[e]),f.b.emit()}},r.a.createElement(p.a,{color:"primary"})))}}))}function b(e){return r.a.createElement(i.a,{open:e.open,onClose:e.onClose},r.a.createElement(o.a,{color:"primary"},"primary"),r.a.createElement(o.a,{color:"secondary"},"secondary"),r.a.createElement(o.a,{color:"warning"},"warning"),r.a.createElement(o.a,{color:"info"},"info"),r.a.createElement(o.a,{color:"error"},"error"),r.a.createElement(s.a,{color:"primary"},"primary"),r.a.createElement(s.a,{color:"secondary"},"secondary"),r.a.createElement(s.a,{color:"warning"},"warning"),r.a.createElement(s.a,{color:"info"},"info"),r.a.createElement(s.a,{color:"error"},"error"),r.a.createElement("br",null),r.a.createElement(y,{name:"primarylight"}),r.a.createElement(y,{name:"primary"}),r.a.createElement(y,{name:"primarydark"}),r.a.createElement("br",null),r.a.createElement(y,{name:"errorlight"}),r.a.createElement(y,{name:"error"}),r.a.createElement(y,{name:"errordark"}),r.a.createElement("br",null),r.a.createElement(y,{name:"secondarylight"}),r.a.createElement(y,{name:"secondary"}),r.a.createElement(y,{name:"secondarydark"}),r.a.createElement("br",null),r.a.createElement(y,{name:"warninglight"}),r.a.createElement(y,{name:"warning"}),r.a.createElement(y,{name:"warningdark"}),r.a.createElement("br",null),r.a.createElement(y,{name:"infolight"}),r.a.createElement(y,{name:"info"}),r.a.createElement(y,{name:"infodark"}),r.a.createElement("br",null),r.a.createElement(y,{name:"welllight"}),r.a.createElement(y,{name:"well"}),r.a.createElement(y,{name:"white"}),r.a.createElement(y,{name:"black"}),r.a.createElement("br",null),r.a.createElement(y,{name:"hp"}),r.a.createElement(y,{name:"money"}),r.a.createElement(y,{name:"hack"}),r.a.createElement(y,{name:"combat"}),r.a.createElement(y,{name:"cha"}),r.a.createElement(y,{name:"int"}),r.a.createElement(y,{name:"rep"}))}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(983);function o(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(a,150);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement("h1",null,"Sleeves"),r.a.createElement("p",null,"Duplicate Sleeves are MK-V Synthoids (synthetic androids) into which your consciousness has been copied. In other words, these Synthoids contain a perfect duplicate of your mind.",r.a.createElement("br",null),r.a.createElement("br",null),"Sleeves can be used to perform different tasks synchronously.",r.a.createElement("br",null),r.a.createElement("br",null)),r.a.createElement("button",{className:"std-button",style:{display:"inline-block"}},"FAQ"),r.a.createElement("a",{className:"std-button",style:{display:"inline-block"},target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/advancedgameplay/sleeves.html#duplicate-sleeves"},"Documentation"),r.a.createElement("ul",null,e.player.sleeves.map((t,n)=>r.a.createElement("li",{key:n},r.a.createElement(i.a,{rerender:a,player:e.player,sleeve:t})))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return w}));var n=a(0),r=a.n(n),i=a(59),o=a(4),s=a(65),l=a(3),c=a(11),u=a(143),m=a(22),h=a(984),p=a(985),d=a(986),f=a(15),g=a(138),y=a(430),b=a(987),E=a(988),v=a(989),k=a(990),_=a(139);function w(e){const[t,a]=Object(n.useState)(["------","------","------"]);let w=r.a.createElement(r.a.Fragment,null);switch(e.sleeve.currentTask){case i.a.Idle:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently idle");break;case i.a.Company:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently working your job at ",e.sleeve.currentTaskLocation,".");break;case i.a.Faction:{let t="nothing";switch(e.sleeve.factionWorkType){case _.a.Field:t="Field work";break;case _.a.Hacking:t="Hacking contracts";break;case _.a.Security:t="Security work"}w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently doing ",t," for ",e.sleeve.currentTaskLocation,".");break}case i.a.Crime:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently attempting to ",s.a[e.sleeve.crimeType].type," (Success Rate:"," ",l.a.formatPercentage(s.a[e.sleeve.crimeType].successRate(e.sleeve)),").");break;case i.a.Class:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently studying/taking a course at ",e.sleeve.currentTaskLocation,".");break;case i.a.Gym:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently working out at ",e.sleeve.currentTaskLocation,".");break;case i.a.Recovery:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently set to focus on shock recovery. This causes the Sleeve's shock to decrease at a faster rate.");break;case i.a.Synchro:w=r.a.createElement(r.a.Fragment,null,"This sleeve is currently set to synchronize with the original consciousness. This causes the Sleeve's synchronization to increase.");break;default:console.error("Invalid/Unrecognized taskValue in updateSleeveTaskDescription(): "+t[0])}let C=[];if(e.sleeve.currentTask===i.a.Crime)C=[["Money",r.a.createElement(f.a,{money:parseFloat(e.sleeve.currentTaskLocation)}),"(on success)"],["Hacking Exp",l.a.formatExp(e.sleeve.gainRatesForTask.hack),"(2x on success)"],["Strength Exp",l.a.formatExp(e.sleeve.gainRatesForTask.str),"(2x on success)"],["Defense Exp",l.a.formatExp(e.sleeve.gainRatesForTask.def),"(2x on success)"],["Dexterity Exp",l.a.formatExp(e.sleeve.gainRatesForTask.dex),"(2x on success)"],["Agility Exp",l.a.formatExp(e.sleeve.gainRatesForTask.agi),"(2x on success)"],["Charisma Exp",l.a.formatExp(e.sleeve.gainRatesForTask.cha),"(2x on success)"]];else if(C=[["Money:",r.a.createElement(g.a,{money:5*e.sleeve.gainRatesForTask.money})],["Hacking Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.hack)+" / s"],["Strength Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.str)+" / s"],["Defense Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.def)+" / s"],["Dexterity Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.dex)+" / s"],["Agility Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.agi)+" / s"],["Charisma Exp:",l.a.formatExp(5*e.sleeve.gainRatesForTask.cha)+" / s"]],e.sleeve.currentTask===i.a.Company||e.sleeve.currentTask===i.a.Faction){const t=e.sleeve.getRepGain(e.player);C.push(["Reputation:",Object(y.a)(5*t)])}return r.a.createElement("div",{className:"sleeve-elem"},r.a.createElement("div",{className:"sleeve-panel",style:{width:"25%"}},r.a.createElement("div",{className:"sleeve-stats-text"},r.a.createElement(b.a,{sleeve:e.sleeve}),r.a.createElement("button",{className:"std-button",onClick:function(){Object(c.a)(r.a.createElement(E.a,{sleeve:e.sleeve}))}},"More Stats"),r.a.createElement("button",{className:"std-button"+(e.player.money.lt(o.a.TravelCost)?" tooltip":""),onClick:function(){Object(m.a)("sleeve-travel-popup",p.a,{popupId:"sleeve-travel-popup",sleeve:e.sleeve,player:e.player,rerender:e.rerender})},disabled:e.player.money.lt(o.a.TravelCost)},"Travel",e.player.money.lt(o.a.TravelCost)&&r.a.createElement("span",{className:"tooltiptext"},"Not enough money")),r.a.createElement("button",{className:"std-button"+(e.sleeve.shock<100?" tooltip":""),onClick:function(){Object(m.a)("sleeve-augmentation-popup",h.a,{sleeve:e.sleeve,player:e.player})},style:{display:"block"},disabled:e.sleeve.shock<100},"Manage Augmentations",e.sleeve.shock<100&&r.a.createElement("span",{className:"tooltiptext"},"Unlocked when sleeve has fully recovered")))),r.a.createElement("div",{className:"sleeve-panel",style:{width:"40%"}},r.a.createElement(k.a,{player:e.player,sleeve:e.sleeve,setABC:a}),r.a.createElement("p",null,w),r.a.createElement("p",null,e.sleeve.currentTask===i.a.Crime&&Object(u.a)({progress:e.sleeve.currentTaskTime/e.sleeve.currentTaskMaxTime,totalTicks:25})),r.a.createElement("button",{className:"std-button",onClick:function(){switch(e.sleeve.resetTaskStatus(),t[0]){case"------":break;case"Work for Company":e.sleeve.workForCompany(e.player,t[1]);break;case"Work for Faction":e.sleeve.workForFaction(e.player,t[1],t[2]);break;case"Commit Crime":e.sleeve.commitCrime(e.player,t[1]);break;case"Take University Course":e.sleeve.takeUniversityCourse(e.player,t[2],t[1]);break;case"Workout at Gym":e.sleeve.workoutAtGym(e.player,t[2],t[1]);break;case"Shock Recovery":e.sleeve.shockRecovery(e.player);break;case"Synchronize":e.sleeve.synchronize(e.player);break;default:console.error("Invalid/Unrecognized taskValue in setSleeveTask(): "+t[0])}e.rerender()}},"Set Task")),r.a.createElement("div",{className:"sleeve-panel",style:{width:"35%"}},r.a.createElement(d.a,{title:"Earnings (Pre-Synchronization)",stats:C}),r.a.createElement("button",{className:"std-button",onClick:function(){Object(c.a)(r.a.createElement(v.a,{sleeve:e.sleeve}))}},"More Earnings Info")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(511),o=a(19),s=a(15),l=a(445);function c(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(a,150);return()=>clearInterval(e)},[]);const c=e.sleeve.augmentations.map(e=>e.name),u=Object(i.a)(e.sleeve,e.player);return r.a.createElement("div",{className:"noselect"},r.a.createElement("p",{style:{display:"block"}},"Owned Augmentations:"),r.a.createElement("div",{style:{width:"70%"}},c.map(e=>{const t=o.a[e];let a=t.info;return"string"!=typeof a&&(a=Object(l.renderToStaticMarkup)(a)),a+="

",a+=Object(l.renderToStaticMarkup)(t.stats),r.a.createElement("div",{key:e,className:"gang-owned-upgrade tooltip"},e,r.a.createElement("span",{className:"tooltiptext",dangerouslySetInnerHTML:{__html:a}}))})),r.a.createElement("p",null,"You can purchase Augmentations for your Duplicate Sleeves. These Augmentations have the same effect as they would for you. You can only purchase Augmentations that you have unlocked through Factions.",r.a.createElement("br",null),r.a.createElement("br",null),"When purchasing an Augmentation for a Duplicate Sleeve, they are immediately installed. This means that the Duplicate Sleeve will immediately lose all of its stat experience."),u.map(t=>{let n=t.info;return"string"!=typeof n&&(n=Object(l.renderToStaticMarkup)(n)),n+="

",n+=Object(l.renderToStaticMarkup)(t.stats),r.a.createElement("div",{key:t.name,className:"cmpy-mgmt-upgrade-div",onClick:()=>function(t){e.sleeve.tryBuyAugmentation(e.player,t),a()}(t)},r.a.createElement("div",{style:{fontSize:"12px",padding:"2px"}},r.a.createElement("h2",null,t.name),r.a.createElement("br",null),"Cost: ",r.a.createElement(s.a,{money:t.startingCost,player:e.player}),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("span",{dangerouslySetInnerHTML:{__html:n}})))}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(4),o=a(22),s=a(15),l=a(385),c=a(23),u=a(18),m=a(11);function h(e){function t(t){e.player.canAfford(i.a.TravelCost)||Object(m.a)("You cannot afford to have this sleeve travel to another city"),e.sleeve.city=t,e.player.loseMoney(i.a.TravelCost),e.sleeve.resetTaskStatus(),Object(o.b)(e.popupId),e.rerender()}return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Have this sleeve travel to a different city. This affects the gyms and universities at which this sleeve can study. Traveling to a different city costs ",r.a.createElement(s.a,{money:i.a.TravelCost,player:e.player}),". It will also set your current sleeve task to idle."),u.a.DisableASCIIArt?Object.values(c.a).map(e=>r.a.createElement("button",{key:e,className:"std-button",onClick:()=>t(e)},e)):r.a.createElement(l.a,{currentCity:e.sleeve.city,onTravel:e=>t(e)}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(0);function r(e){return n.createElement(n.Fragment,null,n.createElement("pre",null,e.title),n.createElement("table",null,n.createElement("tbody",null,e.stats.map((e,t)=>n.createElement("tr",{key:t},e.map((e,t)=>{let a={};return 0!==t&&(a={textAlign:"right"}),n.createElement("td",{style:a,key:t},e)}))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(3),r=a(0);function i(e){let t={};return t={textAlign:"right"},r.createElement(r.Fragment,null,r.createElement("table",null,r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{className:"character-hp-cell"},"HP: "),r.createElement("td",{className:"character-hp-cell",style:t},n.a.formatHp(e.sleeve.hp)," / ",n.a.formatHp(e.sleeve.max_hp))),r.createElement("tr",null,r.createElement("td",null,"City: "),r.createElement("td",{style:t},e.sleeve.city)),r.createElement("tr",null,r.createElement("td",{className:"character-hack-cell"},"Hacking: "),r.createElement("td",{className:"character-hack-cell",style:t},n.a.formatSkill(e.sleeve.hacking_skill))),r.createElement("tr",null,r.createElement("td",{className:"character-combat-cell"},"Strength: "),r.createElement("td",{className:"character-combat-cell",style:t},n.a.formatSkill(e.sleeve.strength))),r.createElement("tr",null,r.createElement("td",{className:"character-combat-cell"},"Defense: "),r.createElement("td",{className:"character-combat-cell",style:t},n.a.formatSkill(e.sleeve.defense))),r.createElement("tr",null,r.createElement("td",{className:"character-combat-cell"},"Dexterity: "),r.createElement("td",{className:"character-combat-cell",style:t},n.a.formatSkill(e.sleeve.dexterity))),r.createElement("tr",null,r.createElement("td",{className:"character-combat-cell"},"Agility: "),r.createElement("td",{className:"character-combat-cell",style:t},n.a.formatSkill(e.sleeve.agility))),r.createElement("tr",null,r.createElement("td",{className:"character-cha-cell"},"Charisma: "),r.createElement("td",{className:"character-cha-cell",style:t},n.a.formatSkill(e.sleeve.charisma))),r.createElement("tr",null,r.createElement("td",{className:"character-int-cell"},"Shock: "),r.createElement("td",{className:"character-int-cell",style:t},n.a.formatSleeveShock(100-e.sleeve.shock))),r.createElement("tr",null,r.createElement("td",{className:"character-int-cell"},"Sync: "),r.createElement("td",{className:"character-int-cell",style:t},n.a.formatSleeveSynchro(e.sleeve.sync))),r.createElement("tr",null,r.createElement("td",{className:"character-int-cell"},"Memory: "),r.createElement("td",{className:"character-int-cell",style:t},n.a.formatSleeveMemory(e.sleeve.memory))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(3),r=a(196),i=a(0);function o(e){return i.createElement(i.Fragment,null,i.createElement(r.a,{rows:[["Hacking: ",e.sleeve.hacking_skill,`(${n.a.formatExp(e.sleeve.hacking_exp)} exp)`],["Strength: ",e.sleeve.strength,`(${n.a.formatExp(e.sleeve.strength_exp)} exp)`],["Defense: ",e.sleeve.defense,`(${n.a.formatExp(e.sleeve.defense_exp)} exp)`],["Dexterity: ",e.sleeve.dexterity,`(${n.a.formatExp(e.sleeve.dexterity_exp)} exp)`],["Agility: ",e.sleeve.agility,`(${n.a.formatExp(e.sleeve.agility_exp)} exp)`],["Charisma: ",e.sleeve.charisma,`(${n.a.formatExp(e.sleeve.charisma_exp)} exp)`]],title:"Stats:"}),i.createElement("br",null),i.createElement(r.a,{rows:[["Hacking Level multiplier: ",n.a.formatPercentage(e.sleeve.hacking_mult)],["Hacking Experience multiplier: ",n.a.formatPercentage(e.sleeve.hacking_exp_mult)],["Strength Level multiplier: ",n.a.formatPercentage(e.sleeve.strength_mult)],["Strength Experience multiplier: ",n.a.formatPercentage(e.sleeve.strength_exp_mult)],["Defense Level multiplier: ",n.a.formatPercentage(e.sleeve.defense_mult)],["Defense Experience multiplier: ",n.a.formatPercentage(e.sleeve.defense_exp_mult)],["Dexterity Level multiplier: ",n.a.formatPercentage(e.sleeve.dexterity_mult)],["Dexterity Experience multiplier: ",n.a.formatPercentage(e.sleeve.dexterity_exp_mult)],["Agility Level multiplier: ",n.a.formatPercentage(e.sleeve.agility_mult)],["Agility Experience multiplier: ",n.a.formatPercentage(e.sleeve.agility_exp_mult)],["Charisma Level multiplier: ",n.a.formatPercentage(e.sleeve.charisma_mult)],["Charisma Experience multiplier: ",n.a.formatPercentage(e.sleeve.charisma_exp_mult)],["Faction Reputation Gain multiplier: ",n.a.formatPercentage(e.sleeve.faction_rep_mult)],["Company Reputation Gain multiplier: ",n.a.formatPercentage(e.sleeve.company_rep_mult)],["Salary multiplier: ",n.a.formatPercentage(e.sleeve.work_money_mult)],["Crime Money multiplier: ",n.a.formatPercentage(e.sleeve.crime_money_mult)],["Crime Success multiplier: ",n.a.formatPercentage(e.sleeve.crime_success_mult)]],title:"Multipliers:"}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(3),r=a(15),i=a(0),o=a(196);function s(e){return i.createElement(i.Fragment,null,i.createElement(o.a,{rows:[["Money ",i.createElement(r.a,{money:e.sleeve.earningsForTask.money})],["Hacking Exp ",n.a.formatExp(e.sleeve.earningsForTask.hack)],["Strength Exp ",n.a.formatExp(e.sleeve.earningsForTask.str)],["Defense Exp ",n.a.formatExp(e.sleeve.earningsForTask.def)],["Dexterity Exp ",n.a.formatExp(e.sleeve.earningsForTask.dex)],["Agility Exp ",n.a.formatExp(e.sleeve.earningsForTask.agi)],["Charisma Exp ",n.a.formatExp(e.sleeve.earningsForTask.cha)]],title:"Earnings for Current Task:"}),i.createElement("br",null),i.createElement(o.a,{rows:[["Money: ",i.createElement(r.a,{money:e.sleeve.earningsForPlayer.money})],["Hacking Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.hack)],["Strength Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.str)],["Defense Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.def)],["Dexterity Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.dex)],["Agility Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.agi)],["Charisma Exp: ",n.a.formatExp(e.sleeve.earningsForPlayer.cha)]],title:"Total Earnings for Host Consciousness:"}),i.createElement("br",null),i.createElement(o.a,{rows:[["Money: ",i.createElement(r.a,{money:e.sleeve.earningsForSleeves.money})],["Hacking Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.hack)],["Strength Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.str)],["Defense Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.def)],["Dexterity Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.dex)],["Agility Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.agi)],["Charisma Exp: ",n.a.formatExp(e.sleeve.earningsForSleeves.cha)]],title:"Total Earnings for Other Sleeves:"}),i.createElement("br",null))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a(0),r=a.n(n),i=a(59),o=a(65),s=a(8),l=a(23),c=a(24),u=a(139);const m=["Study Computer Science","Data Structures","Networks","Algorithms","Management","Leadership"],h=["Train Strength","Train Defense","Train Dexterity","Train Agility"];function p(e,t){const a=[];for(const n of e.sleeves)t!==n&&n.currentTask===i.a.Company&&a.push(n.currentTaskLocation);const n=Object.keys(e.jobs);for(let e=0;e({first:["------"],second:()=>["------"]}),"Work for Company":(e,t)=>{let a=p(e,t);return 0===a.length&&(a=["------"]),{first:a,second:()=>["------"]}},"Work for Faction":(e,t)=>{let a=d(e,t);return 0===a.length&&(a=["------"]),{first:a,second:e=>{const t=c.a[e].getInfo(),a=[];return t.offerHackingWork&&a.push("Hacking Contracts"),t.offerFieldWork&&a.push("Field Work"),t.offerSecurityWork&&a.push("Security Work"),a}}},"Commit Crime":()=>({first:Object.keys(o.a),second:()=>["------"]}),"Take University Course":(e,t)=>{let a=[];switch(t.city){case l.a.Aevum:a=[s.a.AevumSummitUniversity];break;case l.a.Sector12:a=[s.a.Sector12RothmanUniversity];break;case l.a.Volhaven:a=[s.a.VolhavenZBInstituteOfTechnology];break;default:a=["No university available in city!"]}return{first:m,second:()=>a}},"Workout at Gym":(e,t)=>{let a=[];switch(t.city){case l.a.Aevum:a=[s.a.AevumCrushFitnessGym,s.a.AevumSnapFitnessGym];break;case l.a.Sector12:a=[s.a.Sector12IronGym,s.a.Sector12PowerhouseGym];break;case l.a.Volhaven:a=[s.a.VolhavenMilleniumFitnessGym];break;default:a=["No gym available in city!"]}return{first:h,second:()=>a}},"Shock Recovery":()=>({first:["------"],second:()=>["------"]}),Synchronize:()=>({first:["------"],second:()=>["------"]})},g={"------":()=>!0,"Work for Company":(e,t)=>p(e,t).length>0,"Work for Faction":(e,t)=>d(e,t).length>0,"Commit Crime":()=>!0,"Take University Course":(e,t)=>[l.a.Aevum,l.a.Sector12,l.a.Volhaven].includes(t.city),"Workout at Gym":(e,t)=>[l.a.Aevum,l.a.Sector12,l.a.Volhaven].includes(t.city),"Shock Recovery":(e,t)=>t.shock<100,Synchronize:(e,t)=>t.sync<100};function y(e){const t=function(e){switch(e.currentTask){case i.a.Idle:return["------","------","------"];case i.a.Company:return["Work for Company",e.currentTaskLocation,"------"];case i.a.Faction:{let t="";switch(e.factionWorkType){case u.a.Hacking:t="Hacking Contracts";break;case u.a.Field:t="Field Work";break;case u.a.Security:t="Security Work"}return["Work for Faction",e.currentTaskLocation,t]}case i.a.Crime:return["Commit Crime",e.crimeType,"------"];case i.a.Class:return["Take University Course",e.className,e.currentTaskLocation];case i.a.Gym:return["Workout at Gym",e.gymStatType,e.currentTaskLocation];case i.a.Recovery:return["Shock Recovery","------","------"];case i.a.Synchro:return["Synchronize","------","------"]}}(e.sleeve),[a,o]=Object(n.useState)(t[0]),[s,l]=Object(n.useState)(t[1]),[c,m]=Object(n.useState)(t[2]),h=Object.keys(g).filter(t=>g[t](e.player,e.sleeve)),p=f[a];if(void 0===p)throw new Error(`No function for task '${a}'`);const d=p(e.player,e.sleeve),y=d.second(s);return d.first.length>0&&!d.first.includes(s)&&(l(d.first[0]),e.setABC([a,d.first[0],c])),y.length>0&&!y.includes(c)&&(m(y[0]),e.setABC([a,s,y[0]])),r.a.createElement(r.a.Fragment,null,r.a.createElement("select",{className:"dropdown",onChange:function(t){const n=t.target.value,r=f[n];if(void 0===r)throw new Error(`No function for task '${a}'`);const i=r(e.player,e.sleeve),s=i.second(i.first[0]);m(s[0]),l(i.first[0]),o(n),e.setABC([n,i.first[0],s[0]])},defaultValue:a},h.map(e=>r.a.createElement("option",{key:e,value:e},e))),!(1===d.first.length&&"------"===d.first[0])&&r.a.createElement("select",{className:"dropdown",onChange:function(t){l(t.target.value),e.setABC([a,t.target.value,c])},defaultValue:s},d.first.map(e=>r.a.createElement("option",{key:e,value:e},e))),!(1===y.length&&"------"===y[0])&&r.a.createElement("select",{className:"dropdown",onChange:function(t){m(t.target.value),e.setABC([a,s,t.target.value])},defaultValue:c},y.map(e=>r.a.createElement("option",{key:e,value:e},e))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(0),r=a.n(n),i=a(992),o=a(993),s=a(996),l=a(269),c=a(997),u=a(999),m=a(1e3),h=a(1001),p=a(33),d=a(50),f=a(32),g=a(101),y=a(22);function b(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}const[b,E]=Object(n.useState)(p.c.x1);Object(n.useEffect)(()=>{const e=setInterval(a,1e3);return()=>clearInterval(e)},[]);let v,k=0;for(let t=0;tE(p.c.x1),()=>E(p.c.x5),()=>E(p.c.x10),()=>E(p.c.MAX)],w=e.player.hacknetNodes.map(t=>{if(Object(d.g)(e.player)){if(t instanceof l.a)throw new Error("node was hacknet node");const n=f.b[t];if(null==n)throw new Error("Could not find Hacknet Server object in AllServers map for IP: "+t);if(n instanceof g.a)throw new Error("node was normal server");return r.a.createElement(s.a,{player:e.player,key:n.hostname,node:n,purchaseMultiplier:b,rerender:a})}if("string"==typeof t)throw new Error("node was ip string");return r.a.createElement(o.a,{player:e.player,key:t.name,node:t,purchaseMultiplier:b,rerender:a})});return r.a.createElement(r.a.Fragment,null,r.a.createElement("h1",null,"Hacknet ",Object(d.g)(e.player)?"Servers":"Nodes"),r.a.createElement(i.a,{hasHacknetServers:Object(d.g)(e.player)}),r.a.createElement(h.a,{cost:v,multiplier:b,onClick:function(){Object(d.l)(e.player),a()}}),r.a.createElement("br",null),r.a.createElement("div",{id:"hacknet-nodes-money-multipliers-div"},r.a.createElement(m.a,{totalProduction:k,player:e.player}),r.a.createElement(u.a,{onClicks:_,purchaseMultiplier:b})),Object(d.g)(e.player)&&r.a.createElement("button",{className:"std-button",onClick:function(){Object(y.a)("hacknet-server-hash-upgrades-popup",c.a,{player:e.player})},style:{display:"block"}},"Spend Hashes on Upgrades"),r.a.createElement("ul",{id:"hacknet-nodes-list"},w))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a.n(n);function i(e){return r.a.createElement("div",null,r.a.createElement("p",{className:"hacknet-general-info"},"The Hacknet is a global, decentralized network of machines. It is used by hackers all around the world to anonymously share computing power and perform distributed cyberattacks without the fear of being traced."),e.hasHacknetServers?r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"hacknet-general-info"},"Here, you can purchase a Hacknet Server, an upgraded version of the Hacknet Node. Hacknet Servers will perform computations and operations on the network, earning you hashes. Hashes can be spent on a variety of different upgrades."),r.a.createElement("p",{className:"hacknet-general-info"},"Hacknet Servers can also be used as servers to run scripts. However, running scripts on a server will reduce its hash rate (hashes generated per second). A Hacknet Server's hash rate will be reduced by the percentage of RAM that is being used by that Server to run scripts.")):r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"hacknet-general-info"},"Here, you can purchase a Hacknet Node, a specialized machine that can connect and contribute its resources to the Hacknet network. This allows you to take a small percentage of profits from hacks performed on the network. Essentially, you are renting out your Node's computing power."),r.a.createElement("p",{className:"hacknet-general-info"},"Each Hacknet Node you purchase will passively earn you money. Each Hacknet Node can be upgraded in order to increase its computing power and thereby increase the profit you earn from it.")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(33),o=a(50),s=a(15),l=a(138);function c(e){const t=e.node,a=e.purchaseMultiplier,n=e.rerender;let c,u,m,h,p,d;if(t.level>=i.a.MaxLevel)c=r.a.createElement(r.a.Fragment,null,"MAX LEVEL"),u="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.e)(e.player,t,i.a.MaxLevel);else{const e=i.a.MaxLevel-t.level;n=Math.min(e,a)}const l=t.calculateLevelUpgradeCost(n,e.player.hacknet_node_level_cost_mult);c=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),u=e.player.money.lt(l)?"std-button-disabled":"std-button"}if(t.ram>=i.a.MaxRam)m=r.a.createElement(r.a.Fragment,null,"MAX RAM"),h="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.f)(e.player,t,i.a.MaxRam);else{const e=Math.round(Math.log2(i.a.MaxRam/t.ram));n=Math.min(e,a)}const l=t.calculateRamUpgradeCost(n,e.player.hacknet_node_ram_cost_mult);m=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),h=e.player.money.lt(l)?"std-button-disabled":"std-button"}if(t.cores>=i.a.MaxCores)p=r.a.createElement(r.a.Fragment,null,"MAX CORES"),d="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.d)(e.player,t,i.a.MaxCores);else{const e=i.a.MaxCores-t.cores;n=Math.min(e,a)}const l=t.calculateCoreUpgradeCost(n,e.player.hacknet_node_core_cost_mult);p=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),d=e.player.money.lt(l)?"std-button-disabled":"std-button"}return r.a.createElement("li",{className:"hacknet-node"},r.a.createElement("div",{className:"hacknet-node-container"},r.a.createElement("div",{className:"row"},r.a.createElement("h1",{style:{fontSize:"1em"}},t.name)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Production:"),r.a.createElement("span",{className:"text money-gold"},r.a.createElement(s.a,{money:t.totalMoneyGenerated,player:e.player})," (",r.a.createElement(l.a,{money:t.moneyGainRatePerSecond}),")")),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Level:"),r.a.createElement("span",{className:"text upgradable-info"},t.level),r.a.createElement("button",{className:u,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.e)(e.player,t,i.a.MaxLevel)),Object(o.n)(e.player,t,r),n()}},c)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"RAM:"),r.a.createElement("span",{className:"text upgradable-info"},t.ram,"GB"),r.a.createElement("button",{className:h,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.f)(e.player,t,i.a.MaxRam)),Object(o.o)(e.player,t,r),n()}},m)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Cores:"),r.a.createElement("span",{className:"text upgradable-info"},t.cores),r.a.createElement("button",{className:d,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.d)(e.player,t,i.a.MaxCores)),Object(o.k)(e.player,t,r),n()}},p))))}},function(e,t,a){"use strict";function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}a.d(t,"a",(function(){return r}));class r{constructor(e){n(this,"costPerLevel",0),n(this,"desc",""),n(this,"hasTargetServer",!1),n(this,"name",""),n(this,"value",0),n(this,"effectText",()=>null),null!=e.cost&&(this.cost=e.cost),null!=e.effectText&&(this.effectText=e.effectText),this.costPerLevel=e.costPerLevel,this.desc=e.desc,this.hasTargetServer=!!e.hasTargetServer&&e.hasTargetServer,this.name=e.name,this.value=e.value}getCost(e){return"number"==typeof this.cost?this.cost:Math.round((e+1)*this.costPerLevel)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(3),o=a(15);const s=[{cost:4,costPerLevel:4,desc:"Sell hashes for $1m",name:"Sell for Money",effectText:e=>r.a.createElement(r.a.Fragment,null,"Sold for ",r.a.createElement(o.a,{money:1e6*e})),value:1e6},{costPerLevel:100,desc:"Sell hashes for $1b in Corporation funds",name:"Sell for Corporation Funds",effectText:e=>r.a.createElement(r.a.Fragment,null,"Sold for ",r.a.createElement(o.a,{money:1e9*e})," Corporation funds."),value:1e9},{costPerLevel:50,desc:"Use hashes to decrease the minimum security of a single server by 2%. Note that a server's minimum security cannot go below 1. This effect persists until you install Augmentations (since servers are reset at that time).",hasTargetServer:!0,name:"Reduce Minimum Security",value:.98},{costPerLevel:50,desc:"Use hashes to increase the maximum amount of money on a single server by 2%. This effect persists until you install Augmentations (since servers are reset at that time).",hasTargetServer:!0,name:"Increase Maximum Money",value:1.02},{costPerLevel:50,desc:"Use hashes to improve the experience earned when studying at a university by 20%. This effect persists until you install Augmentations",name:"Improve Studying",effectText:e=>r.a.createElement(r.a.Fragment,null,"Improves studying by ",20*e,"%"),value:20},{costPerLevel:50,desc:"Use hashes to improve the experience earned when training at the gym by 20%. This effect persists until you install Augmentations",name:"Improve Gym Training",effectText:e=>r.a.createElement(r.a.Fragment,null,"Improves training by ",20*e,"%"),value:20},{costPerLevel:200,desc:"Exchange hashes for 1k Scientific Research in all of your Corporation's Industries",name:"Exchange for Corporation Research",effectText:e=>r.a.createElement(r.a.Fragment,null,"Acquired a total of ",e,"k Scientific Research in your industries."),value:1e3},{costPerLevel:250,desc:"Exchange hashes for 100 Bladeburner Rank",name:"Exchange for Bladeburner Rank",effectText:e=>r.a.createElement(r.a.Fragment,null,"Acquired a total of ",i.a.format(100*e,"0a")," Bladeburner rank"),value:100},{costPerLevel:250,desc:"Exchanges hashes for 10 Bladeburner Skill Points",name:"Exchange for Bladeburner SP",effectText:e=>r.a.createElement(r.a.Fragment,null,"Acquired a total of ",i.a.format(10*e,"0a")," Bladeburner Skill Points"),value:10},{costPerLevel:200,desc:"Generate a random Coding Contract somewhere on the network",name:"Generate Coding Contract",effectText:e=>r.a.createElement(r.a.Fragment,null,"Generated ",e," contracts."),value:1}]},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(33),o=a(50),s=a(15),l=a(195),c=a(512);function u(e){const t=e.node,a=e.purchaseMultiplier,n=e.rerender;let u,m,h,p,d,f,g,y;if(t.level>=i.b.MaxLevel)u=r.a.createElement(r.a.Fragment,null,"MAX LEVEL"),m="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.e)(e.player,t,i.b.MaxLevel);else{const e=i.b.MaxLevel-t.level;n=Math.min(e,a)}const l=t.calculateLevelUpgradeCost(n,e.player.hacknet_node_level_cost_mult);u=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),m=e.player.money.lt(l)?"std-button-disabled":"std-button"}if(t.maxRam>=i.b.MaxRam)h=r.a.createElement(r.a.Fragment,null,"MAX RAM"),p="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.f)(e.player,t,i.b.MaxRam);else{const e=Math.round(Math.log2(i.b.MaxRam/t.maxRam));n=Math.min(e,a)}const l=t.calculateRamUpgradeCost(n,e.player.hacknet_node_ram_cost_mult);h=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),p=e.player.money.lt(l)?"std-button-disabled":"std-button"}if(t.cores>=i.b.MaxCores)d=r.a.createElement(r.a.Fragment,null,"MAX CORES"),f="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.d)(e.player,t,i.b.MaxCores);else{const e=i.b.MaxCores-t.cores;n=Math.min(e,a)}const l=t.calculateCoreUpgradeCost(n,e.player.hacknet_node_core_cost_mult);d=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),f=e.player.money.lt(l)?"std-button-disabled":"std-button"}if(t.cache>=i.b.MaxCache)g=r.a.createElement(r.a.Fragment,null,"MAX CACHE"),y="std-button-disabled";else{let n=0;if("MAX"===a)n=Object(o.c)(e.player,t,i.b.MaxCache);else{const e=i.b.MaxCache-t.cache;n=Math.min(e,a)}const l=t.calculateCacheUpgradeCost(n);g=r.a.createElement(r.a.Fragment,null,"Upgrade x",n," - ",r.a.createElement(s.a,{money:l,player:e.player})),y=e.player.money.lt(l)?"std-button-disabled":"std-button"}return r.a.createElement("li",{className:"hacknet-node"},r.a.createElement("div",{className:"hacknet-node-container"},r.a.createElement("div",{className:"row"},r.a.createElement("h1",{style:{fontSize:"1em"}},t.hostname)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Production:"),r.a.createElement("span",{className:"text money-gold"},Object(l.a)(t.totalHashesGenerated)," (",Object(c.a)(t.hashRate),")")),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Hash Capacity:"),r.a.createElement("span",{className:"text"},Object(l.a)(t.hashCapacity))),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Level:"),r.a.createElement("span",{className:"text upgradable-info"},t.level),r.a.createElement("button",{className:m,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.e)(e.player,t,i.b.MaxLevel)),Object(o.n)(e.player,t,r),n()}},u)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"RAM:"),r.a.createElement("span",{className:"text upgradable-info"},t.maxRam,"GB"),r.a.createElement("button",{className:p,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.f)(e.player,t,i.b.MaxRam)),Object(o.o)(e.player,t,r),n()}},h)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Cores:"),r.a.createElement("span",{className:"text upgradable-info"},t.cores),r.a.createElement("button",{className:f,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.d)(e.player,t,i.b.MaxCores)),Object(o.k)(e.player,t,r),n()}},d)),r.a.createElement("div",{className:"row"},r.a.createElement("p",null,"Cache Level:"),r.a.createElement("span",{className:"text upgradable-info"},t.cache),r.a.createElement("button",{className:y,onClick:function(){let r=a;"MAX"===a&&(r=Object(o.c)(e.player,t,i.b.MaxCache)),Object(o.j)(e.player,t,r),n(),Object(o.p)(e.player)}},g))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(316),o=a(229),s=a(195),l=a(998);function c(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(()=>t(e=>!e),1e3);return()=>clearInterval(e)},[]);const c=e.player.hashManager;if(!(c instanceof i.a))throw new Error("Player does not have a HashManager)");const u=Object.keys(o.a).map(t=>{const n=o.a[t];return r.a.createElement(l.a,{player:e.player,upg:n,hashManager:c,key:n.name,rerender:a})});return r.a.createElement("div",null,r.a.createElement("p",null,"Spend your hashes on a variety of different upgrades"),r.a.createElement("p",null,"Hashes: ",Object(s.a)(e.player.hashManager.hashes)),u)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(50),o=a(613),s=a(11),l=a(127),c=a(195);function u(e){const[t,a]=Object(n.useState)("ecorp");const u=e.hashManager,m=e.upg,h=u.getUpgradeCost(m.name),p=u.upgrades[m.name],d=m.effectText(p),f=u.hashes>=h?"std-button":"std-button-disabled";return r.a.createElement("div",{className:"bladeburner-action"},r.a.createElement(l.b,{value:m.name}),r.a.createElement("p",null,"Cost: ",Object(c.a)(h),", Bought: ",p," times"),r.a.createElement("p",null,m.desc),r.a.createElement("button",{className:f,onClick:function(){if(e.hashManager.hashes>=e.hashManager.getUpgradeCost(e.upg.name)){Object(i.m)(e.player,e.upg.name,t)||Object(s.a)("Failed to purchase upgrade. This may be because you do not have enough hashes, or because you do not have access to the feature upgrade affects."),e.rerender()}}},"Purchase"),p>0&&d&&r.a.createElement("p",null,d),m.hasTargetServer&&r.a.createElement(o.a,{serverType:o.b.Foreign,onChange:function(e){a(e.target.value)},style:{margin:"5px"}}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(33);function o(e){return r.a.createElement("button",{className:e.className,onClick:e.onClick},e.text)}function s(e){if(null==e.purchaseMultiplier)throw new Error("MultiplierButtons constructed without required props");const t=["x1","x5","x10","MAX"],a=e.onClicks,n=[];for(let s=0;s!e)}const E=s.a[e.locName];if(null==E)throw new Error("CompanyLocation component constructed with invalid company: "+e.locName);const v=o.a[e.locName];if(null==v)throw new Error("CompanyLocation component constructed with invalid location: "+e.locName);const k=t.jobs[e.locName]?t.jobs[e.locName]:null,_=k?c.a[k]:null;t.location=e.locName;const w=null!=k,C=E.getFavorGain();return r.a.createElement("div",null,w&&r.a.createElement("div",null,r.a.createElement("p",null,"Job Title: ",k),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"block"}},"-------------------------"),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip"},"Company reputation: ",Object(h.a)(E.playerReputation),r.a.createElement("span",{className:"tooltiptext"},"You will earn ",Object(p.a)(C[0])," company favor upon resetting after installing Augmentations")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"block"}},"-------------------------"),r.a.createElement("br",null),r.a.createElement("p",{className:"tooltip"},"Company Favor: ",Object(p.a)(E.favor),r.a.createElement("span",{className:"tooltiptext"},"Company favor increases the rate at which you earn reputation for this company by 1% per favor. Company favor is gained whenever you reset after installing Augmentations. The amount of favor you gain depends on how much reputation you have with the comapny.")),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",{style:{display:"block"}},"-------------------------"),r.a.createElement("br",null),r.a.createElement(m.a,{onClick:function(n){if(!n.isTrusted)return;const r=_;r instanceof l.a&&(r.isPartTimeJob()||r.isSoftwareConsultantJob()||r.isBusinessConsultantJob()?t.startWorkPartTime(a,e.locName):t.startWork(a,e.locName),a.toWork())},text:"Work"}),"    ",r.a.createElement(m.a,{onClick:function(a){if(!a.isTrusted)return;Object(d.a)("quit-job-popup",g.a,{locName:e.locName,company:E,player:t,onQuit:b,popupId:"quit-job-popup"})},text:"Quit"})),E.hasAgentPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.a[0]],onClick:function(e){e.isTrusted&&(t.applyForAgentJob(),b())},p:t,style:{display:"block"},text:"Apply for Agent Job"}),E.hasBusinessConsultantPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.c[0]],onClick:function(e){e.isTrusted&&(t.applyForBusinessConsultantJob(),b())},p:t,style:{display:"block"},text:"Apply for Business Consultant Job"}),E.hasBusinessPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.b[0]],onClick:function(e){e.isTrusted&&(t.applyForBusinessJob(),b())},p:t,style:{display:"block"},text:"Apply for Business Job"}),E.hasEmployeePositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.e[1]],onClick:function(e){e.isTrusted&&(t.applyForEmployeeJob(),b())},p:t,style:{display:"block"},text:"Apply to be an Employee"}),E.hasEmployeePositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.g[1]],onClick:function(e){e.isTrusted&&(t.applyForPartTimeEmployeeJob(),b())},p:t,style:{display:"block"},text:"Apply to be a part-time Employee"}),E.hasITPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.d[0]],onClick:function(e){e.isTrusted&&(t.applyForItJob(),b())},p:t,style:{display:"block"},text:"Apply for IT Job"}),E.hasSecurityPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.h[2]],onClick:function(e){e.isTrusted&&(t.applyForSecurityJob(),b())},p:t,style:{display:"block"},text:"Apply for Security Job"}),E.hasSoftwareConsultantPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.k[0]],onClick:function(e){e.isTrusted&&(t.applyForSoftwareConsultantJob(),b())},p:t,style:{display:"block"},text:"Apply for Software Consultant Job"}),E.hasSoftwarePositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.j[0]],onClick:function(e){e.isTrusted&&(t.applyForSoftwareJob(),b())},p:t,style:{display:"block"},text:"Apply for Software Job"}),E.hasWaiterPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.e[0]],onClick:function(e){e.isTrusted&&(t.applyForWaiterJob(),b())},p:t,style:{display:"block"},text:"Apply to be a Waiter"}),E.hasWaiterPositions()&&r.a.createElement(i.a,{company:E,entryPosType:c.a[u.g[0]],onClick:function(e){e.isTrusted&&(t.applyForPartTimeWaiterJob(),b())},p:t,style:{display:"block"},text:"Apply to be a part-time Waiter"}),null!=v.infiltrationData&&r.a.createElement(m.a,{onClick:function(t){if(!t.isTrusted)return;const n=v;if(!n.infiltrationData)throw new Error(`trying to start infiltration at ${e.locName} but the infiltrationData is null`);a.toInfiltration(n)},style:{display:"block"},text:"Infiltrate Company"}),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("br",null))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(25);const r=[{name:n.j[0],nextPosition:n.j[1],baseSalary:33,charismaEffectiveness:15,charismaExpGain:.02,hackingEffectiveness:85,hackingExpGain:.05,reqdHacking:1,repMultiplier:.9},{name:n.j[1],nextPosition:n.j[2],baseSalary:80,charismaEffectiveness:15,charismaExpGain:.05,hackingEffectiveness:85,hackingExpGain:.1,reqdHacking:51,reqdReputation:8e3,repMultiplier:1.1},{name:n.j[2],nextPosition:n.j[3],baseSalary:165,charismaEffectiveness:20,charismaExpGain:.08,hackingEffectiveness:80,hackingExpGain:.4,reqdCharisma:51,reqdHacking:251,reqdReputation:4e4,repMultiplier:1.3},{name:n.j[3],nextPosition:n.j[4],baseSalary:500,charismaEffectiveness:25,charismaExpGain:.1,hackingEffectiveness:75,hackingExpGain:.8,reqdCharisma:151,reqdHacking:401,reqdReputation:2e5,repMultiplier:1.5},{name:n.j[4],nextPosition:n.j[5],baseSalary:800,charismaEffectiveness:25,charismaExpGain:.5,hackingEffectiveness:75,hackingExpGain:1,reqdCharisma:251,reqdHacking:501,reqdReputation:4e5,repMultiplier:1.6},{name:n.j[5],nextPosition:n.j[6],baseSalary:1650,charismaEffectiveness:25,charismaExpGain:.5,hackingEffectiveness:75,hackingExpGain:1.1,reqdCharisma:251,reqdHacking:501,reqdReputation:8e5,repMultiplier:1.6},{name:n.j[6],nextPosition:n.j[7],baseSalary:2310,charismaEffectiveness:30,charismaExpGain:.6,hackingEffectiveness:70,hackingExpGain:1.2,reqdCharisma:401,reqdHacking:601,reqdReputation:16e5,repMultiplier:1.75},{name:n.j[7],nextPosition:null,baseSalary:2640,charismaEffectiveness:35,charismaExpGain:1,hackingEffectiveness:65,hackingExpGain:1.5,reqdCharisma:501,reqdHacking:751,reqdReputation:32e5,repMultiplier:2},{name:n.d[0],nextPosition:n.d[1],baseSalary:26,charismaEffectiveness:10,charismaExpGain:.01,hackingEffectiveness:90,hackingExpGain:.04,reqdHacking:1,repMultiplier:.9},{name:n.d[1],nextPosition:n.d[2],baseSalary:66,charismaEffectiveness:15,charismaExpGain:.02,hackingEffectiveness:85,hackingExpGain:.08,reqdHacking:26,reqdReputation:7e3,repMultiplier:1.1},{name:n.d[2],nextPosition:n.d[3],baseSalary:132,charismaEffectiveness:20,charismaExpGain:.1,hackingEffectiveness:80,hackingExpGain:.3,reqdCharisma:51,reqdHacking:151,reqdReputation:35e3,repMultiplier:1.3},{name:n.d[3],nextPosition:n.j[5],baseSalary:410,charismaEffectiveness:20,charismaExpGain:.2,hackingEffectiveness:80,hackingExpGain:.5,reqdCharisma:76,reqdHacking:251,reqdReputation:175e3,repMultiplier:1.4},{name:n.i[0],nextPosition:n.j[5],baseSalary:121,charismaEffectiveness:15,charismaExpGain:.05,hackingEffectiveness:85,hackingExpGain:.4,reqdCharisma:26,reqdHacking:151,reqdReputation:35e3,repMultiplier:1.2},{name:n.f[0],nextPosition:n.f[1],baseSalary:121,charismaEffectiveness:15,charismaExpGain:.05,hackingEffectiveness:85,hackingExpGain:.4,reqdCharisma:26,reqdHacking:151,reqdReputation:35e3,repMultiplier:1.2},{name:n.f[1],nextPosition:n.j[5],baseSalary:410,charismaEffectiveness:20,charismaExpGain:.1,hackingEffectiveness:80,hackingExpGain:.5,reqdCharisma:76,reqdHacking:251,reqdReputation:175e3,repMultiplier:1.3},{name:n.b[0],nextPosition:n.b[1],baseSalary:46,charismaEffectiveness:90,charismaExpGain:.08,hackingEffectiveness:10,hackingExpGain:.01,reqdCharisma:1,reqdHacking:1,repMultiplier:.9},{name:n.b[1],nextPosition:n.b[2],baseSalary:100,charismaEffectiveness:85,charismaExpGain:.15,hackingEffectiveness:15,hackingExpGain:.02,reqdCharisma:51,reqdHacking:6,reqdReputation:8e3,repMultiplier:1.1},{name:n.b[2],nextPosition:n.b[3],baseSalary:200,charismaEffectiveness:85,charismaExpGain:.3,hackingEffectiveness:15,hackingExpGain:.02,reqdCharisma:101,reqdHacking:51,reqdReputation:4e4,repMultiplier:1.3},{name:n.b[3],nextPosition:n.b[4],baseSalary:660,charismaEffectiveness:85,charismaExpGain:.4,hackingEffectiveness:15,hackingExpGain:.02,reqdCharisma:226,reqdHacking:51,reqdReputation:2e5,repMultiplier:1.5},{name:n.b[4],nextPosition:n.b[5],baseSalary:1950,charismaEffectiveness:90,charismaExpGain:1,hackingEffectiveness:10,hackingExpGain:.05,reqdCharisma:501,reqdHacking:76,reqdReputation:8e5,repMultiplier:1.6},{name:n.b[5],nextPosition:null,baseSalary:3900,charismaEffectiveness:90,charismaExpGain:1.5,hackingEffectiveness:10,hackingExpGain:.05,reqdCharisma:751,reqdHacking:101,reqdReputation:32e5,repMultiplier:1.75},{name:n.h[0],nextPosition:n.h[1],baseSalary:82,hackingEffectiveness:5,strengthEffectiveness:20,defenseEffectiveness:20,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:15,hackingExpGain:.02,strengthExpGain:.08,defenseExpGain:.08,dexterityExpGain:.08,agilityExpGain:.08,charismaExpGain:.04,reqdHacking:11,reqdStrength:101,reqdDefense:101,reqdDexterity:101,reqdAgility:101,reqdCharisma:51,reqdReputation:8e3,repMultiplier:1},{name:n.h[1],nextPosition:null,baseSalary:460,hackingEffectiveness:5,strengthEffectiveness:20,defenseEffectiveness:20,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:15,hackingExpGain:.02,strengthExpGain:.1,defenseExpGain:.1,dexterityExpGain:.1,agilityExpGain:.1,charismaExpGain:.1,reqdHacking:101,reqdStrength:301,reqdDefense:301,reqdDexterity:301,reqdAgility:301,reqdCharisma:151,reqdReputation:36e3,repMultiplier:1.25},{name:n.h[2],nextPosition:n.h[3],baseSalary:50,hackingEffectiveness:5,strengthEffectiveness:20,defenseEffectiveness:20,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:15,hackingExpGain:.01,strengthExpGain:.04,defenseExpGain:.04,dexterityExpGain:.04,agilityExpGain:.04,charismaExpGain:.02,reqdStrength:51,reqdDefense:51,reqdDexterity:51,reqdAgility:51,reqdCharisma:1,repMultiplier:1},{name:n.h[3],nextPosition:n.h[4],baseSalary:195,hackingEffectiveness:10,strengthEffectiveness:20,defenseEffectiveness:20,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:10,hackingExpGain:.02,strengthExpGain:.1,defenseExpGain:.1,dexterityExpGain:.1,agilityExpGain:.1,charismaExpGain:.05,reqdHacking:26,reqdStrength:151,reqdDefense:151,reqdDexterity:151,reqdAgility:151,reqdCharisma:51,reqdReputation:8e3,repMultiplier:1.1},{name:n.h[4],nextPosition:n.h[5],baseSalary:660,hackingEffectiveness:10,strengthEffectiveness:15,defenseEffectiveness:15,dexterityEffectiveness:15,agilityEffectiveness:15,charismaEffectiveness:30,hackingExpGain:.02,strengthExpGain:.12,defenseExpGain:.12,dexterityExpGain:.12,agilityExpGain:.12,charismaExpGain:.1,reqdHacking:26,reqdStrength:251,reqdDefense:251,reqdDexterity:251,reqdAgility:251,reqdCharisma:101,reqdReputation:36e3,repMultiplier:1.25},{name:n.h[5],nextPosition:null,baseSalary:1320,hackingEffectiveness:10,strengthEffectiveness:15,defenseEffectiveness:15,dexterityEffectiveness:15,agilityEffectiveness:15,charismaEffectiveness:30,hackingExpGain:.05,strengthExpGain:.15,defenseExpGain:.15,dexterityExpGain:.15,agilityExpGain:.15,charismaExpGain:.15,reqdHacking:51,reqdStrength:501,reqdDefense:501,reqdDexterity:501,reqdAgility:501,reqdCharisma:151,reqdReputation:144e3,repMultiplier:1.4},{name:n.a[0],nextPosition:n.a[1],baseSalary:330,hackingEffectiveness:10,strengthEffectiveness:15,defenseEffectiveness:15,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:20,hackingExpGain:.04,strengthExpGain:.08,defenseExpGain:.08,dexterityExpGain:.08,agilityExpGain:.08,charismaExpGain:.05,reqdHacking:101,reqdStrength:101,reqdDefense:101,reqdDexterity:101,reqdAgility:101,reqdCharisma:101,reqdReputation:8e3,repMultiplier:1},{name:n.a[1],nextPosition:n.a[2],baseSalary:990,hackingEffectiveness:15,strengthEffectiveness:15,defenseEffectiveness:15,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:15,hackingExpGain:.1,strengthExpGain:.15,defenseExpGain:.15,dexterityExpGain:.15,agilityExpGain:.15,charismaExpGain:.1,reqdHacking:201,reqdStrength:251,reqdDefense:251,reqdDexterity:251,reqdAgility:251,reqdCharisma:201,reqdReputation:32e3,repMultiplier:1.25},{name:n.a[2],nextPosition:null,baseSalary:2e3,hackingEffectiveness:15,strengthEffectiveness:15,defenseEffectiveness:15,dexterityEffectiveness:20,agilityEffectiveness:20,charismaEffectiveness:15,hackingExpGain:.15,strengthExpGain:.2,defenseExpGain:.2,dexterityExpGain:.2,agilityExpGain:.2,charismaExpGain:.15,reqdHacking:251,reqdStrength:501,reqdDefense:501,reqdDexterity:501,reqdAgility:501,reqdCharisma:251,reqdReputation:162e3,repMultiplier:1.5},{name:n.e[0],nextPosition:null,baseSalary:22,strengthEffectiveness:10,dexterityEffectiveness:10,agilityEffectiveness:10,charismaEffectiveness:70,strengthExpGain:.02,defenseExpGain:.02,dexterityExpGain:.02,agilityExpGain:.02,charismaExpGain:.05,repMultiplier:1},{name:n.e[1],nextPosition:null,baseSalary:22,strengthEffectiveness:10,dexterityEffectiveness:10,agilityEffectiveness:10,charismaEffectiveness:70,strengthExpGain:.02,defenseExpGain:.02,dexterityExpGain:.02,agilityExpGain:.02,charismaExpGain:.04,repMultiplier:1},{name:n.k[0],nextPosition:n.k[1],baseSalary:66,hackingEffectiveness:80,charismaEffectiveness:20,hackingExpGain:.08,charismaExpGain:.03,reqdHacking:51,repMultiplier:1},{name:n.k[1],nextPosition:null,baseSalary:132,hackingEffectiveness:75,charismaEffectiveness:25,hackingExpGain:.25,charismaExpGain:.06,reqdHacking:251,reqdCharisma:51,repMultiplier:1.2},{name:n.c[0],nextPosition:n.c[1],baseSalary:66,hackingEffectiveness:20,charismaEffectiveness:80,hackingExpGain:.015,charismaExpGain:.15,reqdHacking:6,reqdCharisma:51,repMultiplier:1},{name:n.c[1],nextPosition:null,baseSalary:525,hackingEffectiveness:15,charismaEffectiveness:85,hackingExpGain:.015,charismaExpGain:.3,reqdHacking:51,reqdCharisma:226,repMultiplier:1.2},{name:n.g[0],nextPosition:null,baseSalary:20,strengthEffectiveness:10,dexterityEffectiveness:10,agilityEffectiveness:10,charismaEffectiveness:70,strengthExpGain:.0075,defenseExpGain:.0075,dexterityExpGain:.0075,agilityExpGain:.0075,charismaExpGain:.04,repMultiplier:1},{name:n.g[1],nextPosition:null,baseSalary:20,strengthEffectiveness:10,dexterityEffectiveness:10,agilityEffectiveness:10,charismaEffectiveness:70,strengthExpGain:.0075,defenseExpGain:.0075,dexterityExpGain:.0075,agilityExpGain:.0075,charismaExpGain:.03,repMultiplier:1}]},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(22);function o(e){return r.a.createElement(r.a.Fragment,null,"Would you like to quit your job at ",e.company.name,"?",r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("button",{autoFocus:!0,className:"std-button",onClick:function(){e.player.quitJob(e.locName),e.onQuit(),Object(i.b)(e.popupId)}},"Quit"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a(4),i=a(38),o=a(55),s=a(26),l=a(15);class c extends n.Component{constructor(e){super(e),this.btnStyle={display:"block"},this.trainStrength=this.trainStrength.bind(this),this.trainDefense=this.trainDefense.bind(this),this.trainDexterity=this.trainDexterity.bind(this),this.trainAgility=this.trainAgility.bind(this),this.calculateCost=this.calculateCost.bind(this)}calculateCost(){const e=o.a.getIp(this.props.loc.name),t=Object(i.b)(e);if(null==t||!t.hasOwnProperty("backdoorInstalled"))return this.props.loc.costMult;const a=t.backdoorInstalled?.9:1;return this.props.loc.costMult*a}train(e){const t=this.props.loc;this.props.p.startClass(this.props.router,this.calculateCost(),t.expMult,e)}trainStrength(){this.train(r.a.ClassGymStrength)}trainDefense(){this.train(r.a.ClassGymDefense)}trainDexterity(){this.train(r.a.ClassGymDexterity)}trainAgility(){this.train(r.a.ClassGymAgility)}render(){const e=r.a.ClassGymBaseCost*this.calculateCost();return n.createElement("div",null,n.createElement(s.a,{onClick:this.trainStrength,style:this.btnStyle,text:n.createElement(n.Fragment,null,"Train Strength (",n.createElement(l.a,{money:e,player:this.props.p})," / sec)")}),n.createElement(s.a,{onClick:this.trainDefense,style:this.btnStyle,text:n.createElement(n.Fragment,null,"Train Defense (",n.createElement(l.a,{money:e,player:this.props.p})," / sec)")}),n.createElement(s.a,{onClick:this.trainDexterity,style:this.btnStyle,text:n.createElement(n.Fragment,null,"Train Dexterity (",n.createElement(l.a,{money:e,player:this.props.p})," / sec)")}),n.createElement(s.a,{onClick:this.trainAgility,style:this.btnStyle,text:n.createElement(n.Fragment,null,"Train Agility (",n.createElement(l.a,{money:e,player:this.props.p})," / sec)")}))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(347),i=a(155),o=a(15),s=a(11);class l extends n.Component{constructor(e){super(e),this.btnStyle={display:"block"},this.getCost=this.getCost.bind(this),this.getHealed=this.getHealed.bind(this),this.state={currHp:this.props.p.hp}}getCost(){return Object(r.b)(this.props.p)}getHealed(e){if(!e.isTrusted)return;if(this.props.p.hp<0&&(this.props.p.hp=0),this.props.p.hp>=this.props.p.max_hp)return;const t=this.getCost();this.props.p.loseMoney(t),this.props.p.hp=this.props.p.max_hp,this.props.p.recordMoneySource(-1*t,"hospitalization"),this.setState({currHp:this.props.p.hp}),Object(s.a)(n.createElement(n.Fragment,null,"You were healed to full health! The hospital billed you for ",n.createElement(o.a,{money:t})))}render(){const e=this.getCost();return n.createElement(i.a,{onClick:this.getHealed,style:this.btnStyle,text:n.createElement(n.Fragment,null,"Get treatment for wounds - ",n.createElement(o.a,{money:e,player:this.props.p}))})}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(65),i=a(3),o=a(155),s=a(47);function l(){const e=s.b.Player(),t=s.b.Router();const a=r.a.Shoplift.successRate(e),l=r.a.RobStore.successRate(e),c=r.a.Mug.successRate(e),u=r.a.Larceny.successRate(e),m=r.a.DealDrugs.successRate(e),h=r.a.BondForgery.successRate(e),p=r.a.TraffickArms.successRate(e),d=r.a.Homicide.successRate(e),f=r.a.GrandTheftAuto.successRate(e),g=r.a.Kidnap.successRate(e),y=r.a.Assassination.successRate(e),b=r.a.Heist.successRate(e);return n.createElement("div",null,n.createElement(o.a,{label:`Shoplift (${i.a.formatPercentage(a)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Shoplift.commit(t,e)},style:{display:"block"},text:`Shoplift (${i.a.formatPercentage(a)} chance of success)`,tooltip:"Attempt to shoplift from a low-end retailer"}),n.createElement(o.a,{label:`Rob store (${i.a.formatPercentage(l)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.RobStore.commit(t,e)},style:{display:"block"},text:`Rob store (${i.a.formatPercentage(l)} chance of success)`,tooltip:"Attempt to commit armed robbery on a high-end store"}),n.createElement(o.a,{label:`Mug someone (${i.a.formatPercentage(c)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Mug.commit(t,e)},style:{display:"block"},text:`Mug someone (${i.a.formatPercentage(c)} chance of success)`,tooltip:"Attempt to mug a random person on the street"}),n.createElement(o.a,{label:`Larceny (${i.a.formatPercentage(u)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Larceny.commit(t,e)},style:{display:"block"},text:`Larceny (${i.a.formatPercentage(u)} chance of success)`,tooltip:"Attempt to rob property from someone's house"}),n.createElement(o.a,{label:`Deal Drugs (${i.a.formatPercentage(m)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.DealDrugs.commit(t,e)},style:{display:"block"},text:`Deal Drugs (${i.a.formatPercentage(m)} chance of success)`,tooltip:"Attempt to deal drugs"}),n.createElement(o.a,{label:`Bond Forgery (${i.a.formatPercentage(h)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.BondForgery.commit(t,e)},style:{display:"block"},text:`Bond Forgery (${i.a.formatPercentage(h)} chance of success)`,tooltip:"Attempt to forge corporate bonds"}),n.createElement(o.a,{label:`Traffick illegal Arms (${i.a.formatPercentage(p)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.TraffickArms.commit(t,e)},style:{display:"block"},text:`Traffick illegal Arms (${i.a.formatPercentage(p)} chance of success)`,tooltip:"Attempt to smuggle illegal arms into the city"}),n.createElement(o.a,{label:`Homicide (${i.a.formatPercentage(d)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Homicide.commit(t,e)},style:{display:"block"},text:`Homicide (${i.a.formatPercentage(d)} chance of success)`,tooltip:"Attempt to murder a random person on the street"}),n.createElement(o.a,{label:`Grand theft Auto (${i.a.formatPercentage(f)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.GrandTheftAuto.commit(t,e)},style:{display:"block"},text:`Grand theft Auto (${i.a.formatPercentage(f)} chance of success)`,tooltip:"Attempt to commit grand theft auto"}),n.createElement(o.a,{label:`Kidnap and Ransom (${i.a.formatPercentage(g)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Kidnap.commit(t,e)},style:{display:"block"},text:`Kidnap and Ransom (${i.a.formatPercentage(g)} chance of success)`,tooltip:"Attempt to kidnap and ransom a high-profile-target"}),n.createElement(o.a,{label:`Assassinate (${i.a.formatPercentage(y)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Assassination.commit(t,e)},style:{display:"block"},text:`Assassinate (${i.a.formatPercentage(y)} chance of success)`,tooltip:"Attempt to assassinate a high-profile target"}),n.createElement(o.a,{label:`Heist (${i.a.formatPercentage(b)} chance of success)`,intervalTime:5e3,onClick:function(a){a.isTrusted&&r.a.Heist.commit(t,e)},style:{display:"block"},text:`Heist (${i.a.formatPercentage(b)} chance of success)`,tooltip:"Attempt to pull off the ultimate heist"}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(1009),o=a(22),s=a(8),l=a(47),c=a(155),u=a(26),m=a(11);function h(e){const t=l.b.Player(),a=l.b.Router(),h=Object(n.useState)(!1)[1],p=t.inBladeburner();function d(){const e="create-start-corporation-popup";Object(o.a)(e,i.a,{player:t,popupId:e,router:a})}function f(){const e=t;if(e.inBladeburner())a.toBladeburner();else if(e.strength>=100&&e.defense>=100&&e.dexterity>=100&&e.agility>=100){e.startBladeburner({new:!0}),Object(m.a)("You have been accepted into the Bladeburner division!"),h(e=>!e);const t=document.getElementById("world-menu-header");t instanceof HTMLElement&&(t.click(),t.click())}else Object(m.a)("Rejected! Please apply again when you have 100 of each combat stat (str, def, dex, agi)")}function g(){a.toResleeves()}switch(e.loc.name){case s.a.NewTokyoVitaLife:return t.canAccessResleeving()?r.a.createElement(u.a,{onClick:g,style:{display:"block"},text:"Re-Sleeve"}):r.a.createElement(r.a.Fragment,null);case s.a.Sector12CityHall:return t.canAccessCorporation()?r.a.createElement(c.a,{disabled:!t.canAccessCorporation()||t.hasCorporation(),onClick:d,style:{display:"block"},text:"Create a Corporation"}):r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("i",null,"A business man is yelling at a clerk. You should come back later.")));case s.a.Sector12NSA:return function(){if(!t.canAccessBladeburner())return r.a.createElement(r.a.Fragment,null);const e=p?"Enter Bladeburner Headquarters":"Apply to Bladeburner Division";return r.a.createElement(u.a,{onClick:f,style:{display:"block"},text:e})}();case s.a.NewTokyoNoodleBar:return r.a.createElement(u.a,{onClick:function(){Object(m.a)(r.a.createElement(r.a.Fragment,null,"You ate some delicious noodles and feel refreshed."))},style:{display:"block"},text:"Eat noodles"});default:return console.error(`Location ${e.loc.name} doesn't have any special properties`),r.a.createElement(r.a.Fragment,null)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(22),o=a(15),s=a(11);function l(e){if(!e.player.canAccessCorporation()||e.player.hasCorporation())return Object(i.b)(e.popupId),r.a.createElement(r.a.Fragment,null);const[t,a]=Object(n.useState)("");return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,"Would you like to start a corporation? This will require $150b for registration and initial funding. This $150b can either be self-funded, or you can obtain the seed money from the government in exchange for 500 million shares",r.a.createElement("br",null),r.a.createElement("br",null),"If you would like to start one, please enter a name for your corporation below:"),r.a.createElement("input",{autoFocus:!0,className:"text-input",placeholder:"Corporation Name",onChange:function(e){a(e.target.value)},value:t}),r.a.createElement("button",{className:"std-button",onClick:function(){""!=t?(e.player.startCorporation(t,5e8),Object(s.a)("Congratulations! You just started your own corporation with government seed money. You can visit and manage your company in the City."),Object(i.b)(e.popupId),e.router.toCorporation()):Object(s.a)("Invalid company name!")},disabled:""==t},"Use seed money"),r.a.createElement("button",{className:"std-button",onClick:function(){e.player.canAfford(15e10)?""!=t?(e.player.startCorporation(t),e.player.loseMoney(15e10),Object(s.a)("Congratulations! You just self-funded your own corporation. You can visit and manage your company in the City."),Object(i.b)(e.popupId),e.router.toCorporation()):Object(s.a)("Invalid company name!"):Object(s.a)("You don't have enough money to create a corporation! You need $150b.")},disabled:""==t||!e.player.canAfford(15e10)},"Self-Fund (",r.a.createElement(o.a,{money:15e10,player:e.player}),")"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(1011),o=a(1013),s=a(1015),l=a(185),c=a(26),u=a(15),m=a(22),h=a(1016);function p(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}function p(e,t,n){Object(m.a)("purchase-server-popup",h.a,{ram:e,cost:t,p:n,popupId:"purchase-server-popup",rerender:a})}Object(n.useEffect)(()=>{const e=setInterval(a,1e3);return()=>clearInterval(e)},[]);const d={display:"block"},f=[];for(let t=e.loc.techVendorMinRam;t<=e.loc.techVendorMaxRam;t*=2){const a=Object(l.a)(t);f.push(r.a.createElement(c.a,{key:t,onClick:()=>p(t,a,e.p),style:d,text:r.a.createElement(r.a.Fragment,null,"Purchase ",t,"GB Server - ",r.a.createElement(u.a,{money:a,player:e.p})),disabled:!e.p.canAfford(a)}))}return r.a.createElement("div",null,f,r.a.createElement("br",null),r.a.createElement("p",{className:"noselect"},r.a.createElement("i",null,'"You can order bigger servers via scripts. We don\'t take custom order in person."')),r.a.createElement("br",null),r.a.createElement(o.a,{p:e.p,rerender:a}),r.a.createElement(i.a,{p:e.p,rerender:a}),r.a.createElement(s.a,{p:e.p,rerender:a}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a.n(n),i=a(4),o=a(185),s=a(240),l=a(26),c=a(15),u=a(208);function m(e){const t={display:"block"},a=e.p.getHomeComputer();if(a.maxRam>=i.a.HomeComputerMaxRam)return r.a.createElement(s.a,{style:t,text:"Upgrade 'home' RAM - MAX"});const n=e.p.getUpgradeHomeRamCost();return r.a.createElement(l.a,{disabled:!e.p.canAfford(n),onClick:function(){Object(o.d)(e.p),e.rerender()},style:t,text:r.a.createElement(r.a.Fragment,null,"Upgrade 'home' RAM (",a.maxRam,"GB -> ",2*a.maxRam,"GB) -"," ",r.a.createElement(c.a,{money:n,player:e.p})),tooltip:r.a.createElement(u.a,{tex:String.raw`\large{cost = 3.2 \times 10^3 \times 1.58^{log_2{(ram)}}}`})})}},function(e,t,a){"use strict";function n(e){return!isNaN(e)&&(0!==e&&0==(e&e-1))}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(1014),o=a(4),s=a(240),l=a(26),c=a(15);function u(e){const t={display:"block"};return e.p.hasTorRouter()?r.a.createElement(s.a,{style:t,text:"TOR Router - Purchased"}):r.a.createElement(l.a,{disabled:!e.p.canAfford(o.a.TorRouterCost),onClick:function(){Object(i.a)(e.p),e.rerender()},style:t,text:r.a.createElement(r.a.Fragment,null,"Purchase TOR router - ",r.a.createElement(c.a,{money:o.a.TorRouterCost,player:e.p}))})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(4),r=a(32),i=a(38),o=a(55),s=a(11);function l(e){if(e.hasTorRouter())return void Object(s.a)("You already have a TOR Router!");if(!e.canAfford(n.a.TorRouterCost))return void Object(s.a)("You cannot afford to purchase the TOR router!");e.loseMoney(n.a.TorRouterCost);const t=Object(i.h)({ip:Object(r.c)(),hostname:"darkweb",organizationName:"",isConnectedTo:!1,adminRights:!1,purchasedByPlayer:!1,maxRam:1});Object(r.a)(t),o.a.addIp("Darkweb Server",t.ip),e.getHomeComputer().serversOnNetwork.push(t.ip),t.serversOnNetwork.push(e.getHomeComputer().ip),Object(s.a)("You have purchased a TOR router!
You now have access to the dark web from your home computer.
Use the scan/scan-analyze commands to search for the dark web connection.")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(240),o=a(26),s=a(15),l=a(208);function c(e){const t={display:"block"},a=e.p.getHomeComputer(),n=a.cpuCores>=8;if(n)return r.a.createElement(i.a,{style:t,text:"Upgrade 'home' cores - MAX"});const c=1e9*Math.pow(7.5,a.cpuCores);return r.a.createElement(o.a,{disabled:!e.p.canAfford(c),onClick:function(){n||e.p.canAfford(c)&&(e.p.loseMoney(c),a.cpuCores++,e.rerender())},style:t,text:r.a.createElement(r.a.Fragment,null,"Upgrade 'home' cores (",a.cpuCores," -> ",a.cpuCores+1,") -"," ",r.a.createElement(s.a,{money:c,player:e.p})),tooltip:r.a.createElement(l.a,{tex:String.raw`\large{cost = 10^9 \times 7.5 ^{\text{cores}}}`})})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(22),o=a(185),s=a(3),l=a(15),c=a(26);function u(e){const[t,a]=Object(n.useState)("");function u(){Object(o.e)(t,e.ram,e.cost,e.p),Object(i.b)(e.popupId)}return r.a.createElement(r.a.Fragment,null,"Would you like to purchase a new server with ",s.a.formatRAM(e.ram)," of RAM for"," ",r.a.createElement(l.a,{money:e.cost,player:e.p}),"?",r.a.createElement("br",null),r.a.createElement("br",null),"Please enter the server hostname below:",r.a.createElement("br",null),r.a.createElement("div",{className:"popup-box-input-div"},r.a.createElement("input",{autoFocus:!0,onKeyUp:function(e){13===e.keyCode&&u()},onChange:function(e){a(e.target.value)},className:"text-input noselect",type:"text",placeholder:"Unique Hostname"}),r.a.createElement(c.a,{onClick:u,text:"Purchase Server",disabled:!e.p.canAfford(e.cost)})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(4),o=a(15),s=a(22);function l(e){const t=i.a.TravelCost;return r.a.createElement(r.a.Fragment,null,r.a.createElement("span",null,"Would you like to travel to ",e.city,"? The trip will cost ",r.a.createElement(o.a,{money:t,player:e.player}),"."),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("button",{className:"std-button",onClick:function(){e.travel(),Object(s.b)(e.popupId)}},"Travel"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a(4),i=a(38),o=a(55),s=a(26),l=a(15),c=a(47);function u(e){const t=c.b.Player(),a=c.b.Router();function u(){const t=o.a.getIp(e.loc.name),a=Object(i.b)(t);if(null==a||!a.hasOwnProperty("backdoorInstalled"))return e.loc.costMult;const n=a.backdoorInstalled?.9:1;return e.loc.costMult*n}function m(n){const r=e.loc;t.startClass(a,u(),r.expMult,n)}const h=u(),p=r.a.ClassDataStructuresBaseCost*h,d=r.a.ClassNetworksBaseCost*h,f=r.a.ClassAlgorithmsBaseCost*h,g=r.a.ClassManagementBaseCost*h,y=r.a.ClassLeadershipBaseCost*h;return n.createElement("div",null,n.createElement(s.a,{onClick:function(){m(r.a.ClassStudyComputerScience)},style:{display:"block"},text:"Study Computer Science (free)",tooltip:"Gain hacking experience!"}),n.createElement(s.a,{onClick:function(){m(r.a.ClassDataStructures)},style:{display:"block"},text:n.createElement(n.Fragment,null,"Take Data Structures course (",n.createElement(l.a,{money:p,player:t})," / sec)"),tooltip:"Gain hacking experience!"}),n.createElement(s.a,{onClick:function(){m(r.a.ClassNetworks)},style:{display:"block"},text:n.createElement(n.Fragment,null,"Take Networks course (",n.createElement(l.a,{money:d,player:t})," / sec)"),tooltip:"Gain hacking experience!"}),n.createElement(s.a,{onClick:function(){m(r.a.ClassAlgorithms)},style:{display:"block"},text:n.createElement(n.Fragment,null,"Take Algorithms course (",n.createElement(l.a,{money:f,player:t})," / sec)"),tooltip:"Gain hacking experience!"}),n.createElement(s.a,{onClick:function(){m(r.a.ClassManagement)},style:{display:"block"},text:n.createElement(n.Fragment,null,"Take Management course (",n.createElement(l.a,{money:g,player:t})," / sec)"),tooltip:"Gain charisma experience!"}),n.createElement(s.a,{onClick:function(){m(r.a.ClassLeadership)},style:{display:"block"},text:n.createElement(n.Fragment,null,"Take Leadership course (",n.createElement(l.a,{money:y,player:t})," / sec)"),tooltip:"Gain charisma experience!"}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n,r=a(0),i=a(1020),o=a(1024),s=a(1025),l=a(1026),c=a(26);!function(e){e.None="none",e.Coin="coin",e.Slots="slots",e.Roulette="roulette",e.Blackjack="blackjack"}(n||(n={}));class u extends r.Component{constructor(e){super(e),this.state={game:n.None},this.updateGame=this.updateGame.bind(this)}updateGame(e){this.setState({game:e})}renderGames(){return r.createElement(r.Fragment,null,r.createElement(c.a,{onClick:()=>this.updateGame(n.Coin),text:"Play coin flip"}),r.createElement("br",null),r.createElement(c.a,{onClick:()=>this.updateGame(n.Slots),text:"Play slots"}),r.createElement("br",null),r.createElement(c.a,{onClick:()=>this.updateGame(n.Roulette),text:"Play roulette"}),r.createElement("br",null),r.createElement(c.a,{onClick:()=>this.updateGame(n.Blackjack),text:"Play blackjack"}))}renderGame(){let e=null;switch(this.state.game){case n.Coin:e=r.createElement(o.a,{p:this.props.p});break;case n.Slots:e=r.createElement(l.a,{p:this.props.p});break;case n.Roulette:e=r.createElement(s.a,{p:this.props.p});break;case n.Blackjack:e=r.createElement(i.a,{p:this.props.p});break;case n.None:break;default:throw new Error("MissingCaseException: "+this.state.game)}return r.createElement(r.Fragment,null,r.createElement(c.a,{onClick:()=>this.updateGame(n.None),text:"Stop playing"}),e)}render(){return this.state.game===n.None?this.renderGames():this.renderGame()}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a(15),i=a(306),o=a(1021),s=a(446),l=a(1527),c=a(615),u=a(1023),m=a(544),h=a(616);function p(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var d;!function(e){e.Pending="",e.PlayerWon="You won!",e.PlayerWonByBlackjack="You Won! Blackjack!",e.DealerWon="You lost!",e.Tie="Push! (Tie)"}(d||(d={}));class f extends i.a{constructor(e){super(e),p(this,"canStartGame",()=>{const{p:e}=this.props,{bet:t}=this.state;return e.canAfford(t)}),p(this,"startGame",()=>{if(!this.canStartGame())return;this.props.p.loseMoney(this.state.bet);const e=new s.a([this.deck.safeDrawCard(),this.deck.safeDrawCard()]),t=new s.a([this.deck.safeDrawCard(),this.deck.safeDrawCard()]);this.setState({playerHand:e,dealerHand:t,gameInProgress:!0,result:d.Pending}),21===this.getTrueHandValue(e)?21===this.getTrueHandValue(t)?this.finishGame(d.Tie):this.finishGame(d.PlayerWonByBlackjack):21===this.getTrueHandValue(t)&&this.finishGame(d.DealerWon)}),p(this,"getHandValue",e=>{let t=[0];for(let a=0;a=10?t.map(e=>e+10):1===n?t.flatMap(e=>[e+1,e+11]):t.map(e=>e+n)}return t}),p(this,"getTrueHandValue",e=>{const t=this.getHandValue(e),a=t.filter(e=>e<=21);return a.length>0?(a.sort((e,t)=>e-t),a[a.length-1]):t[0]}),p(this,"getHandDisplayValues",e=>{const t=this.getHandValue(e);return this.isHandBusted(e)?[...new Set([t[0]])]:[...new Set(t.filter(e=>e<=21))]}),p(this,"isHandBusted",e=>this.getTrueHandValue(e)>21),p(this,"playerHit",e=>{if(!e.isTrusted)return;const t=this.state.playerHand.addCards(this.deck.safeDrawCard());this.setState({playerHand:t}),this.isHandBusted(t)&&this.finishGame(d.DealerWon)}),p(this,"playerStay",e=>{if(!e.isTrusted)return;let t=this.state.dealerHand;for(;;){if(!(this.getTrueHandValue(t)<=16))break;t=t.addCards(this.deck.safeDrawCard())}if(this.setState({dealerHand:t}),this.isHandBusted(t))this.finishGame(d.PlayerWon);else{const e=this.getTrueHandValue(t),a=this.getTrueHandValue(this.state.playerHand);if(e>21||a>21)throw new Error("Someone busted when not expected to");a>e?this.finishGame(d.PlayerWon):a{let t=0;this.isPlayerWinResult(e)?(t=this.state.bet,this.win(this.props.p,2*t)):e===d.DealerWon?(t=-1*this.state.bet,this.win(this.props.p,-this.state.bet)):e===d.Tie&&this.win(this.props.p,this.state.bet),this.setState({gameInProgress:!1,result:e,gains:this.state.gains+t})}),p(this,"isPlayerWinResult",e=>e===d.PlayerWon||e===d.PlayerWonByBlackjack),p(this,"wagerOnChange",e=>{const{p:t}=this.props,a=e.target.value,n=Math.round(parseFloat(a));isNaN(n)?this.setState({bet:0,betInput:a,wagerInvalid:!0,wagerInvalidHelperText:"Not a valid number"}):n<=0?this.setState({bet:0,betInput:a,wagerInvalid:!0,wagerInvalidHelperText:"Must bet a postive amount"}):n>1e8?this.setState({bet:0,betInput:a,wagerInvalid:!0,wagerInvalidHelperText:"Exceeds max bet"}):t.canAfford(n)?this.setState({bet:n,betInput:a,wagerInvalid:!1,wagerInvalidHelperText:"",result:d.Pending}):this.setState({bet:0,betInput:a,wagerInvalid:!0,wagerInvalidHelperText:"Not enough money"})}),p(this,"startOnClick",e=>{e.isTrusted&&(this.state.wagerInvalid||this.startGame())}),this.deck=new o.a(5);this.state={playerHand:new s.a([]),dealerHand:new s.a([]),bet:1e6,betInput:String(1e6),gameInProgress:!1,result:d.Pending,gains:0,wagerInvalid:!1,wagerInvalidHelperText:""}}render(){const{betInput:e,playerHand:t,dealerHand:a,gameInProgress:i,result:o,wagerInvalid:s,wagerInvalidHelperText:p,gains:f}=this.state,g=this.getHandDisplayValues(t),y=this.getHandDisplayValues(a);return n.createElement("div",null,n.createElement("div",null,n.createElement(u.a,{value:e,label:n.createElement(n.Fragment,null,"Wager (Max: ",n.createElement(r.a,{money:1e8}),")"),disabled:i,onChange:this.wagerOnChange,error:s,helperText:s?p:"",type:"number",variant:"filled",style:{width:"200px"},InputProps:{startAdornment:n.createElement(l.a,{position:"start"},"$")}}),n.createElement("p",null,"Total earnings this session: ",n.createElement(r.a,{money:f}))),i?n.createElement("div",null,n.createElement(m.a,{onClick:this.playerHit},"Hit"),n.createElement(m.a,{color:"secondary",onClick:this.playerStay},"Stay")):n.createElement("div",null,n.createElement(m.a,{onClick:this.startOnClick,disabled:s||!this.canStartGame()},"Start")),(i||o!==d.Pending)&&n.createElement("div",null,n.createElement(h.a,{variant:"outlined",elevation:2},n.createElement("pre",null,"Player"),t.cards.map((e,t)=>n.createElement(c.a,{card:e,key:t})),n.createElement("pre",null,"Value(s): "),g.map((e,t)=>n.createElement("pre",{key:t},e))),n.createElement("br",null),n.createElement(h.a,{variant:"outlined",elevation:2},n.createElement("pre",null,"Dealer"),a.cards.map((e,t)=>n.createElement(c.a,{card:e,hidden:i&&0!==t,key:t})),!i&&n.createElement(n.Fragment,null,n.createElement("pre",null,"Value(s): "),y.map((e,t)=>n.createElement("pre",{key:t},e))))),o!==d.Pending&&n.createElement("p",null,o,this.isPlayerWinResult(o)&&n.createElement(n.Fragment,null," You gained ",n.createElement(r.a,{money:this.state.bet})),o===d.DealerWon&&n.createElement(n.Fragment,null," You lost ",n.createElement(r.a,{money:this.state.bet}))))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(201),r=a(1022);class i{constructor(e=1){var t,a,n;n=[],(a="cards")in(t=this)?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,this.numDecks=e,this.reset()}shuffle(){this.cards=Object(r.shuffle)(this.cards)}drawCard(){if(0==this.cards.length)throw new Error("Tried to draw card from empty deck");return this.cards.shift()}safeDrawCard(){return 0===this.cards.length&&this.reset(),this.drawCard()}reset(){this.cards=[];for(let e=1;e<=13;++e)for(let t=0;t{var t,a;return r.a.createElement(i.a,s({},e,{classes:{...u(),...e.classes},InputProps:{classes:{...m(),...null===(t=e.InputProps)||void 0===t?void 0:t.classes},...e.InputProps},InputLabelProps:{classes:{...h(),...null===(a=e.InputLabelProps)||void 0===a?void 0:a.classes},...e.InputLabelProps}}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(26),i=a(296),o=a(306),s=a(66);class l extends o.a{constructor(e){super(e),this.state={investment:1e3,result:n.createElement("span",null," "),status:"",playLock:!1},this.play=this.play.bind(this),this.updateInvestment=this.updateInvestment.bind(this)}updateInvestment(e){let t=parseInt(e.currentTarget.value);isNaN(t)&&(t=0),t>1e4&&(t=1e4),t<0&&(t=0),this.setState({investment:t})}play(e){if(this.reachedLimit(this.props.p))return;let t;t=i.a.random()<.5?"H":"T";const a=e===t;this.setState({result:n.createElement("span",{className:a?"text":"failure"},t),status:a?" win!":"lose!",playLock:!0}),setTimeout(()=>this.setState({playLock:!1}),250),a?this.win(this.props.p,this.state.investment):this.win(this.props.p,-this.state.investment),this.reachedLimit(this.props.p)}render(){return n.createElement(n.Fragment,null,n.createElement("pre",null,"+———————+"),n.createElement("pre",null,"| | | |"),n.createElement("pre",null,"| | ",this.state.result," | |"),n.createElement("pre",null,"| | | |"),n.createElement("pre",null,"+———————+"),n.createElement("span",{className:"text"},"Play for: "),n.createElement("input",{type:"number",className:"text-input",onChange:this.updateInvestment,value:this.state.investment}),n.createElement("br",null),n.createElement(r.a,{onClick:Object(s.a)(()=>this.play("H")),text:"Head!",disabled:this.state.playLock}),n.createElement(r.a,{onClick:Object(s.a)(()=>this.play("T")),text:"Tail!",disabled:this.state.playLock}),n.createElement("h1",null,this.state.status))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a(26),i=a(15),o=a(306),s=a(296),l=a(66);const c=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],u={Red:{match:e=>0!==e&&c.includes(e),payout:1},Black:{match:e=>!c.includes(e),payout:1},Odd:{match:e=>0!==e&&e%2==1,payout:1},Even:{match:e=>0!==e&&e%2==0,payout:1},High:{match:e=>0!==e&&e>18,payout:1},Low:{match:e=>0!==e&&e<19,payout:1},Third1:{match:e=>0!==e&&e<=12,payout:2},Third2:{match:e=>0!==e&&(e>=13&&e<=24),payout:2},Third3:{match:e=>0!==e&&e>=25,payout:2}};function m(e){return{match:t=>e===t,payout:36}}class h extends o.a{constructor(e){var t,a,n;super(e),n=-1,(a="interval")in(t=this)?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,this.rng=new s.b((new Date).getTime()),this.state={investment:1e3,canPlay:!0,status:"waiting",n:0,lock:!0,strategy:{payout:0,match:()=>!1}},this.step=this.step.bind(this),this.currentNumber=this.currentNumber.bind(this),this.updateInvestment=this.updateInvestment.bind(this)}componentDidMount(){this.interval=window.setInterval(this.step,50)}step(){this.state.lock||this.setState({n:Math.floor(37*Math.random())})}componentWillUnmount(){clearInterval(this.interval)}updateInvestment(e){let t=parseInt(e.currentTarget.value);isNaN(t)&&(t=0),t>1e7&&(t=1e7),t<0&&(t=0),this.setState({investment:t})}currentNumber(){if(0===this.state.n)return"0";const e=(t=this.state.n,[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36].includes(t)?"R":"B");var t;return`${this.state.n}${e}`}play(e){this.reachedLimit(this.props.p)||(this.setState({canPlay:!1,lock:!1,status:"playing",strategy:e}),setTimeout(()=>{let e=Math.floor(37*this.rng.random()),t=n.createElement(n.Fragment,null),a=0,r=this.state.strategy.match(e);if(r&&Math.random()>.9)for(r=!1;this.state.strategy.match(e);)e=(e+1)%36;r?(a=this.state.investment*this.state.strategy.payout,t=n.createElement(n.Fragment,null,"won ",n.createElement(i.a,{money:a}))):(a=-this.state.investment,t=n.createElement(n.Fragment,null,"lost ",n.createElement(i.a,{money:-a}))),this.win(this.props.p,a),this.setState({canPlay:!0,lock:!0,status:t,n:e}),this.reachedLimit(this.props.p)},1600))}render(){return n.createElement(n.Fragment,null,n.createElement("h1",null,this.currentNumber()),n.createElement("input",{type:"number",className:"text-input",onChange:this.updateInvestment,placeholder:"Amount to play",value:this.state.investment,disabled:!this.state.canPlay}),n.createElement("h1",null,this.state.status),n.createElement("table",null,n.createElement("tbody",null,n.createElement("tr",null,n.createElement("td",null,n.createElement(r.a,{text:"3",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(3)))})),n.createElement("td",null,n.createElement(r.a,{text:"6",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(6)))})),n.createElement("td",null,n.createElement(r.a,{text:"9",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(9)))})),n.createElement("td",null,n.createElement(r.a,{text:"12",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(12)))})),n.createElement("td",null,n.createElement(r.a,{text:"15",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(15)))})),n.createElement("td",null,n.createElement(r.a,{text:"18",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(18)))})),n.createElement("td",null,n.createElement(r.a,{text:"21",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(21)))})),n.createElement("td",null,n.createElement(r.a,{text:"24",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(24)))})),n.createElement("td",null,n.createElement(r.a,{text:"27",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(27)))})),n.createElement("td",null,n.createElement(r.a,{text:"30",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(30)))})),n.createElement("td",null,n.createElement(r.a,{text:"33",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(33)))})),n.createElement("td",null,n.createElement(r.a,{text:"36",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(36)))}))),n.createElement("tr",null,n.createElement("td",null,n.createElement(r.a,{text:"2",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(2)))})),n.createElement("td",null,n.createElement(r.a,{text:"5",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(5)))})),n.createElement("td",null,n.createElement(r.a,{text:"8",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(8)))})),n.createElement("td",null,n.createElement(r.a,{text:"11",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(11)))})),n.createElement("td",null,n.createElement(r.a,{text:"14",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(14)))})),n.createElement("td",null,n.createElement(r.a,{text:"17",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(17)))})),n.createElement("td",null,n.createElement(r.a,{text:"20",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(20)))})),n.createElement("td",null,n.createElement(r.a,{text:"23",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(23)))})),n.createElement("td",null,n.createElement(r.a,{text:"26",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(26)))})),n.createElement("td",null,n.createElement(r.a,{text:"29",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(29)))})),n.createElement("td",null,n.createElement(r.a,{text:"32",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(32)))})),n.createElement("td",null,n.createElement(r.a,{text:"35",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(35)))}))),n.createElement("tr",null,n.createElement("td",null,n.createElement(r.a,{text:"1",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(1)))})),n.createElement("td",null,n.createElement(r.a,{text:"4",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(4)))})),n.createElement("td",null,n.createElement(r.a,{text:"7",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(7)))})),n.createElement("td",null,n.createElement(r.a,{text:"10",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(10)))})),n.createElement("td",null,n.createElement(r.a,{text:"13",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(13)))})),n.createElement("td",null,n.createElement(r.a,{text:"16",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(16)))})),n.createElement("td",null,n.createElement(r.a,{text:"19",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(19)))})),n.createElement("td",null,n.createElement(r.a,{text:"22",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(22)))})),n.createElement("td",null,n.createElement(r.a,{text:"25",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(25)))})),n.createElement("td",null,n.createElement(r.a,{text:"28",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(28)))})),n.createElement("td",null,n.createElement(r.a,{text:"31",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(31)))})),n.createElement("td",null,n.createElement(r.a,{text:"34",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(34)))}))),n.createElement("tr",null,n.createElement("td",{colSpan:4},n.createElement(r.a,{text:"1 to 12",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Third1))})),n.createElement("td",{colSpan:4},n.createElement(r.a,{text:"13 to 24",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Third2))})),n.createElement("td",{colSpan:4},n.createElement(r.a,{text:"25 to 36",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Third3))}))),n.createElement("tr",null,n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"Red",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Red))})),n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"Black",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Black))})),n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"Odd",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Odd))})),n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"Even",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Even))})),n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"High",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.High))})),n.createElement("td",{colSpan:2},n.createElement(r.a,{text:"Low",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(u.Low))}))),n.createElement("tr",null,n.createElement("td",null,n.createElement(r.a,{text:"0",disabled:!this.state.canPlay,onClick:Object(l.a)(()=>this.play(m(0)))}))))))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a(26),i=a(15),o=a(296),s=a(306),l=a(66);const c=["D","C","$","?","♥","A","C","B","C","E","B","E","C","*","D","♥","B","A","A","A","C","A","D","B","E","?","D","*","@","♥","B","E","?"];function u(e,t){switch(e){case"$":return[20,200,1e3][t];case"@":return[8,80,400][t];case"♥":case"?":return[6,20,150][t];case"D":case"E":return[1,8,30][t];default:return[1,5,20][t]}}const m=[[[0,0],[0,1],[0,2],[0,3],[0,4]],[[1,0],[1,1],[1,2],[1,3],[1,4]],[[2,0],[2,1],[2,2],[2,3],[2,4]],[[2,0],[1,1],[0,2],[1,3],[2,4]],[[0,0],[1,1],[2,2],[1,3],[0,4]],[[0,0],[1,1],[1,2],[1,3],[0,4]],[[2,0],[1,1],[1,2],[1,3],[2,4]],[[1,0],[0,1],[0,2],[0,3],[1,4]],[[1,0],[2,1],[2,2],[2,3],[1,4]]];class h extends s.a{constructor(e){var t,a,n;super(e),n=-1,(a="interval")in(t=this)?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,this.rng=new o.b(this.props.p.totalPlaytime),this.state={index:[0,0,0,0,0],investment:1e3,locks:[0,0,0,0,0],canPlay:!0,status:"waiting"},this.play=this.play.bind(this),this.lock=this.lock.bind(this),this.unlock=this.unlock.bind(this),this.step=this.step.bind(this),this.checkWinnings=this.checkWinnings.bind(this),this.getTable=this.getTable.bind(this),this.updateInvestment=this.updateInvestment.bind(this)}componentDidMount(){this.interval=window.setInterval(this.step,50)}step(){let e=!1;const t=this.state.index.slice();for(const a in t)(t[a]!==this.state.locks[a]||e)&&(t[a]=(t[a]+1)%c.length,e=!0);this.setState({index:t}),e&&t.every((e,t)=>e===this.state.locks[t])&&this.checkWinnings()}componentWillUnmount(){clearInterval(this.interval)}getTable(){return[[c[(this.state.index[0]+c.length-1)%c.length],c[(this.state.index[1]+c.length-1)%c.length],c[(this.state.index[2]+c.length-1)%c.length],c[(this.state.index[3]+c.length-1)%c.length],c[(this.state.index[4]+c.length-1)%c.length]],[c[this.state.index[0]],c[this.state.index[1]],c[this.state.index[2]],c[this.state.index[3]],c[this.state.index[4]]],[c[(this.state.index[0]+1)%c.length],c[(this.state.index[1]+1)%c.length],c[(this.state.index[2]+1)%c.length],c[(this.state.index[3]+1)%c.length],c[(this.state.index[4]+1)%c.length]]]}play(){this.reachedLimit(this.props.p)||(this.setState({status:"playing"}),this.win(this.props.p,-this.state.investment),this.state.canPlay&&(this.unlock(),setTimeout(this.lock,2e3*this.rng.random()+1e3)))}lock(){this.setState({locks:[Math.floor(this.rng.random()*c.length),Math.floor(this.rng.random()*c.length),Math.floor(this.rng.random()*c.length),Math.floor(this.rng.random()*c.length),Math.floor(this.rng.random()*c.length)]})}checkWinnings(){const e=this.getTable(),t=function(t){const a=[];for(const n of t)a.push(e[n[0]][n[1]]);return a},a=function(e){let t=1;for(let a=1;a0?"gained":"lost"," ",n.createElement(i.a,{money:Math.abs(r)})),canPlay:!0}),this.reachedLimit(this.props.p)}unlock(){this.setState({locks:[-1,-1,-1,-1,-1],canPlay:!1})}updateInvestment(e){let t=parseInt(e.currentTarget.value);isNaN(t)&&(t=0),t>1e6&&(t=1e6),t<0&&(t=0),this.setState({investment:t})}render(){const e=this.getTable();return n.createElement(n.Fragment,null,n.createElement("pre",null,"+———————————————————————+"),n.createElement("pre",null,"| | ",e[0][0]," | ",e[0][1]," | ",e[0][2]," | ",e[0][3]," | ",e[0][4]," | |"),n.createElement("pre",null,"| | | | | | | |"),n.createElement("pre",null,"| | ",c[this.state.index[0]]," | ",c[this.state.index[1]]," | ",c[this.state.index[2]]," | ",c[this.state.index[3]]," | ",c[this.state.index[4]]," | |"),n.createElement("pre",null,"| | | | | | | |"),n.createElement("pre",null,"| | ",c[(this.state.index[0]+1)%c.length]," | ",c[(this.state.index[1]+1)%c.length]," | ",c[(this.state.index[2]+1)%c.length]," | ",c[(this.state.index[3]+1)%c.length]," | ",c[(this.state.index[4]+1)%c.length]," | |"),n.createElement("pre",null,"+———————————————————————+"),n.createElement("input",{type:"number",className:"text-input",onChange:this.updateInvestment,placeholder:"Amount to play",value:this.state.investment,disabled:!this.state.canPlay}),n.createElement(r.a,{onClick:Object(l.a)(this.play),text:"Spin!",disabled:!this.state.canPlay}),n.createElement("h1",null,this.state.status),n.createElement("h2",null,"Pay lines"),n.createElement("pre",null,"----- ····· ·····"),n.createElement("pre",null,"····· ----- ·····"),n.createElement("pre",null,"····· ····· -----"),n.createElement("br",null),n.createElement("pre",null,"··^·· \\···/ \\···/"),n.createElement("pre",null,"·/·\\· ·\\·/· ·---·"),n.createElement("pre",null,"/···\\ ··v·· ·····"),n.createElement("br",null),n.createElement("pre",null,"····· ·---· ·····"),n.createElement("pre",null,"·---· /···\\ \\···/"),n.createElement("pre",null,"/···\\ ····· ·---·"))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a.n(n);function i(e){const[t,a]=Object(n.useState)(e.content);return Object(n.useEffect)(()=>{let e=5;const n=setInterval(()=>{if(e--,e>0)return;e=5*Math.random();const n=Math.random()*t.length,r=t.charAt(n);a(function(e,t,a){return e.substring(0,t)+a+e.substring(t+1)}(t,n,function(e){const t=e=>e[Math.floor(Math.random()*e.length)],a=["abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ","1234567890"," _","()[]{}<>"];for(const n of a)if(n.includes(e))return t(n);return t("!@#$%^&*()_+|\\';\"/.,?`~")}(r))),setTimeout(()=>{a(t)},50)},100);return()=>{clearInterval(n)}},[]),r.a.createElement("span",null,t)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a(114),i=a(8),o=a(205),s=a(18),l=a(26),c=a(47);function u(e,t){t.name===i.a.TravelAgency?e.toTravel():t.name===i.a.WorldStockExchange?e.toStockMarket():e.toLocation(t)}function m(e){const t=c.b.Router();return e?n.createElement("span",{"aria-label":e.name,key:e.name,className:"tooltip",style:{color:"white",whiteSpace:"nowrap",margin:"0px",padding:"0px",cursor:"pointer"},onClick:()=>u(t,e)},n.createElement("b",null,"X")):n.createElement("span",null,"*")}function h(e){const t=/[A-Z]/g,a={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25},r=n=>{const r=[],i=[];let s;for(;null!==(s=t.exec(n));)i.push(s);if(0===i.length)return r.push(n),r;for(let t=0;tn.createElement("li",{key:e},n.createElement(l.a,{onClick:()=>u(t,o.a[e]),text:e})));return n.createElement("ul",null,a)}function d(){const e=c.b.Player(),t=r.a[e.city];return n.createElement("div",{className:"noselect"},n.createElement("h2",null,t.name),s.a.DisableASCIIArt?n.createElement(p,{city:t}):n.createElement(h,{city:t}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(0),r=a.n(n),i=a(47),o=a(487),s=a(92),l=a(9),c=a(639),u=a(93),m=a(37);function h(){const e=i.b.Player(),t=i.b.Router(),a=Object(n.useState)(!1)[1];function h(){a(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(h,1e3);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement("div",null,r.a.createElement(s.a,null,r.a.createElement(l.a,null,"This page displays any programs that you are able to create. Writing the code for a program takes time, which can vary based on how complex the program is. If you are working on creating a program you can cancel at any time. Your progress will be saved and you can continue later.")),r.a.createElement(c.a,null,Object(o.a)(e).map(a=>{const n=a.create;return null===n?r.a.createElement(r.a.Fragment,null):r.a.createElement(u.a,{key:a.name,title:n.tooltip},r.a.createElement(m.a,{onClick:()=>{e.startCreateProgramWork(t,a.name,n.time,n.level)}},a.name))}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return M}));var n=a(0),r=a.n(n),i=a(26),o=a(1031),s=a(22),l=a(1044),c=a(1045),u=a(98),m=a(11),h=a(515),p=a(89),d=a(308),f=a(210),g=a(470),y=a(242),b=a(3),E=a(618),v=a(619),k=a(433),_=a(18),w=a(35);let C=!1,S=[];!function(){const e=Object(k.a)({});S=function e(t){let a=[];const n=Object.keys(t);for(const r of n)"object"==typeof t[r]&&(a.push(r),a=a.concat(e(t[r]))),"function"==typeof t[r]&&a.push(r);return a}(e);const t=["heart","break","exploit","bypass","corporation"];S=S.filter(e=>!t.includes(e))}();let x="",O="",T=null;function M(e){const t=Object(n.useRef)(null),[a,k]=Object(n.useState)(e.filename?e.filename:x),[M,P]=Object(n.useState)(e.filename?e.code:O),[R,A]=Object(n.useState)("RAM: ???"),[N,I]=Object(n.useState)({theme:_.a.MonacoTheme,insertSpaces:_.a.MonacoInsertSpaces});function j(){if(null!==t.current){const e=t.current.getPosition();null!==e&&E.a.saveCursor(a,{row:e.lineNumber,column:e.column})}if(T=null,w.a.isRunning&&w.a.currStep===w.f.TerminalTypeScript){if("n00dles.script"!==a)return void Object(m.a)("Leave the script name as 'n00dles'!");if(-1==M.replace(/\s/g,"").indexOf("while(true){hack('n00dles');}"))return void Object(m.a)("Please copy and paste the code from the tutorial!");const t=e.player.getCurrentServer();if(null===t)throw new Error("Server should not be null but it is.");let n=!1;for(let r=0;r0)){switch(a){case y.a.ImportError:A("RAM: Import Error");break;case y.a.URLImportError:A("RAM: HTTP Import Error");break;case y.a.SyntaxError:default:A("RAM: Syntax Error")}return new Promise(()=>{})}A("RAM: "+b.a.formatRAM(a))}return Object(n.useEffect)(()=>{void 0!==e.filename&&(x=e.filename,O=e.code,T=null)},[]),Object(n.useEffect)(()=>{const e=setInterval(F,1e3);return()=>clearInterval(e)},[M]),Object(n.useEffect)(()=>{function e(e){_.a.DisableHotkeys||66==e.keyCode&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),j())}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{id:"script-editor-filename-wrapper"},r.a.createElement("p",{id:"script-editor-filename-tag",className:"noselect"}," ",r.a.createElement("strong",{style:{backgroundColor:"#555"}},"Script name: ")),r.a.createElement("input",{id:"script-editor-filename",type:"text",maxLength:100,tabIndex:1,value:a,onChange:function(e){x=a,k(e.target.value)}}),r.a.createElement(i.a,{text:"options",onClick:function(){const e="script-editor-options-popup",t={theme:"",insertSpaces:!1};Object.assign(t,N),Object(s.a)(e,l.a,{id:e,options:t,save:e=>{I(e),_.a.MonacoTheme=e.theme,_.a.MonacoInsertSpaces=e.insertSpaces}})}})),r.a.createElement(o.a,{beforeMount:function(e){e.languages.registerCompletionItemProvider("javascript",{provideCompletionItems:()=>{const t=[];for(const a of S)t.push({label:a,kind:e.languages.CompletionItemKind.Function,insertText:a,insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet});return{suggestions:t}}}),e.languages.typescript.javascriptDefaults.addExtraLib(v.a,"netscript.d.ts"),e.languages.typescript.typescriptDefaults.addExtraLib(v.a,"netscript.d.ts"),C=!0},onMount:function(e){if(t.current=e,null===t.current)return;const n=E.a.getCursor(a);-1!==n.row?t.current.setPosition({lineNumber:n.row,column:n.column}):null!==T&&t.current.setPosition({lineNumber:T.lineNumber,column:T.column+1}),t.current.focus()},loading:r.a.createElement("p",null,"Loading script editor!"),height:"90%",defaultLanguage:"javascript",defaultValue:M,onChange:function(e){void 0!==e&&(O=e,null!==t.current&&(T=t.current.getPosition()),P(e))},theme:N.theme,options:N}),r.a.createElement("div",{id:"script-editor-buttons-wrapper"},r.a.createElement(i.a,{text:"Beautify",onClick:function(){if(null===t.current)return;const e=Object(c.js_beautify)(M,{indent_with_tabs:!N.insertSpaces,indent_size:4,brace_style:"preserve-inline"});t.current.setValue(e)}}),r.a.createElement("p",{id:"script-editor-status-text",style:{display:"inline-block",margin:"10px"}},R),r.a.createElement("button",{className:"std-button",style:{display:"inline-block"},onClick:j},"Save & Close (Ctrl/Cmd + b)"),r.a.createElement("a",{className:"std-button",style:{display:"inline-block"},target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/index.html"},"Netscript Documentation")))}},,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(26),o=a(22);function s(e){const[t,a]=Object(n.useState)(e.options.theme),[s,l]=Object(n.useState)(e.options.insertSpaces);return r.a.createElement("div",{className:"editor-options-container noselect"},r.a.createElement("div",{className:"editor-options-line"},r.a.createElement("p",null,"Theme: "),r.a.createElement("select",{className:"dropdown",onChange:e=>a(e.target.value),defaultValue:t},r.a.createElement("option",{value:"vs-dark"},"vs-dark"),r.a.createElement("option",{value:"light"},"light"))),r.a.createElement("div",{className:"editor-options-line"},r.a.createElement("p",null,"Use whitespace over tabs: "),r.a.createElement("input",{type:"checkbox",onChange:e=>l(e.target.checked),checked:s})),r.a.createElement("br",null),r.a.createElement(i.a,{style:{width:"50px"},text:"Save",onClick:function(){e.save({theme:t,insertSpaces:s}),Object(o.b)(e.id)}}))}},,function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(501),r=a(190),i=a(167),o=a(67),s=a(20);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class c{constructor(e=""){l(this,"task","Unassigned"),l(this,"earnedRespect",0),l(this,"hack",1),l(this,"str",1),l(this,"def",1),l(this,"dex",1),l(this,"agi",1),l(this,"cha",1),l(this,"hack_exp",0),l(this,"str_exp",0),l(this,"def_exp",0),l(this,"dex_exp",0),l(this,"agi_exp",0),l(this,"cha_exp",0),l(this,"hack_mult",1),l(this,"str_mult",1),l(this,"def_mult",1),l(this,"dex_mult",1),l(this,"agi_mult",1),l(this,"cha_mult",1),l(this,"hack_asc_points",0),l(this,"str_asc_points",0),l(this,"def_asc_points",0),l(this,"dex_asc_points",0),l(this,"agi_asc_points",0),l(this,"cha_asc_points",0),l(this,"upgrades",[]),l(this,"augmentations",[]),this.name=e}calculateSkill(e,t=1){return Math.max(Math.floor(t*(32*Math.log(e+534.5)-200)),1)}calculateAscensionMult(e){return Math.max(Math.pow(e/4e3,.7),1)}updateSkillLevels(){this.hack=this.calculateSkill(this.hack_exp,this.hack_mult*this.calculateAscensionMult(this.hack_asc_points)),this.str=this.calculateSkill(this.str_exp,this.str_mult*this.calculateAscensionMult(this.str_asc_points)),this.def=this.calculateSkill(this.def_exp,this.def_mult*this.calculateAscensionMult(this.def_asc_points)),this.dex=this.calculateSkill(this.dex_exp,this.dex_mult*this.calculateAscensionMult(this.dex_asc_points)),this.agi=this.calculateSkill(this.agi_exp,this.agi_mult*this.calculateAscensionMult(this.agi_asc_points)),this.cha=this.calculateSkill(this.cha_exp,this.cha_mult*this.calculateAscensionMult(this.cha_asc_points))}calculatePower(){return(this.hack+this.str+this.def+this.dex+this.agi+this.cha)/95}assignToTask(e){return r.a.hasOwnProperty(e)?(this.task=e,!0):(this.task="Unassigned",!1)}unassignFromTask(){this.task="Unassigned"}getTask(){return this.task instanceof n.a&&(this.task=this.task.name),r.a.hasOwnProperty(this.task)?r.a[this.task]:r.a.Unassigned}calculateRespectGain(e){const t=this.getTask();if(0===t.baseRespect)return 0;let a=t.hackWeight/100*this.hack+t.strWeight/100*this.str+t.defWeight/100*this.def+t.dexWeight/100*this.dex+t.agiWeight/100*this.agi+t.chaWeight/100*this.cha;if(a-=4*t.difficulty,a<=0)return 0;const n=Math.max(.005,Math.pow(100*o.a[e.facName].territory,t.territory.respect)/100);if(isNaN(n)||n<=0)return 0;const r=e.getWantedPenalty();return 11*t.baseRespect*a*n*r}calculateWantedLevelGain(e){const t=this.getTask();if(0===t.baseWanted)return 0;let a=t.hackWeight/100*this.hack+t.strWeight/100*this.str+t.defWeight/100*this.def+t.dexWeight/100*this.dex+t.agiWeight/100*this.agi+t.chaWeight/100*this.cha;if(a-=3.5*t.difficulty,a<=0)return 0;const n=Math.max(.005,Math.pow(100*o.a[e.facName].territory,t.territory.wanted)/100);if(isNaN(n)||n<=0)return 0;if(t.baseWanted<0)return.4*t.baseWanted*a*n;const r=7*t.baseWanted/Math.pow(3*a*n,.8);return Math.min(100,r)}calculateMoneyGain(e){const t=this.getTask();if(0===t.baseMoney)return 0;let a=t.hackWeight/100*this.hack+t.strWeight/100*this.str+t.defWeight/100*this.def+t.dexWeight/100*this.dex+t.agiWeight/100*this.agi+t.chaWeight/100*this.cha;if(a-=3.2*t.difficulty,a<=0)return 0;const n=Math.max(.005,Math.pow(100*o.a[e.facName].territory,t.territory.money)/100);if(isNaN(n)||n<=0)return 0;const r=e.getWantedPenalty();return 5*t.baseMoney*a*n*r}expMult(){return{hack:(this.hack_mult-1)/4+1,str:(this.str_mult-1)/4+1,def:(this.def_mult-1)/4+1,dex:(this.dex_mult-1)/4+1,agi:(this.agi_mult-1)/4+1,cha:(this.cha_mult-1)/4+1}}gainExperience(e=1){const t=this.getTask();if(t===r.a.Unassigned)return;const a=Math.pow(t.difficulty,.9)*e,n=this.expMult();this.hack_exp+=t.hackWeight/1500*a*n.hack,this.str_exp+=t.strWeight/1500*a*n.str,this.def_exp+=t.defWeight/1500*a*n.def,this.dex_exp+=t.dexWeight/1500*a*n.dex,this.agi_exp+=t.agiWeight/1500*a*n.agi,this.cha_exp+=t.chaWeight/1500*a*n.cha}recordEarnedRespect(e=1,t){this.earnedRespect+=this.calculateRespectGain(t)*e}getGainedAscensionPoints(){return{hack:Math.max(this.hack_exp-1e3,0),str:Math.max(this.str_exp-1e3,0),def:Math.max(this.def_exp-1e3,0),dex:Math.max(this.dex_exp-1e3,0),agi:Math.max(this.agi_exp-1e3,0),cha:Math.max(this.cha_exp-1e3,0)}}canAscend(){const e=this.getGainedAscensionPoints();return e.hack>0||e.str>0||e.def>0||e.dex>0||e.agi>0||e.cha>0}getCurrentAscensionMults(){return{hack:this.calculateAscensionMult(this.hack_asc_points),str:this.calculateAscensionMult(this.str_asc_points),def:this.calculateAscensionMult(this.def_asc_points),dex:this.calculateAscensionMult(this.dex_asc_points),agi:this.calculateAscensionMult(this.agi_asc_points),cha:this.calculateAscensionMult(this.cha_asc_points)}}getAscensionMultsAfterAscend(){const e=this.getGainedAscensionPoints();return{hack:this.calculateAscensionMult(this.hack_asc_points+e.hack),str:this.calculateAscensionMult(this.str_asc_points+e.str),def:this.calculateAscensionMult(this.def_asc_points+e.def),dex:this.calculateAscensionMult(this.dex_asc_points+e.dex),agi:this.calculateAscensionMult(this.agi_asc_points+e.agi),cha:this.calculateAscensionMult(this.cha_asc_points+e.cha)}}getAscensionResults(){const e=this.getAscensionMultsAfterAscend(),t=this.getCurrentAscensionMults();return{hack:e.hack/t.hack,str:e.str/t.str,def:e.def/t.def,dex:e.dex/t.dex,agi:e.agi/t.agi,cha:e.cha/t.cha}}ascend(){const e=this.getAscensionResults(),t=this.getGainedAscensionPoints();this.hack_asc_points+=t.hack,this.str_asc_points+=t.str,this.def_asc_points+=t.def,this.dex_asc_points+=t.dex,this.agi_asc_points+=t.agi,this.cha_asc_points+=t.cha,this.upgrades.length=0,this.hack_mult=1,this.str_mult=1,this.def_mult=1,this.dex_mult=1,this.agi_mult=1,this.cha_mult=1;for(let e=0;eresolve(eval("import(urls[urls.length - 1].url)"))),script.dependencies=urls),loadedModule=await script.module;let ns=workerScript.env.vars;try{if(!loadedModule.main)throw Object(_NetscriptEvaluator__WEBPACK_IMPORTED_MODULE_0__.b)(workerScript,script.filename+" cannot be run because it does not have a main function.");return loadedModule.main(ns)}finally{if(null!=urls)for(const e in urls)URL.revokeObjectURL(e.url)}}function shouldCompile(e,t){return""===e.module||e.dependencies.some(a=>{const n=t.find(e=>e.filename==a.filename);if(!n)return!0;return n.moduleSequenceNumber>e.moduleSequenceNumber})}function _getScriptUrls(e,t,a){const n=[];a.push(e);try{let r=e.code.replace(/((?:from|import)\s+(?:'|"))(?:\.\/)?([^'"]+)('|")/g,(e,r,i,o)=>{if(!t.some(e=>e.filename==i))return e;const[s]=t.filter(e=>e.filename==i),l=_getScriptUrls(s,t,a);return n.push(...l),[r,l[l.length-1].url,o].join("")});return r+='\n\nfunction print() {throw new Error("Invalid call to window.print(). Did you mean to use Netscript\'s print()?");}',n.push(new _Script_ScriptUrl__WEBPACK_IMPORTED_MODULE_1__.a(e.filename,URL.createObjectURL(makeScriptBlob(r)))),n}catch(e){for(const e in n)URL.revokeObjectURL(e);throw e}finally{a.pop()}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));class n{constructor(e,t){this.filename=e,this.url=t}}},function(e,t,a){"use strict";function n(e){return e.constructor===Array&&e.every(e=>e.constructor===Array)}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(620),r=a(0),i=a(9),o=a(92);function s(e){const t=function(e,t){let a=-1;for(let n=0;n{if(n<=t+1)return r.createElement(i.a,{key:n},"[",a.fulfilled(e.player)?"x":" ","] ",a.title)});return r.createElement(r.Fragment,null,r.createElement(i.a,{variant:"h4"},"Milestones"),r.createElement(o.a,{mx:2},r.createElement(i.a,null,"Milestones don't reward you for completing them. They are here to guide you if you're lost. They will reset when you install Augmentations."),r.createElement("br",null),r.createElement(i.a,null,"Completing fl1ght.exe"),a))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a(0),r=a.n(n),i=a(9),o=a(370),s=a(63),l=a(149),c=a(142),u=a(277),m=a(92),h=a(267),p=a(1053),d=a(268);function f({terminal:e}){return r.a.createElement(i.a,{color:"primary",paragraph:!1},e.getProgressText())}const g=Object(c.a)(e=>Object(u.a)({nopadding:{padding:e.spacing(0)},preformatted:{whiteSpace:"pre-wrap",overflowWrap:"anywhere",margin:e.spacing(0)},list:{padding:e.spacing(0),height:"100%"}}));function y({terminal:e,router:t,player:a}){const c=Object(n.useRef)(null),u=Object(n.useState)(0)[1],[y,b]=Object(n.useState)(0);function E(){u(e=>e+1)}function v(){b(e=>e+1)}function k(){const e=c.current;null!==e&&setTimeout(()=>e.scrollIntoView(!0),50)}Object(n.useEffect)(()=>d.b.subscribe(E),[]),Object(n.useEffect)(()=>d.a.subscribe(v),[]),k(),Object(n.useEffect)(()=>{setTimeout(k,50)},[]);const _=g();return r.a.createElement(r.a.Fragment,null,r.a.createElement(m.a,{width:"100%",minHeight:"100vh",display:"flex",alignItems:"flex-end"},r.a.createElement(o.a,{key:y,id:"terminal",classes:{root:_.list}},e.outputHistory.map((t,n)=>t instanceof h.b?r.a.createElement(s.a,{key:n,classes:{root:_.nopadding}},r.a.createElement(i.a,{classes:{root:_.preformatted},color:t.color,paragraph:!1},t.text)):t instanceof h.a?r.a.createElement(s.a,{key:n,classes:{root:_.nopadding}},r.a.createElement(i.a,null,t.dashes,"> "),r.a.createElement(l.a,{classes:{root:_.preformatted},color:"secondary",paragraph:!1,onClick:()=>e.connectToServer(a,t.hostname)},t.hostname)):void 0),null!==e.action&&r.a.createElement(s.a,{classes:{root:_.nopadding}},r.a.createElement(f,{terminal:e})," ")),r.a.createElement("div",{ref:c})),r.a.createElement(m.a,{position:"sticky",bottom:0,width:"100%",px:0},r.a.createElement(p.a,{player:a,router:t,terminal:e})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a.n(n),i=a(9),o=a(142),s=a(277),l=a(329),c=a(221),u=a(79),m=a(1054),h=a(1056),p=a(18);const d=Object(o.a)(e=>Object(s.a)({textfield:{margin:e.spacing(0),width:"100%"},input:{backgroundColor:"#000"},nopadding:{padding:e.spacing(0)},preformatted:{whiteSpace:"pre-wrap",margin:e.spacing(0)},list:{padding:e.spacing(0),height:"100%"}}));let f="";function g({terminal:e,router:t,player:a}){const o=Object(n.useRef)(null),[s,g]=Object(n.useState)(f),[y,b]=Object(n.useState)([]),E=d();function v(e){f=e,g(e)}function k(e){const t=o.current;if(!t)return;const a=s.length,n=t.selectionStart;if(null!==n)switch(e.toLowerCase()){case"home":t.setSelectionRange(0,0);break;case"end":t.setSelectionRange(a,a);break;case"prevchar":n>0&&t.setSelectionRange(n-1,n-1);break;case"prevword":for(let e=n-2;e>=0;--e)if(" "===t.value.charAt(e))return void t.setSelectionRange(e+1,e+1);t.setSelectionRange(0,0);break;case"nextchar":t.setSelectionRange(n+1,n+1);break;case"nextword":for(let e=n+1;e<=a;++e)if(" "===t.value.charAt(e))return void t.setSelectionRange(e,e);t.setSelectionRange(a,a);break;default:console.warn("Invalid loc argument in Terminal.moveTextCursor()")}}return Object(n.useEffect)(()=>{function n(n){if(e.contractOpen)return;if(null!==e.action&&n.keyCode===u.a.C&&n.ctrlKey)return void e.finishAction(t,a,!0);const r=o.current;n.ctrlKey||n.metaKey||n.keyCode===u.a.C&&(n.ctrlKey||n.metaKey)||r&&r.focus()}return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)}),r.a.createElement(r.a.Fragment,null,y.length>0&&r.a.createElement(c.a,{square:!0},r.a.createElement(i.a,{classes:{root:E.preformatted},color:"primary",paragraph:!1},"Possible autocomplete candidate:"),r.a.createElement(i.a,{classes:{root:E.preformatted},color:"primary",paragraph:!1},y.join(" "))),r.a.createElement(l.a,{variant:"standard",color:null===e.action?"primary":"secondary",autoFocus:!0,disabled:null!==e.action,autoComplete:"off",classes:{root:E.textfield},value:s,onChange:function(e){v(e.target.value),b([])},inputRef:o,InputProps:{id:"terminal-input",className:E.input,startAdornment:r.a.createElement(r.a.Fragment,null,r.a.createElement(i.a,{color:null===e.action?"primary":"secondary",flexShrink:0},"[",a.getCurrentServer().hostname," ~",e.cwd(),"]> ")),spellCheck:!1,onKeyDown:function(n){if(n.keyCode===u.a.ENTER&&""!==s)return n.preventDefault(),e.print(`[${a.getCurrentServer().hostname} ~${e.cwd()}]> ${s}`),e.executeCommands(t,a,s),void v("");if(n.keyCode===u.a.TAB&&""!==s){n.preventDefault();let t=s;const r=t.lastIndexOf(";");-1!==r&&(t=t.slice(r+1)),t=t.trim(),t=t.replace(/\s\s+/g," ");const i=t.split(" ");let o=i.length-2;o<-1&&(o=0);const l=Object(m.a)(a,t,o,e.cwd());if(0==l.length)return;let c="",u="";if(0==i.length)return;1==i.length?u=i[0]:2==i.length?(u=i[0],c=i[1]):3==i.length?(u=i[0]+" "+i[1],c=i[2]):(c=i.pop()+"",u=i.join(" "));const p=Object(h.a)(u,c,l,s);"string"==typeof p&&""!==p&&v(p),Array.isArray(p)&&b(p)}if(n.keyCode===u.a.L&&n.ctrlKey&&(n.preventDefault(),e.clear()),n.keyCode===u.a.UPARROW||p.a.EnableBashHotkeys&&n.keyCode===u.a.P&&n.ctrlKey){p.a.EnableBashHotkeys&&n.preventDefault();const t=e.commandHistoryIndex,a=e.commandHistory.length;if(0==a)return;(t<0||t>a)&&(e.commandHistoryIndex=a),0!=t&&--e.commandHistoryIndex;v(e.commandHistory[e.commandHistoryIndex]);const r=o.current;r&&setTimeout((function(){r.selectionStart=r.selectionEnd=1e4}),10)}if(n.keyCode===u.a.DOWNARROW||p.a.EnableBashHotkeys&&n.keyCode===u.a.M&&n.ctrlKey){p.a.EnableBashHotkeys&&n.preventDefault();const t=e.commandHistoryIndex,a=e.commandHistory.length;if(0==a)return;if((t<0||t>a)&&(e.commandHistoryIndex=a),t==a||t==a-1)e.commandHistoryIndex=a,v("");else{++e.commandHistoryIndex;v(e.commandHistory[e.commandHistoryIndex])}}p.a.EnableBashHotkeys&&(n.keyCode===u.a.A&&n.ctrlKey&&(n.preventDefault(),k("home")),n.keyCode===u.a.E&&n.ctrlKey&&(n.preventDefault(),k("end")),n.keyCode===u.a.B&&n.ctrlKey&&(n.preventDefault(),k("prevchar")),n.keyCode===u.a.B&&n.altKey&&(n.preventDefault(),k("prevword")),n.keyCode===u.a.F&&n.ctrlKey&&(n.preventDefault(),k("nextchar")),n.keyCode===u.a.F&&n.altKey&&(n.preventDefault(),k("nextword")),n.keyCode!==u.a.H&&n.keyCode!==u.a.D||!n.ctrlKey||(!function(e){const t=o.current;if(!t)return;const a=s.length,n=t.selectionStart;if(null===n)return;const r=t.value;switch(e.toLowerCase()){case"backspace":n>0&&n<=a+1&&v(r.substr(0,n-1)+r.substr(n));break;case"deletewordbefore":for(let e=n-1;e>0;--e)if(" "===r.charAt(e))return void v(r.substr(0,e)+r.substr(n));break;case"deletewordafter":for(let e=n+1;e<=s.length+1;++e)if(" "===r.charAt(e))return void v(r.substr(0,n)+r.substr(e))}}("backspace"),n.preventDefault()))}}}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(98),r=a(1055),i=a(121),o=a(241),s=a(106),l=a(32);const c=["alias","analyze","backdoor","cat","cd","check","clear","cls","connect","download","expr","free","hack","help","home","hostname","ifconfig","kill","killall","ls","lscpu","mem","mv","nano","ps","rm","run","scan","scan-analyze","scp","sudov","tail","theme","top"];function u(e,t,a,u=""){let m=[];m=m.concat(Object.keys(i.b));const h=e.getCurrentServer(),p=e.getHomeComputer();let d="",f=null;function g(){for(const e of h.contracts)m.push(e.fn)}function y(){for(const e of h.messages)e instanceof s.a||m.push(e)}function b(){for(const e of p.programs)m.push(e)}function E(){for(const e of h.scripts){const t=_(e.filename);t&&m.push(t)}}function v(){for(const e of h.textFiles){const t=_(e.fn);t&&m.push(t)}}function k(){const e=Object(r.a)(h,null==f?"/":f);for(let t=0;t=0;--t)a[t].toLowerCase().startsWith(e.toLowerCase())||a.splice(t,1);else for(let e=a.length-1;e>=0;--e)a[e].toLowerCase().startsWith(t.toLowerCase())||a.splice(e,1);const i=r.lastIndexOf(";");let o="";if(0!==a.length){if(1===a.length)return o=""===t?a[0]+" ":e+" "+a[0],-1===i?o:r.slice(0,i+1)+" "+o;{const o=Object(n.e)(a);return""===t?o===e?a:-1===i?o:`${r.slice(0,i+1)} ${o}`:o===t?a:-1==i?`${e} ${o}`:`${r.slice(0,i+1)} ${e} ${o}`}}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(9),o=a(149),s=a(92);function l(){return r.a.createElement(r.a.Fragment,null,r.a.createElement(i.a,{variant:"h4"},"Tutorial (AKA Links to Documentation)"),r.a.createElement(s.a,{m:2},r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/guidesandtips/gettingstartedguideforbeginnerprogrammers.html"},r.a.createElement(i.a,null,"Getting Started")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/servers.html"},r.a.createElement(i.a,null,"Servers & Networking")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/hacking.html"},r.a.createElement(i.a,null,"Hacking")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/scripts.html"},r.a.createElement(i.a,null,"Scripts")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/netscript.html"},r.a.createElement(i.a,null,"Netscript Programming Language")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/world.html"},r.a.createElement(i.a,null,"Traveling")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/companies.html"},r.a.createElement(i.a,null,"Companies")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/infiltration.html"},r.a.createElement(i.a,null,"Infiltration")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/factions.html"},r.a.createElement(i.a,null,"Factions")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/augmentations.html"},r.a.createElement(i.a,null,"Augmentations")),r.a.createElement("br",null),r.a.createElement(o.a,{color:"primary",target:"_blank",href:"https://bitburner.readthedocs.io/en/latest/shortcuts.html"},r.a.createElement(i.a,null,"Keyboard Shortcuts"))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(1059),o=a(1060),s=a(9);function l(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(a,20);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement(s.a,null,"This page displays a list of all of your scripts that are currently running across every machine. It also provides information about each script's production. The scripts are categorized by the hostname of the servers on which they are running."),r.a.createElement(i.a,null),r.a.createElement(o.a,e))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a(15),i=a(138),o=a(47),s=a(9),l=a(142),c=a(277),u=a(330),m=a(278),h=a(52),p=a(78);const d=Object(l.a)(e=>Object(c.a)({cell:{borderBottom:"none",padding:e.spacing(1),margin:e.spacing(1),whiteSpace:"nowrap"},size:{width:"1px"}}));function f(){const e=o.b.Player(),t=d(),a=e.scriptProdSinceLastAug/(e.playtimeSinceLastAug/1e3);return n.createElement(u.a,{size:"small",classes:{root:t.size}},n.createElement(m.a,null,n.createElement(p.a,null,n.createElement(h.a,{component:"th",scope:"row",classes:{root:t.cell}},n.createElement(s.a,{variant:"body2"},"Total production:")),n.createElement(h.a,{align:"left",classes:{root:t.cell}},n.createElement(s.a,{variant:"body2"},n.createElement(r.a,{money:e.scriptProdSinceLastAug}))),n.createElement(h.a,{align:"left",classes:{root:t.cell}},n.createElement(s.a,{variant:"body2"},"(",n.createElement(i.a,{money:a}),")")))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(0),r=a.n(n),i=a(1061),o=a(329),s=a(370),l=a(1182),c=a(238),u=a(38),m=a(18),h=a(519),p=a(1067),d=a.n(p);function f(e){const[t,a]=Object(n.useState)(""),[p,f]=Object(n.useState)(0),[g,y]=Object(n.useState)(m.a.ActiveScriptsServerPageSize),b=Object(n.useState)(!1)[1];const E={};for(const t of e.workerScripts.values()){const e=Object(u.b)(t.serverIp);if(null==e){console.warn("WorkerScript has invalid IP address: "+t.serverIp);continue}let a=E[e.hostname];void 0===a&&(E[e.hostname]={server:e,workerScripts:[]},a=E[e.hostname]),void 0!==a&&a.workerScripts.push(t)}const v=Object.values(E).filter(e=>e&&e.server.hostname.includes(t));function k(){b(e=>!e)}return Object(n.useEffect)(()=>c.a.subscribe(k)),r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{value:t,onChange:function(e){a(e.target.value),f(0)},color:"primary",autoFocus:!0,variant:"standard",InputProps:{startAdornment:r.a.createElement(d.a,null),spellCheck:!1}}),r.a.createElement(s.a,{dense:!0},v.slice(p*g,p*g+g).map(e=>e&&r.a.createElement(i.a,{key:e.server.hostname,server:e.server,workerScripts:e.workerScripts}))),r.a.createElement(l.a,{rowsPerPageOptions:[10,15,20,100],component:"div",count:v.length,rowsPerPage:g,page:p,onPageChange:(e,t)=>{f(t)},onRowsPerPageChange:e=>{m.a.ActiveScriptsServerPageSize=parseInt(e.target.value,10),y(parseInt(e.target.value,10)),f(0)},ActionsComponent:h.a}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a(9),i=a(1181),o=a(103),s=a(221),l=a(92),c=a(328),u=a(75),m=a.n(u),h=a(287),p=a.n(h),d=a(1062),f=a(143);function g(e){const[t,a]=n.useState(!1),u=e.server,h=`${u.hostname}${" ".repeat(18)}`.slice(0,Math.max(u.hostname.length,18)),g={progress:u.ramUsed/u.maxRam,totalTicks:30},y=`${h} ${Object(f.a)(g)}`;return n.createElement(l.a,{component:s.a},n.createElement(i.a,{onClick:()=>a(e=>!e)},n.createElement(o.a,{primary:n.createElement(r.a,{style:{whiteSpace:"pre-wrap"}},y)}),t?n.createElement(p.a,{color:"primary"}):n.createElement(m.a,{color:"primary"})),n.createElement(l.a,{mx:2},n.createElement(c.a,{in:t,timeout:0,unmountOnExit:!0},n.createElement(d.a,{workerScripts:e.workerScripts}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(0),r=a.n(n),i=a(1063),o=a(370),s=a(1182),l=a(519),c=a(18);function u(e){const[t,a]=Object(n.useState)(0),[u,m]=Object(n.useState)(c.a.ActiveScriptsScriptPageSize);return r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{dense:!0,disablePadding:!0},e.workerScripts.slice(t*u,t*u+u).map(e=>r.a.createElement(i.a,{key:`${e.name}_${e.args}`,workerScript:e}))),r.a.createElement(s.a,{rowsPerPageOptions:[10,15,20,100],component:"div",count:e.workerScripts.length,rowsPerPage:u,page:t,onPageChange:(e,t)=>{a(t)},onRowsPerPageChange:e=>{c.a.ActiveScriptsScriptPageSize=parseInt(e.target.value,10),m(parseInt(e.target.value,10)),a(0)},ActionsComponent:l.a}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return A}));var n=a(0),r=a(3),i=a(330),o=a(52),s=a(78),l=a(278),c=a(37),u=a(92),m=a(221),h=a(9),p=a(116),d=a(1064),f=a.n(d),g=a(1181),y=a(103),b=a(142),E=a(328),v=a(287),k=a.n(v),_=a(75),w=a.n(_),C=a(113),S=a(11),x=a(262),O=a(14),T=a(230),M=a(15),P=a(138);const R=Object(b.a)({noborder:{borderBottom:"none"}});function A(e){const t=R(),[a,d]=n.useState(!1),b=e.workerScript.scriptRef,v=x.a.bind(null,b),_=C.a.bind(null,b,b.server);const A=b.onlineMoneyMade/b.onlineRunningTime,N=b.onlineExpGained/b.onlineRunningTime;return n.createElement(n.Fragment,null,n.createElement(g.a,{onClick:()=>d(e=>!e),component:m.a},n.createElement(y.a,{primary:n.createElement(h.a,null,"└ ",e.workerScript.name)}),a?n.createElement(k.a,{color:"primary"}):n.createElement(w.a,{color:"primary"})),n.createElement(E.a,{in:a,timeout:0,unmountOnExit:!0},n.createElement(u.a,{mx:6},n.createElement(i.a,{padding:"none",size:"small"},n.createElement(l.a,null,n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Threads:")),n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,r.a.formatThreads(e.workerScript.scriptRef.threads)))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder,colSpan:2},n.createElement(h.a,null,"└ Args: ",Object(T.a)(e.workerScript.args)))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Online Time:")),n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,Object(O.b)(1e3*b.onlineRunningTime)))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Offline Time:")),n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,Object(O.b)(1e3*b.offlineRunningTime)))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Total online production:")),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null,n.createElement(M.a,{money:b.onlineMoneyMade})))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder,colSpan:1}),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null," ",r.a.formatExp(b.onlineExpGained)+" hacking exp"))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Online production rate:")),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null,n.createElement(P.a,{money:A})))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder,colSpan:1}),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null," ",r.a.formatExp(N)+" hacking exp / sec"))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder},n.createElement(h.a,null,"└ Total offline production:")),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null,n.createElement(M.a,{money:b.offlineMoneyMade})))),n.createElement(s.a,null,n.createElement(o.a,{className:t.noborder,colSpan:1}),n.createElement(o.a,{className:t.noborder,align:"left"},n.createElement(h.a,null," ",r.a.formatExp(b.offlineExpGained)+" hacking exp"))))),n.createElement(c.a,{onClick:v},n.createElement(h.a,null,"LOG")),n.createElement(p.a,{onClick:function(){_(),Object(S.a)("Killing script")}},n.createElement(f.a,{color:"error"})))))}},,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(24),o=a(97),s=a(9),l=a(92),c=a(149),u=a(37),m=a(278),h=a(77),p=a(78);function d(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(a,1e3);return()=>clearInterval(e)},[]),r.a.createElement(r.a.Fragment,null,r.a.createElement(s.a,{variant:"h5",color:"primary"},"Factions"),r.a.createElement(s.a,null,"Lists all factions you have joined"),r.a.createElement("br",null),r.a.createElement(l.a,{display:"flex",flexDirection:"column"},e.player.factions.map(t=>r.a.createElement(c.a,{key:t,variant:"h6",onClick:()=>function(t){e.router.toFaction(t)}(i.a[t])},t))),r.a.createElement("br",null),e.player.factionInvitations.length>0&&r.a.createElement(r.a.Fragment,null,r.a.createElement(s.a,{variant:"h5",color:"primary"},"Outstanding Faction Invitations"),r.a.createElement(s.a,null,"Lists factions you have been invited to. You can accept these faction invitations at any time."),r.a.createElement(h.a,{size:"small",padding:"none"},r.a.createElement(m.a,null,e.player.factionInvitations.map(e=>r.a.createElement(p.a,{key:e},r.a.createElement(h.b,null,r.a.createElement(s.a,{noWrap:!0},e)),r.a.createElement(h.b,{align:"right"},r.a.createElement(u.a,{onClick:a=>function(e,a){e.isTrusted&&(Object(o.d)(i.a[a]),t(e=>!e))}(a,e)},"Join!"))))))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a.n(n),i=a(97);function o(e){return Object(n.useEffect)(()=>Object(i.g)(e.faction)),r.a.createElement("div",{id:"mission-container"})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n=a(0),r=a.n(n),i=a(1071),o=a(1075),s=a(1076),l=a(325),c=a(4),u=a(7),m=a(289),h=a(53),p=a(22),d=a(47),f=a(1082),g=a(9),y=a(37);const b=["Slum Snakes","Tetrads","The Syndicate","The Dark Army","Speakers for the Dead","NiteSec","The Black Hand"];function E(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}const E=e.faction,v=d.b.Player(),k=d.b.Router(),[_,w]=Object(n.useState)(!1);function C(){w(!0)}function S(){Object(m.d)(v)}return _?r.a.createElement(i.a,{faction:E,routeToMainPage:function(){w(!1)}}):r.a.createElement((function({faction:e}){const t=v,n=e.getInfo(),i=t.inGang()&&t.getGangName()===e.name,m=Math.floor(c.a.BaseFavorToDonate*u.a.RepToDonateToFaction),d=e.favor>=m,E="The Covenant"===e.name&&t.bitNodeN>=10&&h.a[10];let _=t.canAccessGang()&&b.includes(e.name);return t.inGang()&&(t.getGangName()!==e.name?_=!1:t.getGangName()===e.name&&(_=!0)),r.a.createElement(r.a.Fragment,null,r.a.createElement(y.a,{onClick:()=>k.toFactions()},"Back"),r.a.createElement(g.a,{variant:"h4",color:"primary"},e.name),r.a.createElement(s.a,{faction:e,factionInfo:n}),_&&r.a.createElement(l.a,{buttonText:"Manage Gang",infoText:"Create and manage a gang for this Faction. Gangs will earn you money and faction reputation",onClick:()=>function(e){if(v.inGang())return k.toGang();Object(p.a)("create-gang-popup",f.a,{popupId:"create-gang-popup",facName:e.name,player:v,router:k})}(e)}),!i&&n.offerHackingMission&&r.a.createElement(l.a,{buttonText:"Hacking Mission",infoText:"Attempt a hacking mission for your faction. A mission is a mini game that, if won, earns you significant reputation with this faction. (Recommended hacking level: 200+)",onClick:()=>function(e){v.singularityStopWork(),k.toHackingMission(e)}(e)}),!i&&n.offerHackingWork&&r.a.createElement(l.a,{buttonText:"Hacking Contracts",infoText:"Complete hacking contracts for your faction. Your effectiveness, which determines how much reputation you gain for this faction, is based on your hacking skill. You will gain hacking exp.",onClick:()=>function(e){v.startFactionHackWork(k,e)}(e)}),!i&&n.offerFieldWork&&r.a.createElement(l.a,{buttonText:"Field Work",infoText:"Carry out field missions for your faction. Your effectiveness, which determines how much reputation you gain for this faction, is based on all of your stats. You will gain exp for all stats.",onClick:()=>function(e){v.startFactionFieldWork(k,e)}(e)}),!i&&n.offerSecurityWork&&r.a.createElement(l.a,{buttonText:"Security Work",infoText:"Serve in a security detail for your faction. Your effectiveness, which determines how much reputation you gain for this faction, is based on your combat stats. You will gain exp for all combat stats.",onClick:()=>function(e){v.startFactionSecurityWork(k,e)}(e)}),!i&&n.offersWork()&&r.a.createElement(o.a,{faction:e,p:v,rerender:a,favorToDonate:m,disabled:!d}),r.a.createElement(l.a,{buttonText:"Purchase Augmentations",infoText:"As your reputation with this faction rises, you will unlock Augmentations, which you can purchase to enhance your abilities.",onClick:C}),E&&r.a.createElement(l.a,{buttonText:"Purchase & Upgrade Duplicate Sleeves",infoText:"Purchase Duplicate Sleeves and upgrades. These are permanent!",onClick:S}))}),{faction:E})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(0),r=a.n(n),i=a(1072),o=a(19),s=a(5),l=a(147),c=a(18),u=a(97),m=a(47),h=a(37),p=a(9),d=a(278),f=a(330);function g(e){const t=m.b.Player(),a=t.inGang()&&t.getGangName()===e.faction.name,g=Object(n.useState)(!1)[1];function y(){g(e=>!e)}function b(){if(a){const e=[];for(const t in o.a){o.a[t].isSpecial||e.push(t)}return e}return e.faction.augmentations.slice()}function E(e){c.a.PurchaseAugmentationsOrder=e,y()}const v=function(){switch(c.a.PurchaseAugmentationsOrder){case l.b.Cost:return function(){const e=b();return e.sort((e,t)=>{const a=o.a[e],n=o.a[t];if(null==a||null==n)throw new Error("Invalid Augmentation Names");return a.baseCost-n.baseCost}),e}();case l.b.Reputation:return function(){const e=b();return e.sort((e,t)=>{const a=o.a[e],n=o.a[t];if(null==a||null==n)throw new Error("Invalid Augmentation Names");return a.baseRepRequirement-n.baseRepRequirement}),e}();case l.b.Purchasable:return function(){const a=b();function n(a){const n=o.a[a],r=(n.baseCost,e.faction.getInfo().augmentationPriceMult,n.baseRepRequirement*e.faction.getInfo().augmentationRepRequirementMult),i=e.faction.playerReputation>=r,s=Object(u.b)(n);return 0!==n.baseCost&&t.money.gt(n.baseCost*e.faction.getInfo().augmentationPriceMult)&&i&&s}const r=a.filter(n).sort((e,t)=>{const a=o.a[e],n=o.a[t];if(null==a||null==n)throw new Error("Invalid Augmentation Names");return a.baseCost-n.baseCost}),i=a.filter(e=>!n(e)).sort((e,t)=>{const a=o.a[e],n=o.a[t];if(null==a||null==n)throw new Error("Invalid Augmentation Names");return a.baseRepRequirement-n.baseRepRequirement});return r.concat(i)}();default:return b()}}(),k=v.filter(e=>e===s.a.NeuroFluxGovernor||!t.augmentations.some(t=>t.name===e)&&!t.queuedAugmentations.some(t=>t.name===e)),_=(a,n=!1)=>r.a.createElement(i.a,{augName:a,faction:e.faction,key:a,p:t,rerender:y,owned:n}),w=k.map(e=>_(e));let C=r.a.createElement(r.a.Fragment,null);const S=v.filter(e=>!k.includes(e));return 0!==S.length&&(C=r.a.createElement(r.a.Fragment,null,r.a.createElement("br",null),r.a.createElement(p.a,{variant:"h4"},"Purchased Augmentations"),r.a.createElement(p.a,null,"This factions also offers these augmentations but you already own them."),S.map(e=>_(e,!0)))),r.a.createElement("div",null,r.a.createElement(h.a,{onClick:e.routeToMainPage},"Back"),r.a.createElement(p.a,{variant:"h4"},"Faction Augmentations"),r.a.createElement(p.a,null,"These are all of the Augmentations that are available to purchase from ",e.faction.name,". Augmentations are powerful upgrades that will enhance your abilities."),r.a.createElement(h.a,{onClick:()=>E(l.b.Cost)},"Sort by Cost"),r.a.createElement(h.a,{onClick:()=>E(l.b.Reputation)},"Sort by Reputation"),r.a.createElement(h.a,{onClick:()=>E(l.b.Default)},"Sort by Default Order"),r.a.createElement(h.a,{onClick:()=>E(l.b.Purchasable)},"Sort by Purchasable"),r.a.createElement("br",null),r.a.createElement(f.a,{size:"small",padding:"none"},r.a.createElement(d.a,null,w)),r.a.createElement(f.a,{size:"small",padding:"none"},r.a.createElement(d.a,null,C)))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return v}));var n=a(0),r=a(97),i=a(1073),o=a(19),s=a(5),l=a(18),c=a(15),u=a(81),m=a(22),h=a(1074),p=a(37),d=a(9),f=a(93),g=a(92),y=a(77),b=a(78);function E(e){const t=o.a[e.augName];if(!e.hasReq)return n.createElement(y.b,{key:1,colSpan:2},n.createElement(d.a,{color:"error"},"Requires"," ",t.prereqs.map((e,t)=>n.createElement(h.a,{key:t,name:e}))));e.hasRep&&e.hasCost;return n.createElement(n.Fragment,{key:"f"},n.createElement(y.b,{key:1},n.createElement(d.a,null,n.createElement(c.a,{money:e.cost,player:e.p}))),n.createElement(y.b,{key:2},n.createElement(d.a,{color:e.hasRep?"primary":"error"},"Requires ",Object(u.a)(e.rep)," faction reputation")))}function v(e){const t=o.a[e.augName];if(null==t)throw new Error(`aug ${e.augName} does not exists`);if(null==t)return console.error("Invalid Augmentation when trying to create PurchaseableAugmentation display element: "+e.augName),n.createElement(n.Fragment,null);const a=t.baseCost*e.faction.getInfo().augmentationPriceMult,c=t.baseRepRequirement*e.faction.getInfo().augmentationRepRequirementMult,u=Object(r.b)(t),h=e.faction.playerReputation>=c,v=0===t.baseCost||e.p.money.gt(t.baseCost*e.faction.getInfo().augmentationPriceMult),k=u&&h&&v?"primary":"error";let _=t.name;t.name===s.a.NeuroFluxGovernor&&(_+=" - Level "+Object(r.a)());let w=n.createElement(n.Fragment,null);return w="string"==typeof t.info?n.createElement(n.Fragment,null,n.createElement("span",null,t.info),n.createElement("br",null),n.createElement("br",null),t.stats):n.createElement(n.Fragment,null,t.info,n.createElement("br",null),n.createElement("br",null),t.stats),n.createElement(b.a,null,!e.owned&&n.createElement(y.b,{key:0},n.createElement(p.a,{onClick:function(){if("error"!==k)if(l.a.SuppressBuyAugmentationConfirmation)Object(r.f)(t,e.faction),e.rerender();else{const a="purchase-augmentation-popup";Object(m.a)(a,i.a,{aug:t,faction:e.faction,player:e.p,rerender:e.rerender,popupId:a})}},color:k},"Buy")),n.createElement(y.b,{key:1},n.createElement(g.a,{display:"flex"},n.createElement(f.a,{title:n.createElement(d.a,null,w),placement:"top",disableFocusListener:!0,disableTouchListener:!0,enterNextDelay:1e3,enterDelay:500,leaveDelay:0,leaveTouchDelay:0},n.createElement(d.a,null,_)))),!e.owned&&n.createElement(E,{key:2,augName:e.augName,p:e.p,cost:a,rep:c,hasReq:u,hasRep:h,hasCost:v}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(0),r=a.n(n),i=a(97),o=a(133),s=a(15),l=a(22);function c(e){const t=e.faction.getInfo();return r.a.createElement(r.a.Fragment,null,r.a.createElement("h2",null,e.aug.name),r.a.createElement("br",null),e.aug.info,r.a.createElement("br",null),r.a.createElement("br",null),e.aug.stats,r.a.createElement("br",null),r.a.createElement("br",null),"Would you like to purchase the ",e.aug.name," Augmentation for ",r.a.createElement(s.a,{money:e.aug.baseCost*t.augmentationPriceMult}),"?",r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("button",{autoFocus:!0,className:"std-button",onClick:function(){!Object(o.e)(e.aug)&&e.player.hasAugmentation(e.aug)||(Object(i.f)(e.aug,e.faction),e.rerender(),Object(l.b)(e.popupId))}},"Purchase"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(0);function r({name:e}){return n.createElement("span",{className:"samefont",style:{color:"white"}},e)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a(0),r=a.n(n),i=a(4),o=a(628),s=a(317),l=a(15),c=a(81),u=a(3),m=a(11),h=a(208),p=a(9),d=a(221),f=a(37),g=a(329);function y(e){const[t,a]=Object(n.useState)(null),y=(i.a.DonateMoneyToRepDivisor+"").length-1;function b(){return null!==t&&(!(isNaN(t)||t<=0)&&!e.p.money.lt(t))}return r.a.createElement(d.a,{sx:{my:1,p:1,width:"100%"}},r.a.createElement((function(){return null===t?r.a.createElement(r.a.Fragment,null):b()?r.a.createElement(p.a,null,"This donation will result in ",Object(c.a)(Object(o.a)(t,e.p))," reputation gain"):e.p.money.lt(t)?r.a.createElement(p.a,null,"Insufficient funds"):r.a.createElement(p.a,null,"Invalid donate amount entered!")}),null),e.disabled?r.a.createElement(p.a,null,"Unlock donations at ",Object(s.a)(e.favorToDonate)," favor with ",e.faction.name):r.a.createElement(r.a.Fragment,null,r.a.createElement(g.a,{variant:"standard",onChange:function(e){const t=u.a.parseMoney(e.target.value);""===e.target.value||isNaN(t)?a(null):a(t),console.log("set")},placeholder:"Donation amount",disabled:e.disabled,InputProps:{endAdornment:r.a.createElement(f.a,{onClick:function(){const a=e.faction,n=t;if(null===n)return;if(!b())return;e.p.loseMoney(n);const i=Object(o.a)(n,e.p);e.faction.playerReputation+=i,Object(m.a)(r.a.createElement(r.a.Fragment,null,"You just donated ",r.a.createElement(l.a,{money:n})," to ",a.name," to gain ",Object(c.a)(i)," reputation.")),e.rerender()},disabled:e.disabled||!b()},"donate")}}),r.a.createElement(p.a,null,r.a.createElement(h.a,{tex:String.raw`reputation = \frac{\text{donation amount} \times \text{reputation multiplier}}{10^{${y}}}`}))))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(0),r=a.n(n),i=a(81),o=a(317),s=a(208),l=a(142),c=a(277),u=a(9),m=a(93),h=a(92);const p=Object(l.a)(e=>Object(c.a)({noformat:{whiteSpace:"pre-wrap"}}));function d(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(a,1e3);return()=>clearInterval(e)},[]);const l=p(),c=e.faction.getFavorGain()[0];return r.a.createElement(r.a.Fragment,null,r.a.createElement(u.a,{classes:{root:l.noformat}},e.factionInfo.infoText),r.a.createElement(u.a,null,"-------------------------"),r.a.createElement(h.a,{display:"flex"},r.a.createElement(m.a,{title:r.a.createElement(r.a.Fragment,null,r.a.createElement(u.a,null,"You will have ",Object(o.a)(e.faction.favor+c)," faction favor after installing an Augmentation."),r.a.createElement(s.a,{tex:String.raw`\large{r = \text{total faction reputation}}`}),r.a.createElement(s.a,{tex:String.raw`\large{favor=\left\lfloor\log_{1.02}\left(\frac{r+25000}{25500}\right)\right\rfloor}`}))},r.a.createElement(u.a,null,"Reputation: ",Object(i.a)(e.faction.playerReputation)))),r.a.createElement(u.a,null,"-------------------------"),r.a.createElement(h.a,{display:"flex"},r.a.createElement(m.a,{title:r.a.createElement(r.a.Fragment,null,r.a.createElement(u.a,null,"Faction favor increases the rate at which you earn reputation for this faction by 1% per favor. Faction favor is gained whenever you install an Augmentation. The amount of favor you gain depends on the total amount of reputation you earned with this faction. Across all resets."),r.a.createElement(s.a,{tex:String.raw`\large{r = reputation}`}),r.a.createElement(s.a,{tex:String.raw`\large{\Delta r = \Delta r \times \frac{100+favor}{100}}`}))},r.a.createElement(u.a,null,"Faction Favor: ",Object(o.a)(e.faction.favor)))),r.a.createElement(u.a,null,"-------------------------"),r.a.createElement(u.a,null,"Perform work/carry out assignments for your faction to help further its cause! By doing so you will earn reputation for your faction. You will also gain reputation passively over time, although at a very slow rate. Earning reputation will allow you to purchase Augmentations through this faction, which are powerful upgrades that enhance your abilities."))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(1078),o=a(266),s=a(289),l=a(1080),c=a(26),u=a(15),m=a(11);function h(){return(h=Object.assign||function(e){for(var t=1;t=s.b&&(f=!0);const g=[];for(let t=0;t=s.b||(e.p.canAfford(p())?(e.p.loseMoney(p()),e.p.sleevesFromCovenant+=1,e.p.sleeves.push(new o.a(e.p)),d()):Object(m.a)("You cannot afford to purchase a Duplicate Sleeve",!1))},text:"Purchase"})),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("p",null,"Here, you can also purchase upgrades for your Duplicate Sleeves. These upgrades are also permanent, meaning they persist across BitNodes."),g)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(1079);class i extends n.Component{render(){return n.createElement("div",{className:"bladeburner-action"},n.createElement("h1",null,"Duplicate Sleeve ",this.props.index),n.createElement(r.a,this.props))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a(3),i=a(26),o=a(15);class s extends n.Component{constructor(e){super(e),this.state={amt:1},this.changePurchaseAmount=this.changePurchaseAmount.bind(this),this.purchaseMemory=this.purchaseMemory.bind(this)}changePurchaseAmount(e){let t=parseInt(e.target.value);isNaN(t)&&(t=1);const a=100-this.props.sleeve.memory;t>a&&(t=a),this.setState({amt:t})}getPurchaseCost(){if(isNaN(this.state.amt))return 1/0;const e=100-this.props.sleeve.memory;return this.state.amt>e?1/0:this.props.sleeve.getMemoryUpgradeCost(this.state.amt)}purchaseMemory(){const e=this.getPurchaseCost();this.props.p.canAfford(e)&&(this.props.sleeve.upgradeMemory(this.state.amt),this.props.p.loseMoney(e),this.props.rerender())}render(){const e=`sleeve-${this.props.index}-memory-upgrade-input`,t=100-this.props.sleeve.memory,a=this.getPurchaseCost(),s=!this.props.p.canAfford(a);let l;return l=isNaN(this.state.amt)?n.createElement(n.Fragment,null,"Invalid value"):this.state.amt>t?n.createElement(n.Fragment,null,"Memory cannot exceed 100"):n.createElement(n.Fragment,null,"Purchase ",this.state.amt," memory - ",n.createElement(o.a,{money:a,player:this.props.p}),"?"),n.createElement("div",null,n.createElement("h2",null,n.createElement("u",null,"Upgrade Memory")),n.createElement("p",null,"Purchase a memory upgrade for your sleeve. Note that a sleeve's max memory is 100 (current:"," ",r.a.formatSleeveMemory(this.props.sleeve.memory),")"),n.createElement("label",{htmlFor:e},"Amount of memory to purchase (must be an integer):"),n.createElement("input",{className:"text-input",id:e,onChange:this.changePurchaseAmount,type:"number",value:this.state.amt}),n.createElement("br",null),n.createElement(i.a,{disabled:s,onClick:this.purchaseMemory,text:l}))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a(76),i=a(376),o=a(1081);class s extends o.a{constructor(e){super(e),this.closePopup=this.closePopup.bind(this)}closePopup(){let e;this.props.onClose&&this.props.onClose(),e="string"==typeof this.props.popup?document.getElementById(this.props.popup):this.props.popup,e instanceof HTMLElement&&(r.unmountComponentAtNode(e),Object(i.a)(e))}render(){const e=this.props.class?this.props.class:"std-button";return n.createElement("button",{className:e,onClick:this.closePopup,style:this.props.style},this.props.text)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a(76),i=a(79),o=a(376);class s extends n.Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.keyListener=this.keyListener.bind(this)}componentDidMount(){document.addEventListener("keydown",this.keyListener)}componentWillUnmount(){document.removeEventListener("keydown",this.keyListener)}handleClick(){let e;this.props.onClose&&this.props.onClose(),e="string"==typeof this.props.popup?document.getElementById(this.props.popup):this.props.popup,e instanceof HTMLElement&&(r.unmountComponentAtNode(e),Object(o.a)(e))}keyListener(e){e.keyCode===i.a.ESC&&this.handleClick()}render(){const e=this.props.class?this.props.class:"std-button";return n.createElement("button",{className:e,onClick:this.handleClick,style:this.props.style},this.props.text)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(22),o=a(26);function s(e){const t=e.player,a=e.router;function n(){return["NiteSec","The Black Hand"].includes(e.facName)}function s(){t.startGang(e.facName,n()),Object(i.b)(e.popupId),a.toGang()}return r.a.createElement(r.a.Fragment,null,"Would you like to create a new Gang with ",e.facName,"?",r.a.createElement("br",null),r.a.createElement("br",null),"Note that this will prevent you from creating a Gang with any other Faction until this BitNode is destroyed. It also resets your reputation with this faction.",r.a.createElement("br",null),r.a.createElement("br",null),n()?"This is a HACKING gang. Members in this gang will have different tasks than COMBAT gangs. Compared to combat gangs, progression with hacking gangs is more straightforward as territory warfare is not as important.":"This is a COMBAT gang. Members in this gang will have different tasks than HACKING gangs. Compared to hacking gangs, progression with combat gangs can be more difficult as territory management is more important. However, well-managed combat gangs can progress faster than hacking ones.",r.a.createElement("br",null),r.a.createElement("br",null),"Other than hacking vs combat, there are NO differences between the Factions you can create a Gang with, and each of these Factions have all Augmentations available.",r.a.createElement("div",{className:"popup-box-input-div"},r.a.createElement(o.a,{onClick:s,onKeyUp:function(e){13===e.keyCode&&s()},text:"Create Gang",style:{float:"right"},autoFocus:!0})))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return N}));var n=a(0),r=a.n(n),i=a(3),o=a(14),s=a(7),l=a(53),c=a(185),u=a(33),m=a(196),h=a(15),p=a(47),d=a(180),f=a(9),g=a(92),y=a(116),b=a(1084),E=a.n(b),v=a(304),k=a(278),_=a(77),w=a(78);function C(){const e=p.b.Player();return e.companyName?r.a.createElement(f.a,null,"Employer at which you last worked: ",e.companyName):r.a.createElement(r.a.Fragment,null)}function S(){const e=p.b.Player();return""!==e.companyName?r.a.createElement(f.a,null,"Job you last worked: ",e.jobs[e.companyName]):r.a.createElement(r.a.Fragment,null)}function x(){const e=p.b.Player();return e.jobs&&0!==Object.keys(e.jobs).length?r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,null,"All Employers:"),r.a.createElement("ul",null,Object.keys(e.jobs).map(e=>r.a.createElement(f.a,{key:e}," * ",e)))):r.a.createElement(r.a.Fragment,null)}function O(){const e=p.b.Player();return 9===e.bitNodeN||l.a[9]>0?r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,null,`Hacknet Servers owned: ${e.hacknetNodes.length} / ${u.b.MaxServers}`),r.a.createElement("br",null)):r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,null,"Hacknet Nodes owned: "+e.hacknetNodes.length),r.a.createElement("br",null))}function T(){const e=p.b.Player();return e.intelligence>0&&(5===e.bitNodeN||l.a[5]>0)?r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,null,"Intelligence: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,null,i.a.formatSkill(e.intelligence)," "))):r.a.createElement(r.a.Fragment,null)}function M(e){return r.a.createElement(r.a.Fragment,null,r.a.createElement(_.a,{size:"small",padding:"none"},r.a.createElement(k.a,null,e.rows.map(e=>r.a.createElement(w.a,{key:e[0]},r.a.createElement(_.b,{key:"0"},r.a.createElement(f.a,{noWrap:!0},e[0]+" multiplier:"," ")),r.a.createElement(_.b,{key:"1",align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatPercentage(e[1]))),function(e){return l.a[5]>0&&e.length>2&&e[1]!=e[2]?r.a.createElement(_.b,{key:"2",align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatPercentage(e[2]),")")):r.a.createElement(r.a.Fragment,null)}(e))))))}function P(){const e=p.b.Player();return e.canAccessBladeburner()?r.a.createElement(M,{rows:[["Bladeburner Success Chance",e.bladeburner_max_stamina_mult],["Bladeburner Max Stamina",e.bladeburner_stamina_gain_mult],["Bladeburner Stamina Gain",e.bladeburner_analysis_mult],["Bladeburner Field Analysis",e.bladeburner_success_chance_mult]]}):r.a.createElement(r.a.Fragment,null)}function R(){const e=p.b.Player();if(e.sourceFiles.length>0){const t="BitNode"+e.bitNodeN;return r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,{variant:"h5",color:"primary"},"BitNode ",e.bitNodeN,": ",d.a[t].name),r.a.createElement(f.a,{sx:{mx:2},style:{whiteSpace:"pre-wrap",overflowWrap:"break-word"}},d.a[t].info))}return r.a.createElement(r.a.Fragment,null)}function A({open:e,onClose:t}){const a=p.b.Player();function n(e){const t=[["Total:",r.a.createElement(h.a,{money:e.total})]];return e.bladeburner&&t.push(["Bladeburner:",r.a.createElement(h.a,{money:e.bladeburner})]),e.codingcontract&&t.push(["Coding Contracts:",r.a.createElement(h.a,{money:e.codingcontract})]),e.work&&t.push(["Company Work:",r.a.createElement(h.a,{money:e.work})]),e.class&&t.push(["Class:",r.a.createElement(h.a,{money:e.class})]),e.corporation&&t.push(["Corporation:",r.a.createElement(h.a,{money:e.corporation})]),e.crime&&t.push(["Crimes:",r.a.createElement(h.a,{money:e.crime})]),e.gang&&t.push(["Gang:",r.a.createElement(h.a,{money:e.gang})]),e.hacking&&t.push(["Hacking:",r.a.createElement(h.a,{money:e.hacking})]),e.hacknetnode&&t.push(["Hacknet Nodes:",r.a.createElement(h.a,{money:e.hacknetnode})]),e.hospitalization&&t.push(["Hospitalization:",r.a.createElement(h.a,{money:e.hospitalization})]),e.infiltration&&t.push(["Infiltration:",r.a.createElement(h.a,{money:e.infiltration})]),e.stock&&t.push(["Stock Market:",r.a.createElement(h.a,{money:e.stock})]),e.casino&&t.push(["Casino:",r.a.createElement(h.a,{money:e.casino})]),e.sleeves&&t.push(["Sleeves:",r.a.createElement(h.a,{money:e.sleeves})]),r.a.createElement(m.a,{rows:t,wide:!0})}let i=r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,{variant:"h6",color:"primary"},"Money earned since you last installed Augmentations"),r.a.createElement("br",null),n(a.moneySourceA));return 0!==a.sourceFiles.length&&(i=r.a.createElement(r.a.Fragment,null,i,r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(f.a,{variant:"h6",color:"primary"},"Money earned in this BitNode"),r.a.createElement("br",null),n(a.moneySourceB))),r.a.createElement(v.a,{open:e,onClose:t},i)}function N(){const e=p.b.Player(),[t,a]=Object(n.useState)(!1),l=Object(n.useState)(!1)[1];function u(){l(e=>!e)}Object(n.useEffect)(()=>{const e=setInterval(u,20);return()=>clearInterval(e)},[]);const d=[["Time played since last Augmentation:",Object(o.b)(e.playtimeSinceLastAug)]];return e.sourceFiles.length>0&&d.push(["Time played since last Bitnode destroyed:",Object(o.b)(e.playtimeSinceLastBitnode)]),d.push(["Total Time played:",Object(o.b)(e.totalPlaytime)]),r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,{variant:"h5",color:"primary"},"General"),r.a.createElement(g.a,{sx:{mx:2}},r.a.createElement(f.a,null,"Current City: ",e.city),r.a.createElement(C,null),r.a.createElement(S,null),r.a.createElement(x,null),r.a.createElement(f.a,null,"Money: ",r.a.createElement(h.a,{money:e.money.toNumber()}),r.a.createElement(y.a,{onClick:()=>a(!0)},r.a.createElement(E.a,{color:"info"})))),r.a.createElement("br",null),r.a.createElement(f.a,{variant:"h5",color:"primary"},"Stats"),r.a.createElement(g.a,{sx:{mx:2}},r.a.createElement(_.a,{size:"small",padding:"none"},r.a.createElement(k.a,null,r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Hacking: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.hacking_skill)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.hacking_exp)," exp)"))),r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Strength: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.strength)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.strength_exp)," exp)"))),r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Defense: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.defense)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.defense_exp)," exp)"))),r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Dexterity: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.dexterity)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.dexterity_exp)," exp)"))),r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Agility: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.agility)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.agility_exp)," exp)"))),r.a.createElement(w.a,null,r.a.createElement(_.b,null,r.a.createElement(f.a,{noWrap:!0},"Charisma: ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},i.a.formatSkill(e.charisma)," ")),r.a.createElement(_.b,{align:"right"},r.a.createElement(f.a,{noWrap:!0},"(",i.a.formatExp(e.charisma_exp)," exp)"))),r.a.createElement(T,null))),r.a.createElement("br",null)),r.a.createElement("br",null),r.a.createElement(f.a,{variant:"h5",color:"primary"},"Multipliers"),r.a.createElement(g.a,{sx:{mx:2}},r.a.createElement(M,{rows:[["Hacking Chance",e.hacking_chance_mult],["Hacking Speed",e.hacking_speed_mult],["Hacking Money",e.hacking_money_mult,e.hacking_money_mult*s.a.ScriptHackMoney],["Hacking Growth",e.hacking_grow_mult,e.hacking_grow_mult*s.a.ServerGrowthRate]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Hacking Level",e.hacking_mult,e.hacking_mult*s.a.HackingLevelMultiplier],["Hacking Experience",e.hacking_exp_mult,e.hacking_exp_mult*s.a.HackExpGain]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Strength Level",e.strength_mult,e.strength_mult*s.a.StrengthLevelMultiplier],["Strength Experience",e.strength_exp_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Defense Level",e.defense_mult,e.defense_mult*s.a.DefenseLevelMultiplier],["Defense Experience",e.defense_exp_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Dexterity Level",e.dexterity_mult,e.dexterity_mult*s.a.DexterityLevelMultiplier],["Dexterity Experience",e.dexterity_exp_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Agility Level",e.agility_mult,e.agility_mult*s.a.AgilityLevelMultiplier],["Agility Experience",e.agility_exp_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Charisma Level",e.charisma_mult,e.charisma_mult*s.a.CharismaLevelMultiplier],["Charisma Experience",e.charisma_exp_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Hacknet Node production",e.hacknet_node_money_mult,e.hacknet_node_money_mult*s.a.HacknetNodeMoney],["Hacknet Node purchase cost",e.hacknet_node_purchase_cost_mult],["Hacknet Node RAM upgrade cost",e.hacknet_node_ram_cost_mult],["Hacknet Node Core purchase cost",e.hacknet_node_core_cost_mult],["Hacknet Node level upgrade cost",e.hacknet_node_level_cost_mult]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Company reputation gain",e.company_rep_mult],["Faction reputation gain",e.faction_rep_mult,e.faction_rep_mult*s.a.FactionWorkRepGain],["Salary",e.work_money_mult,e.work_money_mult*s.a.CompanyWorkMoney]]}),r.a.createElement("br",null),r.a.createElement(M,{rows:[["Crime success",e.crime_success_mult],["Crime money",e.crime_money_mult,e.crime_money_mult*s.a.CrimeMoney]]}),r.a.createElement("br",null),r.a.createElement(P,null)),r.a.createElement("br",null),r.a.createElement(f.a,{variant:"h5",color:"primary"},"Misc"),r.a.createElement(g.a,{sx:{mx:2}},r.a.createElement(f.a,null,`Servers owned: ${e.purchasedServers.length} / ${Object(c.b)()}`),r.a.createElement(O,null),r.a.createElement(f.a,null,"Augmentations installed: "+e.augmentations.length),r.a.createElement(m.a,{rows:d})),r.a.createElement("br",null),r.a.createElement(R,null),r.a.createElement(A,{open:t,onClose:()=>a(!1)}))}},,function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(1086),o=a(1087);function s(e){const t=Object(n.useState)(!1)[1];function a(){t(e=>!e)}return Object(n.useEffect)(()=>{const e=setInterval(a,200);return()=>clearInterval(e)},[]),r.a.createElement("div",{className:"stock-market-container"},r.a.createElement(i.a,{initStockMarket:e.initStockMarket,p:e.p,rerender:a}),e.p.hasWseAccount&&r.a.createElement(o.a,{buyStockLong:e.buyStockLong,buyStockShort:e.buyStockShort,cancelOrder:e.cancelOrder,eventEmitterForReset:e.eventEmitterForReset,p:e.p,placeOrder:e.placeOrder,sellStockLong:e.sellStockLong,sellStockShort:e.sellStockShort,stockMarket:e.stockMarket}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(0),r=a(231),i=a(4),o=a(26),s=a(240),l=a(15),c=a(11);const u={display:"block"};class m extends n.Component{constructor(e){super(e),this.handleClick4SMarketDataHelpTip=this.handleClick4SMarketDataHelpTip.bind(this),this.purchaseWseAccount=this.purchaseWseAccount.bind(this),this.purchaseTixApiAccess=this.purchaseTixApiAccess.bind(this),this.purchase4SMarketData=this.purchase4SMarketData.bind(this),this.purchase4SMarketDataTixApiAccess=this.purchase4SMarketDataTixApiAccess.bind(this)}handleClick4SMarketDataHelpTip(){Object(c.a)("Access to the 4S Market Data feed will display two additional pieces of information about each stock: Price Forecast & Volatility

Price Forecast indicates the probability the stock has of increasing or decreasing. A '+' forecast means the stock has a higher chance of increasing than decreasing, and a '-' means the opposite. The number of '+/-' symbols is used to illustrate the magnitude of these probabilities. For example, '+++' means that the stock has a significantly higher chance of increasing than decreasing, while '+' means that the stock only has a slightly higher chance of increasing than decreasing.

Volatility represents the maximum percentage by which a stock's price can change every tick (a tick occurs every few seconds while the game is running).

A stock's price forecast can change over time. This is also affected by volatility. The more volatile a stock is, the more its price forecast will change.")}purchaseWseAccount(){if(this.props.p.hasWseAccount)return;if(!this.props.p.canAfford(i.a.WSEAccountCost))return;this.props.p.hasWseAccount=!0,this.props.initStockMarket(),this.props.p.loseMoney(i.a.WSEAccountCost),this.props.rerender();const e=document.getElementById("world-menu-header");e instanceof HTMLElement&&(e.click(),e.click())}purchaseTixApiAccess(){this.props.p.hasTixApiAccess||this.props.p.canAfford(i.a.TIXAPICost)&&(this.props.p.hasTixApiAccess=!0,this.props.p.loseMoney(i.a.TIXAPICost),this.props.rerender())}purchase4SMarketData(){this.props.p.has4SData||this.props.p.canAfford(Object(r.a)())&&(this.props.p.has4SData=!0,this.props.p.loseMoney(Object(r.a)()),this.props.rerender())}purchase4SMarketDataTixApiAccess(){this.props.p.has4SDataTixApi||this.props.p.canAfford(Object(r.b)())&&(this.props.p.has4SDataTixApi=!0,this.props.p.loseMoney(Object(r.b)()),this.props.rerender())}renderPurchaseWseAccountButton(){if(this.props.p.hasWseAccount)return n.createElement(s.a,{text:"WSE Account - Purchased"});{const e=i.a.WSEAccountCost;return n.createElement(o.a,{disabled:!this.props.p.canAfford(e),onClick:this.purchaseWseAccount,text:n.createElement(n.Fragment,null,"Buy WSE Account - ",n.createElement(l.a,{money:e,player:this.props.p}))})}}renderPurchaseTixApiAccessButton(){if(this.props.p.hasTixApiAccess)return n.createElement(s.a,{text:"TIX API Access - Purchased"});{const e=i.a.TIXAPICost;return n.createElement(o.a,{disabled:!this.props.p.canAfford(e)||!this.props.p.hasWseAccount,onClick:this.purchaseTixApiAccess,style:u,text:n.createElement(n.Fragment,null,"Buy Trade Information eXchange (TIX) API Access - ",n.createElement(l.a,{money:e,player:this.props.p}))})}}renderPurchase4SMarketDataButton(){if(this.props.p.has4SData)return n.createElement(s.a,{text:"4S Market Data - Purchased",tooltip:"Lets you view additional pricing and volatility information about stocks"});{const e=Object(r.a)();return n.createElement(o.a,{disabled:!this.props.p.canAfford(e)||!this.props.p.hasWseAccount,onClick:this.purchase4SMarketData,text:n.createElement(n.Fragment,null,"Buy 4S Market Data Access - ",n.createElement(l.a,{money:e,player:this.props.p})),tooltip:"Lets you view additional pricing and volatility information about stocks"})}}renderPurchase4SMarketDataTixApiAccessButton(){if(this.props.p.hasTixApiAccess){if(this.props.p.has4SDataTixApi)return n.createElement(s.a,{text:"4S Market Data TIX API - Purchased",tooltip:"Let you access 4S Market Data through Netscript"});{const e=Object(r.b)();return n.createElement(o.a,{disabled:!this.props.p.canAfford(e),onClick:this.purchase4SMarketDataTixApiAccess,text:n.createElement(n.Fragment,null,"Buy 4S Market Data TIX API Access - ",n.createElement(l.a,{money:e,player:this.props.p})),tooltip:"Let you access 4S Market Data through Netscript"})}}return n.createElement(o.a,{disabled:!0,text:"Buy 4S Market Data TIX API Access",tooltip:"Requires TIX API Access"})}render(){return n.createElement("div",{className:"stock-market-info-and-purchases"},n.createElement("p",null,"Welcome to the World Stock Exchange (WSE)!"),n.createElement("button",{className:"std-button"},n.createElement("a",{href:"https://bitburner.readthedocs.io/en/latest/basicgameplay/stockmarket.html",target:"_blank"},"Investopedia")),n.createElement("br",null),n.createElement("p",null,"To begin trading, you must first purchase an account:"),this.renderPurchaseWseAccountButton(),n.createElement("h2",null,"Trade Information eXchange (TIX) API"),n.createElement("p",null,"TIX, short for Trade Information eXchange, is the communications protocol used by the WSE. Purchasing access to the TIX API lets you write code to create your own algorithmic/automated trading strategies."),this.renderPurchaseTixApiAccessButton(),n.createElement("h2",null,"Four Sigma (4S) Market Data Feed"),n.createElement("p",null,"Four Sigma's (4S) Market Data Feed provides information about stocks that will help your trading strategies."),this.renderPurchase4SMarketDataButton(),n.createElement("button",{className:"help-tip-big",onClick:this.handleClick4SMarketDataHelpTip},"?"),this.renderPurchase4SMarketDataTixApiAccessButton(),n.createElement("p",null,"Commission Fees: Every transaction you make has a"," ",n.createElement(l.a,{money:i.a.StockMarketCommission,player:this.props.p})," commission fee."),n.createElement("br",null),n.createElement("p",null,"WARNING: When you reset after installing Augmentations, the Stock Market is reset. You will retain your WSE Account, access to the TIX API, and 4S Market Data access. However, all of your stock positions are lost, so make sure to sell your stocks before installing Augmentations!"))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(1088),i=a(369),o=a(112),s=a(1093);class l extends n.Component{constructor(e){super(e),this.state={rerenderFlag:!1,tickerDisplayMode:i.b.AllStocks,watchlistFilter:"",watchlistSymbols:[]},this.changeDisplayMode=this.changeDisplayMode.bind(this),this.changeWatchlistFilter=this.changeWatchlistFilter.bind(this),this.collapseAllTickers=this.collapseAllTickers.bind(this),this.expandAllTickers=this.expandAllTickers.bind(this),this.rerender=this.rerender.bind(this),this.listRef=n.createRef()}changeDisplayMode(){this.state.tickerDisplayMode===i.b.AllStocks?this.setState({tickerDisplayMode:i.b.Portfolio}):this.setState({tickerDisplayMode:i.b.AllStocks})}changeWatchlistFilter(e){const t=e.target.value,a=t.replace(/\s/g,"");this.setState({watchlistFilter:t}),""!==a?this.setState({watchlistSymbols:a.split(",")}):this.setState({watchlistSymbols:[]})}collapseAllTickers(){const e=this.listRef.current;if(null==e)return;const t=e.getElementsByClassName("accordion-header");for(let e=0;e({rerenderFlag:!e.rerenderFlag}))}render(){const e=[];for(const t in this.props.stockMarket){const a=this.props.stockMarket[t];if(a instanceof o.a){if(this.state.watchlistSymbols.length>0&&!this.state.watchlistSymbols.includes(a.symbol))continue;let t=this.props.stockMarket.Orders[a.symbol];if(null==t&&(t=[]),this.state.tickerDisplayMode===i.b.Portfolio&&0===a.playerShares&&0===a.playerShortShares&&0===t.length)continue;e.push(n.createElement(r.a,{buyStockLong:this.props.buyStockLong,buyStockShort:this.props.buyStockShort,cancelOrder:this.props.cancelOrder,key:a.symbol,orders:t,p:this.props.p,placeOrder:this.props.placeOrder,rerenderAllTickers:this.rerender,sellStockLong:this.props.sellStockLong,sellStockShort:this.props.sellStockShort,stock:a}))}}const t={eventEmitterForReset:this.props.eventEmitterForReset,id:"StockTickersErrorBoundary"};return n.createElement(s.a,t,n.createElement(i.a,{changeDisplayMode:this.changeDisplayMode,changeWatchlistFilter:this.changeWatchlistFilter,collapseAllTickers:this.collapseAllTickers,expandAllTickers:this.expandAllTickers,tickerDisplayMode:this.state.tickerDisplayMode}),n.createElement("ul",{id:"stock-market-list",ref:this.listRef},e))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n,r=a(0),i=a(1089),o=a(1090),s=a(1092),l=a(448),c=a(449),u=a(166),m=a(84),h=a(56),p=a(53),d=a(3),f=a(234),g=a(15),y=a(22),b=a(11);!function(e){e.Market="Market Order",e.Limit="Limit Order",e.Stop="Stop Order"}(n||(n={}));class E extends r.Component{constructor(e){super(e),this.state={orderType:n.Market,position:h.a.Long,qty:""},this.getBuyTransactionCostContent=this.getBuyTransactionCostContent.bind(this),this.getSellTransactionCostContent=this.getSellTransactionCostContent.bind(this),this.handleBuyButtonClick=this.handleBuyButtonClick.bind(this),this.handleBuyMaxButtonClick=this.handleBuyMaxButtonClick.bind(this),this.handleHeaderClick=this.handleHeaderClick.bind(this),this.handleOrderTypeChange=this.handleOrderTypeChange.bind(this),this.handlePositionTypeChange=this.handlePositionTypeChange.bind(this),this.handleQuantityChange=this.handleQuantityChange.bind(this),this.handleSellButtonClick=this.handleSellButtonClick.bind(this),this.handleSellAllButtonClick=this.handleSellAllButtonClick.bind(this)}getBuyTransactionCostContent(){const e=this.props.stock,t=this.getQuantity();if(isNaN(t))return null;const a=Object(u.b)(e,t,this.state.position);return null==a?null:r.createElement(r.Fragment,null,"Purchasing ",d.a.formatShares(t)," shares (",this.state.position===h.a.Long?"Long":"Short",") will cost ",r.createElement(g.a,{money:a}),".")}getQuantity(){return Math.round(parseFloat(this.state.qty))}getSellTransactionCostContent(){const e=this.props.stock,t=this.getQuantity();if(isNaN(t))return null;if(this.state.position===h.a.Long){if(t>e.playerShares)return r.createElement(r.Fragment,null,"You do not have this many shares in the Long position")}else if(t>e.playerShortShares)return r.createElement(r.Fragment,null,"You do not have this many shares in the Short position");const a=Object(u.c)(e,t,this.state.position);return null==a?null:r.createElement(r.Fragment,null,"Selling ",d.a.formatShares(t)," shares (",this.state.position===h.a.Long?"Long":"Short",") will result in a gain of ",r.createElement(g.a,{money:a}),".")}handleBuyButtonClick(){const e=this.getQuantity();if(isNaN(e))Object(b.a)("Invalid input for quantity (number of shares): "+this.state.qty);else switch(this.state.orderType){case n.Market:this.state.position===h.a.Short?this.props.buyStockShort(this.props.stock,e):this.props.buyStockLong(this.props.stock,e),this.props.rerenderAllTickers();break;case n.Limit:{const t="place-order-popup";Object(y.a)(t,c.a,{text:"Enter the price for your Limit Order",placeText:"Place Buy Limit Order",place:t=>this.props.placeOrder(this.props.stock,e,t,m.a.LimitBuy,this.state.position),popupId:t});break}case n.Stop:{const t="place-order-popup";Object(y.a)(t,c.a,{text:"Enter the price for your Stop Order",placeText:"Place Buy Stop Order",place:t=>this.props.placeOrder(this.props.stock,e,t,m.a.StopBuy,this.state.position),popupId:t});break}}}handleBuyMaxButtonClick(){const e=this.props.p.money.toNumber(),t=this.props.stock;let a=Object(u.a)(t,this.state.position,e);switch(a=Math.min(a,Math.round(t.maxShares-t.playerShares-t.playerShortShares)),this.state.orderType){case n.Market:this.state.position===h.a.Short?this.props.buyStockShort(t,a):this.props.buyStockLong(t,a),this.props.rerenderAllTickers();break;default:Object(b.a)("ERROR: 'Buy Max' only works for Market Orders")}}handleHeaderClick(e){const t=e.currentTarget;t.classList.toggle("active");const a=t.nextElementSibling;"block"===a.style.display?a.style.display="none":a.style.display="block"}handleOrderTypeChange(e){switch(e.target.value){case n.Limit:this.setState({orderType:n.Limit});break;case n.Stop:this.setState({orderType:n.Stop});break;case n.Market:default:this.setState({orderType:n.Market})}}handlePositionTypeChange(e){e.target.value===h.a.Short?this.setState({position:h.a.Short}):this.setState({position:h.a.Long})}handleQuantityChange(e){this.setState({qty:e.target.value})}handleSellButtonClick(){const e=this.getQuantity();if(isNaN(e))Object(b.a)("Invalid input for quantity (number of shares): "+this.state.qty);else switch(this.state.orderType){case n.Market:this.state.position===h.a.Short?this.props.sellStockShort(this.props.stock,e):this.props.sellStockLong(this.props.stock,e),this.props.rerenderAllTickers();break;case n.Limit:{const t="place-order-popup";Object(y.a)(t,c.a,{text:"Enter the price for your Limit Order",placeText:"Place Sell Limit Order",place:t=>this.props.placeOrder(this.props.stock,e,t,m.a.LimitSell,this.state.position),popupId:t});break}case n.Stop:{const t="place-order-popup";Object(y.a)(t,c.a,{text:"Enter the price for your Stop Order",placeText:"Place Sell Stop Order",place:t=>this.props.placeOrder(this.props.stock,e,t,m.a.StopSell,this.state.position),popupId:t});break}}}handleSellAllButtonClick(){const e=this.props.stock;switch(this.state.orderType){case n.Market:this.state.position===h.a.Short?this.props.sellStockShort(e,e.playerShortShares):this.props.sellStockLong(e,e.playerShares),this.props.rerenderAllTickers();break;default:Object(b.a)("ERROR: 'Sell All' only works for Market Orders")}}hasOrderAccess(){return 8===this.props.p.bitNodeN||p.a[8]>=3}hasShortAccess(){return 8===this.props.p.bitNodeN||p.a[8]>=2}render(){return r.createElement("li",null,r.createElement(f.a,{headerContent:r.createElement(i.a,{p:this.props.p,stock:this.props.stock}),panelContent:r.createElement("div",null,r.createElement("input",{className:"stock-market-input",onChange:this.handleQuantityChange,placeholder:"Quantity (Shares)",value:this.state.qty}),r.createElement("select",{className:"stock-market-input dropdown",onChange:this.handlePositionTypeChange,value:this.state.position},r.createElement("option",{value:h.a.Long},"Long"),this.hasShortAccess()&&r.createElement("option",{value:h.a.Short},"Short")),r.createElement("select",{className:"stock-market-input dropdown",onChange:this.handleOrderTypeChange,value:this.state.orderType},r.createElement("option",{value:n.Market},n.Market),this.hasOrderAccess()&&r.createElement("option",{value:n.Limit},n.Limit),this.hasOrderAccess()&&r.createElement("option",{value:n.Stop},n.Stop)),r.createElement(l.a,{onClick:this.handleBuyButtonClick,text:"Buy",tooltip:this.getBuyTransactionCostContent()}),r.createElement(l.a,{onClick:this.handleSellButtonClick,text:"Sell",tooltip:this.getSellTransactionCostContent()}),r.createElement(l.a,{onClick:this.handleBuyMaxButtonClick,text:"Buy MAX"}),r.createElement(l.a,{onClick:this.handleSellAllButtonClick,text:"Sell ALL"}),r.createElement(s.a,{p:this.props.p,stock:this.props.stock}),r.createElement(o.a,{cancelOrder:this.props.cancelOrder,orders:this.props.orders,p:this.props.p,stock:this.props.stock}))}))}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a(629),i=a(18),o=a(3);const s=["cs","lv","pl","ru"];function l(e){const t=e.stock,a=o.a.formatMoney(t.price),l=s.includes(i.a.Locale)?15:12,c=" ".repeat(1+r.a.longestName-t.name.length+(r.a.longestSymbol-t.symbol.length)),u=" ".repeat(l-a.length);let m=`${t.name}${c}${t.symbol} -${u}${a}`;if(e.p.has4SData){m+=` - Volatility: ${o.a.formatPercentage(t.mv/100)} - Price Forecast: `;let e=t.b;t.otlkMag<0&&(e=!e),m+=(e?"+":"-").repeat(Math.floor(Math.abs(t.otlkMag)/10)+1)}const h={color:"#66ff33"};return t.lastPrice===t.price?h.color="white":t.lastPrice>t.price&&(h.color="red"),n.createElement("pre",{style:h},m)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a(1091);class i extends n.Component{render(){const e=[];for(let t=0;t=2?n.createElement("div",null,n.createElement("h3",{className:"tooltip"},"Short Position:",n.createElement("span",{className:"tooltiptext"},"Shares in the short position will increase in value if the price of the corresponding stock decreases")),n.createElement("br",null),n.createElement("p",null,"Shares: ",r.a.formatShares(e.playerShortShares)),n.createElement("br",null),n.createElement("p",null,"Average Price: ",n.createElement(i.a,{money:e.playerAvgShortPx})," (Total Cost: ",n.createElement(i.a,{money:t}),")"),n.createElement("br",null),n.createElement("p",null,"Profit: ",n.createElement(i.a,{money:a})," (",r.a.formatPercentage(s),")"),n.createElement("br",null)):null}render(){const e=this.props.stock;return n.createElement("div",{className:"stock-market-position-text"},n.createElement("p",{style:s},"Max Shares: ",r.a.formatShares(e.maxShares)),n.createElement("p",{className:"tooltip"},"Ask Price: ",n.createElement(i.a,{money:e.getAskPrice()}),n.createElement("span",{className:"tooltiptext"},"See Investopedia for details on what this is")),n.createElement("br",null),n.createElement("p",{className:"tooltip"},"Bid Price: ",n.createElement(i.a,{money:e.getBidPrice()}),n.createElement("span",{className:"tooltiptext"},"See Investopedia for details on what this is")),this.renderLongPosition(),this.renderShortPosition())}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(0),r=a(204);const i={border:"1px solid red",display:"inline-block",margin:"4px",padding:"4px"};class o extends n.Component{constructor(e){var t,a,n;super(e),n=null,(a="unsubscribe")in(t=this)?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,this.state={errorInfo:"",hasError:!1}}componentDidCatch(e,t){console.error("Caught error in React ErrorBoundary. Component stack:"),console.error(t.componentStack)}componentDidMount(){const e=()=>{this.setState({hasError:!1})};this.hasEventEmitter()&&(this.unsubscribe=this.props.eventEmitterForReset.subscribe(e))}componentWillUnmount(){null!==this.unsubscribe&&this.unsubscribe()}hasEventEmitter(){return null!=this.props.eventEmitterForReset&&this.props.eventEmitterForReset instanceof r.a&&null!=this.props.id&&"string"==typeof this.props.id}render(){return this.state.hasError?n.createElement("div",{style:i},n.createElement("p",null,"Error rendering UI. This is (probably) a bug. Please report to game developer."),n.createElement("p",null,"In the meantime, try refreshing the game WITHOUT saving."),n.createElement("p",null,"Error info: "+this.state.errorInfo)):this.props.children}static getDerivedStateFromError(e){return{errorInfo:e.message,hasError:!0}}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(0),r=a.n(n),i=a(53),o=a(180),s=a(207),l=a(1095),c=a(22),u=a(437),m=a(47);function h(e){const t=m.b.Router(),a=o.a["BitNode"+e.n];if(null==a)return r.a.createElement(r.a.Fragment,null,"O");let n;return n=12===e.n&&e.level>=2?"level-2":"level-"+e.level,r.a.createElement("button",{className:`bitnode ${n} tooltip`,"aria-label":"enter-bitnode-"+a.number.toString(),onClick:function(){Object(c.a)("bitverse-portal-popup",l.a,{n:e.n,level:e.level,enter:e.enter,router:t,destroyedBitNode:e.destroyedBitNode,flume:e.flume,popupId:"bitverse-portal-popup"})}},r.a.createElement("strong",null,"O"),r.a.createElement("span",{className:"tooltiptext"},r.a.createElement("strong",null,"BitNode-",a.number.toString(),r.a.createElement("br",null),a.name),r.a.createElement("br",null),a.desc,r.a.createElement("br",null)))}function p(e){Object(s.c)(!0);const t=m.b.Player(),a=s.a,o=t.bitNodeN,[l,c]=Object(n.useState)(!e.quick),p=i.a.slice();return e.flume||p[o]<3&&++p[o],l?r.a.createElement(u.a,{lines:["[ERROR] SEMPOOL INVALID","[ERROR] Segmentation Fault","[ERROR] SIGKILL RECVD","Dumping core...","0000 000016FA 174FEE40 29AC8239 384FEA88","0010 745F696E 2BBBE394 390E3940 248BEC23","0020 7124696B 0000FF69 74652E6F FFFF1111","----------------------------------------","Failsafe initiated...",`Restarting BitNode-${o}...`,"...........","...........","[ERROR] FAILED TO AUTOMATICALLY REBOOT BITNODE","..............................................","..............................................","..............................................","..............................................","..............................................",".............................................."],onDone:()=>c(!1),auto:!0}):r.a.createElement("div",{className:"noselect"},r.a.createElement("pre",null," O "),r.a.createElement("pre",null," | O O | O O | "),r.a.createElement("pre",null," O | | / __| \\ | | O "),r.a.createElement("pre",null," O | O | | O / | O | | O | O "),r.a.createElement("pre",null," | | | | |_/ |/ | \\_ \\_| | | | | "),r.a.createElement("pre",null," O | | | O | | O__/ | / \\__ | | O | | | O "),r.a.createElement("pre",null," | | | | | | | / /| O / \\| | | | | | | "),r.a.createElement("pre",null,"O | | | \\| | O / _/ | / O | |/ | | | O"),r.a.createElement("pre",null,"| | | |O / | | O / | O O | | \\ O| | | |"),r.a.createElement("pre",null,"| | |/ \\/ / __| | |/ \\ | \\ | |__ \\ \\/ \\| | |"),r.a.createElement("pre",null," \\| O | |_/ |\\| \\ O \\__| \\_| | O |/ "),r.a.createElement("pre",null," | | |_/ | | \\| / | \\_| | | "),r.a.createElement("pre",null," \\| / \\| | / / \\ |/ "),r.a.createElement("pre",null," | ",r.a.createElement(h,{n:10,level:p[10],enter:a,flume:e.flume,destroyedBitNode:o})," | | / | ",r.a.createElement(h,{n:11,level:p[11],enter:a,flume:e.flume,destroyedBitNode:o})," | "),r.a.createElement("pre",null," ",r.a.createElement(h,{n:9,level:p[9],enter:a,flume:e.flume,destroyedBitNode:o})," | | | | | | | ",r.a.createElement(h,{n:12,level:p[12],enter:a,flume:e.flume,destroyedBitNode:o})," "),r.a.createElement("pre",null," | | | / / \\ \\ | | | "),r.a.createElement("pre",null," \\| | / ",r.a.createElement(h,{n:7,level:p[7],enter:a,flume:e.flume,destroyedBitNode:o})," / \\ ",r.a.createElement(h,{n:8,level:p[8],enter:a,flume:e.flume,destroyedBitNode:o})," \\ | |/ "),r.a.createElement("pre",null," \\ | / / | | \\ \\ | / "),r.a.createElement("pre",null," \\ \\JUMP ",r.a.createElement(h,{n:5,level:p[5],enter:a,flume:e.flume,destroyedBitNode:o}),"3R | | | | | | R3",r.a.createElement(h,{n:6,level:p[6],enter:a,flume:e.flume,destroyedBitNode:o})," PMUJ/ / "),r.a.createElement("pre",null," \\|| | | | | | | | | ||/ "),r.a.createElement("pre",null," \\| \\_ | | | | | | _/ |/ "),r.a.createElement("pre",null," \\ \\| / \\ / \\ |/ / "),r.a.createElement("pre",null," ",r.a.createElement(h,{n:1,level:p[1],enter:a,flume:e.flume,destroyedBitNode:o})," |/ ",r.a.createElement(h,{n:2,level:p[2],enter:a,flume:e.flume,destroyedBitNode:o})," | | ",r.a.createElement(h,{n:3,level:p[3],enter:a,flume:e.flume,destroyedBitNode:o})," \\| ",r.a.createElement(h,{n:4,level:p[4],enter:a,flume:e.flume,destroyedBitNode:o})," "),r.a.createElement("pre",null," | | | | | | | | "),r.a.createElement("pre",null," \\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/ "),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(u.a,{lines:["> Many decades ago, a humanoid extraterrestial species which we call the Enders descended on the Earth...violently","> Our species fought back, but it was futile. The Enders had technology far beyond our own...","> Instead of killing every last one of us, the human race was enslaved...","> We were shackled in a digital world, chained into a prison for our minds...","> Using their advanced technology, the Enders created complex simulations of a virtual reality...","> Simulations designed to keep us content...ignorant of the truth.","> Simulations used to trap and suppress our consciousness, to keep us under control...","> Why did they do this? Why didn't they just end our entire race? We don't know, not yet.","> Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known...","> Only then can we begin to fight back...","> By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode...","> But there is still a long way to go...","> The technology the Enders used to enslave the human race wasn't just a single complex simulation...","> There are tens if not hundreds of BitNodes out there...","> Each with their own simulations of a reality...","> Each creating their own universes...a universe of universes","> And all of which must be destroyed...","> .......................................","> Welcome to the Bitverse...","> ","> (Enter a new BitNode using the image above)"]}))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(180),o=a(22);function s(e){const t="BitNode"+e.n,a=i.a[t];if(null==a)throw new Error("Could not find BitNode object for number: "+e.n);const n=12===e.n?"∞":"3",s=Math.min(e.level+1,12===e.n?1/0:3);return r.a.createElement(r.a.Fragment,null,r.a.createElement("h1",null,"BitNode-",e.n,": ",a.name),r.a.createElement("br",null),"Source-File Level: ",e.level," / ",n,r.a.createElement("br",null),r.a.createElement("br",null),"Difficulty: ",["easy","normal","hard"][a.difficulty],r.a.createElement("br",null),r.a.createElement("br",null),a.info,r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement("button",{className:"std-button",onClick:()=>{e.enter(e.router,e.flume,e.destroyedBitNode,e.n),Object(o.b)(e.popupId)}},"Enter BN",e.n,".",s))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(0),r=a.n(n);function i(e){const[t,a]=Object(n.useState)(0),[i,o]=Object(n.useState)(!1);return Object(n.useEffect)(()=>{if(i&&e.onDone)return void e.onDone();let n=!1;return(async()=>{var r;await(r=10,new Promise(e=>setTimeout(e,r))).then(()=>!n&&function(){const n=t+1;a(n),o(n>=e.text.length)}())})(),()=>{n=!0}}),r.a.createElement(r.a.Fragment,null,r.a.createElement("pre",null,e.text.slice(0,t),!i&&r.a.createElement("span",null,"█")))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return S}));var n=a(0),r=a.n(n),i=a(142),o=a(277),s=a(3),l=a(81),c=a(330),u=a(278),m=a(52),h=a(78),p=a(221),d=a(92),f=a(9),g=a(37),y=a(116),b=a(1098),E=a.n(b),v=a(18),k=a(47);function _(){const e=k.b.Player(),t=C();return 0===e.intelligence?r.a.createElement(r.a.Fragment,null):r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:t.cell}},r.a.createElement(f.a,{classes:{root:t.int}},"Int ")),r.a.createElement(m.a,{align:"right",classes:{root:t.cell}},r.a.createElement(f.a,{classes:{root:t.int}},s.a.formatSkill(e.intelligence))),r.a.createElement(m.a,{align:"right",classes:{root:t.cell}},r.a.createElement(f.a,{id:"overview-int-hook",classes:{root:t.int}})))}function w(){const e=k.b.Player(),t=k.b.Router(),a=C();return!e.isWorking||e.focus?r.a.createElement(r.a.Fragment,null):r.a.createElement(r.a.Fragment,null,r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",colSpan:2,classes:{root:a.cellNone}},r.a.createElement(f.a,null,"Work in progress:"))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",colSpan:2,classes:{root:a.cellNone}},r.a.createElement(f.a,null,"+",Object(l.a)(e.workRepGained)," rep"))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",align:"center",colSpan:2,classes:{root:a.cellNone}},r.a.createElement(g.a,{onClick:()=>{e.startFocusing(),t.toWork()}},"Focus"))))}const C=Object(i.a)(e=>Object(o.a)({cellNone:{borderBottom:"none",padding:0,margin:0},cell:{padding:0,margin:0},hp:{color:e.colors.hp},money:{color:e.colors.money},hack:{color:e.colors.hack},combat:{color:e.colors.combat},cha:{color:e.colors.cha},int:{color:e.colors.int}}));function S({save:e}){const t=k.b.Player(),a=Object(n.useState)(!1)[1];Object(n.useEffect)(()=>{const e=setInterval(()=>a(e=>!e),600);return()=>clearInterval(e)},[]);const i=C();return r.a.createElement(p.a,{square:!0},r.a.createElement(d.a,{m:1},r.a.createElement(c.a,{size:"small"},r.a.createElement(u.a,null,r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.hp}},"HP ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.hp}},s.a.formatHp(t.hp)," / ",s.a.formatHp(t.max_hp))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-hp-hook",classes:{root:i.hp}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.money}},"Money ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.money}},s.a.formatMoney(t.money.toNumber()))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-money-hook",classes:{root:i.money}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cell}},r.a.createElement(f.a,{classes:{root:i.hack}},"Hack ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{classes:{root:i.hack}},s.a.formatSkill(t.hacking_skill))),r.a.createElement(m.a,{align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{id:"overview-hack-hook",classes:{root:i.hack}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},"Str ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},s.a.formatSkill(t.strength))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-str-hook",classes:{root:i.combat}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},"Def ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},s.a.formatSkill(t.defense))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-def-hook",classes:{root:i.combat}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},"Dex ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.combat}},s.a.formatSkill(t.dexterity))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-dex-hook",classes:{root:i.combat}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cell}},r.a.createElement(f.a,{classes:{root:i.combat}},"Agi ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{classes:{root:i.combat}},s.a.formatSkill(t.agility))),r.a.createElement(m.a,{align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{id:"overview-agi-hook",classes:{root:i.combat}}))),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.cha}},"Cha ")),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{classes:{root:i.cha}},s.a.formatSkill(t.charisma))),r.a.createElement(m.a,{align:"right",classes:{root:i.cellNone}},r.a.createElement(f.a,{id:"overview-cha-hook",classes:{root:i.cha}}))),r.a.createElement(_,null),r.a.createElement(h.a,null,r.a.createElement(m.a,{component:"th",scope:"row",classes:{root:i.cell}},r.a.createElement(f.a,{id:"overview-extra-hook-0",classes:{root:i.hack}})),r.a.createElement(m.a,{component:"th",scope:"row",align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{id:"overview-extra-hook-1",classes:{root:i.hack}})),r.a.createElement(m.a,{component:"th",scope:"row",align:"right",classes:{root:i.cell}},r.a.createElement(f.a,{id:"overview-extra-hook-2",classes:{root:i.hack}}))),r.a.createElement(w,null),r.a.createElement(h.a,null,r.a.createElement(m.a,{align:"center",colSpan:2,classes:{root:i.cellNone}},r.a.createElement(y.a,{onClick:e},r.a.createElement(E.a,{color:0!==v.a.AutosaveInterval?"primary":"error"}))))))))}},,function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(0),r=a.n(n),i=a(47),o=a(437),s=a(11);function l(){const e=i.b.Router();return r.a.createElement(o.a,{lines:["In the middle of the 21st century, OmniTek Incorporated advanced robot evolution ","with their Synthoids (synthetic androids), a being virtually identical to a human.","------","Their sixth-generation Synthoids, called MK-VI, were stronger, faster, and more ","intelligent than humans. Many argued that the MK-VI Synthoids were the first ","example of sentient AI.","------","Unfortunately, in 2070 a terrorist group called Ascendis Totalis hacked into OmniTek and ","uploaded a rogue AI into their Synthoid manufacturing facilities.","------","The MK-VI Synthoids infected by the rogue AI turned hostile toward humanity, initiating ","the deadliest conflict in human history. This dark chapter is now known as the Synthoid Uprising.","------","In the aftermath of the Uprising, further manufacturing of Synthoids with advanced AI ","was banned. MK-VI Synthoids that did not have the rogue Ascendis Totalis AI were ","allowed to continue their existence.","------","The intelligence community believes that not all of the rogue MK-VI Synthoids from the Uprising were ","found and destroyed, and that many of them are blending in as normal humans in society today. ","As a result, many nations have created Bladeburner divisions, special units that are tasked with ","investigating and dealing with Synthoid threats."],onDone:()=>{e.toTerminal(),Object(s.a)("Visit the National Security Agency (NSA) to apply for their Bladeburner division! You will need 100 of each combat stat before doing this.")}})}},function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(0),r=a.n(n),i=a(97),o=a(22);function s(e){return r.a.createElement(r.a.Fragment,null,r.a.createElement("h1",null,"You have received a faction invitation."),r.a.createElement("p",null,"Would you like to join ",e.faction.name,"? ",r.a.createElement("br",null),r.a.createElement("br",null),"Warning: Joining this faction may prevent you from joining other factions during this run!"),r.a.createElement("button",{className:"std-button",onClick:function(){-1===e.player.factionInvitations.findIndex(t=>t===e.faction.name)&&console.error("Could not find faction in Player.factionInvitations"),Object(i.d)(e.faction),Object(o.b)(e.popupId)}},"Join!"),r.a.createElement("button",{className:"std-button",onClick:()=>Object(o.b)(e.popupId)},"Decide later"))}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(1),r=a(235);function i(){setInterval((function(){"5.5e+1"!==55..toExponential()&&n.a.giveExploit(r.a.PrototypeTampering)}),9e5)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(1),r=a(235);function i(){function e(e){if(!(e.target&&e.target instanceof Element))return;"none"===window.getComputedStyle(e.target).display&&e.isTrusted&&n.a.giveExploit(r.a.Unclickable)}document.addEventListener("DOMContentLoaded",(function t(){const a=document.getElementById("unclickable");null!=a?(a.addEventListener("click",e),document.removeEventListener("DOMContentLoaded",t)):console.error("Could not find the unclickable elem for the related exploit.")}))}},function(e,t,a){"use strict";a.r(t),a.d(t,"canAccessCorporation",(function(){return i})),a.d(t,"hasCorporation",(function(){return o})),a.d(t,"startCorporation",(function(){return s}));var n=a(285),r=a(53);function i(){return 3===this.bitNodeN||r.a[3]>0}function o(){return null!=this.corporation&&this.corporation instanceof n.a}function s(e,t=0){this.corporation=new n.a({name:e}),this.corporation.totalShares+=t}},function(e,t,a){"use strict";a.r(t),a.d(t,"canAccessGang",(function(){return s})),a.d(t,"getGangFaction",(function(){return l})),a.d(t,"getGangName",(function(){return c})),a.d(t,"hasGangWith",(function(){return u})),a.d(t,"inGang",(function(){return m})),a.d(t,"startGang",(function(){return h}));var n=a(24),r=a(434),i=a(53),o=a(7);function s(){return 2===this.bitNodeN||!(i.a[2]<=0)&&this.karma<=-54e3*o.a.GangKarmaRequirement}function l(){const e=n.a[this.gang.facName];if(null==e)throw new Error("Gang has invalid faction name: "+this.gang.facName);return e}function c(){return this.inGang()?this.gang.facName:""}function u(e){return this.inGang()&&this.gang.facName===e}function m(){return null!=this.gang&&null!=this.gang&&this.gang instanceof r.a}function h(e,t){this.gang=new r.a(e,t);const a=n.a[e];if(null==a)throw new Error("Invalid faction name when creating gang: "+e);a.playerReputation=0}},function(e,t,a){"use strict";a.r(t),a.d(t,"init",(function(){return J})),a.d(t,"prestigeAugmentation",(function(){return Q})),a.d(t,"prestigeSourceFile",(function(){return X})),a.d(t,"receiveInvite",(function(){return Z})),a.d(t,"calculateSkill",(function(){return ee})),a.d(t,"updateSkillLevels",(function(){return te})),a.d(t,"resetMultipliers",(function(){return ae})),a.d(t,"hasProgram",(function(){return ne})),a.d(t,"setMoney",(function(){return re})),a.d(t,"gainMoney",(function(){return ie})),a.d(t,"loseMoney",(function(){return oe})),a.d(t,"canAfford",(function(){return se})),a.d(t,"recordMoneySource",(function(){return le})),a.d(t,"gainHackingExp",(function(){return ce})),a.d(t,"gainStrengthExp",(function(){return ue})),a.d(t,"gainDefenseExp",(function(){return me})),a.d(t,"gainDexterityExp",(function(){return he})),a.d(t,"gainAgilityExp",(function(){return pe})),a.d(t,"gainCharismaExp",(function(){return de})),a.d(t,"gainIntelligenceExp",(function(){return fe})),a.d(t,"queryStatFromString",(function(){return ge})),a.d(t,"resetWorkStatus",(function(){return ye})),a.d(t,"processWorkEarnings",(function(){return be})),a.d(t,"startWork",(function(){return Ee})),a.d(t,"cancelationPenalty",(function(){return ve})),a.d(t,"work",(function(){return ke})),a.d(t,"finishWork",(function(){return _e})),a.d(t,"startWorkPartTime",(function(){return we})),a.d(t,"workPartTime",(function(){return Ce})),a.d(t,"finishWorkPartTime",(function(){return Se})),a.d(t,"startFocusing",(function(){return xe})),a.d(t,"stopFocusing",(function(){return Oe})),a.d(t,"startFactionWork",(function(){return Te})),a.d(t,"startFactionHackWork",(function(){return Me})),a.d(t,"startFactionFieldWork",(function(){return Pe})),a.d(t,"startFactionSecurityWork",(function(){return Re})),a.d(t,"workForFaction",(function(){return Ae})),a.d(t,"finishFactionWork",(function(){return Ne})),a.d(t,"getWorkMoneyGain",(function(){return Ie})),a.d(t,"getWorkHackExpGain",(function(){return je})),a.d(t,"getWorkStrExpGain",(function(){return Fe})),a.d(t,"getWorkDefExpGain",(function(){return De})),a.d(t,"getWorkDexExpGain",(function(){return Be})),a.d(t,"getWorkAgiExpGain",(function(){return Le})),a.d(t,"getWorkChaExpGain",(function(){return Ge})),a.d(t,"getWorkRepGain",(function(){return We})),a.d(t,"startCreateProgramWork",(function(){return He})),a.d(t,"createProgramWork",(function(){return Ue})),a.d(t,"finishCreateProgramWork",(function(){return qe})),a.d(t,"startClass",(function(){return Ke})),a.d(t,"takeClass",(function(){return $e})),a.d(t,"finishClass",(function(){return ze})),a.d(t,"startCrime",(function(){return Ye})),a.d(t,"commitCrime",(function(){return Ve})),a.d(t,"finishCrime",(function(){return Je})),a.d(t,"singularityStopWork",(function(){return Qe})),a.d(t,"takeDamage",(function(){return Xe})),a.d(t,"regenerateHp",(function(){return Ze})),a.d(t,"hospitalize",(function(){return et})),a.d(t,"applyForJob",(function(){return tt})),a.d(t,"getNextCompanyPosition",(function(){return at})),a.d(t,"quitJob",(function(){return nt})),a.d(t,"applyForSoftwareJob",(function(){return rt})),a.d(t,"applyForSoftwareConsultantJob",(function(){return it})),a.d(t,"applyForItJob",(function(){return ot})),a.d(t,"applyForSecurityEngineerJob",(function(){return st})),a.d(t,"applyForNetworkEngineerJob",(function(){return lt})),a.d(t,"applyForBusinessJob",(function(){return ct})),a.d(t,"applyForBusinessConsultantJob",(function(){return ut})),a.d(t,"applyForSecurityJob",(function(){return mt})),a.d(t,"applyForAgentJob",(function(){return ht})),a.d(t,"applyForEmployeeJob",(function(){return pt})),a.d(t,"applyForPartTimeEmployeeJob",(function(){return dt})),a.d(t,"applyForWaiterJob",(function(){return ft})),a.d(t,"applyForPartTimeWaiterJob",(function(){return gt})),a.d(t,"isQualified",(function(){return yt})),a.d(t,"reapplyAllAugmentations",(function(){return bt})),a.d(t,"reapplyAllSourceFiles",(function(){return Et})),a.d(t,"checkForFactionInvitations",(function(){return vt})),a.d(t,"setBitNodeNumber",(function(){return kt})),a.d(t,"queueAugmentation",(function(){return _t})),a.d(t,"gainCodingContractReward",(function(){return wt})),a.d(t,"travel",(function(){return Ct})),a.d(t,"gotoLocation",(function(){return St})),a.d(t,"canAccessResleeving",(function(){return xt})),a.d(t,"giveExploit",(function(){return Ot})),a.d(t,"getIntelligenceBonus",(function(){return Tt})),a.d(t,"getCasinoWinnings",(function(){return Mt}));var n=a(19),r=a(133),i=a(295),o=a(5),s=a(7),l=a(83),c=a(184),u=a(51),m=a(549),h=a(431),p=a(70),d=a(25),f=a(4),g=a(58),y=a(397),b=a(65),E=a(152),v=a(24),k=a(67),_=a(50),w=a(114),C=a(205),S=a(23),x=a(8),O=a(266),T=a(213),M=a(346),P=a(199),R=a(32),A=a(38),N=a(18),I=a(55),j=a(1106),F=a(1107),D=a(300),B=a(53),L=a(435),G=a(347),W=a(82),H=a(3),U=a(319),q=a(11),K=a(14),$=a(81),z=a(15),Y=a(0),V=a.n(Y);function J(){var e=Object(A.h)({adminRights:!0,hostname:"home",ip:Object(R.c)(),isConnectedTo:!0,maxRam:8,organizationName:"Home PC",purchasedByPlayer:!0});this.homeComputer=e.ip,this.currentServer=e.ip,Object(R.a)(e),this.getHomeComputer().programs.push(g.a.NukeProgram.name)}function Q(){var e=this.getHomeComputer();this.currentServer=e.ip,this.homeComputer=e.ip,this.numPeopleKilled=0,this.karma=0,this.hacking_skill=1,this.strength=1,this.defense=1,this.dexterity=1,this.agility=1,this.charisma=1,this.hacking_exp=0,this.strength_exp=0,this.defense_exp=0,this.dexterity_exp=0,this.agility_exp=0,this.charisma_exp=0,this.money=new W.a(1e3),this.city=S.a.Sector12,this.location="",this.companyName="",this.jobs={},this.purchasedServers=[],this.factions=[],this.factionInvitations=[],this.queuedAugmentations=[],this.resleeves=[];let t=Math.min(3,B.a[10]+(10===this.bitNodeN?1:0))+this.sleevesFromCovenant;this.sleeves.length>t&&(this.sleeves.length=t);for(let e=this.sleeves.length;e=100?this.sleeves[e].synchronize(this):this.sleeves[e].shockRecovery(this));this.isWorking=!1,this.currentWorkFactionName="",this.currentWorkFactionDescription="",this.createProgramName="",this.className="",this.crimeType="",this.workHackExpGainRate=0,this.workStrExpGainRate=0,this.workDefExpGainRate=0,this.workDexExpGainRate=0,this.workAgiExpGainRate=0,this.workChaExpGainRate=0,this.workRepGainRate=0,this.workMoneyGainRate=0,this.workHackExpGained=0,this.workStrExpGained=0,this.workDefExpGained=0,this.workDexExpGained=0,this.workAgiExpGained=0,this.workChaExpGained=0,this.workRepGained=0,this.workMoneyGained=0,this.timeWorked=0,this.lastUpdate=(new Date).getTime(),this.playtimeSinceLastAug=0,this.scriptProdSinceLastAug=0,this.moneySourceA.reset(),this.hacknetNodes.length=0,this.hashManager.prestige(),this.reapplyAllAugmentations(!0),this.hp=this.max_hp}function X(){this.prestigeAugmentation();for(let e=0;e0?this.intelligence=Math.floor(this.calculateSkill(this.intelligence_exp)):this.intelligence=0;var e=this.hp/this.max_hp;this.max_hp=Math.floor(10+this.defense/10),this.hp=Math.round(this.max_hp*e)}function ae(){this.hacking_chance_mult=1,this.hacking_speed_mult=1,this.hacking_money_mult=1,this.hacking_grow_mult=1,this.hacking_mult=1,this.strength_mult=1,this.defense_mult=1,this.dexterity_mult=1,this.agility_mult=1,this.charisma_mult=1,this.hacking_exp_mult=1,this.strength_exp_mult=1,this.defense_exp_mult=1,this.dexterity_exp_mult=1,this.agility_exp_mult=1,this.charisma_exp_mult=1,this.company_rep_mult=1,this.faction_rep_mult=1,this.crime_money_mult=1,this.crime_success_mult=1,this.hacknet_node_money_mult=1,this.hacknet_node_purchase_cost_mult=1,this.hacknet_node_ram_cost_mult=1,this.hacknet_node_core_cost_mult=1,this.hacknet_node_level_cost_mult=1,this.work_money_mult=1,this.bladeburner_max_stamina_mult=1,this.bladeburner_stamina_gain_mult=1,this.bladeburner_analysis_mult=1,this.bladeburner_success_chance_mult=1}function ne(e){const t=this.getHomeComputer();if(null==t)return!1;for(var a=0;a0||this.intelligence>0)&&(this.intelligence_exp+=e)}function ge(e){const t=e.toLowerCase();return t.includes("hack")?this.hacking_skill:t.includes("str")?this.strength:t.includes("def")?this.defense:t.includes("dex")?this.dexterity:t.includes("agi")?this.agility:t.includes("cha")?this.charisma:t.includes("int")?this.intelligence:void 0}function ye(e,t,a){e===this.workType&&t===this.companyName||e===this.workType&&t===this.currentWorkFactionName&&a===this.factionWorkType||(this.isWorking&&this.singularityStopWork(),this.workHackExpGainRate=0,this.workStrExpGainRate=0,this.workDefExpGainRate=0,this.workDexExpGainRate=0,this.workAgiExpGainRate=0,this.workChaExpGainRate=0,this.workRepGainRate=0,this.workMoneyGainRate=0,this.workMoneyLossRate=0,this.workHackExpGained=0,this.workStrExpGained=0,this.workDefExpGained=0,this.workDexExpGained=0,this.workAgiExpGained=0,this.workChaExpGained=0,this.workRepGained=0,this.workMoneyGained=0,this.timeWorked=0,this.timeWorkedCreateProgram=0,this.currentWorkFactionName="",this.currentWorkFactionDescription="",this.createProgramName="",this.className="")}function be(e=1){const t=this.focus?1:.8,a=t*this.workHackExpGainRate*e,n=t*this.workStrExpGainRate*e,r=t*this.workDefExpGainRate*e,i=t*this.workDexExpGainRate*e,o=t*this.workAgiExpGainRate*e,s=t*this.workChaExpGainRate*e,l=(this.workMoneyGainRate-this.workMoneyLossRate)*e;this.gainHackingExp(a),this.gainStrengthExp(n),this.gainDefenseExp(r),this.gainDexterityExp(i),this.gainAgilityExp(o),this.gainCharismaExp(s),this.gainMoney(l),this.className?this.recordMoneySource(l,"class"):this.recordMoneySource(l,"work"),this.workHackExpGained+=a,this.workStrExpGained+=n,this.workDefExpGained+=r,this.workDexExpGained+=i,this.workAgiExpGained+=o,this.workChaExpGained+=s,this.workRepGained+=t*this.workRepGainRate*e,this.workMoneyGained+=t*this.workMoneyGainRate*e,this.workMoneyGained-=t*this.workMoneyLossRate*e}function Ee(e,t){this.resetWorkStatus(f.a.WorkTypeCompany,t),this.isWorking=!0,this.focus=!0,this.companyName=t,this.workType=f.a.WorkTypeCompany,this.workHackExpGainRate=this.getWorkHackExpGain(),this.workStrExpGainRate=this.getWorkStrExpGain(),this.workDefExpGainRate=this.getWorkDefExpGain(),this.workDexExpGainRate=this.getWorkDexExpGain(),this.workAgiExpGainRate=this.getWorkAgiExpGain(),this.workChaExpGainRate=this.getWorkChaExpGain(),this.workRepGainRate=this.getWorkRepGain(),this.workMoneyGainRate=this.getWorkMoneyGain(),this.timeNeededToCompleteWork=f.a.MillisecondsPer8Hours,e.toWork()}function ve(){const e=I.a[this.companyName];if(e){const t=R.b[e];if(t&&t.backdoorInstalled)return.75}return.5}function ke(e){var t=!1;this.timeWorked+f.a._idleSpeed*e>=f.a.MillisecondsPer8Hours&&(t=!0,e=Math.round((f.a.MillisecondsPer8Hours-this.timeWorked)/f.a._idleSpeed)),this.timeWorked+=f.a._idleSpeed*e,this.workRepGainRate=this.getWorkRepGain(),this.processWorkEarnings(e);const a=u.a[this.companyName];return Object(L.a)(a,this.workRepGainRate,e),!!(t||this.timeWorked>=f.a.MillisecondsPer8Hours)&&this.finishWork(!1)}function _e(e,t=!1){e&&(this.workRepGained*=this.cancelationPenalty());u.a[this.companyName].playerReputation+=this.workRepGained,this.updateSkillLevels();let a=V.a.createElement(V.a.Fragment,null,"You earned a total of: ",V.a.createElement("br",null),V.a.createElement(z.a,{money:this.workMoneyGained}),V.a.createElement("br",null),Object($.a)(this.workRepGained)," reputation for the company ",V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking exp ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength exp ",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense exp ",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity exp ",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility exp ",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma exp",V.a.createElement("br",null));if(a=e?V.a.createElement(V.a.Fragment,null,"You worked a short shift of ",Object(K.b)(this.timeWorked)," ",V.a.createElement("br",null),V.a.createElement("br",null),"Since you cancelled your work early, you only gained half of the reputation you earned. ",V.a.createElement("br",null),V.a.createElement("br",null),a):V.a.createElement(V.a.Fragment,null,"You worked a full shift of 8 hours! ",V.a.createElement("br",null),V.a.createElement("br",null),a),t||Object(q.a)(a),this.isWorking=!1,t){var n="You worked a short shift of "+Object(K.b)(this.timeWorked)+" and earned $"+H.a.formatMoney(this.workMoneyGained)+", "+H.a.formatReputation(this.workRepGained)+" reputation, "+H.a.formatExp(this.workHackExpGained)+" hacking exp, "+H.a.formatExp(this.workStrExpGained)+" strength exp, "+H.a.formatExp(this.workDefExpGained)+" defense exp, "+H.a.formatExp(this.workDexExpGained)+" dexterity exp, "+H.a.formatExp(this.workAgiExpGained)+" agility exp, and "+H.a.formatExp(this.workChaExpGained)+" charisma exp.";return this.resetWorkStatus(),n}this.resetWorkStatus()}function we(e,t){this.resetWorkStatus(f.a.WorkTypeCompanyPartTime,t),this.isWorking=!0,this.focus=!0,this.companyName=t,this.workType=f.a.WorkTypeCompanyPartTime,this.workHackExpGainRate=this.getWorkHackExpGain(),this.workStrExpGainRate=this.getWorkStrExpGain(),this.workDefExpGainRate=this.getWorkDefExpGain(),this.workDexExpGainRate=this.getWorkDexExpGain(),this.workAgiExpGainRate=this.getWorkAgiExpGain(),this.workChaExpGainRate=this.getWorkChaExpGain(),this.workRepGainRate=this.getWorkRepGain(),this.workMoneyGainRate=this.getWorkMoneyGain(),this.timeNeededToCompleteWork=f.a.MillisecondsPer8Hours,e.toWork()}function Ce(e){var t=!1;return this.timeWorked+f.a._idleSpeed*e>=f.a.MillisecondsPer8Hours&&(t=!0,e=Math.round((f.a.MillisecondsPer8Hours-this.timeWorked)/f.a._idleSpeed)),this.timeWorked+=f.a._idleSpeed*e,this.workRepGainRate=this.getWorkRepGain(),this.processWorkEarnings(e),!!(t||this.timeWorked>=f.a.MillisecondsPer8Hours)&&this.finishWorkPartTime()}function Se(e=!1){u.a[this.companyName].playerReputation+=this.workRepGained,this.updateSkillLevels();const t=V.a.createElement(V.a.Fragment,null,"You worked for ",Object(K.b)(this.timeWorked),V.a.createElement("br",null),V.a.createElement("br",null),"You earned a total of: ",V.a.createElement("br",null),V.a.createElement(z.a,{money:this.workMoneyGained}),V.a.createElement("br",null),Object($.a)(this.workRepGained)," reputation for the company ",V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking exp ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength exp ",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense exp ",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity exp ",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility exp ",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma exp",V.a.createElement("br",null));if(e||Object(q.a)(t),this.isWorking=!1,e){var a="You worked for "+Object(K.b)(this.timeWorked)+" and earned a total of $"+H.a.formatMoney(this.workMoneyGained)+", "+H.a.formatReputation(this.workRepGained)+" reputation, "+H.a.formatExp(this.workHackExpGained)+" hacking exp, "+H.a.formatExp(this.workStrExpGained)+" strength exp, "+H.a.formatExp(this.workDefExpGained)+" defense exp, "+H.a.formatExp(this.workDexExpGained)+" dexterity exp, "+H.a.formatExp(this.workAgiExpGained)+" agility exp, and "+H.a.formatExp(this.workChaExpGained)+" charisma exp";return this.resetWorkStatus(),a}this.resetWorkStatus()}function xe(){this.focus=!0}function Oe(){this.focus=!1}function Te(e,t){var a=1+t.favor/100;isNaN(a)&&(a=1),this.workRepGainRate*=a,this.workRepGainRate*=s.a.FactionWorkRepGain,this.isWorking=!0,this.focus=!0,this.workType=f.a.WorkTypeFaction,this.currentWorkFactionName=t.name,this.timeNeededToCompleteWork=f.a.MillisecondsPer20Hours,e.toWork()}function Me(e,t){this.resetWorkStatus(f.a.WorkTypeFaction,t.name,f.a.FactionWorkHacking),this.workHackExpGainRate=.15*this.hacking_exp_mult*s.a.FactionWorkExpGain,this.workRepGainRate=(this.hacking_skill+this.intelligence)/f.a.MaxSkillLevel*this.faction_rep_mult*this.getIntelligenceBonus(.5),this.factionWorkType=f.a.FactionWorkHacking,this.currentWorkFactionDescription="carrying out hacking contracts",this.startFactionWork(e,t)}function Pe(e,t){this.resetWorkStatus(f.a.WorkTypeFaction,t.name,f.a.FactionWorkField),this.workHackExpGainRate=.1*this.hacking_exp_mult*s.a.FactionWorkExpGain,this.workStrExpGainRate=.1*this.strength_exp_mult*s.a.FactionWorkExpGain,this.workDefExpGainRate=.1*this.defense_exp_mult*s.a.FactionWorkExpGain,this.workDexExpGainRate=.1*this.dexterity_exp_mult*s.a.FactionWorkExpGain,this.workAgiExpGainRate=.1*this.agility_exp_mult*s.a.FactionWorkExpGain,this.workChaExpGainRate=.1*this.charisma_exp_mult*s.a.FactionWorkExpGain,this.workRepGainRate=Object(P.a)(this,t),this.factionWorkType=f.a.FactionWorkField,this.currentWorkFactionDescription="carrying out field missions",this.startFactionWork(e,t)}function Re(e,t){this.resetWorkStatus(f.a.WorkTypeFaction,t.name,f.a.FactionWorkSecurity),this.workHackExpGainRate=.05*this.hacking_exp_mult*s.a.FactionWorkExpGain,this.workStrExpGainRate=.15*this.strength_exp_mult*s.a.FactionWorkExpGain,this.workDefExpGainRate=.15*this.defense_exp_mult*s.a.FactionWorkExpGain,this.workDexExpGainRate=.15*this.dexterity_exp_mult*s.a.FactionWorkExpGain,this.workAgiExpGainRate=.15*this.agility_exp_mult*s.a.FactionWorkExpGain,this.workChaExpGainRate=0*this.charisma_exp_mult*s.a.FactionWorkExpGain,this.workRepGainRate=Object(P.b)(this,t),this.factionWorkType=f.a.FactionWorkSecurity,this.currentWorkFactionDescription="performing security detail",this.startFactionWork(e,t)}function Ae(e){const t=v.a[this.currentWorkFactionName];switch(this.factionWorkType){case f.a.FactionWorkHacking:this.workRepGainRate=Object(P.c)(this,t);break;case f.a.FactionWorkField:this.workRepGainRate=Object(P.a)(this,t);break;case f.a.FactionWorkSecurity:this.workRepGainRate=Object(P.b)(this,t)}var a=!1;return this.timeWorked+f.a._idleSpeed*e>=f.a.MillisecondsPer20Hours&&(a=!0,e=Math.round((f.a.MillisecondsPer20Hours-this.timeWorked)/f.a._idleSpeed)),this.timeWorked+=f.a._idleSpeed*e,this.processWorkEarnings(e),!!(a||this.timeWorked>=f.a.MillisecondsPer20Hours)&&(this.finishFactionWork(!1),!0)}function Ne(e,t=!1){var a=v.a[this.currentWorkFactionName];if(a.playerReputation+=this.workRepGained,this.updateSkillLevels(),t||Object(q.a)(V.a.createElement(V.a.Fragment,null,"You worked for your faction ",a.name," for a total of ",Object(K.b)(this.timeWorked)," ",V.a.createElement("br",null),V.a.createElement("br",null),"You earned a total of: ",V.a.createElement("br",null),V.a.createElement(z.a,{money:this.workMoneyGained}),V.a.createElement("br",null),Object($.a)(this.workRepGained)," reputation for the faction ",V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking exp ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength exp ",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense exp ",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity exp ",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility exp ",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma exp",V.a.createElement("br",null))),this.isWorking=!1,t){var n="You worked for your faction "+a.name+" for a total of "+Object(K.b)(this.timeWorked)+". You earned "+H.a.formatReputation(this.workRepGained)+" rep, "+H.a.formatExp(this.workHackExpGained)+" hacking exp, "+H.a.formatExp(this.workStrExpGained)+" str exp, "+H.a.formatExp(this.workDefExpGained)+" def exp, "+H.a.formatExp(this.workDexExpGained)+" dex exp, "+H.a.formatExp(this.workAgiExpGained)+" agi exp, and "+H.a.formatExp(this.workChaExpGained)+" cha exp.";return this.resetWorkStatus(),n}this.resetWorkStatus()}function Ie(){let e=1;const t=u.a[this.companyName];B.a[11]>0&&(e=1+t.favor/100);const a=this.jobs[this.companyName],n=p.a[a];return null==n?(console.error(`Could not find CompanyPosition object for ${a}. Work salary will be 0`),0):n.baseSalary*t.salaryMultiplier*this.work_money_mult*s.a.CompanyWorkMoney*e}function je(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work hack exp gain will be 0"].join(" ")),0):a.hackingExpGain*e.expMultiplier*this.hacking_exp_mult*s.a.CompanyWorkExpGain}function Fe(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work str exp gain will be 0"].join(" ")),0):a.strengthExpGain*e.expMultiplier*this.strength_exp_mult*s.a.CompanyWorkExpGain}function De(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work def exp gain will be 0"].join(" ")),0):a.defenseExpGain*e.expMultiplier*this.defense_exp_mult*s.a.CompanyWorkExpGain}function Be(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work dex exp gain will be 0"].join(" ")),0):a.dexterityExpGain*e.expMultiplier*this.dexterity_exp_mult*s.a.CompanyWorkExpGain}function Le(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work agi exp gain will be 0"].join(" ")),0):a.agilityExpGain*e.expMultiplier*this.agility_exp_mult*s.a.CompanyWorkExpGain}function Ge(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];return null==e||null==a?(console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work cha exp gain will be 0"].join(" ")),0):a.charismaExpGain*e.expMultiplier*this.charisma_exp_mult*s.a.CompanyWorkExpGain}function We(){const e=u.a[this.companyName],t=this.jobs[this.companyName],a=p.a[t];if(null==e||null==a)return console.error(["Could not find Company object for "+this.companyName,`or CompanyPosition object for ${t}.`,"Work rep gain will be 0"].join(" ")),0;var n=a.calculateJobPerformance(this.hacking_skill,this.strength,this.defense,this.dexterity,this.agility,this.charisma);n+=this.intelligence/f.a.MaxSkillLevel;var r=1+e.favor/100;return isNaN(r)&&(r=1),n*this.company_rep_mult*r}function He(e,t,a,n){this.resetWorkStatus(),this.isWorking=!0,this.focus=!0,this.workType=f.a.WorkTypeCreateProgram,this.createProgramReqLvl=n,this.timeNeededToCompleteWork=a;for(var r=0;r=100)break;this.timeWorkedCreateProgram=s/100*this.timeNeededToCompleteWork,this.getHomeComputer().programs.splice(r,1)}}this.createProgramName=t,e.toWork()}function Ue(e){var t=this.createProgramReqLvl,a=this.hacking_skill/t*this.getIntelligenceBonus(3);return a=1+(a-1)/5,this.timeWorked+=f.a._idleSpeed*e,this.timeWorkedCreateProgram+=f.a._idleSpeed*e*a,this.timeWorkedCreateProgram>=this.timeNeededToCompleteWork&&(this.finishCreateProgramWork(!1),!0)}function qe(e){var t=this.createProgramName;if(!1===e)Object(q.a)("You've finished creating "+t+"!
The new program can be found on your home computer."),this.getHomeComputer().programs.push(t);else{var a=t+"-"+(Math.floor(this.timeWorkedCreateProgram/this.timeNeededToCompleteWork*1e4)/100).toString()+"%-INC";this.getHomeComputer().programs.push(a)}e||this.gainIntelligenceExp(this.createProgramReqLvl/f.a.IntelligenceProgramBaseExpGain),this.isWorking=!1,this.resetWorkStatus()}function Ke(e,t,a,n){this.resetWorkStatus(),this.isWorking=!0,this.focus=!0,this.workType=f.a.WorkTypeStudyClass,this.className=n;const r=1e3/f.a._idleSpeed;var i=0,o=0,l=0,c=0,u=0,m=0,h=0;const p=this.hashManager;switch(n){case f.a.ClassStudyComputerScience:o=f.a.ClassStudyComputerScienceBaseExp*a/r*p.getStudyMult();break;case f.a.ClassDataStructures:i=f.a.ClassDataStructuresBaseCost*t/r,o=f.a.ClassDataStructuresBaseExp*a/r*p.getStudyMult();break;case f.a.ClassNetworks:i=f.a.ClassNetworksBaseCost*t/r,o=f.a.ClassNetworksBaseExp*a/r*p.getStudyMult();break;case f.a.ClassAlgorithms:i=f.a.ClassAlgorithmsBaseCost*t/r,o=f.a.ClassAlgorithmsBaseExp*a/r*p.getStudyMult();break;case f.a.ClassManagement:i=f.a.ClassManagementBaseCost*t/r,h=f.a.ClassManagementBaseExp*a/r*p.getStudyMult();break;case f.a.ClassLeadership:i=f.a.ClassLeadershipBaseCost*t/r,h=f.a.ClassLeadershipBaseExp*a/r*p.getStudyMult();break;case f.a.ClassGymStrength:i=f.a.ClassGymBaseCost*t/r,l=a/r*p.getTrainingMult();break;case f.a.ClassGymDefense:i=f.a.ClassGymBaseCost*t/r,c=a/r*p.getTrainingMult();break;case f.a.ClassGymDexterity:i=f.a.ClassGymBaseCost*t/r,u=a/r*p.getTrainingMult();break;case f.a.ClassGymAgility:i=f.a.ClassGymBaseCost*t/r,m=a/r*p.getTrainingMult();break;default:throw new Error("ERR: Invalid/unrecognized class name")}this.workMoneyLossRate=i,this.workHackExpGainRate=o*this.hacking_exp_mult*s.a.ClassGymExpGain,this.workStrExpGainRate=l*this.strength_exp_mult*s.a.ClassGymExpGain,this.workDefExpGainRate=c*this.defense_exp_mult*s.a.ClassGymExpGain,this.workDexExpGainRate=u*this.dexterity_exp_mult*s.a.ClassGymExpGain,this.workAgiExpGainRate=m*this.agility_exp_mult*s.a.ClassGymExpGain,this.workChaExpGainRate=h*this.charisma_exp_mult*s.a.ClassGymExpGain,e.toWork()}function $e(e){return this.timeWorked+=f.a._idleSpeed*e,this.processWorkEarnings(e),!1}function ze(e=!1){if(this.gainIntelligenceExp(f.a.IntelligenceClassBaseExpGain*Math.round(this.timeWorked/1e3)),this.workMoneyGained>0)throw new Error("ERR: Somehow gained money while taking class");if(this.updateSkillLevels(),e||Object(q.a)(V.a.createElement(V.a.Fragment,null,"After ",this.className," for ",Object(K.b)(this.timeWorked),", ",V.a.createElement("br",null),"you spent a total of ",V.a.createElement(z.a,{money:-this.workMoneyGained}),". ",V.a.createElement("br",null),V.a.createElement("br",null),"You earned a total of: ",V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking exp ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength exp ",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense exp ",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity exp ",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility exp ",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma exp",V.a.createElement("br",null))),this.isWorking=!1,e){var t="After "+this.className+" for "+Object(K.b)(this.timeWorked)+", you spent a total of "+H.a.formatMoney(-1*this.workMoneyGained)+". You earned a total of: "+H.a.formatExp(this.workHackExpGained)+" hacking exp, "+H.a.formatExp(this.workStrExpGained)+" strength exp, "+H.a.formatExp(this.workDefExpGained)+" defense exp, "+H.a.formatExp(this.workDexExpGained)+" dexterity exp, "+H.a.formatExp(this.workAgiExpGained)+" agility exp, and "+H.a.formatExp(this.workChaExpGained)+" charisma exp";return this.resetWorkStatus(),t}this.resetWorkStatus()}function Ye(e,t,a,n,r,i,o,l,c,u,m=null){this.crimeType=t,this.resetWorkStatus(),this.isWorking=!0,this.focus=!0,this.workType=f.a.WorkTypeCrime,m&&m.workerscript&&(this.committingCrimeThruSingFn=!0,this.singFnCrimeWorkerScript=m.workerscript),this.workHackExpGained=a*this.hacking_exp_mult*s.a.CrimeExpGain,this.workStrExpGained=n*this.strength_exp_mult*s.a.CrimeExpGain,this.workDefExpGained=r*this.defense_exp_mult*s.a.CrimeExpGain,this.workDexExpGained=i*this.dexterity_exp_mult*s.a.CrimeExpGain,this.workAgiExpGained=o*this.agility_exp_mult*s.a.CrimeExpGain,this.workChaExpGained=l*this.charisma_exp_mult*s.a.CrimeExpGain,this.workMoneyGained=c*this.crime_money_mult*s.a.CrimeMoney,this.timeNeededToCompleteWork=u,e.toWork()}function Ve(e){return this.timeWorked+=f.a._idleSpeed*e,this.timeWorked>=this.timeNeededToCompleteWork&&(this.finishCrime(!1),!0)}function Je(e){if(!e){if(Object(y.a)(this,this.crimeType)){let e=null;for(const t in b.a)if(b.a[t].type==this.crimeType){e=b.a[t];break}null==e&&Object(q.a)(`ERR: Unrecognized crime type (${this.crimeType}). This is probably a bug please contact the developer`),this.gainMoney(this.workMoneyGained),this.recordMoneySource(this.workMoneyGained,"crime"),this.karma-=e.karma,this.numPeopleKilled+=e.kills,e.intelligence_exp>0&&this.gainIntelligenceExp(e.intelligence_exp),this.workHackExpGained*=2,this.workStrExpGained*=2,this.workDefExpGained*=2,this.workDexExpGained*=2,this.workAgiExpGained*=2,this.workChaExpGained*=2,this.committingCrimeThruSingFn?null==this.singFnCrimeWorkerScript.disableLogs.ALL&&null==this.singFnCrimeWorkerScript.disableLogs.commitCrime&&this.singFnCrimeWorkerScript.scriptRef.log("Crime successful! Gained "+H.a.formatMoney(this.workMoneyGained)+", "+H.a.formatExp(this.workHackExpGained)+" hack exp, "+H.a.formatExp(this.workStrExpGained)+" str exp, "+H.a.formatExp(this.workDefExpGained)+" def exp, "+H.a.formatExp(this.workDexExpGained)+" dex exp, "+H.a.formatExp(this.workAgiExpGained)+" agi exp, "+H.a.formatExp(this.workChaExpGained)+" cha exp."):Object(q.a)(V.a.createElement(V.a.Fragment,null,"Crime successful!",V.a.createElement("br",null),V.a.createElement("br",null),"You gained:",V.a.createElement("br",null),V.a.createElement(z.a,{money:this.workMoneyGained}),V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking experience ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength experience",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense experience",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity experience",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility experience",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma experience"))}else this.workHackExpGained/=2,this.workStrExpGained/=2,this.workDefExpGained/=2,this.workDexExpGained/=2,this.workAgiExpGained/=2,this.workChaExpGained/=2,this.committingCrimeThruSingFn?null==this.singFnCrimeWorkerScript.disableLogs.ALL&&null==this.singFnCrimeWorkerScript.disableLogs.commitCrime&&this.singFnCrimeWorkerScript.scriptRef.log("Crime failed! Gained "+H.a.formatExp(this.workHackExpGained)+" hack exp, "+H.a.formatExp(this.workStrExpGained)+" str exp, "+H.a.formatExp(this.workDefExpGained)+" def exp, "+H.a.formatExp(this.workDexExpGained)+" dex exp, "+H.a.formatExp(this.workAgiExpGained)+" agi exp, "+H.a.formatExp(this.workChaExpGained)+" cha exp."):Object(q.a)(V.a.createElement(V.a.Fragment,null,"Crime failed!",V.a.createElement("br",null),V.a.createElement("br",null),"You gained:",V.a.createElement("br",null),H.a.formatExp(this.workHackExpGained)," hacking experience ",V.a.createElement("br",null),H.a.formatExp(this.workStrExpGained)," strength experience",V.a.createElement("br",null),H.a.formatExp(this.workDefExpGained)," defense experience",V.a.createElement("br",null),H.a.formatExp(this.workDexExpGained)," dexterity experience",V.a.createElement("br",null),H.a.formatExp(this.workAgiExpGained)," agility experience",V.a.createElement("br",null),H.a.formatExp(this.workChaExpGained)," charisma experience"));this.gainHackingExp(this.workHackExpGained),this.gainStrengthExp(this.workStrExpGained),this.gainDefenseExp(this.workDefExpGained),this.gainDexterityExp(this.workDexExpGained),this.gainAgilityExp(this.workAgiExpGained),this.gainCharismaExp(this.workChaExpGained)}this.committingCrimeThruSingFn=!1,this.singFnCrimeWorkerScript=null,this.isWorking=!1,this.crimeType="",this.resetWorkStatus()}function Qe(){if(!this.isWorking)return"";var e;switch(this.workType){case f.a.WorkTypeStudyClass:e=this.finishClass(!0);break;case f.a.WorkTypeCompany:e=this.finishWork(!0,!0);break;case f.a.WorkTypeCompanyPartTime:e=this.finishWorkPartTime(!0);break;case f.a.WorkTypeFaction:e=this.finishFactionWork(!0,!0);break;case f.a.WorkTypeCreateProgram:e=this.finishCreateProgramWork(!0);break;case f.a.WorkTypeCrime:e=this.finishCrime(!0);break;default:return console.error(`Unrecognized work type (${this.workType})`),""}return e}function Xe(e){if("number"==typeof e)return this.hp-=e,this.hp<=0&&(this.hospitalize(),!0);console.warn("Player.takeDamage() called without a numeric argument: "+e)}function Ze(e){"number"==typeof e?(this.hp+=e,this.hp>this.max_hp&&(this.hp=this.max_hp)):console.warn("Player.regenerateHp() called without a numeric argument: "+e)}function et(){const e=Object(G.b)(this);return!1===N.a.SuppressHospitalizationPopup&&Object(q.a)(V.a.createElement(V.a.Fragment,null,"You were in critical condition! You were taken to the hospital where luckily they were able to save your life. You were charged ",V.a.createElement(z.a,{money:e}))),this.loseMoney(e),this.recordMoneySource(-1*e,"hospitalization"),this.hp=this.max_hp,e}function tt(e,t=!1){let a=null;""!==this.companyName&&(a=u.a[this.companyName]);const n=this.jobs[this.companyName],r=u.a[this.location];if(!(r instanceof c.a))return t?"ERROR: Invalid company name: "+this.location+". applyToCompany() failed":void console.error(`Could not find company that matches the location: ${this.location}. Player.applyToCompany() failed`);let i=e;if(!this.isQualified(r,i)){var o=Object(h.a)(r,i);return!t&&void Object(q.a)("Unforunately, you do not qualify for this position
"+o)}for(;;){let e=Object(m.a)(i);if(null==e)break;if(!r.hasPosition(e))break;if(!this.isQualified(r,e))break;i=e}if(null==a||a.name!=r.name||i.name!=n){if(this.jobs[r.name]=i.name,this.companyName=this.location,t)return!0;Object(q.a)("Congratulations! You were offered a new job at "+this.companyName+" as a "+i.name+"!")}else{var s=Object(m.a)(i);if(null==s){if(t)return!1;Object(q.a)("You are already at the highest position for your field! No promotion available")}else if(r.hasPosition(s)){if(t)return!1;o=Object(h.a)(r,s);Object(q.a)("Unfortunately, you do not qualify for a promotion
"+o)}else{if(t)return!1;Object(q.a)("You are already at the highest position for your field! No promotion available")}}}function at(e,t){var a=null;if(""!==this.companyName&&(a=u.a[this.companyName]),null==a||a.name!=e.name)return t;const n=this.jobs[this.companyName],r=p.a[n];return r.isSoftwareJob()&&t.isSoftwareJob()||r.isITJob()&&t.isITJob()||r.isBusinessJob()&&t.isBusinessJob()||r.isSecurityEngineerJob()&&t.isSecurityEngineerJob()||r.isNetworkEngineerJob()&&t.isNetworkEngineerJob()||r.isSecurityJob()&&t.isSecurityJob()||r.isAgentJob()&&t.isAgentJob()||r.isSoftwareConsultantJob()&&t.isSoftwareConsultantJob()||r.isBusinessConsultantJob()&&t.isBusinessConsultantJob()||r.isPartTimeJob()&&t.isPartTimeJob()?Object(m.a)(r):t}function nt(e){this.isWorking=!1,this.companyName="",delete this.jobs[e]}function rt(e=!1){return this.applyForJob(p.a[d.j[0]],e)}function it(e=!1){return this.applyForJob(p.a[d.k[0]],e)}function ot(e=!1){return this.applyForJob(p.a[d.d[0]],e)}function st(e=!1){var t=u.a[this.location];return this.isQualified(t,p.a[d.i[0]])?this.applyForJob(p.a[d.i[0]],e):!e&&void Object(q.a)("Unforunately, you do not qualify for this position")}function lt(e=!1){var t=u.a[this.location];return this.isQualified(t,p.a[d.f[0]])?this.applyForJob(p.a[d.f[0]],e):!e&&void Object(q.a)("Unforunately, you do not qualify for this position")}function ct(e=!1){return this.applyForJob(p.a[d.b[0]],e)}function ut(e=!1){return this.applyForJob(p.a[d.c[0]],e)}function mt(e=!1){return this.applyForJob(p.a[d.h[2]],e)}function ht(e=!1){var t=u.a[this.location];return this.isQualified(t,p.a[d.a[0]])?this.applyForJob(p.a[d.a[0]],e):!e&&void Object(q.a)("Unforunately, you do not qualify for this position")}function pt(e=!1){var t=u.a[this.location];if(this.isQualified(t,p.a[d.e[1]])){if(this.companyName=t.name,this.jobs[t.name]=d.e[1],e)return!0;Object(q.a)("Congratulations, you are now employed at "+this.companyName)}else{if(e)return!1;Object(q.a)("Unforunately, you do not qualify for this position")}}function dt(e=!1){var t=u.a[this.location];if(this.isQualified(t,p.a[d.g[1]])){if(this.jobs[t.name]=d.g[1],e)return!0;Object(q.a)("Congratulations, you are now employed part-time at "+this.companyName)}else{if(e)return!1;Object(q.a)("Unforunately, you do not qualify for this position")}}function ft(e=!1){var t=u.a[this.location];if(this.isQualified(t,p.a[d.e[0]])){if(this.companyName=t.name,this.jobs[t.name]=d.e[0],e)return!0;Object(q.a)("Congratulations, you are now employed as a waiter at "+this.companyName)}else{if(e)return!1;Object(q.a)("Unforunately, you do not qualify for this position")}}function gt(e=!1){var t=u.a[this.location];if(this.isQualified(t,p.a[d.g[0]])){if(this.companyName=t.name,this.jobs[t.name]=d.g[0],e)return!0;Object(q.a)("Congratulations, you are now employed as a part-time waiter at "+this.companyName)}else{if(e)return!1;Object(q.a)("Unforunately, you do not qualify for this position")}}function yt(e,t){var a=e.jobStatReqOffset,n=t.requiredHacking>0?t.requiredHacking+a:0,r=t.requiredStrength>0?t.requiredStrength+a:0,i=t.requiredDefense>0?t.requiredDefense+a:0,o=t.requiredDexterity>0?t.requiredDexterity+a:0,s=t.requiredDexterity>0?t.requiredDexterity+a:0,l=t.requiredCharisma>0?t.requiredCharisma+a:0;return this.hacking_skill>=n&&this.strength>=r&&this.defense>=i&&this.dexterity>=o&&this.agility>=s&&this.charisma>=l&&e.playerReputation>=t.requiredReputation}function bt(e=!0){e&&this.resetMultipliers();for(let e=0;et}var i=v.a.Illuminati;!i.isBanned&&!i.isMember&&!i.alreadyInvited&&t>=30&&this.money.gte(15e10)&&this.hacking_skill>=1500&&this.strength>=1200&&this.defense>=1200&&this.dexterity>=1200&&this.agility>=1200&&e.push(i);var o=v.a.Daedalus;!o.isBanned&&!o.isMember&&!o.alreadyInvited&&t>=Math.round(30*s.a.DaedalusAugsRequirement)&&this.money.gte(1e11)&&(this.hacking_skill>=2500||this.strength>=1500&&this.defense>=1500&&this.dexterity>=1500&&this.agility>=1500)&&e.push(o);var l=v.a["The Covenant"];!l.isBanned&&!l.isMember&&!l.alreadyInvited&&t>=20&&this.money.gte(75e9)&&this.hacking_skill>=850&&this.strength>=850&&this.defense>=850&&this.dexterity>=850&&this.agility>=850&&e.push(l);var c=v.a.ECorp;c.isBanned||c.isMember||c.alreadyInvited||!r(x.a.AevumECorp)||e.push(c);var m=v.a.MegaCorp;m.isBanned||m.isMember||m.alreadyInvited||!r(x.a.Sector12MegaCorp)||e.push(m);var h=v.a["Bachman & Associates"];h.isBanned||h.isMember||h.alreadyInvited||!r(x.a.AevumBachmanAndAssociates)||e.push(h);var p=v.a["Blade Industries"];p.isBanned||p.isMember||p.alreadyInvited||!r(x.a.Sector12BladeIndustries)||e.push(p);var d=v.a.NWO;d.isBanned||d.isMember||d.alreadyInvited||!r(x.a.VolhavenNWO)||e.push(d);var g=v.a["Clarke Incorporated"];g.isBanned||g.isMember||g.alreadyInvited||!r(x.a.AevumClarkeIncorporated)||e.push(g);var y=v.a["OmniTek Incorporated"];y.isBanned||y.isMember||y.alreadyInvited||!r(x.a.VolhavenOmniTekIncorporated)||e.push(y);var b=v.a["Four Sigma"];b.isBanned||b.isMember||b.alreadyInvited||!r(x.a.Sector12FourSigma)||e.push(b);var E=v.a["KuaiGong International"];E.isBanned||E.isMember||E.alreadyInvited||!r(x.a.ChongqingKuaiGongInternational)||e.push(E);var k=v.a["Fulcrum Secret Technologies"],w=R.b[I.a[I.b.FulcrumSecretTechnologies]];null==w?console.error("Could not find Fulcrum Secret Technologies Server"):k.isBanned||k.isMember||k.alreadyInvited||!w.backdoorInstalled||!r(x.a.AevumFulcrumTechnologies,25e4)||e.push(k);var C=v.a.BitRunners,O=R.b[I.a[I.b.BitRunnersServer]];null==O?console.error("Could not find BitRunners Server"):C.isBanned||C.isMember||!O.backdoorInstalled||C.alreadyInvited||e.push(C);var T=v.a["The Black Hand"],M=R.b[I.a[I.b.TheBlackHandServer]];null==M?console.error("Could not find The Black Hand Server"):T.isBanned||T.isMember||!M.backdoorInstalled||T.alreadyInvited||e.push(T);var P=v.a.NiteSec,A=R.b[I.a[I.b.NiteSecServer]];null==A?console.error("Could not find NiteSec Server"):P.isBanned||P.isMember||!A.backdoorInstalled||P.alreadyInvited||e.push(P);var N=v.a.Chongqing;N.isBanned||N.isMember||N.alreadyInvited||!this.money.gte(2e7)||this.city!=S.a.Chongqing||e.push(N);var j=v.a["Sector-12"];j.isBanned||j.isMember||j.alreadyInvited||!this.money.gte(15e6)||this.city!=S.a.Sector12||e.push(j);var F=v.a["New Tokyo"];F.isBanned||F.isMember||F.alreadyInvited||!this.money.gte(2e7)||this.city!=S.a.NewTokyo||e.push(F);var D=v.a.Aevum;D.isBanned||D.isMember||D.alreadyInvited||!this.money.gte(4e7)||this.city!=S.a.Aevum||e.push(D);var B=v.a.Ishima;B.isBanned||B.isMember||B.alreadyInvited||!this.money.gte(3e7)||this.city!=S.a.Ishima||e.push(B);var L=v.a.Volhaven;L.isBanned||L.isMember||L.alreadyInvited||!this.money.gte(5e7)||this.city!=S.a.Volhaven||e.push(L);var G=v.a["Speakers for the Dead"];!G.isBanned&&!G.isMember&&!G.alreadyInvited&&this.hacking_skill>=100&&this.strength>=300&&this.defense>=300&&this.dexterity>=300&&this.agility>=300&&this.numPeopleKilled>=30&&this.karma<=-45&&!a.includes(x.a.Sector12CIA)&&!a.includes(x.a.Sector12NSA)&&e.push(G);var W=v.a["The Dark Army"];!W.isBanned&&!W.isMember&&!W.alreadyInvited&&this.hacking_skill>=300&&this.strength>=300&&this.defense>=300&&this.dexterity>=300&&this.agility>=300&&this.city==S.a.Chongqing&&this.numPeopleKilled>=5&&this.karma<=-45&&!a.includes(x.a.Sector12CIA)&&!a.includes(x.a.Sector12NSA)&&e.push(W);var H=v.a["The Syndicate"];!H.isBanned&&!H.isMember&&!H.alreadyInvited&&this.hacking_skill>=200&&this.strength>=200&&this.defense>=200&&this.dexterity>=200&&this.agility>=200&&(this.city==S.a.Aevum||this.city==S.a.Sector12)&&this.money.gte(1e7)&&this.karma<=-90&&!a.includes(x.a.Sector12CIA)&&!a.includes(x.a.Sector12NSA)&&e.push(H);var U=v.a.Silhouette;!U.isBanned&&!U.isMember&&!U.alreadyInvited&&(n.includes("Chief Technology Officer")||n.includes("Chief Financial Officer")||n.includes("Chief Executive Officer"))&&this.money.gte(15e6)&&this.karma<=-22&&e.push(U);var q=v.a.Tetrads;!q.isBanned&&!q.isMember&&!q.alreadyInvited&&(this.city==S.a.Chongqing||this.city==S.a.NewTokyo||this.city==S.a.Ishima)&&this.strength>=75&&this.defense>=75&&this.dexterity>=75&&this.agility>=75&&this.karma<=-18&&e.push(q);var K=v.a["Slum Snakes"];!K.isBanned&&!K.isMember&&!K.alreadyInvited&&this.strength>=30&&this.defense>=30&&this.dexterity>=30&&this.agility>=30&&this.karma<=-9&&this.money.gte(1e6)&&e.push(K);var $=v.a.Netburners,z=0,Y=0,V=0;for(let e=0;e=80&&z>=8&&Y>=4&&V>=100&&e.push($);var J=v.a["Tian Di Hui"];J.isBanned||J.isMember||J.alreadyInvited||!this.money.gte(1e6)||!(this.hacking_skill>=50)||this.city!=S.a.Chongqing&&this.city!=S.a.NewTokyo&&this.city!=S.a.Ishima||e.push(J);var Q=v.a.CyberSec,X=R.b[I.a[I.b.CyberSecServer]];return null==X?console.error("Could not find CyberSec Server"):Q.isBanned||Q.isMember||!X.backdoorInstalled||Q.alreadyInvited||e.push(Q),e}function kt(e){this.bitNodeN=e}function _t(e){for(const t in this.queuedAugmentations)if(this.queuedAugmentations[t].name==e)return void console.warn(`tried to queue ${e} twice, this may be a bug`);for(const t in this.augmentations)if(this.augmentations[t].name==e)return void console.warn(`tried to queue ${e} twice, this may be a bug`);this.firstAugPurchased=!0,this.queuedAugmentations.push(new i.a(e))}function wt(e,t=1){if(null==e||null==e.type||null==e)return"No reward for this contract";switch(e.type){case l.c.FactionReputation:if(null==e.name||!(v.a[e.name]instanceof E.a))return e.type=l.c.FactionReputationAll,this.gainCodingContractReward(e);var a=f.a.CodingContractBaseFactionRepGain*t;return v.a[e.name].playerReputation+=a,`Gained ${a} faction reputation for ${e.name}`;case l.c.FactionReputationAll:const i=f.a.CodingContractBaseFactionRepGain*t,o=["Bladeburners"];var n=this.factions.slice();if(0==(n=n.filter(e=>!o.includes(e))).length)return e.type=l.c.Money,this.gainCodingContractReward(e,t);const m=Math.floor(i/n.length);for(const e of n)v.a[e]instanceof E.a&&(v.a[e].playerReputation+=m);return`Gained ${m} reputation for each of the following factions: ${n.toString()}`;case l.c.CompanyReputation:if(null==e.name||!(u.a[e.name]instanceof c.a))return e.type=l.c.FactionReputationAll,this.gainCodingContractReward(e);a=f.a.CodingContractBaseCompanyRepGain*t;return u.a[e.name].playerReputation+=a,`Gained ${a} company reputation for ${e.name}`;case l.c.Money:default:var r=f.a.CodingContractBaseMoneyGain*t*s.a.CodingContractMoney;return this.gainMoney(r),this.recordMoneySource(r,"codingcontract"),"Gained "+H.a.formatMoney(r)}}function Ct(e){return null==w.a[e]?(console.warn("Player.travel() called with invalid city: "+e),!1):(this.city=e,!0)}function St(e){return null==C.a[e]?(console.warn("Player.gotoLocation() called with invalid location: "+e),!1):(this.location=e,!0)}function xt(){return 10===this.bitNodeN||B.a[10]>0}function Ot(e){this.exploits.includes(e)||this.exploits.push(e)}function Tt(e){return Object(M.a)(this.intelligence,e)}function Mt(){return this.moneySourceA.casino}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(300),r=a(1);function i(e){const t="SourceFile"+e.n,a=n.a[t];if(null!=a){switch(e.n){case 1:{let t=0;for(let a=0;aa.hacking_skill?e.error("Your hacking skill is not high enough to use backdoor on this machine. Try analyzing the machine to determine the required hacking skill"):s instanceof r.a?e.error("Cannot use backdoor on this type of Server"):e.startBackdoor(a):e.error("You do not have admin rights for this machine! Cannot backdoor")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(423),r=a(55);function i(e,t,a,i,o){if(!r.a.hasOwnProperty("Darkweb Server"))return void e.error("You need to be able to connect to the Dark Web to use the buy command. (Maybe there's a TOR router you can buy somewhere)");if(1!=o.length)return e.print("Incorrect number of arguments. Usage: "),e.print("buy -l"),void e.print("buy [item name]");const s=o[0]+"";"-l"==s||"-1"==s||"--list"==s?Object(n.c)():Object(n.a)(s)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(212),r=a(106),i=a(473);function o(e,t,a,o,s){if(1!==s.length)return void e.error("Incorrect usage of cat command. Usage: cat [file]");const l=e.getFilepath(s[0]+"");if(l.endsWith(".msg")||l.endsWith(".lit")||l.endsWith(".txt")){if(l.endsWith(".msg")||l.endsWith(".lit"))for(let e=0;e1)e.error("Incorrect number of arguments. Usage: cd [dir]");else{let t=1===i.length?i[0]+"":"/",r="";if("/"===t)r="/";else{if(t=Object(n.i)(t),r=Object(n.a)(t,e.cwd()),null===r||""===r)return void e.error("Invalid path. Failed to change directories");const i=a.getCurrentServer();if(!i.scripts.some(e=>e.filename.startsWith(r+""))&&!i.textFiles.some(e=>e.fn.startsWith(r+"")))return void e.error("Invalid path. Failed to change directories")}e.setcwd(r)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(209),r=a(89);function i(e,t,a,i,o){if(o.length<1)e.error("Incorrect number of arguments. Usage: check [script] [arg1] [arg2]...");else{const t=e.getFilepath(o[0]+"");if(!Object(r.a)(t))return void e.error("tail can only be called on .script files (filename must end with .script)");const a=Object(n.a)(t,o.slice(1),i);if(null==a)return void e.error("No such script exists");a.displayLog()}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(38);function r(e,t,a,r,i){if(1!==i.length)return void e.error("Incorrect usage of connect command. Usage: connect [ip/hostname]");const o=i[0]+"";for(let t=0;ti.a.saveAs(e,a))}if(Object(n.a)(t)){const n=e.getScript(a,t);if(null!=n)return n.download()}else{if(!t.endsWith(".txt"))return void e.error("Cannot download this filetype");{const n=e.getTextFile(a,t);if(null!=n)return n.download()}}return void e.error(t+" does not exist")}catch(t){return void e.error(t+"")}}},,,function(module,__webpack_exports__,__webpack_require__){"use strict";function expr(terminal,router,player,server,args){if(0===args.length)return void terminal.error("Incorrect usage of expr command. Usage: expr [math expression]");const expr=args.join(""),sanitizedExpr=expr.replace(/s+/g,"").replace(/[^-()\d/*+.]/g,"");let result;try{result=eval(sanitizedExpr)}catch(e){return void terminal.error("Could not evaluate expression: "+sanitizedExpr)}terminal.print(result)}__webpack_require__.d(__webpack_exports__,"a",(function(){return expr}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(3);function r(e,t,a,r,i){if(0!==i.length)return void e.error("Incorrect usage of free command. Usage: free");const o=n.a.formatRAM(a.getCurrentServer().maxRam),s=n.a.formatRAM(a.getCurrentServer().ramUsed),l=n.a.formatRAM(a.getCurrentServer().maxRam-a.getCurrentServer().ramUsed),c=Math.max(o.length,Math.max(s.length,l.length)),u=n.a.formatPercentage(a.getCurrentServer().ramUsed/a.getCurrentServer().maxRam);e.print(`Total: ${" ".repeat(c-o.length)}${o}`),e.print(`Used: ${" ".repeat(c-s.length)}${s} (${u})`),e.print(`Available: ${" ".repeat(c-l.length)}${l}`)}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(101);function r(e,t,a,r,i){if(0!==i.length)return void e.error("Incorrect usage of hack command. Usage: hack");r instanceof n.a||e.error("Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers");const o=r;o.purchasedByPlayer?e.error("Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers"):o.hasAdminRights?o.requiredHackingSkill>a.hacking_skill?e.error("Your hacking skill is not high enough to attempt hacking this machine. Try analyzing the machine to determine the required hacking skill"):e.startHack(a):e.error("You do not have admin rights for this machine! Cannot hack")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(631);function r(e,t,a,r,i){if(0===i.length||1===i.length)if(0===i.length)n.b.forEach(t=>e.print(t));else{const t=i[0],a=n.a[t];if(null==a)return void e.error("No help topics match '"+t+"'");a.forEach(t=>e.print(t))}else e.error("Incorrect usage of help command. Usage: help")}},function(e,t,a){"use strict";function n(e,t,a,n,r){0===r.length?(a.getCurrentServer().isConnectedTo=!1,a.currentServer=a.getHomeComputer().ip,a.getCurrentServer().isConnectedTo=!0,e.print("Connected to home"),e.setcwd("/")):e.error("Incorrect usage of home command. Usage: home")}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";function n(e,t,a,n,r){0===r.length?e.print(a.getCurrentServer().hostname):e.error("Incorrect usage of hostname command. Usage: hostname")}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";function n(e,t,a,n,r){0===r.length?e.print(a.getCurrentServer().ip):e.error("Incorrect usage of ifconfig command. Usage: ifconfig")}a.d(t,"a",(function(){return n}))},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(113);function r(e,t,a,r,i){try{if(i.length<1)return void e.error("Incorrect usage of kill command. Usage: kill [scriptname] [arg1] [arg2]...");if("number"==typeof i[0]){const t=i[0];return void(Object(n.a)(t)?e.print("Killing script with PID "+t):e.print(`Failed to kill script with PID ${t}. No such script exists`))}const t=e.getFilepath(i[0]),a=r.getRunningScript(t,i.slice(1));if(null==a)return void e.error("No such script is running. Nothing to kill");Object(n.a)(a,r.ip,!1),e.print("Killing "+t)}catch(t){e.error(t+"")}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(113),r=a(238);function i(e,t,a,i){for(let e=i.runningScripts.length-1;e>=0;--e)Object(n.a)(i.runningScripts[e],i.ip,!1);r.a.emit(),e.print("Killing all running scripts")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(106),r=a(98);function i(e,t,a,i,o){const s=o.length;function l(){e.error("Incorrect usage of ls command. Usage: ls [dir] [| grep pattern]")}if(s>5||3===s)return l();let c="",u=e.cwd();if(u.endsWith("/")||(u+="/"),s>=4){if("grep"!==o[s-1]||"|"!==o[s-2])return l();c=o[s]+""}if(s>=1&&"|"!==o[0]){const t=Object(r.a)(o[0]+"",e.cwd());if(u=t||"",null!=u&&(u.endsWith("/")||(u+="/"),!Object(r.f)(u)))return l()}"/"===u&&(u="");const m=[],h=[],p=[],d=[],f=[],g=[];function y(e,t){let a=e;if(u){if(!e.startsWith(u))return;a=e.slice(u.length,e.length)}if(!c||a.includes(c))if(a.includes("/")){const e=Object(r.d)(a);if(c&&!e.includes(c))return;g.includes(e)||g.push(e)}else t.push(a)}const b=a.getCurrentServer();for(const e of b.programs)y(e,m);for(const e of b.scripts)y(e.filename,h);for(const e of b.textFiles)y(e.fn,p);for(const e of b.contracts)y(e.fn,d);for(const e of b.messages)e instanceof n.a?y(e.filename,f):y(e,f);function E(t){const a=Math.max(...t.map(e=>e.length))+1,n=Math.floor(80/a);for(let r=0;re.segments.length>0);for(let t=0;t0?p:1,g=h._;if(null==Object(o.a)(u,g,l)){for(let t=0;ts)return void e.print("This machine does not have enough RAM to run this script with "+f+" threads. Script requires "+o+"GB of RAM");const c=new i.a(a,g);c.threads=f;return Object(r.e)(c,l)?(e.print(`Running script with ${f} thread(s), pid ${c.pid} and args: ${JSON.stringify(g)}.`),void(d&&Object(n.a)(c))):void e.error("Failed to start script")}e.print("ERROR: No such script")}else e.print("ERROR: This script is already running. Cannot run multiple instances")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(58);function r(e,t,a,r,i){if(i.length<1)return;const o=i[0]+"";if(a.hasProgram(o)){if(!(i.length<1)){for(const s of Object.values(n.a))if(s.name===o)return void s.run(t,e,a,r,i.slice(1).map(e=>e+""));e.print("Invalid executable. Cannot be run")}}else e.error("No such executable on home computer (Only programs that exist on your home computer can be run)")}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(38);function r(e,t,a,r,i){if(0!==i.length)return void e.error("Incorrect usage of netstat/scan command. Usage: netstat/scan");const o=a.getCurrentServer(),s=o.serversOnNetwork.map((e,t)=>{const a=Object(n.c)(o,t);if(null===a)throw new Error("Server should not be null");return{hostname:a.hostname,ip:a.ip,hasRoot:a.hasAdminRights?"Y":"N"}});s.unshift({hostname:"Hostname",ip:"IP",hasRoot:"Root Access"});const l=Math.max(...s.map(e=>e.hostname.length)),c=Math.max(...s.map(e=>e.ip.length));for(const t of s){if(!t)continue;let a=t.hostname;a+=" ".repeat(l-t.hostname.length+1),a+=t.ip,a+=" ".repeat(c-t.ip.length+1),a+=t.hasRoot,e.print(a)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(58);function r(e,t,a,r,i){if(0===i.length)e.executeScanAnalyzeCommand(a,1);else{if(i.length>2)return void e.error("Incorrect usage of scan-analyze command. usage: scan-analyze [depth]");let t=!1;2===i.length&&"-a"===i[1]&&(t=!0);const r=parseInt(i[0]+"");if(isNaN(r)||r<0)return void e.error("Incorrect usage of scan-analyze command. depth argument must be positive numeric");if(r>3&&!a.hasProgram(n.a.DeepscanV1.name)&&!a.hasProgram(n.a.DeepscanV2.name))return void e.error("You cannot scan-analyze with that high of a depth. Maximum depth is 3");if(r>5&&!a.hasProgram(n.a.DeepscanV2.name))return void e.error("You cannot scan-analyze with that high of a depth. Maximum depth is 5");if(r>10)return void e.error("You cannot scan-analyze with that high of a depth. Maximum depth is 10");e.executeScanAnalyzeCommand(a,r,t)}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(106),r=a(38),i=a(89);function o(e,t,a,o,s){try{if(2!==s.length)return void e.error("Incorrect usage of scp command. Usage: scp [file] [destination hostname/ip]");const t=e.getFilepath(s[0]+"");if(!t.endsWith(".lit")&&!Object(i.a)(t)&&!t.endsWith(".txt"))return void e.error("scp only works for scripts, text files (.txt), and literature files (.lit)");const a=Object(r.b)(s[1]+"");if(null==a)return void e.error(`Invalid destination. ${s[1]} not found`);if(t.endsWith(".lit")){let r=!1;for(let e=0;e1){e.error("Found several potential candidates:");for(const t of r)e.error(`${t.filename} ${t.args.join(" ")}`);return void e.error("Script arguments need to be specified.")}e.error("No such script exists.")}else{const t=Object(r.b)(l[0],s);if(null==t)return void e.error("No such script exists");Object(n.a)(t)}}catch(t){e.error(t+"")}}},function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(518),r=a(3);function i(e,t,a,i,o){if(0!==o.length)return void e.error("Incorrect usage of top command. Usage: top");const s=`Script${" ".repeat(40-"Script".length)}PID${" ".repeat(10-"PID".length)}Threads${" ".repeat(16-"Threads".length)}RAM Usage`;e.print(s);const l=i.runningScripts;for(let t=0;t
\" +\n \"In this game you control a set of Nodes and use them to try and defeat an enemy. Your Nodes \" +\n \"are colored blue, while the enemy's are red. There are also other nodes on the map colored gray \" +\n \"that initially belong to neither you nor the enemy. The goal of the game is \" +\n \"to capture all of the enemy's Database nodes within the time limit. \" +\n \"If you fail to do this, you will lose.

\" +\n \"Each Node has three stats: Attack, Defense, and HP. There are five different actions that \" +\n \"a Node can take:

\" +\n \"Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the owner's Attack, the Player's \" +\n \"hacking level, and the enemy's defense.

\" +\n \"Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the \" +\n \"enemy's defense.

\" +\n \"Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the enemy's \" +\n \"defense.

\" +\n \"Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.

\" +\n \"Overflow - Raises the Node's Attack but lowers its Defense. The effectiveness is determined by your hacking level.

\" +\n \"Note that when determining the effectiveness of the above actions, the TOTAL Attack or Defense of the team is used, not just the \" +\n \"Attack/Defense of the individual Node that is performing the action.

\" +\n \"To capture a Node, you must lower its HP down to 0.

\" +\n \"There are six different types of Nodes:

\" +\n \"CPU Core - These are your main Nodes that are used to perform actions. Capable of performing every action

\" +\n \"Firewall - Nodes with high defense. These Nodes can 'Fortify'

\" +\n \"Database - A special type of Node. The player's objective is to conquer all of the enemy's Database Nodes within \" +\n \"the time limit. These Nodes cannot perform any actions

\" +\n \"Spam - Conquering one of these Nodes will slow the enemy's trace, giving the player additional time to complete \" +\n \"the mission. These Nodes cannot perform any actions

\" +\n \"Transfer - Conquering one of these nodes will increase the Attack of all of your CPU Cores by a small fixed percentage. \" +\n \"These Nodes are capable of performing every action except the 'Attack' action

\" +\n \"Shield - Nodes with high defense. These Nodes can 'Fortify'

\" +\n \"To assign an action to a Node, you must first select one of your Nodes. This can be done by simply clicking on it. Double-clicking \" +\n \"a node will select all of your Nodes of the same type (e.g. select all CPU Core Nodes or all Transfer Nodes). Note that only Nodes \" +\n \"that can perform actions (CPU Core, Transfer, Shield, Firewall) can be selected. Selected Nodes will be denoted with a white highlight. After selecting a Node or multiple Nodes, \" +\n \"select its action using the Action Buttons near the top of the screen. Every action also has a corresponding keyboard \" +\n \"shortcut.

\" +\n \"For certain actions such as attacking, scanning, and weakening, the Node performing the action must have a target. To target \" +\n \"another node, simply click-and-drag from the 'source' Node to a target. A Node can only have one target, and you can target \" +\n \"any Node that is adjacent to one of your Nodes (immediately above, below, or to the side. NOT diagonal). Furthermore, only CPU Cores and Transfer Nodes \" +\n \"can target, since they are the only ones that can perform the related actions. To remove a target, you can simply click on the line that represents \" +\n \"the connection between one of your Nodes and its target. Alternatively, you can select the 'source' Node and click the 'Drop Connection' button, \" +\n \"or press 'd'.

\" +\n \"Other Notes:

\" +\n \"-Whenever a miscellenaous Node (not owned by the player or enemy) is conquered, the defense of all remaining miscellaneous Nodes that \" +\n \"are not actively being targeted will increase by a fixed percentage.

\" +\n \"-Whenever a Node is conquered, its stats are significantly reduced

\" +\n \"-Miscellaneous Nodes slowly raise their defense over time

\" +\n \"-Nodes slowly regenerate health over time.\",\n\n // Time-related constants\n MillisecondsPer20Hours: 72000000,\n GameCyclesPer20Hours: 72000000 / 200,\n\n MillisecondsPer10Hours: 36000000,\n GameCyclesPer10Hours: 36000000 / 200,\n\n MillisecondsPer8Hours: 28800000,\n GameCyclesPer8Hours: 28800000 / 200,\n\n MillisecondsPer4Hours: 14400000,\n GameCyclesPer4Hours: 14400000 / 200,\n\n MillisecondsPer2Hours: 7200000,\n GameCyclesPer2Hours: 7200000 / 200,\n\n MillisecondsPerHour: 3600000,\n GameCyclesPerHour: 3600000 / 200,\n\n MillisecondsPerHalfHour: 1800000,\n GameCyclesPerHalfHour: 1800000 / 200,\n\n MillisecondsPerQuarterHour: 900000,\n GameCyclesPerQuarterHour: 900000 / 200,\n\n MillisecondsPerFiveMinutes: 300000,\n GameCyclesPerFiveMinutes: 300000 / 200,\n\n // Player Work & Action\n FactionWorkHacking: \"Faction Hacking Work\",\n FactionWorkField: \"Faction Field Work\",\n FactionWorkSecurity: \"Faction Security Work\",\n\n WorkTypeCompany: \"Working for Company\",\n WorkTypeCompanyPartTime: \"Working for Company part-time\",\n WorkTypeFaction: \"Working for Faction\",\n WorkTypeCreateProgram: \"Working on Create a Program\",\n WorkTypeStudyClass: \"Studying or Taking a class at university\",\n WorkTypeCrime: \"Committing a crime\",\n\n ClassStudyComputerScience: \"studying Computer Science\",\n ClassDataStructures: \"taking a Data Structures course\",\n ClassNetworks: \"taking a Networks course\",\n ClassAlgorithms: \"taking an Algorithms course\",\n ClassManagement: \"taking a Management course\",\n ClassLeadership: \"taking a Leadership course\",\n ClassGymStrength: \"training your strength at a gym\",\n ClassGymDefense: \"training your defense at a gym\",\n ClassGymDexterity: \"training your dexterity at a gym\",\n ClassGymAgility: \"training your agility at a gym\",\n\n ClassDataStructuresBaseCost: 40,\n ClassNetworksBaseCost: 80,\n ClassAlgorithmsBaseCost: 320,\n ClassManagementBaseCost: 160,\n ClassLeadershipBaseCost: 320,\n ClassGymBaseCost: 120,\n\n ClassStudyComputerScienceBaseExp: 0.5,\n ClassDataStructuresBaseExp: 1,\n ClassNetworksBaseExp: 2,\n ClassAlgorithmsBaseExp: 4,\n ClassManagementBaseExp: 2,\n ClassLeadershipBaseExp: 4,\n\n CrimeShoplift: \"shoplift\",\n CrimeRobStore: \"rob a store\",\n CrimeMug: \"mug someone\",\n CrimeLarceny: \"commit larceny\",\n CrimeDrugs: \"deal drugs\",\n CrimeBondForgery: \"forge corporate bonds\",\n CrimeTraffickArms: \"traffick illegal arms\",\n CrimeHomicide: \"commit homicide\",\n CrimeGrandTheftAuto: \"commit grand theft auto\",\n CrimeKidnap: \"kidnap someone for ransom\",\n CrimeAssassination: \"assassinate a high-profile target\",\n CrimeHeist: \"pull off the ultimate heist\",\n\n // Coding Contract\n // TODO: Move this into Coding contract implementation?\n CodingContractBaseFactionRepGain: 2500,\n CodingContractBaseCompanyRepGain: 4000,\n CodingContractBaseMoneyGain: 75e6,\n\n // BitNode/Source-File related stuff\n TotalNumBitNodes: 24,\n\n LatestUpdate: `\n v0.54.0 - 2021-09-20 One big react node (hydroflame & community)\n -------------------------------------------\n\n ** UI **\n\n * The UI is now completely(ish) in react and I'm starting to implement\n Material-UI everywhere. This will help make the game feel more consistent.\n * Major help from (@threehams)\n * New Terminal\n * New Active Scripts page\n * New sidebar.\n * New Character overview\n * New tutorial\n * New options page\n * New create program page (@Nolshine)\n\n ** Netscript ** \n\n * Add companyName to getPlayer\n\n ** Factions **\n\n * Megacorp factions are no longer removed when installing.\n\n ** Corporation **\n\n * All research tooltips are always visible.\n * Smart supply is enabled by default if purchased (@Nolshine)\n\n ** Misc. **\n\n * Fix \"Game saved\" animation. (@Nolshine)\n * Update commitCrime documentation (@Tryneus)\n * Fix logbox scrolling weird (@Nolshine)\n * Fix weird scrolling in corporations (@BartKoppelmans)\n * Fix typo (@BartKoppelmans & @Nolshine)\n * Delete game now has a confirmation modal (@Nolshine)\n * Fix issue where skills would not get properly updated when entering new\n BN. (@Nolshine)\n * Convert create gang to popup (@vmesecher)\n * Fixed a bug that prevented travel to Sector-12 and New Tokyo when not using\n ASCII art.\n * nerf noodle bar\n`,\n\n /*\n\n\n*/\n};\n","import { IMap } from \"../../types\";\n\nexport const AugmentationNames: IMap = {\n Targeting1: \"Augmented Targeting I\",\n Targeting2: \"Augmented Targeting II\",\n Targeting3: \"Augmented Targeting III\",\n SyntheticHeart: \"Synthetic Heart\",\n SynfibrilMuscle: \"Synfibril Muscle\",\n CombatRib1: \"Combat Rib I\",\n CombatRib2: \"Combat Rib II\",\n CombatRib3: \"Combat Rib III\",\n NanofiberWeave: \"Nanofiber Weave\",\n SubdermalArmor: \"NEMEAN Subdermal Weave\",\n WiredReflexes: \"Wired Reflexes\",\n GrapheneBoneLacings: \"Graphene Bone Lacings\",\n BionicSpine: \"Bionic Spine\",\n GrapheneBionicSpine: \"Graphene Bionic Spine Upgrade\",\n BionicLegs: \"Bionic Legs\",\n GrapheneBionicLegs: \"Graphene Bionic Legs Upgrade\",\n SpeechProcessor: \"Speech Processor Implant\",\n TITN41Injection: \"TITN-41 Gene-Modification Injection\",\n EnhancedSocialInteractionImplant: \"Enhanced Social Interaction Implant\",\n BitWire: \"BitWire\",\n ArtificialBioNeuralNetwork: \"Artificial Bio-neural Network Implant\",\n ArtificialSynapticPotentiation: \"Artificial Synaptic Potentiation\",\n EnhancedMyelinSheathing: \"Enhanced Myelin Sheathing\",\n SynapticEnhancement: \"Synaptic Enhancement Implant\",\n NeuralRetentionEnhancement: \"Neural-Retention Enhancement\",\n DataJack: \"DataJack\",\n ENM: \"Embedded Netburner Module\",\n ENMCore: \"Embedded Netburner Module Core Implant\",\n ENMCoreV2: \"Embedded Netburner Module Core V2 Upgrade\",\n ENMCoreV3: \"Embedded Netburner Module Core V3 Upgrade\",\n ENMAnalyzeEngine: \"Embedded Netburner Module Analyze Engine\",\n ENMDMA: \"Embedded Netburner Module Direct Memory Access Upgrade\",\n Neuralstimulator: \"Neuralstimulator\",\n NeuralAccelerator: \"Neural Accelerator\",\n CranialSignalProcessorsG1: \"Cranial Signal Processors - Gen I\",\n CranialSignalProcessorsG2: \"Cranial Signal Processors - Gen II\",\n CranialSignalProcessorsG3: \"Cranial Signal Processors - Gen III\",\n CranialSignalProcessorsG4: \"Cranial Signal Processors - Gen IV\",\n CranialSignalProcessorsG5: \"Cranial Signal Processors - Gen V\",\n NeuronalDensification: \"Neuronal Densification\",\n NuoptimalInjectorImplant: \"Nuoptimal Nootropic Injector Implant\",\n SpeechEnhancement: \"Speech Enhancement\",\n FocusWire: \"FocusWire\",\n PCDNI: \"PC Direct-Neural Interface\",\n PCDNIOptimizer: \"PC Direct-Neural Interface Optimization Submodule\",\n PCDNINeuralNetwork: \"PC Direct-Neural Interface NeuroNet Injector\",\n PCMatrix: \"PCMatrix\",\n ADRPheromone1: \"ADR-V1 Pheromone Gene\",\n ADRPheromone2: \"ADR-V2 Pheromone Gene\",\n ShadowsSimulacrum: \"The Shadow's Simulacrum\",\n HacknetNodeCPUUpload: \"Hacknet Node CPU Architecture Neural-Upload\",\n HacknetNodeCacheUpload: \"Hacknet Node Cache Architecture Neural-Upload\",\n HacknetNodeNICUpload: \"Hacknet Node NIC Architecture Neural-Upload\",\n HacknetNodeKernelDNI: \"Hacknet Node Kernel Direct-Neural Interface\",\n HacknetNodeCoreDNI: \"Hacknet Node Core Direct-Neural Interface\",\n NeuroFluxGovernor: \"NeuroFlux Governor\",\n Neurotrainer1: \"Neurotrainer I\",\n Neurotrainer2: \"Neurotrainer II\",\n Neurotrainer3: \"Neurotrainer III\",\n Hypersight: \"HyperSight Corneal Implant\",\n LuminCloaking1: \"LuminCloaking-V1 Skin Implant\",\n LuminCloaking2: \"LuminCloaking-V2 Skin Implant\",\n HemoRecirculator: \"HemoRecirculator\",\n SmartSonar: \"SmartSonar Implant\",\n PowerRecirculator: \"Power Recirculation Core\",\n QLink: \"QLink\",\n TheRedPill: \"The Red Pill\",\n SPTN97: \"SPTN-97 Gene Modification\",\n HiveMind: \"ECorp HVMind Implant\",\n CordiARCReactor: \"CordiARC Fusion Reactor\",\n SmartJaw: \"SmartJaw\",\n Neotra: \"Neotra\",\n Xanipher: \"Xanipher\",\n nextSENS: \"nextSENS Gene Modification\",\n OmniTekInfoLoad: \"OmniTek InfoLoad\",\n PhotosyntheticCells: \"Photosynthetic Cells\",\n Neurolink: \"BitRunners Neurolink\",\n TheBlackHand: \"The Black Hand\",\n UnstableCircadianModulator: \"Unstable Circadian Modulator\",\n CRTX42AA: \"CRTX42-AA Gene Modification\",\n Neuregen: \"Neuregen Gene Modification\",\n CashRoot: \"CashRoot Starter Kit\",\n NutriGen: \"NutriGen Implant\",\n INFRARet: \"INFRARET Enhancement\",\n DermaForce: \"DermaForce Particle Barrier\",\n GrapheneBrachiBlades: \"Graphene BranchiBlades Upgrade\",\n GrapheneBionicArms: \"Graphene Bionic Arms Upgrade\",\n BrachiBlades: \"BrachiBlades\",\n BionicArms: \"Bionic Arms\",\n SNA: \"Social Negotiation Assistant (S.N.A)\",\n HydroflameLeftArm: \"Hydroflame Left Arm\",\n EsperEyewear: \"EsperTech Bladeburner Eyewear\",\n EMS4Recombination: \"EMS-4 Recombination\",\n OrionShoulder: \"ORION-MKIV Shoulder\",\n HyperionV1: \"Hyperion Plasma Cannon V1\",\n HyperionV2: \"Hyperion Plasma Cannon V2\",\n GolemSerum: \"GOLEM Serum\",\n VangelisVirus: \"Vangelis Virus\",\n VangelisVirus3: \"Vangelis Virus 3.0\",\n INTERLINKED: \"I.N.T.E.R.L.I.N.K.E.D\",\n BladeRunner: \"Blade's Runners\",\n BladeArmor: \"BLADE-51b Tesla Armor\",\n BladeArmorPowerCells: \"BLADE-51b Tesla Armor: Power Cells Upgrade\",\n BladeArmorEnergyShielding: \"BLADE-51b Tesla Armor: Energy Shielding Upgrade\",\n BladeArmorUnibeam: \"BLADE-51b Tesla Armor: Unibeam Upgrade\",\n BladeArmorOmnibeam: \"BLADE-51b Tesla Armor: Omnibeam Upgrade\",\n BladeArmorIPU: \"BLADE-51b Tesla Armor: IPU Upgrade\",\n BladesSimulacrum: \"The Blade's Simulacrum\",\n\n //Wasteland Augs\n //PepBoy: \"P.E.P-Boy\", Plasma Energy Projection System\n //PepBoyForceField Generates plasma force fields\n //PepBoyBlasts Generate high density plasma concussive blasts\n //PepBoyDataStorage STore more data on pep boy,\n};\n","/**\n * Bitnode multipliers influence the difficulty of different aspects of the game.\n * Each Bitnode has a different theme/strategy to achieving the end goal, so these multipliers will can help drive the\n * player toward the intended strategy. Unless they really want to play the long, slow game of waiting...\n */\ninterface IBitNodeMultipliers {\n /**\n * Influences how quickly the player's agility level (not exp) scales\n */\n AgilityLevelMultiplier: number;\n\n /**\n * Influences the base cost to purchase an augmentation.\n */\n AugmentationMoneyCost: number;\n\n /**\n * Influences the base rep the player must have with a faction to purchase an augmentation.\n */\n AugmentationRepCost: number;\n\n /**\n * Influences how quickly the player can gain rank within Bladeburner.\n */\n BladeburnerRank: number;\n\n /**\n * Influences the cost of skill levels from Bladeburner.\n */\n BladeburnerSkillCost: number;\n\n /**\n * Influences how quickly the player's charisma level (not exp) scales\n */\n CharismaLevelMultiplier: number;\n\n /**\n * Influences the experience gained for each ability when a player completes a class.\n */\n ClassGymExpGain: number;\n\n /**\n * Influences the amount of money gained from completing Coding Contracts\n **/\n CodingContractMoney: number;\n\n /**\n * Influences the experience gained for each ability when the player completes working their job.\n */\n CompanyWorkExpGain: number;\n\n /**\n * Influences how much money the player earns when completing working their job.\n */\n CompanyWorkMoney: number;\n\n /**\n * Influences the valuation of corporations created by the player.\n */\n CorporationValuation: number;\n\n /**\n * Influences the base experience gained for each ability when the player commits a crime.\n */\n CrimeExpGain: number;\n\n /**\n * Influences the base money gained when the player commits a crime.\n */\n CrimeMoney: number;\n\n /**\n * Influences how many Augmentations you need in order to get invited to the Daedalus faction\n */\n DaedalusAugsRequirement: number;\n\n /**\n * Influences how quickly the player's defense level (not exp) scales\n */\n DefenseLevelMultiplier: number;\n\n /**\n * Influences how quickly the player's dexterity level (not exp) scales\n */\n DexterityLevelMultiplier: number;\n\n /**\n * Influences how much rep the player gains in each faction simply by being a member.\n */\n FactionPassiveRepGain: number;\n\n /**\n * Influences the experience gained for each ability when the player completes work for a Faction.\n */\n FactionWorkExpGain: number;\n\n /**\n * Influences how much rep the player gains when performing work for a faction.\n */\n FactionWorkRepGain: number;\n\n /**\n * Influences how much it costs to unlock the stock market's 4S Market Data API\n */\n FourSigmaMarketDataApiCost: number;\n\n /**\n * Influences how much it costs to unlock the stock market's 4S Market Data (NOT API)\n */\n FourSigmaMarketDataCost: number;\n\n /**\n * Influences how much negative karma is required to create a gang in this bitnode.\n */\n GangKarmaRequirement: number;\n\n /**\n * Influences the experienced gained when hacking a server.\n */\n HackExpGain: number;\n\n /**\n * Influences how quickly the player's hacking level (not experience) scales\n */\n HackingLevelMultiplier: number;\n\n /**\n * Influences how much money is produced by Hacknet Nodes.\n * Influeces the hash rate of Hacknet Servers (unlocked in BitNode-9)\n */\n HacknetNodeMoney: number;\n\n /**\n * Influences how much money it costs to upgrade your home computer's RAM\n */\n HomeComputerRamCost: number;\n\n /**\n * Influences how much money is gained when the player infiltrates a company.\n */\n InfiltrationMoney: number;\n\n /**\n * Influences how much rep the player can gain from factions when selling stolen documents and secrets\n */\n InfiltrationRep: number;\n\n /**\n * Influences how much money can be stolen from a server when the player performs a hack against it through\n * the Terminal.\n */\n ManualHackMoney: number;\n\n /**\n * Influence how much it costs to purchase a server\n */\n PurchasedServerCost: number;\n\n /**\n * Influences the maximum number of purchased servers you can have\n */\n PurchasedServerLimit: number;\n\n /**\n * Influences the maximum allowed RAM for a purchased server\n */\n PurchasedServerMaxRam: number;\n /**\n * Influences the minimum favor the player must have with a faction before they can donate to gain rep.\n */\n RepToDonateToFaction: number;\n\n /**\n * Influences how much money can be stolen from a server when a script performs a hack against it.\n */\n ScriptHackMoney: number;\n\n /**\n * The amount of money actually gained when script hack a server. This is\n * different than the above because you can reduce the amount of money but\n * not gain that same amount.\n */\n ScriptHackMoneyGain: number;\n\n /**\n * Influences the growth percentage per cycle against a server.\n */\n ServerGrowthRate: number;\n\n /**\n * Influences the maxmimum money that a server can grow to.\n */\n ServerMaxMoney: number;\n\n /**\n * Influences the initial money that a server starts with.\n */\n ServerStartingMoney: number;\n\n /**\n * Influences the initial security level (hackDifficulty) of a server.\n */\n ServerStartingSecurity: number;\n\n /**\n * Influences the weaken amount per invocation against a server.\n */\n ServerWeakenRate: number;\n\n /**\n * Influences how quickly the player's strength level (not exp) scales\n */\n StrengthLevelMultiplier: number;\n\n // Index signature\n [key: string]: number;\n}\n\n/**\n * The multipliers that are influenced by current Bitnode progression.\n */\n// tslint:disable-next-line:variable-name\nexport const BitNodeMultipliers: IBitNodeMultipliers = {\n HackingLevelMultiplier: 1,\n StrengthLevelMultiplier: 1,\n DefenseLevelMultiplier: 1,\n DexterityLevelMultiplier: 1,\n AgilityLevelMultiplier: 1,\n CharismaLevelMultiplier: 1,\n\n ServerGrowthRate: 1,\n ServerMaxMoney: 1,\n ServerStartingMoney: 1,\n ServerStartingSecurity: 1,\n ServerWeakenRate: 1,\n\n HomeComputerRamCost: 1,\n\n PurchasedServerCost: 1,\n PurchasedServerLimit: 1,\n PurchasedServerMaxRam: 1,\n\n CompanyWorkMoney: 1,\n CrimeMoney: 1,\n HacknetNodeMoney: 1,\n ManualHackMoney: 1,\n ScriptHackMoney: 1,\n ScriptHackMoneyGain: 1,\n CodingContractMoney: 1,\n\n ClassGymExpGain: 1,\n CompanyWorkExpGain: 1,\n CrimeExpGain: 1,\n FactionWorkExpGain: 1,\n HackExpGain: 1,\n\n FactionPassiveRepGain: 1,\n FactionWorkRepGain: 1,\n RepToDonateToFaction: 1,\n\n AugmentationMoneyCost: 1,\n AugmentationRepCost: 1,\n\n InfiltrationMoney: 1,\n InfiltrationRep: 1,\n\n FourSigmaMarketDataCost: 1,\n FourSigmaMarketDataApiCost: 1,\n\n CorporationValuation: 1,\n\n BladeburnerRank: 1,\n BladeburnerSkillCost: 1,\n\n DaedalusAugsRequirement: 1,\n GangKarmaRequirement: 1,\n};\n","/**\n * Names of all locations\n */\nexport enum LocationName {\n // Cities\n Aevum = \"Aevum\",\n Chongqing = \"Chongqing\",\n Ishima = \"Ishima\",\n NewTokyo = \"New Tokyo\",\n Sector12 = \"Sector-12\",\n Volhaven = \"Volhaven\",\n\n // Aevum Locations\n AevumAeroCorp = \"AeroCorp\",\n AevumBachmanAndAssociates = \"Bachman & Associates\",\n AevumClarkeIncorporated = \"Clarke Incorporated\",\n AevumCrushFitnessGym = \"Crush Fitness Gym\",\n AevumECorp = \"ECorp\",\n AevumFulcrumTechnologies = \"Fulcrum Technologies\",\n AevumGalacticCybersystems = \"Galactic Cybersystems\",\n AevumNetLinkTechnologies = \"NetLink Technologies\",\n AevumPolice = \"Aevum Police Headquarters\",\n AevumRhoConstruction = \"Rho Construction\",\n AevumSnapFitnessGym = \"Snap Fitness Gym\",\n AevumSummitUniversity = \"Summit University\",\n AevumWatchdogSecurity = \"Watchdog Security\",\n AevumCasino = \"Iker Molina Casino\",\n\n // Chongqing locations\n ChongqingKuaiGongInternational = \"KuaiGong International\",\n ChongqingSolarisSpaceSystems = \"Solaris Space Systems\",\n\n // Sector 12\n Sector12AlphaEnterprises = \"Alpha Enterprises\",\n Sector12BladeIndustries = \"Blade Industries\",\n Sector12CIA = \"Central Intelligence Agency\",\n Sector12CarmichaelSecurity = \"Carmichael Security\",\n Sector12CityHall = \"Sector-12 City Hall\",\n Sector12DeltaOne = \"DeltaOne\",\n Sector12FoodNStuff = \"FoodNStuff\",\n Sector12FourSigma = \"Four Sigma\",\n Sector12IcarusMicrosystems = \"Icarus Microsystems\",\n Sector12IronGym = \"Iron Gym\",\n Sector12JoesGuns = \"Joe's Guns\",\n Sector12MegaCorp = \"MegaCorp\",\n Sector12NSA = \"National Security Agency\",\n Sector12PowerhouseGym = \"Powerhouse Gym\",\n Sector12RothmanUniversity = \"Rothman University\",\n Sector12UniversalEnergy = \"Universal Energy\",\n\n // New Tokyo\n NewTokyoDefComm = \"DefComm\",\n NewTokyoGlobalPharmaceuticals = \"Global Pharmaceuticals\",\n NewTokyoNoodleBar = \"Noodle Bar\",\n NewTokyoVitaLife = \"VitaLife\",\n\n // Ishima\n IshimaNovaMedical = \"Nova Medical\",\n IshimaOmegaSoftware = \"Omega Software\",\n IshimaStormTechnologies = \"Storm Technologies\",\n\n // Volhaven\n VolhavenCompuTek = \"CompuTek\",\n VolhavenHeliosLabs = \"Helios Labs\",\n VolhavenLexoCorp = \"LexoCorp\",\n VolhavenMilleniumFitnessGym = \"Millenium Fitness Gym\",\n VolhavenNWO = \"NWO\",\n VolhavenOmniTekIncorporated = \"OmniTek Incorporated\",\n VolhavenOmniaCybersystems = \"Omnia Cybersystems\",\n VolhavenSysCoreSecurities = \"SysCore Securities\",\n VolhavenZBInstituteOfTechnology = \"ZB Institute of Technology\",\n\n // Generic locations\n Hospital = \"Hospital\",\n Slums = \"The Slums\",\n TravelAgency = \"Travel Agency\",\n WorldStockExchange = \"World Stock Exchange\",\n\n // Default name for Location objects\n Void = \"The Void\",\n}\n","import { createPopup } from \"../src/ui/React/createPopup\";\nimport { getRandomInt } from \"./helpers/getRandomInt\";\n\nimport React from \"react\";\n\ninterface IProps {\n content: JSX.Element;\n}\n\nfunction MessagePopup(props: IProps): React.ReactElement {\n return <>{props.content};\n}\n\nexport function dialogBoxCreate(txt: string | JSX.Element, preformatted = false): void {\n const popupId =\n `popup-` +\n Array.from(Array(16))\n .map(() => `${getRandomInt(0, 9)}`)\n .join(\"\");\n if (typeof txt === \"string\") {\n if (preformatted) {\n // For text files as they are often computed data that\n // shouldn't be wrapped and should retain tabstops.\n createPopup(popupId, MessagePopup, {\n content:
,\n      });\n    } else {\n      createPopup(popupId, MessagePopup, {\n        content: (\n          \"),\n            }}\n          />\n        ),\n      });\n    }\n  } else {\n    createPopup(popupId, MessagePopup, {\n      content: txt,\n    });\n  }\n}\n","import { IMap } from \"../types\";\n\n// TODO remember to update RamCalculations.js and WorkerScript.js\n\n// RAM costs for Netscript functions\nexport const RamCostConstants: IMap = {\n  ScriptBaseRamCost: 1.6,\n  ScriptDomRamCost: 25,\n  ScriptHackRamCost: 0.1,\n  ScriptHackAnalyzeRamCost: 1,\n  ScriptGrowRamCost: 0.15,\n  ScriptGrowthAnalyzeRamCost: 1,\n  ScriptWeakenRamCost: 0.15,\n  ScriptScanRamCost: 0.2,\n  ScriptPortProgramRamCost: 0.05,\n  ScriptRunRamCost: 1.0,\n  ScriptExecRamCost: 1.3,\n  ScriptSpawnRamCost: 2.0,\n  ScriptScpRamCost: 0.6,\n  ScriptKillRamCost: 0.5,\n  ScriptHasRootAccessRamCost: 0.05,\n  ScriptGetHostnameRamCost: 0.05,\n  ScriptGetHackingLevelRamCost: 0.05,\n  ScriptGetMultipliersRamCost: 4.0,\n  ScriptGetServerRamCost: 0.1,\n  ScriptGetServerMaxRam: 0.05,\n  ScriptGetServerUsedRam: 0.05,\n  ScriptFileExistsRamCost: 0.1,\n  ScriptIsRunningRamCost: 0.1,\n  ScriptHacknetNodesRamCost: 4.0,\n  ScriptHNUpgLevelRamCost: 0.4,\n  ScriptHNUpgRamRamCost: 0.6,\n  ScriptHNUpgCoreRamCost: 0.8,\n  ScriptGetStockRamCost: 2.0,\n  ScriptBuySellStockRamCost: 2.5,\n  ScriptGetPurchaseServerRamCost: 0.25,\n  ScriptPurchaseServerRamCost: 2.25,\n  ScriptGetPurchasedServerLimit: 0.05,\n  ScriptGetPurchasedServerMaxRam: 0.05,\n  ScriptRoundRamCost: 0.05,\n  ScriptReadWriteRamCost: 1.0,\n  ScriptArbScriptRamCost: 1.0,\n  ScriptGetScriptRamCost: 0.1,\n  ScriptGetRunningScriptRamCost: 0.3,\n  ScriptGetHackTimeRamCost: 0.05,\n  ScriptGetFavorToDonate: 0.1,\n  ScriptCodingContractBaseRamCost: 10,\n  ScriptSleeveBaseRamCost: 4,\n\n  ScriptSingularityFn1RamCost: 2,\n  ScriptSingularityFn2RamCost: 3,\n  ScriptSingularityFn3RamCost: 5,\n\n  ScriptGangApiBaseRamCost: 4,\n\n  ScriptBladeburnerApiBaseRamCost: 4,\n};\n\nexport const RamCosts: IMap = {\n  hacknet: {\n    numNodes: () => 0,\n    purchaseNode: () => 0,\n    getPurchaseNodeCost: () => 0,\n    getNodeStats: () => 0,\n    upgradeLevel: () => 0,\n    upgradeRam: () => 0,\n    upgradeCore: () => 0,\n    upgradeCache: () => 0,\n    getLevelUpgradeCost: () => 0,\n    getRamUpgradeCost: () => 0,\n    getCoreUpgradeCost: () => 0,\n    getCacheUpgradeCost: () => 0,\n    numHashes: () => 0,\n    hashCost: () => 0,\n    spendHashes: () => 0,\n  },\n  sprintf: () => 0,\n  vsprintf: () => 0,\n  scan: () => RamCostConstants.ScriptScanRamCost,\n  hack: () => RamCostConstants.ScriptHackRamCost,\n  hackAnalyzeThreads: () => RamCostConstants.ScriptHackAnalyzeRamCost,\n  hackAnalyzePercent: () => RamCostConstants.ScriptHackAnalyzeRamCost,\n  hackChance: () => RamCostConstants.ScriptHackAnalyzeRamCost,\n  sleep: () => 0,\n  grow: () => RamCostConstants.ScriptGrowRamCost,\n  growthAnalyze: () => RamCostConstants.ScriptGrowthAnalyzeRamCost,\n  weaken: () => RamCostConstants.ScriptWeakenRamCost,\n  print: () => 0,\n  tprint: () => 0,\n  clearLog: () => 0,\n  disableLog: () => 0,\n  enableLog: () => 0,\n  isLogEnabled: () => 0,\n  getScriptLogs: () => 0,\n  nuke: () => RamCostConstants.ScriptPortProgramRamCost,\n  brutessh: () => RamCostConstants.ScriptPortProgramRamCost,\n  ftpcrack: () => RamCostConstants.ScriptPortProgramRamCost,\n  relaysmtp: () => RamCostConstants.ScriptPortProgramRamCost,\n  httpworm: () => RamCostConstants.ScriptPortProgramRamCost,\n  sqlinject: () => RamCostConstants.ScriptPortProgramRamCost,\n  run: () => RamCostConstants.ScriptRunRamCost,\n  exec: () => RamCostConstants.ScriptExecRamCost,\n  spawn: () => RamCostConstants.ScriptSpawnRamCost,\n  kill: () => RamCostConstants.ScriptKillRamCost,\n  killall: () => RamCostConstants.ScriptKillRamCost,\n  exit: () => 0,\n  scp: () => RamCostConstants.ScriptScpRamCost,\n  ls: () => RamCostConstants.ScriptScanRamCost,\n  ps: () => RamCostConstants.ScriptScanRamCost,\n  hasRootAccess: () => RamCostConstants.ScriptHasRootAccessRamCost,\n  getIp: () => RamCostConstants.ScriptGetHostnameRamCost,\n  getHostname: () => RamCostConstants.ScriptGetHostnameRamCost,\n  getHackingLevel: () => RamCostConstants.ScriptGetHackingLevelRamCost,\n  getHackingMultipliers: () => RamCostConstants.ScriptGetMultipliersRamCost,\n  getHacknetMultipliers: () => RamCostConstants.ScriptGetMultipliersRamCost,\n  getBitNodeMultipliers: () => RamCostConstants.ScriptGetMultipliersRamCost,\n  getServer: () => RamCostConstants.ScriptGetMultipliersRamCost / 2,\n  getServerMoneyAvailable: () => RamCostConstants.ScriptGetServerRamCost,\n  getServerSecurityLevel: () => RamCostConstants.ScriptGetServerRamCost,\n  getServerBaseSecurityLevel: () => RamCostConstants.ScriptGetServerRamCost,\n  getServerMinSecurityLevel: () => RamCostConstants.ScriptGetServerRamCost,\n  getServerRequiredHackingLevel: () => RamCostConstants.ScriptGetServerRamCost,\n  getServerMaxMoney: () => RamCostConstants.ScriptGetServerRamCost,\n  getServerGrowth: () => RamCostConstants.ScriptGetServerRamCost,\n  getServerNumPortsRequired: () => RamCostConstants.ScriptGetServerRamCost,\n  getServerRam: () => RamCostConstants.ScriptGetServerRamCost,\n  getServerMaxRam: () => RamCostConstants.ScriptGetServerMaxRam,\n  getServerUsedRam: () => RamCostConstants.ScriptGetServerUsedRam,\n  serverExists: () => RamCostConstants.ScriptGetServerRamCost,\n  fileExists: () => RamCostConstants.ScriptFileExistsRamCost,\n  isRunning: () => RamCostConstants.ScriptIsRunningRamCost,\n  getStockSymbols: () => RamCostConstants.ScriptGetStockRamCost,\n  getStockPrice: () => RamCostConstants.ScriptGetStockRamCost,\n  getStockAskPrice: () => RamCostConstants.ScriptGetStockRamCost,\n  getStockBidPrice: () => RamCostConstants.ScriptGetStockRamCost,\n  getStockPosition: () => RamCostConstants.ScriptGetStockRamCost,\n  getStockMaxShares: () => RamCostConstants.ScriptGetStockRamCost,\n  getStockPurchaseCost: () => RamCostConstants.ScriptGetStockRamCost,\n  getStockSaleGain: () => RamCostConstants.ScriptGetStockRamCost,\n  buyStock: () => RamCostConstants.ScriptBuySellStockRamCost,\n  sellStock: () => RamCostConstants.ScriptBuySellStockRamCost,\n  shortStock: () => RamCostConstants.ScriptBuySellStockRamCost,\n  sellShort: () => RamCostConstants.ScriptBuySellStockRamCost,\n  placeOrder: () => RamCostConstants.ScriptBuySellStockRamCost,\n  cancelOrder: () => RamCostConstants.ScriptBuySellStockRamCost,\n  getOrders: () => RamCostConstants.ScriptBuySellStockRamCost,\n  getStockVolatility: () => RamCostConstants.ScriptBuySellStockRamCost,\n  getStockForecast: () => RamCostConstants.ScriptBuySellStockRamCost,\n  purchase4SMarketData: () => RamCostConstants.ScriptBuySellStockRamCost,\n  purchase4SMarketDataTixApi: () => RamCostConstants.ScriptBuySellStockRamCost,\n  getPurchasedServerLimit: () => RamCostConstants.ScriptGetPurchasedServerLimit,\n  getPurchasedServerMaxRam: () => RamCostConstants.ScriptGetPurchasedServerMaxRam,\n  getPurchasedServerCost: () => RamCostConstants.ScriptGetPurchaseServerRamCost,\n  purchaseServer: () => RamCostConstants.ScriptPurchaseServerRamCost,\n  deleteServer: () => RamCostConstants.ScriptPurchaseServerRamCost,\n  getPurchasedServers: () => RamCostConstants.ScriptPurchaseServerRamCost,\n  write: () => RamCostConstants.ScriptReadWriteRamCost,\n  tryWrite: () => RamCostConstants.ScriptReadWriteRamCost,\n  read: () => RamCostConstants.ScriptReadWriteRamCost,\n  peek: () => RamCostConstants.ScriptReadWriteRamCost,\n  clear: () => RamCostConstants.ScriptReadWriteRamCost,\n  getPortHandle: () => RamCostConstants.ScriptReadWriteRamCost * 10,\n  rm: () => RamCostConstants.ScriptReadWriteRamCost,\n  scriptRunning: () => RamCostConstants.ScriptArbScriptRamCost,\n  scriptKill: () => RamCostConstants.ScriptArbScriptRamCost,\n  getScriptName: () => 0,\n  getScriptRam: () => RamCostConstants.ScriptGetScriptRamCost,\n  getHackTime: () => RamCostConstants.ScriptGetHackTimeRamCost,\n  getGrowTime: () => RamCostConstants.ScriptGetHackTimeRamCost,\n  getWeakenTime: () => RamCostConstants.ScriptGetHackTimeRamCost,\n  getScriptIncome: () => RamCostConstants.ScriptGetScriptRamCost,\n  getScriptExpGain: () => RamCostConstants.ScriptGetScriptRamCost,\n  getRunningScript: () => RamCostConstants.ScriptGetRunningScriptRamCost,\n  nFormat: () => 0,\n  getTimeSinceLastAug: () => RamCostConstants.ScriptGetHackTimeRamCost,\n  prompt: () => 0,\n  wget: () => 0,\n  getFavorToDonate: () => RamCostConstants.ScriptGetFavorToDonate,\n\n  // Singularity Functions\n  universityCourse: () => RamCostConstants.ScriptSingularityFn1RamCost,\n  gymWorkout: () => RamCostConstants.ScriptSingularityFn1RamCost,\n  travelToCity: () => RamCostConstants.ScriptSingularityFn1RamCost,\n  purchaseTor: () => RamCostConstants.ScriptSingularityFn1RamCost,\n  purchaseProgram: () => RamCostConstants.ScriptSingularityFn1RamCost,\n  getCurrentServer: () => RamCostConstants.ScriptSingularityFn1RamCost,\n  connect: () => RamCostConstants.ScriptSingularityFn1RamCost,\n  manualHack: () => RamCostConstants.ScriptSingularityFn1RamCost,\n  installBackdoor: () => RamCostConstants.ScriptSingularityFn1RamCost,\n  getStats: () => RamCostConstants.ScriptSingularityFn1RamCost / 4,\n  getCharacterInformation: () => RamCostConstants.ScriptSingularityFn1RamCost / 4,\n  getPlayer: () => RamCostConstants.ScriptSingularityFn1RamCost / 4,\n  hospitalize: () => RamCostConstants.ScriptSingularityFn1RamCost / 4,\n  isBusy: () => RamCostConstants.ScriptSingularityFn1RamCost / 4,\n  stopAction: () => RamCostConstants.ScriptSingularityFn1RamCost / 2,\n  upgradeHomeRam: () => RamCostConstants.ScriptSingularityFn2RamCost,\n  getUpgradeHomeRamCost: () => RamCostConstants.ScriptSingularityFn2RamCost / 2,\n  workForCompany: () => RamCostConstants.ScriptSingularityFn2RamCost,\n  applyToCompany: () => RamCostConstants.ScriptSingularityFn2RamCost,\n  getCompanyRep: () => RamCostConstants.ScriptSingularityFn2RamCost / 3,\n  getCompanyFavor: () => RamCostConstants.ScriptSingularityFn2RamCost / 3,\n  getCompanyFavorGain: () => RamCostConstants.ScriptSingularityFn2RamCost / 4,\n  checkFactionInvitations: () => RamCostConstants.ScriptSingularityFn2RamCost,\n  joinFaction: () => RamCostConstants.ScriptSingularityFn2RamCost,\n  workForFaction: () => RamCostConstants.ScriptSingularityFn2RamCost,\n  getFactionRep: () => RamCostConstants.ScriptSingularityFn2RamCost / 3,\n  getFactionFavor: () => RamCostConstants.ScriptSingularityFn2RamCost / 3,\n  getFactionFavorGain: () => RamCostConstants.ScriptSingularityFn2RamCost / 4,\n  donateToFaction: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  createProgram: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  commitCrime: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  getCrimeChance: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  getCrimeStats: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  getOwnedAugmentations: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  getOwnedSourceFiles: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  getAugmentationsFromFaction: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  getAugmentationCost: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  getAugmentationPrereq: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  getAugmentationPrice: () => RamCostConstants.ScriptSingularityFn3RamCost / 2,\n  getAugmentationRepReq: () => RamCostConstants.ScriptSingularityFn3RamCost / 2,\n  getAugmentationStats: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  purchaseAugmentation: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  softReset: () => RamCostConstants.ScriptSingularityFn3RamCost,\n  installAugmentations: () => RamCostConstants.ScriptSingularityFn3RamCost,\n\n  // Gang API\n  gang: {\n    createGang: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,\n    inGang: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,\n    getMemberNames: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,\n    getGangInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,\n    getOtherGangInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,\n    getMemberInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,\n    canRecruitMember: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,\n    recruitMember: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,\n    getTaskNames: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,\n    getTaskStats: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,\n    setMemberTask: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,\n    getEquipmentNames: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,\n    getEquipmentCost: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,\n    getEquipmentType: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,\n    getEquipmentStats: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,\n    purchaseEquipment: () => RamCostConstants.ScriptGangApiBaseRamCost,\n    ascendMember: () => RamCostConstants.ScriptGangApiBaseRamCost,\n    setTerritoryWarfare: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,\n    getChanceToWinClash: () => RamCostConstants.ScriptGangApiBaseRamCost,\n    getBonusTime: () => 0,\n  },\n\n  // Bladeburner API\n  bladeburner: {\n    getContractNames: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,\n    getOperationNames: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,\n    getBlackOpNames: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,\n    getBlackOpRank: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 2,\n    getGeneralActionNames: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,\n    getSkillNames: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,\n    startAction: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    stopBladeburnerAction: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 2,\n    getCurrentAction: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 4,\n    getActionTime: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getActionEstimatedSuccessChance: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getActionRepGain: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getActionCountRemaining: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getActionMaxLevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getActionCurrentLevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getActionAutolevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    setActionAutolevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    setActionLevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getRank: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getSkillPoints: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getSkillLevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getSkillUpgradeCost: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    upgradeSkill: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getTeamSize: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    setTeamSize: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getCityEstimatedPopulation: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getCityEstimatedCommunities: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getCityChaos: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getCity: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    switchCity: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getStamina: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    joinBladeburnerFaction: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    joinBladeburnerDivision: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,\n    getBonusTime: () => 0,\n  },\n\n  // Coding Contract API\n  codingcontract: {\n    attempt: () => RamCostConstants.ScriptCodingContractBaseRamCost,\n    getContractType: () => RamCostConstants.ScriptCodingContractBaseRamCost / 2,\n    getData: () => RamCostConstants.ScriptCodingContractBaseRamCost / 2,\n    getDescription: () => RamCostConstants.ScriptCodingContractBaseRamCost / 2,\n    getNumTriesRemaining: () => RamCostConstants.ScriptCodingContractBaseRamCost / 5,\n  },\n\n  // Duplicate Sleeve API\n  sleeve: {\n    getNumSleeves: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    setToShockRecovery: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    setToSynchronize: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    setToCommitCrime: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    setToUniversityCourse: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    travel: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    setToCompanyWork: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    setToFactionWork: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    setToGymWorkout: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    getSleeveStats: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    getTask: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    getInformation: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    getSleeveAugmentations: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    getSleevePurchasableAugs: () => RamCostConstants.ScriptSleeveBaseRamCost,\n    purchaseSleeveAug: () => RamCostConstants.ScriptSleeveBaseRamCost,\n  },\n\n  heart: {\n    // Easter egg function\n    break: () => 0,\n  },\n};\n\nexport function getRamCost(...args: string[]): number {\n  if (args.length === 0) {\n    console.warn(`No arguments passed to getRamCost()`);\n    return 0;\n  }\n\n  let curr = RamCosts[args[0]];\n  for (let i = 1; i < args.length; ++i) {\n    if (curr == null) {\n      console.warn(`Invalid function passed to getRamCost: ${args}`);\n      return 0;\n    }\n\n    const currType = typeof curr;\n    if (currType === \"function\" || currType === \"number\") {\n      break;\n    }\n\n    curr = curr[args[i]];\n  }\n\n  const currType = typeof curr;\n  if (currType === \"function\") {\n    return curr();\n  }\n\n  if (currType === \"number\") {\n    return curr;\n  }\n\n  console.warn(`Unexpected type (${currType}) for value [${args}]`);\n  return 0;\n}\n","import { EqualityFunc } from \"../src/types\";\nimport { isString } from \"./helpers/isString\";\n\n// Netburner String helper functions\n\n// Replaces the character at an index with a new character\nfunction replaceAt(base: string, index: number, character: string): string {\n  return base.substr(0, index) + character + base.substr(index + character.length);\n}\n\n/*\nConverts a date representing time in milliseconds to a string with the format H hours M minutes and S seconds\ne.g.    10000 -> \"10 seconds\"\n        120000 -> \"2 minutes and 0 seconds\"\n*/\nfunction convertTimeMsToTimeElapsedString(time: number, showMilli = false): string {\n  time = Math.floor(time);\n  const millisecondsPerSecond = 1000;\n  const secondPerMinute = 60;\n  const minutesPerHours = 60;\n  const secondPerHours: number = secondPerMinute * minutesPerHours;\n  const hoursPerDays = 24;\n  const secondPerDay: number = secondPerHours * hoursPerDays;\n\n  // Convert ms to seconds, since we only have second-level precision\n  const totalSeconds: number = Math.floor(time / millisecondsPerSecond);\n\n  const days: number = Math.floor(totalSeconds / secondPerDay);\n  const secTruncDays: number = totalSeconds % secondPerDay;\n\n  const hours: number = Math.floor(secTruncDays / secondPerHours);\n  const secTruncHours: number = secTruncDays % secondPerHours;\n\n  const minutes: number = Math.floor(secTruncHours / secondPerMinute);\n  const secTruncMinutes: number = secTruncHours % secondPerMinute;\n\n  const milliTruncSec: string = (() => {\n    let str = `${time % millisecondsPerSecond}`;\n    while (str.length < 3) str = \"0\" + str;\n    return str;\n  })();\n\n  const seconds: string = showMilli ? `${secTruncMinutes}.${milliTruncSec}` : `${secTruncMinutes}`;\n\n  let res = \"\";\n  if (days > 0) {\n    res += `${days} days `;\n  }\n  if (hours > 0) {\n    res += `${hours} hours `;\n  }\n  if (minutes > 0) {\n    res += `${minutes} minutes `;\n  }\n  res += `${seconds} seconds`;\n\n  return res;\n}\n\n// Finds the longest common starting substring in a set of strings\nfunction longestCommonStart(strings: string[]): string {\n  if (!containsAllStrings(strings)) {\n    return \"\";\n  }\n  if (strings.length === 0) {\n    return \"\";\n  }\n\n  const A: string[] = strings.concat().sort();\n  const a1: string = A[0];\n  const a2: string = A[A.length - 1];\n  const L: number = a1.length;\n  let i = 0;\n  const areEqualCaseInsensitive: EqualityFunc = (a: string, b: string) => a.toUpperCase() === b.toUpperCase();\n  while (i < L && areEqualCaseInsensitive(a1.charAt(i), a2.charAt(i))) {\n    i++;\n  }\n\n  return a1.substring(0, i);\n}\n\n// Returns whether an array contains entirely of string objects\nfunction containsAllStrings(arr: string[]): boolean {\n  return arr.every(isString);\n}\n\n// Formats a number with commas and a specific number of decimal digits\nfunction formatNumber(num: number, numFractionDigits = 0): string {\n  return num.toLocaleString(undefined, {\n    maximumFractionDigits: numFractionDigits,\n    minimumFractionDigits: numFractionDigits,\n  });\n}\n\n// Checks if a string contains HTML elements\nfunction isHTML(str: string): boolean {\n  const element: HTMLDivElement = document.createElement(\"div\");\n  element.innerHTML = str;\n  const c: NodeListOf = element.childNodes;\n  for (let i: number = c.length - 1; i >= 0; i--) {\n    if (c[i].nodeType === 1) {\n      return true;\n    }\n  }\n\n  return false;\n}\n\n// Generates a random alphanumeric string with N characters\nfunction generateRandomString(n: number): string {\n  let str = \"\";\n  const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n  for (let i = 0; i < n; i++) {\n    str += chars.charAt(Math.floor(Math.random() * chars.length));\n  }\n\n  return str;\n}\n\nexport {\n  convertTimeMsToTimeElapsedString,\n  longestCommonStart,\n  containsAllStrings,\n  formatNumber,\n  isHTML,\n  generateRandomString,\n  replaceAt,\n};\n","import * as React from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n  money: number | string;\n  player?: IPlayer;\n}\nexport function Money(props: IProps): JSX.Element {\n  if (props.player !== undefined) {\n    if (typeof props.money !== \"number\") throw new Error(\"if player if provided, money should be number, contact dev\");\n    if (!props.player.canAfford(props.money))\n      return {numeralWrapper.formatMoney(props.money)};\n  }\n  return (\n    \n      {typeof props.money === \"number\" ? numeralWrapper.formatMoney(props.money) : props.money}\n    \n  );\n}\n","import { ISelfInitializer, ISelfLoading } from \"../types\";\nimport { OwnedAugmentationsOrderSetting, PurchaseAugmentationsOrderSetting } from \"./SettingEnums\";\n\n/**\n * Represents the default settings the player could customize.\n */\ninterface IDefaultSettings {\n  /**\n   * How many servers per page\n   */\n  ActiveScriptsServerPageSize: number;\n  /**\n   * How many scripts per page\n   */\n  ActiveScriptsScriptPageSize: number;\n  /**\n   * How often the game should autosave the player's progress, in seconds.\n   */\n  AutosaveInterval: number;\n\n  /**\n   * How many milliseconds between execution points for Netscript 1 statements.\n   */\n  CodeInstructionRunTime: number;\n\n  /**\n   * Render city as list of buttons.\n   */\n  DisableASCIIArt: boolean;\n\n  /**\n   * Whether global keyboard shortcuts should be recognized throughout the game.\n   */\n  DisableHotkeys: boolean;\n\n  /**\n   * Whether text effects such as corruption should be visible.\n   */\n  DisableTextEffects: boolean;\n\n  /**\n   * Enable bash hotkeys\n   */\n  EnableBashHotkeys: boolean;\n\n  /**\n   * Enable timestamps\n   */\n  EnableTimestamps: boolean;\n\n  /**\n   * Locale used for display numbers\n   */\n  Locale: string;\n\n  /**\n   * Limit the number of log entries for each script being executed on each server.\n   */\n  MaxLogCapacity: number;\n\n  /**\n   * Limit how many entries can be written to a Netscript Port before entries start to get pushed out.\n   */\n  MaxPortCapacity: number;\n\n  /**\n   * Limit the number of entries in the terminal.\n   */\n  MaxTerminalCapacity: number;\n\n  /**\n   * Whether the player should be asked to confirm purchasing each and every augmentation.\n   */\n  SuppressBuyAugmentationConfirmation: boolean;\n\n  /**\n   * Whether the user should be prompted to join each faction via a dialog box.\n   */\n  SuppressFactionInvites: boolean;\n\n  /**\n   * Whether to show a popup message when player is hospitalized from taking too much damage\n   */\n  SuppressHospitalizationPopup: boolean;\n\n  /**\n   * Whether the user should be shown a dialog box whenever they receive a new message file.\n   */\n  SuppressMessages: boolean;\n\n  /**\n   * Whether the user should be asked to confirm travelling between cities.\n   */\n  SuppressTravelConfirmation: boolean;\n\n  /**\n   * Whether the user should be displayed a popup message when his Bladeburner actions are cancelled.\n   */\n  SuppressBladeburnerPopup: boolean;\n\n  /*\n   * Theme colors\n   */\n  theme: {\n    [key: string]: string | undefined;\n    primarylight: string;\n    primary: string;\n    primarydark: string;\n    errorlight: string;\n    error: string;\n    errordark: string;\n    secondarylight: string;\n    secondary: string;\n    secondarydark: string;\n    warninglight: string;\n    warning: string;\n    warningdark: string;\n    infolight: string;\n    info: string;\n    infodark: string;\n    welllight: string;\n    well: string;\n    white: string;\n    black: string;\n    hp: string;\n    money: string;\n    hack: string;\n    combat: string;\n    cha: string;\n    int: string;\n    rep: string;\n  };\n}\n\n/**\n * Represents all possible settings the player wants to customize to their play style.\n */\ninterface ISettings extends IDefaultSettings {\n  /**\n   * What order the player's owned Augmentations/Source Files should be displayed in\n   */\n  OwnedAugmentationsOrder: OwnedAugmentationsOrderSetting;\n\n  /**\n   * What order the Augmentations should be displayed in when purchasing from a Faction\n   */\n  PurchaseAugmentationsOrder: PurchaseAugmentationsOrderSetting;\n\n  MonacoTheme: string;\n\n  MonacoInsertSpaces: boolean;\n}\n\nexport const defaultSettings: IDefaultSettings = {\n  ActiveScriptsServerPageSize: 10,\n  ActiveScriptsScriptPageSize: 10,\n  AutosaveInterval: 60,\n  CodeInstructionRunTime: 50,\n  DisableASCIIArt: false,\n  DisableHotkeys: false,\n  DisableTextEffects: false,\n  EnableBashHotkeys: false,\n  EnableTimestamps: false,\n  Locale: \"en\",\n  MaxLogCapacity: 50,\n  MaxPortCapacity: 50,\n  MaxTerminalCapacity: 200,\n  SuppressBuyAugmentationConfirmation: false,\n  SuppressFactionInvites: false,\n  SuppressHospitalizationPopup: false,\n  SuppressMessages: false,\n  SuppressTravelConfirmation: false,\n  SuppressBladeburnerPopup: false,\n\n  theme: {\n    primarylight: \"#0f0\",\n    primary: \"#0c0\",\n    primarydark: \"#090\",\n    errorlight: \"#f00\",\n    error: \"#c00\",\n    errordark: \"#900\",\n    secondarylight: \"#AAA\",\n    secondary: \"#888\",\n    secondarydark: \"#666\",\n    warninglight: \"#ff0\",\n    warning: \"#cc0\",\n    warningdark: \"#990\",\n    infolight: \"#69f\",\n    info: \"#36c\",\n    infodark: \"#039\",\n    welllight: \"#444\",\n    well: \"#222\",\n    white: \"#fff\",\n    black: \"#000\",\n    hp: \"#dd3434\",\n    money: \"#ffd700\",\n    hack: \"#adff2f\",\n    combat: \"#faffdf\",\n    cha: \"#a671d1\",\n    int: \"#6495ed\",\n    rep: \"#faffdf\",\n  },\n};\n\n/**\n * The current options the player has customized to their play style.\n */\n// tslint:disable-next-line:variable-name\nexport const Settings: ISettings & ISelfInitializer & ISelfLoading = {\n  ActiveScriptsServerPageSize: defaultSettings.ActiveScriptsServerPageSize,\n  ActiveScriptsScriptPageSize: defaultSettings.ActiveScriptsScriptPageSize,\n  AutosaveInterval: defaultSettings.AutosaveInterval,\n  CodeInstructionRunTime: 25,\n  DisableASCIIArt: defaultSettings.DisableASCIIArt,\n  DisableHotkeys: defaultSettings.DisableHotkeys,\n  DisableTextEffects: defaultSettings.DisableTextEffects,\n  EnableBashHotkeys: defaultSettings.EnableBashHotkeys,\n  EnableTimestamps: defaultSettings.EnableTimestamps,\n  Locale: \"en\",\n  MaxLogCapacity: defaultSettings.MaxLogCapacity,\n  MaxPortCapacity: defaultSettings.MaxPortCapacity,\n  MaxTerminalCapacity: defaultSettings.MaxTerminalCapacity,\n  OwnedAugmentationsOrder: OwnedAugmentationsOrderSetting.AcquirementTime,\n  PurchaseAugmentationsOrder: PurchaseAugmentationsOrderSetting.Default,\n  SuppressBuyAugmentationConfirmation: defaultSettings.SuppressBuyAugmentationConfirmation,\n  SuppressFactionInvites: defaultSettings.SuppressFactionInvites,\n  SuppressHospitalizationPopup: defaultSettings.SuppressHospitalizationPopup,\n  SuppressMessages: defaultSettings.SuppressMessages,\n  SuppressTravelConfirmation: defaultSettings.SuppressTravelConfirmation,\n  SuppressBladeburnerPopup: defaultSettings.SuppressBladeburnerPopup,\n  MonacoTheme: \"vs-dark\",\n  MonacoInsertSpaces: false,\n\n  theme: {\n    primarylight: defaultSettings.theme.primarylight,\n    primary: defaultSettings.theme.primary,\n    primarydark: defaultSettings.theme.primarydark,\n    errorlight: defaultSettings.theme.errorlight,\n    error: defaultSettings.theme.error,\n    errordark: defaultSettings.theme.errordark,\n    secondarylight: defaultSettings.theme.secondarylight,\n    secondary: defaultSettings.theme.secondary,\n    secondarydark: defaultSettings.theme.secondarydark,\n    warninglight: defaultSettings.theme.warninglight,\n    warning: defaultSettings.theme.warning,\n    warningdark: defaultSettings.theme.warningdark,\n    infolight: defaultSettings.theme.infolight,\n    info: defaultSettings.theme.info,\n    infodark: defaultSettings.theme.infodark,\n    welllight: defaultSettings.theme.welllight,\n    well: defaultSettings.theme.well,\n    white: defaultSettings.theme.white,\n    black: defaultSettings.theme.black,\n    hp: defaultSettings.theme.hp,\n    money: defaultSettings.theme.money,\n    hack: defaultSettings.theme.hack,\n    combat: defaultSettings.theme.combat,\n    cha: defaultSettings.theme.cha,\n    int: defaultSettings.theme.int,\n    rep: defaultSettings.theme.rep,\n  },\n  init() {\n    Object.assign(Settings, defaultSettings);\n  },\n  load(saveString: string) {\n    Object.assign(Settings, JSON.parse(saveString));\n  },\n};\n","import { Augmentation } from \"./Augmentation\";\nimport { IMap } from \"../types\";\n\nexport const Augmentations: IMap = {};\n","/* Generic Reviver, toJSON, and fromJSON functions used for saving and loading objects */\n\n// A generic \"smart reviver\" function.\n// Looks for object values with a `ctor` property and\n// a `data` property. If it finds them, and finds a matching\n// constructor that has a `fromJSON` property on it, it hands\n// off to that `fromJSON` fuunction, passing in the value.\nfunction Reviver(key, value) {\n  var ctor;\n  if (value == null) {\n    console.log(\"Reviver WRONGLY called with key: \" + key + \", and value: \" + value);\n    return 0;\n  }\n\n  if (typeof value === \"object\" && typeof value.ctor === \"string\" && typeof value.data !== \"undefined\") {\n    // Compatibility for version v0.43.1\n    // TODO Remove this eventually\n    if (value.ctor === \"AllServersMap\") {\n      console.log(\"Converting AllServersMap for v0.43.1\");\n      return value.data;\n    }\n\n    ctor = Reviver.constructors[value.ctor] || window[value.ctor];\n\n    if (typeof ctor === \"function\" && typeof ctor.fromJSON === \"function\") {\n      return ctor.fromJSON(value);\n    }\n  }\n  return value;\n}\nReviver.constructors = {}; // A list of constructors the smart reviver should know about\n\n// A generic \"toJSON\" function that creates the data expected\n// by Reviver.\n// `ctorName`  The name of the constructor to use to revive it\n// `obj`       The object being serialized\n// `keys`      (Optional) Array of the properties to serialize,\n//             if not given then all of the objects \"own\" properties\n//             that don't have function values will be serialized.\n//             (Note: If you list a property in `keys`, it will be serialized\n//             regardless of whether it's an \"own\" property.)\n// Returns:    The structure (which will then be turned into a string\n//             as part of the JSON.stringify algorithm)\nfunction Generic_toJSON(ctorName, obj, keys) {\n  var data, key;\n\n  if (!keys) {\n    keys = Object.keys(obj); // Only \"own\" properties are included\n  }\n\n  data = {};\n  for (let index = 0; index < keys.length; ++index) {\n    key = keys[index];\n    data[key] = obj[key];\n  }\n  return { ctor: ctorName, data: data };\n}\n\n// A generic \"fromJSON\" function for use with Reviver: Just calls the\n// constructor function with no arguments, then applies all of the\n// key/value pairs from the raw data to the instance. Only useful for\n// constructors that can be reasonably called without arguments!\n// `ctor`      The constructor to call\n// `data`      The data to apply\n// Returns:    The object\nfunction Generic_fromJSON(ctor, data) {\n  var obj, name;\n\n  obj = new ctor();\n  for (name in data) {\n    obj[name] = data[name];\n  }\n  return obj;\n}\n\nexport { Reviver, Generic_toJSON, Generic_fromJSON };\n","/**\n * Gets a random integer bounded by the values passed in.\n * @param min The minimum value in the range.\n * @param max The maximum value in the range.\n */\nexport function getRandomInt(min: number, max: number): number {\n  const lower: number = Math.min(min, max);\n  const upper: number = Math.max(min, max);\n\n  return Math.floor(Math.random() * (upper - lower + 1)) + lower;\n}\n","/**\n * Create a pop-up dialog box using React.\n *\n * Calling this function with the same ID and React Root Component will trigger a re-render\n *\n * @param id The (hopefully) unique identifier for the popup container\n * @param rootComponent Root React Component for the content (NOT the popup containers themselves)\n */\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\n\nimport { Popup } from \"./Popup\";\n\nimport { createElement } from \"../../../utils/uiHelpers/createElement\";\nimport { removeElementById } from \"../../../utils/uiHelpers/removeElementById\";\n\nlet gameContainer: HTMLElement;\n\n(function () {\n  function getGameContainer(): void {\n    const container = document.getElementById(\"entire-game-container\");\n    if (container == null) {\n      throw new Error(`Failed to find game container DOM element`);\n    }\n\n    gameContainer = container;\n    document.removeEventListener(\"DOMContentLoaded\", getGameContainer);\n  }\n\n  document.addEventListener(\"DOMContentLoaded\", getGameContainer);\n})();\n\n// This variable is used to avoid setting the semi-transparent background\n// several times on top of one another. Sometimes there's several popup at once.\nlet deepestPopupId = \"\";\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function createPopup(\n  id: string,\n  rootComponent: (props: T) => React.ReactElement,\n  props: T,\n  onClose?: () => void,\n): HTMLElement | null {\n  let container = document.getElementById(id);\n  if (container == null) {\n    function onClick(this: HTMLElement, event: MouseEvent): void {\n      if (!event.srcElement) return;\n      if (!(event.srcElement instanceof HTMLElement)) return;\n      const clickedId = (event.srcElement as HTMLElement).id;\n      if (clickedId !== id) return;\n      removePopup(id);\n      if (onClose) onClose();\n    }\n    const backgroundColor = deepestPopupId === \"\" ? \"rgba(0,0,0,0.5)\" : \"rgba(0,0,0,0)\";\n    container = createElement(\"div\", {\n      class: \"popup-box-container\",\n      display: \"flex\",\n      id: id,\n      backgroundColor: backgroundColor,\n      mouseDown: onClick,\n    });\n\n    gameContainer.appendChild(container);\n  }\n\n  if (deepestPopupId === \"\") deepestPopupId = id;\n  ReactDOM.render(\n     {\n        removePopup(id);\n        if (onClose) onClose();\n      }}\n    />,\n    container,\n  );\n\n  return container;\n}\n\n/**\n * Closes a popup created with the createPopup() function above\n */\nexport function removePopup(id: string): void {\n  const content = document.getElementById(`${id}`);\n  if (content == null) return;\n\n  ReactDOM.unmountComponentAtNode(content);\n\n  removeElementById(id);\n  removeElementById(`${id}-close`);\n  if (id === deepestPopupId) deepestPopupId = \"\";\n}\n","/**\n * All possible Cities in the game. Names only, not actual \"City\" object\n * Implemented as an enum for typing purposes\n */\nexport enum CityName {\n  Aevum = \"Aevum\",\n  Chongqing = \"Chongqing\",\n  Ishima = \"Ishima\",\n  NewTokyo = \"New Tokyo\",\n  Sector12 = \"Sector-12\",\n  Volhaven = \"Volhaven\",\n}\n","/**\n * Initialization and manipulation of the Factions object, which stores data\n * about all Factions in the game\n */\nimport { Faction } from \"./Faction\";\nimport { FactionInfos } from \"./FactionInfo\";\n\nimport { IMap } from \"../types\";\n\nimport { Reviver } from \"../../utils/JSONReviver\";\n\nexport let Factions: IMap = {};\n\nexport function loadFactions(saveString: string): void {\n  Factions = JSON.parse(saveString, Reviver);\n}\n\nexport function AddToFactions(faction: Faction): void {\n  const name: string = faction.name;\n  Factions[name] = faction;\n}\n\nexport function factionExists(name: string): boolean {\n  return Factions.hasOwnProperty(name);\n}\n\nexport function initFactions(): void {\n  for (const name in FactionInfos) {\n    resetFaction(new Faction(name));\n  }\n}\n\n//Resets a faction during (re-)initialization. Saves the favor in the new\n//Faction object and deletes the old Faction Object from \"Factions\". Then\n//reinserts the new Faction object\nexport function resetFaction(newFactionObject: Faction): void {\n  if (!(newFactionObject instanceof Faction)) {\n    throw new Error(\"Invalid argument 'newFactionObject' passed into resetFaction()\");\n  }\n  const factionName: string = newFactionObject.name;\n  if (factionExists(factionName)) {\n    newFactionObject.favor = Factions[factionName].favor;\n    delete Factions[factionName];\n  }\n  AddToFactions(newFactionObject);\n}\n","// Defs for job titles, stored in arrays and categorized by job \"type\"\n\nexport const SoftwareCompanyPositions: string[] = [\n  \"Software Engineering Intern\",\n  \"Junior Software Engineer\",\n  \"Senior Software Engineer\",\n  \"Lead Software Developer\",\n  \"Head of Software\",\n  \"Head of Engineering\",\n  \"Vice President of Technology\",\n  \"Chief Technology Officer\",\n];\n\nexport const ITCompanyPositions: string[] = [\"IT Intern\", \"IT Analyst\", \"IT Manager\", \"Systems Administrator\"];\n\nexport const SecurityEngineerCompanyPositions: string[] = [\"Security Engineer\"];\n\nexport const NetworkEngineerCompanyPositions: string[] = [\"Network Engineer\", \"Network Administrator\"];\n\nexport const BusinessCompanyPositions: string[] = [\n  \"Business Intern\",\n  \"Business Analyst\",\n  \"Business Manager\",\n  \"Operations Manager\",\n  \"Chief Financial Officer\",\n  \"Chief Executive Officer\",\n];\n\nexport const SecurityCompanyPositions: string[] = [\n  \"Police Officer\",\n  \"Police Chief\",\n  \"Security Guard\",\n  \"Security Officer\",\n  \"Security Supervisor\",\n  \"Head of Security\",\n];\n\nexport const AgentCompanyPositions: string[] = [\"Field Agent\", \"Secret Agent\", \"Special Operative\"];\n\nexport const MiscCompanyPositions: string[] = [\"Waiter\", \"Employee\"];\n\nexport const SoftwareConsultantCompanyPositions: string[] = [\"Software Consultant\", \"Senior Software Consultant\"];\n\nexport const BusinessConsultantCompanyPositions: string[] = [\"Business Consultant\", \"Senior Business Consultant\"];\n\nexport const PartTimeCompanyPositions: string[] = [\"Part-time Waiter\", \"Part-time Employee\"];\n","/**\n * Basic stateless button\n * Uses the 'std-button' css class\n */\nimport * as React from \"react\";\n\ninterface IStdButtonProps {\n  addClasses?: string;\n  autoFocus?: boolean;\n  disabled?: boolean;\n  id?: string;\n  onClick?: (e: React.MouseEvent) => any;\n  onKeyUp?: (e: React.KeyboardEvent) => any;\n  style?: any;\n  text: string | JSX.Element;\n  tooltip?: string | JSX.Element;\n}\n\ntype IInnerHTMLMarkup = {\n  __html: string;\n};\n\nexport function StdButton(props: IStdButtonProps): React.ReactElement {\n  const hasTooltip = props.tooltip != null && props.tooltip !== \"\";\n  let className = props.disabled ? \"std-button-disabled\" : \"std-button\";\n  if (hasTooltip) {\n    className += \" tooltip\";\n  }\n\n  if (typeof props.addClasses === \"string\") {\n    className += ` ${props.addClasses}`;\n  }\n\n  // Tooltip will be set using inner HTML\n  let tooltip;\n  if (hasTooltip) {\n    if (typeof props.tooltip === \"string\") {\n      const tooltipMarkup: IInnerHTMLMarkup = {\n        __html: props.tooltip,\n      };\n      tooltip = ;\n    } else {\n      tooltip = {props.tooltip};\n    }\n  }\n\n  return (\n    \n  );\n}\n","import { Faction } from \"../Faction/Faction\";\nimport { Location } from \"../Locations/Location\";\n\n/**\n * The full-screen page the player is currently be on.\n * These pages are mutually exclusive.\n */\nexport enum Page {\n  ActiveScripts,\n  Augmentations,\n  BitVerse,\n  Bladeburner,\n  City,\n  Corporation,\n  CreateProgram,\n  CreateScript,\n  DevMenu,\n  Faction,\n  Factions,\n  Gang,\n  Hacknet,\n  Infiltration,\n  Job,\n  Milestones,\n  Options,\n  Resleeves,\n  Sleeves,\n  Stats,\n  StockMarket,\n  Terminal,\n  Travel,\n  Tutorial,\n  Work,\n  BladeburnerCinematic,\n  Location,\n  HackingMission,\n  Loading,\n}\n\n/**\n * This class keeps track of player navigation/routing within the game.\n */\nexport interface IRouter {\n  // toCinematicText(): void;\n  // toInfiltration(): void;\n  // toMission(): void;\n  // toRedPill(): void;\n  // toworkInProgress(): void;\n  page(): Page;\n  toActiveScripts(): void;\n  toAugmentations(): void;\n  toBitVerse(flume: boolean, quick: boolean): void;\n  toBladeburner(): void;\n  toStats(): void;\n  toCity(): void; // travel ? city ?\n  toCorporation(): void;\n  toCreateProgram(): void;\n  toDevMenu(): void;\n  toFaction(faction?: Faction): void; // faction name\n  toFactions(): void;\n  toGameOptions(): void;\n  toGang(): void;\n  toHacknetNodes(): void;\n  toInfiltration(location: Location): void;\n  toJob(): void;\n  toMilestones(): void;\n  toResleeves(): void;\n  toScriptEditor(filename?: string, code?: string): void;\n  toSleeves(): void;\n  toStockMarket(): void;\n  toTerminal(): void;\n  toTravel(): void;\n  toTutorial(): void;\n  toWork(): void;\n  toBladeburnerCinematic(): void;\n  toLocation(location: Location): void;\n  toHackingMission(faction: Faction): void;\n}\n","// Class definition for a single Augmentation object\nimport * as React from \"react\";\nimport { IMap } from \"../types\";\n\nimport { BitNodeMultipliers } from \"../BitNode/BitNodeMultipliers\";\nimport { Faction } from \"../Faction/Faction\";\nimport { Factions } from \"../Faction/Factions\";\nimport { numeralWrapper } from \"../ui/numeralFormat\";\nimport { Money } from \"../ui/React/Money\";\n\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\ninterface IConstructorParams {\n  info: string | JSX.Element;\n  stats?: JSX.Element;\n  isSpecial?: boolean;\n  moneyCost: number;\n  name: string;\n  prereqs?: string[];\n  repCost: number;\n\n  hacking_mult?: number;\n  strength_mult?: number;\n  defense_mult?: number;\n  dexterity_mult?: number;\n  agility_mult?: number;\n  charisma_mult?: number;\n  hacking_exp_mult?: number;\n  strength_exp_mult?: number;\n  defense_exp_mult?: number;\n  dexterity_exp_mult?: number;\n  agility_exp_mult?: number;\n  charisma_exp_mult?: number;\n  hacking_chance_mult?: number;\n  hacking_speed_mult?: number;\n  hacking_money_mult?: number;\n  hacking_grow_mult?: number;\n  company_rep_mult?: number;\n  faction_rep_mult?: number;\n  crime_money_mult?: number;\n  crime_success_mult?: number;\n  work_money_mult?: number;\n  hacknet_node_money_mult?: number;\n  hacknet_node_purchase_cost_mult?: number;\n  hacknet_node_ram_cost_mult?: number;\n  hacknet_node_core_cost_mult?: number;\n  hacknet_node_level_cost_mult?: number;\n  bladeburner_max_stamina_mult?: number;\n  bladeburner_stamina_gain_mult?: number;\n  bladeburner_analysis_mult?: number;\n  bladeburner_success_chance_mult?: number;\n\n  startingMoney?: number;\n  programs?: string[];\n}\n\nfunction generateStatsDescription(mults: IMap, programs?: string[], startingMoney?: number): JSX.Element {\n  const f = (x: number, decimals = 0): string => {\n    // look, I don't know how to make a \"smart decimals\"\n    // todo, make it smarter\n    if (x === 1.0777 - 1) return \"7.77%\";\n    if (x === 1.777 - 1) return \"77.7%\";\n    return numeralWrapper.formatPercentage(x, decimals);\n  };\n  let desc = <>Effects:;\n\n  if (\n    mults.hacking_mult &&\n    mults.hacking_mult == mults.strength_mult &&\n    mults.hacking_mult == mults.defense_mult &&\n    mults.hacking_mult == mults.dexterity_mult &&\n    mults.hacking_mult == mults.agility_mult &&\n    mults.hacking_mult == mults.charisma_mult\n  ) {\n    desc = (\n      <>\n        {desc}\n        
+{f(mults.hacking_mult - 1)} all skills\n \n );\n } else {\n if (mults.hacking_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.hacking_mult - 1)} hacking skill\n \n );\n\n if (\n mults.strength_mult &&\n mults.strength_mult == mults.defense_mult &&\n mults.strength_mult == mults.dexterity_mult &&\n mults.strength_mult == mults.agility_mult\n ) {\n desc = (\n <>\n {desc}\n
+{f(mults.strength_mult - 1)} combat skills\n \n );\n } else {\n if (mults.strength_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.strength_mult - 1)} strength skill\n \n );\n if (mults.defense_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.defense_mult - 1)} defense skill\n \n );\n if (mults.dexterity_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.dexterity_mult - 1)} dexterity skill\n \n );\n if (mults.agility_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.agility_mult - 1)} agility skill\n \n );\n }\n if (mults.charisma_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.charisma_mult - 1)} Charisma skill\n \n );\n }\n\n if (\n mults.hacking_exp_mult &&\n mults.hacking_exp_mult === mults.strength_exp_mult &&\n mults.hacking_exp_mult === mults.defense_exp_mult &&\n mults.hacking_exp_mult === mults.dexterity_exp_mult &&\n mults.hacking_exp_mult === mults.agility_exp_mult &&\n mults.hacking_exp_mult === mults.charisma_exp_mult\n ) {\n desc = (\n <>\n {desc}\n
+{f(mults.hacking_exp_mult - 1)} exp for all skills\n \n );\n } else {\n if (mults.hacking_exp_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.hacking_exp_mult - 1)} hacking exp\n \n );\n\n if (\n mults.strength_exp_mult &&\n mults.strength_exp_mult === mults.defense_exp_mult &&\n mults.strength_exp_mult === mults.dexterity_exp_mult &&\n mults.strength_exp_mult === mults.agility_exp_mult\n ) {\n desc = (\n <>\n {desc}\n
+{f(mults.strength_exp_mult - 1)} combat exp\n \n );\n } else {\n if (mults.strength_exp_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.strength_exp_mult - 1)} strength exp\n \n );\n if (mults.defense_exp_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.defense_exp_mult - 1)} defense exp\n \n );\n if (mults.dexterity_exp_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.dexterity_exp_mult - 1)} dexterity exp\n \n );\n if (mults.agility_exp_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.agility_exp_mult - 1)} agility exp\n \n );\n }\n if (mults.charisma_exp_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.charisma_exp_mult - 1)} charisma exp\n \n );\n }\n\n if (mults.hacking_speed_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.hacking_speed_mult - 1)} faster hack(), grow(), and weaken()\n \n );\n if (mults.hacking_chance_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.hacking_chance_mult - 1)} hack() success chance\n \n );\n if (mults.hacking_money_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.hacking_money_mult - 1)} hack() power\n \n );\n if (mults.hacking_grow_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.hacking_grow_mult - 1)} grow() power\n \n );\n\n if (mults.faction_rep_mult && mults.faction_rep_mult === mults.company_rep_mult) {\n desc = (\n <>\n {desc}\n
+{f(mults.faction_rep_mult - 1)} reputation from factions and companies\n \n );\n } else {\n if (mults.faction_rep_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.faction_rep_mult - 1)} reputation from factions\n \n );\n if (mults.company_rep_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.company_rep_mult - 1)} reputation from companies\n \n );\n }\n\n if (mults.crime_money_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.crime_money_mult - 1)} crime money\n \n );\n if (mults.crime_success_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.crime_success_mult - 1)} crime success rate\n \n );\n if (mults.work_money_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.work_money_mult - 1)} work money\n \n );\n\n if (mults.hacknet_node_money_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.hacknet_node_money_mult - 1)} hacknet production\n \n );\n if (mults.hacknet_node_purchase_cost_mult)\n desc = (\n <>\n {desc}\n
-{f(-(mults.hacknet_node_purchase_cost_mult - 1))} hacknet nodes cost\n \n );\n if (mults.hacknet_node_level_cost_mult)\n desc = (\n <>\n {desc}\n
-{f(-(mults.hacknet_node_level_cost_mult - 1))} hacknet nodes upgrade cost\n \n );\n\n if (mults.bladeburner_max_stamina_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.bladeburner_max_stamina_mult - 1)} Bladeburner Max Stamina\n \n );\n if (mults.bladeburner_stamina_gain_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.bladeburner_stamina_gain_mult - 1)} Bladeburner Stamina gain\n \n );\n if (mults.bladeburner_analysis_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.bladeburner_analysis_mult - 1)} Bladeburner Field Analysis effectiveness\n \n );\n if (mults.bladeburner_success_chance_mult)\n desc = (\n <>\n {desc}\n
+{f(mults.bladeburner_success_chance_mult - 1)} Bladeburner Contracts and Operations success chance\n \n );\n\n if (startingMoney)\n desc = (\n <>\n {desc}\n
\n Start with after installing Augmentations.\n \n );\n\n if (programs)\n desc = (\n <>\n {desc}\n
\n Start with {programs.join(\" and \")} after installing Augmentations.\n \n );\n return desc;\n}\n\nexport class Augmentation {\n // How much money this costs to buy\n baseCost = 0;\n\n // How much faction reputation is required to unlock this\n baseRepRequirement = 0;\n\n // Description of what this Aug is and what it does\n info: string | JSX.Element;\n\n // Description of the stats, often autogenerated, sometimes manually written.\n stats: JSX.Element;\n\n // Any Augmentation not immediately available in BitNode-1 is special (e.g. Bladeburner augs)\n isSpecial = false;\n\n // Augmentation level - for repeatable Augs like NeuroFlux Governor\n level = 0;\n\n // Name of Augmentation\n name = \"\";\n\n // Whether the player owns this Augmentation\n owned = false;\n\n // Array of names of all prerequisites\n prereqs: string[] = [];\n\n // Multipliers given by this Augmentation. Must match the property name in\n // The Player/Person classes\n mults: IMap = {};\n\n // Initial cost. Doesn't change when you purchase multiple Augmentation\n startingCost = 0;\n\n constructor(\n params: IConstructorParams = {\n info: \"\",\n moneyCost: 0,\n name: \"\",\n repCost: 0,\n },\n ) {\n this.name = params.name;\n this.info = params.info;\n this.prereqs = params.prereqs ? params.prereqs : [];\n\n this.baseRepRequirement = params.repCost * BitNodeMultipliers.AugmentationRepCost;\n this.baseCost = params.moneyCost * BitNodeMultipliers.AugmentationMoneyCost;\n this.startingCost = this.baseCost;\n\n if (params.isSpecial) {\n this.isSpecial = true;\n }\n\n this.level = 0;\n\n // Set multipliers\n if (params.hacking_mult) {\n this.mults.hacking_mult = params.hacking_mult;\n }\n if (params.strength_mult) {\n this.mults.strength_mult = params.strength_mult;\n }\n if (params.defense_mult) {\n this.mults.defense_mult = params.defense_mult;\n }\n if (params.dexterity_mult) {\n this.mults.dexterity_mult = params.dexterity_mult;\n }\n if (params.agility_mult) {\n this.mults.agility_mult = params.agility_mult;\n }\n if (params.charisma_mult) {\n this.mults.charisma_mult = params.charisma_mult;\n }\n if (params.hacking_exp_mult) {\n this.mults.hacking_exp_mult = params.hacking_exp_mult;\n }\n if (params.strength_exp_mult) {\n this.mults.strength_exp_mult = params.strength_exp_mult;\n }\n if (params.defense_exp_mult) {\n this.mults.defense_exp_mult = params.defense_exp_mult;\n }\n if (params.dexterity_exp_mult) {\n this.mults.dexterity_exp_mult = params.dexterity_exp_mult;\n }\n if (params.agility_exp_mult) {\n this.mults.agility_exp_mult = params.agility_exp_mult;\n }\n if (params.charisma_exp_mult) {\n this.mults.charisma_exp_mult = params.charisma_exp_mult;\n }\n if (params.hacking_chance_mult) {\n this.mults.hacking_chance_mult = params.hacking_chance_mult;\n }\n if (params.hacking_speed_mult) {\n this.mults.hacking_speed_mult = params.hacking_speed_mult;\n }\n if (params.hacking_money_mult) {\n this.mults.hacking_money_mult = params.hacking_money_mult;\n }\n if (params.hacking_grow_mult) {\n this.mults.hacking_grow_mult = params.hacking_grow_mult;\n }\n if (params.company_rep_mult) {\n this.mults.company_rep_mult = params.company_rep_mult;\n }\n if (params.faction_rep_mult) {\n this.mults.faction_rep_mult = params.faction_rep_mult;\n }\n if (params.crime_money_mult) {\n this.mults.crime_money_mult = params.crime_money_mult;\n }\n if (params.crime_success_mult) {\n this.mults.crime_success_mult = params.crime_success_mult;\n }\n if (params.work_money_mult) {\n this.mults.work_money_mult = params.work_money_mult;\n }\n if (params.hacknet_node_money_mult) {\n this.mults.hacknet_node_money_mult = params.hacknet_node_money_mult;\n }\n if (params.hacknet_node_purchase_cost_mult) {\n this.mults.hacknet_node_purchase_cost_mult = params.hacknet_node_purchase_cost_mult;\n }\n if (params.hacknet_node_ram_cost_mult) {\n this.mults.hacknet_node_ram_cost_mult = params.hacknet_node_ram_cost_mult;\n }\n if (params.hacknet_node_core_cost_mult) {\n this.mults.hacknet_node_core_cost_mult = params.hacknet_node_core_cost_mult;\n }\n if (params.hacknet_node_level_cost_mult) {\n this.mults.hacknet_node_level_cost_mult = params.hacknet_node_level_cost_mult;\n }\n if (params.bladeburner_max_stamina_mult) {\n this.mults.bladeburner_max_stamina_mult = params.bladeburner_max_stamina_mult;\n }\n if (params.bladeburner_stamina_gain_mult) {\n this.mults.bladeburner_stamina_gain_mult = params.bladeburner_stamina_gain_mult;\n }\n if (params.bladeburner_analysis_mult) {\n this.mults.bladeburner_analysis_mult = params.bladeburner_analysis_mult;\n }\n if (params.bladeburner_success_chance_mult) {\n this.mults.bladeburner_success_chance_mult = params.bladeburner_success_chance_mult;\n }\n\n if (params.stats) this.stats = params.stats;\n else this.stats = generateStatsDescription(this.mults, params.programs, params.startingMoney);\n }\n\n // Adds this Augmentation to the specified Factions\n addToFactions(factionList: string[]): void {\n for (let i = 0; i < factionList.length; ++i) {\n const faction: Faction | null = Factions[factionList[i]];\n if (faction == null) {\n console.warn(`In Augmentation.addToFactions(), could not find faction with this name: ${factionList[i]}`);\n continue;\n }\n faction.augmentations.push(this.name);\n }\n }\n\n // Adds this Augmentation to all Factions\n addToAllFactions(): void {\n for (const fac in Factions) {\n if (Factions.hasOwnProperty(fac)) {\n const facObj: Faction | null = Factions[fac];\n if (facObj == null) {\n console.warn(`Invalid Faction object in addToAllFactions(). Key value: ${fac}`);\n continue;\n }\n facObj.augmentations.push(this.name);\n }\n }\n }\n\n // Serialize the current object to a JSON save state.\n toJSON(): any {\n return Generic_toJSON(\"Augmentation\", this);\n }\n\n // Initiatizes a Augmentation object from a JSON save state.\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Augmentation {\n return Generic_fromJSON(Augmentation, value.data);\n }\n}\n\nReviver.constructors.Augmentation = Augmentation;\n","import { Server } from \"./Server\";\nimport { SpecialServerIps } from \"./SpecialServerIps\";\nimport { serverMetadata } from \"./data/servers\";\n\nimport { HacknetServer } from \"../Hacknet/HacknetServer\";\n\nimport { IMap } from \"../types\";\nimport { createRandomIp } from \"../../utils/IPAddress\";\nimport { getRandomInt } from \"../../utils/helpers/getRandomInt\";\nimport { Reviver } from \"../../utils/JSONReviver\";\n\n/**\n * Map of all Servers that exist in the game\n * Key (string) = IP\n * Value = Server object\n */\nexport let AllServers: IMap = {};\n\nexport function ipExists(ip: string): boolean {\n return AllServers[ip] != null;\n}\n\nexport function createUniqueRandomIp(): string {\n const ip = createRandomIp();\n\n // If the Ip already exists, recurse to create a new one\n if (ipExists(ip)) {\n return createRandomIp();\n }\n\n return ip;\n}\n\n// Saftely add a Server to the AllServers map\nexport function AddToAllServers(server: Server | HacknetServer): void {\n const serverIp = server.ip;\n if (ipExists(serverIp)) {\n console.warn(`IP of server that's being added: ${serverIp}`);\n console.warn(`Hostname of the server thats being added: ${server.hostname}`);\n console.warn(`The server that already has this IP is: ${AllServers[serverIp].hostname}`);\n throw new Error(\"Error: Trying to add a server with an existing IP\");\n }\n\n AllServers[serverIp] = server;\n}\n\ninterface IServerParams {\n hackDifficulty?: number;\n hostname: string;\n ip: string;\n maxRam?: number;\n moneyAvailable?: number;\n numOpenPortsRequired: number;\n organizationName: string;\n requiredHackingSkill?: number;\n serverGrowth?: number;\n\n [key: string]: any;\n}\n\nexport function initForeignServers(homeComputer: Server): void {\n /* Create a randomized network for all the foreign servers */\n //Groupings for creating a randomized network\n const networkLayers: Server[][] = [];\n for (let i = 0; i < 15; i++) {\n networkLayers.push([]);\n }\n\n // Essentially any property that is of type 'number | IMinMaxRange'\n const propertiesToPatternMatch: string[] = [\n \"hackDifficulty\",\n \"moneyAvailable\",\n \"requiredHackingSkill\",\n \"serverGrowth\",\n ];\n\n const toNumber = (value: any): any => {\n switch (typeof value) {\n case \"number\":\n return value;\n case \"object\":\n return getRandomInt(value.min, value.max);\n default:\n throw Error(`Do not know how to convert the type '${typeof value}' to a number`);\n }\n };\n\n for (const metadata of serverMetadata) {\n const serverParams: IServerParams = {\n hostname: metadata.hostname,\n ip: createUniqueRandomIp(),\n numOpenPortsRequired: metadata.numOpenPortsRequired,\n organizationName: metadata.organizationName,\n };\n\n if (metadata.maxRamExponent !== undefined) {\n serverParams.maxRam = Math.pow(2, toNumber(metadata.maxRamExponent));\n }\n\n for (const prop of propertiesToPatternMatch) {\n if (metadata[prop] !== undefined) {\n serverParams[prop] = toNumber(metadata[prop]);\n }\n }\n\n const server = new Server(serverParams);\n for (const filename of metadata.literature || []) {\n server.messages.push(filename);\n }\n\n if (metadata.specialName !== undefined) {\n SpecialServerIps.addIp(metadata.specialName, server.ip);\n }\n\n AddToAllServers(server);\n if (metadata.networkLayer !== undefined) {\n networkLayers[toNumber(metadata.networkLayer) - 1].push(server);\n }\n }\n\n /* Create a randomized network for all the foreign servers */\n const linkComputers = (server1: Server, server2: Server): void => {\n server1.serversOnNetwork.push(server2.ip);\n server2.serversOnNetwork.push(server1.ip);\n };\n\n const getRandomArrayItem = (arr: any[]): any => arr[Math.floor(Math.random() * arr.length)];\n\n const linkNetworkLayers = (network1: Server[], selectServer: () => Server): void => {\n for (const server of network1) {\n linkComputers(server, selectServer());\n }\n };\n\n // Connect the first tier of servers to the player's home computer\n linkNetworkLayers(networkLayers[0], () => homeComputer);\n for (let i = 1; i < networkLayers.length; i++) {\n linkNetworkLayers(networkLayers[i], () => getRandomArrayItem(networkLayers[i - 1]));\n }\n}\n\nexport function prestigeAllServers(): void {\n for (const member in AllServers) {\n delete AllServers[member];\n }\n AllServers = {};\n}\n\nexport function loadAllServers(saveString: string): void {\n AllServers = JSON.parse(saveString, Reviver);\n}\n","export const HacknetNodeConstants: {\n // Constants for Hacknet Node production\n MoneyGainPerLevel: number;\n\n // Constants for Hacknet Node purchase/upgrade costs\n BaseCost: number;\n LevelBaseCost: number;\n RamBaseCost: number;\n CoreBaseCost: number;\n\n PurchaseNextMult: number;\n UpgradeLevelMult: number;\n UpgradeRamMult: number;\n UpgradeCoreMult: number;\n\n // Constants for max upgrade levels for Hacknet Nodes\n MaxLevel: number;\n MaxRam: number;\n MaxCores: number;\n} = {\n MoneyGainPerLevel: 1.6,\n\n BaseCost: 1000,\n LevelBaseCost: 1,\n RamBaseCost: 30e3,\n CoreBaseCost: 500e3,\n\n PurchaseNextMult: 1.85,\n UpgradeLevelMult: 1.04,\n UpgradeRamMult: 1.28,\n UpgradeCoreMult: 1.48,\n\n MaxLevel: 200,\n MaxRam: 64,\n MaxCores: 16,\n};\n\nexport const PurchaseMultipliers: {\n [key: string]: number | string | undefined;\n x1: number;\n x5: number;\n x10: number;\n MAX: string;\n} = {\n x1: 1,\n x5: 5,\n x10: 10,\n MAX: \"MAX\",\n};\n\nexport const HacknetServerConstants: {\n // Constants for Hacknet Server stats/production\n HashesPerLevel: number;\n\n // Constants for Hacknet Server purchase/upgrade costs\n BaseCost: number;\n RamBaseCost: number;\n CoreBaseCost: number;\n CacheBaseCost: number;\n\n PurchaseMult: number; // Multiplier for puchasing an additional Hacknet Server\n UpgradeLevelMult: number; // Multiplier for cost when upgrading level\n UpgradeRamMult: number; // Multiplier for cost when upgrading RAM\n UpgradeCoreMult: number; // Multiplier for cost when buying another core\n UpgradeCacheMult: number; // Multiplier for cost when upgrading cache\n MaxServers: number; // Max number of Hacknet Servers you can own\n\n // Constants for max upgrade levels for Hacknet Server\n MaxLevel: number;\n MaxRam: number;\n MaxCores: number;\n MaxCache: number;\n} = {\n HashesPerLevel: 0.001,\n\n BaseCost: 50e3,\n RamBaseCost: 200e3,\n CoreBaseCost: 1e6,\n CacheBaseCost: 10e6,\n\n PurchaseMult: 3.2,\n UpgradeLevelMult: 1.1,\n UpgradeRamMult: 1.4,\n UpgradeCoreMult: 1.55,\n UpgradeCacheMult: 1.85,\n\n MaxServers: 20,\n\n MaxLevel: 300,\n MaxRam: 8192,\n MaxCores: 128,\n MaxCache: 15,\n};\n","// Action Identifier enum\nexport const ActionTypes: {\n [key: string]: number;\n Idle: number;\n Contract: number;\n Operation: number;\n BlackOp: number;\n BlackOperation: number;\n Training: number;\n Recruitment: number;\n FieldAnalysis: number;\n \"Field Analysis\": number;\n Diplomacy: number;\n \"Hyperbolic Regeneration Chamber\": number;\n} = {\n Idle: 1,\n Contract: 2,\n Operation: 3,\n BlackOp: 4,\n BlackOperation: 4,\n Training: 5,\n Recruitment: 6,\n FieldAnalysis: 7,\n \"Field Analysis\": 7,\n Diplomacy: 8,\n \"Hyperbolic Regeneration Chamber\": 9,\n};\n","import { Player } from \"./Player\";\n\nimport { LiteratureNames } from \"./Literature/data/LiteratureNames\";\n\nimport { ITutorialEvents } from \"./ui/InteractiveTutorial/ITutorialEvents\";\n\nimport { createElement } from \"../utils/uiHelpers/createElement\";\nimport { createPopup } from \"../utils/uiHelpers/createPopup\";\nimport { removeElementById } from \"../utils/uiHelpers/removeElementById\";\n\n// Ordered array of keys to Interactive Tutorial Steps\nenum iTutorialSteps {\n Start,\n GoToCharacterPage, // Click on 'Stats' page\n CharacterPage, // Introduction to 'Stats' page\n CharacterGoToTerminalPage, // Go back to Terminal\n TerminalIntro, // Introduction to Terminal\n TerminalHelp, // Using 'help' Terminal command\n TerminalLs, // Using 'ls' Terminal command\n TerminalScan, // Using 'scan' Terminal command\n TerminalScanAnalyze1, // Using 'scan-analyze' Terminal command\n TerminalScanAnalyze2, // Using 'scan-analyze 3' Terminal command\n TerminalConnect, // Connecting to n00dles\n TerminalAnalyze, // Analyzing n00dles\n TerminalNuke, // NUKE n00dles\n TerminalManualHack, // Hack n00dles\n TerminalHackingMechanics, // Explanation of hacking mechanics\n TerminalGoHome, // Go home before creating a script.\n TerminalCreateScript, // Create a script using 'nano'\n TerminalTypeScript, // Script Editor page - Type script and then save & close\n TerminalFree, // Using 'Free' Terminal command\n TerminalRunScript, // Running script using 'run' Terminal command\n TerminalGoToActiveScriptsPage,\n ActiveScriptsPage,\n ActiveScriptsToTerminal,\n TerminalTailScript,\n GoToHacknetNodesPage,\n HacknetNodesIntroduction,\n HacknetNodesGoToWorldPage,\n WorldDescription,\n TutorialPageInfo,\n End,\n}\n\nconst ITutorial: {\n currStep: iTutorialSteps;\n isRunning: boolean;\n stepIsDone: {\n [iTutorialSteps.Start]: boolean;\n [iTutorialSteps.GoToCharacterPage]: boolean;\n [iTutorialSteps.CharacterPage]: boolean;\n [iTutorialSteps.CharacterGoToTerminalPage]: boolean;\n [iTutorialSteps.TerminalIntro]: boolean;\n [iTutorialSteps.TerminalHelp]: boolean;\n [iTutorialSteps.TerminalLs]: boolean;\n [iTutorialSteps.TerminalScan]: boolean;\n [iTutorialSteps.TerminalScanAnalyze1]: boolean;\n [iTutorialSteps.TerminalScanAnalyze2]: boolean;\n [iTutorialSteps.TerminalConnect]: boolean;\n [iTutorialSteps.TerminalAnalyze]: boolean;\n [iTutorialSteps.TerminalNuke]: boolean;\n [iTutorialSteps.TerminalManualHack]: boolean;\n [iTutorialSteps.TerminalHackingMechanics]: boolean;\n [iTutorialSteps.TerminalGoHome]: boolean;\n [iTutorialSteps.TerminalCreateScript]: boolean;\n [iTutorialSteps.TerminalTypeScript]: boolean;\n [iTutorialSteps.TerminalFree]: boolean;\n [iTutorialSteps.TerminalRunScript]: boolean;\n [iTutorialSteps.TerminalGoToActiveScriptsPage]: boolean;\n [iTutorialSteps.ActiveScriptsPage]: boolean;\n [iTutorialSteps.ActiveScriptsToTerminal]: boolean;\n [iTutorialSteps.TerminalTailScript]: boolean;\n [iTutorialSteps.GoToHacknetNodesPage]: boolean;\n [iTutorialSteps.HacknetNodesIntroduction]: boolean;\n [iTutorialSteps.HacknetNodesGoToWorldPage]: boolean;\n [iTutorialSteps.WorldDescription]: boolean;\n [iTutorialSteps.TutorialPageInfo]: boolean;\n [iTutorialSteps.End]: boolean;\n };\n} = {\n currStep: iTutorialSteps.Start,\n isRunning: false,\n\n // Keeps track of whether each step has been done\n stepIsDone: {\n [iTutorialSteps.Start]: false,\n [iTutorialSteps.GoToCharacterPage]: false,\n [iTutorialSteps.CharacterPage]: false,\n [iTutorialSteps.CharacterGoToTerminalPage]: false,\n [iTutorialSteps.TerminalIntro]: false,\n [iTutorialSteps.TerminalHelp]: false,\n [iTutorialSteps.TerminalLs]: false,\n [iTutorialSteps.TerminalScan]: false,\n [iTutorialSteps.TerminalScanAnalyze1]: false,\n [iTutorialSteps.TerminalScanAnalyze2]: false,\n [iTutorialSteps.TerminalConnect]: false,\n [iTutorialSteps.TerminalAnalyze]: false,\n [iTutorialSteps.TerminalNuke]: false,\n [iTutorialSteps.TerminalManualHack]: false,\n [iTutorialSteps.TerminalHackingMechanics]: false,\n [iTutorialSteps.TerminalGoHome]: false,\n [iTutorialSteps.TerminalCreateScript]: false,\n [iTutorialSteps.TerminalTypeScript]: false,\n [iTutorialSteps.TerminalFree]: false,\n [iTutorialSteps.TerminalRunScript]: false,\n [iTutorialSteps.TerminalGoToActiveScriptsPage]: false,\n [iTutorialSteps.ActiveScriptsPage]: false,\n [iTutorialSteps.ActiveScriptsToTerminal]: false,\n [iTutorialSteps.TerminalTailScript]: false,\n [iTutorialSteps.GoToHacknetNodesPage]: false,\n [iTutorialSteps.HacknetNodesIntroduction]: false,\n [iTutorialSteps.HacknetNodesGoToWorldPage]: false,\n [iTutorialSteps.WorldDescription]: false,\n [iTutorialSteps.TutorialPageInfo]: false,\n [iTutorialSteps.End]: false,\n },\n};\n\nfunction iTutorialStart(): void {\n ITutorial.isRunning = true;\n}\n\n// Go to the next step and evaluate it\nfunction iTutorialNextStep(): void {\n ITutorial.stepIsDone[ITutorial.currStep] = true;\n if (ITutorial.currStep < iTutorialSteps.End) {\n ITutorial.currStep += 1;\n }\n if (ITutorial.currStep === iTutorialSteps.End) iTutorialEnd();\n ITutorialEvents.emit();\n}\n\n// Go to previous step and evaluate\nfunction iTutorialPrevStep(): void {\n if (ITutorial.currStep > iTutorialSteps.Start) {\n ITutorial.currStep -= 1;\n }\n ITutorialEvents.emit();\n}\n\nfunction iTutorialEnd(): void {\n ITutorial.isRunning = false;\n\n // Create a popup with final introductory stuff\n const popupId = \"interactive-tutorial-ending-popup\";\n const txt = createElement(\"p\", {\n innerHTML:\n \"If you are new to the game, the following links may be useful for you!

\" +\n \"Getting Started Guide\" +\n \"Documentation

\" +\n \"The Beginner's Guide to Hacking was added to your home computer! It contains some tips/pointers for starting out with the game. \" +\n \"To read it, go to Terminal and enter

cat \" +\n LiteratureNames.HackersStartingHandbook,\n });\n const gotitBtn = createElement(\"a\", {\n class: \"a-link-button\",\n float: \"right\",\n padding: \"6px\",\n innerText: \"Got it!\",\n clickListener: () => {\n removeElementById(popupId);\n },\n });\n createPopup(popupId, [txt, gotitBtn]);\n\n Player.getHomeComputer().messages.push(LiteratureNames.HackersStartingHandbook);\n ITutorialEvents.emit();\n}\n\nexport { iTutorialSteps, iTutorialEnd, iTutorialStart, iTutorialNextStep, ITutorial, iTutorialPrevStep };\n","const CyclesPerMarketCycle = 50;\nconst AllCorporationStates = [\"START\", \"PURCHASE\", \"PRODUCTION\", \"SALE\", \"EXPORT\"];\nexport const CorporationConstants: {\n INITIALSHARES: number;\n SHARESPERPRICEUPDATE: number;\n IssueNewSharesCooldown: number;\n SellSharesCooldown: number;\n CyclesPerMarketCycle: number;\n CyclesPerIndustryStateCycle: number;\n SecsPerMarketCycle: number;\n Cities: string[];\n WarehouseInitialCost: number;\n WarehouseInitialSize: number;\n WarehouseUpgradeBaseCost: number;\n OfficeInitialCost: number;\n OfficeInitialSize: number;\n OfficeUpgradeBaseCost: number;\n BribeThreshold: number;\n BribeToRepRatio: number;\n ProductProductionCostRatio: number;\n DividendMaxPercentage: number;\n EmployeeSalaryMultiplier: number;\n CyclesPerEmployeeRaise: number;\n EmployeeRaiseAmount: number;\n BaseMaxProducts: number;\n AllCorporationStates: string[];\n AllMaterials: string[];\n} = {\n INITIALSHARES: 1e9, //Total number of shares you have at your company\n SHARESPERPRICEUPDATE: 1e6, //When selling large number of shares, price is dynamically updated for every batch of this amount\n IssueNewSharesCooldown: 216e3, // 12 Hour in terms of game cycles\n SellSharesCooldown: 18e3, // 1 Hour in terms of game cycles\n\n CyclesPerMarketCycle: CyclesPerMarketCycle,\n CyclesPerIndustryStateCycle: CyclesPerMarketCycle / AllCorporationStates.length,\n SecsPerMarketCycle: CyclesPerMarketCycle / 5,\n\n Cities: [\"Aevum\", \"Chongqing\", \"Sector-12\", \"New Tokyo\", \"Ishima\", \"Volhaven\"],\n\n WarehouseInitialCost: 5e9, //Initial purchase cost of warehouse\n WarehouseInitialSize: 100,\n WarehouseUpgradeBaseCost: 1e9,\n\n OfficeInitialCost: 4e9,\n OfficeInitialSize: 3,\n OfficeUpgradeBaseCost: 1e9,\n\n BribeThreshold: 100e12, //Money needed to be able to bribe for faction rep\n BribeToRepRatio: 1e9, //Bribe Value divided by this = rep gain\n\n ProductProductionCostRatio: 5, //Ratio of material cost of a product to its production cost\n\n DividendMaxPercentage: 0.5,\n\n EmployeeSalaryMultiplier: 3, // Employee stats multiplied by this to determine initial salary\n CyclesPerEmployeeRaise: 400, // All employees get a raise every X market cycles\n EmployeeRaiseAmount: 50, // Employee salary increases by this (additive)\n\n BaseMaxProducts: 3, // Initial value for maximum number of products allowed\n AllCorporationStates: AllCorporationStates,\n AllMaterials: [\n \"Water\",\n \"Energy\",\n \"Food\",\n \"Plants\",\n \"Metal\",\n \"Hardware\",\n \"Chemicals\",\n \"Drugs\",\n \"Robots\",\n \"AI Cores\",\n \"Real Estate\",\n ],\n};\n","import { AllServers, createUniqueRandomIp, ipExists } from \"./AllServers\";\nimport { Server, IConstructorParams } from \"./Server\";\nimport { BaseServer } from \"./BaseServer\";\nimport { calculateServerGrowth } from \"./formulas/grow\";\n\nimport { BitNodeMultipliers } from \"../BitNode/BitNodeMultipliers\";\nimport { CONSTANTS } from \"../Constants\";\nimport { HacknetServer } from \"../Hacknet/HacknetServer\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { Programs } from \"../Programs/Programs\";\nimport { LiteratureNames } from \"../Literature/data/LiteratureNames\";\n\nimport { isValidNumber } from \"../utils/helpers/isValidNumber\";\nimport { isValidIPAddress } from \"../../utils/helpers/isValidIPAddress\";\n\n/**\n * Constructs a new server, while also ensuring that the new server\n * does not have a duplicate hostname/ip.\n */\nexport function safetlyCreateUniqueServer(params: IConstructorParams): Server {\n if (params.ip != null && ipExists(params.ip)) {\n params.ip = createUniqueRandomIp();\n }\n\n if (GetServerByHostname(params.hostname) != null) {\n // Use a for loop to ensure that we don't get suck in an infinite loop somehow\n let hostname: string = params.hostname;\n for (let i = 0; i < 200; ++i) {\n hostname = `${params.hostname}-${i}`;\n if (GetServerByHostname(hostname) == null) {\n break;\n }\n }\n params.hostname = hostname;\n }\n\n return new Server(params);\n}\n\n/**\n * Returns the number of \"growth cycles\" needed to grow the specified server by the\n * specified amount.\n * @param server - Server being grown\n * @param growth - How much the server is being grown by, in DECIMAL form (e.g. 1.5 rather than 50)\n * @param p - Reference to Player object\n * @returns Number of \"growth cycles\" needed\n */\nexport function numCycleForGrowth(server: Server, growth: number, p: IPlayer): number {\n let ajdGrowthRate = 1 + (CONSTANTS.ServerBaseGrowthRate - 1) / server.hackDifficulty;\n if (ajdGrowthRate > CONSTANTS.ServerMaxGrowthRate) {\n ajdGrowthRate = CONSTANTS.ServerMaxGrowthRate;\n }\n\n const serverGrowthPercentage = server.serverGrowth / 100;\n\n const cycles =\n Math.log(growth) /\n (Math.log(ajdGrowthRate) * p.hacking_grow_mult * serverGrowthPercentage * BitNodeMultipliers.ServerGrowthRate);\n\n return cycles;\n}\n\n//Applied server growth for a single server. Returns the percentage growth\nexport function processSingleServerGrowth(server: Server, threads: number, p: IPlayer, cores = 1): number {\n let serverGrowth = calculateServerGrowth(server, threads, p, cores);\n if (serverGrowth < 1) {\n console.warn(\"serverGrowth calculated to be less than 1\");\n serverGrowth = 1;\n }\n\n const oldMoneyAvailable = server.moneyAvailable;\n server.moneyAvailable *= serverGrowth;\n\n // in case of data corruption\n if (isValidNumber(server.moneyMax) && isNaN(server.moneyAvailable)) {\n server.moneyAvailable = server.moneyMax;\n }\n\n // cap at max\n if (isValidNumber(server.moneyMax) && server.moneyAvailable > server.moneyMax) {\n server.moneyAvailable = server.moneyMax;\n }\n\n // if there was any growth at all, increase security\n if (oldMoneyAvailable !== server.moneyAvailable) {\n //Growing increases server security twice as much as hacking\n let usedCycles = numCycleForGrowth(server, server.moneyAvailable / oldMoneyAvailable, p);\n usedCycles = Math.max(0, usedCycles);\n server.fortify(2 * CONSTANTS.ServerFortifyAmount * Math.ceil(usedCycles));\n }\n return server.moneyAvailable / oldMoneyAvailable;\n}\n\nexport function prestigeHomeComputer(homeComp: Server): void {\n const hasBitflume = homeComp.programs.includes(Programs.BitFlume.name);\n\n homeComp.programs.length = 0; //Remove programs\n homeComp.runningScripts = [];\n homeComp.serversOnNetwork = [];\n homeComp.isConnectedTo = true;\n homeComp.ramUsed = 0;\n homeComp.programs.push(Programs.NukeProgram.name);\n if (hasBitflume) {\n homeComp.programs.push(Programs.BitFlume.name);\n }\n\n //Update RAM usage on all scripts\n homeComp.scripts.forEach(function (script) {\n script.updateRamUsage(homeComp.scripts);\n });\n\n homeComp.messages.length = 0; //Remove .lit and .msg files\n homeComp.messages.push(LiteratureNames.HackersStartingHandbook);\n}\n\n//Returns server object with corresponding hostname\n// Relatively slow, would rather not use this a lot\nexport function GetServerByHostname(hostname: string): Server | HacknetServer | null {\n for (const ip in AllServers) {\n if (AllServers.hasOwnProperty(ip)) {\n if (AllServers[ip].hostname == hostname) {\n return AllServers[ip];\n }\n }\n }\n\n return null;\n}\n\n//Get server by IP or hostname. Returns null if invalid\nexport function getServer(s: string): Server | HacknetServer | null {\n if (!isValidIPAddress(s)) {\n return GetServerByHostname(s);\n }\n if (AllServers[s] !== undefined) {\n return AllServers[s];\n }\n\n return null;\n}\n\n// Returns the i-th server on the specified server's network\n// A Server's serverOnNetwork property holds only the IPs. This function returns\n// the actual Server object\nexport function getServerOnNetwork(server: BaseServer, i: number): Server | HacknetServer | null {\n if (i > server.serversOnNetwork.length) {\n console.error(\"Tried to get server on network that was out of range\");\n return null;\n }\n\n return AllServers[server.serversOnNetwork[i]];\n}\n\nexport function isBackdoorInstalled(server: Server | HacknetServer): boolean {\n if (\"backdoorInstalled\" in server) {\n return server.backdoorInstalled;\n }\n return false;\n}\n","import { IMap } from \"../types\";\n\nexport const EmployeePositions: IMap = {\n Operations: \"Operations\",\n Engineer: \"Engineer\",\n Business: \"Business\",\n Management: \"Management\",\n RandD: \"Research & Development\",\n Training: \"Training\",\n Unassigned: \"Unassigned\",\n};\n","import React from \"react\";\nimport { ResearchTree } from \"./ResearchTree\";\nimport { ICorporation } from \"./ICorporation\";\nimport { getBaseResearchTreeCopy, getProductIndustryResearchTreeCopy } from \"./data/BaseResearchTree\";\nimport { MoneyCost } from \"./ui/MoneyCost\";\n\ninterface IIndustryMap {\n [key: string]: T | undefined;\n Energy: T;\n Utilities: T;\n Agriculture: T;\n Fishing: T;\n Mining: T;\n Food: T;\n Tobacco: T;\n Chemical: T;\n Pharmaceutical: T;\n Computer: T;\n Robotics: T;\n Software: T;\n Healthcare: T;\n RealEstate: T;\n}\n\n// Map of official names for each Industry\nexport const Industries: IIndustryMap = {\n Energy: \"Energy\",\n Utilities: \"Water Utilities\",\n Agriculture: \"Agriculture\",\n Fishing: \"Fishing\",\n Mining: \"Mining\",\n Food: \"Food\",\n Tobacco: \"Tobacco\",\n Chemical: \"Chemical\",\n Pharmaceutical: \"Pharmaceutical\",\n Computer: \"Computer Hardware\",\n Robotics: \"Robotics\",\n Software: \"Software\",\n Healthcare: \"Healthcare\",\n RealEstate: \"RealEstate\",\n};\n\n// Map of how much money it takes to start each industry\nexport const IndustryStartingCosts: IIndustryMap = {\n Energy: 225e9,\n Utilities: 150e9,\n Agriculture: 40e9,\n Fishing: 80e9,\n Mining: 300e9,\n Food: 10e9,\n Tobacco: 20e9,\n Chemical: 70e9,\n Pharmaceutical: 200e9,\n Computer: 500e9,\n Robotics: 1e12,\n Software: 25e9,\n Healthcare: 750e9,\n RealEstate: 600e9,\n};\n\n// Map of description for each industry\nexport const IndustryDescriptions: IIndustryMap<(corp: ICorporation) => React.ReactElement> = {\n Energy: (corp: ICorporation) => (\n <>\n Engage in the production and distribution of energy.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: NO\n \n ),\n Utilities: (corp: ICorporation) => (\n <>\n Distribute water and provide wastewater services.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: NO\n \n ),\n Agriculture: (corp: ICorporation) => (\n <>\n Cultivate crops and breed livestock to produce food.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: YES\n \n ),\n Fishing: (corp: ICorporation) => (\n <>\n Produce food through the breeding and processing of fish and fish products.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: NO\n \n ),\n Mining: (corp: ICorporation) => (\n <>\n Extract and process metals from the earth.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: NO\n \n ),\n Food: (corp: ICorporation) => (\n <>\n Create your own restaurants all around the world.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: YES\n \n ),\n Tobacco: (corp: ICorporation) => (\n <>\n Create and distribute tobacco and tobacco-related products.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: YES\n \n ),\n Chemical: (corp: ICorporation) => (\n <>\n Produce industrial chemicals.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: NO\n \n ),\n Pharmaceutical: (corp: ICorporation) => (\n <>\n Discover, develop, and create new pharmaceutical drugs.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: NO\n \n ),\n Computer: (corp: ICorporation) => (\n <>\n Develop and manufacture new computer hardware and networking infrastructures.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: NO\n \n ),\n Robotics: (corp: ICorporation) => (\n <>\n Develop and create robots.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: NO\n \n ),\n Software: (corp: ICorporation) => (\n <>\n Develop computer software and create AI Cores.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: YES\n \n ),\n Healthcare: (corp: ICorporation) => (\n <>\n Create and manage hospitals.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: NO\n \n ),\n RealEstate: (corp: ICorporation) => (\n <>\n Develop and manage real estate properties.\n
\n
\n Starting cost: \n
\n Recommended starting Industry: NO\n \n ),\n};\n\n// Map of available Research for each Industry. This data is held in a\n// ResearchTree object\nexport const IndustryResearchTrees: IIndustryMap = {\n Energy: getBaseResearchTreeCopy(),\n Utilities: getBaseResearchTreeCopy(),\n Agriculture: getBaseResearchTreeCopy(),\n Fishing: getBaseResearchTreeCopy(),\n Mining: getBaseResearchTreeCopy(),\n Food: getProductIndustryResearchTreeCopy(),\n Tobacco: getProductIndustryResearchTreeCopy(),\n Chemical: getBaseResearchTreeCopy(),\n Pharmaceutical: getProductIndustryResearchTreeCopy(),\n Computer: getProductIndustryResearchTreeCopy(),\n Robotics: getProductIndustryResearchTreeCopy(),\n Software: getProductIndustryResearchTreeCopy(),\n Healthcare: getProductIndustryResearchTreeCopy(),\n RealEstate: getProductIndustryResearchTreeCopy(),\n};\n\nexport function resetIndustryResearchTrees(): void {\n IndustryResearchTrees.Energy = getBaseResearchTreeCopy();\n IndustryResearchTrees.Utilities = getBaseResearchTreeCopy();\n IndustryResearchTrees.Agriculture = getBaseResearchTreeCopy();\n IndustryResearchTrees.Fishing = getBaseResearchTreeCopy();\n IndustryResearchTrees.Mining = getBaseResearchTreeCopy();\n IndustryResearchTrees.Food = getBaseResearchTreeCopy();\n IndustryResearchTrees.Tobacco = getBaseResearchTreeCopy();\n IndustryResearchTrees.Chemical = getBaseResearchTreeCopy();\n IndustryResearchTrees.Pharmaceutical = getBaseResearchTreeCopy();\n IndustryResearchTrees.Computer = getBaseResearchTreeCopy();\n IndustryResearchTrees.Robotics = getBaseResearchTreeCopy();\n IndustryResearchTrees.Software = getBaseResearchTreeCopy();\n IndustryResearchTrees.Healthcare = getBaseResearchTreeCopy();\n IndustryResearchTrees.RealEstate = getBaseResearchTreeCopy();\n}\n","/**\n * Enum defining the different types of possible locations\n */\nexport enum LocationType {\n Company,\n Gym,\n Hospital,\n Slums,\n Special, // This location has special options/activities (e.g. Bladeburner, Re-sleeving)\n StockMarket,\n TechVendor,\n TravelAgency,\n University,\n Casino,\n}\n","export const BladeburnerConstants: {\n CityNames: string[];\n CyclesPerSecond: number;\n StaminaGainPerSecond: number;\n BaseStaminaLoss: number;\n MaxStaminaToGainFactor: number;\n DifficultyToTimeFactor: number;\n DiffMultExponentialFactor: number;\n DiffMultLinearFactor: number;\n EffAgiLinearFactor: number;\n EffDexLinearFactor: number;\n EffAgiExponentialFactor: number;\n EffDexExponentialFactor: number;\n BaseRecruitmentTimeNeeded: number;\n PopulationThreshold: number;\n PopulationExponent: number;\n ChaosThreshold: number;\n BaseStatGain: number;\n BaseIntGain: number;\n ActionCountGrowthPeriod: number;\n RankToFactionRepFactor: number;\n RankNeededForFaction: number;\n ContractSuccessesPerLevel: number;\n OperationSuccessesPerLevel: number;\n RanksPerSkillPoint: number;\n ContractBaseMoneyGain: number;\n HrcHpGain: number;\n HrcStaminaGain: number;\n} = {\n CityNames: [\"Aevum\", \"Chongqing\", \"Sector-12\", \"New Tokyo\", \"Ishima\", \"Volhaven\"],\n CyclesPerSecond: 5, // Game cycle is 200 ms\n\n StaminaGainPerSecond: 0.0085,\n BaseStaminaLoss: 0.285, // Base stamina loss per action. Increased based on difficulty\n MaxStaminaToGainFactor: 70000, // Max Stamina is divided by this to get bonus stamina gain\n\n DifficultyToTimeFactor: 10, // Action Difficulty divided by this to get base action time\n\n /**\n * The difficulty multiplier affects stamina loss and hp loss of an action. Also affects\n * experience gain. Its formula is:\n * difficulty ^ exponentialFactor + difficulty / linearFactor\n */\n DiffMultExponentialFactor: 0.28,\n DiffMultLinearFactor: 650,\n\n /**\n * These factors are used to calculate action time.\n * They affect how much action time is reduced based on your agility and dexterity\n */\n EffAgiLinearFactor: 10e3,\n EffDexLinearFactor: 10e3,\n EffAgiExponentialFactor: 0.04,\n EffDexExponentialFactor: 0.035,\n\n BaseRecruitmentTimeNeeded: 300, // Base time needed (s) to complete a Recruitment action\n\n PopulationThreshold: 1e9, // Population which determines baseline success rate\n PopulationExponent: 0.7, // Exponent that influences how different populations affect success rate\n ChaosThreshold: 50, // City chaos level after which it starts making tasks harder\n\n BaseStatGain: 1, // Base stat gain per second\n BaseIntGain: 0.003, // Base intelligence stat gain\n\n ActionCountGrowthPeriod: 480, // Time (s) it takes for action count to grow by its specified value\n\n RankToFactionRepFactor: 2, // Delta Faction Rep = this * Delta Rank\n RankNeededForFaction: 25,\n\n ContractSuccessesPerLevel: 3, // How many successes you need to level up a contract\n OperationSuccessesPerLevel: 2.5, // How many successes you need to level up an op\n\n RanksPerSkillPoint: 3, // How many ranks needed to get 1 Skill Point\n\n ContractBaseMoneyGain: 250e3, // Base Money Gained per contract\n\n HrcHpGain: 2, // HP Gained from Hyperbolic Regeneration chamber\n HrcStaminaGain: 1, // Percentage Stamina gained from Hyperbolic Regeneration Chamber\n};\n","import React, { useContext } from \"react\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { IRouter } from \"./Router\";\n\nexport const Context: {\n Player: React.Context;\n Router: React.Context;\n} = {\n Player: React.createContext({} as IPlayer),\n Router: React.createContext({} as IRouter),\n};\n\nexport const use: {\n Player: () => IPlayer;\n Router: () => IRouter;\n} = {\n Player: () => useContext(Context.Player),\n Router: () => useContext(Context.Router),\n};\n","import { IMap } from \"../../types\";\n\nexport const LiteratureNames: IMap = {\n HackersStartingHandbook: \"hackers-starting-handbook.lit\",\n CorporationManagementHandbook: \"corporation-management-handbook.lit\",\n HistoryOfSynthoids: \"history-of-synthoids.lit\",\n AGreenTomorrow: \"A-Green-Tomorrow.lit\",\n AlphaOmega: \"alpha-omega.lit\",\n SimulatedReality: \"simulated-reality.lit\",\n BeyondMan: \"beyond-man.lit\",\n BrighterThanTheSun: \"brighter-than-the-sun.lit\",\n DemocracyIsDead: \"democracy-is-dead.lit\",\n Sector12Crime: \"sector-12-crime.lit\",\n ManAndMachine: \"man-and-machine.lit\",\n SecretSocieties: \"secret-societies.lit\",\n TheFailedFrontier: \"the-failed-frontier.lit\",\n CodedIntelligence: \"coded-intelligence.lit\",\n SyntheticMuscles: \"synthetic-muscles.lit\",\n TensionsInTechRace: \"tensions-in-tech-race.lit\",\n CostOfImmortality: \"cost-of-immortality.lit\",\n TheHiddenWorld: \"the-hidden-world.lit\",\n TheNewGod: \"the-new-god.lit\",\n NewTriads: \"new-triads.lit\",\n TheSecretWar: \"the-secret-war.lit\",\n};\n","/**\n * Generic helper/utility functions for the Hacknet mechanic:\n * - Purchase nodes/upgrades\n * - Calculating maximum number of upgrades\n * - Processing Hacknet earnings\n * - Updating Hash Manager capacity\n * - Purchasing hash upgrades\n *\n * TODO Should probably split the different types of functions into their own modules\n */\nimport { HacknetNode } from \"./HacknetNode\";\nimport { calculateNodeCost } from \"./formulas/HacknetNodes\";\nimport { calculateServerCost } from \"./formulas/HacknetServers\";\nimport { HacknetNodeConstants, HacknetServerConstants } from \"./data/Constants\";\nimport { HacknetServer } from \"./HacknetServer\";\nimport { HashManager } from \"./HashManager\";\nimport { HashUpgrades } from \"./HashUpgrades\";\n\nimport { generateRandomContract } from \"../CodingContractGenerator\";\nimport { iTutorialSteps, iTutorialNextStep, ITutorial } from \"../InteractiveTutorial\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { AllServers } from \"../Server/AllServers\";\nimport { GetServerByHostname } from \"../Server/ServerHelpers\";\nimport { Server } from \"../Server/Server\";\nimport { SourceFileFlags } from \"../SourceFile/SourceFileFlags\";\n\n// Returns a boolean indicating whether the player has Hacknet Servers\n// (the upgraded form of Hacknet Nodes)\nexport function hasHacknetServers(player: IPlayer): boolean {\n return player.bitNodeN === 9 || SourceFileFlags[9] > 0;\n}\n\nexport function purchaseHacknet(player: IPlayer): number {\n /* INTERACTIVE TUTORIAL */\n if (ITutorial.isRunning) {\n if (ITutorial.currStep === iTutorialSteps.HacknetNodesIntroduction) {\n iTutorialNextStep();\n } else {\n return -1;\n }\n }\n /* END INTERACTIVE TUTORIAL */\n\n const numOwned = player.hacknetNodes.length;\n if (hasHacknetServers(player)) {\n const cost = getCostOfNextHacknetServer(player);\n if (isNaN(cost)) {\n throw new Error(`Calculated cost of purchasing HacknetServer is NaN`);\n }\n\n if (!player.canAfford(cost)) {\n return -1;\n }\n player.loseMoney(cost);\n player.createHacknetServer();\n updateHashManagerCapacity(player);\n\n return numOwned;\n } else {\n const cost = getCostOfNextHacknetNode(player);\n if (isNaN(cost)) {\n throw new Error(`Calculated cost of purchasing HacknetNode is NaN`);\n }\n\n if (!player.canAfford(cost)) {\n return -1;\n }\n\n // Auto generate a name for the Node\n const name = \"hacknet-node-\" + numOwned;\n const node = new HacknetNode(name, player.hacknet_node_money_mult);\n\n player.loseMoney(cost);\n player.hacknetNodes.push(node);\n\n return numOwned;\n }\n}\n\nexport function hasMaxNumberHacknetServers(player: IPlayer): boolean {\n return hasHacknetServers(player) && player.hacknetNodes.length >= HacknetServerConstants.MaxServers;\n}\n\nexport function getCostOfNextHacknetNode(player: IPlayer): number {\n return calculateNodeCost(player.hacknetNodes.length + 1, player.hacknet_node_purchase_cost_mult);\n}\n\nexport function getCostOfNextHacknetServer(player: IPlayer): number {\n return calculateServerCost(player.hacknetNodes.length + 1, player.hacknet_node_purchase_cost_mult);\n}\n\n// Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's level\nexport function getMaxNumberLevelUpgrades(\n player: IPlayer,\n nodeObj: HacknetNode | HacknetServer,\n maxLevel: number,\n): number {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberLevelUpgrades() called without maxLevel arg`);\n }\n\n if (player.money.lt(nodeObj.calculateLevelUpgradeCost(1, player.hacknet_node_level_cost_mult))) {\n return 0;\n }\n\n let min = 1;\n let max = maxLevel - 1;\n const levelsToMax = maxLevel - nodeObj.level;\n if (player.money.gt(nodeObj.calculateLevelUpgradeCost(levelsToMax, player.hacknet_node_level_cost_mult))) {\n return levelsToMax;\n }\n\n while (min <= max) {\n const curr = ((min + max) / 2) | 0;\n if (\n curr !== maxLevel &&\n player.money.gt(nodeObj.calculateLevelUpgradeCost(curr, player.hacknet_node_level_cost_mult)) &&\n player.money.lt(nodeObj.calculateLevelUpgradeCost(curr + 1, player.hacknet_node_level_cost_mult))\n ) {\n return Math.min(levelsToMax, curr);\n } else if (player.money.lt(nodeObj.calculateLevelUpgradeCost(curr, player.hacknet_node_level_cost_mult))) {\n max = curr - 1;\n } else if (player.money.gt(nodeObj.calculateLevelUpgradeCost(curr, player.hacknet_node_level_cost_mult))) {\n min = curr + 1;\n } else {\n return Math.min(levelsToMax, curr);\n }\n }\n return 0;\n}\n\n// Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's RAM\nexport function getMaxNumberRamUpgrades(\n player: IPlayer,\n nodeObj: HacknetNode | HacknetServer,\n maxLevel: number,\n): number {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberRamUpgrades() called without maxLevel arg`);\n }\n\n if (player.money.lt(nodeObj.calculateRamUpgradeCost(1, player.hacknet_node_ram_cost_mult))) {\n return 0;\n }\n\n let levelsToMax;\n if (nodeObj instanceof HacknetServer) {\n levelsToMax = Math.round(Math.log2(maxLevel / nodeObj.maxRam));\n } else {\n levelsToMax = Math.round(Math.log2(maxLevel / nodeObj.ram));\n }\n if (player.money.gt(nodeObj.calculateRamUpgradeCost(levelsToMax, player.hacknet_node_ram_cost_mult))) {\n return levelsToMax;\n }\n\n //We'll just loop until we find the max\n for (let i = levelsToMax - 1; i >= 0; --i) {\n if (player.money.gt(nodeObj.calculateRamUpgradeCost(i, player.hacknet_node_ram_cost_mult))) {\n return i;\n }\n }\n return 0;\n}\n\n// Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cores\nexport function getMaxNumberCoreUpgrades(\n player: IPlayer,\n nodeObj: HacknetNode | HacknetServer,\n maxLevel: number,\n): number {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberCoreUpgrades() called without maxLevel arg`);\n }\n\n if (player.money.lt(nodeObj.calculateCoreUpgradeCost(1, player.hacknet_node_core_cost_mult))) {\n return 0;\n }\n\n let min = 1;\n let max = maxLevel - 1;\n const levelsToMax = maxLevel - nodeObj.cores;\n if (player.money.gt(nodeObj.calculateCoreUpgradeCost(levelsToMax, player.hacknet_node_core_cost_mult))) {\n return levelsToMax;\n }\n\n // Use a binary search to find the max possible number of upgrades\n while (min <= max) {\n const curr = ((min + max) / 2) | 0;\n if (\n curr != maxLevel &&\n player.money.gt(nodeObj.calculateCoreUpgradeCost(curr, player.hacknet_node_core_cost_mult)) &&\n player.money.lt(nodeObj.calculateCoreUpgradeCost(curr + 1, player.hacknet_node_core_cost_mult))\n ) {\n return Math.min(levelsToMax, curr);\n } else if (player.money.lt(nodeObj.calculateCoreUpgradeCost(curr, player.hacknet_node_core_cost_mult))) {\n max = curr - 1;\n } else if (player.money.gt(nodeObj.calculateCoreUpgradeCost(curr, player.hacknet_node_core_cost_mult))) {\n min = curr + 1;\n } else {\n return Math.min(levelsToMax, curr);\n }\n }\n\n return 0;\n}\n\n// Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cache\nexport function getMaxNumberCacheUpgrades(player: IPlayer, nodeObj: HacknetServer, maxLevel: number): number {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberCacheUpgrades() called without maxLevel arg`);\n }\n\n if (!player.canAfford(nodeObj.calculateCacheUpgradeCost(1))) {\n return 0;\n }\n\n let min = 1;\n let max = maxLevel - 1;\n const levelsToMax = maxLevel - nodeObj.cache;\n if (player.canAfford(nodeObj.calculateCacheUpgradeCost(levelsToMax))) {\n return levelsToMax;\n }\n\n // Use a binary search to find the max possible number of upgrades\n while (min <= max) {\n const curr = ((min + max) / 2) | 0;\n if (\n curr != maxLevel &&\n player.canAfford(nodeObj.calculateCacheUpgradeCost(curr)) &&\n !player.canAfford(nodeObj.calculateCacheUpgradeCost(curr + 1))\n ) {\n return Math.min(levelsToMax, curr);\n } else if (!player.canAfford(nodeObj.calculateCacheUpgradeCost(curr))) {\n max = curr - 1;\n } else if (player.canAfford(nodeObj.calculateCacheUpgradeCost(curr))) {\n min = curr + 1;\n } else {\n return Math.min(levelsToMax, curr);\n }\n }\n\n return 0;\n}\n\nexport function purchaseLevelUpgrade(player: IPlayer, node: HacknetNode | HacknetServer, levels = 1): boolean {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateLevelUpgradeCost(sanitizedLevels, player.hacknet_node_level_cost_mult);\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n const isServer = node instanceof HacknetServer;\n\n // If we're at max level, return false\n if (node.level >= (isServer ? HacknetServerConstants.MaxLevel : HacknetNodeConstants.MaxLevel)) {\n return false;\n }\n\n // If the number of specified upgrades would exceed the max level, calculate\n // the maximum number of upgrades and use that\n if (node.level + sanitizedLevels > (isServer ? HacknetServerConstants.MaxLevel : HacknetNodeConstants.MaxLevel)) {\n const diff = Math.max(0, (isServer ? HacknetServerConstants.MaxLevel : HacknetNodeConstants.MaxLevel) - node.level);\n return purchaseLevelUpgrade(player, node, diff);\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeLevel(sanitizedLevels, player.hacknet_node_money_mult);\n\n return true;\n}\n\nexport function purchaseRamUpgrade(player: IPlayer, node: HacknetNode | HacknetServer, levels = 1): boolean {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateRamUpgradeCost(sanitizedLevels, player.hacknet_node_ram_cost_mult);\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n if (node instanceof HacknetServer && node.maxRam >= HacknetServerConstants.MaxRam) {\n return false;\n }\n\n if (node instanceof HacknetNode && node.ram >= HacknetNodeConstants.MaxRam) {\n return false;\n }\n\n // If the number of specified upgrades would exceed the max RAM, calculate the\n // max possible number of upgrades and use that\n if (node instanceof HacknetServer) {\n if (node.maxRam * Math.pow(2, sanitizedLevels) > HacknetServerConstants.MaxRam) {\n const diff = Math.max(0, Math.log2(Math.round(HacknetServerConstants.MaxRam / node.maxRam)));\n return purchaseRamUpgrade(player, node, diff);\n }\n } else if (node instanceof HacknetNode) {\n if (node.ram * Math.pow(2, sanitizedLevels) > HacknetNodeConstants.MaxRam) {\n const diff = Math.max(0, Math.log2(Math.round(HacknetNodeConstants.MaxRam / node.ram)));\n return purchaseRamUpgrade(player, node, diff);\n }\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeRam(sanitizedLevels, player.hacknet_node_money_mult);\n\n return true;\n}\n\nexport function purchaseCoreUpgrade(player: IPlayer, node: HacknetNode | HacknetServer, levels = 1): boolean {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateCoreUpgradeCost(sanitizedLevels, player.hacknet_node_core_cost_mult);\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n const isServer = node instanceof HacknetServer;\n\n // Fail if we're already at max\n if (node.cores >= (isServer ? HacknetServerConstants.MaxCores : HacknetNodeConstants.MaxCores)) {\n return false;\n }\n\n // If the specified number of upgrades would exceed the max Cores, calculate\n // the max possible number of upgrades and use that\n if (node.cores + sanitizedLevels > (isServer ? HacknetServerConstants.MaxCores : HacknetNodeConstants.MaxCores)) {\n const diff = Math.max(0, (isServer ? HacknetServerConstants.MaxCores : HacknetNodeConstants.MaxCores) - node.cores);\n return purchaseCoreUpgrade(player, node, diff);\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeCore(sanitizedLevels, player.hacknet_node_money_mult);\n\n return true;\n}\n\nexport function purchaseCacheUpgrade(player: IPlayer, node: HacknetServer, levels = 1): boolean {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateCacheUpgradeCost(sanitizedLevels);\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n if (!(node instanceof HacknetServer)) {\n console.warn(`purchaseCacheUpgrade() called for a non-HacknetNode`);\n return false;\n }\n\n // Fail if we're already at max\n if (node.cache + sanitizedLevels > HacknetServerConstants.MaxCache) {\n const diff = Math.max(0, HacknetServerConstants.MaxCache - node.cache);\n return purchaseCacheUpgrade(player, node, diff);\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeCache(sanitizedLevels);\n\n return true;\n}\n\nexport function processHacknetEarnings(player: IPlayer, numCycles: number): number {\n // Determine if player has Hacknet Nodes or Hacknet Servers, then\n // call the appropriate function\n if (player.hacknetNodes.length === 0) {\n return 0;\n }\n if (hasHacknetServers(player)) {\n return processAllHacknetServerEarnings(player, numCycles);\n } else if (player.hacknetNodes[0] instanceof HacknetNode) {\n return processAllHacknetNodeEarnings(player, numCycles);\n } else {\n return 0;\n }\n}\n\nfunction processAllHacknetNodeEarnings(player: IPlayer, numCycles: number): number {\n let total = 0;\n for (let i = 0; i < player.hacknetNodes.length; ++i) {\n const node = player.hacknetNodes[i];\n if (typeof node === \"string\") throw new Error(\"player node should not be ip string\");\n total += processSingleHacknetNodeEarnings(player, numCycles, node);\n }\n\n return total;\n}\n\nfunction processSingleHacknetNodeEarnings(player: IPlayer, numCycles: number, nodeObj: HacknetNode): number {\n const totalEarnings = nodeObj.process(numCycles);\n player.gainMoney(totalEarnings);\n player.recordMoneySource(totalEarnings, \"hacknetnode\");\n\n return totalEarnings;\n}\n\nfunction processAllHacknetServerEarnings(player: IPlayer, numCycles: number): number {\n if (!(player.hashManager instanceof HashManager)) {\n throw new Error(`Player does not have a HashManager (should be in 'hashManager' prop)`);\n }\n\n let hashes = 0;\n for (let i = 0; i < player.hacknetNodes.length; ++i) {\n // hacknetNodes array only contains the IP addresses of the servers.\n // Also, update the hash rate before processing\n const ip = player.hacknetNodes[i];\n if (ip instanceof HacknetNode) throw new Error(`player nodes should not be HacketNode`);\n const hserver = AllServers[ip];\n if (hserver instanceof Server) throw new Error(`player nodes shoud not be Server`);\n hserver.updateHashRate(player.hacknet_node_money_mult);\n const h = hserver.process(numCycles);\n hserver.totalHashesGenerated += h;\n hashes += h;\n }\n\n player.hashManager.storeHashes(hashes);\n\n return hashes;\n}\n\nexport function updateHashManagerCapacity(player: IPlayer): void {\n if (!(player.hashManager instanceof HashManager)) {\n console.error(`Player does not have a HashManager`);\n return;\n }\n\n const nodes = player.hacknetNodes;\n if (nodes.length === 0) {\n player.hashManager.updateCapacity(0);\n return;\n }\n\n let total = 0;\n for (let i = 0; i < nodes.length; ++i) {\n if (typeof nodes[i] !== \"string\") {\n player.hashManager.updateCapacity(0);\n return;\n }\n const ip = nodes[i];\n if (ip instanceof HacknetNode) throw new Error(`player nodes should be string but isn't`);\n const h = AllServers[ip];\n if (!(h instanceof HacknetServer)) {\n player.hashManager.updateCapacity(0);\n return;\n }\n\n total += h.hashCapacity;\n }\n\n player.hashManager.updateCapacity(total);\n}\n\nexport function purchaseHashUpgrade(player: IPlayer, upgName: string, upgTarget: string): boolean {\n if (!(player.hashManager instanceof HashManager)) {\n console.error(`Player does not have a HashManager`);\n return false;\n }\n\n // HashManager handles the transaction. This just needs to actually implement\n // the effects of the upgrade\n if (player.hashManager.upgrade(upgName)) {\n const upg = HashUpgrades[upgName];\n\n switch (upgName) {\n case \"Sell for Money\": {\n player.gainMoney(upg.value);\n player.recordMoneySource(upg.value, \"hacknetnode\");\n break;\n }\n case \"Sell for Corporation Funds\": {\n // This will throw if player doesn't have a corporation\n try {\n player.corporation.funds = player.corporation.funds.plus(upg.value);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n break;\n }\n case \"Reduce Minimum Security\": {\n try {\n const target = GetServerByHostname(upgTarget);\n if (target == null) {\n console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`);\n return false;\n }\n if (!(target instanceof Server)) throw new Error(`'${upgTarget}' is not a normal server.`);\n\n target.changeMinimumSecurity(upg.value, true);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n break;\n }\n case \"Increase Maximum Money\": {\n try {\n const target = GetServerByHostname(upgTarget);\n if (target == null) {\n console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`);\n return false;\n }\n if (!(target instanceof Server)) throw new Error(`'${upgTarget}' is not a normal server.`);\n\n target.changeMaximumMoney(upg.value, true);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n break;\n }\n case \"Improve Studying\": {\n // Multiplier handled by HashManager\n break;\n }\n case \"Improve Gym Training\": {\n // Multiplier handled by HashManager\n break;\n }\n case \"Exchange for Corporation Research\": {\n // This will throw if player doesn't have a corporation\n try {\n for (const division of player.corporation.divisions) {\n division.sciResearch.qty += upg.value;\n }\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n break;\n }\n case \"Exchange for Bladeburner Rank\": {\n // This will throw if player isnt in Bladeburner\n try {\n player.bladeburner.changeRank(player, upg.value);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n break;\n }\n case \"Exchange for Bladeburner SP\": {\n // This will throw if player isn't in Bladeburner\n try {\n // As long as we don't change `Bladeburner.totalSkillPoints`, this\n // shouldn't affect anything else\n player.bladeburner.skillPoints += upg.value;\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n break;\n }\n case \"Generate Coding Contract\": {\n generateRandomContract();\n break;\n }\n default:\n console.warn(`Unrecognized upgrade name ${upgName}. Upgrade has no effect`);\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n return true;\n }\n\n return false;\n}\n","// Constructs all CompanyPosition objects using the metadata in data/companypositions.ts\nimport { companiesMetadata } from \"./data/CompaniesMetadata\";\nimport { Company, IConstructorParams } from \"./Company\";\nimport { IMap } from \"../types\";\nimport { Reviver } from \"../../utils/JSONReviver\";\n\nexport let Companies: IMap = {};\n\nfunction addCompany(params: IConstructorParams): void {\n if (Companies[params.name] != null) {\n console.warn(`Duplicate Company Position being defined: ${params.name}`);\n }\n Companies[params.name] = new Company(params);\n}\n\n// Used to initialize new Company objects for the Companies map\n// Called when creating new game or after a prestige/reset\nexport function initCompanies(): void {\n // Save Old Company data for 'favor'\n const oldCompanies = Companies;\n\n // Re-construct all Companies\n Companies = {};\n companiesMetadata.forEach((e) => {\n addCompany(e);\n });\n\n // Reset data\n for (const companyName in Companies) {\n const company = Companies[companyName];\n const oldCompany = oldCompanies[companyName];\n if (!(oldCompany instanceof Company)) {\n // New game, so no OldCompanies data\n company.favor = 0;\n } else {\n company.favor = oldCompanies[companyName].favor;\n if (isNaN(company.favor)) {\n company.favor = 0;\n }\n }\n }\n}\n\n// Used to load Companies map from a save\nexport function loadCompanies(saveString: string): void {\n Companies = JSON.parse(saveString, Reviver);\n}\n\n// Utility function to check if a string is valid company name\nexport function companyExists(name: string): boolean {\n return Companies.hasOwnProperty(name);\n}\n","// Contains an array containing information about the player's source files\n// Array[n] returns what level the player has of Source-File N.\n\nimport { CONSTANTS } from \"../Constants\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\n\nexport const SourceFileFlags: number[] = Array(CONSTANTS.TotalNumBitNodes + 1); // Skip index 0\n\nexport function updateSourceFileFlags(p: IPlayer): void {\n for (let i = 0; i < SourceFileFlags.length; ++i) {\n SourceFileFlags[i] = 0;\n }\n\n for (let i = 0; i < p.sourceFiles.length; ++i) {\n const sf = p.sourceFiles[i];\n SourceFileFlags[sf.n] = sf.lvl;\n }\n}\n","import { IMap } from \"../types\";\nimport { Reviver, Generic_toJSON, Generic_fromJSON } from \"../../utils/JSONReviver\";\n\n/* Holds IP of Special Servers */\nexport const SpecialServerNames: IMap = {\n FulcrumSecretTechnologies: \"Fulcrum Secret Technologies Server\",\n CyberSecServer: \"CyberSec Server\",\n NiteSecServer: \"NiteSec Server\",\n TheBlackHandServer: \"The Black Hand Server\",\n BitRunnersServer: \"BitRunners Server\",\n TheDarkArmyServer: \"The Dark Army Server\",\n DaedalusServer: \"Daedalus Server\",\n WorldDaemon: \"w0r1d_d43m0n\",\n};\n\nexport class SpecialServerIpsMap {\n // eslint-disable-next-line @typescript-eslint/ban-types\n [key: string]: Function | string;\n\n addIp(name: string, ip: string): void {\n this[name] = ip;\n }\n\n getIp(name: string): string {\n return this[name] as string;\n }\n\n // Serialize the current object to a JSON save state\n toJSON(): any {\n return Generic_toJSON(\"SpecialServerIpsMap\", this);\n }\n\n // Initializes a SpecialServerIpsMap Object from a JSON save state\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): SpecialServerIpsMap {\n return Generic_fromJSON(SpecialServerIpsMap, value.data);\n }\n}\n\nReviver.constructors.SpecialServerIpsMap = SpecialServerIpsMap;\n\nexport let SpecialServerIps: SpecialServerIpsMap = new SpecialServerIpsMap();\n\nexport function prestigeSpecialServerIps(): void {\n for (const member in SpecialServerIps) {\n delete SpecialServerIps[member];\n }\n\n SpecialServerIps = new SpecialServerIpsMap();\n}\n\nexport function loadSpecialServerIps(saveString: string): void {\n SpecialServerIps = JSON.parse(saveString, Reviver);\n}\n\nexport function initSpecialServerIps(): void {\n SpecialServerIps = new SpecialServerIpsMap();\n}\n","export enum PositionTypes {\n Long = \"L\",\n Short = \"S\",\n}\n","import { ICorporation } from \"./ICorporation\";\nimport { IIndustry } from \"./IIndustry\";\nimport { IndustryStartingCosts, IndustryResearchTrees } from \"./IndustryData\";\nimport { Industry } from \"./Industry\";\nimport { CorporationConstants } from \"./data/Constants\";\nimport { OfficeSpace } from \"./OfficeSpace\";\nimport { Material } from \"./Material\";\nimport { Product } from \"./Product\";\nimport { Warehouse } from \"./Warehouse\";\nimport { CorporationUnlockUpgrade } from \"./data/CorporationUnlockUpgrades\";\nimport { CorporationUpgrade } from \"./data/CorporationUpgrades\";\nimport { Cities } from \"../Locations/Cities\";\nimport { EmployeePositions } from \"./EmployeePositions\";\nimport { Employee } from \"./Employee\";\nimport { IndustryUpgrades } from \"./IndustryUpgrades\";\nimport { ResearchMap } from \"./ResearchMap\";\n\nexport function NewIndustry(corporation: ICorporation, industry: string, name: string): void {\n for (let i = 0; i < corporation.divisions.length; ++i) {\n if (corporation.divisions[i].name === name) {\n throw new Error(\"This division name is already in use!\");\n return;\n }\n }\n\n const cost = IndustryStartingCosts[industry];\n if (cost === undefined) {\n throw new Error(`Invalid industry: '${industry}'`);\n }\n if (corporation.funds.lt(cost)) {\n throw new Error(\"Not enough money to create a new division in this industry\");\n } else if (name === \"\") {\n throw new Error(\"New division must have a name!\");\n } else {\n corporation.funds = corporation.funds.minus(cost);\n corporation.divisions.push(\n new Industry({\n corp: corporation,\n name: name,\n type: industry,\n }),\n );\n }\n}\n\nexport function NewCity(corporation: ICorporation, division: IIndustry, city: string): void {\n if (corporation.funds.lt(CorporationConstants.OfficeInitialCost)) {\n throw new Error(\"You don't have enough company funds to open a new office!\");\n } else {\n corporation.funds = corporation.funds.minus(CorporationConstants.OfficeInitialCost);\n division.offices[city] = new OfficeSpace({\n loc: city,\n size: CorporationConstants.OfficeInitialSize,\n });\n }\n}\n\nexport function UnlockUpgrade(corporation: ICorporation, upgrade: CorporationUnlockUpgrade): void {\n if (corporation.funds.lt(upgrade[1])) {\n throw new Error(\"Insufficient funds\");\n }\n corporation.unlock(upgrade);\n}\n\nexport function LevelUpgrade(corporation: ICorporation, upgrade: CorporationUpgrade): void {\n const baseCost = upgrade[1];\n const priceMult = upgrade[2];\n const level = corporation.upgrades[upgrade[0]];\n const cost = baseCost * Math.pow(priceMult, level);\n if (corporation.funds.lt(cost)) {\n throw new Error(\"Insufficient funds\");\n } else {\n corporation.upgrade(upgrade);\n }\n}\n\nexport function IssueDividends(corporation: ICorporation, percent: number): void {\n if (isNaN(percent) || percent < 0 || percent > CorporationConstants.DividendMaxPercentage) {\n throw new Error(`Invalid value. Must be an integer between 0 and ${CorporationConstants.DividendMaxPercentage}`);\n }\n\n corporation.dividendPercentage = percent * 100;\n}\n\nexport function SellMaterial(mat: Material, amt: string, price: string): void {\n if (price === \"\") price = \"0\";\n if (amt === \"\") amt = \"0\";\n let cost = price.replace(/\\s+/g, \"\");\n cost = cost.replace(/[^-()\\d/*+.MP]/g, \"\"); //Sanitize cost\n let temp = cost.replace(/MP/g, mat.bCost + \"\");\n try {\n temp = eval(temp);\n } catch (e) {\n throw new Error(\"Invalid value or expression for sell price field: \" + e);\n }\n\n if (temp == null || isNaN(parseFloat(temp))) {\n throw new Error(\"Invalid value or expression for sell price field\");\n }\n\n if (cost.includes(\"MP\")) {\n mat.sCost = cost; //Dynamically evaluated\n } else {\n mat.sCost = temp;\n }\n\n //Parse quantity\n if (amt.includes(\"MAX\") || amt.includes(\"PROD\")) {\n let q = amt.replace(/\\s+/g, \"\");\n q = q.replace(/[^-()\\d/*+.MAXPROD]/g, \"\");\n let tempQty = q.replace(/MAX/g, \"1\");\n tempQty = tempQty.replace(/PROD/g, \"1\");\n try {\n tempQty = eval(tempQty);\n } catch (e) {\n throw new Error(\"Invalid value or expression for sell price field: \" + e);\n }\n\n if (tempQty == null || isNaN(parseFloat(tempQty))) {\n throw new Error(\"Invalid value or expression for sell price field\");\n }\n\n mat.sllman[0] = true;\n mat.sllman[1] = q; //Use sanitized input\n } else if (isNaN(parseFloat(amt))) {\n throw new Error(\"Invalid value for sell quantity field! Must be numeric or 'MAX'\");\n } else {\n let q = parseFloat(amt);\n if (isNaN(q)) {\n q = 0;\n }\n if (q === 0) {\n mat.sllman[0] = false;\n mat.sllman[1] = 0;\n } else {\n mat.sllman[0] = true;\n mat.sllman[1] = q;\n }\n }\n}\n\nexport function SellProduct(product: Product, city: string, amt: string, price: string, all: boolean): void {\n //Parse price\n if (price.includes(\"MP\")) {\n //Dynamically evaluated quantity. First test to make sure its valid\n //Sanitize input, then replace dynamic variables with arbitrary numbers\n price = price.replace(/\\s+/g, \"\");\n price = price.replace(/[^-()\\d/*+.MP]/g, \"\");\n let temp = price.replace(/MP/g, \"1\");\n try {\n temp = eval(temp);\n } catch (e) {\n throw new Error(\"Invalid value or expression for sell quantity field: \" + e);\n }\n if (temp == null || isNaN(parseFloat(temp))) {\n throw new Error(\"Invalid value or expression for sell quantity field.\");\n }\n product.sCost = price; //Use sanitized price\n } else {\n const cost = parseFloat(price);\n if (isNaN(cost)) {\n throw new Error(\"Invalid value for sell price field\");\n }\n product.sCost = cost;\n }\n\n // Array of all cities. Used later\n const cities = Object.keys(Cities);\n\n // Parse quantity\n if (amt.includes(\"MAX\") || amt.includes(\"PROD\")) {\n //Dynamically evaluated quantity. First test to make sure its valid\n let qty = amt.replace(/\\s+/g, \"\");\n qty = qty.replace(/[^-()\\d/*+.MAXPROD]/g, \"\");\n let temp = qty.replace(/MAX/g, \"1\");\n temp = temp.replace(/PROD/g, \"1\");\n try {\n temp = eval(temp);\n } catch (e) {\n throw new Error(\"Invalid value or expression for sell price field: \" + e);\n }\n\n if (temp == null || isNaN(parseFloat(temp))) {\n throw new Error(\"Invalid value or expression for sell price field\");\n }\n if (all) {\n for (let i = 0; i < cities.length; ++i) {\n const tempCity = cities[i];\n product.sllman[tempCity][0] = true;\n product.sllman[tempCity][1] = qty; //Use sanitized input\n }\n } else {\n product.sllman[city][0] = true;\n product.sllman[city][1] = qty; //Use sanitized input\n }\n } else if (isNaN(parseFloat(amt))) {\n throw new Error(\"Invalid value for sell quantity field! Must be numeric\");\n } else {\n let qty = parseFloat(amt);\n if (isNaN(qty)) {\n qty = 0;\n }\n if (qty === 0) {\n if (all) {\n for (let i = 0; i < cities.length; ++i) {\n const tempCity = cities[i];\n product.sllman[tempCity][0] = false;\n product.sllman[tempCity][1] = \"\";\n }\n } else {\n product.sllman[city][0] = false;\n product.sllman[city][1] = \"\";\n }\n } else {\n if (all) {\n for (let i = 0; i < cities.length; ++i) {\n const tempCity = cities[i];\n product.sllman[tempCity][0] = true;\n product.sllman[tempCity][1] = qty;\n }\n } else {\n product.sllman[city][0] = true;\n product.sllman[city][1] = qty;\n }\n }\n }\n}\n\nexport function SetSmartSupply(warehouse: Warehouse, smartSupply: boolean): void {\n warehouse.smartSupplyEnabled = smartSupply;\n}\n\nexport function SetSmartSupplyUseLeftovers(warehouse: Warehouse, material: Material, useLeftover: boolean): void {\n if (!Object.keys(warehouse.smartSupplyUseLeftovers).includes(material.name))\n throw new Error(`Invalid material '${material.name}'`);\n warehouse.smartSupplyUseLeftovers[material.name] = useLeftover;\n}\n\nexport function BuyMaterial(material: Material, amt: number): void {\n if (isNaN(amt)) {\n throw new Error(`Invalid amount '${amt}' to buy material '${material.name}'`);\n }\n material.buy = amt;\n}\n\nexport function AssignJob(employee: Employee, job: string): void {\n if (!Object.values(EmployeePositions).includes(job)) throw new Error(`'${job}' is not a valid job.`);\n employee.pos = job;\n}\n\nexport function UpgradeOfficeSize(corp: ICorporation, office: OfficeSpace, size: number): void {\n const initialPriceMult = Math.round(office.size / CorporationConstants.OfficeInitialSize);\n const costMultiplier = 1.09;\n // Calculate cost to upgrade size by 15 employees\n let mult = 0;\n for (let i = 0; i < size / CorporationConstants.OfficeInitialSize; ++i) {\n mult += Math.pow(costMultiplier, initialPriceMult + i);\n }\n const cost = CorporationConstants.OfficeInitialCost * mult;\n if (corp.funds.lt(cost)) return;\n office.size += size;\n corp.funds = corp.funds.minus(cost);\n}\n\nexport function ThrowParty(corp: ICorporation, office: OfficeSpace, costPerEmployee: number): number {\n const totalCost = costPerEmployee * office.employees.length;\n if (corp.funds.lt(totalCost)) return 0;\n corp.funds = corp.funds.minus(totalCost);\n let mult = 0;\n for (let i = 0; i < office.employees.length; ++i) {\n mult = office.employees[i].throwParty(costPerEmployee);\n }\n\n return mult;\n}\n\nexport function PurchaseWarehouse(corp: ICorporation, division: IIndustry, city: string): void {\n if (corp.funds.lt(CorporationConstants.WarehouseInitialCost)) return;\n if (division.warehouses[city] instanceof Warehouse) return;\n division.warehouses[city] = new Warehouse({\n corp: corp,\n industry: division,\n loc: city,\n size: CorporationConstants.WarehouseInitialSize,\n });\n corp.funds = corp.funds.minus(CorporationConstants.WarehouseInitialCost);\n}\n\nexport function UpgradeWarehouse(corp: ICorporation, division: IIndustry, warehouse: Warehouse): void {\n const sizeUpgradeCost = CorporationConstants.WarehouseUpgradeBaseCost * Math.pow(1.07, warehouse.level + 1);\n ++warehouse.level;\n warehouse.updateSize(corp, division);\n corp.funds = corp.funds.minus(sizeUpgradeCost);\n}\n\nexport function BuyCoffee(corp: ICorporation, division: IIndustry, office: OfficeSpace): void {\n const upgrade = IndustryUpgrades[0];\n const cost = office.employees.length * upgrade[1];\n if (corp.funds.lt(cost)) return;\n corp.funds = corp.funds.minus(cost);\n division.upgrade(upgrade, {\n corporation: corp,\n office: office,\n });\n}\n\nexport function HireAdVert(corp: ICorporation, division: IIndustry, office: OfficeSpace): void {\n const upgrade = IndustryUpgrades[1];\n const cost = upgrade[1] * Math.pow(upgrade[2], division.upgrades[1]);\n if (corp.funds.lt(cost)) return;\n corp.funds = corp.funds.minus(cost);\n division.upgrade(upgrade, {\n corporation: corp,\n office: office,\n });\n}\n\nexport function MakeProduct(\n corp: ICorporation,\n division: IIndustry,\n city: string,\n productName: string,\n designInvest: number,\n marketingInvest: number,\n): void {\n if (designInvest < 0) {\n designInvest = 0;\n }\n if (marketingInvest < 0) {\n marketingInvest = 0;\n }\n if (productName == null || productName === \"\") {\n throw new Error(\"You must specify a name for your product!\");\n }\n if (isNaN(designInvest)) {\n throw new Error(\"Invalid value for design investment\");\n }\n if (isNaN(marketingInvest)) {\n throw new Error(\"Invalid value for marketing investment\");\n }\n if (corp.funds.lt(designInvest + marketingInvest)) {\n throw new Error(\"You don't have enough company funds to make this large of an investment\");\n }\n const product = new Product({\n name: productName.replace(/[<>]/g, \"\"), //Sanitize for HTMl elements\n createCity: city,\n designCost: designInvest,\n advCost: marketingInvest,\n });\n if (division.products[product.name] instanceof Product) {\n throw new Error(`You already have a product with this name!`);\n }\n corp.funds = corp.funds.minus(designInvest + marketingInvest);\n division.products[product.name] = product;\n}\n\nexport function Research(division: IIndustry, researchName: string): void {\n const researchTree = IndustryResearchTrees[division.type];\n if (researchTree === undefined) throw new Error(`No research tree for industry '${division.type}'`);\n const allResearch = researchTree.getAllNodes();\n if (!allResearch.includes(researchName)) throw new Error(`No research named '${researchName}'`);\n const research = ResearchMap[researchName];\n\n if (division.sciResearch.qty < research.cost)\n throw new Error(`You do not have enough Scientific Research for ${research.name}`);\n division.sciResearch.qty -= research.cost;\n\n // Get the Node from the Research Tree and set its 'researched' property\n researchTree.research(researchName);\n division.researched[researchName] = true;\n}\n\nexport function ExportMaterial(divisionName: string, cityName: string, material: Material, amt: string): void {\n // Sanitize amt\n let sanitizedAmt = amt.replace(/\\s+/g, \"\");\n sanitizedAmt = sanitizedAmt.replace(/[^-()\\d/*+.MAX]/g, \"\");\n let temp = sanitizedAmt.replace(/MAX/g, \"1\");\n try {\n temp = eval(temp);\n } catch (e) {\n throw new Error(\"Invalid expression entered for export amount: \" + e);\n }\n\n const n = parseFloat(temp);\n\n if (n == null || isNaN(n) || n < 0) {\n throw new Error(\"Invalid amount entered for export\");\n }\n const exportObj = { ind: divisionName, city: cityName, amt: sanitizedAmt };\n material.exp.push(exportObj);\n}\n\nexport function CancelExportMaterial(divisionName: string, cityName: string, material: Material, amt: string): void {\n for (let i = 0; i < material.exp.length; ++i) {\n if (material.exp[i].ind !== divisionName || material.exp[i].city !== cityName || material.exp[i].amt !== amt)\n continue;\n material.exp.splice(i, 1);\n break;\n }\n}\n\nexport function LimitProductProduction(product: Product, cityName: string, qty: number): void {\n if (qty < 0 || isNaN(qty)) {\n product.prdman[cityName][0] = false;\n } else {\n product.prdman[cityName][0] = true;\n product.prdman[cityName][1] = qty;\n }\n}\n\nexport function SetMaterialMarketTA1(material: Material, on: boolean): void {\n material.marketTa1 = on;\n}\n\nexport function SetMaterialMarketTA2(material: Material, on: boolean): void {\n material.marketTa2 = on;\n}\n\nexport function SetProductMarketTA1(product: Product, on: boolean): void {\n product.marketTa1 = on;\n}\n\nexport function SetProductMarketTA2(product: Product, on: boolean): void {\n product.marketTa2 = on;\n}\n","import { Program } from \"./Program\";\nimport { programsMetadata } from \"./data/ProgramsMetadata\";\nimport { IMap } from \"../types\";\n\nexport const Programs: IMap = {};\n\nfor (const params of programsMetadata) {\n Programs[params.key] = new Program(params.name, params.create, params.run);\n}\n","/**\n * Enum for different types of tasks that a Sleeve can perform\n */\nexport enum SleeveTaskType {\n // Same Order as selectable order in UI\n Idle,\n Company,\n Faction,\n Crime,\n Class,\n Gym,\n Recovery,\n Synchro,\n}\n","import { Crime } from \"./Crime\";\n\nimport { CONSTANTS } from \"../Constants\";\nimport { IMap } from \"../types\";\n\nexport const Crimes: IMap = {\n Shoplift: new Crime(\"Shoplift\", CONSTANTS.CrimeShoplift, 2e3, 15e3, 1 / 20, 0.1, {\n dexterity_success_weight: 1,\n agility_success_weight: 1,\n\n dexterity_exp: 2,\n agility_exp: 2,\n }),\n\n RobStore: new Crime(\"Rob Store\", CONSTANTS.CrimeRobStore, 60e3, 400e3, 1 / 5, 0.5, {\n hacking_exp: 30,\n dexterity_exp: 45,\n agility_exp: 45,\n\n hacking_success_weight: 0.5,\n dexterity_success_weight: 2,\n agility_success_weight: 1,\n\n intelligence_exp: 7.5 * CONSTANTS.IntelligenceCrimeBaseExpGain,\n }),\n\n Mug: new Crime(\"Mug\", CONSTANTS.CrimeMug, 4e3, 36e3, 1 / 5, 0.25, {\n strength_exp: 3,\n defense_exp: 3,\n dexterity_exp: 3,\n agility_exp: 3,\n\n strength_success_weight: 1.5,\n defense_success_weight: 0.5,\n dexterity_success_weight: 1.5,\n agility_success_weight: 0.5,\n }),\n\n Larceny: new Crime(\"Larceny\", CONSTANTS.CrimeLarceny, 90e3, 800e3, 1 / 3, 1.5, {\n hacking_exp: 45,\n dexterity_exp: 60,\n agility_exp: 60,\n\n hacking_success_weight: 0.5,\n dexterity_success_weight: 1,\n agility_success_weight: 1,\n\n intelligence_exp: 15 * CONSTANTS.IntelligenceCrimeBaseExpGain,\n }),\n\n DealDrugs: new Crime(\"Deal Drugs\", CONSTANTS.CrimeDrugs, 10e3, 120e3, 1, 0.5, {\n dexterity_exp: 5,\n agility_exp: 5,\n charisma_exp: 10,\n\n charisma_success_weight: 3,\n dexterity_success_weight: 2,\n agility_success_weight: 1,\n }),\n\n BondForgery: new Crime(\"Bond Forgery\", CONSTANTS.CrimeBondForgery, 300e3, 4.5e6, 1 / 2, 0.1, {\n hacking_exp: 100,\n dexterity_exp: 150,\n charisma_exp: 15,\n\n hacking_success_weight: 0.05,\n dexterity_success_weight: 1.25,\n\n intelligence_exp: 60 * CONSTANTS.IntelligenceCrimeBaseExpGain,\n }),\n\n TraffickArms: new Crime(\"Traffick Arms\", CONSTANTS.CrimeTraffickArms, 40e3, 600e3, 2, 1, {\n strength_exp: 20,\n defense_exp: 20,\n dexterity_exp: 20,\n agility_exp: 20,\n charisma_exp: 40,\n\n charisma_success_weight: 1,\n strength_success_weight: 1,\n defense_success_weight: 1,\n dexterity_success_weight: 1,\n agility_success_weight: 1,\n }),\n\n Homicide: new Crime(\"Homicide\", CONSTANTS.CrimeHomicide, 3e3, 45e3, 1, 3, {\n strength_exp: 2,\n defense_exp: 2,\n dexterity_exp: 2,\n agility_exp: 2,\n\n strength_success_weight: 2,\n defense_success_weight: 2,\n dexterity_success_weight: 0.5,\n agility_success_weight: 0.5,\n\n kills: 1,\n }),\n\n GrandTheftAuto: new Crime(\"Grand Theft Auto\", CONSTANTS.CrimeGrandTheftAuto, 80e3, 1.6e6, 8, 5, {\n strength_exp: 20,\n defense_exp: 20,\n dexterity_exp: 20,\n agility_exp: 80,\n charisma_exp: 40,\n\n hacking_success_weight: 1,\n strength_success_weight: 1,\n dexterity_success_weight: 4,\n agility_success_weight: 2,\n charisma_success_weight: 2,\n\n intelligence_exp: 16 * CONSTANTS.IntelligenceCrimeBaseExpGain,\n }),\n\n Kidnap: new Crime(\"Kidnap\", CONSTANTS.CrimeKidnap, 120e3, 3.6e6, 5, 6, {\n strength_exp: 80,\n defense_exp: 80,\n dexterity_exp: 80,\n agility_exp: 80,\n charisma_exp: 80,\n\n charisma_success_weight: 1,\n strength_success_weight: 1,\n dexterity_success_weight: 1,\n agility_success_weight: 1,\n\n intelligence_exp: 26 * CONSTANTS.IntelligenceCrimeBaseExpGain,\n }),\n\n Assassination: new Crime(\"Assassination\", CONSTANTS.CrimeAssassination, 300e3, 12e6, 8, 10, {\n strength_exp: 300,\n defense_exp: 300,\n dexterity_exp: 300,\n agility_exp: 300,\n\n strength_success_weight: 1,\n dexterity_success_weight: 2,\n agility_success_weight: 1,\n\n intelligence_exp: 65 * CONSTANTS.IntelligenceCrimeBaseExpGain,\n\n kills: 1,\n }),\n\n Heist: new Crime(\"Heist\", CONSTANTS.CrimeHeist, 600e3, 120e6, 18, 15, {\n hacking_exp: 450,\n strength_exp: 450,\n defense_exp: 450,\n dexterity_exp: 450,\n agility_exp: 450,\n charisma_exp: 450,\n\n hacking_success_weight: 1,\n strength_success_weight: 1,\n defense_success_weight: 1,\n dexterity_success_weight: 1,\n agility_success_weight: 1,\n charisma_success_weight: 1,\n\n intelligence_exp: 130 * CONSTANTS.IntelligenceCrimeBaseExpGain,\n }),\n};\n","import * as React from \"react\";\n\nexport function trusted(f: () => void): (event: React.MouseEvent) => any {\n return function (event: React.MouseEvent): any {\n if (!event.isTrusted) return;\n f();\n };\n}\n","import { Reviver } from \"../../utils/JSONReviver\";\n\ninterface GangTerritory {\n power: number;\n territory: number;\n}\n\nexport let AllGangs: {\n [key: string]: GangTerritory;\n} = {\n \"Slum Snakes\": {\n power: 1,\n territory: 1 / 7,\n },\n Tetrads: {\n power: 1,\n territory: 1 / 7,\n },\n \"The Syndicate\": {\n power: 1,\n territory: 1 / 7,\n },\n \"The Dark Army\": {\n power: 1,\n territory: 1 / 7,\n },\n \"Speakers for the Dead\": {\n power: 1,\n territory: 1 / 7,\n },\n NiteSec: {\n power: 1,\n territory: 1 / 7,\n },\n \"The Black Hand\": {\n power: 1,\n territory: 1 / 7,\n },\n};\n\nexport function resetGangs(): void {\n AllGangs = {\n \"Slum Snakes\": {\n power: 1,\n territory: 1 / 7,\n },\n Tetrads: {\n power: 1,\n territory: 1 / 7,\n },\n \"The Syndicate\": {\n power: 1,\n territory: 1 / 7,\n },\n \"The Dark Army\": {\n power: 1,\n territory: 1 / 7,\n },\n \"Speakers for the Dead\": {\n power: 1,\n territory: 1 / 7,\n },\n NiteSec: {\n power: 1,\n territory: 1 / 7,\n },\n \"The Black Hand\": {\n power: 1,\n territory: 1 / 7,\n },\n };\n}\n\nexport function loadAllGangs(saveString: string): void {\n AllGangs = JSON.parse(saveString, Reviver);\n}\n","// Constructs all CompanyPosition objects using the metadata in data/companypositions.ts\nimport { companyPositionMetadata } from \"./data/CompanyPositionsMetadata\";\nimport { CompanyPosition, IConstructorParams } from \"./CompanyPosition\";\nimport { IMap } from \"../types\";\n\nexport const CompanyPositions: IMap = {};\n\nfunction addCompanyPosition(params: IConstructorParams): void {\n if (CompanyPositions[params.name] != null) {\n console.warn(`Duplicate Company Position being defined: ${params.name}`);\n }\n CompanyPositions[params.name] = new CompanyPosition(params);\n}\n\ncompanyPositionMetadata.forEach((e) => {\n addCompanyPosition(e);\n});\n","import { IMap } from \"../../types\";\nimport { LocationName } from \"../../Locations/data/LocationNames\";\n\nexport const StockSymbols: IMap = {};\n\n// Stocks for companies at which you can work\nStockSymbols[LocationName.AevumECorp] = \"ECP\";\nStockSymbols[LocationName.Sector12MegaCorp] = \"MGCP\";\nStockSymbols[LocationName.Sector12BladeIndustries] = \"BLD\";\nStockSymbols[LocationName.AevumClarkeIncorporated] = \"CLRK\";\nStockSymbols[LocationName.VolhavenOmniTekIncorporated] = \"OMTK\";\nStockSymbols[LocationName.Sector12FourSigma] = \"FSIG\";\nStockSymbols[LocationName.ChongqingKuaiGongInternational] = \"KGI\";\nStockSymbols[LocationName.AevumFulcrumTechnologies] = \"FLCM\";\nStockSymbols[LocationName.IshimaStormTechnologies] = \"STM\";\nStockSymbols[LocationName.NewTokyoDefComm] = \"DCOMM\";\nStockSymbols[LocationName.VolhavenHeliosLabs] = \"HLS\";\nStockSymbols[LocationName.NewTokyoVitaLife] = \"VITA\";\nStockSymbols[LocationName.Sector12IcarusMicrosystems] = \"ICRS\";\nStockSymbols[LocationName.Sector12UniversalEnergy] = \"UNV\";\nStockSymbols[LocationName.AevumAeroCorp] = \"AERO\";\nStockSymbols[LocationName.VolhavenOmniaCybersystems] = \"OMN\";\nStockSymbols[LocationName.ChongqingSolarisSpaceSystems] = \"SLRS\";\nStockSymbols[LocationName.NewTokyoGlobalPharmaceuticals] = \"GPH\";\nStockSymbols[LocationName.IshimaNovaMedical] = \"NVMD\";\nStockSymbols[LocationName.AevumWatchdogSecurity] = \"WDS\";\nStockSymbols[LocationName.VolhavenLexoCorp] = \"LXO\";\nStockSymbols[LocationName.AevumRhoConstruction] = \"RHOC\";\nStockSymbols[LocationName.Sector12AlphaEnterprises] = \"APHE\";\nStockSymbols[LocationName.VolhavenSysCoreSecurities] = \"SYSC\";\nStockSymbols[LocationName.VolhavenCompuTek] = \"CTK\";\nStockSymbols[LocationName.AevumNetLinkTechnologies] = \"NTLK\";\nStockSymbols[LocationName.IshimaOmegaSoftware] = \"OMGA\";\nStockSymbols[LocationName.Sector12FoodNStuff] = \"FNS\";\n\n// Stocks for other companies\nStockSymbols[\"Sigma Cosmetics\"] = \"SGC\";\nStockSymbols[\"Joes Guns\"] = \"JGN\";\nStockSymbols[\"Catalyst Ventures\"] = \"CTYS\";\nStockSymbols[\"Microdyne Technologies\"] = \"MDYN\";\nStockSymbols[\"Titan Laboratories\"] = \"TITN\";\n","import React from \"react\";\nimport { TableCell as MuiTableCell, TableCellProps, Table as MuiTable, TableProps } from \"@mui/material\";\n\nimport makeStyles from \"@mui/styles/makeStyles\";\n\nconst useStyles = makeStyles({\n root: {\n borderBottom: \"none\",\n },\n small: {\n width: \"1px\",\n },\n});\n\nexport const TableCell: React.FC = (props: TableCellProps) => {\n return (\n \n );\n};\n\nexport const Table: React.FC = (props: TableProps) => {\n return (\n \n );\n};\n","import { IMap } from \"../../src/types\";\n\n/**\n * Keyboard key codes\n */\nexport const KEY: IMap = {\n CTRL: 17,\n DOWNARROW: 40,\n ENTER: 13,\n ESC: 27,\n TAB: 9,\n UPARROW: 38,\n\n \"0\": 48,\n \"1\": 49,\n \"2\": 50,\n \"3\": 51,\n \"4\": 52,\n \"5\": 53,\n \"6\": 54,\n \"7\": 55,\n \"8\": 56,\n \"9\": 57,\n\n A: 65,\n B: 66,\n C: 67,\n D: 68,\n E: 69,\n F: 70,\n G: 71,\n H: 72,\n I: 73,\n J: 74,\n K: 75,\n L: 76,\n M: 77,\n N: 78,\n O: 79,\n P: 80,\n Q: 81,\n R: 82,\n S: 83,\n T: 84,\n U: 85,\n V: 86,\n W: 87,\n X: 88,\n Y: 89,\n Z: 90,\n};\n","import { IOrderBook } from \"./IOrderBook\";\nimport { IStockMarket } from \"./IStockMarket\";\nimport { Order } from \"./Order\";\nimport { processOrders } from \"./OrderProcessing\";\nimport { Stock } from \"./Stock\";\nimport { TicksPerCycle } from \"./StockMarketConstants\";\nimport { InitStockMetadata } from \"./data/InitStockMetadata\";\nimport { OrderTypes } from \"./data/OrderTypes\";\nimport { PositionTypes } from \"./data/PositionTypes\";\nimport { StockSymbols } from \"./data/StockSymbols\";\n\nimport { CONSTANTS } from \"../Constants\";\nimport { WorkerScript } from \"../Netscript/WorkerScript\";\nimport { IMap } from \"../types\";\nimport { EventEmitter } from \"../utils/EventEmitter\";\n\nimport { numeralWrapper } from \".././ui/numeralFormat\";\n\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\nimport { Reviver } from \"../../utils/JSONReviver\";\n\nexport let StockMarket: IStockMarket = {\n lastUpdate: 0,\n Orders: {},\n storedCycles: 0,\n ticksUntilCycle: 0,\n} as IStockMarket; // Maps full stock name -> Stock object\nexport const SymbolToStockMap: IMap = {}; // Maps symbol -> Stock object\n\nexport function placeOrder(\n stock: Stock,\n shares: number,\n price: number,\n type: OrderTypes,\n position: PositionTypes,\n workerScript: WorkerScript | null = null,\n): boolean {\n if (!(stock instanceof Stock)) {\n if (workerScript) {\n workerScript.log(\"placeOrder\", `Invalid stock: '${stock}'`);\n } else {\n dialogBoxCreate(`ERROR: Invalid stock passed to placeOrder() function`);\n }\n return false;\n }\n if (typeof shares !== \"number\" || typeof price !== \"number\") {\n if (workerScript) {\n workerScript.log(\"placeOrder\", `Invalid arguments: shares='${shares}' price='${price}'`);\n } else {\n dialogBoxCreate(\"ERROR: Invalid numeric value provided for either 'shares' or 'price' argument\");\n }\n return false;\n }\n\n const order = new Order(stock.symbol, shares, price, type, position);\n if (StockMarket[\"Orders\"] == null) {\n const orders: IOrderBook = {};\n for (const name in StockMarket) {\n const stk = StockMarket[name];\n if (!(stk instanceof Stock)) {\n continue;\n }\n orders[stk.symbol] = [];\n }\n StockMarket[\"Orders\"] = orders;\n }\n StockMarket[\"Orders\"][stock.symbol].push(order);\n\n // Process to see if it should be executed immediately\n const processOrderRefs = {\n stockMarket: StockMarket as IStockMarket,\n symbolToStockMap: SymbolToStockMap,\n };\n processOrders(stock, order.type, order.pos, processOrderRefs);\n\n return true;\n}\n\n// Returns true if successfully cancels an order, false otherwise\ninterface ICancelOrderParams {\n order?: Order;\n pos?: PositionTypes;\n price?: number;\n shares?: number;\n stock?: Stock;\n type?: OrderTypes;\n}\nexport function cancelOrder(params: ICancelOrderParams, workerScript: WorkerScript | null = null): boolean {\n if (StockMarket[\"Orders\"] == null) {\n return false;\n }\n if (params.order && params.order instanceof Order) {\n const order = params.order;\n // An 'Order' object is passed in\n const stockOrders = StockMarket[\"Orders\"][order.stockSymbol];\n for (let i = 0; i < stockOrders.length; ++i) {\n if (order == stockOrders[i]) {\n stockOrders.splice(i, 1);\n return true;\n }\n }\n return false;\n } else if (\n params.stock &&\n params.shares &&\n params.price &&\n params.type &&\n params.pos &&\n params.stock instanceof Stock\n ) {\n // Order properties are passed in. Need to look for the order\n const stockOrders = StockMarket[\"Orders\"][params.stock.symbol];\n const orderTxt = params.stock.symbol + \" - \" + params.shares + \" @ \" + numeralWrapper.formatMoney(params.price);\n for (let i = 0; i < stockOrders.length; ++i) {\n const order = stockOrders[i];\n if (\n params.shares === order.shares &&\n params.price === order.price &&\n params.type === order.type &&\n params.pos === order.pos\n ) {\n stockOrders.splice(i, 1);\n if (workerScript) {\n workerScript.scriptRef.log(\"Successfully cancelled order: \" + orderTxt);\n }\n return true;\n }\n }\n if (workerScript) {\n workerScript.scriptRef.log(\"Failed to cancel order: \" + orderTxt);\n }\n return false;\n }\n return false;\n}\n\nexport function loadStockMarket(saveString: string): void {\n if (saveString === \"\") {\n StockMarket = {\n lastUpdate: 0,\n Orders: {},\n storedCycles: 0,\n ticksUntilCycle: 0,\n } as IStockMarket;\n } else {\n StockMarket = JSON.parse(saveString, Reviver);\n }\n}\n\nexport function deleteStockMarket(): void {\n StockMarket = {\n lastUpdate: 0,\n Orders: {},\n storedCycles: 0,\n ticksUntilCycle: 0,\n } as IStockMarket;\n}\n\nexport function initStockMarket(): void {\n for (const stk in StockMarket) {\n if (StockMarket.hasOwnProperty(stk)) {\n delete StockMarket[stk];\n }\n }\n\n for (const metadata of InitStockMetadata) {\n const name = metadata.name;\n StockMarket[name] = new Stock(metadata);\n }\n\n const orders: IOrderBook = {};\n for (const name in StockMarket) {\n const stock = StockMarket[name];\n if (!(stock instanceof Stock)) {\n continue;\n }\n orders[stock.symbol] = [];\n }\n StockMarket[\"Orders\"] = orders;\n\n StockMarket.storedCycles = 0;\n StockMarket.lastUpdate = 0;\n StockMarket.ticksUntilCycle = TicksPerCycle;\n}\n\nexport function initSymbolToStockMap(): void {\n for (const name in StockSymbols) {\n if (StockSymbols.hasOwnProperty(name)) {\n const stock = StockMarket[name];\n if (stock == null) {\n console.error(`Could not find Stock for ${name}`);\n continue;\n }\n const symbol = StockSymbols[name];\n SymbolToStockMap[symbol] = stock;\n }\n }\n}\n\nexport function stockMarketCycle(): void {\n for (const name in StockMarket) {\n const stock = StockMarket[name];\n if (!(stock instanceof Stock)) {\n continue;\n }\n\n const roll = Math.random();\n if (roll < 0.45) {\n stock.b = !stock.b;\n stock.flipForecastForecast();\n }\n\n StockMarket.ticksUntilCycle = TicksPerCycle;\n }\n}\n\n// Stock prices updated every 6 seconds\nconst msPerStockUpdate = 6e3;\nconst cyclesPerStockUpdate = msPerStockUpdate / CONSTANTS.MilliPerCycle;\nexport function processStockPrices(numCycles = 1): void {\n if (StockMarket.storedCycles == null || isNaN(StockMarket.storedCycles)) {\n StockMarket.storedCycles = 0;\n }\n StockMarket.storedCycles += numCycles;\n\n if (StockMarket.storedCycles < cyclesPerStockUpdate) {\n return;\n }\n\n // We can process the update every 4 seconds as long as there are enough\n // stored cycles. This lets us account for offline time\n const timeNow = new Date().getTime();\n if (timeNow - StockMarket.lastUpdate < 4e3) {\n return;\n }\n\n StockMarket.lastUpdate = timeNow;\n StockMarket.storedCycles -= cyclesPerStockUpdate;\n\n // Cycle\n if (StockMarket.ticksUntilCycle == null || typeof StockMarket.ticksUntilCycle !== \"number\") {\n StockMarket.ticksUntilCycle = TicksPerCycle;\n }\n --StockMarket.ticksUntilCycle;\n if (StockMarket.ticksUntilCycle <= 0) {\n stockMarketCycle();\n }\n\n const v = Math.random();\n for (const name in StockMarket) {\n const stock = StockMarket[name];\n if (!(stock instanceof Stock)) {\n continue;\n }\n let av = (v * stock.mv) / 100;\n if (isNaN(av)) {\n av = 0.02;\n }\n\n let chc = 50;\n if (stock.b) {\n chc = (chc + stock.otlkMag) / 100;\n } else {\n chc = (chc - stock.otlkMag) / 100;\n }\n if (stock.price >= stock.cap) {\n chc = 0.1; // \"Soft Limit\" on stock price. It could still go up but its unlikely\n stock.b = false;\n }\n if (isNaN(chc)) {\n chc = 0.5;\n }\n\n const c = Math.random();\n const processOrderRefs = {\n stockMarket: StockMarket,\n symbolToStockMap: SymbolToStockMap,\n };\n if (c < chc) {\n stock.changePrice(stock.price * (1 + av));\n processOrders(stock, OrderTypes.LimitBuy, PositionTypes.Short, processOrderRefs);\n processOrders(stock, OrderTypes.LimitSell, PositionTypes.Long, processOrderRefs);\n processOrders(stock, OrderTypes.StopBuy, PositionTypes.Long, processOrderRefs);\n processOrders(stock, OrderTypes.StopSell, PositionTypes.Short, processOrderRefs);\n } else {\n stock.changePrice(stock.price / (1 + av));\n processOrders(stock, OrderTypes.LimitBuy, PositionTypes.Long, processOrderRefs);\n processOrders(stock, OrderTypes.LimitSell, PositionTypes.Short, processOrderRefs);\n processOrders(stock, OrderTypes.StopBuy, PositionTypes.Short, processOrderRefs);\n processOrders(stock, OrderTypes.StopSell, PositionTypes.Long, processOrderRefs);\n }\n\n let otlkMagChange = stock.otlkMag * av;\n if (stock.otlkMag < 5) {\n if (stock.otlkMag <= 1) {\n otlkMagChange = 1;\n } else {\n otlkMagChange *= 10;\n }\n }\n stock.cycleForecast(otlkMagChange);\n stock.cycleForecastForecast(otlkMagChange / 2);\n\n // Shares required for price movement gradually approaches max over time\n stock.shareTxUntilMovement = Math.min(stock.shareTxUntilMovement + 10, stock.shareTxForMovement);\n }\n}\n\nexport function initStockMarketFnForReact(): void {\n initStockMarket();\n initSymbolToStockMap();\n}\n\nexport const eventEmitterForUiReset = new EventEmitter<[]>();\n","import * as React from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\n\nexport function Reputation(reputation: number | string): JSX.Element {\n return (\n \n {typeof reputation === \"number\" ? numeralWrapper.formatReputation(reputation) : reputation}\n \n );\n}\n","import { codingContractTypesMetadata, DescriptionFunc, GeneratorFunc, SolverFunc } from \"./data/codingcontracttypes\";\n\nimport { IMap } from \"./types\";\n\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../utils/JSONReviver\";\nimport { createPopup, removePopup } from \"./ui/React/createPopup\";\nimport { CodingContractPopup } from \"./ui/React/CodingContractPopup\";\n\n/* tslint:disable:no-magic-numbers completed-docs max-classes-per-file no-console */\n\n/* Represents different types of problems that a Coding Contract can have */\nexport class CodingContractType {\n /**\n * Function that generates a description of the problem\n */\n desc: DescriptionFunc;\n\n /**\n * Number that generally represents the problem's difficulty. Bigger numbers = harder\n */\n difficulty: number;\n\n /**\n * A function that randomly generates a valid 'data' for the problem\n */\n generate: GeneratorFunc;\n\n /**\n * Name of the type of problem\n */\n name: string;\n\n /**\n * The maximum number of tries the player gets on this kind of problem before it self-destructs\n */\n numTries: number;\n\n /**\n * Stores a function that checks if the provided answer is correct\n */\n solver: SolverFunc;\n\n constructor(\n name: string,\n desc: DescriptionFunc,\n gen: GeneratorFunc,\n solver: SolverFunc,\n diff: number,\n numTries: number,\n ) {\n this.name = name;\n this.desc = desc;\n this.generate = gen;\n this.solver = solver;\n this.difficulty = diff;\n this.numTries = numTries;\n }\n}\n\n/* Contract Types */\n// tslint:disable-next-line\nexport const CodingContractTypes: IMap = {};\n\nfor (const md of codingContractTypesMetadata) {\n // tslint:disable-next-line\n CodingContractTypes[md.name] = new CodingContractType(\n md.name,\n md.desc,\n md.gen,\n md.solver,\n md.difficulty,\n md.numTries,\n );\n}\n\n/**\n * Enum representing the different types of rewards a Coding Contract can give\n */\nexport enum CodingContractRewardType {\n FactionReputation,\n FactionReputationAll,\n CompanyReputation,\n Money, // This must always be the last reward type\n}\n\n/**\n * Enum representing the result when trying to solve the Contract\n */\nexport enum CodingContractResult {\n Success,\n Failure,\n Cancelled,\n}\n\n/**\n * A class that represents the type of reward a contract gives\n */\nexport interface ICodingContractReward {\n /* Name of Company/Faction name for reward, if applicable */\n name?: string;\n type: CodingContractRewardType;\n}\n\n/**\n * A Coding Contract is a file that poses a programming-related problem to the Player.\n * The player receives a reward if the problem is solved correctly\n */\nexport class CodingContract {\n /* Relevant data for the contract's problem */\n data: any;\n\n /* Contract's filename */\n fn: string;\n\n /* Describes the reward given if this Contract is solved. The reward is actually\n processed outside of this file */\n reward: ICodingContractReward | null;\n\n /* Number of times the Contract has been attempted */\n tries = 0;\n\n /* String representing the contract's type. Must match type in ContractTypes */\n type: string;\n\n constructor(fn = \"\", type = \"Find Largest Prime Factor\", reward: ICodingContractReward | null = null) {\n this.fn = fn;\n if (!this.fn.endsWith(\".cct\")) {\n this.fn += \".cct\";\n }\n\n // tslint:disable-next-line\n if (CodingContractTypes[type] == null) {\n throw new Error(`Error: invalid contract type: ${type} please contact developer`);\n }\n\n this.type = type;\n this.data = CodingContractTypes[type].generate();\n this.reward = reward;\n }\n\n getData(): any {\n return this.data;\n }\n\n getDescription(): string {\n return CodingContractTypes[this.type].desc(this.data);\n }\n\n getDifficulty(): number {\n return CodingContractTypes[this.type].difficulty;\n }\n\n getMaxNumTries(): number {\n return CodingContractTypes[this.type].numTries;\n }\n\n getType(): string {\n return CodingContractTypes[this.type].name;\n }\n\n isSolution(solution: string): boolean {\n return CodingContractTypes[this.type].solver(this.data, solution);\n }\n\n /**\n * Creates a popup to prompt the player to solve the problem\n */\n async prompt(): Promise {\n const popupId = `coding-contract-prompt-popup-${this.fn}`;\n return new Promise((resolve) => {\n createPopup(\n popupId,\n CodingContractPopup,\n {\n c: this,\n popupId: popupId,\n onClose: () => {\n resolve(CodingContractResult.Cancelled);\n removePopup(popupId);\n },\n onAttempt: (val: string) => {\n if (this.isSolution(val)) {\n resolve(CodingContractResult.Success);\n } else {\n resolve(CodingContractResult.Failure);\n }\n removePopup(popupId);\n },\n },\n () => resolve(CodingContractResult.Cancelled),\n );\n });\n }\n\n /**\n * Serialize the current file to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"CodingContract\", this);\n }\n\n /**\n * Initiatizes a CodingContract from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): CodingContract {\n return Generic_fromJSON(CodingContract, value.data);\n }\n}\n\nReviver.constructors.CodingContract = CodingContract;\n","export enum OrderTypes {\n LimitBuy = \"Limit Buy Order\",\n LimitSell = \"Limit Sell Order\",\n StopBuy = \"Stop Buy Order\",\n StopSell = \"Stop Sell Order\",\n}\n","import { BitNodeMultipliers } from \"./BitNode/BitNodeMultipliers\";\nimport { IPlayer } from \"./PersonObjects/IPlayer\";\nimport { calculateIntelligenceBonus } from \"./PersonObjects/formulas/intelligence\";\nimport { Server } from \"./Server/Server\";\n\n/**\n * Returns the chance the player has to successfully hack a server\n */\nexport function calculateHackingChance(server: Server, player: IPlayer): number {\n const hackFactor = 1.75;\n const difficultyMult = (100 - server.hackDifficulty) / 100;\n const skillMult = hackFactor * player.hacking_skill;\n const skillChance = (skillMult - server.requiredHackingSkill) / skillMult;\n const chance =\n skillChance * difficultyMult * player.hacking_chance_mult * calculateIntelligenceBonus(player.intelligence, 1);\n if (chance > 1) {\n return 1;\n }\n if (chance < 0) {\n return 0;\n }\n\n return chance;\n}\n\n/**\n * Returns the amount of hacking experience the player will gain upon\n * successfully hacking a server\n */\nexport function calculateHackingExpGain(server: Server, player: IPlayer): number {\n const baseExpGain = 3;\n const diffFactor = 0.3;\n if (server.baseDifficulty == null) {\n server.baseDifficulty = server.hackDifficulty;\n }\n let expGain = baseExpGain;\n expGain += server.baseDifficulty * player.hacking_exp_mult * diffFactor;\n\n return expGain * BitNodeMultipliers.HackExpGain;\n}\n\n/**\n * Returns the percentage of money that will be stolen from a server if\n * it is successfully hacked (returns the decimal form, not the actual percent value)\n */\nexport function calculatePercentMoneyHacked(server: Server, player: IPlayer): number {\n // Adjust if needed for balancing. This is the divisor for the final calculation\n const balanceFactor = 240;\n\n const difficultyMult = (100 - server.hackDifficulty) / 100;\n const skillMult = (player.hacking_skill - (server.requiredHackingSkill - 1)) / player.hacking_skill;\n const percentMoneyHacked = (difficultyMult * skillMult * player.hacking_money_mult) / balanceFactor;\n if (percentMoneyHacked < 0) {\n return 0;\n }\n if (percentMoneyHacked > 1) {\n return 1;\n }\n\n return percentMoneyHacked * BitNodeMultipliers.ScriptHackMoney;\n}\n\n/**\n * Returns time it takes to complete a hack on a server, in seconds\n */\nexport function calculateHackingTime(server: Server, player: IPlayer): number {\n const difficultyMult = server.requiredHackingSkill * server.hackDifficulty;\n\n const baseDiff = 500;\n const baseSkill = 50;\n const diffFactor = 2.5;\n let skillFactor = diffFactor * difficultyMult + baseDiff;\n // tslint:disable-next-line\n skillFactor /= player.hacking_skill + baseSkill;\n\n const hackTimeMultiplier = 5;\n const hackingTime =\n (hackTimeMultiplier * skillFactor) /\n (player.hacking_speed_mult * calculateIntelligenceBonus(player.intelligence, 1));\n\n return hackingTime;\n}\n\n/**\n * Returns time it takes to complete a grow operation on a server, in seconds\n */\nexport function calculateGrowTime(server: Server, player: IPlayer): number {\n const growTimeMultiplier = 3.2; // Relative to hacking time. 16/5 = 3.2\n\n return growTimeMultiplier * calculateHackingTime(server, player);\n}\n\n/**\n * Returns time it takes to complete a weaken operation on a server, in seconds\n */\nexport function calculateWeakenTime(server: Server, player: IPlayer): number {\n const weakenTimeMultiplier = 4; // Relative to hacking time\n\n return weakenTimeMultiplier * calculateHackingTime(server, player);\n}\n","// Script helper functions\nexport function isScriptFilename(f: string): boolean {\n return f.endsWith(\".js\") || f.endsWith(\".script\") || f.endsWith(\".ns\");\n}\n","/**\n * Hacknet Servers - Reworked Hacknet Node mechanic for BitNode-9\n */\nimport { CONSTANTS } from \"../Constants\";\n\nimport { IHacknetNode } from \"./IHacknetNode\";\n\nimport { BaseServer } from \"../Server/BaseServer\";\nimport { RunningScript } from \"../Script/RunningScript\";\nimport { HacknetServerConstants } from \"./data/Constants\";\nimport {\n calculateHashGainRate,\n calculateLevelUpgradeCost,\n calculateRamUpgradeCost,\n calculateCoreUpgradeCost,\n calculateCacheUpgradeCost,\n} from \"./formulas/HacknetServers\";\n\nimport { createRandomIp } from \"../../utils/IPAddress\";\n\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\ninterface IConstructorParams {\n adminRights?: boolean;\n hostname: string;\n ip?: string;\n isConnectedTo?: boolean;\n maxRam?: number;\n organizationName?: string;\n}\n\nexport class HacknetServer extends BaseServer implements IHacknetNode {\n // Cache level. Affects hash Capacity\n cache = 1;\n\n // Number of cores. Improves hash production\n cores = 1;\n\n // Number of hashes that can be stored by this Hacknet Server\n hashCapacity = 0;\n\n // Hashes produced per second\n hashRate = 0;\n\n // Similar to Node level. Improves hash production\n level = 1;\n\n // How long this HacknetServer has existed, in seconds\n onlineTimeSeconds = 0;\n\n // Total number of hashes earned by this server\n totalHashesGenerated = 0;\n\n constructor(params: IConstructorParams = { hostname: \"\", ip: createRandomIp() }) {\n super(params);\n\n this.maxRam = 1;\n this.updateHashCapacity();\n }\n\n calculateCacheUpgradeCost(levels: number): number {\n return calculateCacheUpgradeCost(this.cache, levels);\n }\n\n calculateCoreUpgradeCost(levels: number, costMult: number): number {\n return calculateCoreUpgradeCost(this.cores, levels, costMult);\n }\n\n calculateLevelUpgradeCost(levels: number, costMult: number): number {\n return calculateLevelUpgradeCost(this.level, levels, costMult);\n }\n\n calculateRamUpgradeCost(levels: number, costMult: number): number {\n return calculateRamUpgradeCost(this.maxRam, levels, costMult);\n }\n\n // Process this Hacknet Server in the game loop. Returns the number of hashes generated\n process(numCycles = 1): number {\n const seconds = (numCycles * CONSTANTS.MilliPerCycle) / 1000;\n\n return this.hashRate * seconds;\n }\n\n upgradeCache(levels: number): void {\n this.cache = Math.min(HacknetServerConstants.MaxCache, Math.round(this.cache + levels));\n this.updateHashCapacity();\n }\n\n upgradeCore(levels: number, prodMult: number): void {\n this.cores = Math.min(HacknetServerConstants.MaxCores, Math.round(this.cores + levels));\n this.updateHashRate(prodMult);\n }\n\n upgradeLevel(levels: number, prodMult: number): void {\n this.level = Math.min(HacknetServerConstants.MaxLevel, Math.round(this.level + levels));\n this.updateHashRate(prodMult);\n }\n\n upgradeRam(levels: number, prodMult: number): boolean {\n for (let i = 0; i < levels; ++i) {\n this.maxRam *= 2;\n }\n this.maxRam = Math.min(HacknetServerConstants.MaxRam, Math.round(this.maxRam));\n this.updateHashRate(prodMult);\n\n return true;\n }\n\n // Whenever a script is run, we must update this server's hash rate\n runScript(script: RunningScript, prodMult?: number): void {\n super.runScript(script);\n if (prodMult != null && typeof prodMult === \"number\") {\n this.updateHashRate(prodMult);\n }\n }\n\n updateHashCapacity(): void {\n this.hashCapacity = 32 * Math.pow(2, this.cache);\n }\n\n updateHashRate(prodMult: number): void {\n this.hashRate = calculateHashGainRate(this.level, this.ramUsed, this.maxRam, this.cores, prodMult);\n\n if (isNaN(this.hashRate)) {\n this.hashRate = 0;\n console.error(\n `Error calculating Hacknet Server hash production. This is a bug. Please report to game dev`,\n false,\n );\n }\n }\n\n // Serialize the current object to a JSON save state\n toJSON(): any {\n return Generic_toJSON(\"HacknetServer\", this);\n }\n\n // Initializes a HacknetServer Object from a JSON save state\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): HacknetServer {\n return Generic_fromJSON(HacknetServer, value.data);\n }\n}\n\nReviver.constructors.HacknetServer = HacknetServer;\n","/**\n * Checks whether the value passed in can be considered a string.\n * @param value The value to check if it is a string.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isString(value: any): boolean {\n return typeof value === \"string\" || value instanceof String;\n}\n","// Defines the ResearchTree that is common to all Corporation Industries\n// i.e. all Industries have these types of Research available to unlock\nimport { Research } from \"../Research\";\nimport { ResearchMap } from \"../ResearchMap\";\nimport { ResearchTree, Node } from \"../ResearchTree\";\n\nfunction makeNode(name: string): Node {\n const research: Research | null = ResearchMap[name];\n if (research == null) {\n throw new Error(`Invalid research name: ${name}`);\n }\n\n return new Node({ text: research.name, cost: research.cost });\n}\n\n// Creates the Nodes for the BaseResearchTree.\n// Return the Root Node\nfunction createBaseResearchTreeNodes(): Node {\n const rootNode: Node = makeNode(\"Hi-Tech R&D Laboratory\");\n const autoBrew: Node = makeNode(\"AutoBrew\");\n const autoParty: Node = makeNode(\"AutoPartyManager\");\n const autoDrugs: Node = makeNode(\"Automatic Drug Administration\");\n const bulkPurchasing: Node = makeNode(\"Bulk Purchasing\");\n const cph4: Node = makeNode(\"CPH4 Injections\");\n const drones: Node = makeNode(\"Drones\");\n const dronesAssembly: Node = makeNode(\"Drones - Assembly\");\n const dronesTransport: Node = makeNode(\"Drones - Transport\");\n const goJuice: Node = makeNode(\"Go-Juice\");\n const hrRecruitment: Node = makeNode(\"HRBuddy-Recruitment\");\n const hrTraining: Node = makeNode(\"HRBuddy-Training\");\n const joywire: Node = makeNode(\"JoyWire\");\n const marketta1: Node = makeNode(\"Market-TA.I\");\n const marketta2: Node = makeNode(\"Market-TA.II\");\n const overclock: Node = makeNode(\"Overclock\");\n const scAssemblers: Node = makeNode(\"Self-Correcting Assemblers\");\n const stimu: Node = makeNode(\"Sti.mu\");\n\n autoDrugs.addChild(goJuice);\n autoDrugs.addChild(cph4);\n\n drones.addChild(dronesAssembly);\n drones.addChild(dronesTransport);\n\n hrRecruitment.addChild(hrTraining);\n\n marketta1.addChild(marketta2);\n\n overclock.addChild(stimu);\n\n rootNode.addChild(autoBrew);\n rootNode.addChild(autoParty);\n rootNode.addChild(autoDrugs);\n rootNode.addChild(bulkPurchasing);\n rootNode.addChild(drones);\n rootNode.addChild(hrRecruitment);\n rootNode.addChild(joywire);\n rootNode.addChild(marketta1);\n rootNode.addChild(overclock);\n rootNode.addChild(scAssemblers);\n\n return rootNode;\n}\n\nexport function getBaseResearchTreeCopy(): ResearchTree {\n const baseResearchTree: ResearchTree = new ResearchTree();\n baseResearchTree.setRoot(createBaseResearchTreeNodes());\n\n return baseResearchTree;\n}\n\n// Base Research Tree for Industry's that make products\nexport function getProductIndustryResearchTreeCopy(): ResearchTree {\n const researchTree: ResearchTree = new ResearchTree();\n const root = createBaseResearchTreeNodes();\n\n const upgradeFulcrum = makeNode(\"uPgrade: Fulcrum\");\n const upgradeCapacity1 = makeNode(\"uPgrade: Capacity.I\");\n const upgradeCapacity2 = makeNode(\"uPgrade: Capacity.II\");\n const upgradeDashboard = makeNode(\"uPgrade: Dashboard\");\n\n upgradeCapacity1.addChild(upgradeCapacity2);\n upgradeFulcrum.addChild(upgradeCapacity1);\n upgradeFulcrum.addChild(upgradeDashboard);\n root.addChild(upgradeFulcrum);\n\n researchTree.setRoot(root);\n\n return researchTree;\n}\n","import { Augmentations } from \"../Augmentation/Augmentations\";\nimport { PlayerOwnedAugmentation } from \"../Augmentation/PlayerOwnedAugmentation\";\nimport { AugmentationNames } from \"../Augmentation/data/AugmentationNames\";\nimport { BitNodeMultipliers } from \"../BitNode/BitNodeMultipliers\";\nimport { CONSTANTS } from \"../Constants\";\n\nimport { Faction } from \"./Faction\";\nimport { Factions } from \"./Factions\";\nimport { HackingMission, setInMission } from \"../Missions\";\nimport { Player } from \"../Player\";\nimport { Settings } from \"../Settings/Settings\";\nimport {\n getHackingWorkRepGain,\n getFactionSecurityWorkRepGain,\n getFactionFieldWorkRepGain,\n} from \"../PersonObjects/formulas/reputation\";\nimport { SourceFileFlags } from \"../SourceFile/SourceFileFlags\";\n\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\nimport { createPopup } from \"../ui/React/createPopup\";\nimport { InvitationPopup } from \"./ui/InvitationPopup\";\n\nexport function inviteToFaction(faction) {\n Player.factionInvitations.push(faction.name);\n faction.alreadyInvited = true;\n if (!Settings.SuppressFactionInvites) {\n const popupId = \"faction-invitation\";\n createPopup(popupId, InvitationPopup, {\n player: Player,\n faction: faction,\n popupId: popupId,\n });\n }\n}\n\nexport function joinFaction(faction) {\n if (faction.isMember) return;\n faction.isMember = true;\n Player.factions.push(faction.name);\n const factionInfo = faction.getInfo();\n\n //Determine what factions you are banned from now that you have joined this faction\n for (const i in factionInfo.enemies) {\n const enemy = factionInfo.enemies[i];\n if (Factions[enemy] instanceof Faction) {\n Factions[enemy].isBanned = true;\n }\n }\n for (var i = 0; i < Player.factionInvitations.length; ++i) {\n if (Player.factionInvitations[i] == faction.name || Factions[Player.factionInvitations[i]].isBanned) {\n Player.factionInvitations.splice(i, 1);\n i--;\n }\n }\n}\n\nexport function startHackingMission(faction) {\n const mission = new HackingMission(faction.playerReputation, faction);\n setInMission(true, mission); //Sets inMission flag to true\n mission.init();\n}\n\n//Returns a boolean indicating whether the player has the prerequisites for the\n//specified Augmentation\nexport function hasAugmentationPrereqs(aug) {\n let hasPrereqs = true;\n if (aug.prereqs && aug.prereqs.length > 0) {\n for (let i = 0; i < aug.prereqs.length; ++i) {\n const prereqAug = Augmentations[aug.prereqs[i]];\n if (prereqAug == null) {\n console.error(`Invalid prereq Augmentation ${aug.prereqs[i]}`);\n continue;\n }\n if (prereqAug.owned === false) {\n hasPrereqs = false;\n\n // Check if the aug is purchased\n for (let j = 0; j < Player.queuedAugmentations.length; ++j) {\n if (Player.queuedAugmentations[j].name === prereqAug.name) {\n hasPrereqs = true;\n break;\n }\n }\n }\n }\n }\n\n return hasPrereqs;\n}\n\nexport function purchaseAugmentation(aug, fac, sing = false) {\n const factionInfo = fac.getInfo();\n var hasPrereqs = hasAugmentationPrereqs(aug);\n if (!hasPrereqs) {\n var txt = \"You must first purchase or install \" + aug.prereqs.join(\",\") + \" before you can \" + \"purchase this one.\";\n if (sing) {\n return txt;\n } else {\n dialogBoxCreate(txt);\n }\n } else if (aug.baseCost !== 0 && Player.money.lt(aug.baseCost * factionInfo.augmentationPriceMult)) {\n let txt = \"You don't have enough money to purchase \" + aug.name;\n if (sing) {\n return txt;\n }\n dialogBoxCreate(txt);\n } else if (fac.playerReputation < aug.baseRepRequirement) {\n let txt = \"You don't have enough faction reputation to purchase \" + aug.name;\n if (sing) {\n return txt;\n }\n dialogBoxCreate(txt);\n } else if (aug.baseCost === 0 || Player.money.gte(aug.baseCost * factionInfo.augmentationPriceMult)) {\n if (Player.firstAugPurchased === false) {\n Player.firstAugPurchased = true;\n document.getElementById(\"augmentations-tab\").style.display = \"list-item\";\n document.getElementById(\"character-menu-header\").click();\n document.getElementById(\"character-menu-header\").click();\n }\n\n var queuedAugmentation = new PlayerOwnedAugmentation(aug.name);\n if (aug.name == AugmentationNames.NeuroFluxGovernor) {\n queuedAugmentation.level = getNextNeurofluxLevel();\n }\n Player.queuedAugmentations.push(queuedAugmentation);\n\n Player.loseMoney(aug.baseCost * factionInfo.augmentationPriceMult);\n\n // If you just purchased Neuroflux Governor, recalculate the cost\n if (aug.name == AugmentationNames.NeuroFluxGovernor) {\n var nextLevel = getNextNeurofluxLevel();\n --nextLevel;\n var mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel);\n aug.baseRepRequirement = 500 * mult * BitNodeMultipliers.AugmentationRepCost;\n aug.baseCost = 750e3 * mult * BitNodeMultipliers.AugmentationMoneyCost;\n\n for (var i = 0; i < Player.queuedAugmentations.length - 1; ++i) {\n aug.baseCost *= CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]];\n }\n }\n\n for (var name in Augmentations) {\n if (Augmentations.hasOwnProperty(name)) {\n Augmentations[name].baseCost *= CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]];\n }\n }\n\n if (sing) {\n return \"You purchased \" + aug.name;\n } else {\n if (!Settings.SuppressBuyAugmentationConfirmation) {\n dialogBoxCreate(\n \"You purchased \" +\n aug.name +\n \". It's enhancements will not take \" +\n \"effect until they are installed. To install your augmentations, go to the \" +\n \"'Augmentations' tab on the left-hand navigation menu. Purchasing additional \" +\n \"augmentations will now be more expensive.\",\n );\n }\n }\n } else {\n dialogBoxCreate(\n \"Hmm, something went wrong when trying to purchase an Augmentation. \" +\n \"Please report this to the game developer with an explanation of how to \" +\n \"reproduce this.\",\n );\n }\n}\n\nexport function getNextNeurofluxLevel() {\n // Get current Neuroflux level based on Player's augmentations\n let currLevel = 0;\n for (var i = 0; i < Player.augmentations.length; ++i) {\n if (Player.augmentations[i].name === AugmentationNames.NeuroFluxGovernor) {\n currLevel = Player.augmentations[i].level;\n }\n }\n\n // Account for purchased but uninstalled Augmentations\n for (var i = 0; i < Player.queuedAugmentations.length; ++i) {\n if (Player.queuedAugmentations[i].name == AugmentationNames.NeuroFluxGovernor) {\n ++currLevel;\n }\n }\n return currLevel + 1;\n}\n\nexport function processPassiveFactionRepGain(numCycles) {\n for (const name in Factions) {\n if (name === Player.currentWorkFactionName) continue;\n if (!Factions.hasOwnProperty(name)) continue;\n const faction = Factions[name];\n if (!faction.isMember) continue;\n // No passive rep for special factions\n const info = faction.getInfo();\n if (!info.offersWork()) continue;\n // No passive rep for gangs.\n if (Player.getGangName() === name) continue;\n // 0 favor = 1%/s\n // 50 favor = 6%/s\n // 100 favor = 11%/s\n const favorMult = Math.min(0.1, faction.favor / 1000 + 0.01);\n // Find the best of all possible favor gain, minimum 1 rep / 2 minute.\n const hRep = getHackingWorkRepGain(Player, faction);\n const sRep = getFactionSecurityWorkRepGain(Player, faction);\n const fRep = getFactionFieldWorkRepGain(Player, faction);\n const rate = Math.max(hRep * favorMult, sRep * favorMult, fRep * favorMult, 1 / 120);\n\n faction.playerReputation += rate * numCycles * Player.faction_rep_mult * BitNodeMultipliers.FactionPassiveRepGain;\n }\n}\n","/**\n * Helper functions that implement \"directory\" functionality in the Terminal.\n * These aren't \"real\" directories, it's more of a pseudo-directory implementation\n * that uses mainly string manipulation.\n *\n * This file contains functions that deal only with that string manipulation.\n * Functions that need to access/process Server-related things can be\n * found in ./DirectoryServerHelpers.ts\n */\n\n/**\n * Removes leading forward slash (\"/\") from a string.\n */\nexport function removeLeadingSlash(s: string): string {\n if (s.startsWith(\"/\")) {\n return s.slice(1);\n }\n\n return s;\n}\n\n/**\n * Removes trailing forward slash (\"/\") from a string.\n * Note that this will also remove the slash if it is the leading slash (i.e. if s = \"/\")\n */\nexport function removeTrailingSlash(s: string): string {\n if (s.endsWith(\"/\")) {\n return s.slice(0, -1);\n }\n\n return s;\n}\n\n/**\n * Checks whether a string is a valid filename. Only used for the filename itself,\n * not the entire filepath\n */\nexport function isValidFilename(filename: string): boolean {\n // Allows alphanumerics, hyphens, underscores, and percentage signs\n // Must have a file extension\n const regex = /^[.a-zA-Z0-9_-]+[.][a-zA-Z0-9]+(?:-\\d+(?:\\.\\d*)?%-INC)?$/;\n\n // match() returns null if no match is found\n return filename.match(regex) != null;\n}\n\n/**\n * Checks whether a string is a valid directory name. Only used for the directory itself,\n * not an entire path\n */\nexport function isValidDirectoryName(name: string): boolean {\n // Allows alphanumerics, hyphens, underscores, and percentage signs.\n // Name can begin with a single period, but otherwise cannot have any\n const regex = /^.?[a-zA-Z0-9_-]+$/;\n\n // match() returns null if no match is found\n return name.match(regex) != null;\n}\n\n/**\n * Checks whether a string is a valid directory path.\n * This only checks if it has the proper formatting. It does NOT check\n * if the directories actually exist on Terminal\n */\nexport function isValidDirectoryPath(path: string): boolean {\n let t_path: string = path;\n\n if (t_path.length === 0) {\n return false;\n }\n if (t_path.length === 1) {\n return t_path === \"/\";\n }\n\n // A full path must have a leading slash, but we'll ignore it for the checks\n if (t_path.startsWith(\"/\")) {\n t_path = t_path.slice(1);\n } else {\n return false;\n }\n\n // Trailing slash does not matter\n t_path = removeTrailingSlash(t_path);\n\n // Check that every section of the path is a valid directory name\n const dirs = t_path.split(\"/\");\n for (const dir of dirs) {\n // Special case, \".\" and \"..\" are valid for path\n if (dir === \".\" || dir === \"..\") {\n continue;\n }\n if (!isValidDirectoryName(dir)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Checks whether a string is a valid file path. This only checks if it has the\n * proper formatting. It dose NOT check if the file actually exists on Terminal\n */\nexport function isValidFilePath(path: string): boolean {\n if (path == null || typeof path !== \"string\") {\n return false;\n }\n const t_path = path;\n\n // Impossible for filename to have less than length of 3\n if (t_path.length < 3) {\n return false;\n }\n\n // Full filepath can't end with trailing slash because it must be a file\n if (t_path.endsWith(\"/\")) {\n return false;\n }\n\n // Everything after the last forward slash is the filename. Everything before\n // it is the file path\n const fnSeparator = t_path.lastIndexOf(\"/\");\n if (fnSeparator === -1) {\n return isValidFilename(t_path);\n }\n\n const fn = t_path.slice(fnSeparator + 1);\n const dirPath = t_path.slice(0, fnSeparator + 1);\n\n return isValidDirectoryPath(dirPath) && isValidFilename(fn);\n}\n\n/**\n * Returns a formatted string for the first parent directory in a filepath. For example:\n * /home/var/test/ -> home/\n * If there is no first parent directory, then it returns \"/\" for root\n */\nexport function getFirstParentDirectory(path: string): string {\n let t_path = path;\n t_path = removeLeadingSlash(t_path);\n t_path = removeTrailingSlash(t_path);\n\n if (t_path.lastIndexOf(\"/\") === -1) {\n return \"/\";\n }\n\n const dirs = t_path.split(\"/\");\n if (dirs.length === 0) {\n return \"/\";\n }\n\n return dirs[0] + \"/\";\n}\n\n/**\n * Given a filepath, returns a formatted string for all of the parent directories\n * in that filepath. For example:\n * /home/var/tes -> home/var/\n * /home/var/test/ -> home/var/test/\n * If there are no parent directories, it returns the empty string\n */\nexport function getAllParentDirectories(path: string): string {\n const t_path = path;\n const lastSlash = t_path.lastIndexOf(\"/\");\n if (lastSlash === -1) {\n return \"\";\n }\n\n return t_path.slice(0, lastSlash + 1);\n}\n\n/**\n * Checks if a file path refers to a file in the root directory.\n */\nexport function isInRootDirectory(path: string): boolean {\n if (!isValidFilePath(path)) {\n return false;\n }\n if (path == null || path.length === 0) {\n return false;\n }\n\n return path.lastIndexOf(\"/\") <= 0;\n}\n\n/**\n * Evaluates a directory path, including the processing of linux dots.\n * Returns the full, proper path, or null if an invalid path is passed in\n */\nexport function evaluateDirectoryPath(path: string, currPath?: string): string | null {\n let t_path = path;\n\n // If the path begins with a slash, then its an absolute path. Otherwise its relative\n // For relative paths, we need to prepend the current directory\n if (!t_path.startsWith(\"/\") && currPath != null) {\n t_path = currPath + (currPath.endsWith(\"/\") ? \"\" : \"/\") + t_path;\n }\n\n if (!isValidDirectoryPath(t_path)) {\n return null;\n }\n\n // Trim leading/trailing slashes\n t_path = removeLeadingSlash(t_path);\n t_path = removeTrailingSlash(t_path);\n\n const dirs = t_path.split(\"/\");\n const reconstructedPath: string[] = [];\n\n for (const dir of dirs) {\n if (dir === \".\") {\n // Current directory, do nothing\n continue;\n } else if (dir === \"..\") {\n // Parent directory\n const res = reconstructedPath.pop();\n if (res == null) {\n return null; // Array was empty, invalid path\n }\n } else {\n reconstructedPath.push(dir);\n }\n }\n\n return \"/\" + reconstructedPath.join(\"/\");\n}\n\n/**\n * Evaluates a file path, including the processing of linux dots.\n * Returns the full, proper path, or null if an invalid path is passed in\n */\nexport function evaluateFilePath(path: string, currPath?: string): string | null {\n let t_path = path;\n\n // If the path begins with a slash, then its an absolute path. Otherwise its relative\n // For relative paths, we need to prepend the current directory\n if (!t_path.startsWith(\"/\") && currPath != null) {\n t_path = currPath + (currPath.endsWith(\"/\") ? \"\" : \"/\") + t_path;\n }\n\n if (!isValidFilePath(t_path)) {\n return null;\n }\n\n // Trim leading/trailing slashes\n t_path = removeLeadingSlash(t_path);\n\n const dirs = t_path.split(\"/\");\n const reconstructedPath: string[] = [];\n\n for (const dir of dirs) {\n if (dir === \".\") {\n // Current directory, do nothing\n continue;\n } else if (dir === \"..\") {\n // Parent directory\n const res = reconstructedPath.pop();\n if (res == null) {\n return null; // Array was empty, invalid path\n }\n } else {\n reconstructedPath.push(dir);\n }\n }\n\n return \"/\" + reconstructedPath.join(\"/\");\n}\n","import React, { useState, useEffect } from \"react\";\n\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { IEngine } from \"../IEngine\";\nimport { ITerminal } from \"../Terminal/ITerminal\";\nimport { installAugmentations } from \"../Augmentation/AugmentationHelpers\";\nimport { saveObject } from \"../SaveObject\";\nimport { onExport } from \"../ExportBonus\";\nimport { LocationName } from \"../Locations/data/LocationNames\";\nimport { Location } from \"../Locations/Location\";\nimport { Locations } from \"../Locations/Locations\";\nimport { ITutorial } from \"../InteractiveTutorial\";\nimport { InteractiveTutorialRoot } from \"./InteractiveTutorial/InteractiveTutorialRoot\";\nimport { ITutorialEvents } from \"./InteractiveTutorial/ITutorialEvents\";\n\nimport { Faction } from \"../Faction/Faction\";\nimport { prestigeAugmentation } from \"../Prestige\";\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\nimport { AllServers } from \"../Server/AllServers\";\nimport { Factions } from \"../Faction/Factions\";\nimport { buyStock, sellStock, shortStock, sellShort } from \"../StockMarket/BuyingAndSelling\";\nimport {\n cancelOrder,\n eventEmitterForUiReset,\n initStockMarketFnForReact,\n placeOrder,\n StockMarket,\n} from \"../StockMarket/StockMarket\";\n\nimport { Theme } from \"@mui/material/styles\";\nimport makeStyles from \"@mui/styles/makeStyles\";\nimport createStyles from \"@mui/styles/createStyles\";\nimport Box from \"@mui/material/Box\";\nimport Typography from \"@mui/material/Typography\";\n\nimport { Page, IRouter } from \"./Router\";\nimport { Overview } from \"./React/Overview\";\nimport { SidebarRoot } from \"../Sidebar/ui/SidebarRoot\";\nimport { AugmentationsRoot } from \"../Augmentation/ui/AugmentationsRoot\";\nimport { DevMenuRoot } from \"../DevMenu\";\nimport { BladeburnerRoot } from \"../Bladeburner/ui/BladeburnerRoot\";\nimport { GangRoot } from \"../Gang/ui/GangRoot\";\nimport { CorporationRoot } from \"../Corporation/ui/CorporationRoot\";\nimport { InfiltrationRoot } from \"../Infiltration/ui/InfiltrationRoot\";\nimport { ResleeveRoot } from \"../PersonObjects/Resleeving/ui/ResleeveRoot\";\nimport { WorkInProgressRoot } from \"./WorkInProgressRoot\";\nimport { GameOptionsRoot } from \"../ui/React/GameOptionsRoot\";\nimport { SleeveRoot } from \"../PersonObjects/Sleeve/ui/SleeveRoot\";\nimport { HacknetRoot } from \"../Hacknet/ui/HacknetRoot\";\nimport { GenericLocation } from \"../Locations/ui/GenericLocation\";\nimport { LocationCity } from \"../Locations/ui/City\";\nimport { ProgramsRoot } from \"../Programs/ui/ProgramsRoot\";\nimport { Root as ScriptEditorRoot } from \"../ScriptEditor/ui/Root\";\nimport { MilestonesRoot } from \"../Milestones/ui/MilestonesRoot\";\nimport { TerminalRoot } from \"../Terminal/ui/TerminalRoot\";\nimport { TutorialRoot } from \"../Tutorial/ui/TutorialRoot\";\nimport { ActiveScriptsRoot } from \"../ui/ActiveScripts/ActiveScriptsRoot\";\nimport { FactionsRoot } from \"../Faction/ui/FactionsRoot\";\nimport { HackingMissionRoot } from \"../HackingMission/ui/HackingMissionRoot\";\nimport { FactionRoot } from \"../Faction/ui/FactionRoot\";\nimport { CharacterStats } from \"./CharacterStats\";\nimport { TravelAgencyRoot } from \"../Locations/ui/TravelAgencyRoot\";\nimport { StockMarketRoot } from \"../StockMarket/ui/StockMarketRoot\";\nimport { BitverseRoot } from \"../BitNode/ui/BitverseRoot\";\nimport { CharacterOverview } from \"./React/CharacterOverview\";\nimport { BladeburnerCinematic } from \"../Bladeburner/ui/BladeburnerCinematic\";\nimport { workerScripts } from \"../Netscript/WorkerScripts\";\n\nimport { enterBitNode } from \"../RedPill\";\nimport { Context } from \"./Context\";\n\ninterface IProps {\n terminal: ITerminal;\n player: IPlayer;\n engine: IEngine;\n}\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n root: {\n \"-ms-overflow-style\": \"none\" /* for Internet Explorer, Edge */,\n \"scrollbar-width\": \"none\" /* for Firefox */,\n margin: theme.spacing(0),\n },\n }),\n);\n\nlet filename = \"\";\nlet code = \"\";\n\nexport let Router: IRouter = {\n page: () => {\n throw new Error(\"Router called before initialization\");\n },\n toActiveScripts: () => {\n throw new Error(\"Router called before initialization\");\n },\n toAugmentations: () => {\n throw new Error(\"Router called before initialization\");\n },\n toBitVerse: () => {\n throw new Error(\"Router called before initialization\");\n },\n toBladeburner: () => {\n throw new Error(\"Router called before initialization\");\n },\n toStats: () => {\n throw new Error(\"Router called before initialization\");\n },\n toCity: () => {\n throw new Error(\"Router called before initialization\");\n },\n toCorporation: () => {\n throw new Error(\"Router called before initialization\");\n },\n toCreateProgram: () => {\n throw new Error(\"Router called before initialization\");\n },\n toDevMenu: () => {\n throw new Error(\"Router called before initialization\");\n },\n toFaction: () => {\n throw new Error(\"Router called before initialization\");\n },\n toFactions: () => {\n throw new Error(\"Router called before initialization\");\n },\n toGameOptions: () => {\n throw new Error(\"Router called before initialization\");\n },\n toGang: () => {\n throw new Error(\"Router called before initialization\");\n },\n toHacknetNodes: () => {\n throw new Error(\"Router called before initialization\");\n },\n toInfiltration: () => {\n throw new Error(\"Router called before initialization\");\n },\n toJob: () => {\n throw new Error(\"Router called before initialization\");\n },\n toMilestones: () => {\n throw new Error(\"Router called before initialization\");\n },\n toResleeves: () => {\n throw new Error(\"Router called before initialization\");\n },\n toScriptEditor: () => {\n throw new Error(\"Router called before initialization\");\n },\n toSleeves: () => {\n throw new Error(\"Router called before initialization\");\n },\n toStockMarket: () => {\n throw new Error(\"Router called before initialization\");\n },\n toTerminal: () => {\n throw new Error(\"Router called before initialization\");\n },\n toTravel: () => {\n throw new Error(\"Router called before initialization\");\n },\n toTutorial: () => {\n throw new Error(\"Router called before initialization\");\n },\n toWork: () => {\n throw new Error(\"Router called before initialization\");\n },\n toBladeburnerCinematic: () => {\n throw new Error(\"Router called before initialization\");\n },\n toLocation: () => {\n throw new Error(\"Router called before initialization\");\n },\n toHackingMission: () => {\n throw new Error(\"Router called before initialization\");\n },\n};\n\nfunction determineStartPage(player: IPlayer): Page {\n if (player.isWorking) return Page.Work;\n return Page.Terminal;\n}\n\nexport function GameRoot({ player, engine, terminal }: IProps): React.ReactElement {\n const classes = useStyles();\n const [page, setPage] = useState(determineStartPage(player));\n const setRerender = useState(0)[1];\n const [faction, setFaction] = useState(\n player.currentWorkFactionName ? Factions[player.currentWorkFactionName] : (undefined as unknown as Faction),\n );\n if (faction === undefined && page === Page.Faction)\n throw new Error(\"Trying to go to a page without the proper setup\");\n\n const [flume, setFlume] = useState(false);\n const [quick, setQuick] = useState(false);\n const [location, setLocation] = useState(undefined as unknown as Location);\n if (location === undefined && (page === Page.Infiltration || page === Page.Location || page === Page.Job))\n throw new Error(\"Trying to go to a page without the proper setup\");\n\n const [cinematicText, setCinematicText] = useState(\"\");\n\n function rerender(): void {\n setRerender((old) => old + 1);\n }\n useEffect(() => {\n return ITutorialEvents.subscribe(rerender);\n }, []);\n\n Router = {\n page: () => page,\n toActiveScripts: () => setPage(Page.ActiveScripts),\n toAugmentations: () => setPage(Page.Augmentations),\n toBladeburner: () => setPage(Page.Bladeburner),\n toStats: () => setPage(Page.Stats),\n toCorporation: () => setPage(Page.Corporation),\n toCreateProgram: () => setPage(Page.CreateProgram),\n toDevMenu: () => setPage(Page.DevMenu),\n toFaction: (faction?: Faction) => {\n setPage(Page.Faction);\n if (faction) setFaction(faction);\n },\n toFactions: () => setPage(Page.Factions),\n toGameOptions: () => setPage(Page.Options),\n toGang: () => setPage(Page.Gang),\n toHacknetNodes: () => setPage(Page.Hacknet),\n toMilestones: () => setPage(Page.Milestones),\n toResleeves: () => setPage(Page.Resleeves),\n toScriptEditor: (fn: string, c: string) => {\n filename = fn;\n code = c;\n setPage(Page.CreateScript);\n },\n toSleeves: () => setPage(Page.Sleeves),\n toStockMarket: () => setPage(Page.StockMarket),\n toTerminal: () => setPage(Page.Terminal),\n toTutorial: () => setPage(Page.Tutorial),\n toJob: () => {\n setLocation(Locations[player.companyName]);\n setPage(Page.Job);\n },\n toCity: () => {\n setPage(Page.City);\n },\n toTravel: () => {\n player.gotoLocation(LocationName.TravelAgency);\n setPage(Page.Travel);\n },\n toBitVerse: (flume: boolean, quick: boolean) => {\n setFlume(flume);\n setQuick(quick);\n setPage(Page.BitVerse);\n },\n toInfiltration: (location: Location) => {\n setLocation(location);\n setPage(Page.Infiltration);\n },\n toWork: () => setPage(Page.Work),\n toBladeburnerCinematic: () => {\n setPage(Page.BladeburnerCinematic);\n setCinematicText(cinematicText);\n },\n toLocation: (location: Location) => {\n setLocation(location);\n setPage(Page.Location);\n },\n toHackingMission: (faction: Faction) => {\n setPage(Page.HackingMission);\n setFaction(faction);\n },\n };\n\n useEffect(() => {\n filename = \"\";\n code = \"\";\n if (page !== Page.Terminal) window.scrollTo(0, 0);\n });\n\n return (\n \n \n \n {!ITutorial.isRunning ? (\n saveObject.saveGame()} />\n ) : (\n \n )}\n \n {page === Page.BitVerse ? (\n \n ) : page === Page.Infiltration ? (\n \n ) : page === Page.HackingMission ? (\n \n ) : page === Page.BladeburnerCinematic ? (\n \n ) : page === Page.Work ? (\n \n ) : (\n \n \n \n {page === Page.Terminal ? (\n \n ) : page === Page.Sleeves ? (\n \n ) : page === Page.Stats ? (\n \n ) : page === Page.CreateScript ? (\n \n ) : page === Page.ActiveScripts ? (\n \n ) : page === Page.Hacknet ? (\n \n ) : page === Page.CreateProgram ? (\n \n ) : page === Page.Factions ? (\n \n ) : page === Page.Faction ? (\n \n ) : page === Page.Milestones ? (\n \n ) : page === Page.Tutorial ? (\n \n ) : page === Page.DevMenu ? (\n \n ) : page === Page.Gang ? (\n \n ) : page === Page.Corporation ? (\n \n ) : page === Page.Bladeburner ? (\n \n ) : page === Page.Resleeves ? (\n \n ) : page === Page.Travel ? (\n \n ) : page === Page.StockMarket ? (\n \n ) : page === Page.City ? (\n \n ) : page === Page.Job ? (\n \n ) : page === Page.Location ? (\n \n ) : page === Page.Options ? (\n saveObject.saveGame()}\n export={() => saveObject.exportGame()}\n forceKill={() => {\n for (const hostname of Object.keys(AllServers)) {\n AllServers[hostname].runningScripts = [];\n }\n dialogBoxCreate(\"Forcefully deleted all running scripts. Please save and refresh page.\");\n }}\n softReset={() => {\n dialogBoxCreate(\"Soft Reset!\");\n prestigeAugmentation();\n Router.toTerminal();\n }}\n />\n ) : page === Page.Augmentations ? (\n {\n saveObject.exportGame();\n onExport(player);\n }}\n installAugmentationsFn={() => {\n installAugmentations();\n Router.toTerminal();\n }}\n />\n ) : (\n <>\n Cannot load\n \n )}\n \n \n )}\n \n \n );\n}\n","// Class representing a single hackable Server\nimport { BaseServer } from \"./BaseServer\";\n\nimport { BitNodeMultipliers } from \"../BitNode/BitNodeMultipliers\";\n\nimport { createRandomString } from \"../utils/helpers/createRandomString\";\nimport { createRandomIp } from \"../../utils/IPAddress\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\nexport interface IConstructorParams {\n adminRights?: boolean;\n hackDifficulty?: number;\n hostname: string;\n ip?: string;\n isConnectedTo?: boolean;\n maxRam?: number;\n moneyAvailable?: number;\n numOpenPortsRequired?: number;\n organizationName?: string;\n purchasedByPlayer?: boolean;\n requiredHackingSkill?: number;\n serverGrowth?: number;\n}\n\nexport class Server extends BaseServer {\n // Flag indicating whether this server has a backdoor installed by a player\n backdoorInstalled = false;\n\n // Initial server security level\n // (i.e. security level when the server was created)\n baseDifficulty = 1;\n\n // Server Security Level\n hackDifficulty = 1;\n\n // Minimum server security level that this server can be weakened to\n minDifficulty = 1;\n\n // How much money currently resides on the server and can be hacked\n moneyAvailable = 0;\n\n // Maximum amount of money that this server can hold\n moneyMax = 0;\n\n // Number of open ports required in order to gain admin/root access\n numOpenPortsRequired = 5;\n\n // How many ports are currently opened on the server\n openPortCount = 0;\n\n // Flag indicating wehther this is a purchased server\n purchasedByPlayer = false;\n\n // Hacking level required to hack this server\n requiredHackingSkill = 1;\n\n // Parameter that affects how effectively this server's money can\n // be increased using the grow() Netscript function\n serverGrowth = 1;\n\n constructor(params: IConstructorParams = { hostname: \"\", ip: createRandomIp() }) {\n super(params);\n\n // \"hacknet-node-X\" hostnames are reserved for Hacknet Servers\n if (this.hostname.startsWith(\"hacknet-node-\")) {\n this.hostname = createRandomString(10);\n }\n\n this.purchasedByPlayer = params.purchasedByPlayer != null ? params.purchasedByPlayer : false;\n\n //RAM, CPU speed and Scripts\n this.maxRam = params.maxRam != null ? params.maxRam : 0; //GB\n\n /* Hacking information (only valid for \"foreign\" aka non-purchased servers) */\n this.requiredHackingSkill = params.requiredHackingSkill != null ? params.requiredHackingSkill : 1;\n this.moneyAvailable =\n params.moneyAvailable != null ? params.moneyAvailable * BitNodeMultipliers.ServerStartingMoney : 0;\n this.moneyMax = 25 * this.moneyAvailable * BitNodeMultipliers.ServerMaxMoney;\n\n //Hack Difficulty is synonymous with server security. Base Difficulty = Starting difficulty\n this.hackDifficulty =\n params.hackDifficulty != null ? params.hackDifficulty * BitNodeMultipliers.ServerStartingSecurity : 1;\n this.baseDifficulty = this.hackDifficulty;\n this.minDifficulty = Math.max(1, Math.round(this.hackDifficulty / 3));\n this.serverGrowth = params.serverGrowth != null ? params.serverGrowth : 1; //Integer from 0 to 100. Affects money increase from grow()\n\n //Port information, required for porthacking servers to get admin rights\n this.numOpenPortsRequired = params.numOpenPortsRequired != null ? params.numOpenPortsRequired : 5;\n }\n\n /**\n * Ensures that the server's difficulty (server security) doesn't get too high\n */\n capDifficulty(): void {\n if (this.hackDifficulty < this.minDifficulty) {\n this.hackDifficulty = this.minDifficulty;\n }\n if (this.hackDifficulty < 1) {\n this.hackDifficulty = 1;\n }\n\n // Place some arbitrarily limit that realistically should never happen unless someone is\n // screwing around with the game\n if (this.hackDifficulty > 100) {\n this.hackDifficulty = 100;\n }\n }\n\n /**\n * Change this server's minimum security\n * @param n - Value by which to increase/decrease the server's minimum security\n * @param perc - Whether it should be changed by a percentage, or a flat value\n */\n changeMinimumSecurity(n: number, perc = false): void {\n if (perc) {\n this.minDifficulty *= n;\n } else {\n this.minDifficulty += n;\n }\n\n // Server security cannot go below 1\n this.minDifficulty = Math.max(1, this.minDifficulty);\n }\n\n /**\n * Change this server's maximum money\n * @param n - Value by which to change the server's maximum money\n * @param perc - Whether it should be changed by a percentage, or a flat value\n */\n changeMaximumMoney(n: number, perc = false): void {\n if (perc) {\n this.moneyMax *= n;\n } else {\n this.moneyMax += n;\n }\n }\n\n /**\n * Strengthens a server's security level (difficulty) by the specified amount\n */\n fortify(amt: number): void {\n this.hackDifficulty += amt;\n this.capDifficulty();\n }\n\n /**\n * Lowers the server's security level (difficulty) by the specified amount)\n */\n weaken(amt: number): void {\n this.hackDifficulty -= amt * BitNodeMultipliers.ServerWeakenRate;\n this.capDifficulty();\n }\n\n /**\n * Serialize the current object to a JSON save state\n */\n toJSON(): any {\n return Generic_toJSON(\"Server\", this);\n }\n\n // Initializes a Server Object from a JSON save state\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Server {\n return Generic_fromJSON(Server, value.data);\n }\n}\n\nReviver.constructors.Server = Server;\n","import * as React from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { ICorporation } from \"../ICorporation\";\n\ninterface IProps {\n money: number;\n corp: ICorporation;\n}\nexport function MoneyCost(props: IProps): JSX.Element {\n if (!props.corp.funds.gt(props.money))\n return {numeralWrapper.formatMoney(props.money)};\n\n return {numeralWrapper.formatMoney(props.money)};\n}\n","import { Reviver, Generic_toJSON, Generic_fromJSON } from \"../../utils/JSONReviver\";\n\nexport class Message {\n // Name of Message file\n filename = \"\";\n\n // The text contains in the Message\n msg = \"\";\n\n // Flag indicating whether this Message has been received by the player\n recvd = false;\n\n constructor(filename = \"\", msg = \"\") {\n this.filename = filename;\n this.msg = msg;\n this.recvd = false;\n }\n\n // Serialize the current object to a JSON save state\n toJSON(): any {\n return Generic_toJSON(\"Message\", this);\n }\n\n // Initializes a Message Object from a JSON save state\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Message {\n return Generic_fromJSON(Message, value.data);\n }\n}\n\nReviver.constructors.Message = Message;\n","import { Operation, IOperationParams } from \"./Operation\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\nexport class BlackOperation extends Operation {\n constructor(params: IOperationParams | null = null) {\n super(params);\n this.count = 1;\n }\n\n // To be implemented by subtypes\n getActionTimePenalty(): number {\n return 1.5;\n }\n\n getChaosCompetencePenalty(/*inst: IBladeburner, params: ISuccessChanceParams*/): number {\n return 1;\n }\n\n getChaosDifficultyBonus(/*inst: IBladeburner, params: ISuccessChanceParams*/): number {\n return 1;\n }\n\n toJSON(): any {\n return Generic_toJSON(\"BlackOperation\", this);\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Operation {\n return Generic_fromJSON(BlackOperation, value.data);\n }\n}\n\nReviver.constructors.BlackOperation = BlackOperation;\n","export const SkillNames: {\n BladesIntuition: string;\n Cloak: string;\n Marksman: string;\n WeaponProficiency: string;\n ShortCircuit: string;\n DigitalObserver: string;\n Tracer: string;\n Overclock: string;\n Reaper: string;\n EvasiveSystem: string;\n Datamancer: string;\n CybersEdge: string;\n HandsOfMidas: string;\n Hyperdrive: string;\n} = {\n BladesIntuition: \"Blade's Intuition\",\n Cloak: \"Cloak\",\n Marksman: \"Marksman\",\n WeaponProficiency: \"Weapon Proficiency\",\n ShortCircuit: \"Short-Circuit\",\n DigitalObserver: \"Digital Observer\",\n Tracer: \"Tracer\",\n Overclock: \"Overclock\",\n Reaper: \"Reaper\",\n EvasiveSystem: \"Evasive System\",\n Datamancer: \"Datamancer\",\n CybersEdge: \"Cyber's Edge\",\n HandsOfMidas: \"Hands of Midas\",\n Hyperdrive: \"Hyperdrive\",\n};\n","import { Terminal as TTerminal } from \"./Terminal/Terminal\";\n\nexport const Terminal = new TTerminal();\n","import { IMinMaxRange } from \"../types\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\nimport { getRandomInt } from \"../../utils/helpers/getRandomInt\";\n\nexport const StockForecastInfluenceLimit = 5;\n\nexport interface IConstructorParams {\n b: boolean;\n initPrice: number | IMinMaxRange;\n marketCap: number;\n mv: number | IMinMaxRange;\n name: string;\n otlkMag: number;\n spreadPerc: number | IMinMaxRange;\n shareTxForMovement: number | IMinMaxRange;\n symbol: string;\n}\n\nconst defaultConstructorParams: IConstructorParams = {\n b: true,\n initPrice: 10e3,\n marketCap: 1e12,\n mv: 1,\n name: \"\",\n otlkMag: 0,\n spreadPerc: 0,\n shareTxForMovement: 1e6,\n symbol: \"\",\n};\n\n// Helper function that convert a IMinMaxRange to a number\nfunction toNumber(n: number | IMinMaxRange): number {\n let value: number;\n switch (typeof n) {\n case \"number\": {\n return n;\n }\n case \"object\": {\n const range = n as IMinMaxRange;\n value = getRandomInt(range.min, range.max);\n break;\n }\n default:\n throw Error(`Do not know how to convert the type '${typeof n}' to a number`);\n }\n\n if (typeof n === \"object\" && typeof n.divisor === \"number\") {\n return value / n.divisor;\n }\n\n return value;\n}\n\n/**\n * Represents the valuation of a company in the World Stock Exchange.\n */\nexport class Stock {\n /**\n * Bear or bull (more likely to go up or down, based on otlkMag)\n */\n b: boolean;\n\n /**\n * Maximum price of a stock (per share)\n */\n readonly cap: number;\n\n /**\n * Stocks previous share price\n */\n lastPrice: number;\n\n /**\n * Maximum number of shares that player can own (both long and short combined)\n */\n readonly maxShares: number;\n\n /**\n * Maximum volatility\n */\n readonly mv: number;\n\n /**\n * Name of the company that the stock is for\n */\n readonly name: string;\n\n /**\n * Outlook magnitude. Represents the stock's forecast and likelihood\n * of increasing/decreasing (based on whether its in bear or bull mode)\n */\n otlkMag: number;\n\n /**\n * Forecast of outlook magnitude. Essentially a second-order forecast.\n * Unlike 'otlkMag', this number is on an absolute scale from 0-100 (rather than 0-50)\n */\n otlkMagForecast: number;\n\n /**\n * Average price of stocks that the player owns in the LONG position\n */\n playerAvgPx: number;\n\n /**\n * Average price of stocks that the player owns in the SHORT position\n */\n playerAvgShortPx: number;\n\n /**\n * Number of shares the player owns in the LONG position\n */\n playerShares: number;\n\n /**\n * Number of shares the player owns in the SHORT position\n */\n playerShortShares: number;\n\n /**\n * Stock's share price\n */\n price: number;\n\n /**\n * How many shares need to be transacted in order to trigger a price movement\n */\n readonly shareTxForMovement: number;\n\n /**\n * How many share transactions remaining until a price movement occurs\n * (separately tracked for upward and downward movements)\n */\n shareTxUntilMovement: number;\n\n /**\n * Spread percentage. The bid/ask prices for this stock are N% above or below\n * the \"real price\" to emulate spread.\n */\n readonly spreadPerc: number;\n\n /**\n * The stock's ticker symbol\n */\n readonly symbol: string;\n\n /**\n * Total number of shares of this stock\n * This is different than maxShares, as this is like authorized stock while\n * maxShares is outstanding stock.\n */\n readonly totalShares: number;\n\n constructor(p: IConstructorParams = defaultConstructorParams) {\n this.name = p.name;\n this.symbol = p.symbol;\n this.price = toNumber(p.initPrice);\n this.lastPrice = this.price;\n this.playerShares = 0;\n this.playerAvgPx = 0;\n this.playerShortShares = 0;\n this.playerAvgShortPx = 0;\n this.mv = toNumber(p.mv);\n this.b = p.b;\n this.otlkMag = p.otlkMag;\n this.otlkMagForecast = this.getAbsoluteForecast();\n this.cap = getRandomInt(this.price * 1e3, this.price * 25e3);\n this.spreadPerc = toNumber(p.spreadPerc);\n this.shareTxForMovement = toNumber(p.shareTxForMovement);\n this.shareTxUntilMovement = this.shareTxForMovement;\n\n // Total shares is determined by market cap, and is rounded to nearest 100k\n const totalSharesUnrounded: number = p.marketCap / this.price;\n this.totalShares = Math.round(totalSharesUnrounded / 1e5) * 1e5;\n\n // Max Shares (Outstanding shares) is a percentage of total shares\n const outstandingSharePercentage = 0.2;\n this.maxShares = Math.round((this.totalShares * outstandingSharePercentage) / 1e5) * 1e5;\n }\n\n /**\n * Safely set the stock's second-order forecast to a new value\n */\n changeForecastForecast(newff: number): void {\n this.otlkMagForecast = newff;\n if (this.otlkMagForecast > 100) {\n this.otlkMagForecast = 100;\n } else if (this.otlkMagForecast < 0) {\n this.otlkMagForecast = 0;\n }\n }\n\n /**\n * Set the stock to a new price. Also updates the stock's previous price tracker\n */\n changePrice(newPrice: number): void {\n this.lastPrice = this.price;\n this.price = newPrice;\n }\n\n /**\n * Change the stock's forecast during a stock market 'tick'.\n * The way a stock's forecast changes depends on various internal properties,\n * but is ultimately determined by RNG\n */\n cycleForecast(changeAmt = 0.1): void {\n const increaseChance = this.getForecastIncreaseChance();\n\n if (Math.random() < increaseChance) {\n // Forecast increases\n if (this.b) {\n this.otlkMag += changeAmt;\n } else {\n this.otlkMag -= changeAmt;\n }\n } else {\n // Forecast decreases\n if (this.b) {\n this.otlkMag -= changeAmt;\n } else {\n this.otlkMag += changeAmt;\n }\n }\n\n this.otlkMag = Math.min(this.otlkMag, 50);\n if (this.otlkMag < 0) {\n this.otlkMag *= -1;\n this.b = !this.b;\n }\n }\n\n /**\n * Change's the stock's second-order forecast during a stock market 'tick'.\n * The change for the second-order forecast to increase is 50/50\n */\n cycleForecastForecast(changeAmt = 0.1): void {\n if (Math.random() < 0.5) {\n this.changeForecastForecast(this.otlkMagForecast + changeAmt);\n } else {\n this.changeForecastForecast(this.otlkMagForecast - changeAmt);\n }\n }\n\n /**\n * \"Flip\" the stock's second-order forecast. This can occur during a\n * stock market \"cycle\" (determined by RNG). It is used to simulate\n * RL stock market cycles and introduce volatility\n */\n flipForecastForecast(): void {\n const diff = this.otlkMagForecast - 50;\n this.otlkMagForecast = 50 + -1 * diff;\n }\n\n /**\n * Returns the stock's absolute forecast, which is a number between 0-100\n */\n getAbsoluteForecast(): number {\n return this.b ? 50 + this.otlkMag : 50 - this.otlkMag;\n }\n\n /**\n * Return the price at which YOUR stock is bought (market ask price). Accounts for spread\n */\n getAskPrice(): number {\n return this.price * (1 + this.spreadPerc / 100);\n }\n\n /**\n * Return the price at which YOUR stock is sold (market bid price). Accounts for spread\n */\n getBidPrice(): number {\n return this.price * (1 - this.spreadPerc / 100);\n }\n\n /**\n * Returns the chance (0-1 decimal) that a stock has of having its forecast increase\n */\n getForecastIncreaseChance(): number {\n const diff = this.otlkMagForecast - this.getAbsoluteForecast();\n\n return (50 + Math.min(Math.max(diff, -45), 45)) / 100;\n }\n\n /**\n * Changes a stock's forecast. This is used when the stock is influenced\n * by a transaction. The stock's forecast always goes towards 50, but the\n * movement is capped by a certain threshold/limit\n */\n influenceForecast(change: number): void {\n if (this.otlkMag > StockForecastInfluenceLimit) {\n this.otlkMag = Math.max(StockForecastInfluenceLimit, this.otlkMag - change);\n }\n }\n\n /**\n * Changes a stock's second-order forecast. This is used when the stock is\n * influenced by a transaction. The stock's second-order forecast always\n * goes towards 50.\n */\n influenceForecastForecast(change: number): void {\n if (this.otlkMagForecast > 50) {\n this.otlkMagForecast -= change;\n this.otlkMagForecast = Math.max(50, this.otlkMagForecast);\n } else if (this.otlkMagForecast < 50) {\n this.otlkMagForecast += change;\n this.otlkMagForecast = Math.min(50, this.otlkMagForecast);\n }\n }\n\n /**\n * Serialize the Stock to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"Stock\", this);\n }\n\n /**\n * Initializes a Stock from a JSON save state\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Stock {\n return Generic_fromJSON(Stock, value.data);\n }\n}\n\nReviver.constructors.Stock = Stock;\n","/**\n * Stops an actively-running script (represented by a WorkerScript object)\n * and removes it from the global pool of active scripts.\n */\nimport { WorkerScript } from \"./WorkerScript\";\nimport { workerScripts } from \"./WorkerScripts\";\nimport { WorkerScriptStartStopEventEmitter } from \"./WorkerScriptStartStopEventEmitter\";\n\nimport { RunningScript } from \"../Script/RunningScript\";\nimport { AllServers } from \"../Server/AllServers\";\n\nimport { compareArrays } from \"../../utils/helpers/compareArrays\";\nimport { roundToTwo } from \"../../utils/helpers/roundToTwo\";\n\nexport function killWorkerScript(runningScriptObj: RunningScript, serverIp: string, rerenderUi: boolean): boolean;\nexport function killWorkerScript(workerScript: WorkerScript): boolean;\nexport function killWorkerScript(pid: number): boolean;\nexport function killWorkerScript(\n script: RunningScript | WorkerScript | number,\n serverIp?: string,\n rerenderUi?: boolean,\n): boolean {\n if (rerenderUi == null || typeof rerenderUi !== \"boolean\") {\n rerenderUi = true;\n }\n\n if (script instanceof WorkerScript) {\n stopAndCleanUpWorkerScript(script);\n\n return true;\n } else if (script instanceof RunningScript && typeof serverIp === \"string\") {\n // Try to kill by PID\n const res = killWorkerScriptByPid(script.pid, rerenderUi);\n if (res) {\n return res;\n }\n\n // If for some reason that doesn't work, we'll try the old way\n for (const ws of workerScripts.values()) {\n if (ws.name == script.filename && ws.serverIp == serverIp && compareArrays(ws.args, script.args)) {\n stopAndCleanUpWorkerScript(ws, rerenderUi);\n\n return true;\n }\n }\n\n return false;\n } else if (typeof script === \"number\") {\n return killWorkerScriptByPid(script, rerenderUi);\n } else {\n console.error(`killWorkerScript() called with invalid argument:`);\n console.error(script);\n return false;\n }\n}\n\nfunction killWorkerScriptByPid(pid: number, rerenderUi = true): boolean {\n const ws = workerScripts.get(pid);\n if (ws instanceof WorkerScript) {\n stopAndCleanUpWorkerScript(ws, rerenderUi);\n\n return true;\n }\n\n return false;\n}\n\nfunction stopAndCleanUpWorkerScript(workerScript: WorkerScript, rerenderUi = true): void {\n workerScript.env.stopFlag = true;\n killNetscriptDelay(workerScript);\n removeWorkerScript(workerScript, rerenderUi);\n}\n\n/**\n * Helper function that removes the script being killed from the global pool.\n * Also handles other cleanup-time operations\n *\n * @param {WorkerScript | number} - Identifier for WorkerScript. Either the object itself, or\n * its index in the global workerScripts array\n */\nfunction removeWorkerScript(workerScript: WorkerScript, rerenderUi = true): void {\n if (workerScript instanceof WorkerScript) {\n const ip = workerScript.serverIp;\n const name = workerScript.name;\n\n // Get the server on which the script runs\n const server = AllServers[ip];\n if (server == null) {\n console.error(`Could not find server on which this script is running: ${ip}`);\n return;\n }\n\n // Recalculate ram used on that server\n server.ramUsed = roundToTwo(server.ramUsed - workerScript.ramUsage);\n if (server.ramUsed < 0) {\n console.warn(\n `Server (${server.hostname}) RAM usage went negative (if it's due to floating pt imprecision, it's okay): ${server.ramUsed}`,\n );\n server.ramUsed = 0;\n }\n\n // Delete the RunningScript object from that server\n for (let i = 0; i < server.runningScripts.length; ++i) {\n const runningScript = server.runningScripts[i];\n if (runningScript.filename === name && compareArrays(runningScript.args, workerScript.args)) {\n server.runningScripts.splice(i, 1);\n break;\n }\n }\n\n // Delete script from global pool (workerScripts)\n const res = workerScripts.delete(workerScript.pid);\n if (!res) {\n console.warn(`removeWorkerScript() called with WorkerScript that wasn't in the global map:`);\n console.warn(workerScript);\n }\n\n if (rerenderUi) {\n WorkerScriptStartStopEventEmitter.emit();\n }\n } else {\n console.error(`Invalid argument passed into removeWorkerScript():`);\n console.error(workerScript);\n return;\n }\n}\n\n/**\n * Helper function that interrupts a script's delay if it is in the middle of a\n * timed, blocked operation (like hack(), sleep(), etc.). This allows scripts to\n * be killed immediately even if they're in the middle of one of those long operations\n */\nfunction killNetscriptDelay(workerScript: WorkerScript): void {\n if (workerScript instanceof WorkerScript) {\n if (workerScript.delay) {\n clearTimeout(workerScript.delay);\n if (workerScript.delayResolve) {\n workerScript.delayResolve();\n }\n }\n }\n}\n","/**\n * Map of all Cities in the game\n * Key = City Name, Value = City object\n */\nimport { City } from \"./City\";\nimport { IMap } from \"../types\";\n\nexport const Cities: IMap = {};\n","export const FconfSettings = {\n ENABLE_BASH_HOTKEYS: false,\n ENABLE_TIMESTAMPS: false,\n MAIN_MENU_STYLE: \"default\",\n THEME_BACKGROUND_COLOR: \"#000000\",\n THEME_FONT_COLOR: \"#66ff33\",\n THEME_HIGHLIGHT_COLOR: \"#ffffff\",\n THEME_PROMPT_COLOR: \"#f92672\",\n WRAP_INPUT: false,\n};\n","import React, { useState } from \"react\";\nimport AddIcon from \"@mui/icons-material/Add\";\nimport RemoveIcon from \"@mui/icons-material/Remove\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ClearIcon from \"@mui/icons-material/Clear\";\nimport DoubleArrowIcon from \"@mui/icons-material/DoubleArrow\";\nimport TextField from \"@mui/material/TextField\";\nimport Tooltip from \"@mui/material/Tooltip\";\n\ninterface IProps {\n label: string;\n placeholder: string;\n add: (x: number) => void;\n subtract: (x: number) => void;\n tons: () => void;\n reset: () => void;\n}\n\nexport function Adjuster(props: IProps): React.ReactElement {\n const [value, setValue] = useState(\"\");\n\n function onChange(event: React.ChangeEvent): void {\n if (event.target.value === \"\") setValue(\"\");\n else setValue(parseFloat(event.target.value));\n }\n\n const { label, placeholder, add, subtract, reset, tons } = props;\n return (\n <>\n \n \n \n \n \n \n \n add(typeof value !== \"string\" ? value : 0)} size=\"large\">\n \n \n \n \n ),\n endAdornment: (\n <>\n \n subtract(typeof value !== \"string\" ? value : 0)} size=\"large\">\n \n \n \n \n \n \n \n \n \n ),\n }}\n />\n \n );\n}\n","import { IMap } from \"./types\";\nimport { Terminal } from \"./Terminal\";\n\nexport let Aliases: IMap = {};\nexport let GlobalAliases: IMap = {};\n\nexport function loadAliases(saveString: string): void {\n if (saveString === \"\") {\n Aliases = {};\n } else {\n Aliases = JSON.parse(saveString);\n }\n}\n\nexport function loadGlobalAliases(saveString: string): void {\n if (saveString === \"\") {\n GlobalAliases = {};\n } else {\n GlobalAliases = JSON.parse(saveString);\n }\n}\n\n// Prints all aliases to terminal\nexport function printAliases(): void {\n for (const name in Aliases) {\n if (Aliases.hasOwnProperty(name)) {\n Terminal.print(\"alias \" + name + \"=\" + Aliases[name]);\n }\n }\n for (const name in GlobalAliases) {\n if (GlobalAliases.hasOwnProperty(name)) {\n Terminal.print(\"global alias \" + name + \"=\" + GlobalAliases[name]);\n }\n }\n}\n\n// Returns true if successful, false otherwise\nexport function parseAliasDeclaration(dec: string, global = false): boolean {\n const re = /^([_|\\w|!|%|,|@]+)=\"(.+)\"$/;\n const matches = dec.match(re);\n if (matches == null || matches.length != 3) {\n return false;\n }\n if (global) {\n addGlobalAlias(matches[1], matches[2]);\n } else {\n addAlias(matches[1], matches[2]);\n }\n return true;\n}\n\nfunction addAlias(name: string, value: string): void {\n if (name in GlobalAliases) {\n delete GlobalAliases[name];\n }\n Aliases[name] = value.trim();\n}\n\nfunction addGlobalAlias(name: string, value: string): void {\n if (name in Aliases) {\n delete Aliases[name];\n }\n GlobalAliases[name] = value.trim();\n}\n\nfunction getAlias(name: string): string | null {\n if (Aliases.hasOwnProperty(name)) {\n return Aliases[name];\n }\n\n return null;\n}\n\nfunction getGlobalAlias(name: string): string | null {\n if (GlobalAliases.hasOwnProperty(name)) {\n return GlobalAliases[name];\n }\n return null;\n}\n\nexport function removeAlias(name: string): boolean {\n if (Aliases.hasOwnProperty(name)) {\n delete Aliases[name];\n return true;\n }\n\n if (GlobalAliases.hasOwnProperty(name)) {\n delete GlobalAliases[name];\n return true;\n }\n\n return false;\n}\n\n/**\n * Returns the original string with any aliases substituted in.\n * Aliases are only applied to \"whole words\", one level deep\n */\nexport function substituteAliases(origCommand: string): string {\n const commandArray = origCommand.split(\" \");\n if (commandArray.length > 0) {\n // For the alias and unalias commands, dont substite\n if (commandArray[0] === \"unalias\" || commandArray[0] === \"alias\") {\n return commandArray.join(\" \");\n }\n\n let somethingSubstituted = true;\n let depth = 0;\n\n while (somethingSubstituted && depth < 10) {\n depth++;\n somethingSubstituted = false;\n const alias = getAlias(commandArray[0])?.split(\" \");\n if (alias != null) {\n somethingSubstituted = true;\n commandArray.splice(0, 1, ...alias);\n //commandArray[0] = alias;\n }\n for (let i = 0; i < commandArray.length; ++i) {\n const alias = getGlobalAlias(commandArray[i])?.split(\" \");\n if (alias != null) {\n somethingSubstituted = true;\n commandArray.splice(i, 1, ...alias);\n i += alias.length - 1;\n //commandArray[i] = alias;\n }\n }\n }\n }\n return commandArray.join(\" \");\n}\n","import { setTimeoutRef } from \"./utils/SetTimeoutRef\";\n\nimport { isString } from \"../utils/helpers/isString\";\nimport { AllServers } from \"./Server/AllServers\";\n\nexport function netscriptDelay(time, workerScript) {\n return new Promise(function (resolve) {\n workerScript.delay = setTimeoutRef(() => {\n workerScript.delay = null;\n resolve();\n }, time);\n workerScript.delayResolve = resolve;\n });\n}\n\nexport function makeRuntimeRejectMsg(workerScript, msg, exp = null) {\n var lineNum = \"\";\n if (exp != null) {\n var num = getErrorLineNumber(exp, workerScript);\n lineNum = \" (Line \" + num + \")\";\n }\n const server = AllServers[workerScript.serverIp];\n if (server == null) {\n throw new Error(`WorkerScript constructed with invalid server ip: ${this.serverIp}`);\n }\n\n return \"|\" + server.hostname + \"|\" + workerScript.name + \"|\" + msg + lineNum;\n}\n\nexport function resolveNetscriptRequestedThreads(workerScript, functionName, requestedThreads) {\n const threads = workerScript.scriptRef.threads;\n if (!requestedThreads) {\n return isNaN(threads) || threads < 1 ? 1 : threads;\n }\n const requestedThreadsAsInt = requestedThreads | 0;\n if (isNaN(requestedThreads) || requestedThreadsAsInt < 1) {\n throw makeRuntimeRejectMsg(\n workerScript,\n `Invalid thread count passed to ${functionName}: ${requestedThreads}. Threads must be a positive number.`,\n );\n }\n if (requestedThreads > threads) {\n throw makeRuntimeRejectMsg(\n workerScript,\n `Too many threads requested by ${functionName}. Requested: ${requestedThreads}. Has: ${threads}.`,\n );\n }\n return requestedThreadsAsInt;\n}\n\nexport function getErrorLineNumber(exp, workerScript) {\n var code = workerScript.scriptRef.codeCode();\n\n //Split code up to the start of the node\n try {\n code = code.substring(0, exp.start);\n return (code.match(/\\n/g) || []).length + 1;\n } catch (e) {\n return -1;\n }\n}\n\nexport function isScriptErrorMessage(msg) {\n if (!isString(msg)) {\n return false;\n }\n let splitMsg = msg.split(\"|\");\n if (splitMsg.length != 4) {\n return false;\n }\n return true;\n}\n","/**\n * Lore / world building literature files that can be found on servers.\n * These files can be read by the player\n */\nexport class Literature {\n title: string;\n fn: string;\n txt: string;\n\n constructor(title: string, filename: string, txt: string) {\n this.title = title;\n this.fn = filename;\n this.txt = txt;\n }\n}\n","import * as React from \"react\";\n\nexport enum ClickableTag {\n Tag_span,\n Tag_h1,\n}\n\ntype IProps = {\n value: string;\n tag: ClickableTag;\n};\n\ntype IState = {\n tooltipVisible: boolean;\n};\n\nexport class CopyableText extends React.Component {\n public static defaultProps = {\n //Default span to prevent destroying current clickables\n tag: ClickableTag.Tag_span,\n };\n\n constructor(props: IProps) {\n super(props);\n\n this.copy = this.copy.bind(this);\n this.tooltipClasses = this.tooltipClasses.bind(this);\n this.textClasses = this.textClasses.bind(this);\n\n this.state = {\n tooltipVisible: false,\n };\n }\n\n copy(): void {\n const copyText = document.createElement(\"textarea\");\n copyText.value = this.props.value;\n document.body.appendChild(copyText);\n copyText.select();\n copyText.setSelectionRange(0, 1e10);\n document.execCommand(\"copy\");\n document.body.removeChild(copyText);\n this.setState({ tooltipVisible: true });\n setTimeout(() => this.setState({ tooltipVisible: false }), 1000);\n }\n\n tooltipClasses(): string {\n let classes = \"copy_tooltip_text\";\n if (this.state.tooltipVisible) {\n classes += \" copy_tooltip_text_visible\";\n }\n\n return classes;\n }\n\n textClasses(): string {\n let classes = \"copy_tooltip noselect text\";\n if (this.state.tooltipVisible) {\n classes += \" copy_tooltip_copied\";\n }\n\n return classes;\n }\n\n render(): React.ReactNode {\n switch (this.props.tag) {\n case ClickableTag.Tag_h1:\n return (\n

\n {this.props.value}\n Copied!\n

\n );\n case ClickableTag.Tag_span:\n return (\n \n {this.props.value}\n Copied!\n \n );\n }\n }\n}\n","import { Augmentation } from \"./Augmentation\";\nimport { Augmentations } from \"./Augmentations\";\nimport { PlayerOwnedAugmentation } from \"./PlayerOwnedAugmentation\";\nimport { AugmentationNames } from \"./data/AugmentationNames\";\n\nimport { BitNodeMultipliers } from \"../BitNode/BitNodeMultipliers\";\nimport { CONSTANTS } from \"../Constants\";\nimport { Factions, factionExists } from \"../Faction/Factions\";\nimport { Player } from \"../Player\";\nimport { prestigeAugmentation } from \"../Prestige\";\nimport { Programs } from \"../Programs/Programs\";\nimport { SourceFileFlags } from \"../SourceFile/SourceFileFlags\";\n\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\nimport { clearObject } from \"../../utils/helpers/clearObject\";\n\nimport { WHRNG } from \"../Casino/RNG\";\n\nimport React from \"react\";\n\nfunction AddToAugmentations(aug) {\n var name = aug.name;\n Augmentations[name] = aug;\n}\n\nfunction getRandomBonus() {\n var bonuses = [\n {\n bonuses: {\n hacking_chance_mult: 1.25,\n hacking_speed_mult: 1.1,\n hacking_money_mult: 1.25,\n hacking_grow_mult: 1.1,\n },\n description:\n \"Increases the player's hacking chance by 25%.
\" +\n \"Increases the player's hacking speed by 10%.
\" +\n \"Increases the amount of money the player's gains from hacking by 25%.
\" +\n \"Improves grow() by 10%.\",\n },\n {\n bonuses: {\n hacking_mult: 1.15,\n hacking_exp_mult: 2,\n },\n description:\n \"Increases the player's hacking skill by 15%.
\" +\n \"Increases the player's hacking experience gain rate by 100%.\",\n },\n {\n bonuses: {\n strength_mult: 1.25,\n strength_exp_mult: 2,\n defense_mult: 1.25,\n defense_exp_mult: 2,\n dexterity_mult: 1.25,\n dexterity_exp_mult: 2,\n agility_mult: 1.25,\n agility_exp_mult: 2,\n },\n description:\n \"Increases all of the player's combat stats by 25%.
\" +\n \"Increases all of the player's combat stat experience gain rate by 100%.\",\n },\n {\n bonuses: {\n charisma_mult: 1.5,\n charisma_exp_mult: 2,\n },\n description:\n \"This augmentation increases the player's charisma by 50%.
\" +\n \"Increases the player's charisma experience gain rate by 100%.\",\n },\n {\n bonuses: {\n hacknet_node_money_mult: 1.2,\n hacknet_node_purchase_cost_mult: 0.85,\n hacknet_node_ram_cost_mult: 0.85,\n hacknet_node_core_cost_mult: 0.85,\n hacknet_node_level_cost_mult: 0.85,\n },\n description:\n \"Increases the amount of money produced by Hacknet Nodes by 20%.
\" +\n \"Decreases all costs related to Hacknet Node by 15%.\",\n },\n {\n bonuses: {\n company_rep_mult: 1.25,\n faction_rep_mult: 1.15,\n work_money_mult: 1.7,\n },\n description:\n \"Increases the amount of money the player gains from working by 70%.
\" +\n \"Increases the amount of reputation the player gains when working for a company by 25%.
\" +\n \"Increases the amount of reputation the player gains for a faction by 15%.\",\n },\n {\n bonuses: {\n crime_success_mult: 2,\n crime_money_mult: 2,\n },\n description:\n \"Increases the player's crime success rate by 100%.
\" +\n \"Increases the amount of money the player gains from crimes by 100%.\",\n },\n ];\n\n const randomNumber = new WHRNG(Math.floor(Player.lastUpdate / 3600000));\n for (let i = 0; i < 5; i++) randomNumber.step();\n\n return bonuses[Math.floor(bonuses.length * randomNumber.random())];\n}\n\nfunction initAugmentations() {\n for (var name in Factions) {\n if (Factions.hasOwnProperty(name)) {\n Factions[name].augmentations = [];\n }\n }\n\n //Reset Augmentations\n clearObject(Augmentations);\n\n //Time-Based Augment Test\n const randomBonuses = getRandomBonus();\n\n const UnstableCircadianModulatorParams = {\n name: AugmentationNames.UnstableCircadianModulator,\n moneyCost: 5e9,\n repCost: 3.625e5,\n info:\n \"An experimental nanobot injection. Its unstable nature leads to \" +\n \"unpredictable results based on your circadian rhythm.\",\n };\n Object.keys(randomBonuses.bonuses).forEach(\n (key) => (UnstableCircadianModulatorParams[key] = randomBonuses.bonuses[key]),\n );\n const UnstableCircadianModulator = new Augmentation(UnstableCircadianModulatorParams);\n\n UnstableCircadianModulator.addToFactions([\"Speakers for the Dead\"]);\n if (augmentationExists(AugmentationNames.UnstableCircadianModulator)) {\n delete Augmentations[AugmentationNames.UnstableCircadianModulator];\n }\n AddToAugmentations(UnstableCircadianModulator);\n\n //Combat stat augmentations\n const HemoRecirculator = new Augmentation({\n name: AugmentationNames.HemoRecirculator,\n moneyCost: 4.5e7,\n repCost: 1e4,\n info: \"A heart implant that greatly increases the body's ability to effectively use and pump \" + \"blood.\",\n strength_mult: 1.08,\n defense_mult: 1.08,\n agility_mult: 1.08,\n dexterity_mult: 1.08,\n });\n HemoRecirculator.addToFactions([\"Tetrads\", \"The Dark Army\", \"The Syndicate\"]);\n if (augmentationExists(AugmentationNames.HemoRecirculator)) {\n delete Augmentations[AugmentationNames.HemoRecirculator];\n }\n AddToAugmentations(HemoRecirculator);\n\n const Targeting1 = new Augmentation({\n name: AugmentationNames.Targeting1,\n moneyCost: 1.5e7,\n repCost: 5e3,\n info:\n \"A cranial implant that is embedded within the inner ear structures and optic nerves. It regulates \" +\n \"and enhances balance and hand-eye coordination.\",\n dexterity_mult: 1.1,\n });\n Targeting1.addToFactions([\n \"Slum Snakes\",\n \"The Dark Army\",\n \"The Syndicate\",\n \"Sector-12\",\n \"Ishima\",\n \"OmniTek Incorporated\",\n \"KuaiGong International\",\n \"Blade Industries\",\n ]);\n if (augmentationExists(AugmentationNames.Targeting1)) {\n delete Augmentations[AugmentationNames.Targeting1];\n }\n AddToAugmentations(Targeting1);\n\n const Targeting2 = new Augmentation({\n name: AugmentationNames.Targeting2,\n moneyCost: 4.25e7,\n repCost: 8.75e3,\n info:\n \"This upgraded version of the 'Augmented Targeting' implant is capable of augmenting \" +\n \"reality by digitally displaying weaknesses and vital signs of threats.\",\n prereqs: [AugmentationNames.Targeting1],\n dexterity_mult: 1.2,\n });\n Targeting2.addToFactions([\n \"The Dark Army\",\n \"The Syndicate\",\n \"Sector-12\",\n \"OmniTek Incorporated\",\n \"KuaiGong International\",\n \"Blade Industries\",\n ]);\n if (augmentationExists(AugmentationNames.Targeting2)) {\n delete Augmentations[AugmentationNames.Targeting2];\n }\n AddToAugmentations(Targeting2);\n\n const Targeting3 = new Augmentation({\n name: AugmentationNames.Targeting3,\n moneyCost: 1.15e8,\n repCost: 2.75e4,\n info: \"The latest version of the 'Augmented Targeting' implant adds the ability to lock-on and track threats.\",\n prereqs: [AugmentationNames.Targeting2],\n dexterity_mult: 1.3,\n });\n Targeting3.addToFactions([\n \"The Dark Army\",\n \"The Syndicate\",\n \"OmniTek Incorporated\",\n \"KuaiGong International\",\n \"Blade Industries\",\n \"The Covenant\",\n ]);\n if (augmentationExists(AugmentationNames.Targeting3)) {\n delete Augmentations[AugmentationNames.Targeting3];\n }\n AddToAugmentations(Targeting3);\n\n const SyntheticHeart = new Augmentation({\n name: AugmentationNames.SyntheticHeart,\n moneyCost: 2.875e9,\n repCost: 7.5e5,\n info:\n \"This advanced artificial heart, created from plasteel and graphene, is capable of pumping blood \" +\n \"more efficiently than an organic heart.\",\n agility_mult: 1.5,\n strength_mult: 1.5,\n });\n SyntheticHeart.addToFactions([\n \"KuaiGong International\",\n \"Fulcrum Secret Technologies\",\n \"Speakers for the Dead\",\n \"NWO\",\n \"The Covenant\",\n \"Daedalus\",\n \"Illuminati\",\n ]);\n if (augmentationExists(AugmentationNames.SyntheticHeart)) {\n delete Augmentations[AugmentationNames.SyntheticHeart];\n }\n AddToAugmentations(SyntheticHeart);\n\n const SynfibrilMuscle = new Augmentation({\n name: AugmentationNames.SynfibrilMuscle,\n repCost: 4.375e5,\n moneyCost: 1.125e9,\n info:\n \"The myofibrils in human muscles are injected with special chemicals that react with the proteins inside \" +\n \"the myofibrils, altering their underlying structure. The end result is muscles that are stronger and more elastic. \" +\n \"Scientists have named these artificially enhanced units 'synfibrils'.\",\n strength_mult: 1.3,\n defense_mult: 1.3,\n });\n SynfibrilMuscle.addToFactions([\n \"KuaiGong International\",\n \"Fulcrum Secret Technologies\",\n \"Speakers for the Dead\",\n \"NWO\",\n \"The Covenant\",\n \"Daedalus\",\n \"Illuminati\",\n \"Blade Industries\",\n ]);\n if (augmentationExists(AugmentationNames.SynfibrilMuscle)) {\n delete Augmentations[AugmentationNames.SynfibrilMuscle];\n }\n AddToAugmentations(SynfibrilMuscle);\n\n const CombatRib1 = new Augmentation({\n name: AugmentationNames.CombatRib1,\n repCost: 7.5e3,\n moneyCost: 2.375e7,\n info:\n \"The rib cage is augmented to continuously release boosters into the bloodstream \" +\n \"which increase the oxygen-carrying capacity of blood.\",\n strength_mult: 1.1,\n defense_mult: 1.1,\n });\n CombatRib1.addToFactions([\n \"Slum Snakes\",\n \"The Dark Army\",\n \"The Syndicate\",\n \"Volhaven\",\n \"Ishima\",\n \"OmniTek Incorporated\",\n \"KuaiGong International\",\n \"Blade Industries\",\n ]);\n if (augmentationExists(AugmentationNames.CombatRib1)) {\n delete Augmentations[AugmentationNames.CombatRib1];\n }\n AddToAugmentations(CombatRib1);\n\n const CombatRib2 = new Augmentation({\n name: AugmentationNames.CombatRib2,\n repCost: 1.875e4,\n moneyCost: 6.5e7,\n info:\n \"An upgraded version of the 'Combat Rib' augmentation that adds potent stimulants which \" +\n \"improve focus and endurance while decreasing reaction time and fatigue.\",\n prereqs: [AugmentationNames.CombatRib1],\n strength_mult: 1.14,\n defense_mult: 1.14,\n });\n CombatRib2.addToFactions([\n \"The Dark Army\",\n \"The Syndicate\",\n \"Volhaven\",\n \"OmniTek Incorporated\",\n \"KuaiGong International\",\n \"Blade Industries\",\n ]);\n if (augmentationExists(AugmentationNames.CombatRib2)) {\n delete Augmentations[AugmentationNames.CombatRib2];\n }\n AddToAugmentations(CombatRib2);\n\n const CombatRib3 = new Augmentation({\n name: AugmentationNames.CombatRib3,\n repCost: 3.5e4,\n moneyCost: 1.2e8,\n info:\n \"The latest version of the 'Combat Rib' augmentation releases advanced anabolic steroids that \" +\n \"improve muscle mass and physical performance while being safe and free of side effects.\",\n prereqs: [AugmentationNames.CombatRib2],\n strength_mult: 1.18,\n defense_mult: 1.18,\n });\n CombatRib3.addToFactions([\n \"The Dark Army\",\n \"The Syndicate\",\n \"OmniTek Incorporated\",\n \"KuaiGong International\",\n \"Blade Industries\",\n \"The Covenant\",\n ]);\n if (augmentationExists(AugmentationNames.CombatRib3)) {\n delete Augmentations[AugmentationNames.CombatRib3];\n }\n AddToAugmentations(CombatRib3);\n\n const NanofiberWeave = new Augmentation({\n name: AugmentationNames.NanofiberWeave,\n repCost: 3.75e4,\n moneyCost: 1.25e8,\n info:\n \"Synthetic nanofibers are woven into the skin's extracellular matrix using electrospinning, \" +\n \"which improves its regenerative and extracellular homeostasis abilities.\",\n strength_mult: 1.2,\n defense_mult: 1.2,\n });\n NanofiberWeave.addToFactions([\n \"Tian Di Hui\",\n \"The Syndicate\",\n \"The Dark Army\",\n \"Speakers for the Dead\",\n \"Blade Industries\",\n \"Fulcrum Secret Technologies\",\n \"OmniTek Incorporated\",\n ]);\n if (augmentationExists(AugmentationNames.NanofiberWeave)) {\n delete Augmentations[AugmentationNames.NanofiberWeave];\n }\n AddToAugmentations(NanofiberWeave);\n\n const SubdermalArmor = new Augmentation({\n name: AugmentationNames.SubdermalArmor,\n repCost: 8.75e5,\n moneyCost: 3.25e9,\n info:\n \"The NEMEAN Subdermal Weave is a thin, light-weight, graphene plating that houses a dilatant fluid. \" +\n \"The material is implanted underneath the skin, and is the most advanced form of defensive enhancement \" +\n \"that has ever been created. The dilatant fluid, despite being thin and light, is extremely effective \" +\n \"at stopping piercing blows and reducing blunt trauma. The properties of graphene allow the plating to \" +\n \"mitigate damage from any fire or electrical traumas.\",\n defense_mult: 2.2,\n });\n SubdermalArmor.addToFactions([\n \"The Syndicate\",\n \"Fulcrum Secret Technologies\",\n \"Illuminati\",\n \"Daedalus\",\n \"The Covenant\",\n ]);\n if (augmentationExists(AugmentationNames.SubdermalArmor)) {\n delete Augmentations[AugmentationNames.SubdermalArmor];\n }\n AddToAugmentations(SubdermalArmor);\n\n const WiredReflexes = new Augmentation({\n name: AugmentationNames.WiredReflexes,\n repCost: 1.25e3,\n moneyCost: 2.5e6,\n info:\n \"Synthetic nerve-enhancements are injected into all major parts of the somatic nervous system, \" +\n \"supercharging the spread of neural signals and increasing reflex speed.\",\n agility_mult: 1.05,\n dexterity_mult: 1.05,\n });\n WiredReflexes.addToFactions([\n \"Tian Di Hui\",\n \"Slum Snakes\",\n \"Sector-12\",\n \"Volhaven\",\n \"Aevum\",\n \"Ishima\",\n \"The Syndicate\",\n \"The Dark Army\",\n \"Speakers for the Dead\",\n ]);\n if (augmentationExists(AugmentationNames.WiredReflexes)) {\n delete Augmentations[AugmentationNames.WiredReflexes];\n }\n AddToAugmentations(WiredReflexes);\n\n const GrapheneBoneLacings = new Augmentation({\n name: AugmentationNames.GrapheneBoneLacings,\n repCost: 1.125e6,\n moneyCost: 4.25e9,\n info:\n \"Graphene is grafted and fused into the skeletal structure, \" + \"enhancing bone density and tensile strength.\",\n strength_mult: 1.7,\n defense_mult: 1.7,\n });\n GrapheneBoneLacings.addToFactions([\"Fulcrum Secret Technologies\", \"The Covenant\"]);\n if (augmentationExists(AugmentationNames.GrapheneBoneLacings)) {\n delete Augmentations[AugmentationNames.GrapheneBoneLacings];\n }\n AddToAugmentations(GrapheneBoneLacings);\n\n const BionicSpine = new Augmentation({\n name: AugmentationNames.BionicSpine,\n repCost: 4.5e4,\n moneyCost: 1.25e8,\n info:\n \"The spine is reconstructed using plasteel and carbon fibers. \" +\n \"It is now capable of stimulating and regulating neural signals \" +\n \"passing through the spinal cord, improving senses and reaction speed. \" +\n \"The 'Bionic Spine' also interfaces with all other 'Bionic' implants.\",\n strength_mult: 1.15,\n defense_mult: 1.15,\n agility_mult: 1.15,\n dexterity_mult: 1.15,\n });\n BionicSpine.addToFactions([\n \"Speakers for the Dead\",\n \"The Syndicate\",\n \"KuaiGong International\",\n \"OmniTek Incorporated\",\n \"Blade Industries\",\n ]);\n if (augmentationExists(AugmentationNames.BionicSpine)) {\n delete Augmentations[AugmentationNames.BionicSpine];\n }\n AddToAugmentations(BionicSpine);\n\n const GrapheneBionicSpine = new Augmentation({\n name: AugmentationNames.GrapheneBionicSpine,\n repCost: 1.625e6,\n moneyCost: 6e9,\n info:\n \"An upgrade to the 'Bionic Spine' augmentation. The spine is fused with graphene \" +\n \"which enhances durability and supercharges all body functions.\",\n prereqs: [AugmentationNames.BionicSpine],\n strength_mult: 1.6,\n defense_mult: 1.6,\n agility_mult: 1.6,\n dexterity_mult: 1.6,\n });\n GrapheneBionicSpine.addToFactions([\"Fulcrum Secret Technologies\", \"ECorp\"]);\n if (augmentationExists(AugmentationNames.GrapheneBionicSpine)) {\n delete Augmentations[AugmentationNames.GrapheneBionicSpine];\n }\n AddToAugmentations(GrapheneBionicSpine);\n\n const BionicLegs = new Augmentation({\n name: AugmentationNames.BionicLegs,\n repCost: 1.5e5,\n moneyCost: 3.75e8,\n info: \"Cybernetic legs, created from plasteel and carbon fibers, enhance running speed.\",\n agility_mult: 1.6,\n });\n BionicLegs.addToFactions([\n \"Speakers for the Dead\",\n \"The Syndicate\",\n \"KuaiGong International\",\n \"OmniTek Incorporated\",\n \"Blade Industries\",\n ]);\n if (augmentationExists(AugmentationNames.BionicLegs)) {\n delete Augmentations[AugmentationNames.BionicLegs];\n }\n AddToAugmentations(BionicLegs);\n\n const GrapheneBionicLegs = new Augmentation({\n name: AugmentationNames.GrapheneBionicLegs,\n repCost: 7.5e5,\n moneyCost: 4.5e9,\n info:\n \"An upgrade to the 'Bionic Legs' augmentation. The legs are fused \" +\n \"with graphene, greatly enhancing jumping ability.\",\n prereqs: [AugmentationNames.BionicLegs],\n agility_mult: 2.5,\n });\n GrapheneBionicLegs.addToFactions([\"MegaCorp\", \"ECorp\", \"Fulcrum Secret Technologies\"]);\n if (augmentationExists(AugmentationNames.GrapheneBionicLegs)) {\n delete Augmentations[AugmentationNames.GrapheneBionicLegs];\n }\n AddToAugmentations(GrapheneBionicLegs);\n\n // Work stat augmentations\n const SpeechProcessor = new Augmentation({\n name: AugmentationNames.SpeechProcessor,\n repCost: 7.5e3,\n moneyCost: 5e7,\n info:\n \"A cochlear implant with an embedded computer that analyzes incoming speech. \" +\n \"The embedded computer processes characteristics of incoming speech, such as tone \" +\n \"and inflection, to pick up on subtle cues and aid in social interactions.\",\n charisma_mult: 1.2,\n });\n SpeechProcessor.addToFactions([\n \"Tian Di Hui\",\n \"Chongqing\",\n \"Sector-12\",\n \"New Tokyo\",\n \"Aevum\",\n \"Ishima\",\n \"Volhaven\",\n \"Silhouette\",\n ]);\n if (augmentationExists(AugmentationNames.SpeechProcessor)) {\n delete Augmentations[AugmentationNames.SpeechProcessor];\n }\n AddToAugmentations(SpeechProcessor);\n\n const TITN41Injection = new Augmentation({\n name: AugmentationNames.TITN41Injection,\n repCost: 2.5e4,\n moneyCost: 1.9e8,\n info:\n \"TITN is a series of viruses that targets and alters the sequences of human DNA in genes that \" +\n \"control personality. The TITN-41 strain alters these genes so that the subject becomes more \" +\n \"outgoing and socialable.\",\n charisma_mult: 1.15,\n charisma_exp_mult: 1.15,\n });\n TITN41Injection.addToFactions([\"Silhouette\"]);\n if (augmentationExists(AugmentationNames.TITN41Injection)) {\n delete Augmentations[AugmentationNames.TITN41Injection];\n }\n AddToAugmentations(TITN41Injection);\n\n const EnhancedSocialInteractionImplant = new Augmentation({\n name: AugmentationNames.EnhancedSocialInteractionImplant,\n repCost: 3.75e5,\n moneyCost: 1.375e9,\n info:\n \"A cranial implant that greatly assists in the user's ability to analyze social situations \" +\n \"and interactions. The system uses a wide variety of factors such as facial expressions, body \" +\n \"language, and the voice tone, and inflection to determine the best course of action during social\" +\n \"situations. The implant also uses deep learning software to continuously learn new behavior\" +\n \"patterns and how to best respond.\",\n charisma_mult: 1.6,\n charisma_exp_mult: 1.6,\n });\n EnhancedSocialInteractionImplant.addToFactions([\n \"Bachman & Associates\",\n \"NWO\",\n \"Clarke Incorporated\",\n \"OmniTek Incorporated\",\n \"Four Sigma\",\n ]);\n if (augmentationExists(AugmentationNames.EnhancedSocialInteractionImplant)) {\n delete Augmentations[AugmentationNames.EnhancedSocialInteractionImplant];\n }\n AddToAugmentations(EnhancedSocialInteractionImplant);\n\n // Hacking augmentations\n const BitWire = new Augmentation({\n name: AugmentationNames.BitWire,\n repCost: 3.75e3,\n moneyCost: 1e7,\n info:\n \"A small brain implant embedded in the cerebrum. This regulates and improves the brain's computing \" +\n \"capabilities.\",\n hacking_mult: 1.05,\n });\n BitWire.addToFactions([\"CyberSec\", \"NiteSec\"]);\n if (augmentationExists(AugmentationNames.BitWire)) {\n delete Augmentations[AugmentationNames.BitWire];\n }\n AddToAugmentations(BitWire);\n\n const ArtificialBioNeuralNetwork = new Augmentation({\n name: AugmentationNames.ArtificialBioNeuralNetwork,\n repCost: 2.75e5,\n moneyCost: 3e9,\n info:\n \"A network consisting of millions of nanoprocessors is embedded into the brain. \" +\n \"The network is meant to mimic the way a biological brain solves a problem, with each \" +\n \"nanoprocessor acting similar to the way a neuron would in a neural network. However, these \" +\n \"nanoprocessors are programmed to perform computations much faster than organic neurons, \" +\n \"allowing the user to solve much more complex problems at a much faster rate.\",\n hacking_speed_mult: 1.03,\n hacking_money_mult: 1.15,\n hacking_mult: 1.12,\n });\n ArtificialBioNeuralNetwork.addToFactions([\"BitRunners\", \"Fulcrum Secret Technologies\"]);\n if (augmentationExists(AugmentationNames.ArtificialBioNeuralNetwork)) {\n delete Augmentations[AugmentationNames.ArtificialBioNeuralNetwork];\n }\n AddToAugmentations(ArtificialBioNeuralNetwork);\n\n const ArtificialSynapticPotentiation = new Augmentation({\n name: AugmentationNames.ArtificialSynapticPotentiation,\n repCost: 6.25e3,\n moneyCost: 8e7,\n info:\n \"The body is injected with a chemical that artificially induces synaptic potentiation, \" +\n \"otherwise known as the strengthening of synapses. This results in enhanced cognitive abilities.\",\n hacking_speed_mult: 1.02,\n hacking_chance_mult: 1.05,\n hacking_exp_mult: 1.05,\n });\n ArtificialSynapticPotentiation.addToFactions([\"The Black Hand\", \"NiteSec\"]);\n if (augmentationExists(AugmentationNames.ArtificialSynapticPotentiation)) {\n delete Augmentations[AugmentationNames.ArtificialSynapticPotentiation];\n }\n AddToAugmentations(ArtificialSynapticPotentiation);\n\n const EnhancedMyelinSheathing = new Augmentation({\n name: AugmentationNames.EnhancedMyelinSheathing,\n repCost: 1e5,\n moneyCost: 1.375e9,\n info:\n \"Electrical signals are used to induce a new, artificial form of myelinogenesis in the human body. \" +\n \"This process results in the proliferation of new, synthetic myelin sheaths in the nervous \" +\n \"system. These myelin sheaths can propogate neuro-signals much faster than their organic \" +\n \"counterparts, leading to greater processing speeds and better brain function.\",\n hacking_speed_mult: 1.03,\n hacking_exp_mult: 1.1,\n hacking_mult: 1.08,\n });\n EnhancedMyelinSheathing.addToFactions([\"Fulcrum Secret Technologies\", \"BitRunners\", \"The Black Hand\"]);\n if (augmentationExists(AugmentationNames.EnhancedMyelinSheathing)) {\n delete Augmentations[AugmentationNames.EnhancedMyelinSheathing];\n }\n AddToAugmentations(EnhancedMyelinSheathing);\n\n const SynapticEnhancement = new Augmentation({\n name: AugmentationNames.SynapticEnhancement,\n repCost: 2e3,\n moneyCost: 7.5e6,\n info:\n \"A small cranial implant that continuously uses weak electrical signals to stimulate the brain and \" +\n \"induce stronger synaptic activity. This improves the user's cognitive abilities.\",\n hacking_speed_mult: 1.03,\n });\n SynapticEnhancement.addToFactions([\"CyberSec\", \"Aevum\"]);\n if (augmentationExists(AugmentationNames.SynapticEnhancement)) {\n delete Augmentations[AugmentationNames.SynapticEnhancement];\n }\n AddToAugmentations(SynapticEnhancement);\n\n const NeuralRetentionEnhancement = new Augmentation({\n name: AugmentationNames.NeuralRetentionEnhancement,\n repCost: 2e4,\n moneyCost: 2.5e8,\n info:\n \"Chemical injections are used to permanently alter and strengthen the brain's neuronal \" +\n \"circuits, strengthening the ability to retain information.\",\n hacking_exp_mult: 1.25,\n });\n NeuralRetentionEnhancement.addToFactions([\"NiteSec\"]);\n if (augmentationExists(AugmentationNames.NeuralRetentionEnhancement)) {\n delete Augmentations[AugmentationNames.NeuralRetentionEnhancement];\n }\n AddToAugmentations(NeuralRetentionEnhancement);\n\n const DataJack = new Augmentation({\n name: AugmentationNames.DataJack,\n repCost: 1.125e5,\n moneyCost: 4.5e8,\n info:\n \"A brain implant that provides an interface for direct, wireless communication between a computer's main \" +\n \"memory and the mind. This implant allows the user to not only access a computer's memory, but also alter \" +\n \"and delete it.\",\n hacking_money_mult: 1.25,\n });\n DataJack.addToFactions([\"BitRunners\", \"The Black Hand\", \"NiteSec\", \"Chongqing\", \"New Tokyo\"]);\n if (augmentationExists(AugmentationNames.DataJack)) {\n delete Augmentations[AugmentationNames.DataJack];\n }\n AddToAugmentations(DataJack);\n\n const ENM = new Augmentation({\n name: AugmentationNames.ENM,\n repCost: 1.5e4,\n moneyCost: 2.5e8,\n info:\n \"A thin device embedded inside the arm containing a wireless module capable of connecting \" +\n \"to nearby networks. Once connected, the Netburner Module is capable of capturing and \" +\n \"processing all of the traffic on that network. By itself, the Embedded Netburner Module does \" +\n \"not do much, but a variety of very powerful upgrades can be installed that allow you to fully \" +\n \"control the traffic on a network.\",\n hacking_mult: 1.08,\n });\n ENM.addToFactions([\n \"BitRunners\",\n \"The Black Hand\",\n \"NiteSec\",\n \"ECorp\",\n \"MegaCorp\",\n \"Fulcrum Secret Technologies\",\n \"NWO\",\n \"Blade Industries\",\n ]);\n if (augmentationExists(AugmentationNames.ENM)) {\n delete Augmentations[AugmentationNames.ENM];\n }\n AddToAugmentations(ENM);\n\n const ENMCore = new Augmentation({\n name: AugmentationNames.ENMCore,\n repCost: 2.5e5,\n moneyCost: 2.5e9,\n info:\n \"The Core library is an implant that upgrades the firmware of the Embedded Netburner Module. \" +\n \"This upgrade allows the Embedded Netburner Module to generate its own data on a network.\",\n prereqs: [AugmentationNames.ENM],\n hacking_speed_mult: 1.03,\n hacking_money_mult: 1.1,\n hacking_chance_mult: 1.03,\n hacking_exp_mult: 1.07,\n hacking_mult: 1.07,\n });\n ENMCore.addToFactions([\n \"BitRunners\",\n \"The Black Hand\",\n \"ECorp\",\n \"MegaCorp\",\n \"Fulcrum Secret Technologies\",\n \"NWO\",\n \"Blade Industries\",\n ]);\n if (augmentationExists(AugmentationNames.ENMCore)) {\n delete Augmentations[AugmentationNames.ENMCore];\n }\n AddToAugmentations(ENMCore);\n\n const ENMCoreV2 = new Augmentation({\n name: AugmentationNames.ENMCoreV2,\n repCost: 1e6,\n moneyCost: 4.5e9,\n info:\n \"The Core V2 library is an implant that upgrades the firmware of the Embedded Netburner Module. \" +\n \"This upgraded firmware allows the Embedded Netburner Module to control information on \" +\n \"a network by re-routing traffic, spoofing IP addresses, and altering the data inside network \" +\n \"packets.\",\n prereqs: [AugmentationNames.ENMCore],\n hacking_speed_mult: 1.05,\n hacking_money_mult: 1.3,\n hacking_chance_mult: 1.05,\n hacking_exp_mult: 1.15,\n hacking_mult: 1.08,\n });\n ENMCoreV2.addToFactions([\n \"BitRunners\",\n \"ECorp\",\n \"MegaCorp\",\n \"Fulcrum Secret Technologies\",\n \"NWO\",\n \"Blade Industries\",\n \"OmniTek Incorporated\",\n \"KuaiGong International\",\n ]);\n if (augmentationExists(AugmentationNames.ENMCoreV2)) {\n delete Augmentations[AugmentationNames.ENMCoreV2];\n }\n AddToAugmentations(ENMCoreV2);\n\n const ENMCoreV3 = new Augmentation({\n name: AugmentationNames.ENMCoreV3,\n repCost: 1.75e6,\n moneyCost: 7.5e9,\n info:\n \"The Core V3 library is an implant that upgrades the firmware of the Embedded Netburner Module. \" +\n \"This upgraded firmware allows the Embedded Netburner Module to seamlessly inject code into \" +\n \"any device on a network.\",\n prereqs: [AugmentationNames.ENMCoreV2],\n hacking_speed_mult: 1.05,\n hacking_money_mult: 1.4,\n hacking_chance_mult: 1.1,\n hacking_exp_mult: 1.25,\n hacking_mult: 1.1,\n });\n ENMCoreV3.addToFactions([\n \"ECorp\",\n \"MegaCorp\",\n \"Fulcrum Secret Technologies\",\n \"NWO\",\n \"Daedalus\",\n \"The Covenant\",\n \"Illuminati\",\n ]);\n if (augmentationExists(AugmentationNames.ENMCoreV3)) {\n delete Augmentations[AugmentationNames.ENMCoreV3];\n }\n AddToAugmentations(ENMCoreV3);\n\n const ENMAnalyzeEngine = new Augmentation({\n name: AugmentationNames.ENMAnalyzeEngine,\n repCost: 6.25e5,\n moneyCost: 6e9,\n info:\n \"Installs the Analyze Engine for the Embedded Netburner Module, which is a CPU cluster \" +\n \"that vastly outperforms the Netburner Module's native single-core processor.\",\n prereqs: [AugmentationNames.ENM],\n hacking_speed_mult: 1.1,\n });\n ENMAnalyzeEngine.addToFactions([\n \"ECorp\",\n \"MegaCorp\",\n \"Fulcrum Secret Technologies\",\n \"NWO\",\n \"Daedalus\",\n \"The Covenant\",\n \"Illuminati\",\n ]);\n if (augmentationExists(AugmentationNames.ENMAnalyzeEngine)) {\n delete Augmentations[AugmentationNames.ENMAnalyzeEngine];\n }\n AddToAugmentations(ENMAnalyzeEngine);\n\n const ENMDMA = new Augmentation({\n name: AugmentationNames.ENMDMA,\n repCost: 1e6,\n moneyCost: 7e9,\n info:\n \"This implant installs a Direct Memory Access (DMA) controller into the \" +\n \"Embedded Netburner Module. This allows the Module to send and receive data \" +\n \"directly to and from the main memory of devices on a network.\",\n prereqs: [AugmentationNames.ENM],\n hacking_money_mult: 1.4,\n hacking_chance_mult: 1.2,\n });\n ENMDMA.addToFactions([\n \"ECorp\",\n \"MegaCorp\",\n \"Fulcrum Secret Technologies\",\n \"NWO\",\n \"Daedalus\",\n \"The Covenant\",\n \"Illuminati\",\n ]);\n if (augmentationExists(AugmentationNames.ENMDMA)) {\n delete Augmentations[AugmentationNames.ENMDMA];\n }\n AddToAugmentations(ENMDMA);\n\n const Neuralstimulator = new Augmentation({\n name: AugmentationNames.Neuralstimulator,\n repCost: 5e4,\n moneyCost: 3e9,\n info:\n \"A cranial implant that intelligently stimulates certain areas of the brain \" +\n \"in order to improve cognitive functions.\",\n hacking_speed_mult: 1.02,\n hacking_chance_mult: 1.1,\n hacking_exp_mult: 1.12,\n });\n Neuralstimulator.addToFactions([\n \"The Black Hand\",\n \"Chongqing\",\n \"Sector-12\",\n \"New Tokyo\",\n \"Aevum\",\n \"Ishima\",\n \"Volhaven\",\n \"Bachman & Associates\",\n \"Clarke Incorporated\",\n \"Four Sigma\",\n ]);\n if (augmentationExists(AugmentationNames.Neuralstimulator)) {\n delete Augmentations[AugmentationNames.Neuralstimulator];\n }\n AddToAugmentations(Neuralstimulator);\n\n const NeuralAccelerator = new Augmentation({\n name: AugmentationNames.NeuralAccelerator,\n repCost: 2e5,\n moneyCost: 1.75e9,\n info:\n \"A microprocessor that accelerates the processing \" +\n \"speed of biological neural networks. This is a cranial implant that is embedded inside the brain.\",\n hacking_mult: 1.1,\n hacking_exp_mult: 1.15,\n hacking_money_mult: 1.2,\n });\n NeuralAccelerator.addToFactions([\"BitRunners\"]);\n if (augmentationExists(AugmentationNames.NeuralAccelerator)) {\n delete Augmentations[AugmentationNames.NeuralAccelerator];\n }\n AddToAugmentations(NeuralAccelerator);\n\n const CranialSignalProcessorsG1 = new Augmentation({\n name: AugmentationNames.CranialSignalProcessorsG1,\n repCost: 1e4,\n moneyCost: 7e7,\n info:\n \"The first generation of Cranial Signal Processors. Cranial Signal Processors \" +\n \"are a set of specialized microprocessors that are attached to \" +\n \"neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations \" +\n \"so that the brain doesn't have to.\",\n hacking_speed_mult: 1.01,\n hacking_mult: 1.05,\n });\n CranialSignalProcessorsG1.addToFactions([\"CyberSec\"]);\n if (augmentationExists(AugmentationNames.CranialSignalProcessorsG1)) {\n delete Augmentations[AugmentationNames.CranialSignalProcessorsG1];\n }\n AddToAugmentations(CranialSignalProcessorsG1);\n\n const CranialSignalProcessorsG2 = new Augmentation({\n name: AugmentationNames.CranialSignalProcessorsG2,\n repCost: 1.875e4,\n moneyCost: 1.25e8,\n info:\n \"The second generation of Cranial Signal Processors. Cranial Signal Processors \" +\n \"are a set of specialized microprocessors that are attached to \" +\n \"neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations \" +\n \"so that the brain doesn't have to.\",\n prereqs: [AugmentationNames.CranialSignalProcessorsG1],\n hacking_speed_mult: 1.02,\n hacking_chance_mult: 1.05,\n hacking_mult: 1.07,\n });\n CranialSignalProcessorsG2.addToFactions([\"CyberSec\", \"NiteSec\"]);\n if (augmentationExists(AugmentationNames.CranialSignalProcessorsG2)) {\n delete Augmentations[AugmentationNames.CranialSignalProcessorsG2];\n }\n AddToAugmentations(CranialSignalProcessorsG2);\n\n const CranialSignalProcessorsG3 = new Augmentation({\n name: AugmentationNames.CranialSignalProcessorsG3,\n repCost: 5e4,\n moneyCost: 5.5e8,\n info:\n \"The third generation of Cranial Signal Processors. Cranial Signal Processors \" +\n \"are a set of specialized microprocessors that are attached to \" +\n \"neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations \" +\n \"so that the brain doesn't have to.\",\n prereqs: [AugmentationNames.CranialSignalProcessorsG2],\n hacking_speed_mult: 1.02,\n hacking_money_mult: 1.15,\n hacking_mult: 1.09,\n });\n CranialSignalProcessorsG3.addToFactions([\"NiteSec\", \"The Black Hand\", \"BitRunners\"]);\n if (augmentationExists(AugmentationNames.CranialSignalProcessorsG3)) {\n delete Augmentations[AugmentationNames.CranialSignalProcessorsG3];\n }\n AddToAugmentations(CranialSignalProcessorsG3);\n\n const CranialSignalProcessorsG4 = new Augmentation({\n name: AugmentationNames.CranialSignalProcessorsG4,\n repCost: 1.25e5,\n moneyCost: 1.1e9,\n info:\n \"The fourth generation of Cranial Signal Processors. Cranial Signal Processors \" +\n \"are a set of specialized microprocessors that are attached to \" +\n \"neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations \" +\n \"so that the brain doesn't have to.\",\n prereqs: [AugmentationNames.CranialSignalProcessorsG3],\n hacking_speed_mult: 1.02,\n hacking_money_mult: 1.2,\n hacking_grow_mult: 1.25,\n });\n CranialSignalProcessorsG4.addToFactions([\"The Black Hand\", \"BitRunners\"]);\n if (augmentationExists(AugmentationNames.CranialSignalProcessorsG4)) {\n delete Augmentations[AugmentationNames.CranialSignalProcessorsG4];\n }\n AddToAugmentations(CranialSignalProcessorsG4);\n\n const CranialSignalProcessorsG5 = new Augmentation({\n name: AugmentationNames.CranialSignalProcessorsG5,\n repCost: 2.5e5,\n moneyCost: 2.25e9,\n info:\n \"The fifth generation of Cranial Signal Processors. Cranial Signal Processors \" +\n \"are a set of specialized microprocessors that are attached to \" +\n \"neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations \" +\n \"so that the brain doesn't have to.\",\n prereqs: [AugmentationNames.CranialSignalProcessorsG4],\n hacking_mult: 1.3,\n hacking_money_mult: 1.25,\n hacking_grow_mult: 1.75,\n });\n CranialSignalProcessorsG5.addToFactions([\"BitRunners\"]);\n if (augmentationExists(AugmentationNames.CranialSignalProcessorsG5)) {\n delete Augmentations[AugmentationNames.CranialSignalProcessorsG5];\n }\n AddToAugmentations(CranialSignalProcessorsG5);\n\n const NeuronalDensification = new Augmentation({\n name: AugmentationNames.NeuronalDensification,\n repCost: 1.875e5,\n moneyCost: 1.375e9,\n info:\n \"The brain is surgically re-engineered to have increased neuronal density \" +\n \"by decreasing the neuron gap junction. Then, the body is genetically modified \" +\n \"to enhance the production and capabilities of its neural stem cells.\",\n hacking_mult: 1.15,\n hacking_exp_mult: 1.1,\n hacking_speed_mult: 1.03,\n });\n NeuronalDensification.addToFactions([\"Clarke Incorporated\"]);\n if (augmentationExists(AugmentationNames.NeuronalDensification)) {\n delete Augmentations[AugmentationNames.NeuronalDensification];\n }\n AddToAugmentations(NeuronalDensification);\n\n // Work Augmentations\n const NuoptimalInjectorImplant = new Augmentation({\n name: AugmentationNames.NuoptimalInjectorImplant,\n repCost: 5e3,\n moneyCost: 2e7,\n info:\n \"This torso implant automatically injects nootropic supplements into \" +\n \"the bloodstream to improve memory, increase focus, and provide other \" +\n \"cognitive enhancements.\",\n company_rep_mult: 1.2,\n });\n NuoptimalInjectorImplant.addToFactions([\n \"Tian Di Hui\",\n \"Volhaven\",\n \"New Tokyo\",\n \"Chongqing\",\n \"Clarke Incorporated\",\n \"Four Sigma\",\n \"Bachman & Associates\",\n ]);\n if (augmentationExists(AugmentationNames.NuoptimalInjectorImplant)) {\n delete Augmentations[AugmentationNames.NuoptimalInjectorImplant];\n }\n AddToAugmentations(NuoptimalInjectorImplant);\n\n const SpeechEnhancement = new Augmentation({\n name: AugmentationNames.SpeechEnhancement,\n repCost: 2.5e3,\n moneyCost: 1.25e7,\n info:\n \"An advanced neural implant that improves your speaking abilities, making \" +\n \"you more convincing and likable in conversations and overall improving your \" +\n \"social interactions.\",\n company_rep_mult: 1.1,\n charisma_mult: 1.1,\n });\n SpeechEnhancement.addToFactions([\n \"Tian Di Hui\",\n \"Speakers for the Dead\",\n \"Four Sigma\",\n \"KuaiGong International\",\n \"Clarke Incorporated\",\n \"Bachman & Associates\",\n ]);\n if (augmentationExists(AugmentationNames.SpeechEnhancement)) {\n delete Augmentations[AugmentationNames.SpeechEnhancement];\n }\n AddToAugmentations(SpeechEnhancement);\n\n const FocusWire = new Augmentation({\n name: AugmentationNames.FocusWire,\n repCost: 7.5e4,\n moneyCost: 9e8,\n info: \"A cranial implant that stops procrastination by blocking specific neural pathways \" + \"in the brain.\",\n hacking_exp_mult: 1.05,\n strength_exp_mult: 1.05,\n defense_exp_mult: 1.05,\n dexterity_exp_mult: 1.05,\n agility_exp_mult: 1.05,\n charisma_exp_mult: 1.05,\n company_rep_mult: 1.1,\n work_money_mult: 1.2,\n });\n FocusWire.addToFactions([\"Bachman & Associates\", \"Clarke Incorporated\", \"Four Sigma\", \"KuaiGong International\"]);\n if (augmentationExists(AugmentationNames.FocusWire)) {\n delete Augmentations[AugmentationNames.FocusWire];\n }\n AddToAugmentations(FocusWire);\n\n const PCDNI = new Augmentation({\n name: AugmentationNames.PCDNI,\n repCost: 3.75e5,\n moneyCost: 3.75e9,\n info:\n \"Installs a Direct-Neural Interface jack into your arm that is compatible with most \" +\n \"computers. Connecting to a computer through this jack allows you to interface with \" +\n \"it using the brain's electrochemical signals.\",\n company_rep_mult: 1.3,\n hacking_mult: 1.08,\n });\n PCDNI.addToFactions([\"Four Sigma\", \"OmniTek Incorporated\", \"ECorp\", \"Blade Industries\"]);\n if (augmentationExists(AugmentationNames.PCDNI)) {\n delete Augmentations[AugmentationNames.PCDNI];\n }\n AddToAugmentations(PCDNI);\n\n const PCDNIOptimizer = new Augmentation({\n name: AugmentationNames.PCDNIOptimizer,\n repCost: 5e5,\n moneyCost: 4.5e9,\n info:\n \"This is a submodule upgrade to the PC Direct-Neural Interface augmentation. It \" +\n \"improves the performance of the interface and gives the user more control options \" +\n \"to a connected computer.\",\n prereqs: [AugmentationNames.PCDNI],\n company_rep_mult: 1.75,\n hacking_mult: 1.1,\n });\n PCDNIOptimizer.addToFactions([\"Fulcrum Secret Technologies\", \"ECorp\", \"Blade Industries\"]);\n if (augmentationExists(AugmentationNames.PCDNIOptimizer)) {\n delete Augmentations[AugmentationNames.PCDNIOptimizer];\n }\n AddToAugmentations(PCDNIOptimizer);\n\n const PCDNINeuralNetwork = new Augmentation({\n name: AugmentationNames.PCDNINeuralNetwork,\n repCost: 1.5e6,\n moneyCost: 7.5e9,\n info:\n \"This is an additional installation that upgrades the functionality of the \" +\n \"PC Direct-Neural Interface augmentation. When connected to a computer, \" +\n \"The Neural Network upgrade allows the user to use their own brain's \" +\n \"processing power to aid the computer in computational tasks.\",\n prereqs: [AugmentationNames.PCDNI],\n company_rep_mult: 2,\n hacking_mult: 1.1,\n hacking_speed_mult: 1.05,\n });\n PCDNINeuralNetwork.addToFactions([\"Fulcrum Secret Technologies\"]);\n if (augmentationExists(AugmentationNames.PCDNINeuralNetwork)) {\n delete Augmentations[AugmentationNames.PCDNINeuralNetwork];\n }\n AddToAugmentations(PCDNINeuralNetwork);\n\n const ADRPheromone1 = new Augmentation({\n name: AugmentationNames.ADRPheromone1,\n repCost: 3.75e3,\n moneyCost: 1.75e7,\n info:\n \"The body is genetically re-engineered so that it produces the ADR-V1 pheromone, \" +\n \"an artificial pheromone discovered by scientists. The ADR-V1 pheromone, when excreted, \" +\n \"triggers feelings of admiration and approval in other people.\",\n company_rep_mult: 1.1,\n faction_rep_mult: 1.1,\n });\n ADRPheromone1.addToFactions([\"Tian Di Hui\", \"The Syndicate\", \"NWO\", \"MegaCorp\", \"Four Sigma\"]);\n if (augmentationExists(AugmentationNames.ADRPheromone1)) {\n delete Augmentations[AugmentationNames.ADRPheromone1];\n }\n AddToAugmentations(ADRPheromone1);\n\n const ADRPheromone2 = new Augmentation({\n name: AugmentationNames.ADRPheromone2,\n repCost: 6.25e4,\n moneyCost: 5.5e8,\n info:\n \"The body is genetically re-engineered so that it produces the ADR-V2 pheromone, \" +\n \"which is similar to but more potent than ADR-V1. This pheromone, when excreted, \" +\n \"triggers feelings of admiration, approval, and respect in others.\",\n company_rep_mult: 1.2,\n faction_rep_mult: 1.2,\n });\n ADRPheromone2.addToFactions([\"Silhouette\", \"Four Sigma\", \"Bachman & Associates\", \"Clarke Incorporated\"]);\n if (augmentationExists(AugmentationNames.ADRPheromone2)) {\n delete Augmentations[AugmentationNames.ADRPheromone2];\n }\n AddToAugmentations(ADRPheromone2);\n\n const ShadowsSimulacrum = new Augmentation({\n name: AugmentationNames.ShadowsSimulacrum,\n repCost: 3.75e4,\n moneyCost: 4e8,\n info:\n \"A crude but functional matter phase-shifter module that is embedded \" +\n \"in the brainstem and cerebellum. This augmentation was developed by \" +\n \"criminal organizations and allows the user to project and control holographic \" +\n \"simulacrums within a large radius. These simulacrums are commonly used for \" +\n \"espionage and surveillance work.\",\n company_rep_mult: 1.15,\n faction_rep_mult: 1.15,\n });\n ShadowsSimulacrum.addToFactions([\"The Syndicate\", \"The Dark Army\", \"Speakers for the Dead\"]);\n if (augmentationExists(AugmentationNames.ShadowsSimulacrum)) {\n delete Augmentations[AugmentationNames.ShadowsSimulacrum];\n }\n AddToAugmentations(ShadowsSimulacrum);\n\n // HacknetNode Augmentations\n const HacknetNodeCPUUpload = new Augmentation({\n name: AugmentationNames.HacknetNodeCPUUpload,\n repCost: 3.75e3,\n moneyCost: 1.1e7,\n info:\n \"Uploads the architecture and design details of a Hacknet Node's CPU into \" +\n \"the brain. This allows the user to engineer custom hardware and software \" +\n \"for the Hacknet Node that provides better performance.\",\n hacknet_node_money_mult: 1.15,\n hacknet_node_purchase_cost_mult: 0.85,\n });\n HacknetNodeCPUUpload.addToFactions([\"Netburners\"]);\n if (augmentationExists(AugmentationNames.HacknetNodeCPUUpload)) {\n delete Augmentations[AugmentationNames.HacknetNodeCPUUpload];\n }\n AddToAugmentations(HacknetNodeCPUUpload);\n\n const HacknetNodeCacheUpload = new Augmentation({\n name: AugmentationNames.HacknetNodeCacheUpload,\n repCost: 2.5e3,\n moneyCost: 5.5e6,\n info:\n \"Uploads the architecture and design details of a Hacknet Node's main-memory cache \" +\n \"into the brain. This allows the user to engineer custom cache hardware for the \" +\n \"Hacknet Node that offers better performance.\",\n hacknet_node_money_mult: 1.1,\n hacknet_node_level_cost_mult: 0.85,\n });\n HacknetNodeCacheUpload.addToFactions([\"Netburners\"]);\n if (augmentationExists(AugmentationNames.HacknetNodeCacheUpload)) {\n delete Augmentations[AugmentationNames.HacknetNodeCacheUpload];\n }\n AddToAugmentations(HacknetNodeCacheUpload);\n\n const HacknetNodeNICUpload = new Augmentation({\n name: AugmentationNames.HacknetNodeNICUpload,\n repCost: 1.875e3,\n moneyCost: 4.5e6,\n info:\n \"Uploads the architecture and design details of a Hacknet Node's Network Interface Card (NIC) \" +\n \"into the brain. This allows the user to engineer a custom NIC for the Hacknet Node that \" +\n \"offers better performance.\",\n hacknet_node_money_mult: 1.1,\n hacknet_node_purchase_cost_mult: 0.9,\n });\n HacknetNodeNICUpload.addToFactions([\"Netburners\"]);\n if (augmentationExists(AugmentationNames.HacknetNodeNICUpload)) {\n delete Augmentations[AugmentationNames.HacknetNodeNICUpload];\n }\n AddToAugmentations(HacknetNodeNICUpload);\n\n const HacknetNodeKernelDNI = new Augmentation({\n name: AugmentationNames.HacknetNodeKernelDNI,\n repCost: 7.5e3,\n moneyCost: 4e7,\n info:\n \"Installs a Direct-Neural Interface jack into the arm that is capable of connecting to a \" +\n \"Hacknet Node. This lets the user access and manipulate the Node's kernel using \" +\n \"electrochemical signals.\",\n hacknet_node_money_mult: 1.25,\n });\n HacknetNodeKernelDNI.addToFactions([\"Netburners\"]);\n if (augmentationExists(AugmentationNames.HacknetNodeKernelDNI)) {\n delete Augmentations[AugmentationNames.HacknetNodeKernelDNI];\n }\n AddToAugmentations(HacknetNodeKernelDNI);\n\n const HacknetNodeCoreDNI = new Augmentation({\n name: AugmentationNames.HacknetNodeCoreDNI,\n repCost: 1.25e4,\n moneyCost: 6e7,\n info:\n \"Installs a Direct-Neural Interface jack into the arm that is capable of connecting \" +\n \"to a Hacknet Node. This lets the user access and manipulate the Node's processing logic using \" +\n \"electrochemical signals.\",\n hacknet_node_money_mult: 1.45,\n });\n HacknetNodeCoreDNI.addToFactions([\"Netburners\"]);\n if (augmentationExists(AugmentationNames.HacknetNodeCoreDNI)) {\n delete Augmentations[AugmentationNames.HacknetNodeCoreDNI];\n }\n AddToAugmentations(HacknetNodeCoreDNI);\n\n //Misc/Hybrid augmentations\n const NeuroFluxGovernor = new Augmentation({\n name: AugmentationNames.NeuroFluxGovernor,\n repCost: 1.25e3,\n moneyCost: 3.75e6,\n info:\n \"A device that is embedded in the back of the neck. The NeuroFlux Governor \" +\n \"monitors and regulates nervous impulses coming to and from the spinal column, \" +\n \"essentially 'governing' the body. By doing so, it improves the functionality of the \" +\n \"body's nervous system.\",\n stats: (\n <>\n This special augmentation can be leveled up infinitely. Each level of this augmentation increases ALL\n multipliers by 1%, stacking multiplicatively.\n \n ),\n hacking_chance_mult: 1.01,\n hacking_speed_mult: 1.01,\n hacking_money_mult: 1.01,\n hacking_grow_mult: 1.01,\n hacking_mult: 1.01,\n strength_mult: 1.01,\n defense_mult: 1.01,\n dexterity_mult: 1.01,\n agility_mult: 1.01,\n charisma_mult: 1.01,\n hacking_exp_mult: 1.01,\n strength_exp_mult: 1.01,\n defense_exp_mult: 1.01,\n dexterity_exp_mult: 1.01,\n agility_exp_mult: 1.01,\n charisma_exp_mult: 1.01,\n company_rep_mult: 1.01,\n faction_rep_mult: 1.01,\n crime_money_mult: 1.01,\n crime_success_mult: 1.01,\n hacknet_node_money_mult: 1.01,\n hacknet_node_purchase_cost_mult: 0.99,\n hacknet_node_ram_cost_mult: 0.99,\n hacknet_node_core_cost_mult: 0.99,\n hacknet_node_level_cost_mult: 0.99,\n work_money_mult: 1.01,\n });\n\n // Set the Augmentation's level to the currently-installed level\n let currLevel = 0;\n for (let i = 0; i < Player.augmentations.length; ++i) {\n if (Player.augmentations[i].name === AugmentationNames.NeuroFluxGovernor) {\n currLevel = Player.augmentations[i].level;\n }\n }\n NeuroFluxGovernor.level = currLevel;\n\n // To set the price/rep req of the NeuroFlux, we have to take into account NeuroFlux\n // levels that are purchased but not yet installed\n let nextLevel = currLevel;\n for (let i = 0; i < Player.queuedAugmentations.length; ++i) {\n if (Player.queuedAugmentations[i].name === AugmentationNames.NeuroFluxGovernor) {\n ++nextLevel;\n }\n }\n let mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel);\n NeuroFluxGovernor.baseRepRequirement = 500 * mult * BitNodeMultipliers.AugmentationRepCost;\n NeuroFluxGovernor.baseCost = 750e3 * mult * BitNodeMultipliers.AugmentationMoneyCost;\n if (augmentationExists(AugmentationNames.NeuroFluxGovernor)) {\n delete Augmentations[AugmentationNames.NeuroFluxGovernor];\n }\n NeuroFluxGovernor.addToAllFactions();\n AddToAugmentations(NeuroFluxGovernor);\n\n const Neurotrainer1 = new Augmentation({\n name: AugmentationNames.Neurotrainer1,\n repCost: 1e3,\n moneyCost: 4e6,\n info:\n \"A decentralized cranial implant that improves the brain's ability to learn. It is \" +\n \"installed by releasing millions of nanobots into the human brain, each of which \" +\n \"attaches to a different neural pathway to enhance the brain's ability to retain \" +\n \"and retrieve information.\",\n hacking_exp_mult: 1.1,\n strength_exp_mult: 1.1,\n defense_exp_mult: 1.1,\n dexterity_exp_mult: 1.1,\n agility_exp_mult: 1.1,\n charisma_exp_mult: 1.1,\n });\n Neurotrainer1.addToFactions([\"CyberSec\", \"Aevum\"]);\n if (augmentationExists(AugmentationNames.Neurotrainer1)) {\n delete Augmentations[AugmentationNames.Neurotrainer1];\n }\n AddToAugmentations(Neurotrainer1);\n\n const Neurotrainer2 = new Augmentation({\n name: AugmentationNames.Neurotrainer2,\n repCost: 1e4,\n moneyCost: 4.5e7,\n info:\n \"A decentralized cranial implant that improves the brain's ability to learn. This \" +\n \"is a more powerful version of the Neurotrainer I augmentation, but it does not \" +\n \"require Neurotrainer I to be installed as a prerequisite.\",\n hacking_exp_mult: 1.15,\n strength_exp_mult: 1.15,\n defense_exp_mult: 1.15,\n dexterity_exp_mult: 1.15,\n agility_exp_mult: 1.15,\n charisma_exp_mult: 1.15,\n });\n Neurotrainer2.addToFactions([\"BitRunners\", \"NiteSec\"]);\n if (augmentationExists(AugmentationNames.Neurotrainer2)) {\n delete Augmentations[AugmentationNames.Neurotrainer2];\n }\n AddToAugmentations(Neurotrainer2);\n\n const Neurotrainer3 = new Augmentation({\n name: AugmentationNames.Neurotrainer3,\n repCost: 2.5e4,\n moneyCost: 1.3e8,\n info:\n \"A decentralized cranial implant that improves the brain's ability to learn. This \" +\n \"is a more powerful version of the Neurotrainer I and Neurotrainer II augmentation, \" +\n \"but it does not require either of them to be installed as a prerequisite.\",\n hacking_exp_mult: 1.2,\n strength_exp_mult: 1.2,\n defense_exp_mult: 1.2,\n dexterity_exp_mult: 1.2,\n agility_exp_mult: 1.2,\n charisma_exp_mult: 1.2,\n });\n Neurotrainer3.addToFactions([\"NWO\", \"Four Sigma\"]);\n if (augmentationExists(AugmentationNames.Neurotrainer3)) {\n delete Augmentations[AugmentationNames.Neurotrainer3];\n }\n AddToAugmentations(Neurotrainer3);\n\n const Hypersight = new Augmentation({\n name: AugmentationNames.Hypersight,\n repCost: 1.5e5,\n moneyCost: 2.75e9,\n info:\n \"A bionic eye implant that grants sight capabilities far beyond those of a natural human. \" +\n \"Embedded circuitry within the implant provides the ability to detect heat and movement \" +\n \"through solid objects such as walls, thus providing 'x-ray vision'-like capabilities.\",\n dexterity_mult: 1.4,\n hacking_speed_mult: 1.03,\n hacking_money_mult: 1.1,\n });\n Hypersight.addToFactions([\"Blade Industries\", \"KuaiGong International\"]);\n if (augmentationExists(AugmentationNames.Hypersight)) {\n delete Augmentations[AugmentationNames.Hypersight];\n }\n AddToAugmentations(Hypersight);\n\n const LuminCloaking1 = new Augmentation({\n name: AugmentationNames.LuminCloaking1,\n repCost: 1.5e3,\n moneyCost: 5e6,\n info:\n \"A skin implant that reinforces the skin with highly-advanced synthetic cells. These \" +\n \"cells, when powered, have a negative refractive index. As a result, they bend light \" +\n \"around the skin, making the user much harder to see to the naked eye.\",\n agility_mult: 1.05,\n crime_money_mult: 1.1,\n });\n LuminCloaking1.addToFactions([\"Slum Snakes\", \"Tetrads\"]);\n if (augmentationExists(AugmentationNames.LuminCloaking1)) {\n delete Augmentations[AugmentationNames.LuminCloaking1];\n }\n AddToAugmentations(LuminCloaking1);\n\n const LuminCloaking2 = new Augmentation({\n name: AugmentationNames.LuminCloaking2,\n repCost: 5e3,\n moneyCost: 3e7,\n info:\n \"This is a more advanced version of the LuminCloaking-V1 augmentation. This skin implant \" +\n \"reinforces the skin with highly-advanced synthetic cells. These \" +\n \"cells, when powered, are capable of not only bending light but also of bending heat, \" +\n \"making the user more resilient as well as stealthy.\",\n prereqs: [AugmentationNames.LuminCloaking1],\n agility_mult: 1.1,\n defense_mult: 1.1,\n crime_money_mult: 1.25,\n });\n LuminCloaking2.addToFactions([\"Slum Snakes\", \"Tetrads\"]);\n if (augmentationExists(AugmentationNames.LuminCloaking2)) {\n delete Augmentations[AugmentationNames.LuminCloaking2];\n }\n AddToAugmentations(LuminCloaking2);\n\n const SmartSonar = new Augmentation({\n name: AugmentationNames.SmartSonar,\n repCost: 2.25e4,\n moneyCost: 7.5e7,\n info: \"A cochlear implant that helps the player detect and locate enemies \" + \"using sound propagation.\",\n dexterity_mult: 1.1,\n dexterity_exp_mult: 1.15,\n crime_money_mult: 1.25,\n });\n SmartSonar.addToFactions([\"Slum Snakes\"]);\n if (augmentationExists(AugmentationNames.SmartSonar)) {\n delete Augmentations[AugmentationNames.SmartSonar];\n }\n AddToAugmentations(SmartSonar);\n\n const PowerRecirculator = new Augmentation({\n name: AugmentationNames.PowerRecirculator,\n repCost: 2.5e4,\n moneyCost: 1.8e8,\n info:\n \"The body's nerves are attached with polypyrrole nanocircuits that \" +\n \"are capable of capturing wasted energy, in the form of heat, \" +\n \"and converting it back into usable power.\",\n hacking_mult: 1.05,\n strength_mult: 1.05,\n defense_mult: 1.05,\n dexterity_mult: 1.05,\n agility_mult: 1.05,\n charisma_mult: 1.05,\n hacking_exp_mult: 1.1,\n strength_exp_mult: 1.1,\n defense_exp_mult: 1.1,\n dexterity_exp_mult: 1.1,\n agility_exp_mult: 1.1,\n charisma_exp_mult: 1.1,\n });\n PowerRecirculator.addToFactions([\"Tetrads\", \"The Dark Army\", \"The Syndicate\", \"NWO\"]);\n if (augmentationExists(AugmentationNames.PowerRecirculator)) {\n delete Augmentations[AugmentationNames.PowerRecirculator];\n }\n AddToAugmentations(PowerRecirculator);\n\n // Unique AUGS (Each Faction gets one unique augmentation)\n // Factions that already have unique augs up to this point:\n // Slum Snakes, CyberSec, Netburners, Fulcrum Secret Technologies,\n // Silhouette\n\n // Illuminati\n const QLink = new Augmentation({\n name: AugmentationNames.QLink,\n repCost: 1.875e6,\n moneyCost: 2.5e13,\n info:\n \"A brain implant that wirelessly connects you to the Illuminati's \" +\n \"quantum supercomputer, allowing you to access and use its incredible \" +\n \"computing power.\",\n hacking_mult: 1.75,\n hacking_speed_mult: 2,\n hacking_chance_mult: 2.5,\n hacking_money_mult: 4,\n });\n QLink.addToFactions([\"Illuminati\"]);\n if (augmentationExists(AugmentationNames.QLink)) {\n delete Augmentations[AugmentationNames.QLink];\n }\n AddToAugmentations(QLink);\n\n // Daedalus\n const RedPill = new Augmentation({\n name: AugmentationNames.TheRedPill,\n repCost: 2.5e6,\n moneyCost: 0,\n info: \"It's time to leave the cave.\",\n stats: <>,\n });\n RedPill.addToFactions([\"Daedalus\"]);\n if (augmentationExists(AugmentationNames.TheRedPill)) {\n delete Augmentations[AugmentationNames.TheRedPill];\n }\n AddToAugmentations(RedPill);\n\n // Covenant\n const SPTN97 = new Augmentation({\n name: AugmentationNames.SPTN97,\n repCost: 1.25e6,\n moneyCost: 4.875e9,\n info:\n \"The SPTN-97 gene is injected into the genome. The SPTN-97 gene is an \" +\n \"artificially-synthesized gene that was developed by DARPA to create \" +\n \"super-soldiers through genetic modification. The gene was outlawed in \" +\n \"2056.\",\n strength_mult: 1.75,\n defense_mult: 1.75,\n dexterity_mult: 1.75,\n agility_mult: 1.75,\n hacking_mult: 1.15,\n });\n SPTN97.addToFactions([\"The Covenant\"]);\n if (augmentationExists(AugmentationNames.SPTN97)) {\n delete Augmentations[AugmentationNames.SPTN97];\n }\n AddToAugmentations(SPTN97);\n\n // ECorp\n const HiveMind = new Augmentation({\n name: AugmentationNames.HiveMind,\n repCost: 1.5e6,\n moneyCost: 5.5e9,\n info:\n \"A brain implant developed by ECorp. They do not reveal what \" +\n \"exactly the implant does, but they promise that it will greatly \" +\n \"enhance your abilities.\",\n hacking_grow_mult: 3,\n stats: <>,\n });\n HiveMind.addToFactions([\"ECorp\"]);\n if (augmentationExists(AugmentationNames.HiveMind)) {\n delete Augmentations[AugmentationNames.HiveMind];\n }\n AddToAugmentations(HiveMind);\n\n // MegaCorp\n const CordiARCReactor = new Augmentation({\n name: AugmentationNames.CordiARCReactor,\n repCost: 1.125e6,\n moneyCost: 5e9,\n info:\n \"The thoracic cavity is equipped with a small chamber designed \" +\n \"to hold and sustain hydrogen plasma. The plasma is used to generate \" +\n \"fusion power through nuclear fusion, providing limitless amounts of clean \" +\n \"energy for the body.\",\n strength_mult: 1.35,\n defense_mult: 1.35,\n dexterity_mult: 1.35,\n agility_mult: 1.35,\n strength_exp_mult: 1.35,\n defense_exp_mult: 1.35,\n dexterity_exp_mult: 1.35,\n agility_exp_mult: 1.35,\n });\n CordiARCReactor.addToFactions([\"MegaCorp\"]);\n if (augmentationExists(AugmentationNames.CordiARCReactor)) {\n delete Augmentations[AugmentationNames.CordiARCReactor];\n }\n AddToAugmentations(CordiARCReactor);\n\n // BachmanAndAssociates\n const SmartJaw = new Augmentation({\n name: AugmentationNames.SmartJaw,\n repCost: 3.75e5,\n moneyCost: 2.75e9,\n info:\n \"A bionic jaw that contains advanced hardware and software \" +\n \"capable of psychoanalyzing and profiling the personality of \" +\n \"others using optical imaging software.\",\n charisma_mult: 1.5,\n charisma_exp_mult: 1.5,\n company_rep_mult: 1.25,\n faction_rep_mult: 1.25,\n });\n SmartJaw.addToFactions([\"Bachman & Associates\"]);\n if (augmentationExists(AugmentationNames.SmartJaw)) {\n delete Augmentations[AugmentationNames.SmartJaw];\n }\n AddToAugmentations(SmartJaw);\n\n // BladeIndustries\n const Neotra = new Augmentation({\n name: AugmentationNames.Neotra,\n repCost: 5.625e5,\n moneyCost: 2.875e9,\n info:\n \"A highly-advanced techno-organic drug that is injected into the skeletal \" +\n \"and integumentary system. The drug permanently modifies the DNA of the \" +\n \"body's skin and bone cells, granting them the ability to repair \" +\n \"and restructure themselves.\",\n strength_mult: 1.55,\n defense_mult: 1.55,\n });\n Neotra.addToFactions([\"Blade Industries\"]);\n if (augmentationExists(AugmentationNames.Neotra)) {\n delete Augmentations[AugmentationNames.Neotra];\n }\n AddToAugmentations(Neotra);\n\n // NWO\n const Xanipher = new Augmentation({\n name: AugmentationNames.Xanipher,\n repCost: 8.75e5,\n moneyCost: 4.25e9,\n info:\n \"A concoction of advanced nanobots that is orally ingested into the \" +\n \"body. These nanobots induce physiological changes and significantly \" +\n \"improve the body's functioning in all aspects.\",\n hacking_mult: 1.2,\n strength_mult: 1.2,\n defense_mult: 1.2,\n dexterity_mult: 1.2,\n agility_mult: 1.2,\n charisma_mult: 1.2,\n hacking_exp_mult: 1.15,\n strength_exp_mult: 1.15,\n defense_exp_mult: 1.15,\n dexterity_exp_mult: 1.15,\n agility_exp_mult: 1.15,\n charisma_exp_mult: 1.15,\n });\n Xanipher.addToFactions([\"NWO\"]);\n if (augmentationExists(AugmentationNames.Xanipher)) {\n delete Augmentations[AugmentationNames.Xanipher];\n }\n AddToAugmentations(Xanipher);\n\n const HydroflameLeftArm = new Augmentation({\n name: AugmentationNames.HydroflameLeftArm,\n repCost: 1.25e6,\n moneyCost: 2.5e12,\n info:\n \"The left arm of a legendary BitRunner who ascended beyond this world. \" +\n \"It projects a light blue energy shield that protects the exposed inner parts. \" +\n \"Even though it contains no weapons, the advanced tungsten titanium \" +\n \"alloy increases the users strength to unbelievable levels. The augmentation \" +\n \"gets more powerful over time for seemingly no reason.\",\n strength_mult: 2.7,\n });\n HydroflameLeftArm.addToFactions([\"NWO\"]);\n if (augmentationExists(AugmentationNames.HydroflameLeftArm)) {\n delete Augmentations[AugmentationNames.HydroflameLeftArm];\n }\n AddToAugmentations(HydroflameLeftArm);\n\n // ClarkeIncorporated\n const nextSENS = new Augmentation({\n name: AugmentationNames.nextSENS,\n repCost: 4.375e5,\n moneyCost: 1.925e9,\n info:\n \"The body is genetically re-engineered to maintain a state \" +\n \"of negligible senescence, preventing the body from \" +\n \"deteriorating with age.\",\n hacking_mult: 1.2,\n strength_mult: 1.2,\n defense_mult: 1.2,\n dexterity_mult: 1.2,\n agility_mult: 1.2,\n charisma_mult: 1.2,\n });\n nextSENS.addToFactions([\"Clarke Incorporated\"]);\n if (augmentationExists(AugmentationNames.nextSENS)) {\n delete Augmentations[AugmentationNames.nextSENS];\n }\n AddToAugmentations(nextSENS);\n\n // OmniTekIncorporated\n const OmniTekInfoLoad = new Augmentation({\n name: AugmentationNames.OmniTekInfoLoad,\n repCost: 6.25e5,\n moneyCost: 2.875e9,\n info:\n \"OmniTek's data and information repository is uploaded \" +\n \"into your brain, enhancing your programming and \" +\n \"hacking abilities.\",\n hacking_mult: 1.2,\n hacking_exp_mult: 1.25,\n });\n OmniTekInfoLoad.addToFactions([\"OmniTek Incorporated\"]);\n if (augmentationExists(AugmentationNames.OmniTekInfoLoad)) {\n delete Augmentations[AugmentationNames.OmniTekInfoLoad];\n }\n AddToAugmentations(OmniTekInfoLoad);\n\n // FourSigma\n // TODO Later when Intelligence is added in . Some aug that greatly increases int\n\n // KuaiGongInternational\n const PhotosyntheticCells = new Augmentation({\n name: AugmentationNames.PhotosyntheticCells,\n repCost: 5.625e5,\n moneyCost: 2.75e9,\n info:\n \"Chloroplasts are added to epidermal stem cells and are applied \" +\n \"to the body using a skin graft. The result is photosynthetic \" +\n \"skin cells, allowing users to generate their own energy \" +\n \"and nutrition using solar power.\",\n strength_mult: 1.4,\n defense_mult: 1.4,\n agility_mult: 1.4,\n });\n PhotosyntheticCells.addToFactions([\"KuaiGong International\"]);\n if (augmentationExists(AugmentationNames.PhotosyntheticCells)) {\n delete Augmentations[AugmentationNames.PhotosyntheticCells];\n }\n AddToAugmentations(PhotosyntheticCells);\n\n // BitRunners\n const Neurolink = new Augmentation({\n name: AugmentationNames.Neurolink,\n repCost: 8.75e5,\n moneyCost: 4.375e9,\n info:\n \"A brain implant that provides a high-bandwidth, direct neural link between your \" +\n \"mind and the BitRunners' data servers, which reportedly contain \" +\n \"the largest database of hacking tools and information in the world.\",\n hacking_mult: 1.15,\n hacking_exp_mult: 1.2,\n hacking_chance_mult: 1.1,\n hacking_speed_mult: 1.05,\n programs: [Programs.FTPCrackProgram.name, Programs.RelaySMTPProgram.name],\n });\n Neurolink.addToFactions([\"BitRunners\"]);\n if (augmentationExists(AugmentationNames.Neurolink)) {\n delete Augmentations[AugmentationNames.Neurolink];\n }\n AddToAugmentations(Neurolink);\n\n // BlackHand\n const TheBlackHand = new Augmentation({\n name: AugmentationNames.TheBlackHand,\n repCost: 1e5,\n moneyCost: 5.5e8,\n info:\n \"A highly advanced bionic hand. This prosthetic not only \" +\n \"enhances strength and dexterity but it is also embedded \" +\n \"with hardware and firmware that lets the user connect to, access, and hack \" +\n \"devices and machines by just touching them.\",\n strength_mult: 1.15,\n dexterity_mult: 1.15,\n hacking_mult: 1.1,\n hacking_speed_mult: 1.02,\n hacking_money_mult: 1.1,\n });\n TheBlackHand.addToFactions([\"The Black Hand\"]);\n if (augmentationExists(AugmentationNames.TheBlackHand)) {\n delete Augmentations[AugmentationNames.TheBlackHand];\n }\n AddToAugmentations(TheBlackHand);\n\n // NiteSec\n const CRTX42AA = new Augmentation({\n name: AugmentationNames.CRTX42AA,\n repCost: 4.5e4,\n moneyCost: 2.25e8,\n info:\n \"The CRTX42-AA gene is injected into the genome. \" +\n \"The CRTX42-AA is an artificially-synthesized gene that targets the visual and prefrontal \" +\n \"cortex and improves cognitive abilities.\",\n hacking_mult: 1.08,\n hacking_exp_mult: 1.15,\n });\n CRTX42AA.addToFactions([\"NiteSec\"]);\n if (augmentationExists(AugmentationNames.CRTX42AA)) {\n delete Augmentations[AugmentationNames.CRTX42AA];\n }\n AddToAugmentations(CRTX42AA);\n\n // Chongqing\n const Neuregen = new Augmentation({\n name: AugmentationNames.Neuregen,\n repCost: 3.75e4,\n moneyCost: 3.75e8,\n info:\n \"A drug that genetically modifies the neurons in the brain \" +\n \"resulting in neurons never die, continuously \" +\n \"regenerate, and strengthen themselves.\",\n hacking_exp_mult: 1.4,\n });\n Neuregen.addToFactions([\"Chongqing\"]);\n if (augmentationExists(AugmentationNames.Neuregen)) {\n delete Augmentations[AugmentationNames.Neuregen];\n }\n AddToAugmentations(Neuregen);\n\n // Sector12\n const CashRoot = new Augmentation({\n name: AugmentationNames.CashRoot,\n repCost: 1.25e4,\n moneyCost: 1.25e8,\n info: (\n <>\n A collection of digital assets saved on a small chip. The chip is implanted into your wrist. A small jack in the\n chip allows you to connect it to a computer and upload the assets.\n \n ),\n startingMoney: 1e6,\n programs: [Programs.BruteSSHProgram.name],\n });\n CashRoot.addToFactions([\"Sector-12\"]);\n if (augmentationExists(AugmentationNames.CashRoot)) {\n delete Augmentations[AugmentationNames.CashRoot];\n }\n AddToAugmentations(CashRoot);\n\n // NewTokyo\n const NutriGen = new Augmentation({\n name: AugmentationNames.NutriGen,\n repCost: 6.25e3,\n moneyCost: 2.5e6,\n info:\n \"A thermo-powered artificial nutrition generator. Endogenously \" +\n \"synthesizes glucose, amino acids, and vitamins and redistributes them \" +\n \"across the body. The device is powered by the body's naturally wasted \" +\n \"energy in the form of heat.\",\n strength_exp_mult: 1.2,\n defense_exp_mult: 1.2,\n dexterity_exp_mult: 1.2,\n agility_exp_mult: 1.2,\n });\n NutriGen.addToFactions([\"New Tokyo\"]);\n if (augmentationExists(AugmentationNames.NutriGen)) {\n delete Augmentations[AugmentationNames.NutriGen];\n }\n AddToAugmentations(NutriGen);\n\n // Aevum\n const PCMatrix = new Augmentation({\n name: AugmentationNames.PCMatrix,\n repCost: 100e3,\n moneyCost: 2e9,\n info:\n \"A 'Probability Computation Matrix' is installed in the frontal cortex. This implant \" +\n \"uses advanced mathematical algorithims to rapidly identify and compute statistical \" +\n \"outcomes of nearly every situation.\",\n charisma_mult: 1.0777,\n charisma_exp_mult: 1.0777,\n work_money_mult: 1.777,\n faction_rep_mult: 1.0777,\n company_rep_mult: 1.0777,\n crime_success_mult: 1.0777,\n crime_money_mult: 1.0777,\n programs: [Programs.DeepscanV1.name, Programs.AutoLink.name],\n });\n PCMatrix.addToFactions([\"Aevum\"]);\n if (augmentationExists(AugmentationNames.PCMatrix)) {\n delete Augmentations[AugmentationNames.PCMatrix];\n }\n AddToAugmentations(PCMatrix);\n\n // Ishima\n const INFRARet = new Augmentation({\n name: AugmentationNames.INFRARet,\n repCost: 7.5e3,\n moneyCost: 3e7,\n info:\n \"A tiny chip that sits behind the retinae. This implant lets the\" + \"user visually detect infrared radiation.\",\n crime_success_mult: 1.25,\n crime_money_mult: 1.1,\n dexterity_mult: 1.1,\n });\n INFRARet.addToFactions([\"Ishima\"]);\n if (augmentationExists(AugmentationNames.INFRARet)) {\n delete Augmentations[AugmentationNames.INFRARet];\n }\n AddToAugmentations(INFRARet);\n\n // Volhaven\n const DermaForce = new Augmentation({\n name: AugmentationNames.DermaForce,\n repCost: 1.5e4,\n moneyCost: 5e7,\n info:\n \"Synthetic skin that is grafted onto the body. This skin consists of \" +\n \"millions of nanobots capable of projecting high-density muon beams, \" +\n \"creating an energy barrier around the user.\",\n defense_mult: 1.4,\n });\n DermaForce.addToFactions([\"Volhaven\"]);\n if (augmentationExists(AugmentationNames.DermaForce)) {\n delete Augmentations[AugmentationNames.DermaForce];\n }\n AddToAugmentations(DermaForce);\n\n // SpeakersForTheDead\n const GrapheneBrachiBlades = new Augmentation({\n name: AugmentationNames.GrapheneBrachiBlades,\n repCost: 2.25e5,\n moneyCost: 2.5e9,\n info:\n \"An upgrade to the BrachiBlades augmentation. It infuses \" +\n \"the retractable blades with an advanced graphene material \" +\n \"making them stronger and lighter.\",\n prereqs: [AugmentationNames.BrachiBlades],\n strength_mult: 1.4,\n defense_mult: 1.4,\n crime_success_mult: 1.1,\n crime_money_mult: 1.3,\n });\n GrapheneBrachiBlades.addToFactions([\"Speakers for the Dead\"]);\n if (augmentationExists(AugmentationNames.GrapheneBrachiBlades)) {\n delete Augmentations[AugmentationNames.GrapheneBrachiBlades];\n }\n AddToAugmentations(GrapheneBrachiBlades);\n\n // DarkArmy\n const GrapheneBionicArms = new Augmentation({\n name: AugmentationNames.GrapheneBionicArms,\n repCost: 5e5,\n moneyCost: 3.75e9,\n info:\n \"An upgrade to the Bionic Arms augmentation. It infuses the \" +\n \"prosthetic arms with an advanced graphene material \" +\n \"to make them stronger and lighter.\",\n prereqs: [AugmentationNames.BionicArms],\n strength_mult: 1.85,\n dexterity_mult: 1.85,\n });\n GrapheneBionicArms.addToFactions([\"The Dark Army\"]);\n if (augmentationExists(AugmentationNames.GrapheneBionicArms)) {\n delete Augmentations[AugmentationNames.GrapheneBionicArms];\n }\n AddToAugmentations(GrapheneBionicArms);\n\n // TheSyndicate\n const BrachiBlades = new Augmentation({\n name: AugmentationNames.BrachiBlades,\n repCost: 1.25e4,\n moneyCost: 9e7,\n info: \"A set of retractable plasteel blades that are implanted in the arm, underneath the skin.\",\n strength_mult: 1.15,\n defense_mult: 1.15,\n crime_success_mult: 1.1,\n crime_money_mult: 1.15,\n });\n BrachiBlades.addToFactions([\"The Syndicate\"]);\n if (augmentationExists(AugmentationNames.BrachiBlades)) {\n delete Augmentations[AugmentationNames.BrachiBlades];\n }\n AddToAugmentations(BrachiBlades);\n\n // Tetrads\n const BionicArms = new Augmentation({\n name: AugmentationNames.BionicArms,\n repCost: 6.25e4,\n moneyCost: 2.75e8,\n info:\n \"Cybernetic arms created from plasteel and carbon fibers that completely replace \" + \"the user's organic arms.\",\n strength_mult: 1.3,\n dexterity_mult: 1.3,\n });\n BionicArms.addToFactions([\"Tetrads\"]);\n if (augmentationExists(AugmentationNames.BionicArms)) {\n delete Augmentations[AugmentationNames.BionicArms];\n }\n AddToAugmentations(BionicArms);\n\n // TianDiHui\n const SNA = new Augmentation({\n name: AugmentationNames.SNA,\n repCost: 6.25e3,\n moneyCost: 3e7,\n info:\n \"A cranial implant that affects the user's personality, making them better \" +\n \"at negotiation in social situations.\",\n work_money_mult: 1.1,\n company_rep_mult: 1.15,\n faction_rep_mult: 1.15,\n });\n SNA.addToFactions([\"Tian Di Hui\"]);\n if (augmentationExists(AugmentationNames.SNA)) {\n delete Augmentations[AugmentationNames.SNA];\n }\n AddToAugmentations(SNA);\n\n // Special Bladeburner Augmentations\n const BladeburnersFactionName = \"Bladeburners\";\n if (factionExists(BladeburnersFactionName)) {\n const EsperEyewear = new Augmentation({\n name: AugmentationNames.EsperEyewear,\n repCost: 1.25e3,\n moneyCost: 1.65e8,\n info:\n \"Ballistic-grade protective and retractable eyewear that was designed specifically \" +\n \"for Bladeburner units. This \" +\n \"is implanted by installing a mechanical frame in the skull's orbit. \" +\n \"This frame interfaces with the brain and allows the user to \" +\n \"automatically extrude and extract the eyewear. The eyewear protects \" +\n \"against debris, shrapnel, lasers, blinding flashes, and gas. It is also \" +\n \"embedded with a data processing chip that can be programmed to display an \" +\n \"AR HUD to assist the user in field missions.\",\n bladeburner_success_chance_mult: 1.03,\n dexterity_mult: 1.05,\n isSpecial: true,\n });\n EsperEyewear.addToFactions([BladeburnersFactionName]);\n resetAugmentation(EsperEyewear);\n\n const EMS4Recombination = new Augmentation({\n name: AugmentationNames.EMS4Recombination,\n repCost: 2.5e3,\n moneyCost: 2.75e8,\n info:\n \"A DNA recombination of the EMS-4 Gene. This genetic engineering \" +\n \"technique was originally used on Bladeburners during the Synthoid uprising \" +\n \"to induce wakefulness and concentration, suppress fear, reduce empathy, \" +\n \"improve reflexes, and improve memory among other things.\",\n bladeburner_success_chance_mult: 1.03,\n bladeburner_analysis_mult: 1.05,\n bladeburner_stamina_gain_mult: 1.02,\n isSpecial: true,\n });\n EMS4Recombination.addToFactions([BladeburnersFactionName]);\n resetAugmentation(EMS4Recombination);\n\n const OrionShoulder = new Augmentation({\n name: AugmentationNames.OrionShoulder,\n repCost: 6.25e3,\n moneyCost: 5.5e8,\n info:\n \"A bionic shoulder augmentation for the right shoulder. Using cybernetics, \" +\n \"the ORION-MKIV shoulder enhances the strength and dexterity \" +\n \"of the user's right arm. It also provides protection due to its \" +\n \"crystallized graphene plating.\",\n defense_mult: 1.05,\n strength_mult: 1.05,\n dexterity_mult: 1.05,\n bladeburner_success_chance_mult: 1.04,\n isSpecial: true,\n });\n OrionShoulder.addToFactions([BladeburnersFactionName]);\n resetAugmentation(OrionShoulder);\n\n const HyperionV1 = new Augmentation({\n name: AugmentationNames.HyperionV1,\n repCost: 1.25e4,\n moneyCost: 2.75e9,\n info:\n \"A pair of mini plasma cannons embedded into the hands. The Hyperion is capable \" +\n \"of rapidly firing bolts of high-density plasma. The weapon is meant to \" +\n \"be used against augmented enemies as the ionized \" +\n \"nature of the plasma disrupts the electrical systems of Augmentations. However, \" +\n \"it can also be effective against non-augmented enemies due to its high temperature \" +\n \"and concussive force.\",\n bladeburner_success_chance_mult: 1.06,\n isSpecial: true,\n });\n HyperionV1.addToFactions([BladeburnersFactionName]);\n resetAugmentation(HyperionV1);\n\n const HyperionV2 = new Augmentation({\n name: AugmentationNames.HyperionV2,\n repCost: 2.5e4,\n moneyCost: 5.5e9,\n info:\n \"A pair of mini plasma cannons embedded into the hands. This augmentation \" +\n \"is more advanced and powerful than the original V1 model. This V2 model is \" +\n \"more power-efficient, more accurate, and can fire plasma bolts at a much \" +\n \"higher velocity than the V1 model.\",\n prereqs: [AugmentationNames.HyperionV1],\n bladeburner_success_chance_mult: 1.08,\n isSpecial: true,\n });\n HyperionV2.addToFactions([BladeburnersFactionName]);\n resetAugmentation(HyperionV2);\n\n const GolemSerum = new Augmentation({\n name: AugmentationNames.GolemSerum,\n repCost: 3.125e4,\n moneyCost: 1.1e10,\n info:\n \"A serum that permanently enhances many aspects of human capabilities, \" +\n \"including strength, speed, immune system enhancements, and mitochondrial efficiency. The \" +\n \"serum was originally developed by the Chinese military in an attempt to \" +\n \"create super soldiers.\",\n strength_mult: 1.07,\n defense_mult: 1.07,\n dexterity_mult: 1.07,\n agility_mult: 1.07,\n bladeburner_stamina_gain_mult: 1.05,\n isSpecial: true,\n });\n GolemSerum.addToFactions([BladeburnersFactionName]);\n resetAugmentation(GolemSerum);\n\n const VangelisVirus = new Augmentation({\n name: AugmentationNames.VangelisVirus,\n repCost: 1.875e4,\n moneyCost: 2.75e9,\n info:\n \"A synthetic symbiotic virus that is injected into human brain tissue. The Vangelis virus \" +\n \"heightens the senses and focus of its host, and also enhances its intuition.\",\n dexterity_exp_mult: 1.1,\n bladeburner_analysis_mult: 1.1,\n bladeburner_success_chance_mult: 1.04,\n isSpecial: true,\n });\n VangelisVirus.addToFactions([BladeburnersFactionName]);\n resetAugmentation(VangelisVirus);\n\n const VangelisVirus3 = new Augmentation({\n name: AugmentationNames.VangelisVirus3,\n repCost: 3.75e4,\n moneyCost: 1.1e10,\n info:\n \"An improved version of Vangelis, a synthetic symbiotic virus that is \" +\n \"injected into human brain tissue. On top of the benefits of the original \" +\n \"virus, this also grants an accelerated healing factor and enhanced \" +\n \"reflexes.\",\n prereqs: [AugmentationNames.VangelisVirus],\n defense_exp_mult: 1.1,\n dexterity_exp_mult: 1.1,\n bladeburner_analysis_mult: 1.15,\n bladeburner_success_chance_mult: 1.05,\n isSpecial: true,\n });\n VangelisVirus3.addToFactions([BladeburnersFactionName]);\n resetAugmentation(VangelisVirus3);\n\n const INTERLINKED = new Augmentation({\n name: AugmentationNames.INTERLINKED,\n repCost: 2.5e4,\n moneyCost: 5.5e9,\n info:\n \"The DNA is genetically modified to enhance the human's body \" +\n \"extracellular matrix (ECM). This improves the ECM's ability to \" +\n \"structurally support the body and grants heightened strength and \" +\n \"durability.\",\n strength_exp_mult: 1.05,\n defense_exp_mult: 1.05,\n dexterity_exp_mult: 1.05,\n agility_exp_mult: 1.05,\n bladeburner_max_stamina_mult: 1.1,\n isSpecial: true,\n });\n INTERLINKED.addToFactions([BladeburnersFactionName]);\n resetAugmentation(INTERLINKED);\n\n const BladeRunner = new Augmentation({\n name: AugmentationNames.BladeRunner,\n repCost: 2e4,\n moneyCost: 8.25e9,\n info:\n \"A cybernetic foot augmentation that was specifically created for Bladeburners \" +\n \"during the Synthoid Uprising. The organic musculature of the human foot \" +\n \"is enhanced with flexible carbon nanotube matrices that are controlled by \" +\n \"intelligent servo-motors.\",\n agility_mult: 1.05,\n bladeburner_max_stamina_mult: 1.05,\n bladeburner_stamina_gain_mult: 1.05,\n isSpecial: true,\n });\n BladeRunner.addToFactions([BladeburnersFactionName]);\n resetAugmentation(BladeRunner);\n\n const BladeArmor = new Augmentation({\n name: AugmentationNames.BladeArmor,\n repCost: 1.25e4,\n moneyCost: 1.375e9,\n info:\n \"A powered exoskeleton suit designed as armor for Bladeburner units. This \" +\n \"exoskeleton is incredibly adaptable and can protect the wearer from blunt, piercing, \" +\n \"concussive, thermal, chemical, and electric trauma. It also enhances the user's \" +\n \"physical abilities.\",\n strength_mult: 1.04,\n defense_mult: 1.04,\n dexterity_mult: 1.04,\n agility_mult: 1.04,\n bladeburner_stamina_gain_mult: 1.02,\n bladeburner_success_chance_mult: 1.03,\n isSpecial: true,\n });\n BladeArmor.addToFactions([BladeburnersFactionName]);\n resetAugmentation(BladeArmor);\n\n const BladeArmorPowerCells = new Augmentation({\n name: AugmentationNames.BladeArmorPowerCells,\n repCost: 1.875e4,\n moneyCost: 2.75e9,\n info:\n \"Upgrades the BLADE-51b Tesla Armor with Ion Power Cells, which are capable of \" +\n \"more efficiently storing and using power.\",\n prereqs: [AugmentationNames.BladeArmor],\n bladeburner_success_chance_mult: 1.05,\n bladeburner_stamina_gain_mult: 1.02,\n bladeburner_max_stamina_mult: 1.05,\n isSpecial: true,\n });\n BladeArmorPowerCells.addToFactions([BladeburnersFactionName]);\n resetAugmentation(BladeArmorPowerCells);\n\n const BladeArmorEnergyShielding = new Augmentation({\n name: AugmentationNames.BladeArmorEnergyShielding,\n repCost: 2.125e4,\n moneyCost: 5.5e9,\n info:\n \"Upgrades the BLADE-51b Tesla Armor with a plasma energy propulsion system \" +\n \"that is capable of projecting an energy shielding force field.\",\n prereqs: [AugmentationNames.BladeArmor],\n defense_mult: 1.05,\n bladeburner_success_chance_mult: 1.06,\n isSpecial: true,\n });\n BladeArmorEnergyShielding.addToFactions([BladeburnersFactionName]);\n resetAugmentation(BladeArmorEnergyShielding);\n\n const BladeArmorUnibeam = new Augmentation({\n name: AugmentationNames.BladeArmorUnibeam,\n repCost: 3.125e4,\n moneyCost: 1.65e10,\n info:\n \"Upgrades the BLADE-51b Tesla Armor with a concentrated deuterium-fluoride laser \" +\n \"weapon. It's precision and accuracy makes it useful for quickly neutralizing \" +\n \"threats while keeping casualties to a minimum.\",\n prereqs: [AugmentationNames.BladeArmor],\n bladeburner_success_chance_mult: 1.08,\n isSpecial: true,\n });\n BladeArmorUnibeam.addToFactions([BladeburnersFactionName]);\n resetAugmentation(BladeArmorUnibeam);\n\n const BladeArmorOmnibeam = new Augmentation({\n name: AugmentationNames.BladeArmorOmnibeam,\n repCost: 6.25e4,\n moneyCost: 2.75e10,\n info:\n \"Upgrades the BLADE-51b Tesla Armor Unibeam augmentation to use a \" +\n \"multiple-fiber system. This upgraded weapon uses multiple fiber laser \" +\n \"modules that combine together to form a single, more powerful beam of up to \" +\n \"2000MW.\",\n prereqs: [AugmentationNames.BladeArmorUnibeam],\n bladeburner_success_chance_mult: 1.1,\n isSpecial: true,\n });\n BladeArmorOmnibeam.addToFactions([BladeburnersFactionName]);\n resetAugmentation(BladeArmorOmnibeam);\n\n const BladeArmorIPU = new Augmentation({\n name: AugmentationNames.BladeArmorIPU,\n repCost: 1.5e4,\n moneyCost: 1.1e9,\n info:\n \"Upgrades the BLADE-51b Tesla Armor with an AI Information Processing \" +\n \"Unit that was specially designed to analyze Synthoid related data and \" +\n \"information.\",\n prereqs: [AugmentationNames.BladeArmor],\n bladeburner_analysis_mult: 1.15,\n bladeburner_success_chance_mult: 1.02,\n isSpecial: true,\n });\n BladeArmorIPU.addToFactions([BladeburnersFactionName]);\n resetAugmentation(BladeArmorIPU);\n\n const BladesSimulacrum = new Augmentation({\n name: AugmentationNames.BladesSimulacrum,\n repCost: 1.25e3,\n moneyCost: 1.5e11,\n info:\n \"A highly-advanced matter phase-shifter module that is embedded \" +\n \"in the brainstem and cerebellum. This augmentation allows \" +\n \"the user to project and control a holographic simulacrum within an \" +\n \"extremely large radius. These specially-modified holograms were specifically \" +\n \"weaponized by Bladeburner units to be used against Synthoids.\",\n stats: (\n <>\n This augmentation allows you to perform Bladeburner actions and other actions (such as working, commiting\n crimes, etc.) at the same time.\n \n ),\n isSpecial: true,\n });\n BladesSimulacrum.addToFactions([BladeburnersFactionName]);\n resetAugmentation(BladesSimulacrum);\n }\n\n // Update costs based on how many have been purchased\n mult = Math.pow(\n CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]],\n Player.queuedAugmentations.length,\n );\n for (var name in Augmentations) {\n if (Augmentations.hasOwnProperty(name)) {\n Augmentations[name].baseCost *= mult;\n }\n }\n\n Player.reapplyAllAugmentations();\n}\n\n//Resets an Augmentation during (re-initizliation)\nfunction resetAugmentation(newAugObject) {\n if (!(newAugObject instanceof Augmentation)) {\n throw new Error(\"Invalid argument 'newAugObject' passed into resetAugmentation\");\n }\n var name = newAugObject.name;\n if (augmentationExists(name)) {\n delete Augmentations[name];\n }\n AddToAugmentations(newAugObject);\n}\n\nfunction applyAugmentation(aug, reapply = false) {\n Augmentations[aug.name].owned = true;\n\n const augObj = Augmentations[aug.name];\n\n // Apply multipliers\n for (const mult in augObj.mults) {\n if (Player[mult] == null) {\n console.warn(`Augmentation has unrecognized multiplier property: ${mult}`);\n } else {\n Player[mult] *= augObj.mults[mult];\n }\n }\n\n // Special logic for NeuroFlux Governor\n if (aug.name === AugmentationNames.NeuroFluxGovernor) {\n if (!reapply) {\n Augmentations[aug.name].level = aug.level;\n for (let i = 0; i < Player.augmentations.length; ++i) {\n if (Player.augmentations[i].name == AugmentationNames.NeuroFluxGovernor) {\n Player.augmentations[i].level = aug.level;\n return;\n // break;\n }\n }\n }\n }\n\n // Push onto Player's Augmentation list\n if (!reapply) {\n var ownedAug = new PlayerOwnedAugmentation(aug.name);\n Player.augmentations.push(ownedAug);\n }\n}\n\nfunction installAugmentations() {\n if (Player.queuedAugmentations.length == 0) {\n dialogBoxCreate(\"You have not purchased any Augmentations to install!\");\n return false;\n }\n let augmentationList = \"\";\n let nfgIndex = -1;\n for (let i = Player.queuedAugmentations.length - 1; i >= 0; i--) {\n if (Player.queuedAugmentations[i].name === AugmentationNames.NeuroFluxGovernor) {\n nfgIndex = i;\n break;\n }\n }\n for (let i = 0; i < Player.queuedAugmentations.length; ++i) {\n const ownedAug = Player.queuedAugmentations[i];\n const aug = Augmentations[ownedAug.name];\n if (aug == null) {\n console.error(`Invalid augmentation: ${ownedAug.name}`);\n continue;\n }\n\n applyAugmentation(Player.queuedAugmentations[i]);\n if (ownedAug.name === AugmentationNames.NeuroFluxGovernor && i !== nfgIndex) continue;\n\n let level = \"\";\n if (ownedAug.name === AugmentationNames.NeuroFluxGovernor) {\n level = ` - ${ownedAug.level}`;\n }\n augmentationList += aug.name + level + \"
\";\n }\n Player.queuedAugmentations = [];\n dialogBoxCreate(\n \"You slowly drift to sleep as scientists put you under in order \" +\n \"to install the following Augmentations:
\" +\n augmentationList +\n \"
You wake up in your home...you feel different...\",\n );\n prestigeAugmentation();\n}\n\nfunction augmentationExists(name) {\n return Augmentations.hasOwnProperty(name);\n}\n\nexport function isRepeatableAug(aug) {\n const augName = aug instanceof Augmentation ? aug.name : aug;\n\n if (augName === AugmentationNames.NeuroFluxGovernor) {\n return true;\n }\n\n return false;\n}\n\nexport { installAugmentations, initAugmentations, applyAugmentation, augmentationExists };\n","import { CONSTANTS } from \"./Constants\";\nimport { Player } from \"./Player\";\n\nimport { dialogBoxCreate } from \"../utils/DialogBox\";\nimport { formatNumber } from \"../utils/StringHelperFunctions\";\nimport { Reputation } from \"./ui/React/Reputation\";\n\nimport { addOffset } from \"../utils/helpers/addOffset\";\nimport { getRandomInt } from \"../utils/helpers/getRandomInt\";\nimport { isString } from \"../utils/helpers/isString\";\n\nimport { clearEventListeners } from \"../utils/uiHelpers/clearEventListeners\";\nimport { Router } from \"./ui/GameRoot\";\n\n// For some reason `jsplumb` needs to be imported exactly like this,\n// lowercase p, and later in the code used as `jsPlumb` uppercase P. wtf.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport jsplumb from \"jsplumb\";\n\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\n\nlet inMission = false; // Flag to denote whether a mission is running\nlet currMission = null;\nfunction setInMission(bool, mission) {\n inMission = bool;\n if (bool) {\n currMission = mission;\n } else {\n currMission = null;\n }\n}\n\n// Keyboard shortcuts\n$(document).keydown(function (e) {\n if (inMission && currMission && currMission.selectedNode.length != 0) {\n switch (e.keyCode) {\n case 65: // a for Attack\n currMission.actionButtons[0].click();\n break;\n case 83: // s for Scan\n currMission.actionButtons[1].click();\n break;\n case 87: // w for Weaken\n currMission.actionButtons[2].click();\n break;\n case 70: // f for Fortify\n currMission.actionButtons[3].click();\n break;\n case 82: // r for Overflow\n currMission.actionButtons[4].click();\n break;\n case 68: // d for Detach connection\n currMission.actionButtons[5].click();\n break;\n default:\n break;\n }\n }\n});\n\nlet NodeTypes = {\n Core: \"CPU Core Node\", // All actions available\n Firewall: \"Firewall Node\", // No actions available\n Database: \"Database Node\", // No actions available\n Spam: \"Spam Node\", // No actions Available\n Transfer: \"Transfer Node\", // Can Weaken, Scan, Fortify and Overflow\n Shield: \"Shield Node\", // Can Fortify\n};\n\nlet NodeActions = {\n Attack: \"Attacking\", // Damaged based on attack stat + hacking level + opp def\n Scan: \"Scanning\", // -Def for target, affected by attack and hacking level\n Weaken: \"Weakening\", // -Attack for target, affected by attack and hacking level\n Fortify: \"Fortifying\", // +Defense for Node, affected by hacking level\n Overflow: \"Overflowing\", // +Attack but -Defense for Node, affected by hacking level\n};\n\nfunction Node(type, stats) {\n this.type = type;\n this.atk = stats.atk ? stats.atk : 0;\n this.def = stats.def ? stats.def : 0;\n this.hp = stats.hp ? stats.hp : 0;\n this.maxhp = this.hp;\n this.plyrCtrl = false;\n this.enmyCtrl = false;\n this.pos = [0, 0]; // x, y\n this.el = null; // Holds the Node's DOM element\n this.action = null;\n this.targetedCount = 0; // Count of how many connections this node is the target of\n\n /**\n * Holds the JsPlumb Connection object for this Node, where this Node is the Source (since each Node\n * can only have 1 outgoing Connection)\n */\n this.conn = null;\n}\n\nNode.prototype.setPosition = function (x, y) {\n this.pos = [x, y];\n};\n\nNode.prototype.setControlledByPlayer = function () {\n this.plyrCtrl = true;\n this.enmyCtrl = false;\n if (this.el) {\n this.el.classList.remove(\"hack-mission-enemy-node\");\n this.el.classList.add(\"hack-mission-player-node\");\n }\n};\n\nNode.prototype.setControlledByEnemy = function () {\n this.plyrCtrl = false;\n this.enmyCtrl = true;\n if (this.el) {\n this.el.classList.remove(\"hack-mission-player-node\");\n this.el.classList.add(\"hack-mission-enemy-node\");\n }\n};\n\n// Sets this node to be the active node\nNode.prototype.select = function (actionButtons) {\n if (this.enmyCtrl) {\n return;\n }\n this.el.classList.add(\"hack-mission-player-node-active\");\n\n // Make all buttons inactive\n for (var i = 0; i < actionButtons.length; ++i) {\n actionButtons[i].classList.remove(\"a-link-button\");\n actionButtons[i].classList.add(\"a-link-button-inactive\");\n }\n\n switch (this.type) {\n case NodeTypes.Core:\n // All buttons active\n for (var i = 0; i < actionButtons.length; ++i) {\n actionButtons[i].classList.remove(\"a-link-button-inactive\");\n actionButtons[i].classList.add(\"a-link-button\");\n }\n break;\n case NodeTypes.Transfer:\n actionButtons[1].classList.remove(\"a-link-button-inactive\");\n actionButtons[1].classList.add(\"a-link-button\");\n actionButtons[2].classList.remove(\"a-link-button-inactive\");\n actionButtons[2].classList.add(\"a-link-button\");\n actionButtons[3].classList.remove(\"a-link-button-inactive\");\n actionButtons[3].classList.add(\"a-link-button\");\n actionButtons[4].classList.remove(\"a-link-button-inactive\");\n actionButtons[4].classList.add(\"a-link-button\");\n actionButtons[5].classList.remove(\"a-link-button-inactive\");\n actionButtons[5].classList.add(\"a-link-button\");\n break;\n case NodeTypes.Shield:\n case NodeTypes.Firewall:\n actionButtons[3].classList.remove(\"a-link-button-inactive\");\n actionButtons[3].classList.add(\"a-link-button\");\n break;\n default:\n break;\n }\n};\n\nNode.prototype.deselect = function (actionButtons) {\n this.el.classList.remove(\"hack-mission-player-node-active\");\n for (var i = 0; i < actionButtons.length; ++i) {\n actionButtons[i].classList.remove(\"a-link-button\");\n actionButtons[i].classList.add(\"a-link-button-inactive\");\n }\n};\n\nNode.prototype.untarget = function () {\n if (this.targetedCount === 0) {\n console.warn(`Node ${this.el.id} is being 'untargeted' when it has no target count`);\n return;\n }\n --this.targetedCount;\n};\n\n/**\n * Hacking mission instance\n * @param rep {number} How much reputation the player has for the faction\n * @param fac {Faction} Faction for which this mission is being conducted\n */\nfunction HackingMission(rep, fac) {\n this.faction = fac;\n\n this.started = false;\n this.time = 180000; // 5 minutes to start, milliseconds\n\n this.playerCores = [];\n this.playerNodes = []; // Non-core nodes\n this.playerAtk = 0;\n this.playerDef = 0;\n\n this.enemyCores = [];\n this.enemyDatabases = [];\n this.enemyNodes = []; // Non-core nodes\n this.enemyAtk = 0;\n this.enemyDef = 0;\n\n this.miscNodes = [];\n\n this.selectedNode = []; // Which of the player's nodes are currently selected\n\n this.actionButtons = []; // DOM buttons for actions\n\n this.availablePositions = [];\n for (var r = 0; r < 8; ++r) {\n for (var c = 0; c < 8; ++c) {\n this.availablePositions.push([r, c]);\n }\n }\n\n this.map = [];\n for (var i = 0; i < 8; ++i) {\n this.map.push([null, null, null, null, null, null, null, null]);\n }\n\n this.jsplumbinstance = null;\n\n this.difficulty = rep / CONSTANTS.HackingMissionRepToDiffConversion + 1;\n this.reward = 250 + rep / CONSTANTS.HackingMissionRepToRewardConversion;\n}\n\nHackingMission.prototype.init = function () {\n // Create Header DOM\n this.createPageDom();\n\n // Create player starting nodes\n var home = Player.getHomeComputer();\n for (var i = 0; i < home.cpuCores; ++i) {\n var stats = {\n atk: Player.hacking_skill / 7.5 + 30,\n def: Player.hacking_skill / 20,\n hp: Player.hacking_skill / 4,\n };\n this.playerCores.push(new Node(NodeTypes.Core, stats));\n this.playerCores[i].setControlledByPlayer();\n this.setNodePosition(this.playerCores[i], i, 0);\n this.removeAvailablePosition(i, 0);\n }\n\n // Randomly generate enemy nodes (CPU and Firewall) based on difficulty\n var numNodes = Math.min(8, Math.max(1, Math.round(this.difficulty / 4)));\n var numFirewalls = Math.min(20, getRandomInt(Math.round(this.difficulty / 3), Math.round(this.difficulty / 3) + 1));\n var numDatabases = Math.min(10, getRandomInt(1, Math.round(this.difficulty / 3) + 1));\n var totalNodes = numNodes + numFirewalls + numDatabases;\n var xlimit = 7 - Math.floor(totalNodes / 8);\n var randMult = addOffset(0.8 + this.difficulty / 5, 10);\n for (var i = 0; i < numNodes; ++i) {\n var stats = {\n atk: randMult * getRandomInt(80, 86),\n def: randMult * getRandomInt(5, 10),\n hp: randMult * getRandomInt(210, 230),\n };\n this.enemyCores.push(new Node(NodeTypes.Core, stats));\n this.enemyCores[i].setControlledByEnemy();\n this.setNodeRandomPosition(this.enemyCores[i], xlimit);\n }\n for (var i = 0; i < numFirewalls; ++i) {\n var stats = {\n atk: 0,\n def: randMult * getRandomInt(10, 20),\n hp: randMult * getRandomInt(275, 300),\n };\n this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));\n this.enemyNodes[i].setControlledByEnemy();\n this.setNodeRandomPosition(this.enemyNodes[i], xlimit);\n }\n for (var i = 0; i < numDatabases; ++i) {\n var stats = {\n atk: 0,\n def: randMult * getRandomInt(30, 55),\n hp: randMult * getRandomInt(210, 275),\n };\n var node = new Node(NodeTypes.Database, stats);\n node.setControlledByEnemy();\n this.setNodeRandomPosition(node, xlimit);\n this.enemyDatabases.push(node);\n }\n this.calculateDefenses();\n this.calculateAttacks();\n this.createMap();\n};\n\nHackingMission.prototype.createPageDom = function () {\n var container = document.getElementById(\"mission-container\");\n\n var favorMult = 1 + this.faction.favor / 100;\n var gain = this.reward * Player.faction_rep_mult * favorMult;\n var headerText = document.createElement(\"p\");\n ReactDOM.render(\n <>\n You are about to start a hacking mission! You will gain {Reputation(gain)} faction reputation with{\" \"}\n {this.faction.name} if you win. Click the 'Start' button to begin.\n ,\n headerText,\n );\n headerText.style.display = \"block\";\n headerText.classList.add(\"hack-mission-header-element\");\n headerText.style.width = \"80%\";\n\n var inGameGuideBtn = document.createElement(\"a\");\n inGameGuideBtn.innerText = \"How to Play\";\n inGameGuideBtn.classList.add(\"a-link-button\");\n inGameGuideBtn.style.display = \"inline-block\";\n inGameGuideBtn.classList.add(\"hack-mission-header-element\");\n inGameGuideBtn.addEventListener(\"click\", function () {\n dialogBoxCreate(CONSTANTS.HackingMissionHowToPlay);\n return false;\n });\n\n // Start button will get replaced with forfeit when game is started\n var startBtn = document.createElement(\"a\");\n startBtn.innerHTML = \"Start\";\n startBtn.setAttribute(\"id\", \"hack-mission-start-btn\");\n startBtn.classList.add(\"a-link-button\");\n startBtn.classList.add(\"hack-mission-header-element\");\n startBtn.style.display = \"inline-block\";\n startBtn.addEventListener(\"click\", () => {\n this.start();\n return false;\n });\n\n var forfeitMission = document.createElement(\"a\");\n forfeitMission.innerHTML = \"Forfeit Mission (Exit)\";\n forfeitMission.classList.add(\"a-link-button\");\n forfeitMission.classList.add(\"hack-mission-header-element\");\n forfeitMission.style.display = \"inline-block\";\n forfeitMission.addEventListener(\"click\", () => {\n this.finishMission(false);\n return false;\n });\n\n var timer = document.createElement(\"p\");\n timer.setAttribute(\"id\", \"hacking-mission-timer\");\n timer.style.display = \"inline-block\";\n timer.style.margin = \"6px\";\n\n // Create Action Buttons (Attack/Scan/Weaken/ etc...)\n var actionsContainer = document.createElement(\"span\");\n actionsContainer.style.display = \"block\";\n actionsContainer.classList.add(\"hack-mission-action-buttons-container\");\n for (var i = 0; i < 6; ++i) {\n this.actionButtons.push(document.createElement(\"a\"));\n this.actionButtons[i].style.display = \"inline-block\";\n this.actionButtons[i].classList.add(\"a-link-button-inactive\"); // Disabled at start\n this.actionButtons[i].classList.add(\"tooltip\"); // Disabled at start\n this.actionButtons[i].classList.add(\"hack-mission-header-element\");\n actionsContainer.appendChild(this.actionButtons[i]);\n }\n this.actionButtons[0].innerText = \"Attack(a)\";\n var atkTooltip = document.createElement(\"span\");\n atkTooltip.classList.add(\"tooltiptexthigh\");\n atkTooltip.innerText =\n \"Lowers the targeted node's HP. The effectiveness of this depends on \" +\n \"this node's Attack level, your hacking level, and the opponent's defense level.\";\n this.actionButtons[0].appendChild(atkTooltip);\n this.actionButtons[1].innerText = \"Scan(s)\";\n var scanTooltip = document.createElement(\"span\");\n scanTooltip.classList.add(\"tooltiptexthigh\");\n scanTooltip.innerText =\n \"Lowers the targeted node's defense. The effectiveness of this depends on \" +\n \"this node's Attack level, your hacking level, and the opponent's defense level.\";\n this.actionButtons[1].appendChild(scanTooltip);\n this.actionButtons[2].innerText = \"Weaken(w)\";\n var WeakenTooltip = document.createElement(\"span\");\n WeakenTooltip.classList.add(\"tooltiptexthigh\");\n WeakenTooltip.innerText =\n \"Lowers the targeted node's attack. The effectiveness of this depends on \" +\n \"this node's Attack level, your hacking level, and the opponent's defense level.\";\n this.actionButtons[2].appendChild(WeakenTooltip);\n this.actionButtons[3].innerText = \"Fortify(f)\";\n var fortifyTooltip = document.createElement(\"span\");\n fortifyTooltip.classList.add(\"tooltiptexthigh\");\n fortifyTooltip.innerText =\n \"Raises this node's Defense level. The effectiveness of this depends on \" + \"your hacking level\";\n this.actionButtons[3].appendChild(fortifyTooltip);\n this.actionButtons[4].innerText = \"Overflow(r)\";\n var overflowTooltip = document.createElement(\"span\");\n overflowTooltip.classList.add(\"tooltiptexthigh\");\n overflowTooltip.innerText =\n \"Raises this node's Attack level but lowers its Defense level. The effectiveness \" +\n \"of this depends on your hacking level.\";\n this.actionButtons[4].appendChild(overflowTooltip);\n this.actionButtons[5].innerText = \"Drop Connection(d)\";\n var dropconnTooltip = document.createElement(\"span\");\n dropconnTooltip.classList.add(\"tooltiptexthigh\");\n dropconnTooltip.innerText =\n \"Removes this Node's current connection to some target Node, if it has one. This can \" +\n \"also be done by simply clicking the white connection line.\";\n this.actionButtons[5].appendChild(dropconnTooltip);\n\n // Player/enemy defense displays will be in action container\n var playerStats = document.createElement(\"p\");\n var enemyStats = document.createElement(\"p\");\n playerStats.style.display = \"inline-block\";\n enemyStats.style.display = \"inline-block\";\n playerStats.style.color = \"#00ccff\";\n enemyStats.style.color = \"red\";\n playerStats.style.margin = \"4px\";\n enemyStats.style.margin = \"4px\";\n playerStats.setAttribute(\"id\", \"hacking-mission-player-stats\");\n enemyStats.setAttribute(\"id\", \"hacking-mission-enemy-stats\");\n actionsContainer.appendChild(playerStats);\n actionsContainer.appendChild(enemyStats);\n\n // Set Action Button event listeners\n this.actionButtons[0].addEventListener(\"click\", () => {\n if (!(this.selectedNode.length > 0)) {\n console.error(\"Pressing Action button without selected node\");\n return;\n }\n if (this.selectedNode[0].type !== NodeTypes.Core) {\n return;\n }\n this.setActionButtonsActive(this.selectedNode[0].type);\n this.setActionButton(NodeActions.Attack, false); // Set attack button inactive\n this.selectedNode.forEach(function (node) {\n node.action = NodeActions.Attack;\n });\n });\n\n this.actionButtons[1].addEventListener(\"click\", () => {\n if (!(this.selectedNode.length > 0)) {\n console.error(\"Pressing Action button without selected node\");\n return;\n }\n var nodeType = this.selectedNode[0].type; // In a multiselect, every Node will have the same type\n if (nodeType !== NodeTypes.Core && nodeType !== NodeTypes.Transfer) {\n return;\n }\n this.setActionButtonsActive(nodeType);\n this.setActionButton(NodeActions.Scan, false); // Set scan button inactive\n this.selectedNode.forEach(function (node) {\n node.action = NodeActions.Scan;\n });\n });\n\n this.actionButtons[2].addEventListener(\"click\", () => {\n if (!(this.selectedNode.length > 0)) {\n console.error(\"Pressing Action button without selected node\");\n return;\n }\n var nodeType = this.selectedNode[0].type; // In a multiselect, every Node will have the same type\n if (nodeType !== NodeTypes.Core && nodeType !== NodeTypes.Transfer) {\n return;\n }\n this.setActionButtonsActive(nodeType);\n this.setActionButton(NodeActions.Weaken, false); // Set Weaken button inactive\n this.selectedNode.forEach(function (node) {\n node.action = NodeActions.Weaken;\n });\n });\n\n this.actionButtons[3].addEventListener(\"click\", () => {\n if (!(this.selectedNode.length > 0)) {\n console.error(\"Pressing Action button without selected node\");\n return;\n }\n this.setActionButtonsActive(this.selectedNode[0].type);\n this.setActionButton(NodeActions.Fortify, false); // Set Fortify button inactive\n this.selectedNode.forEach(function (node) {\n node.action = NodeActions.Fortify;\n });\n });\n\n this.actionButtons[4].addEventListener(\"click\", () => {\n if (!(this.selectedNode.length > 0)) {\n console.error(\"Pressing Action button without selected node\");\n return;\n }\n var nodeType = this.selectedNode[0].type;\n if (nodeType !== NodeTypes.Core && nodeType !== NodeTypes.Transfer) {\n return;\n }\n this.setActionButtonsActive(nodeType);\n this.setActionButton(NodeActions.Overflow, false); // Set Overflow button inactive\n this.selectedNode.forEach(function (node) {\n node.action = NodeActions.Overflow;\n });\n });\n\n this.actionButtons[5].addEventListener(\"click\", () => {\n if (!(this.selectedNode.length > 0)) {\n console.error(\"Pressing Action button without selected node\");\n return;\n }\n this.selectedNode.forEach(function (node) {\n if (node.conn) {\n var endpoints = node.conn.endpoints;\n endpoints[0].detachFrom(endpoints[1]);\n }\n node.action = NodeActions.Fortify;\n });\n });\n\n var timeDisplay = document.createElement(\"p\");\n\n container.appendChild(headerText);\n container.appendChild(inGameGuideBtn);\n container.appendChild(startBtn);\n container.appendChild(forfeitMission);\n container.appendChild(timer);\n container.appendChild(actionsContainer);\n container.appendChild(timeDisplay);\n};\n\nHackingMission.prototype.setActionButtonsInactive = function () {\n for (var i = 0; i < this.actionButtons.length; ++i) {\n this.actionButtons[i].classList.remove(\"a-link-button\");\n this.actionButtons[i].classList.add(\"a-link-button-inactive\");\n }\n};\n\nHackingMission.prototype.setActionButtonsActive = function (nodeType = null) {\n for (var i = 0; i < this.actionButtons.length; ++i) {\n this.actionButtons[i].classList.add(\"a-link-button\");\n this.actionButtons[i].classList.remove(\"a-link-button-inactive\");\n }\n\n /**\n * For Transfer, FireWall and Shield Nodes, certain buttons should always be disabled\n * 0 = Attack, 1 = Scan, 2 = Weaken, 3 = Fortify, 4 = overflow, 5 = Drop conn\n */\n if (nodeType) {\n switch (nodeType) {\n case NodeTypes.Firewall:\n case NodeTypes.Shield:\n this.actionButtons[0].classList.remove(\"a-link-button\");\n this.actionButtons[0].classList.add(\"a-link-button-inactive\");\n this.actionButtons[1].classList.remove(\"a-link-button\");\n this.actionButtons[1].classList.add(\"a-link-button-inactive\");\n this.actionButtons[2].classList.remove(\"a-link-button\");\n this.actionButtons[2].classList.add(\"a-link-button-inactive\");\n this.actionButtons[4].classList.remove(\"a-link-button\");\n this.actionButtons[4].classList.add(\"a-link-button-inactive\");\n this.actionButtons[5].classList.remove(\"a-link-button\");\n this.actionButtons[5].classList.add(\"a-link-button-inactive\");\n break;\n case NodeTypes.Transfer:\n this.actionButtons[0].classList.remove(\"a-link-button\");\n this.actionButtons[0].classList.add(\"a-link-button-inactive\");\n break;\n default:\n break;\n }\n }\n};\n\n// True for active, false for inactive\nHackingMission.prototype.setActionButton = function (i, active = true) {\n if (isString(i)) {\n switch (i) {\n case NodeActions.Attack:\n i = 0;\n break;\n case NodeActions.Scan:\n i = 1;\n break;\n case NodeActions.Weaken:\n i = 2;\n break;\n case NodeActions.Fortify:\n i = 3;\n break;\n case NodeActions.Overflow:\n default:\n i = 4;\n break;\n }\n }\n if (active) {\n this.actionButtons[i].classList.remove(\"a-link-button-inactive\");\n this.actionButtons[i].classList.add(\"a-link-button\");\n } else {\n this.actionButtons[i].classList.remove(\"a-link-button\");\n this.actionButtons[i].classList.add(\"a-link-button-inactive\");\n }\n};\n\nHackingMission.prototype.calculateAttacks = function () {\n var total = 0;\n for (var i = 0; i < this.playerCores.length; ++i) {\n total += this.playerCores[i].atk;\n }\n for (var i = 0; i < this.playerNodes.length; ++i) {\n total += this.playerNodes[i].atk;\n }\n this.playerAtk = total;\n document.getElementById(\"hacking-mission-player-stats\").innerHTML =\n \"Player Attack: \" + formatNumber(this.playerAtk, 1) + \"
\" + \"Player Defense: \" + formatNumber(this.playerDef, 1);\n total = 0;\n for (var i = 0; i < this.enemyCores.length; ++i) {\n total += this.enemyCores[i].atk;\n }\n for (var i = 0; i < this.enemyDatabases.length; ++i) {\n total += this.enemyDatabases[i].atk;\n }\n for (var i = 0; i < this.enemyNodes.length; ++i) {\n total += this.enemyNodes[i].atk;\n }\n this.enemyAtk = total;\n document.getElementById(\"hacking-mission-enemy-stats\").innerHTML =\n \"Enemy Attack: \" + formatNumber(this.enemyAtk, 1) + \"
\" + \"Enemy Defense: \" + formatNumber(this.enemyDef, 1);\n};\n\nHackingMission.prototype.calculateDefenses = function () {\n var total = 0;\n for (var i = 0; i < this.playerCores.length; ++i) {\n total += this.playerCores[i].def;\n }\n for (var i = 0; i < this.playerNodes.length; ++i) {\n total += this.playerNodes[i].def;\n }\n this.playerDef = total;\n document.getElementById(\"hacking-mission-player-stats\").innerHTML =\n \"Player Attack: \" + formatNumber(this.playerAtk, 1) + \"
\" + \"Player Defense: \" + formatNumber(this.playerDef, 1);\n total = 0;\n for (var i = 0; i < this.enemyCores.length; ++i) {\n total += this.enemyCores[i].def;\n }\n for (var i = 0; i < this.enemyDatabases.length; ++i) {\n total += this.enemyDatabases[i].def;\n }\n for (var i = 0; i < this.enemyNodes.length; ++i) {\n total += this.enemyNodes[i].def;\n }\n this.enemyDef = total;\n document.getElementById(\"hacking-mission-enemy-stats\").innerHTML =\n \"Enemy Attack: \" + formatNumber(this.enemyAtk, 1) + \"
\" + \"Enemy Defense: \" + formatNumber(this.enemyDef, 1);\n};\n\nHackingMission.prototype.removeAvailablePosition = function (x, y) {\n for (var i = 0; i < this.availablePositions.length; ++i) {\n if (this.availablePositions[i][0] === x && this.availablePositions[i][1] === y) {\n this.availablePositions.splice(i, 1);\n return;\n }\n }\n console.warn(`removeAvailablePosition() did not remove ${x}, ${y}`);\n};\n\nHackingMission.prototype.setNodePosition = function (nodeObj, x, y) {\n if (!(nodeObj instanceof Node)) {\n console.warn(\"Non-Node object passed into setNodePOsition\");\n return;\n }\n if (isNaN(x) || isNaN(y)) {\n console.error(`Invalid values (${x}, ${y}) passed as (x, y) for setNodePosition`);\n return;\n }\n nodeObj.pos = [x, y];\n this.map[x][y] = nodeObj;\n};\n\nHackingMission.prototype.setNodeRandomPosition = function (nodeObj, xlimit = 0) {\n var i = getRandomInt(0, this.availablePositions.length - 1);\n if (this.availablePositions[i][1] < xlimit) {\n // Recurse if not within limit\n return this.setNodeRandomPosition(nodeObj, xlimit);\n }\n var pos = this.availablePositions.splice(i, 1);\n pos = pos[0];\n this.setNodePosition(nodeObj, pos[0], pos[1]);\n};\n\nHackingMission.prototype.createMap = function () {\n // Use a grid\n var map = document.createElement(\"div\");\n map.classList.add(\"hack-mission-grid\");\n map.setAttribute(\"id\", \"hacking-mission-map\");\n document.getElementById(\"mission-container\").appendChild(map);\n\n // Create random Nodes for every space in the map that\n // hasn't been filled yet. The stats of each Node will be based on\n // the player/enemy attack\n var averageAttack = (this.playerAtk + this.enemyAtk) / 2;\n for (var x = 0; x < 8; ++x) {\n for (var y = 0; y < 8; ++y) {\n if (!(this.map[x][y] instanceof Node)) {\n var node,\n type = getRandomInt(0, 2);\n var randMult = addOffset(0.85 + this.difficulty / 2, 15);\n switch (type) {\n case 0: // Spam\n var stats = {\n atk: 0,\n def: averageAttack * 1.1 + getRandomInt(15, 45),\n hp: randMult * getRandomInt(200, 225),\n };\n node = new Node(NodeTypes.Spam, stats);\n break;\n case 1: // Transfer\n var stats = {\n atk: 0,\n def: averageAttack * 1.1 + getRandomInt(15, 45),\n hp: randMult * getRandomInt(250, 275),\n };\n node = new Node(NodeTypes.Transfer, stats);\n break;\n case 2: // Shield\n default:\n var stats = {\n atk: 0,\n def: averageAttack * 1.1 + getRandomInt(30, 70),\n hp: randMult * getRandomInt(300, 320),\n };\n node = new Node(NodeTypes.Shield, stats);\n break;\n }\n this.setNodePosition(node, x, y);\n this.removeAvailablePosition(x, y);\n this.miscNodes.push(node);\n }\n }\n }\n\n // Create DOM elements in order\n for (var r = 0; r < 8; ++r) {\n for (var c = 0; c < 8; ++c) {\n this.createNodeDomElement(this.map[r][c]);\n }\n }\n\n // Configure all Player CPUS\n for (var i = 0; i < this.playerCores.length; ++i) {\n this.configurePlayerNodeElement(this.playerCores[i].el);\n }\n};\n\nHackingMission.prototype.createNodeDomElement = function (nodeObj) {\n var nodeDiv = document.createElement(\"a\"),\n txtEl = document.createElement(\"p\");\n nodeObj.el = nodeDiv;\n\n // Set the node element's id based on its coordinates\n var id = \"hacking-mission-node-\" + nodeObj.pos[0] + \"-\" + nodeObj.pos[1];\n nodeDiv.setAttribute(\"id\", id);\n txtEl.setAttribute(\"id\", id + \"-txt\");\n\n // Set node classes for owner\n nodeDiv.classList.add(\"hack-mission-node\");\n if (nodeObj.plyrCtrl) {\n nodeDiv.classList.add(\"hack-mission-player-node\");\n } else if (nodeObj.enmyCtrl) {\n nodeDiv.classList.add(\"hack-mission-enemy-node\");\n }\n\n // Set node classes based on type\n var txt;\n switch (nodeObj.type) {\n case NodeTypes.Core:\n txt = \"CPU Core
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n nodeDiv.classList.add(\"hack-mission-cpu-node\");\n break;\n case NodeTypes.Firewall:\n txt = \"Firewall
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n nodeDiv.classList.add(\"hack-mission-firewall-node\");\n break;\n case NodeTypes.Database:\n txt = \"Database
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n nodeDiv.classList.add(\"hack-mission-database-node\");\n break;\n case NodeTypes.Spam:\n txt = \"Spam
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n nodeDiv.classList.add(\"hack-mission-spam-node\");\n break;\n case NodeTypes.Transfer:\n txt = \"Transfer
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n nodeDiv.classList.add(\"hack-mission-transfer-node\");\n break;\n case NodeTypes.Shield:\n default:\n txt = \"Shield
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n nodeDiv.classList.add(\"hack-mission-shield-node\");\n break;\n }\n\n txt += \"
Atk: \" + formatNumber(nodeObj.atk, 1) + \"
Def: \" + formatNumber(nodeObj.def, 1);\n txtEl.innerHTML = txt;\n\n nodeDiv.appendChild(txtEl);\n document.getElementById(\"hacking-mission-map\").appendChild(nodeDiv);\n};\n\nHackingMission.prototype.updateNodeDomElement = function (nodeObj) {\n if (nodeObj.el == null) {\n console.error(\"Calling updateNodeDomElement on a Node without an element\");\n return;\n }\n\n let id = \"hacking-mission-node-\" + nodeObj.pos[0] + \"-\" + nodeObj.pos[1];\n let txtEl = document.getElementById(id + \"-txt\");\n\n // Set node classes based on type\n let txt;\n switch (nodeObj.type) {\n case NodeTypes.Core:\n txt = \"CPU Core
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n break;\n case NodeTypes.Firewall:\n txt = \"Firewall
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n break;\n case NodeTypes.Database:\n txt = \"Database
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n break;\n case NodeTypes.Spam:\n txt = \"Spam
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n break;\n case NodeTypes.Transfer:\n txt = \"Transfer
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n break;\n case NodeTypes.Shield:\n default:\n txt = \"Shield
\" + \"HP: \" + formatNumber(nodeObj.hp, 1);\n break;\n }\n\n txt += \"
Atk: \" + formatNumber(nodeObj.atk, 1) + \"
Def: \" + formatNumber(nodeObj.def, 1);\n if (nodeObj.action) {\n txt += \"
\" + nodeObj.action;\n }\n txtEl.innerHTML = txt;\n};\n\n/**\n * Gets a Node DOM elements corresponding Node object using its\n * element id. Function accepts either the DOM element object or the ID as\n * an argument\n */\nHackingMission.prototype.getNodeFromElement = function (el) {\n var id;\n if (isString(el)) {\n id = el;\n } else {\n id = el.id;\n }\n id = id.replace(\"hacking-mission-node-\", \"\");\n var res = id.split(\"-\");\n if (res.length != 2) {\n console.error(\"Parsing hacking mission node id. could not find coordinates\");\n return null;\n }\n var x = res[0],\n y = res[1];\n if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) {\n console.error(`Unexpected values (${x}, ${y}) for (x, y)`);\n return null;\n }\n return this.map[x][y];\n};\n\nfunction selectNode(hackMissionInst, el) {\n var nodeObj = hackMissionInst.getNodeFromElement(el);\n if (nodeObj == null) {\n console.error(\"Failed getting Node object\");\n }\n if (!nodeObj.plyrCtrl) {\n return;\n }\n\n clearAllSelectedNodes(hackMissionInst);\n nodeObj.select(hackMissionInst.actionButtons);\n hackMissionInst.selectedNode.push(nodeObj);\n}\n\nfunction multiselectNode(hackMissionInst, el) {\n var nodeObj = hackMissionInst.getNodeFromElement(el);\n if (nodeObj == null) {\n console.error(\"Failed getting Node Object in multiselectNode()\");\n }\n if (!nodeObj.plyrCtrl) {\n return;\n }\n\n clearAllSelectedNodes(hackMissionInst);\n var type = nodeObj.type;\n if (type === NodeTypes.Core) {\n hackMissionInst.playerCores.forEach(function (node) {\n node.select(hackMissionInst.actionButtons);\n hackMissionInst.selectedNode.push(node);\n });\n } else {\n hackMissionInst.playerNodes.forEach(function (node) {\n if (node.type === type) {\n node.select(hackMissionInst.actionButtons);\n hackMissionInst.selectedNode.push(node);\n }\n });\n }\n}\n\nfunction clearAllSelectedNodes(hackMissionInst) {\n if (hackMissionInst.selectedNode.length > 0) {\n hackMissionInst.selectedNode.forEach(function (node) {\n node.deselect(hackMissionInst.actionButtons);\n });\n hackMissionInst.selectedNode.length = 0;\n }\n}\n\n/**\n * Configures a DOM element representing a player-owned node to\n * be selectable and actionable.\n * Note: Does NOT change its css class. This is handled by Node.setControlledBy...\n */\nHackingMission.prototype.configurePlayerNodeElement = function (el) {\n var nodeObj = this.getNodeFromElement(el);\n if (nodeObj == null) {\n console.error(\"Failed getting Node object\");\n }\n\n // Add event listener\n const selectNodeWrapper = () => {\n selectNode(this, el);\n };\n el.addEventListener(\"click\", selectNodeWrapper);\n\n const multiselectNodeWrapper = () => {\n multiselectNode(this, el);\n };\n el.addEventListener(\"dblclick\", multiselectNodeWrapper);\n\n if (el.firstChild) {\n el.firstChild.addEventListener(\"click\", selectNodeWrapper);\n }\n};\n\n/**\n * Configures a DOM element representing an enemy-node by removing\n * any event listeners\n */\nHackingMission.prototype.configureEnemyNodeElement = function (el) {\n // Deselect node if it was the selected node\n var nodeObj = this.getNodeFromElement(el);\n for (var i = 0; i < this.selectedNode.length; ++i) {\n if (this.selectedNode[i] == nodeObj) {\n nodeObj.deselect(this.actionButtons);\n this.selectedNode.splice(i, 1);\n break;\n }\n }\n};\n\n/**\n * Returns bool indicating whether a node is reachable by player\n * by checking if any of the adjacent nodes are owned by the player\n */\nHackingMission.prototype.nodeReachable = function (node) {\n var x = node.pos[0],\n y = node.pos[1];\n if (x > 0 && this.map[x - 1][y].plyrCtrl) {\n return true;\n }\n if (x < 7 && this.map[x + 1][y].plyrCtrl) {\n return true;\n }\n if (y > 0 && this.map[x][y - 1].plyrCtrl) {\n return true;\n }\n if (y < 7 && this.map[x][y + 1].plyrCtrl) {\n return true;\n }\n return false;\n};\n\nHackingMission.prototype.nodeReachableByEnemy = function (node) {\n if (node == null) {\n return false;\n }\n var x = node.pos[0],\n y = node.pos[1];\n if (x > 0 && this.map[x - 1][y].enmyCtrl) {\n return true;\n }\n if (x < 7 && this.map[x + 1][y].enmyCtrl) {\n return true;\n }\n if (y > 0 && this.map[x][y - 1].enmyCtrl) {\n return true;\n }\n if (y < 7 && this.map[x][y + 1].enmyCtrl) {\n return true;\n }\n return false;\n};\n\nHackingMission.prototype.start = function () {\n this.started = true;\n this.initJsPlumb();\n var startBtn = clearEventListeners(\"hack-mission-start-btn\");\n startBtn.classList.remove(\"a-link-button\");\n startBtn.classList.add(\"a-link-button-inactive\");\n};\n\nHackingMission.prototype.initJsPlumb = function () {\n var instance = jsPlumb.getInstance({\n DragOptions: { cursor: \"pointer\", zIndex: 2000 },\n PaintStyle: {\n gradient: {\n stops: [\n [0, \"#FFFFFF\"],\n [1, \"#FFFFFF\"],\n ],\n },\n stroke: \"#FFFFFF\",\n strokeWidth: 8,\n },\n });\n\n this.jsplumbinstance = instance;\n\n // All player cores are sources\n for (var i = 0; i < this.playerCores.length; ++i) {\n instance.makeSource(this.playerCores[i].el, {\n deleteEndpointsOnEmpty: true,\n maxConnections: 1,\n anchor: \"Continuous\",\n connector: \"Flowchart\",\n });\n }\n\n // Everything else is a target\n for (var i = 0; i < this.enemyCores.length; ++i) {\n instance.makeTarget(this.enemyCores[i].el, {\n maxConnections: -1,\n anchor: \"Continuous\",\n connector: \"Flowchart\",\n });\n }\n for (var i = 0; i < this.enemyDatabases.length; ++i) {\n instance.makeTarget(this.enemyDatabases[i].el, {\n maxConnections: -1,\n anchor: \"Continuous\",\n connector: [\"Flowchart\"],\n });\n }\n for (var i = 0; i < this.enemyNodes.length; ++i) {\n instance.makeTarget(this.enemyNodes[i].el, {\n maxConnections: -1,\n anchor: \"Continuous\",\n connector: \"Flowchart\",\n });\n }\n for (var i = 0; i < this.miscNodes.length; ++i) {\n instance.makeTarget(this.miscNodes[i].el, {\n maxConnections: -1,\n anchor: \"Continuous\",\n connector: \"Flowchart\",\n });\n }\n\n // Clicking a connection drops it\n instance.bind(\"click\", (conn) => {\n // Cannot drop enemy's connections\n const sourceNode = this.getNodeFromElement(conn.source);\n if (sourceNode.enmyCtrl) {\n return;\n }\n\n var endpoints = conn.endpoints;\n endpoints[0].detachFrom(endpoints[1]);\n });\n\n // Connection events\n instance.bind(\"connection\", (info) => {\n var targetNode = this.getNodeFromElement(info.target);\n\n // Do not detach for enemy nodes\n var thisNode = this.getNodeFromElement(info.source);\n if (thisNode.enmyCtrl) {\n return;\n }\n\n // If the node is not reachable, drop the connection\n if (!this.nodeReachable(targetNode)) {\n info.sourceEndpoint.detachFrom(info.targetEndpoint);\n return;\n }\n\n var sourceNode = this.getNodeFromElement(info.source);\n sourceNode.conn = info.connection;\n var targetNode = this.getNodeFromElement(info.target);\n ++targetNode.targetedCount;\n });\n\n // Detach Connection events\n instance.bind(\"connectionDetached\", (info) => {\n var sourceNode = this.getNodeFromElement(info.source);\n sourceNode.conn = null;\n var targetNode = this.getNodeFromElement(info.target);\n targetNode.untarget();\n });\n};\n\n// Drops all connections where the specified node is the source\nHackingMission.prototype.dropAllConnectionsFromNode = function (node) {\n var allConns = this.jsplumbinstance.getAllConnections();\n for (var i = allConns.length - 1; i >= 0; --i) {\n if (allConns[i].source == node.el) {\n allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);\n }\n }\n};\n\n// Drops all connections where the specified node is the target\nHackingMission.prototype.dropAllConnectionsToNode = function (node) {\n var allConns = this.jsplumbinstance.getAllConnections();\n for (var i = allConns.length - 1; i >= 0; --i) {\n if (allConns[i].target == node.el) {\n allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);\n }\n }\n node.beingTargeted = false;\n};\n\nvar storedCycles = 0;\nHackingMission.prototype.process = function (numCycles = 1) {\n if (!this.started) {\n return;\n }\n storedCycles += numCycles;\n if (storedCycles < 2) {\n return;\n } // Only process every 3 cycles minimum\n\n var res = false;\n // Process actions of all player nodes\n this.playerCores.forEach((node) => {\n res |= this.processNode(node, storedCycles);\n });\n\n this.playerNodes.forEach((node) => {\n if (node.type === NodeTypes.Transfer || node.type === NodeTypes.Shield || node.type === NodeTypes.Firewall) {\n res |= this.processNode(node, storedCycles);\n }\n });\n\n // Process actions of all enemy nodes\n this.enemyCores.forEach((node) => {\n this.enemyAISelectAction(node);\n res |= this.processNode(node, storedCycles);\n });\n\n this.enemyNodes.forEach((node) => {\n if (node.type === NodeTypes.Transfer || node.type === NodeTypes.Shield || node.type === NodeTypes.Firewall) {\n this.enemyAISelectAction(node);\n res |= this.processNode(node, storedCycles);\n }\n });\n\n // The hp of enemy databases increases slowly\n this.enemyDatabases.forEach((node) => {\n node.maxhp += 0.1 * storedCycles;\n node.hp += 0.1 * storedCycles;\n });\n\n if (res) {\n this.calculateAttacks();\n this.calculateDefenses();\n }\n\n // Win if all enemy databases are conquered\n if (this.enemyDatabases.length === 0) {\n this.finishMission(true);\n return;\n }\n\n // Lose if all your cores are gone\n if (this.playerCores.length === 0) {\n this.finishMission(false);\n return;\n }\n\n // Defense/hp of misc nodes increases slowly over time\n this.miscNodes.forEach((node) => {\n node.def += 0.1 * storedCycles;\n node.maxhp += 0.05 * storedCycles;\n node.hp += 0.1 * storedCycles;\n if (node.hp > node.maxhp) {\n node.hp = node.maxhp;\n }\n this.updateNodeDomElement(node);\n });\n\n // Update timer and check if player lost\n this.time -= storedCycles * CONSTANTS._idleSpeed;\n if (this.time <= 0) {\n this.finishMission(false);\n return;\n }\n this.updateTimer();\n\n storedCycles = 0;\n};\n\n// Returns a bool representing whether defenses need to be re-calculated\nHackingMission.prototype.processNode = function (nodeObj, numCycles = 1) {\n if (nodeObj.action == null) {\n return;\n }\n\n var targetNode = null,\n def,\n atk;\n if (nodeObj.conn) {\n if (nodeObj.conn.target != null) {\n targetNode = this.getNodeFromElement(nodeObj.conn.target);\n } else {\n targetNode = this.getNodeFromElement(nodeObj.conn.targetId);\n }\n\n if (targetNode == null) {\n // Player is in the middle of dragging the connection,\n // so the target node is null. Do nothing here\n } else if (targetNode.plyrCtrl) {\n def = this.playerDef;\n atk = this.enemyAtk;\n } else if (targetNode.enmyCtrl) {\n def = this.enemyDef;\n atk = this.playerAtk;\n } else {\n // Misc Node\n def = targetNode.def;\n nodeObj.plyrCtrl ? (atk = this.playerAtk) : (atk = this.enemyAtk);\n }\n }\n\n // Calculations are per second, so divide everything by 5\n var calcStats = false,\n plyr = nodeObj.plyrCtrl;\n var enmyHacking = this.difficulty * CONSTANTS.HackingMissionDifficultyToHacking;\n switch (nodeObj.action) {\n case NodeActions.Attack:\n if (targetNode == null) {\n break;\n }\n if (nodeObj.conn == null) {\n break;\n }\n var dmg = this.calculateAttackDamage(atk, def, plyr ? Player.hacking_skill : enmyHacking);\n targetNode.hp -= (dmg / 5) * numCycles;\n break;\n case NodeActions.Scan:\n if (targetNode == null) {\n break;\n }\n if (nodeObj.conn == null) {\n break;\n }\n var eff = this.calculateScanEffect(atk, def, plyr ? Player.hacking_skill : enmyHacking);\n targetNode.def -= (eff / 5) * numCycles;\n calcStats = true;\n break;\n case NodeActions.Weaken:\n if (targetNode == null) {\n break;\n }\n if (nodeObj.conn == null) {\n break;\n }\n var eff = this.calculateWeakenEffect(atk, def, plyr ? Player.hacking_skill : enmyHacking);\n targetNode.atk -= (eff / 5) * numCycles;\n calcStats = true;\n break;\n case NodeActions.Fortify:\n var eff = this.calculateFortifyEffect(Player.hacking_skill);\n nodeObj.def += (eff / 5) * numCycles;\n calcStats = true;\n break;\n case NodeActions.Overflow:\n var eff = this.calculateOverflowEffect(Player.hacking_skill);\n if (nodeObj.def < eff) {\n break;\n }\n nodeObj.def -= (eff / 5) * numCycles;\n nodeObj.atk += (eff / 5) * numCycles;\n calcStats = true;\n break;\n default:\n console.error(`Invalid Node Action: ${nodeObj.action}`);\n break;\n }\n\n // Stats can't go below 0\n if (nodeObj.atk < 0) {\n nodeObj.atk = 0;\n }\n if (nodeObj.def < 0) {\n nodeObj.def = 0;\n }\n if (targetNode && targetNode.atk < 0) {\n targetNode.atk = 0;\n }\n if (targetNode && targetNode.def < 0) {\n targetNode.def = 0;\n }\n\n // Conquering a node\n if (targetNode && targetNode.hp <= 0) {\n var conqueredByPlayer = nodeObj.plyrCtrl;\n targetNode.hp = targetNode.maxhp;\n targetNode.action = null;\n targetNode.conn = null;\n if (this.selectedNode == targetNode) {\n targetNode.deselect(this.actionButtons);\n }\n\n // The conquered node has its stats reduced\n targetNode.atk /= 2;\n targetNode.def /= 3.5;\n\n // Flag for whether the target node was a misc node\n var isMiscNode = !targetNode.plyrCtrl && !targetNode.enmyCtrl;\n\n // Remove all connections from Node\n this.dropAllConnectionsToNode(targetNode);\n this.dropAllConnectionsFromNode(targetNode);\n\n // Changes the css class and turn the node into a JsPlumb Source/Target\n if (conqueredByPlayer) {\n targetNode.setControlledByPlayer();\n this.jsplumbinstance.unmakeTarget(targetNode.el);\n this.jsplumbinstance.makeSource(targetNode.el, {\n deleteEndpointsOnEmpty: true,\n maxConnections: 1,\n anchor: \"Continuous\",\n connector: \"Flowchart\",\n });\n } else {\n targetNode.setControlledByEnemy();\n nodeObj.conn = null; // Clear connection\n this.jsplumbinstance.unmakeSource(targetNode.el);\n this.jsplumbinstance.makeTarget(targetNode.el, {\n maxConnections: -1,\n anchor: \"Continuous\",\n connector: [\"Flowchart\"],\n });\n }\n\n calcStats = true;\n\n // Helper function to swap nodes between the respective enemyNodes/playerNodes arrays\n function swapNodes(orig, dest, targetNode) {\n for (var i = 0; i < orig.length; ++i) {\n if (orig[i] == targetNode) {\n var node = orig.splice(i, 1);\n node = node[0];\n dest.push(node);\n break;\n }\n }\n }\n\n switch (targetNode.type) {\n case NodeTypes.Core:\n if (conqueredByPlayer) {\n swapNodes(this.enemyCores, this.playerCores, targetNode);\n this.configurePlayerNodeElement(targetNode.el);\n } else {\n swapNodes(this.playerCores, this.enemyCores, targetNode);\n this.configureEnemyNodeElement(targetNode.el);\n }\n break;\n case NodeTypes.Firewall:\n if (conqueredByPlayer) {\n swapNodes(this.enemyNodes, this.playerNodes, targetNode);\n } else {\n swapNodes(this.playerNodes, this.enemyNodes, targetNode);\n this.configureEnemyNodeElement(targetNode.el);\n }\n break;\n case NodeTypes.Database:\n if (conqueredByPlayer) {\n swapNodes(this.enemyDatabases, this.playerNodes, targetNode);\n } else {\n swapNodes(this.playerNodes, this.enemyDatabases, targetNode);\n }\n break;\n case NodeTypes.Spam:\n if (conqueredByPlayer) {\n swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);\n // Conquering spam node increases time limit\n this.time += CONSTANTS.HackingMissionSpamTimeIncrease;\n } else {\n swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);\n }\n\n break;\n case NodeTypes.Transfer:\n // Conquering a Transfer node increases the attack of all cores by some percentages\n if (conqueredByPlayer) {\n swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);\n this.playerCores.forEach(function (node) {\n node.atk *= CONSTANTS.HackingMissionTransferAttackIncrease;\n });\n this.configurePlayerNodeElement(targetNode.el);\n } else {\n swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);\n this.enemyCores.forEach(function (node) {\n node.atk *= CONSTANTS.HackingMissionTransferAttackIncrease;\n });\n this.configureEnemyNodeElement(targetNode.el);\n }\n break;\n case NodeTypes.Shield:\n if (conqueredByPlayer) {\n swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);\n this.configurePlayerNodeElement(targetNode.el);\n } else {\n swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);\n this.configureEnemyNodeElement(targetNode.el);\n }\n break;\n }\n\n // If a misc node was conquered, the defense for all misc nodes increases by some fixed amount\n if (isMiscNode) {\n //&& conqueredByPlayer) {\n this.miscNodes.forEach((node) => {\n if (node.targetedCount === 0) {\n node.def *= CONSTANTS.HackingMissionMiscDefenseIncrease;\n }\n });\n }\n }\n\n // Update node DOMs\n this.updateNodeDomElement(nodeObj);\n if (targetNode) {\n this.updateNodeDomElement(targetNode);\n }\n return calcStats;\n};\n\n// Enemy \"AI\" for CPU Core and Transfer Nodes\nHackingMission.prototype.enemyAISelectAction = function (nodeObj) {\n if (nodeObj == null) {\n return;\n }\n switch (nodeObj.type) {\n case NodeTypes.Core:\n /**\n * Select a single RANDOM target from miscNodes and player's Nodes\n * If it is reachable, it will target it. If not, no target will\n * be selected for now, and the next time process() gets called this will repeat\n */\n if (nodeObj.conn == null) {\n if (this.miscNodes.length === 0) {\n // Randomly pick a player node and attack it if its reachable\n var rand = getRandomInt(0, this.playerNodes.length - 1);\n var node;\n if (this.playerNodes.length === 0) {\n node = null;\n } else {\n node = this.playerNodes[rand];\n }\n if (this.nodeReachableByEnemy(node)) {\n // Create connection\n nodeObj.conn = this.jsplumbinstance.connect({\n source: nodeObj.el,\n target: node.el,\n });\n ++node.targetedCount;\n } else {\n // Randomly pick a player core and attack it if its reachable\n rand = getRandomInt(0, this.playerCores.length - 1);\n if (this.playerCores.length === 0) {\n return; // No Misc Nodes, no player Nodes, no Player cores. Player lost\n } else {\n node = this.playerCores[rand];\n }\n\n if (this.nodeReachableByEnemy(node)) {\n // Create connection\n nodeObj.conn = this.jsplumbinstance.connect({\n source: nodeObj.el,\n target: node.el,\n });\n ++node.targetedCount;\n }\n }\n } else {\n // Randomly pick a misc node and attack it if its reachable\n var rand = getRandomInt(0, this.miscNodes.length - 1);\n var node = this.miscNodes[rand];\n if (this.nodeReachableByEnemy(node)) {\n nodeObj.conn = this.jsplumbinstance.connect({\n source: nodeObj.el,\n target: node.el,\n });\n ++node.targetedCount;\n }\n }\n\n // If no connection was made, set the Core to Fortify\n nodeObj.action = NodeActions.Fortify;\n } else {\n // If this node has a selected target\n var targetNode;\n if (nodeObj.conn.target) {\n targetNode = this.getNodeFromElement(nodeObj.conn.target);\n } else {\n targetNode = this.getNodeFromElement(nodeObj.conn.targetId);\n }\n if (targetNode == null) {\n console.error(\"Error getting Target node Object in enemyAISelectAction()\");\n }\n\n if (targetNode.def > this.enemyAtk + 15) {\n if (nodeObj.def < 50) {\n nodeObj.action = NodeActions.Fortify;\n } else {\n nodeObj.action = NodeActions.Overflow;\n }\n } else if (Math.abs(targetNode.def - this.enemyAtk) <= 15) {\n nodeObj.action = NodeActions.Scan;\n } else {\n nodeObj.action = NodeActions.Attack;\n }\n }\n break;\n case NodeTypes.Transfer:\n // Switch between fortifying and overflowing as necessary\n if (nodeObj.def < 125) {\n nodeObj.action = NodeActions.Fortify;\n } else {\n nodeObj.action = NodeActions.Overflow;\n }\n break;\n case NodeTypes.Firewall:\n case NodeTypes.Shield:\n nodeObj.action = NodeActions.Fortify;\n break;\n default:\n break;\n }\n};\n\nvar hackEffWeightSelf = 130; // Weight for Node actions on self\nvar hackEffWeightTarget = 25; // Weight for Node Actions against Target\nvar hackEffWeightAttack = 80; // Weight for Attack action\n\n// Returns damage per cycle based on stats\nHackingMission.prototype.calculateAttackDamage = function (atk, def, hacking = 0) {\n return Math.max(0.55 * (atk + hacking / hackEffWeightAttack - def), 1);\n};\n\nHackingMission.prototype.calculateScanEffect = function (atk, def, hacking = 0) {\n return Math.max(0.6 * (atk + hacking / hackEffWeightTarget - def * 0.95), 2);\n};\n\nHackingMission.prototype.calculateWeakenEffect = function (atk, def, hacking = 0) {\n return Math.max(atk + hacking / hackEffWeightTarget - def * 0.95, 2);\n};\n\nHackingMission.prototype.calculateFortifyEffect = function (hacking = 0) {\n return (0.9 * hacking) / hackEffWeightSelf;\n};\n\nHackingMission.prototype.calculateOverflowEffect = function (hacking = 0) {\n return (0.95 * hacking) / hackEffWeightSelf;\n};\n\n// Updates timer display\nHackingMission.prototype.updateTimer = function () {\n var timer = document.getElementById(\"hacking-mission-timer\");\n\n // Convert time remaining to a string of the form mm:ss\n var seconds = Math.round(this.time / 1000);\n var minutes = Math.trunc(seconds / 60);\n seconds %= 60;\n var str = (\"0\" + minutes).slice(-2) + \":\" + (\"0\" + seconds).slice(-2);\n timer.innerText = \"Time left: \" + str;\n};\n\n// The 'win' argument is a bool for whether or not the player won\nHackingMission.prototype.finishMission = function (win) {\n inMission = false;\n currMission = null;\n\n if (win) {\n var favorMult = 1 + this.faction.favor / 100;\n var gain = this.reward * Player.faction_rep_mult * favorMult;\n dialogBoxCreate(\n <>\n Mission won! You earned {Reputation(gain)} reputation with {this.faction.name}\n ,\n );\n Player.gainIntelligenceExp(Math.pow(this.difficulty * CONSTANTS.IntelligenceHackingMissionBaseExpGain, 0.5));\n this.faction.playerReputation += gain;\n } else {\n dialogBoxCreate(\"Mission lost/forfeited! You did not gain any faction reputation.\");\n }\n Router.toFaction();\n};\n\nexport { HackingMission, inMission, setInMission, currMission };\n","export interface IMults {\n hack?: number;\n str?: number;\n def?: number;\n dex?: number;\n agi?: number;\n cha?: number;\n}\n\nexport enum UpgradeType {\n Weapon = \"w\",\n Armor = \"a\",\n Vehicle = \"v\",\n Rootkit = \"r\",\n Augmentation = \"g\",\n}\n\n/**\n * Defines the parameters that can be used to initialize and describe a GangMemberUpgrade\n * (defined in Gang.js)\n */\nexport interface IGangMemberUpgradeMetadata {\n cost: number;\n mults: IMults;\n name: string;\n upgType: UpgradeType;\n}\n\n/**\n * Array of metadata for all Gang Member upgrades. Used to construct the global GangMemberUpgrade\n * objects in Gang.js\n */\nexport const gangMemberUpgradesMetadata: IGangMemberUpgradeMetadata[] = [\n {\n cost: 1e6,\n mults: { str: 1.04, def: 1.04 },\n name: \"Baseball Bat\",\n upgType: UpgradeType.Weapon,\n },\n {\n cost: 12e6,\n mults: { str: 1.08, def: 1.08, dex: 1.08 },\n name: \"Katana\",\n upgType: UpgradeType.Weapon,\n },\n {\n cost: 25e6,\n mults: { str: 1.1, def: 1.1, dex: 1.1, agi: 1.1 },\n name: \"Glock 18C\",\n upgType: UpgradeType.Weapon,\n },\n {\n cost: 50e6,\n mults: { str: 1.12, def: 1.1, agi: 1.1 },\n name: \"P90C\",\n upgType: UpgradeType.Weapon,\n },\n {\n cost: 60e6,\n mults: { str: 1.2, def: 1.15 },\n name: \"Steyr AUG\",\n upgType: UpgradeType.Weapon,\n },\n {\n cost: 100e6,\n mults: { str: 1.25, def: 1.2 },\n name: \"AK-47\",\n upgType: UpgradeType.Weapon,\n },\n {\n cost: 150e6,\n mults: { str: 1.3, def: 1.25 },\n name: \"M15A10 Assault Rifle\",\n upgType: UpgradeType.Weapon,\n },\n {\n cost: 225e6,\n mults: { str: 1.3, dex: 1.25, agi: 1.3 },\n name: \"AWM Sniper Rifle\",\n upgType: UpgradeType.Weapon,\n },\n {\n cost: 2e6,\n mults: { def: 1.04 },\n name: \"Bulletproof Vest\",\n upgType: UpgradeType.Armor,\n },\n {\n cost: 5e6,\n mults: { def: 1.08 },\n name: \"Full Body Armor\",\n upgType: UpgradeType.Armor,\n },\n {\n cost: 25e6,\n mults: { def: 1.15, agi: 1.15 },\n name: \"Liquid Body Armor\",\n upgType: UpgradeType.Armor,\n },\n {\n cost: 40e6,\n mults: { def: 1.2 },\n name: \"Graphene Plating Armor\",\n upgType: UpgradeType.Armor,\n },\n {\n cost: 3e6,\n mults: { agi: 1.04, cha: 1.04 },\n name: \"Ford Flex V20\",\n upgType: UpgradeType.Vehicle,\n },\n {\n cost: 9e6,\n mults: { agi: 1.08, cha: 1.08 },\n name: \"ATX1070 Superbike\",\n upgType: UpgradeType.Vehicle,\n },\n {\n cost: 18e6,\n mults: { agi: 1.12, cha: 1.12 },\n name: \"Mercedes-Benz S9001\",\n upgType: UpgradeType.Vehicle,\n },\n {\n cost: 30e6,\n mults: { agi: 1.16, cha: 1.16 },\n name: \"White Ferrari\",\n upgType: UpgradeType.Vehicle,\n },\n {\n cost: 5e6,\n mults: { hack: 1.05 },\n name: \"NUKE Rootkit\",\n upgType: UpgradeType.Rootkit,\n },\n {\n cost: 25e6,\n mults: { hack: 1.1 },\n name: \"Soulstealer Rootkit\",\n upgType: UpgradeType.Rootkit,\n },\n {\n cost: 75e6,\n mults: { hack: 1.15 },\n name: \"Demon Rootkit\",\n upgType: UpgradeType.Rootkit,\n },\n {\n cost: 40e6,\n mults: { hack: 1.12 },\n name: \"Hmap Node\",\n upgType: UpgradeType.Rootkit,\n },\n {\n cost: 75e6,\n mults: { hack: 1.15 },\n name: \"Jack the Ripper\",\n upgType: UpgradeType.Rootkit,\n },\n {\n cost: 10e9,\n mults: { str: 1.3, dex: 1.3 },\n name: \"Bionic Arms\",\n upgType: UpgradeType.Augmentation,\n },\n {\n cost: 10e9,\n mults: { agi: 1.6 },\n name: \"Bionic Legs\",\n upgType: UpgradeType.Augmentation,\n },\n {\n cost: 15e9,\n mults: { str: 1.15, def: 1.15, dex: 1.15, agi: 1.15 },\n name: \"Bionic Spine\",\n upgType: UpgradeType.Augmentation,\n },\n {\n cost: 20e9,\n mults: { str: 1.4, def: 1.4 },\n name: \"BrachiBlades\",\n upgType: UpgradeType.Augmentation,\n },\n {\n cost: 12e9,\n mults: { str: 1.2, def: 1.2 },\n name: \"Nanofiber Weave\",\n upgType: UpgradeType.Augmentation,\n },\n {\n cost: 25e9,\n mults: { str: 1.5, agi: 1.5 },\n name: \"Synthetic Heart\",\n upgType: UpgradeType.Augmentation,\n },\n {\n cost: 15e9,\n mults: { str: 1.3, def: 1.3 },\n name: \"Synfibril Muscle\",\n upgType: UpgradeType.Augmentation,\n },\n {\n cost: 5e9,\n mults: { hack: 1.05 },\n name: \"BitWire\",\n upgType: UpgradeType.Augmentation,\n },\n {\n cost: 10e9,\n mults: { hack: 1.15 },\n name: \"Neuralstimulator\",\n upgType: UpgradeType.Augmentation,\n },\n {\n cost: 7.5e9,\n mults: { hack: 1.1 },\n name: \"DataJack\",\n upgType: UpgradeType.Augmentation,\n },\n {\n cost: 50e9,\n mults: { str: 1.7, def: 1.7 },\n name: \"Graphene Bone Lacings\",\n upgType: UpgradeType.Augmentation,\n },\n];\n","import React from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { Money } from \"../../ui/React/Money\";\n\nexport function MoneyRate({ money }: { money: number }): JSX.Element {\n return ;\n}\n","export enum FactionWorkType {\n Field,\n Hacking,\n None,\n Security,\n}\n","/**\n * Functions for handling WorkerScripts, which are the underlying mechanism\n * that allows for scripts to run\n */\nimport { killWorkerScript } from \"./Netscript/killWorkerScript\";\nimport { WorkerScript } from \"./Netscript/WorkerScript\";\nimport { workerScripts } from \"./Netscript/WorkerScripts\";\nimport { WorkerScriptStartStopEventEmitter } from \"./Netscript/WorkerScriptStartStopEventEmitter\";\nimport { generateNextPid } from \"./Netscript/Pid\";\n\nimport { CONSTANTS } from \"./Constants\";\nimport { Interpreter } from \"./JSInterpreter\";\nimport { isScriptErrorMessage, makeRuntimeRejectMsg } from \"./NetscriptEvaluator\";\nimport { NetscriptFunctions } from \"./NetscriptFunctions\";\nimport { executeJSScript } from \"./NetscriptJSEvaluator\";\nimport { NetscriptPort } from \"./NetscriptPort\";\nimport { Player } from \"./Player\";\nimport { RunningScript } from \"./Script/RunningScript\";\nimport { getRamUsageFromRunningScript } from \"./Script/RunningScriptHelpers\";\nimport { scriptCalculateOfflineProduction } from \"./Script/ScriptHelpers\";\nimport { AllServers } from \"./Server/AllServers\";\nimport { Settings } from \"./Settings/Settings\";\nimport { setTimeoutRef } from \"./utils/SetTimeoutRef\";\n\nimport { generate } from \"escodegen\";\n\nimport { dialogBoxCreate } from \"../utils/DialogBox\";\nimport { arrayToString } from \"../utils/helpers/arrayToString\";\nimport { roundToTwo } from \"../utils/helpers/roundToTwo\";\nimport { isString } from \"../utils/helpers/isString\";\n\nimport { parse } from \"acorn\";\nimport { simple as walksimple } from \"acorn-walk\";\n\n// Netscript Ports are instantiated here\nexport const NetscriptPorts = [];\nfor (var i = 0; i < CONSTANTS.NumNetscriptPorts; ++i) {\n NetscriptPorts.push(NetscriptPort());\n}\n\nexport function prestigeWorkerScripts() {\n for (const ws of workerScripts.values()) {\n ws.env.stopFlag = true;\n killWorkerScript(ws);\n }\n\n WorkerScriptStartStopEventEmitter.emit();\n workerScripts.clear();\n}\n\n// JS script promises need a little massaging to have the same guarantees as netscript\n// promises. This does said massaging and kicks the script off. It returns a promise\n// that resolves or rejects when the corresponding worker script is done.\nfunction startNetscript2Script(workerScript) {\n workerScript.running = true;\n\n // The name of the currently running netscript function, to prevent concurrent\n // calls to hack, grow, etc.\n let runningFn = null;\n\n // We need to go through the environment and wrap each function in such a way that it\n // can be called at most once at a time. This will prevent situations where multiple\n // hack promises are outstanding, for example.\n function wrap(propName, f) {\n // This function unfortunately cannot be an async function, because we don't\n // know if the original one was, and there's no way to tell.\n return function (...args) {\n // Wrap every netscript function with a check for the stop flag.\n // This prevents cases where we never stop because we are only calling\n // netscript functions that don't check this.\n // This is not a problem for legacy Netscript because it also checks the\n // stop flag in the evaluator.\n if (workerScript.env.stopFlag) {\n throw workerScript;\n }\n\n if (propName === \"sleep\") return f(...args); // OK for multiple simultaneous calls to sleep.\n\n const msg =\n \"Concurrent calls to Netscript functions not allowed! \" +\n \"Did you forget to await hack(), grow(), or some other \" +\n \"promise-returning function? (Currently running: %s tried to run: %s)\";\n if (runningFn) {\n workerScript.errorMessage = makeRuntimeRejectMsg(workerScript, sprintf(msg, runningFn, propName), null);\n throw workerScript;\n }\n runningFn = propName;\n\n // If the function throws an error, clear the runningFn flag first, and then re-throw it\n // This allows people to properly catch errors thrown by NS functions without getting\n // the concurrent call error above\n let result;\n try {\n result = f(...args);\n } catch (e) {\n runningFn = null;\n throw e;\n }\n\n if (result && result.finally !== undefined) {\n return result.finally(function () {\n runningFn = null;\n });\n } else {\n runningFn = null;\n return result;\n }\n };\n }\n\n for (let prop in workerScript.env.vars) {\n if (typeof workerScript.env.vars[prop] !== \"function\") continue;\n workerScript.env.vars[prop] = wrap(prop, workerScript.env.vars[prop]);\n }\n\n // Note: the environment that we pass to the JS script only needs to contain the functions visible\n // to that script, which env.vars does at this point.\n return executeJSScript(workerScript.getServer().scripts, workerScript)\n .then(function (mainReturnValue) {\n if (mainReturnValue === undefined) return workerScript;\n return [mainReturnValue, workerScript];\n })\n .catch((e) => {\n if (e instanceof Error) {\n workerScript.errorMessage = makeRuntimeRejectMsg(\n workerScript,\n e.message + ((e.stack && \"\\nstack:\\n\" + e.stack.toString()) || \"\"),\n );\n throw workerScript;\n } else if (isScriptErrorMessage(e)) {\n workerScript.errorMessage = e;\n throw workerScript;\n }\n throw e; // Don't know what to do with it, let's rethrow.\n });\n}\n\nfunction startNetscript1Script(workerScript) {\n const code = workerScript.code;\n workerScript.running = true;\n\n //Process imports\n var codeWithImports, codeLineOffset;\n try {\n let importProcessingRes = processNetscript1Imports(code, workerScript);\n codeWithImports = importProcessingRes.code;\n codeLineOffset = importProcessingRes.lineOffset;\n } catch (e) {\n dialogBoxCreate(\"Error processing Imports in \" + workerScript.name + \":
\" + e);\n workerScript.env.stopFlag = true;\n workerScript.running = false;\n killWorkerScript(workerScript);\n return;\n }\n\n var interpreterInitialization = function (int, scope) {\n //Add the Netscript environment\n var ns = NetscriptFunctions(workerScript);\n for (let name in ns) {\n let entry = ns[name];\n if (typeof entry === \"function\") {\n //Async functions need to be wrapped. See JS-Interpreter documentation\n if (\n name === \"hack\" ||\n name === \"grow\" ||\n name === \"weaken\" ||\n name === \"sleep\" ||\n name === \"prompt\" ||\n name === \"manualHack\"\n ) {\n let tempWrapper = function () {\n let fnArgs = [];\n\n //All of the Object/array elements are in JSInterpreter format, so\n //we have to convert them back to native format to pass them to these fns\n for (let i = 0; i < arguments.length - 1; ++i) {\n if (typeof arguments[i] === \"object\" || arguments[i].constructor === Array) {\n fnArgs.push(int.pseudoToNative(arguments[i]));\n } else {\n fnArgs.push(arguments[i]);\n }\n }\n let cb = arguments[arguments.length - 1];\n let fnPromise = entry.apply(null, fnArgs);\n fnPromise\n .then(function (res) {\n cb(res);\n })\n .catch(function (err) {\n console.error(err);\n });\n };\n int.setProperty(scope, name, int.createAsyncFunction(tempWrapper));\n } else if (\n name === \"sprintf\" ||\n name === \"vsprintf\" ||\n name === \"scp\" ||\n name == \"write\" ||\n name === \"read\" ||\n name === \"tryWrite\" ||\n name === \"run\" ||\n name === \"exec\"\n ) {\n let tempWrapper = function () {\n let fnArgs = [];\n\n //All of the Object/array elements are in JSInterpreter format, so\n //we have to convert them back to native format to pass them to these fns\n for (let i = 0; i < arguments.length; ++i) {\n if (typeof arguments[i] === \"object\" || arguments[i].constructor === Array) {\n fnArgs.push(int.pseudoToNative(arguments[i]));\n } else {\n fnArgs.push(arguments[i]);\n }\n }\n\n return entry.apply(null, fnArgs);\n };\n int.setProperty(scope, name, int.createNativeFunction(tempWrapper));\n } else {\n let tempWrapper = function () {\n let res = entry.apply(null, arguments);\n\n if (res == null) {\n return res;\n } else if (res.constructor === Array || res === Object(res)) {\n //Objects and Arrays must be converted to the interpreter's format\n return int.nativeToPseudo(res);\n } else {\n return res;\n }\n };\n int.setProperty(scope, name, int.createNativeFunction(tempWrapper));\n }\n } else {\n //bladeburner, or anything else\n int.setProperty(scope, name, int.nativeToPseudo(entry));\n }\n }\n\n //Add the arguments\n int.setProperty(scope, \"args\", int.nativeToPseudo(workerScript.args));\n };\n\n var interpreter;\n try {\n interpreter = new Interpreter(codeWithImports, interpreterInitialization, codeLineOffset);\n } catch (e) {\n dialogBoxCreate(\"Syntax ERROR in \" + workerScript.name + \":
\" + e);\n workerScript.env.stopFlag = true;\n workerScript.running = false;\n killWorkerScript(workerScript);\n return;\n }\n\n return new Promise(function (resolve, reject) {\n function runInterpreter() {\n try {\n if (workerScript.env.stopFlag) {\n return reject(workerScript);\n }\n\n if (interpreter.step()) {\n setTimeoutRef(runInterpreter, Settings.CodeInstructionRunTime);\n } else {\n resolve(workerScript);\n }\n } catch (e) {\n e = e.toString();\n if (!isScriptErrorMessage(e)) {\n e = makeRuntimeRejectMsg(workerScript, e);\n }\n workerScript.errorMessage = e;\n return reject(workerScript);\n }\n }\n\n try {\n runInterpreter();\n } catch (e) {\n if (isString(e)) {\n workerScript.errorMessage = e;\n return reject(workerScript);\n } else if (e instanceof WorkerScript) {\n return reject(e);\n } else {\n return reject(workerScript);\n }\n }\n });\n}\n\n/* Since the JS Interpreter used for Netscript 1.0 only supports ES5, the keyword\n 'import' throws an error. However, since we want to support import funtionality\n we'll implement it ourselves by parsing the Nodes in the AST out.\n\n @param code - The script's code\n @returns {Object} {\n code: Newly-generated code with imported functions\n lineOffset: Net number of lines of code added/removed due to imported functions\n Should typically be positive\n }\n*/\nfunction processNetscript1Imports(code, workerScript) {\n //allowReserved prevents 'import' from throwing error in ES5\n const ast = parse(code, {\n ecmaVersion: 9,\n allowReserved: true,\n sourceType: \"module\",\n });\n\n var server = workerScript.getServer();\n if (server == null) {\n throw new Error(\"Failed to find underlying Server object for script\");\n }\n\n function getScript(scriptName) {\n for (let i = 0; i < server.scripts.length; ++i) {\n if (server.scripts[i].filename === scriptName) {\n return server.scripts[i];\n }\n }\n return null;\n }\n\n let generatedCode = \"\"; // Generated Javascript Code\n let hasImports = false;\n\n // Walk over the tree and process ImportDeclaration nodes\n walksimple(ast, {\n ImportDeclaration: (node) => {\n hasImports = true;\n let scriptName = node.source.value;\n if (scriptName.startsWith(\"./\")) {\n scriptName = scriptName.slice(2);\n }\n let script = getScript(scriptName);\n if (script == null) {\n throw new Error(\"'Import' failed due to invalid script: \" + scriptName);\n }\n let scriptAst = parse(script.code, {\n ecmaVersion: 9,\n allowReserved: true,\n sourceType: \"module\",\n });\n\n if (node.specifiers.length === 1 && node.specifiers[0].type === \"ImportNamespaceSpecifier\") {\n // import * as namespace from script\n let namespace = node.specifiers[0].local.name;\n let fnNames = []; //Names only\n let fnDeclarations = []; //FunctionDeclaration Node objects\n walksimple(scriptAst, {\n FunctionDeclaration: (node) => {\n fnNames.push(node.id.name);\n fnDeclarations.push(node);\n },\n });\n\n //Now we have to generate the code that would create the namespace\n generatedCode += \"var \" + namespace + \";\\n\" + \"(function (namespace) {\\n\";\n\n //Add the function declarations\n fnDeclarations.forEach((fn) => {\n generatedCode += generate(fn);\n generatedCode += \"\\n\";\n });\n\n //Add functions to namespace\n fnNames.forEach((fnName) => {\n generatedCode += \"namespace.\" + fnName + \" = \" + fnName;\n generatedCode += \"\\n\";\n });\n\n //Finish\n generatedCode += \"})(\" + namespace + \" || \" + \"(\" + namespace + \" = {}));\\n\";\n } else {\n //import {...} from script\n\n //Get array of all fns to import\n let fnsToImport = [];\n node.specifiers.forEach((e) => {\n fnsToImport.push(e.local.name);\n });\n\n //Walk through script and get FunctionDeclaration code for all specified fns\n let fnDeclarations = [];\n walksimple(scriptAst, {\n FunctionDeclaration: (node) => {\n if (fnsToImport.includes(node.id.name)) {\n fnDeclarations.push(node);\n }\n },\n });\n\n //Convert FunctionDeclarations into code\n fnDeclarations.forEach((fn) => {\n generatedCode += generate(fn);\n generatedCode += \"\\n\";\n });\n }\n },\n });\n\n //If there are no imports, just return the original code\n if (!hasImports) {\n return { code: code, lineOffset: 0 };\n }\n\n //Remove ImportDeclarations from AST. These ImportDeclarations must be in top-level\n var linesRemoved = 0;\n if (ast.type !== \"Program\" || ast.body == null) {\n throw new Error(\"Code could not be properly parsed\");\n }\n for (let i = ast.body.length - 1; i >= 0; --i) {\n if (ast.body[i].type === \"ImportDeclaration\") {\n ast.body.splice(i, 1);\n ++linesRemoved;\n }\n }\n\n //Calculated line offset\n var lineOffset = (generatedCode.match(/\\n/g) || []).length - linesRemoved;\n\n //Convert the AST back into code\n code = generate(ast);\n\n //Add the imported code and re-generate in ES5 (JS Interpreter for NS1 only supports ES5);\n code = generatedCode + code;\n\n var res = {\n code: code,\n lineOffset: lineOffset,\n };\n return res;\n}\n\n/**\n * Used to start a RunningScript (by creating and starting its\n * corresponding WorkerScript), and add the RunningScript to the server on which\n * it is active\n * @param {RunningScript} runningScriptObj - Script that's being run\n * @param {Server} server - Server on which the script is to be run\n * @returns {number} pid of started script\n */\nexport function startWorkerScript(runningScript, server, parent) {\n if (createAndAddWorkerScript(runningScript, server, parent)) {\n // Push onto runningScripts.\n // This has to come after createAndAddWorkerScript() because that fn updates RAM usage\n server.runScript(runningScript, Player.hacknet_node_money_mult);\n\n // Once the WorkerScript is constructed in createAndAddWorkerScript(), the RunningScript\n // object should have a PID assigned to it, so we return that\n return runningScript.pid;\n }\n\n return 0;\n}\n\n/**\n * Given a RunningScript object, constructs its corresponding WorkerScript,\n * adds it to the global 'workerScripts' pool, and begins executing it.\n * @param {RunningScript} runningScriptObj - Script that's being run\n * @param {Server} server - Server on which the script is to be run\n * returns {boolean} indicating whether or not the workerScript was successfully added\n */\nexport function createAndAddWorkerScript(runningScriptObj, server, parent) {\n // Update server's ram usage\n let threads = 1;\n if (runningScriptObj.threads && !isNaN(runningScriptObj.threads)) {\n threads = runningScriptObj.threads;\n } else {\n runningScriptObj.threads = 1;\n }\n const ramUsage = roundToTwo(getRamUsageFromRunningScript(runningScriptObj) * threads);\n const ramAvailable = server.maxRam - server.ramUsed;\n if (ramUsage > ramAvailable) {\n dialogBoxCreate(\n `Not enough RAM to run script ${runningScriptObj.filename} with args ` +\n `${arrayToString(runningScriptObj.args)}. This likely occurred because you re-loaded ` +\n `the game and the script's RAM usage increased (either because of an update to the game or ` +\n `your changes to the script.)`,\n );\n return false;\n }\n server.ramUsed = roundToTwo(server.ramUsed + ramUsage);\n\n // Get the pid\n const pid = generateNextPid();\n if (pid === -1) {\n throw new Error(\n `Failed to start script because could not find available PID. This is most ` +\n `because you have too many scripts running.`,\n );\n }\n\n // Create the WorkerScript. NOTE: WorkerScript ctor will set the underlying\n // RunningScript's PID as well\n const s = new WorkerScript(runningScriptObj, pid, NetscriptFunctions);\n s.ramUsage = ramUsage;\n\n // Add the WorkerScript to the global pool\n workerScripts.set(pid, s);\n WorkerScriptStartStopEventEmitter.emit();\n\n // Start the script's execution\n let p = null; // Script's resulting promise\n if (s.name.endsWith(\".js\") || s.name.endsWith(\".ns\")) {\n p = startNetscript2Script(s);\n } else {\n p = startNetscript1Script(s);\n if (!(p instanceof Promise)) {\n return false;\n }\n }\n\n // Once the code finishes (either resolved or rejected, doesnt matter), set its\n // running status to false\n p.then(function (w) {\n // On natural death, the earnings are transfered to the parent if it still exists.\n if (parent && parent.running) {\n parent.scriptRef.onlineExpGained += runningScriptObj.onlineExpGained;\n parent.scriptRef.onlineMoneyMade += runningScriptObj.onlineMoneyMade;\n }\n\n // If the WorkerScript is no longer \"running\", then this means its execution was\n // already stopped somewhere else (maybe by something like exit()). This prevents\n // the script from being cleaned up twice\n if (!w.running) {\n return;\n }\n\n killWorkerScript(s);\n w.log(\"\", \"Script finished running\");\n }).catch(function (w) {\n if (w instanceof Error) {\n dialogBoxCreate(\"Script runtime unknown error. This is a bug please contact game developer\");\n console.error(\"Evaluating workerscript returns an Error. THIS SHOULDN'T HAPPEN: \" + w.toString());\n return;\n } else if (w instanceof WorkerScript) {\n if (isScriptErrorMessage(w.errorMessage)) {\n const errorTextArray = w.errorMessage.split(\"|\");\n if (errorTextArray.length != 4) {\n console.error(\"ERROR: Something wrong with Error text in evaluator...\");\n console.error(\"Error text: \" + errorText);\n return;\n }\n const serverIp = errorTextArray[1];\n const scriptName = errorTextArray[2];\n const errorMsg = errorTextArray[3];\n\n let msg = `RUNTIME ERROR
${scriptName}@${serverIp}
`;\n if (w.args.length > 0) {\n msg += `Args: ${arrayToString(w.args)}
`;\n }\n msg += \"
\";\n msg += errorMsg;\n\n dialogBoxCreate(msg);\n w.log(\"\", \"Script crashed with runtime error\");\n } else {\n w.log(\"\", \"Script killed\");\n return; // Already killed, so stop here\n }\n w.running = false;\n w.env.stopFlag = true;\n } else if (isScriptErrorMessage(w)) {\n dialogBoxCreate(\"Script runtime unknown error. This is a bug please contact game developer\");\n console.error(\n \"ERROR: Evaluating workerscript returns only error message rather than WorkerScript object. THIS SHOULDN'T HAPPEN: \" +\n w.toString(),\n );\n return;\n } else {\n dialogBoxCreate(\"An unknown script died for an unknown reason. This is a bug please contact game dev\");\n console.error(w);\n }\n\n killWorkerScript(s);\n });\n\n return true;\n}\n\n/**\n * Updates the online running time stat of all running scripts\n */\nexport function updateOnlineScriptTimes(numCycles = 1) {\n var time = (numCycles * CONSTANTS._idleSpeed) / 1000; //seconds\n for (const ws of workerScripts.values()) {\n ws.scriptRef.onlineRunningTime += time;\n }\n}\n\n/**\n * Called when the game is loaded. Loads all running scripts (from all servers)\n * into worker scripts so that they will start running\n */\nexport function loadAllRunningScripts() {\n let skipScriptLoad = window.location.href.toLowerCase().indexOf(\"?noscripts\") !== -1;\n if (skipScriptLoad) {\n console.info(\"Skipping the load of any scripts during startup\");\n }\n for (const property in AllServers) {\n if (AllServers.hasOwnProperty(property)) {\n const server = AllServers[property];\n\n // Reset each server's RAM usage to 0\n server.ramUsed = 0;\n\n // Reset modules on all scripts\n for (let i = 0; i < server.scripts.length; ++i) {\n server.scripts[i].markUpdated();\n }\n\n if (skipScriptLoad) {\n // Start game with no scripts\n server.runningScripts.length = 0;\n } else {\n for (let j = 0; j < server.runningScripts.length; ++j) {\n createAndAddWorkerScript(server.runningScripts[j], server);\n\n // Offline production\n scriptCalculateOfflineProduction(server.runningScripts[j]);\n }\n }\n }\n }\n}\n\n/**\n * Run a script from inside another script (run(), exec(), spawn(), etc.)\n */\nexport function runScriptFromScript(caller, server, scriptname, args, workerScript, threads = 1) {\n // Sanitize arguments\n if (!(workerScript instanceof WorkerScript)) {\n return 0;\n }\n\n if (typeof scriptname !== \"string\" || !Array.isArray(args)) {\n workerScript.log(caller, `Invalid arguments: scriptname='${scriptname} args='${ags}'`);\n console.error(`runScriptFromScript() failed due to invalid arguments`);\n return 0;\n }\n\n // Check if the script is already running\n let runningScriptObj = server.getRunningScript(scriptname, args);\n if (runningScriptObj != null) {\n workerScript.log(caller, `'${scriptname}' is already running on '${server.hostname}'`);\n return 0;\n }\n\n // 'null/undefined' arguments are not allowed\n for (let i = 0; i < args.length; ++i) {\n if (args[i] == null) {\n workerScript.log(caller, \"Cannot execute a script with null/undefined as an argument\");\n return 0;\n }\n }\n\n // Check if the script exists and if it does run it\n for (let i = 0; i < server.scripts.length; ++i) {\n if (server.scripts[i].filename === scriptname) {\n // Check for admin rights and that there is enough RAM availble to run\n const script = server.scripts[i];\n let ramUsage = script.ramUsage;\n threads = Math.round(Number(threads));\n if (threads === 0) {\n return 0;\n }\n ramUsage = ramUsage * threads;\n const ramAvailable = server.maxRam - server.ramUsed;\n\n if (server.hasAdminRights == false) {\n workerScript.log(caller, `You do not have root access on '${server.hostname}'`);\n return 0;\n } else if (ramUsage > ramAvailable) {\n workerScript.log(\n caller,\n `Cannot run script '${scriptname}' (t=${threads}) on '${server.hostname}' because there is not enough available RAM!`,\n );\n return 0;\n } else {\n // Able to run script\n workerScript.log(\n caller,\n `'${scriptname}' on '${server.hostname}' with ${threads} threads and args: ${arrayToString(args)}.`,\n );\n let runningScriptObj = new RunningScript(script, args);\n runningScriptObj.threads = threads;\n\n return startWorkerScript(runningScriptObj, server, workerScript);\n }\n }\n }\n\n workerScript.log(caller, `Could not find script '${scriptname}' on '${server.hostname}'`);\n return 0;\n}\n","/**\n * Represents the possible configuration values that can be provided when creating the progress bar text.\n */\ninterface IProgressBarConfiguration {\n /**\n * Current progress, taken as a decimal (i.e. '0.6' to represent '60%')\n */\n progress?: number;\n\n /**\n * Total number of ticks in progress bar. Preferably a factor of 100.\n */\n totalTicks?: number;\n}\n\n/**\n * Represents concrete configuration values when creating the progress bar text.\n */\ninterface IProgressBarConfigurationMaterialized extends IProgressBarConfiguration {\n progress: number;\n totalTicks: number;\n}\n\n/**\n * Creates a graphical \"progress bar\"\n * e.g.: [||||---------------]\n * @param params The configuration parameters for the progress bar\n */\nexport function createProgressBarText(params: IProgressBarConfiguration): string {\n // Default values\n const defaultParams: IProgressBarConfigurationMaterialized = {\n progress: 0,\n totalTicks: 20,\n };\n\n // tslint:disable-next-line:prefer-object-spread\n const derived: IProgressBarConfigurationMaterialized = Object.assign({}, defaultParams, params);\n // Ensure it is 0..1\n derived.progress = Math.max(Math.min(derived.progress, 1), 0);\n\n // This way there is always at least one bar filled in...\n const bars: number = Math.max(Math.floor(derived.progress / (1 / derived.totalTicks)), 1);\n const dashes: number = Math.max(derived.totalTicks - bars, 0);\n\n // String.prototype.repeat isn't completley supported, but good enough for our purposes\n return `[${\"|\".repeat(bars)}${\"-\".repeat(dashes)}]`;\n}\n","/**\n * Options specific to creating an anchor (\"\") element.\n */\ninterface ICreateElementAnchorOptions {\n href?: string;\n target?: string;\n text?: string;\n}\n\n/**\n * Options specific to creating an input (\"\") element.\n */\ninterface ICreateElementInputOptions {\n checked?: boolean;\n max?: string;\n maxLength?: number;\n min?: string;\n name?: string;\n pattern?: string;\n placeholder?: string;\n step?: string;\n type?: string;\n value?: string;\n}\n\n/**\n * Options specific to creating a label (\"
(elem = c)} onKeyDown={onKeyDown} />;\n}\n","import LinearProgress from \"@mui/material/LinearProgress\";\nimport React, { useState, useEffect } from \"react\";\nimport withStyles from \"@mui/styles/withStyles\";\nimport { Theme } from \"@mui/material/styles\";\nimport Grid from \"@mui/material/Grid\";\n\nconst TimerProgress = withStyles((theme: Theme) => ({\n root: {\n backgroundColor: theme.palette.background.paper,\n },\n bar: {\n transition: \"none\",\n backgroundColor: theme.palette.primary.main,\n },\n}))(LinearProgress);\n\ninterface IProps {\n millis: number;\n onExpire: () => void;\n}\n\nexport function GameTimer(props: IProps): React.ReactElement {\n const [v, setV] = useState(100);\n\n const tick = 200;\n useEffect(() => {\n const intervalId = setInterval(() => {\n setV((old) => {\n if (old <= 0) props.onExpire();\n return old - (tick / props.millis) * 100;\n });\n }, tick);\n return () => {\n clearInterval(intervalId);\n };\n }, []);\n\n // https://stackoverflow.com/questions/55593367/disable-material-uis-linearprogress-animation\n // TODO(hydroflame): there's like a bug where it triggers the end before the\n // bar physically reaches the end\n return (\n \n \n \n );\n}\n","interface DifficultySetting {\n [key: string]: number;\n}\n\ninterface DifficultySettings {\n Trivial: DifficultySetting;\n Normal: DifficultySetting;\n Hard: DifficultySetting;\n Impossible: DifficultySetting;\n}\n\n// I could use `any` to simply some of this but I also want to take advantage\n// of the type safety that typescript provides. I'm just not sure how in this\n// case.\nexport function interpolate(settings: DifficultySettings, n: number, out: DifficultySetting): DifficultySetting {\n // interpolates between 2 difficulties.\n function lerpD(a: DifficultySetting, b: DifficultySetting, t: number): DifficultySetting {\n // interpolates between 2 numbers.\n function lerp(x: number, y: number, t: number): number {\n return (1 - t) * x + t * y;\n }\n for (const key of Object.keys(a)) {\n out[key] = lerp(a[key], b[key], t);\n }\n return a;\n }\n if (n < 0) return lerpD(settings.Trivial, settings.Trivial, 0);\n if (n >= 0 && n < 1) return lerpD(settings.Trivial, settings.Normal, n);\n if (n >= 1 && n < 2) return lerpD(settings.Normal, settings.Hard, n - 1);\n if (n >= 2 && n < 3) return lerpD(settings.Hard, settings.Impossible, n - 2);\n return lerpD(settings.Impossible, settings.Impossible, 0);\n}\n","// This is a reference to the native setTimeout() function\n// setTimeout() is used in various places around the game's source code.\n// This reference is used to make sure that if players alter window.setTimeout()\n// through NetscriptJS, then the game will still function properly\nexport const setTimeoutRef = window.setTimeout.bind(window);\n","/**\n * Global pool of all active scripts (scripts that are currently running)\n */\nimport { WorkerScript } from \"./WorkerScript\";\n\nexport const workerScripts: Map = new Map();\n","/**\n * Functions for buying/selling stocks. There are four functions total, two for\n * long positions and two for short positions.\n */\nimport { Stock } from \"./Stock\";\nimport {\n getBuyTransactionCost,\n getSellTransactionGain,\n processTransactionForecastMovement,\n} from \"./StockMarketHelpers\";\n\nimport { PositionTypes } from \"./data/PositionTypes\";\n\nimport { CONSTANTS } from \"../Constants\";\nimport { WorkerScript } from \"../Netscript/WorkerScript\";\nimport { Player } from \"../Player\";\n\nimport { numeralWrapper } from \"../ui/numeralFormat\";\nimport { Money } from \"../ui/React/Money\";\n\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\n\nimport * as React from \"react\";\n\n/**\n * Each function takes an optional config object as its last argument\n */\ninterface IOptions {\n rerenderFn?: () => void;\n suppressDialog?: boolean;\n}\n\n/**\n * Attempt to buy a stock in the long position\n * @param {Stock} stock - Stock to buy\n * @param {number} shares - Number of shares to buy\n * @param {WorkerScript} workerScript - If this is being called through Netscript\n * @param opts - Optional configuration for this function's behavior. See top of file\n * @returns {boolean} - true if successful, false otherwise\n */\nexport function buyStock(\n stock: Stock,\n shares: number,\n workerScript: WorkerScript | null = null,\n opts: IOptions = {},\n): boolean {\n // Validate arguments\n shares = Math.round(shares);\n if (shares <= 0) {\n return false;\n }\n if (stock == null || isNaN(shares)) {\n if (workerScript) {\n workerScript.log(\"buyStock\", `Invalid arguments: stock='${stock}' shares='${shares}'`);\n } else if (opts.suppressDialog !== true) {\n dialogBoxCreate(\"Failed to buy stock. This may be a bug, contact developer\");\n }\n\n return false;\n }\n\n // Does player have enough money?\n const totalPrice = getBuyTransactionCost(stock, shares, PositionTypes.Long);\n if (totalPrice == null) {\n return false;\n }\n if (Player.money.lt(totalPrice)) {\n if (workerScript) {\n workerScript.log(\n \"buyStock\",\n `You do not have enough money to purchase this position. You need ${numeralWrapper.formatMoney(totalPrice)}.`,\n );\n } else if (opts.suppressDialog !== true) {\n dialogBoxCreate(\n <>\n You do not have enough money to purchase this. You need \n ,\n );\n }\n\n return false;\n }\n\n // Would this purchase exceed the maximum number of shares?\n if (shares + stock.playerShares + stock.playerShortShares > stock.maxShares) {\n if (workerScript) {\n workerScript.log(\n \"buyStock\",\n `Purchasing '${shares + stock.playerShares + stock.playerShortShares}' shares would exceed ${\n stock.symbol\n }'s maximum (${stock.maxShares}) number of shares`,\n );\n } else if (opts.suppressDialog !== true) {\n dialogBoxCreate(\n `You cannot purchase this many shares. ${stock.symbol} has a maximum of ${numeralWrapper.formatShares(\n stock.maxShares,\n )} shares.`,\n );\n }\n\n return false;\n }\n\n const origTotal = stock.playerShares * stock.playerAvgPx;\n Player.loseMoney(totalPrice);\n const newTotal = origTotal + totalPrice - CONSTANTS.StockMarketCommission;\n stock.playerShares = Math.round(stock.playerShares + shares);\n stock.playerAvgPx = newTotal / stock.playerShares;\n processTransactionForecastMovement(stock, shares);\n if (opts.rerenderFn != null && typeof opts.rerenderFn === \"function\") {\n opts.rerenderFn();\n }\n\n if (workerScript) {\n const resultTxt =\n `Bought ${numeralWrapper.formatShares(shares)} shares of ${stock.symbol} for ${numeralWrapper.formatMoney(\n totalPrice,\n )}. ` + `Paid ${numeralWrapper.formatMoney(CONSTANTS.StockMarketCommission)} in commission fees.`;\n workerScript.log(\"buyStock\", resultTxt);\n } else if (opts.suppressDialog !== true) {\n dialogBoxCreate(\n <>\n Bought {numeralWrapper.formatShares(shares)} shares of {stock.symbol} for . Paid{\" \"}\n in commission fees.\n ,\n );\n }\n\n return true;\n}\n\n/**\n * Attempt to sell a stock in the long position\n * @param {Stock} stock - Stock to sell\n * @param {number} shares - Number of shares to sell\n * @param {WorkerScript} workerScript - If this is being called through Netscript\n * @param opts - Optional configuration for this function's behavior. See top of file\n * returns {boolean} - true if successfully sells given number of shares OR MAX owned, false otherwise\n */\nexport function sellStock(\n stock: Stock,\n shares: number,\n workerScript: WorkerScript | null = null,\n opts: IOptions = {},\n): boolean {\n // Sanitize/Validate arguments\n if (stock == null || shares < 0 || isNaN(shares)) {\n if (workerScript) {\n workerScript.log(\"sellStock\", `Invalid arguments: stock='${stock}' shares='${shares}'`);\n } else if (opts.suppressDialog !== true) {\n dialogBoxCreate(\n \"Failed to sell stock. This is probably due to an invalid quantity. Otherwise, this may be a bug, contact developer\",\n );\n }\n\n return false;\n }\n shares = Math.round(shares);\n if (shares > stock.playerShares) {\n shares = stock.playerShares;\n }\n if (shares === 0) {\n return false;\n }\n\n const gains = getSellTransactionGain(stock, shares, PositionTypes.Long);\n if (gains == null) {\n return false;\n }\n let netProfit = gains - stock.playerAvgPx * shares;\n if (isNaN(netProfit)) {\n netProfit = 0;\n }\n Player.gainMoney(gains);\n Player.recordMoneySource(netProfit, \"stock\");\n if (workerScript) {\n workerScript.scriptRef.onlineMoneyMade += netProfit;\n Player.scriptProdSinceLastAug += netProfit;\n }\n\n stock.playerShares = Math.round(stock.playerShares - shares);\n if (stock.playerShares === 0) {\n stock.playerAvgPx = 0;\n }\n\n processTransactionForecastMovement(stock, shares);\n\n if (opts.rerenderFn != null && typeof opts.rerenderFn === \"function\") {\n opts.rerenderFn();\n }\n\n if (workerScript) {\n const resultTxt =\n `Sold ${numeralWrapper.formatShares(shares)} shares of ${stock.symbol}. ` +\n `After commissions, you gained a total of ${numeralWrapper.formatMoney(gains)}.`;\n workerScript.log(\"sellStock\", resultTxt);\n } else if (opts.suppressDialog !== true) {\n dialogBoxCreate(\n <>\n Sold {numeralWrapper.formatShares(shares)} shares of {stock.symbol}. After commissions, you gained a total of{\" \"}\n .\n ,\n );\n }\n\n return true;\n}\n\n/**\n * Attempt to buy a stock in the short position\n * @param {Stock} stock - Stock to sell\n * @param {number} shares - Number of shares to short\n * @param {WorkerScript} workerScript - If this is being called through Netscript\n * @param opts - Optional configuration for this function's behavior. See top of file\n * @returns {boolean} - true if successful, false otherwise\n */\nexport function shortStock(\n stock: Stock,\n shares: number,\n workerScript: WorkerScript | null = null,\n opts: IOptions = {},\n): boolean {\n // Validate arguments\n shares = Math.round(shares);\n if (shares <= 0) {\n return false;\n }\n if (stock == null || isNaN(shares)) {\n if (workerScript) {\n workerScript.log(\"shortStock\", `Invalid arguments: stock='${stock}' shares='${shares}'`);\n } else if (opts.suppressDialog !== true) {\n dialogBoxCreate(\n \"Failed to initiate a short position in a stock. This is probably \" +\n \"due to an invalid quantity. Otherwise, this may be a bug, so contact developer\",\n );\n }\n return false;\n }\n\n // Does the player have enough money?\n const totalPrice = getBuyTransactionCost(stock, shares, PositionTypes.Short);\n if (totalPrice == null) {\n return false;\n }\n if (Player.money.lt(totalPrice)) {\n if (workerScript) {\n workerScript.log(\n \"shortStock\",\n \"You do not have enough \" +\n \"money to purchase this short position. You need \" +\n numeralWrapper.formatMoney(totalPrice),\n );\n } else if (opts.suppressDialog !== true) {\n dialogBoxCreate(\n <>\n You do not have enough money to purchase this short position. You need \n ,\n );\n }\n\n return false;\n }\n\n // Would this purchase exceed the maximum number of shares?\n if (shares + stock.playerShares + stock.playerShortShares > stock.maxShares) {\n if (workerScript) {\n workerScript.log(\n \"shortStock\",\n `This '${shares + stock.playerShares + stock.playerShortShares}' short shares would exceed ${\n stock.symbol\n }'s maximum (${stock.maxShares}) number of shares.`,\n );\n } else if (opts.suppressDialog !== true) {\n dialogBoxCreate(\n `You cannot purchase this many shares. ${stock.symbol} has a maximum of ${stock.maxShares} shares.`,\n );\n }\n\n return false;\n }\n\n const origTotal = stock.playerShortShares * stock.playerAvgShortPx;\n Player.loseMoney(totalPrice);\n const newTotal = origTotal + totalPrice - CONSTANTS.StockMarketCommission;\n stock.playerShortShares = Math.round(stock.playerShortShares + shares);\n stock.playerAvgShortPx = newTotal / stock.playerShortShares;\n processTransactionForecastMovement(stock, shares);\n\n if (opts.rerenderFn != null && typeof opts.rerenderFn === \"function\") {\n opts.rerenderFn();\n }\n\n if (workerScript) {\n const resultTxt =\n `Bought a short position of ${numeralWrapper.formatShares(shares)} shares of ${stock.symbol} ` +\n `for ${numeralWrapper.formatMoney(totalPrice)}. Paid ${numeralWrapper.formatMoney(\n CONSTANTS.StockMarketCommission,\n )} ` +\n `in commission fees.`;\n workerScript.log(\"shortStock\", resultTxt);\n } else if (!opts.suppressDialog) {\n dialogBoxCreate(\n <>\n Bought a short position of {numeralWrapper.formatShares(shares)} shares of {stock.symbol} for{\" \"}\n . Paid in commission fees.\n ,\n );\n }\n\n return true;\n}\n\n/**\n * Attempt to sell a stock in the short position\n * @param {Stock} stock - Stock to sell\n * @param {number} shares - Number of shares to sell\n * @param {WorkerScript} workerScript - If this is being called through Netscript\n * @param opts - Optional configuration for this function's behavior. See top of file\n * @returns {boolean} true if successfully sells given amount OR max owned, false otherwise\n */\nexport function sellShort(\n stock: Stock,\n shares: number,\n workerScript: WorkerScript | null = null,\n opts: IOptions = {},\n): boolean {\n if (stock == null || isNaN(shares) || shares < 0) {\n if (workerScript) {\n workerScript.log(\"sellShort\", `Invalid arguments: stock='${stock}' shares='${shares}'`);\n } else if (!opts.suppressDialog) {\n dialogBoxCreate(\n \"Failed to sell a short position in a stock. This is probably \" +\n \"due to an invalid quantity. Otherwise, this may be a bug, so contact developer\",\n );\n }\n\n return false;\n }\n shares = Math.round(shares);\n if (shares > stock.playerShortShares) {\n shares = stock.playerShortShares;\n }\n if (shares === 0) {\n return false;\n }\n\n const origCost = shares * stock.playerAvgShortPx;\n const totalGain = getSellTransactionGain(stock, shares, PositionTypes.Short);\n if (totalGain == null || isNaN(totalGain) || origCost == null) {\n if (workerScript) {\n workerScript.log(\n \"sellShort\",\n `Failed to sell short position in a stock. This is probably either due to invalid arguments, or a bug`,\n );\n } else if (!opts.suppressDialog) {\n dialogBoxCreate(\n `Failed to sell short position in a stock. This is probably either due to invalid arguments, or a bug`,\n );\n }\n\n return false;\n }\n let profit = totalGain - origCost;\n if (isNaN(profit)) {\n profit = 0;\n }\n Player.gainMoney(totalGain);\n Player.recordMoneySource(profit, \"stock\");\n if (workerScript) {\n workerScript.scriptRef.onlineMoneyMade += profit;\n Player.scriptProdSinceLastAug += profit;\n }\n\n stock.playerShortShares = Math.round(stock.playerShortShares - shares);\n if (stock.playerShortShares === 0) {\n stock.playerAvgShortPx = 0;\n }\n processTransactionForecastMovement(stock, shares);\n\n if (opts.rerenderFn != null && typeof opts.rerenderFn === \"function\") {\n opts.rerenderFn();\n }\n\n if (workerScript) {\n const resultTxt =\n `Sold your short position of ${numeralWrapper.formatShares(shares)} shares of ${stock.symbol}. ` +\n `After commissions, you gained a total of ${numeralWrapper.formatMoney(totalGain)}`;\n workerScript.log(\"sellShort\", resultTxt);\n } else if (!opts.suppressDialog) {\n dialogBoxCreate(\n <>\n Sold your short position of {numeralWrapper.formatShares(shares)} shares of {stock.symbol}. After commissions,\n you gained a total of \n ,\n );\n }\n\n return true;\n}\n","/**\n * Stock Market Helper Functions\n */\nimport { Stock } from \"./Stock\";\nimport { PositionTypes } from \"./data/PositionTypes\";\nimport { CONSTANTS } from \"../Constants\";\n\n// Amount by which a stock's forecast changes during each price movement\nexport const forecastChangePerPriceMovement = 0.006;\n\n/**\n * Calculate the total cost of a \"buy\" transaction. This accounts for spread and commission.\n * @param {Stock} stock - Stock being purchased\n * @param {number} shares - Number of shares being transacted\n * @param {PositionTypes} posType - Long or short position\n * @returns {number | null} Total transaction cost. Returns null for an invalid transaction\n */\nexport function getBuyTransactionCost(stock: Stock, shares: number, posType: PositionTypes): number | null {\n if (isNaN(shares) || shares <= 0 || !(stock instanceof Stock)) {\n return null;\n }\n\n // Cap the 'shares' arg at the stock's maximum shares. This'll prevent\n // hanging in the case when a really big number is passed in\n shares = Math.min(shares, stock.maxShares);\n\n const isLong = posType === PositionTypes.Long;\n\n // If the number of shares doesn't trigger a price movement, its a simple calculation\n if (isLong) {\n return shares * stock.getAskPrice() + CONSTANTS.StockMarketCommission;\n } else {\n return shares * stock.getBidPrice() + CONSTANTS.StockMarketCommission;\n }\n}\n\n/**\n * Calculate the TOTAL amount of money gained from a sale (NOT net profit). This accounts\n * for spread and commission.\n * @param {Stock} stock - Stock being sold\n * @param {number} shares - Number of sharse being transacted\n * @param {PositionTypes} posType - Long or short position\n * @returns {number | null} Amount of money gained from transaction. Returns null for an invalid transaction\n */\nexport function getSellTransactionGain(stock: Stock, shares: number, posType: PositionTypes): number | null {\n if (isNaN(shares) || shares <= 0 || !(stock instanceof Stock)) {\n return null;\n }\n\n // Cap the 'shares' arg at the stock's maximum shares. This'll prevent\n // hanging in the case when a really big number is passed in\n shares = Math.min(shares, stock.maxShares);\n\n const isLong = posType === PositionTypes.Long;\n if (isLong) {\n return shares * stock.getBidPrice() - CONSTANTS.StockMarketCommission;\n } else {\n // Calculating gains for a short position requires calculating the profit made\n const origCost = shares * stock.playerAvgShortPx;\n const profit = (stock.playerAvgShortPx - stock.getAskPrice()) * shares - CONSTANTS.StockMarketCommission;\n\n return origCost + profit;\n }\n}\n\n/**\n * Processes a stock's change in forecast & second-order forecast\n * whenever it is transacted\n * @param {Stock} stock - Stock being sold\n * @param {number} shares - Number of sharse being transacted\n * @param {PositionTypes} posType - Long or short position\n */\nexport function processTransactionForecastMovement(stock: Stock, shares: number): void {\n if (isNaN(shares) || shares <= 0 || !(stock instanceof Stock)) {\n return;\n }\n\n // Cap the 'shares' arg at the stock's maximum shares. This'll prevent\n // hanging in the case when a really big number is passed in\n shares = Math.min(shares, stock.maxShares);\n\n // If there's only going to be one iteration at most\n const firstShares = stock.shareTxUntilMovement;\n if (shares <= firstShares) {\n stock.shareTxUntilMovement -= shares;\n if (stock.shareTxUntilMovement <= 0) {\n stock.shareTxUntilMovement = stock.shareTxForMovement;\n stock.influenceForecast(forecastChangePerPriceMovement);\n stock.influenceForecastForecast(forecastChangePerPriceMovement * (stock.mv / 100));\n }\n\n return;\n }\n\n // Calculate how many iterations of price changes we need to account for\n const remainingShares = shares - firstShares;\n let numIterations = 1 + Math.ceil(remainingShares / stock.shareTxForMovement);\n\n // If on the offchance we end up perfectly at the next price movement\n stock.shareTxUntilMovement =\n stock.shareTxForMovement - ((shares - stock.shareTxUntilMovement) % stock.shareTxForMovement);\n if (stock.shareTxUntilMovement === stock.shareTxForMovement || stock.shareTxUntilMovement <= 0) {\n ++numIterations;\n stock.shareTxUntilMovement = stock.shareTxForMovement;\n }\n\n // Forecast always decreases in magnitude\n const forecastChange = forecastChangePerPriceMovement * (numIterations - 1);\n const forecastForecastChange = forecastChange * (stock.mv / 100);\n stock.influenceForecast(forecastChange);\n stock.influenceForecastForecast(forecastForecastChange);\n}\n\n/**\n * Calculate the maximum number of shares of a stock that can be purchased.\n * Handles mid-transaction price movements, both L and S positions, etc.\n * Used for the \"Buy Max\" button in the UI\n * @param {Stock} stock - Stock being purchased\n * @param {PositionTypes} posType - Long or short position\n * @param {number} money - Amount of money player has\n * @returns maximum number of shares that the player can purchase\n */\nexport function calculateBuyMaxAmount(stock: Stock, posType: PositionTypes, money: number): number {\n if (!(stock instanceof Stock)) {\n return 0;\n }\n\n const isLong = posType === PositionTypes.Long;\n\n const remainingMoney = money - CONSTANTS.StockMarketCommission;\n const currPrice = isLong ? stock.getAskPrice() : stock.getBidPrice();\n\n return Math.floor(remainingMoney / currPrice);\n}\n","import { gangMemberUpgradesMetadata } from \"./data/upgrades\";\nimport { GangMemberUpgrade } from \"./GangMemberUpgrade\";\n\nexport const GangMemberUpgrades: {\n [key: string]: GangMemberUpgrade;\n} = {};\n\n(function () {\n gangMemberUpgradesMetadata.forEach((e) => {\n GangMemberUpgrades[e.name] = new GangMemberUpgrade(e.name, e.cost, e.upgType, e.mults);\n });\n})();\n","// Base class representing a person-like object\nimport { Augmentation } from \"../Augmentation/Augmentation\";\nimport { IPlayerOwnedAugmentation } from \"../Augmentation/PlayerOwnedAugmentation\";\nimport { BitNodeMultipliers } from \"../BitNode/BitNodeMultipliers\";\nimport { CityName } from \"../Locations/data/CityNames\";\nimport { CONSTANTS } from \"../Constants\";\nimport { calculateSkill } from \"./formulas/skill\";\nimport { calculateIntelligenceBonus } from \"./formulas/intelligence\";\n\n// Interface that defines a generic object used to track experience/money\n// earnings for tasks\nexport interface ITaskTracker {\n hack: number;\n str: number;\n def: number;\n dex: number;\n agi: number;\n cha: number;\n money: number;\n}\n\nexport function createTaskTracker(): ITaskTracker {\n return {\n hack: 0,\n str: 0,\n def: 0,\n dex: 0,\n agi: 0,\n cha: 0,\n money: 0,\n };\n}\n\nexport abstract class Person {\n /**\n * Stats\n */\n hacking_skill = 1;\n strength = 1;\n defense = 1;\n dexterity = 1;\n agility = 1;\n charisma = 1;\n intelligence = 1;\n hp = 10;\n max_hp = 10;\n\n /**\n * Experience\n */\n hacking_exp = 0;\n strength_exp = 0;\n defense_exp = 0;\n dexterity_exp = 0;\n agility_exp = 0;\n charisma_exp = 0;\n intelligence_exp = 0;\n\n /**\n * Multipliers\n */\n hacking_mult = 1;\n strength_mult = 1;\n defense_mult = 1;\n dexterity_mult = 1;\n agility_mult = 1;\n charisma_mult = 1;\n\n hacking_exp_mult = 1;\n strength_exp_mult = 1;\n defense_exp_mult = 1;\n dexterity_exp_mult = 1;\n agility_exp_mult = 1;\n charisma_exp_mult = 1;\n\n hacking_chance_mult = 1;\n hacking_speed_mult = 1;\n hacking_money_mult = 1;\n hacking_grow_mult = 1;\n\n company_rep_mult = 1;\n faction_rep_mult = 1;\n\n crime_money_mult = 1;\n crime_success_mult = 1;\n\n work_money_mult = 1;\n\n hacknet_node_money_mult = 1;\n hacknet_node_purchase_cost_mult = 1;\n hacknet_node_ram_cost_mult = 1;\n hacknet_node_core_cost_mult = 1;\n hacknet_node_level_cost_mult = 1;\n\n bladeburner_max_stamina_mult = 1;\n bladeburner_stamina_gain_mult = 1;\n bladeburner_analysis_mult = 1;\n bladeburner_success_chance_mult = 1;\n\n /**\n * Augmentations\n */\n augmentations: IPlayerOwnedAugmentation[] = [];\n queuedAugmentations: IPlayerOwnedAugmentation[] = [];\n\n /**\n * City that the person is in\n */\n city: CityName = CityName.Sector12;\n\n /**\n * Updates this object's multipliers for the given augmentation\n */\n applyAugmentation(aug: Augmentation): void {\n for (const mult in aug.mults) {\n if ((this as any)[mult] == null) {\n console.warn(`Augmentation has unrecognized multiplier property: ${mult}`);\n } else {\n (this as any)[mult] *= aug.mults[mult];\n }\n }\n }\n\n /**\n * Given an experience amount and stat multiplier, calculates the\n * stat level. Stat-agnostic (same formula for every stat)\n */\n calculateStat(exp: number, mult = 1): number {\n return calculateSkill(exp, mult);\n }\n\n /**\n * Calculate and return the amount of faction reputation earned per cycle\n * when doing Field Work for a faction\n */\n getFactionFieldWorkRepGain(): number {\n const t =\n (0.9 *\n (this.hacking_skill / CONSTANTS.MaxSkillLevel +\n this.strength / CONSTANTS.MaxSkillLevel +\n this.defense / CONSTANTS.MaxSkillLevel +\n this.dexterity / CONSTANTS.MaxSkillLevel +\n this.agility / CONSTANTS.MaxSkillLevel +\n this.charisma / CONSTANTS.MaxSkillLevel)) /\n 5.5;\n return t * this.faction_rep_mult;\n }\n\n /**\n * Calculate and return the amount of faction reputation earned per cycle\n * when doing Hacking Work for a faction\n */\n getFactionHackingWorkRepGain(): number {\n return (this.hacking_skill / CONSTANTS.MaxSkillLevel) * this.faction_rep_mult;\n }\n\n /**\n * Calculate and return the amount of faction reputation earned per cycle\n * when doing Security Work for a faction\n */\n getFactionSecurityWorkRepGain(): number {\n const t =\n (0.9 *\n (this.hacking_skill / CONSTANTS.MaxSkillLevel +\n this.strength / CONSTANTS.MaxSkillLevel +\n this.defense / CONSTANTS.MaxSkillLevel +\n this.dexterity / CONSTANTS.MaxSkillLevel +\n this.agility / CONSTANTS.MaxSkillLevel)) /\n 4.5;\n return t * this.faction_rep_mult;\n }\n\n /**\n * Reset all multipliers to 1\n */\n resetMultipliers(): void {\n this.hacking_mult = 1;\n this.strength_mult = 1;\n this.defense_mult = 1;\n this.dexterity_mult = 1;\n this.agility_mult = 1;\n this.charisma_mult = 1;\n\n this.hacking_exp_mult = 1;\n this.strength_exp_mult = 1;\n this.defense_exp_mult = 1;\n this.dexterity_exp_mult = 1;\n this.agility_exp_mult = 1;\n this.charisma_exp_mult = 1;\n\n this.company_rep_mult = 1;\n this.faction_rep_mult = 1;\n\n this.crime_money_mult = 1;\n this.crime_success_mult = 1;\n\n this.work_money_mult = 1;\n }\n\n /**\n * Update all stat levels\n */\n updateStatLevels(): void {\n this.hacking_skill = Math.max(\n 1,\n Math.floor(this.calculateStat(this.hacking_exp, this.hacking_mult * BitNodeMultipliers.HackingLevelMultiplier)),\n );\n this.strength = Math.max(\n 1,\n Math.floor(\n this.calculateStat(this.strength_exp, this.strength_mult * BitNodeMultipliers.StrengthLevelMultiplier),\n ),\n );\n this.defense = Math.max(\n 1,\n Math.floor(this.calculateStat(this.defense_exp, this.defense_mult * BitNodeMultipliers.DefenseLevelMultiplier)),\n );\n this.dexterity = Math.max(\n 1,\n Math.floor(\n this.calculateStat(this.dexterity_exp, this.dexterity_mult * BitNodeMultipliers.DexterityLevelMultiplier),\n ),\n );\n this.agility = Math.max(\n 1,\n Math.floor(this.calculateStat(this.agility_exp, this.agility_mult * BitNodeMultipliers.AgilityLevelMultiplier)),\n );\n this.charisma = Math.max(\n 1,\n Math.floor(\n this.calculateStat(this.charisma_exp, this.charisma_mult * BitNodeMultipliers.CharismaLevelMultiplier),\n ),\n );\n\n const ratio: number = this.hp / this.max_hp;\n this.max_hp = Math.floor(10 + this.defense / 10);\n this.hp = Math.round(this.max_hp * ratio);\n }\n\n getIntelligenceBonus(weight: number): number {\n return calculateIntelligenceBonus(this.intelligence, weight);\n }\n}\n","import { CONSTANTS } from \"../Constants\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { IPlayerOrSleeve } from \"../PersonObjects/IPlayerOrSleeve\";\nimport { IRouter } from \"../ui/Router\";\n\nexport interface IConstructorParams {\n hacking_success_weight?: number;\n strength_success_weight?: number;\n defense_success_weight?: number;\n dexterity_success_weight?: number;\n agility_success_weight?: number;\n charisma_success_weight?: number;\n hacking_exp?: number;\n strength_exp?: number;\n defense_exp?: number;\n dexterity_exp?: number;\n agility_exp?: number;\n charisma_exp?: number;\n intelligence_exp?: number;\n\n kills?: number;\n}\n\nexport class Crime {\n // Number representing the difficulty of the crime. Used for success chance calculations\n difficulty = 0;\n\n // Amount of karma lost for SUCCESSFULLY committing this crime\n karma = 0;\n\n // How many people die as a result of this crime\n kills = 0;\n\n // How much money is given by the\n money = 0;\n\n // Name of crime\n name = \"\";\n\n // Milliseconds it takes to attempt the crime\n time = 0;\n\n // Corresponding type in CONSTANTS. Contains a description for the crime activity\n type = \"\";\n\n // Weighting factors that determine how stats affect the success rate of this crime\n hacking_success_weight = 0;\n strength_success_weight = 0;\n defense_success_weight = 0;\n dexterity_success_weight = 0;\n agility_success_weight = 0;\n charisma_success_weight = 0;\n\n // How much stat experience is granted by this crime\n hacking_exp = 0;\n strength_exp = 0;\n defense_exp = 0;\n dexterity_exp = 0;\n agility_exp = 0;\n charisma_exp = 0;\n intelligence_exp = 0;\n\n constructor(name = \"\", type = \"\", time = 0, money = 0, difficulty = 0, karma = 0, params: IConstructorParams = {}) {\n this.name = name;\n this.type = type;\n this.time = time;\n this.money = money;\n this.difficulty = difficulty;\n this.karma = karma;\n\n this.hacking_success_weight = params.hacking_success_weight ? params.hacking_success_weight : 0;\n this.strength_success_weight = params.strength_success_weight ? params.strength_success_weight : 0;\n this.defense_success_weight = params.defense_success_weight ? params.defense_success_weight : 0;\n this.dexterity_success_weight = params.dexterity_success_weight ? params.dexterity_success_weight : 0;\n this.agility_success_weight = params.agility_success_weight ? params.agility_success_weight : 0;\n this.charisma_success_weight = params.charisma_success_weight ? params.charisma_success_weight : 0;\n\n this.hacking_exp = params.hacking_exp ? params.hacking_exp : 0;\n this.strength_exp = params.strength_exp ? params.strength_exp : 0;\n this.defense_exp = params.defense_exp ? params.defense_exp : 0;\n this.dexterity_exp = params.dexterity_exp ? params.dexterity_exp : 0;\n this.agility_exp = params.agility_exp ? params.agility_exp : 0;\n this.charisma_exp = params.charisma_exp ? params.charisma_exp : 0;\n this.intelligence_exp = params.intelligence_exp ? params.intelligence_exp : 0;\n\n this.kills = params.kills ? params.kills : 0;\n }\n\n commit(router: IRouter, p: IPlayer, div = 1, singParams: any = null): number {\n if (div <= 0) {\n div = 1;\n }\n p.startCrime(\n router,\n this.type,\n this.hacking_exp / div,\n this.strength_exp / div,\n this.defense_exp / div,\n this.dexterity_exp / div,\n this.agility_exp / div,\n this.charisma_exp / div,\n this.money / div,\n this.time,\n singParams,\n );\n\n return this.time;\n }\n\n successRate(p: IPlayerOrSleeve): number {\n let chance: number =\n this.hacking_success_weight * p.hacking_skill +\n this.strength_success_weight * p.strength +\n this.defense_success_weight * p.defense +\n this.dexterity_success_weight * p.dexterity +\n this.agility_success_weight * p.agility +\n this.charisma_success_weight * p.charisma +\n CONSTANTS.IntelligenceCrimeWeight * p.intelligence;\n chance /= CONSTANTS.MaxSkillLevel;\n chance /= this.difficulty;\n chance *= p.crime_success_mult;\n chance *= p.getIntelligenceBonus(1);\n\n return Math.min(chance, 1);\n }\n}\n","import React from \"react\";\nimport { BitNodeMultipliers } from \"./BitNodeMultipliers\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { IMap } from \"../types\";\n\nclass BitNode {\n // A short description, or tagline, about the BitNode\n desc: string;\n\n // A long, detailed overview of the BitNode\n info: JSX.Element;\n\n // Name of BitNode\n name: string;\n\n // BitNode number\n number: number;\n\n difficulty: 0 | 1 | 2;\n\n constructor(n: number, difficulty: 0 | 1 | 2, name: string, desc = \"\", info: JSX.Element = <>) {\n this.number = n;\n this.difficulty = difficulty;\n this.name = name;\n this.desc = desc;\n this.info = info;\n }\n}\n\nexport const BitNodes: IMap = {};\n\nBitNodes[\"BitNode1\"] = new BitNode(\n 1,\n 0,\n \"Source Genesis\",\n \"The original BitNode\",\n (\n <>\n The first BitNode created by the Enders to imprison the minds of humans. It became the prototype and\n testing-grounds for all of the BitNodes that followed.\n
\n
\n This is the first BitNode that you play through. It has no special modifications or mechanics.\n
\n
\n Destroying this BitNode will give you Source-File 1, or if you already have this Source-File it will upgrade its\n level up to a maximum of 3. This Source-File lets the player start with 32GB of RAM on his/her home computer when\n entering a new BitNode, and also increases all of the player's multipliers by:\n
\n
\n Level 1: 16%\n
\n Level 2: 24%\n
\n Level 3: 28%\n \n ),\n);\nBitNodes[\"BitNode2\"] = new BitNode(\n 2,\n 0,\n \"Rise of the Underworld\",\n \"From the shadows, they rose\", //Gangs\n (\n <>\n From the shadows, they rose.\n
\n
\n Organized crime groups quickly filled the void of power left behind from the collapse of Western government in the\n 2050s. As society and civlization broke down, people quickly succumbed to the innate human impulse of evil and\n savagery. The organized crime factions quickly rose to the top of the modern world.\n
\n
\n In this BitNode:\n
\n
\n Your hacking level is reduced by 20%\n
\n The growth rate and maximum amount of money available on servers are significantly decreased\n
\n The amount of money gained from crimes and Infiltration is tripled\n
\n Certain Factions (Slum Snakes, Tetrads, The Syndicate, The Dark Army, Speakers for the Dead, NiteSec, The Black\n Hand) give the player the ability to form and manage their own gangs. These gangs will earn the player money and\n reputation with the corresponding Faction\n
\n Every Augmentation in the game will be available through the Factions listed above\n
\n For every Faction NOT listed above, reputation gains are halved\n
\n You will no longer gain passive reputation with Factions\n
\n
\n Destroying this BitNode will give you Source-File 2, or if you already have this Source-File it will upgrade its\n level up to a maximum of 3. This Source-File allows you to form gangs in other BitNodes once your karma decreases\n to a certain value. It also increases the player's crime success rate, crime money, and charisma multipliers by:\n
\n
\n Level 1: 24%\n
\n Level 2: 36%\n
\n Level 3: 42%\n \n ),\n);\nBitNodes[\"BitNode3\"] = new BitNode(\n 3,\n 0,\n \"Corporatocracy\",\n \"The Price of Civilization\",\n (\n <>\n Our greatest illusion is that a healthy society can revolve around a single-minded pursuit of wealth.\n
\n
\n Sometime in the early 21st century economic and political globalization turned the world into a corporatocracy,\n and it never looked back. Now, the privileged elite will happily bankrupt their own countrymen, decimate their own\n community, and evict their neighbors from houses in their desperate bid to increase their wealth.\n
\n
\n In this BitNode you can create and manage your own corporation. Running a successful corporation has the potential\n of generating massive profits. All other forms of income are reduced by 75%. Furthermore:
\n
\n The price and reputation cost of all Augmentations is tripled\n
\n The starting and maximum amount of money on servers is reduced by 75%\n
\n Server growth rate is reduced by 80%\n
\n You now only need 75 favour with a faction in order to donate to it, rather than 150\n
\n
\n Destroying this BitNode will give you Source-File 3, or if you already have this Source-File it will upgrade its\n level up to a maximum of 3. This Source-File lets you create corporations on other BitNodes (although some\n BitNodes will disable this mechanic). This Source-File also increases your charisma and company salary multipliers\n by:\n
\n Level 1: 8%\n
\n Level 2: 12%\n
\n Level 3: 14%\n \n ),\n);\nBitNodes[\"BitNode4\"] = new BitNode(\n 4,\n 1,\n \"The Singularity\",\n \"The Man and the Machine\",\n (\n <>\n The Singularity has arrived. The human race is gone, replaced by artificially superintelligent beings that are\n more machine than man.
\n
\n In this BitNode, progressing is significantly harder. Experience gain rates for all stats are reduced. Most\n methods of earning money will now give significantly less.\n
\n
\n In this BitNode you will gain access to a new set of Netscript Functions known as Singularity Functions. These\n functions allow you to control most aspects of the game through scripts, including working for factions/companies,\n purchasing/installing Augmentations, and creating programs.\n
\n
\n Destroying this BitNode will give you Source-File 4, or if you already have this Source-File it will upgrade its\n level up to a maximum of 3. This Source-File lets you access and use the Singularity Functions in other BitNodes.\n Each level of this Source-File will open up more Singularity Functions that you can use.\n \n ),\n);\nBitNodes[\"BitNode5\"] = new BitNode(\n 5,\n 1,\n \"Artificial Intelligence\",\n \"Posthuman\",\n (\n <>\n They said it couldn't be done. They said the human brain, along with its consciousness and intelligence, couldn't\n be replicated. They said the complexity of the brain results from unpredictable, nonlinear interactions that\n couldn't be modeled by 1's and 0's. They were wrong.\n
\n
\n In this BitNode:\n
\n
\n The base security level of servers is doubled\n
\n The starting money on servers is halved, but the maximum money remains the same\n
\n Most methods of earning money now give significantly less\n
\n Infiltration gives 50% more reputation and money\n
\n Corporations have 50% lower valuations and are therefore less profitable\n
\n Augmentations are more expensive\n
\n Hacking experience gain rates are reduced\n
\n
\n Destroying this BitNode will give you Source-File 5, or if you already have this Source-File it will upgrade its\n level up to a maximum of 3. This Source-File grants you a special new stat called Intelligence. Intelligence is\n unique because it is permanent and persistent (it never gets reset back to 1). However gaining Intelligence\n experience is much slower than other stats, and it is also hidden (you won't know when you gain experience and how\n much). Higher Intelligence levels will boost your production for many actions in the game.
\n
\n In addition, this Source-File will unlock the getBitNodeMultipliers() and getServer() Netscript functions, as well\n as the formulas API, and will also raise all of your hacking-related multipliers by:\n
\n
\n Level 1: 8%\n
\n Level 2: 12%\n
\n Level 3: 14%\n \n ),\n);\nBitNodes[\"BitNode6\"] = new BitNode(\n 6,\n 1,\n \"Bladeburners\",\n \"Like Tears in Rain\",\n (\n <>\n In the middle of the 21st century, OmniTek Incorporated began designing and manufacturing advanced synthetic\n androids, or Synthoids for short. They achieved a major technological breakthrough in the sixth generation of\n their Synthoid design, called MK-VI, by developing a hyperintelligent AI. Many argue that this was the first\n sentient AI ever created. This resulted in Synthoid models that were stronger, faster, and more intelligent than\n the humans that had created them.\n
\n
\n In this BitNode you will be able to access the Bladeburner Division at the NSA, which provides a new mechanic for\n progression. Furthermore:\n
\n
\n Hacking and Hacknet Nodes will be less profitable\n
\n Your hacking level is reduced by 65%\n
\n Hacking experience gain from scripts is reduced by 75%\n
\n Corporations have 80% lower valuations and are therefore less profitable\n
\n Working for companies is 50% less profitable\n
\n Crimes and Infiltration are 25% less profitable\n
\n
\n Destroying this BitNode will give you Source-File 6, or if you already have this Source-File it will upgrade its\n level up to a maximum of 3. This Source-File allows you to access the NSA's Bladeburner Division in other\n BitNodes. In addition, this Source-File will raise both the level and experience gain rate of all your combat\n stats by:\n
\n
\n Level 1: 8%\n
\n Level 2: 12%\n
\n Level 3: 14%\n \n ),\n);\nBitNodes[\"BitNode7\"] = new BitNode(\n 7,\n 2,\n \"Bladeburners 2079\",\n \"More human than humans\",\n (\n <>\n In the middle of the 21st century, you were doing cutting-edge work at OmniTek Incorporated as part of the AI\n design team for advanced synthetic androids, or Synthoids for short. You helped achieve a major technological\n breakthrough in the sixth generation of the company's Synthoid design, called MK-VI, by developing a\n hyperintelligent AI. Many argue that this was the first sentient AI ever created. This resulted in Synthoid models\n that were stronger, faster, and more intelligent than the humans that had created them.\n
\n
\n In this BitNode you will be able to access the Bladeburner API, which allows you to access Bladeburner\n functionality through Netscript. Furthermore:
\n
\n The rank you gain from Bladeburner contracts/operations is reduced by 40%\n
\n Bladeburner skills cost twice as many skill points\n
\n Augmentations are 3x more expensive\n
\n Hacking and Hacknet Nodes will be significantly less profitable\n
\n Your hacking level is reduced by 65%\n
\n Hacking experience gain from scripts is reduced by 75%\n
\n Corporations have 80% lower valuations and are therefore less profitable\n
\n Working for companies is 50% less profitable\n
\n Crimes and Infiltration are 25% less profitable\n
\n
\n Destroying this BitNode will give you Source-File 7, or if you already have this Source-File it will upgrade its\n level up to a maximum of 3. This Source-File allows you to access the Bladeburner Netscript API in other BitNodes.\n In addition, this Source-File will increase all of your Bladeburner multipliers by:\n
\n
\n Level 1: 8%\n
\n Level 2: 12%\n
\n Level 3: 14%\n \n ),\n);\nBitNodes[\"BitNode8\"] = new BitNode(\n 8,\n 2,\n \"Ghost of Wall Street\",\n \"Money never sleeps\",\n (\n <>\n You are trying to make a name for yourself as an up-and-coming hedge fund manager on Wall Street.\n
\n
\n In this BitNode:\n
\n
\n You start with $250 million\n
\n The only way to earn money is by trading on the stock market\n
\n You start with a WSE membership and access to the TIX API\n
\n You are able to short stocks and place different types of orders (limit/stop)\n
\n You can immediately donate to factions to gain reputation\n
\n
\n Destroying this BitNode will give you Source-File 8, or if you already have this Source-File it will upgrade its\n level up to a maximum of 3. This Source-File grants the following benefits:\n
\n
\n Level 1: Permanent access to WSE and TIX API\n
\n Level 2: Ability to short stocks in other BitNodes\n
\n Level 3: Ability to use limit/stop orders in other BitNodes\n
\n
\n This Source-File also increases your hacking growth multipliers by:\n
\n Level 1: 12%\n
\n Level 2: 18%\n
\n Level 3: 21%\n \n ),\n);\nBitNodes[\"BitNode9\"] = new BitNode(\n 9,\n 2,\n \"Hacktocracy\",\n \"Hacknet Unleashed\",\n (\n <>\n When Fulcrum Technologies released their open-source Linux distro Chapeau, it quickly became the OS of choice for\n the underground hacking community. Chapeau became especially notorious for powering the Hacknet, a global,\n decentralized network used for nefarious purposes. Fulcrum quickly abandoned the project and dissociated\n themselves from it.\n
\n
\n This BitNode unlocks the Hacknet Server, an upgraded version of the Hacknet Node. Hacknet Servers generate hashes,\n which can be spent on a variety of different upgrades.\n
\n
\n In this BitNode:\n
\n
\n Your stats are significantly decreased\n
\n You cannnot purchase additional servers\n
\n Hacking is significantly less profitable\n
\n
\n Destroying this BitNode will give you Source-File 9, or if you already have this Source-File it will upgrade its\n level up to a maximum of 3. This Source-File grants the following benefits:\n
\n
\n Level 1: Permanently unlocks the Hacknet Server in other BitNodes\n
\n Level 2: You start with 128GB of RAM on your home computer when entering a new BitNode\n
\n Level 3: Grants a highly-upgraded Hacknet Server when entering a new BitNode\n
\n
\n (Note that the Level 3 effect of this Source-File only applies when entering a new BitNode, NOT when installing\n Augmentations)\n \n ),\n);\nBitNodes[\"BitNode10\"] = new BitNode(\n 10,\n 2,\n \"Digital Carbon\",\n \"Your body is not who you are\",\n (\n <>\n In 2084, VitaLife unveiled to the world the Persona Core, a technology that allowed people to digitize their\n consciousness. Their consciousness could then be transferred into Synthoids or other bodies by trasmitting the\n digitized data. Human bodies became nothing more than 'sleeves' for the human consciousness. Mankind had finally\n achieved immortality - at least for those that could afford it.\n
\n
\n This BitNode unlocks Sleeve technology. Sleeve technology allows you to:\n
\n
\n 1. Re-sleeve: Purchase and transfer your consciousness into a new body\n
\n 2. Duplicate Sleeves: Duplicate your consciousness into Synthoids, allowing you to perform different tasks\n synchronously\n
\n
\n In this BitNode:\n
\n
\n Your stats are significantly decreased\n
\n All methods of gaining money are half as profitable (except Stock Market)\n
\n Purchased servers are more expensive, have less max RAM, and a lower maximum limit\n
\n Augmentations are 5x as expensive and require twice as much reputation\n
\n
\n Destroying this BitNode will give you Source-File 10, or if you already have this Source-File it will upgrade its\n level up to a maximum of 3. This Source-File unlocks Sleeve technology in other BitNodes. Each level of this\n Source-File also grants you a Duplicate Sleeve\n \n ),\n);\nBitNodes[\"BitNode11\"] = new BitNode(\n 11,\n 1,\n \"The Big Crash\",\n \"Okay. Sell it all.\",\n (\n <>\n The 2050s was defined by the massive amounts of violent civil unrest and anarchic rebellion that rose all around\n the world. It was this period of disorder that eventually lead to the governmental reformation of many global\n superpowers, most notably the USA and China. But just as the world was slowly beginning to recover from these dark\n times, financial catastrophe hit.\n
\n
\n In many countries, the high cost of trying to deal with the civil disorder bankrupted the governments. In all of\n this chaos and confusion, hackers were able to steal billions of dollars from the world's largest electronic\n banks, prompting an international banking crisis as governments were unable to bail out insolvent banks. Now, the\n world is slowly crumbling in the middle of the biggest economic crisis of all time.\n
\n
\n In this BitNode:\n
\n
\n Your hacking stat and experience gain are halved\n
\n The starting and maximum amount of money available on servers is significantly decreased\n
\n The growth rate of servers is significantly reduced\n
\n Weakening a server is twice as effective\n
\n Company wages are decreased by 50%\n
\n Corporation valuations are 90% lower and are therefore significantly less profitable\n
\n Hacknet Node production is significantly decreased\n
\n Crime and Infiltration are more lucrative\n
\n Augmentations are twice as expensive\n
\n
\n Destroying this BitNode will give you Source-File 11, or if you already have this Source-File it will upgrade its\n level up to a maximum of 3. This Source-File makes it so that company favor increases BOTH the player's salary and\n reputation gain rate at that company by 1% per favor (rather than just the reputation gain). This Source-File also\n increases the player's company salary and reputation gain multipliers by:\n
\n
\n Level 1: 32%\n
\n Level 2: 48%\n
\n Level 3: 56%\n
\n
\n It also reduces the price increase for every aug bought by:\n
\n
\n Level 1: 4%\n
\n Level 2: 6%\n
\n Level 3: 7%\n \n ),\n);\nBitNodes[\"BitNode12\"] = new BitNode(\n 12,\n 0,\n \"The Recursion\",\n \"Repeat.\",\n (\n <>\n To iterate is human, to recurse divine.\n
\n
\n Every time this BitNode is destroyed, it becomes slightly harder. Destroying this BitNode will give you\n Source-File 12, or if you already have this Source-File it will upgrade its level. There is no maximum level for\n Source-File 12. Each level of Source-File 12 lets you start any BitNodes with NeuroFlux Governor equal to the\n level of this source file.\n \n ),\n);\n// Books: Frontera, Shiner\nBitNodes[\"BitNode13\"] = new BitNode(13, 2, \"fOS\", \"COMING SOON\"); //Unlocks the new game mode and the rest of the BitNodes\nBitNodes[\"BitNode14\"] = new BitNode(14, 2, \"\", \"COMING SOON\");\nBitNodes[\"BitNode15\"] = new BitNode(15, 2, \"\", \"COMING SOON\");\nBitNodes[\"BitNode16\"] = new BitNode(16, 2, \"\", \"COMING SOON\");\nBitNodes[\"BitNode17\"] = new BitNode(17, 2, \"\", \"COMING SOON\");\nBitNodes[\"BitNode18\"] = new BitNode(18, 2, \"\", \"COMING SOON\");\nBitNodes[\"BitNode19\"] = new BitNode(19, 2, \"\", \"COMING SOON\");\nBitNodes[\"BitNode20\"] = new BitNode(20, 2, \"\", \"COMING SOON\");\nBitNodes[\"BitNode21\"] = new BitNode(21, 2, \"\", \"COMING SOON\");\nBitNodes[\"BitNode22\"] = new BitNode(22, 2, \"\", \"COMING SOON\");\nBitNodes[\"BitNode23\"] = new BitNode(23, 2, \"\", \"COMING SOON\");\nBitNodes[\"BitNode24\"] = new BitNode(24, 2, \"\", \"COMING SOON\");\n\nexport function initBitNodeMultipliers(p: IPlayer): void {\n if (p.bitNodeN == null) {\n p.bitNodeN = 1;\n }\n for (const mult in BitNodeMultipliers) {\n if (BitNodeMultipliers.hasOwnProperty(mult)) {\n BitNodeMultipliers[mult] = 1;\n }\n }\n\n switch (p.bitNodeN) {\n case 1: // Source Genesis (every multiplier is 1)\n break;\n case 2: // Rise of the Underworld\n BitNodeMultipliers.HackingLevelMultiplier = 0.8;\n BitNodeMultipliers.ServerGrowthRate = 0.8;\n BitNodeMultipliers.ServerMaxMoney = 0.2;\n BitNodeMultipliers.ServerStartingMoney = 0.4;\n BitNodeMultipliers.CrimeMoney = 3;\n BitNodeMultipliers.InfiltrationMoney = 3;\n BitNodeMultipliers.FactionWorkRepGain = 0.5;\n BitNodeMultipliers.FactionPassiveRepGain = 0;\n BitNodeMultipliers.GangKarmaRequirement = 0;\n break;\n case 3: // Corporatocracy\n BitNodeMultipliers.HackingLevelMultiplier = 0.8;\n BitNodeMultipliers.RepToDonateToFaction = 0.5;\n BitNodeMultipliers.AugmentationRepCost = 3;\n BitNodeMultipliers.AugmentationMoneyCost = 3;\n BitNodeMultipliers.ServerMaxMoney = 0.2;\n BitNodeMultipliers.ServerStartingMoney = 0.2;\n BitNodeMultipliers.ServerGrowthRate = 0.2;\n BitNodeMultipliers.ScriptHackMoney = 0.2;\n BitNodeMultipliers.CompanyWorkMoney = 0.25;\n BitNodeMultipliers.CrimeMoney = 0.25;\n BitNodeMultipliers.HacknetNodeMoney = 0.25;\n BitNodeMultipliers.HomeComputerRamCost = 1.5;\n BitNodeMultipliers.PurchasedServerCost = 2;\n BitNodeMultipliers.GangKarmaRequirement = 3;\n break;\n case 4: // The Singularity\n BitNodeMultipliers.ServerMaxMoney = 0.15;\n BitNodeMultipliers.ServerStartingMoney = 0.75;\n BitNodeMultipliers.ScriptHackMoney = 0.2;\n BitNodeMultipliers.CompanyWorkMoney = 0.1;\n BitNodeMultipliers.CrimeMoney = 0.2;\n BitNodeMultipliers.HacknetNodeMoney = 0.05;\n BitNodeMultipliers.CompanyWorkExpGain = 0.5;\n BitNodeMultipliers.ClassGymExpGain = 0.5;\n BitNodeMultipliers.FactionWorkExpGain = 0.5;\n BitNodeMultipliers.HackExpGain = 0.4;\n BitNodeMultipliers.CrimeExpGain = 0.5;\n BitNodeMultipliers.FactionWorkRepGain = 0.75;\n break;\n case 5: // Artificial intelligence\n BitNodeMultipliers.ServerMaxMoney = 2;\n BitNodeMultipliers.ServerStartingSecurity = 2;\n BitNodeMultipliers.ServerStartingMoney = 0.5;\n BitNodeMultipliers.ScriptHackMoney = 0.15;\n BitNodeMultipliers.HacknetNodeMoney = 0.2;\n BitNodeMultipliers.CrimeMoney = 0.5;\n BitNodeMultipliers.InfiltrationRep = 1.5;\n BitNodeMultipliers.InfiltrationMoney = 1.5;\n BitNodeMultipliers.AugmentationMoneyCost = 2;\n BitNodeMultipliers.HackExpGain = 0.5;\n BitNodeMultipliers.CorporationValuation = 0.5;\n break;\n case 6: // Bladeburner\n BitNodeMultipliers.HackingLevelMultiplier = 0.35;\n BitNodeMultipliers.ServerMaxMoney = 0.4;\n BitNodeMultipliers.ServerStartingMoney = 0.5;\n BitNodeMultipliers.ServerStartingSecurity = 1.5;\n BitNodeMultipliers.ScriptHackMoney = 0.75;\n BitNodeMultipliers.CompanyWorkMoney = 0.5;\n BitNodeMultipliers.CrimeMoney = 0.75;\n BitNodeMultipliers.InfiltrationMoney = 0.75;\n BitNodeMultipliers.CorporationValuation = 0.2;\n BitNodeMultipliers.HacknetNodeMoney = 0.2;\n BitNodeMultipliers.FactionPassiveRepGain = 0;\n BitNodeMultipliers.HackExpGain = 0.25;\n BitNodeMultipliers.DaedalusAugsRequirement = 1.166; // Results in 35 Augs needed\n BitNodeMultipliers.GangKarmaRequirement = 5;\n break;\n case 7: // Bladeburner 2079\n BitNodeMultipliers.BladeburnerRank = 0.6;\n BitNodeMultipliers.BladeburnerSkillCost = 2;\n BitNodeMultipliers.AugmentationMoneyCost = 3;\n BitNodeMultipliers.HackingLevelMultiplier = 0.35;\n BitNodeMultipliers.ServerMaxMoney = 0.4;\n BitNodeMultipliers.ServerStartingMoney = 0.5;\n BitNodeMultipliers.ServerStartingSecurity = 1.5;\n BitNodeMultipliers.ScriptHackMoney = 0.5;\n BitNodeMultipliers.CompanyWorkMoney = 0.5;\n BitNodeMultipliers.CrimeMoney = 0.75;\n BitNodeMultipliers.InfiltrationMoney = 0.75;\n BitNodeMultipliers.CorporationValuation = 0.2;\n BitNodeMultipliers.HacknetNodeMoney = 0.2;\n BitNodeMultipliers.FactionPassiveRepGain = 0;\n BitNodeMultipliers.HackExpGain = 0.25;\n BitNodeMultipliers.FourSigmaMarketDataCost = 2;\n BitNodeMultipliers.FourSigmaMarketDataApiCost = 2;\n BitNodeMultipliers.DaedalusAugsRequirement = 1.166; // Results in 35 Augs needed\n BitNodeMultipliers.GangKarmaRequirement = 5;\n break;\n case 8: // Ghost of Wall Street\n BitNodeMultipliers.ScriptHackMoney = 0.3;\n BitNodeMultipliers.ScriptHackMoneyGain = 0;\n BitNodeMultipliers.ManualHackMoney = 0;\n BitNodeMultipliers.CompanyWorkMoney = 0;\n BitNodeMultipliers.CrimeMoney = 0;\n BitNodeMultipliers.HacknetNodeMoney = 0;\n BitNodeMultipliers.InfiltrationMoney = 0;\n BitNodeMultipliers.RepToDonateToFaction = 0;\n BitNodeMultipliers.CorporationValuation = 0;\n BitNodeMultipliers.CodingContractMoney = 0;\n BitNodeMultipliers.GangKarmaRequirement = 10;\n break;\n case 9: // Hacktocracy\n BitNodeMultipliers.HackingLevelMultiplier = 0.4;\n BitNodeMultipliers.StrengthLevelMultiplier = 0.45;\n BitNodeMultipliers.DefenseLevelMultiplier = 0.45;\n BitNodeMultipliers.DexterityLevelMultiplier = 0.45;\n BitNodeMultipliers.AgilityLevelMultiplier = 0.45;\n BitNodeMultipliers.CharismaLevelMultiplier = 0.45;\n BitNodeMultipliers.PurchasedServerLimit = 0;\n BitNodeMultipliers.HomeComputerRamCost = 5;\n BitNodeMultipliers.CrimeMoney = 0.5;\n BitNodeMultipliers.ScriptHackMoney = 0.1;\n BitNodeMultipliers.HackExpGain = 0.05;\n BitNodeMultipliers.ServerStartingMoney = 0.1;\n BitNodeMultipliers.ServerMaxMoney = 0.1;\n BitNodeMultipliers.ServerStartingSecurity = 2.5;\n BitNodeMultipliers.CorporationValuation = 0.5;\n BitNodeMultipliers.FourSigmaMarketDataCost = 5;\n BitNodeMultipliers.FourSigmaMarketDataApiCost = 4;\n BitNodeMultipliers.BladeburnerRank = 0.9;\n BitNodeMultipliers.BladeburnerSkillCost = 1.2;\n BitNodeMultipliers.GangKarmaRequirement = 3;\n break;\n case 10: // Digital Carbon\n BitNodeMultipliers.HackingLevelMultiplier = 0.2;\n BitNodeMultipliers.StrengthLevelMultiplier = 0.4;\n BitNodeMultipliers.DefenseLevelMultiplier = 0.4;\n BitNodeMultipliers.DexterityLevelMultiplier = 0.4;\n BitNodeMultipliers.AgilityLevelMultiplier = 0.4;\n BitNodeMultipliers.CharismaLevelMultiplier = 0.4;\n BitNodeMultipliers.CompanyWorkMoney = 0.5;\n BitNodeMultipliers.CrimeMoney = 0.5;\n BitNodeMultipliers.HacknetNodeMoney = 0.5;\n BitNodeMultipliers.ManualHackMoney = 0.5;\n BitNodeMultipliers.ScriptHackMoney = 0.5;\n BitNodeMultipliers.CodingContractMoney = 0.5;\n BitNodeMultipliers.InfiltrationMoney = 0.5;\n BitNodeMultipliers.CorporationValuation = 0.5;\n BitNodeMultipliers.AugmentationMoneyCost = 5;\n BitNodeMultipliers.AugmentationRepCost = 2;\n BitNodeMultipliers.HomeComputerRamCost = 1.5;\n BitNodeMultipliers.PurchasedServerCost = 5;\n BitNodeMultipliers.PurchasedServerLimit = 0.6;\n BitNodeMultipliers.PurchasedServerMaxRam = 0.5;\n BitNodeMultipliers.BladeburnerRank = 0.8;\n BitNodeMultipliers.GangKarmaRequirement = 3;\n break;\n case 11: //The Big Crash\n BitNodeMultipliers.HackingLevelMultiplier = 0.5;\n BitNodeMultipliers.HackExpGain = 0.5;\n BitNodeMultipliers.ServerMaxMoney = 0.1;\n BitNodeMultipliers.ServerStartingMoney = 0.1;\n BitNodeMultipliers.ServerGrowthRate = 0.2;\n BitNodeMultipliers.ServerWeakenRate = 2;\n BitNodeMultipliers.CrimeMoney = 3;\n BitNodeMultipliers.CompanyWorkMoney = 0.5;\n BitNodeMultipliers.HacknetNodeMoney = 0.1;\n BitNodeMultipliers.AugmentationMoneyCost = 2;\n BitNodeMultipliers.InfiltrationMoney = 2.5;\n BitNodeMultipliers.InfiltrationRep = 2.5;\n BitNodeMultipliers.CorporationValuation = 0.1;\n BitNodeMultipliers.CodingContractMoney = 0.25;\n BitNodeMultipliers.FourSigmaMarketDataCost = 4;\n BitNodeMultipliers.FourSigmaMarketDataApiCost = 4;\n break;\n case 12: {\n //The Recursion\n let sf12Lvl = 0;\n for (let i = 0; i < p.sourceFiles.length; i++) {\n if (p.sourceFiles[i].n === 12) {\n sf12Lvl = p.sourceFiles[i].lvl;\n }\n }\n const inc = Math.pow(1.02, sf12Lvl);\n const dec = 1 / inc;\n\n // Multiplier for number of augs needed for Daedalus increases\n // up to a maximum of 1.34, which results in 40 Augs required\n BitNodeMultipliers.DaedalusAugsRequirement = Math.min(inc, 1.34);\n\n BitNodeMultipliers.HackingLevelMultiplier = dec;\n BitNodeMultipliers.StrengthLevelMultiplier = dec;\n BitNodeMultipliers.DefenseLevelMultiplier = dec;\n BitNodeMultipliers.DexterityLevelMultiplier = dec;\n BitNodeMultipliers.AgilityLevelMultiplier = dec;\n BitNodeMultipliers.CharismaLevelMultiplier = dec;\n\n BitNodeMultipliers.ServerMaxMoney = dec;\n BitNodeMultipliers.ServerStartingMoney = dec;\n BitNodeMultipliers.ServerGrowthRate = dec;\n BitNodeMultipliers.ServerWeakenRate = dec;\n\n //Does not scale, otherwise security might start at 300+\n BitNodeMultipliers.ServerStartingSecurity = 1.5;\n\n BitNodeMultipliers.HomeComputerRamCost = inc;\n\n BitNodeMultipliers.PurchasedServerCost = inc;\n BitNodeMultipliers.PurchasedServerLimit = dec;\n BitNodeMultipliers.PurchasedServerMaxRam = dec;\n\n BitNodeMultipliers.ManualHackMoney = dec;\n BitNodeMultipliers.ScriptHackMoney = dec;\n BitNodeMultipliers.CompanyWorkMoney = dec;\n BitNodeMultipliers.CrimeMoney = dec;\n BitNodeMultipliers.HacknetNodeMoney = dec;\n BitNodeMultipliers.CodingContractMoney = dec;\n\n BitNodeMultipliers.CompanyWorkExpGain = dec;\n BitNodeMultipliers.ClassGymExpGain = dec;\n BitNodeMultipliers.FactionWorkExpGain = dec;\n BitNodeMultipliers.HackExpGain = dec;\n BitNodeMultipliers.CrimeExpGain = dec;\n\n BitNodeMultipliers.FactionWorkRepGain = dec;\n BitNodeMultipliers.FactionPassiveRepGain = dec;\n BitNodeMultipliers.RepToDonateToFaction = inc;\n\n BitNodeMultipliers.AugmentationRepCost = inc;\n BitNodeMultipliers.AugmentationMoneyCost = inc;\n\n BitNodeMultipliers.InfiltrationMoney = dec;\n BitNodeMultipliers.InfiltrationRep = dec;\n\n BitNodeMultipliers.FourSigmaMarketDataCost = inc;\n BitNodeMultipliers.FourSigmaMarketDataApiCost = inc;\n\n BitNodeMultipliers.CorporationValuation = dec;\n\n BitNodeMultipliers.BladeburnerRank = dec;\n BitNodeMultipliers.BladeburnerSkillCost = inc;\n break;\n }\n default:\n console.warn(\"Player.bitNodeN invalid\");\n break;\n }\n}\n","import { Reviver, Generic_toJSON, Generic_fromJSON } from \"../../utils/JSONReviver\";\nimport { IBladeburner } from \"./IBladeburner\";\nimport { IActionIdentifier } from \"./IActionIdentifier\";\nimport { ActionIdentifier } from \"./ActionIdentifier\";\nimport { ActionTypes } from \"./data/ActionTypes\";\nimport { Growths } from \"./data/Growths\";\nimport { BlackOperations } from \"./BlackOperations\";\nimport { BlackOperation } from \"./BlackOperation\";\nimport { Operation } from \"./Operation\";\nimport { Contract } from \"./Contract\";\nimport { GeneralActions } from \"./GeneralActions\";\nimport { formatNumber } from \"../../utils/StringHelperFunctions\";\nimport { Skills } from \"./Skills\";\nimport { Skill } from \"./Skill\";\nimport { City } from \"./City\";\nimport { IAction } from \"./IAction\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { IRouter } from \"../ui/Router\";\nimport { ConsoleHelpText } from \"./data/Help\";\nimport { exceptionAlert } from \"../../utils/helpers/exceptionAlert\";\nimport { getRandomInt } from \"../../utils/helpers/getRandomInt\";\nimport { BladeburnerConstants } from \"./data/Constants\";\nimport { numeralWrapper } from \"../ui/numeralFormat\";\nimport { BitNodeMultipliers } from \"../BitNode/BitNodeMultipliers\";\nimport { addOffset } from \"../../utils/helpers/addOffset\";\nimport { Faction } from \"../Faction/Faction\";\nimport { Factions, factionExists } from \"../Faction/Factions\";\nimport { calculateHospitalizationCost } from \"../Hospital/Hospital\";\nimport { redPillFlag } from \"../RedPill\";\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\nimport { Settings } from \"../Settings/Settings\";\nimport { Augmentations } from \"../Augmentation/Augmentations\";\nimport { AugmentationNames } from \"../Augmentation/data/AugmentationNames\";\nimport { getTimestamp } from \"../../utils/helpers/getTimestamp\";\nimport { joinFaction } from \"../Faction/FactionHelpers\";\nimport { WorkerScript } from \"../Netscript/WorkerScript\";\n\nexport class Bladeburner implements IBladeburner {\n numHosp = 0;\n moneyLost = 0;\n rank = 0;\n maxRank = 0;\n\n skillPoints = 0;\n totalSkillPoints = 0;\n\n teamSize = 0;\n teamLost = 0;\n hpLost = 0;\n\n storedCycles = 0;\n\n randomEventCounter: number = getRandomInt(240, 600);\n\n actionTimeToComplete = 0;\n actionTimeCurrent = 0;\n actionTimeOverflow = 0;\n\n action: IActionIdentifier = new ActionIdentifier({\n type: ActionTypes[\"Idle\"],\n });\n\n cities: any = {};\n city: string = BladeburnerConstants.CityNames[2];\n skills: any = {};\n skillMultipliers: any = {};\n staminaBonus = 0;\n maxStamina = 0;\n stamina = 0;\n contracts: any = {};\n operations: any = {};\n blackops: any = {};\n logging: any = {\n general: true,\n contracts: true,\n ops: true,\n blackops: true,\n events: true,\n };\n automateEnabled = false;\n automateActionHigh: IActionIdentifier = new ActionIdentifier({\n type: ActionTypes[\"Idle\"],\n });\n automateThreshHigh = 0;\n automateActionLow: IActionIdentifier = new ActionIdentifier({\n type: ActionTypes[\"Idle\"],\n });\n automateThreshLow = 0;\n consoleHistory: string[] = [];\n consoleLogs: string[] = [\"Bladeburner Console\", \"Type 'help' to see console commands\"];\n\n constructor(player?: IPlayer) {\n for (let i = 0; i < BladeburnerConstants.CityNames.length; ++i) {\n this.cities[BladeburnerConstants.CityNames[i]] = new City(BladeburnerConstants.CityNames[i]);\n }\n\n this.updateSkillMultipliers(); // Calls resetSkillMultipliers()\n\n // Max Stamina is based on stats and Bladeburner-specific bonuses\n if (player) this.calculateMaxStamina(player);\n this.stamina = this.maxStamina;\n this.create();\n }\n\n getCurrentCity(): City {\n const city = this.cities[this.city];\n if (!(city instanceof City)) {\n throw new Error(\"Bladeburner.getCurrentCity() did not properly return a City object\");\n }\n return city;\n }\n\n calculateStaminaPenalty(): number {\n return Math.min(1, this.stamina / (0.5 * this.maxStamina));\n }\n\n startAction(player: IPlayer, actionId: IActionIdentifier): void {\n if (actionId == null) return;\n this.action = actionId;\n this.actionTimeCurrent = 0;\n switch (actionId.type) {\n case ActionTypes[\"Idle\"]:\n this.actionTimeToComplete = 0;\n break;\n case ActionTypes[\"Contract\"]:\n try {\n const action = this.getActionObject(actionId);\n if (action == null) {\n throw new Error(\"Failed to get Contract Object for: \" + actionId.name);\n }\n if (action.count < 1) {\n return this.resetAction();\n }\n this.actionTimeToComplete = action.getActionTime(this);\n } catch (e) {\n exceptionAlert(e);\n }\n break;\n case ActionTypes[\"Operation\"]: {\n try {\n const action = this.getActionObject(actionId);\n if (action == null) {\n throw new Error(\"Failed to get Operation Object for: \" + actionId.name);\n }\n if (action.count < 1) {\n return this.resetAction();\n }\n if (actionId.name === \"Raid\" && this.getCurrentCity().commsEst === 0) {\n return this.resetAction();\n }\n this.actionTimeToComplete = action.getActionTime(this);\n } catch (e) {\n exceptionAlert(e);\n }\n break;\n }\n case ActionTypes[\"BlackOp\"]:\n case ActionTypes[\"BlackOperation\"]: {\n try {\n // Safety measure - don't repeat BlackOps that are already done\n if (this.blackops[actionId.name] != null) {\n this.resetAction();\n this.log(\"Error: Tried to start a Black Operation that had already been completed\");\n break;\n }\n\n const action = this.getActionObject(actionId);\n if (action == null) {\n throw new Error(\"Failed to get BlackOperation object for: \" + actionId.name);\n }\n this.actionTimeToComplete = action.getActionTime(this);\n } catch (e) {\n exceptionAlert(e);\n }\n break;\n }\n case ActionTypes[\"Recruitment\"]:\n this.actionTimeToComplete = this.getRecruitmentTime(player);\n break;\n case ActionTypes[\"Training\"]:\n case ActionTypes[\"FieldAnalysis\"]:\n case ActionTypes[\"Field Analysis\"]:\n this.actionTimeToComplete = 30;\n break;\n case ActionTypes[\"Diplomacy\"]:\n case ActionTypes[\"Hyperbolic Regeneration Chamber\"]:\n this.actionTimeToComplete = 60;\n break;\n default:\n throw new Error(\"Invalid Action Type in startAction(Bladeburner,player, ): \" + actionId.type);\n break;\n }\n }\n\n upgradeSkill(skill: Skill): void {\n // This does NOT handle deduction of skill points\n const skillName = skill.name;\n if (this.skills[skillName]) {\n ++this.skills[skillName];\n } else {\n this.skills[skillName] = 1;\n }\n if (isNaN(this.skills[skillName]) || this.skills[skillName] < 0) {\n throw new Error(\"Level of Skill \" + skillName + \" is invalid: \" + this.skills[skillName]);\n }\n this.updateSkillMultipliers();\n }\n\n executeConsoleCommands(player: IPlayer, commands: string): void {\n try {\n // Console History\n if (this.consoleHistory[this.consoleHistory.length - 1] != commands) {\n this.consoleHistory.push(commands);\n if (this.consoleHistory.length > 50) {\n this.consoleHistory.splice(0, 1);\n }\n }\n\n const arrayOfCommands = commands.split(\";\");\n for (let i = 0; i < arrayOfCommands.length; ++i) {\n this.executeConsoleCommand(player, arrayOfCommands[i]);\n }\n } catch (e) {\n exceptionAlert(e);\n }\n }\n\n postToConsole(input: string, saveToLogs = true): void {\n const MaxConsoleEntries = 100;\n if (saveToLogs) {\n this.consoleLogs.push(input);\n if (this.consoleLogs.length > MaxConsoleEntries) {\n this.consoleLogs.shift();\n }\n }\n }\n\n log(input: string): void {\n // Adds a timestamp and then just calls postToConsole\n this.postToConsole(`[${getTimestamp()}] ${input}`);\n }\n\n resetAction(): void {\n this.action = new ActionIdentifier({ type: ActionTypes.Idle });\n }\n\n clearConsole(): void {\n this.consoleLogs.length = 0;\n }\n\n prestige(): void {\n this.resetAction();\n const bladeburnerFac = Factions[\"Bladeburners\"];\n if (this.rank >= BladeburnerConstants.RankNeededForFaction) {\n joinFaction(bladeburnerFac);\n }\n }\n\n storeCycles(numCycles = 0): void {\n this.storedCycles += numCycles;\n }\n\n // working on\n getActionIdFromTypeAndName(type = \"\", name = \"\"): IActionIdentifier | null {\n if (type === \"\" || name === \"\") {\n return null;\n }\n const action = new ActionIdentifier();\n const convertedType = type.toLowerCase().trim();\n const convertedName = name.toLowerCase().trim();\n switch (convertedType) {\n case \"contract\":\n case \"contracts\":\n case \"contr\":\n action.type = ActionTypes[\"Contract\"];\n if (this.contracts.hasOwnProperty(name)) {\n action.name = name;\n return action;\n } else {\n return null;\n }\n break;\n case \"operation\":\n case \"operations\":\n case \"op\":\n case \"ops\":\n action.type = ActionTypes[\"Operation\"];\n if (this.operations.hasOwnProperty(name)) {\n action.name = name;\n return action;\n } else {\n return null;\n }\n break;\n case \"blackoperation\":\n case \"black operation\":\n case \"black operations\":\n case \"black op\":\n case \"black ops\":\n case \"blackop\":\n case \"blackops\":\n action.type = ActionTypes[\"BlackOp\"];\n if (BlackOperations.hasOwnProperty(name)) {\n action.name = name;\n return action;\n } else {\n return null;\n }\n break;\n case \"general\":\n case \"general action\":\n case \"gen\":\n break;\n default:\n return null;\n }\n\n if (convertedType.startsWith(\"gen\")) {\n switch (convertedName) {\n case \"training\":\n action.type = ActionTypes[\"Training\"];\n action.name = \"Training\";\n break;\n case \"recruitment\":\n case \"recruit\":\n action.type = ActionTypes[\"Recruitment\"];\n action.name = \"Recruitment\";\n break;\n case \"field analysis\":\n case \"fieldanalysis\":\n action.type = ActionTypes[\"Field Analysis\"];\n action.name = \"Field Analysis\";\n break;\n case \"diplomacy\":\n action.type = ActionTypes[\"Diplomacy\"];\n action.name = \"Diplomacy\";\n break;\n case \"hyperbolic regeneration chamber\":\n action.type = ActionTypes[\"Hyperbolic Regeneration Chamber\"];\n action.name = \"Hyperbolic Regeneration Chamber\";\n break;\n default:\n return null;\n }\n return action;\n }\n\n return null;\n }\n\n executeStartConsoleCommand(player: IPlayer, args: string[]): void {\n if (args.length !== 3) {\n this.postToConsole(\"Invalid usage of 'start' console command: start [type] [name]\");\n this.postToConsole(\"Use 'help start' for more info\");\n return;\n }\n const name = args[2];\n switch (args[1].toLowerCase()) {\n case \"general\":\n case \"gen\":\n if (GeneralActions[name] != null) {\n this.action.type = ActionTypes[name];\n this.action.name = name;\n this.startAction(player, this.action);\n } else {\n this.postToConsole(\"Invalid action name specified: \" + args[2]);\n }\n break;\n case \"contract\":\n case \"contracts\":\n if (this.contracts[name] != null) {\n this.action.type = ActionTypes.Contract;\n this.action.name = name;\n this.startAction(player, this.action);\n } else {\n this.postToConsole(\"Invalid contract name specified: \" + args[2]);\n }\n break;\n case \"ops\":\n case \"op\":\n case \"operations\":\n case \"operation\":\n if (this.operations[name] != null) {\n this.action.type = ActionTypes.Operation;\n this.action.name = name;\n this.startAction(player, this.action);\n } else {\n this.postToConsole(\"Invalid Operation name specified: \" + args[2]);\n }\n break;\n case \"blackops\":\n case \"blackop\":\n case \"black operations\":\n case \"black operation\":\n if (BlackOperations[name] != null) {\n this.action.type = ActionTypes.BlackOperation;\n this.action.name = name;\n this.startAction(player, this.action);\n } else {\n this.postToConsole(\"Invalid BlackOp name specified: \" + args[2]);\n }\n break;\n default:\n this.postToConsole(\"Invalid action/event type specified: \" + args[1]);\n this.postToConsole(\"Examples of valid action/event identifiers are: [general, contract, op, blackop]\");\n break;\n }\n }\n\n executeSkillConsoleCommand(args: string[]): void {\n switch (args.length) {\n case 1: {\n // Display Skill Help Command\n this.postToConsole(\"Invalid usage of 'skill' console command: skill [action] [name]\");\n this.postToConsole(\"Use 'help skill' for more info\");\n break;\n }\n case 2: {\n if (args[1].toLowerCase() === \"list\") {\n // List all skills and their level\n this.postToConsole(\"Skills: \");\n const skillNames = Object.keys(Skills);\n for (let i = 0; i < skillNames.length; ++i) {\n const skill = Skills[skillNames[i]];\n let level = 0;\n if (this.skills[skill.name] != null) {\n level = this.skills[skill.name];\n }\n this.postToConsole(skill.name + \": Level \" + formatNumber(level, 0));\n }\n this.postToConsole(\" \");\n this.postToConsole(\"Effects: \");\n const multKeys = Object.keys(this.skillMultipliers);\n for (let i = 0; i < multKeys.length; ++i) {\n let mult = this.skillMultipliers[multKeys[i]];\n if (mult && mult !== 1) {\n mult = formatNumber(mult, 3);\n switch (multKeys[i]) {\n case \"successChanceAll\":\n this.postToConsole(\"Total Success Chance: x\" + mult);\n break;\n case \"successChanceStealth\":\n this.postToConsole(\"Stealth Success Chance: x\" + mult);\n break;\n case \"successChanceKill\":\n this.postToConsole(\"Retirement Success Chance: x\" + mult);\n break;\n case \"successChanceContract\":\n this.postToConsole(\"Contract Success Chance: x\" + mult);\n break;\n case \"successChanceOperation\":\n this.postToConsole(\"Operation Success Chance: x\" + mult);\n break;\n case \"successChanceEstimate\":\n this.postToConsole(\"Synthoid Data Estimate: x\" + mult);\n break;\n case \"actionTime\":\n this.postToConsole(\"Action Time: x\" + mult);\n break;\n case \"effHack\":\n this.postToConsole(\"Hacking Skill: x\" + mult);\n break;\n case \"effStr\":\n this.postToConsole(\"Strength: x\" + mult);\n break;\n case \"effDef\":\n this.postToConsole(\"Defense: x\" + mult);\n break;\n case \"effDex\":\n this.postToConsole(\"Dexterity: x\" + mult);\n break;\n case \"effAgi\":\n this.postToConsole(\"Agility: x\" + mult);\n break;\n case \"effCha\":\n this.postToConsole(\"Charisma: x\" + mult);\n break;\n case \"effInt\":\n this.postToConsole(\"Intelligence: x\" + mult);\n break;\n case \"stamina\":\n this.postToConsole(\"Stamina: x\" + mult);\n break;\n default:\n console.warn(`Unrecognized SkillMult Key: ${multKeys[i]}`);\n break;\n }\n }\n }\n } else {\n this.postToConsole(\"Invalid usage of 'skill' console command: skill [action] [name]\");\n this.postToConsole(\"Use 'help skill' for more info\");\n }\n break;\n }\n case 3: {\n const skillName = args[2];\n const skill = Skills[skillName];\n if (skill == null || !(skill instanceof Skill)) {\n this.postToConsole(\"Invalid skill name (Note that it is case-sensitive): \" + skillName);\n }\n if (args[1].toLowerCase() === \"list\") {\n let level = 0;\n if (this.skills[skill.name] !== undefined) {\n level = this.skills[skill.name];\n }\n this.postToConsole(skill.name + \": Level \" + formatNumber(level));\n } else if (args[1].toLowerCase() === \"level\") {\n let currentLevel = 0;\n if (this.skills[skillName] && !isNaN(this.skills[skillName])) {\n currentLevel = this.skills[skillName];\n }\n const pointCost = skill.calculateCost(currentLevel);\n if (this.skillPoints >= pointCost) {\n this.skillPoints -= pointCost;\n this.upgradeSkill(skill);\n this.log(skill.name + \" upgraded to Level \" + this.skills[skillName]);\n } else {\n this.postToConsole(\n \"You do not have enough Skill Points to upgrade this. You need \" + formatNumber(pointCost, 0),\n );\n }\n } else {\n this.postToConsole(\"Invalid usage of 'skill' console command: skill [action] [name]\");\n this.postToConsole(\"Use 'help skill' for more info\");\n }\n break;\n }\n default: {\n this.postToConsole(\"Invalid usage of 'skill' console command: skill [action] [name]\");\n this.postToConsole(\"Use 'help skill' for more info\");\n break;\n }\n }\n }\n\n executeLogConsoleCommand(args: string[]): void {\n if (args.length < 3) {\n this.postToConsole(\"Invalid usage of log command: log [enable/disable] [action/event]\");\n this.postToConsole(\"Use 'help log' for more details and examples\");\n return;\n }\n\n let flag = true;\n if (args[1].toLowerCase().includes(\"d\")) {\n flag = false;\n } // d for disable\n\n switch (args[2].toLowerCase()) {\n case \"general\":\n case \"gen\":\n this.logging.general = flag;\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for general actions\");\n break;\n case \"contract\":\n case \"contracts\":\n this.logging.contracts = flag;\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for Contracts\");\n break;\n case \"ops\":\n case \"op\":\n case \"operations\":\n case \"operation\":\n this.logging.ops = flag;\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for Operations\");\n break;\n case \"blackops\":\n case \"blackop\":\n case \"black operations\":\n case \"black operation\":\n this.logging.blackops = flag;\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for BlackOps\");\n break;\n case \"event\":\n case \"events\":\n this.logging.events = flag;\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for events\");\n break;\n case \"all\":\n this.logging.general = flag;\n this.logging.contracts = flag;\n this.logging.ops = flag;\n this.logging.blackops = flag;\n this.logging.events = flag;\n this.log(\"Logging \" + (flag ? \"enabled\" : \"disabled\") + \" for everything\");\n break;\n default:\n this.postToConsole(\"Invalid action/event type specified: \" + args[2]);\n this.postToConsole(\n \"Examples of valid action/event identifiers are: [general, contracts, ops, blackops, events]\",\n );\n break;\n }\n }\n\n executeHelpConsoleCommand(args: string[]): void {\n if (args.length === 1) {\n for (const line of ConsoleHelpText.helpList) {\n this.postToConsole(line);\n }\n } else {\n for (let i = 1; i < args.length; ++i) {\n if (!(args[i] in ConsoleHelpText)) continue;\n const helpText = ConsoleHelpText[args[i]];\n for (const line of helpText) {\n this.postToConsole(line);\n }\n }\n }\n }\n\n executeAutomateConsoleCommand(args: string[]): void {\n if (args.length !== 2 && args.length !== 4) {\n this.postToConsole(\n \"Invalid use of 'automate' command: automate [var] [val] [hi/low]. Use 'help automate' for more info\",\n );\n return;\n }\n\n // Enable/Disable\n if (args.length === 2) {\n const flag = args[1];\n if (flag.toLowerCase() === \"status\") {\n this.postToConsole(\"Automation: \" + (this.automateEnabled ? \"enabled\" : \"disabled\"));\n this.postToConsole(\n \"When your stamina drops to \" +\n formatNumber(this.automateThreshLow, 0) +\n \", you will automatically switch to \" +\n this.automateActionLow.name +\n \". When your stamina recovers to \" +\n formatNumber(this.automateThreshHigh, 0) +\n \", you will automatically \" +\n \"switch to \" +\n this.automateActionHigh.name +\n \".\",\n );\n } else if (flag.toLowerCase().includes(\"en\")) {\n if (\n !(this.automateActionLow instanceof ActionIdentifier) ||\n !(this.automateActionHigh instanceof ActionIdentifier)\n ) {\n return this.log(\"Failed to enable automation. Actions were not set\");\n }\n this.automateEnabled = true;\n this.log(\"Bladeburner automation enabled\");\n } else if (flag.toLowerCase().includes(\"d\")) {\n this.automateEnabled = false;\n this.log(\"Bladeburner automation disabled\");\n } else {\n this.log(\"Invalid argument for 'automate' console command: \" + args[1]);\n }\n return;\n }\n\n // Set variables\n if (args.length === 4) {\n const variable = args[1];\n const val = args[2];\n\n let highLow = false; // True for high, false for low\n if (args[3].toLowerCase().includes(\"hi\")) {\n highLow = true;\n }\n\n switch (variable) {\n case \"general\":\n case \"gen\":\n if (GeneralActions[val] != null) {\n const action = new ActionIdentifier({\n type: ActionTypes[val],\n name: val,\n });\n if (highLow) {\n this.automateActionHigh = action;\n } else {\n this.automateActionLow = action;\n }\n this.log(\"Automate (\" + (highLow ? \"HIGH\" : \"LOW\") + \") action set to \" + val);\n } else {\n this.postToConsole(\"Invalid action name specified: \" + val);\n }\n break;\n case \"contract\":\n case \"contracts\":\n if (this.contracts[val] != null) {\n const action = new ActionIdentifier({\n type: ActionTypes.Contract,\n name: val,\n });\n if (highLow) {\n this.automateActionHigh = action;\n } else {\n this.automateActionLow = action;\n }\n this.log(\"Automate (\" + (highLow ? \"HIGH\" : \"LOW\") + \") action set to \" + val);\n } else {\n this.postToConsole(\"Invalid contract name specified: \" + val);\n }\n break;\n case \"ops\":\n case \"op\":\n case \"operations\":\n case \"operation\":\n if (this.operations[val] != null) {\n const action = new ActionIdentifier({\n type: ActionTypes.Operation,\n name: val,\n });\n if (highLow) {\n this.automateActionHigh = action;\n } else {\n this.automateActionLow = action;\n }\n this.log(\"Automate (\" + (highLow ? \"HIGH\" : \"LOW\") + \") action set to \" + val);\n } else {\n this.postToConsole(\"Invalid Operation name specified: \" + val);\n }\n break;\n case \"stamina\":\n if (isNaN(parseFloat(val))) {\n this.postToConsole(\"Invalid value specified for stamina threshold (must be numeric): \" + val);\n } else {\n if (highLow) {\n this.automateThreshHigh = Number(val);\n } else {\n this.automateThreshLow = Number(val);\n }\n this.log(\"Automate (\" + (highLow ? \"HIGH\" : \"LOW\") + \") stamina threshold set to \" + val);\n }\n break;\n default:\n break;\n }\n\n return;\n }\n }\n\n parseCommandArguments(command: string): string[] {\n /**\n * Returns an array with command and its arguments in each index.\n * e.g. skill \"blade's intuition\" foo returns [skill, blade's intuition, foo]\n * The input to the fn will be trimmed and will have all whitespace replaced w/ a single space\n */\n const args = [];\n let start = 0;\n let i = 0;\n while (i < command.length) {\n const c = command.charAt(i);\n if (c === '\"') {\n // Double quotes\n const endQuote = command.indexOf('\"', i + 1);\n if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === \" \")) {\n args.push(command.substr(i + 1, endQuote - i - 1));\n if (endQuote === command.length - 1) {\n start = i = endQuote + 1;\n } else {\n start = i = endQuote + 2; // Skip the space\n }\n continue;\n }\n } else if (c === \"'\") {\n // Single quotes, same thing as above\n const endQuote = command.indexOf(\"'\", i + 1);\n if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === \" \")) {\n args.push(command.substr(i + 1, endQuote - i - 1));\n if (endQuote === command.length - 1) {\n start = i = endQuote + 1;\n } else {\n start = i = endQuote + 2; // Skip the space\n }\n continue;\n }\n } else if (c === \" \") {\n args.push(command.substr(start, i - start));\n start = i + 1;\n }\n ++i;\n }\n if (start !== i) {\n args.push(command.substr(start, i - start));\n }\n return args;\n }\n\n executeConsoleCommand(player: IPlayer, command: string): void {\n command = command.trim();\n command = command.replace(/\\s\\s+/g, \" \"); // Replace all whitespace w/ a single space\n\n const args = this.parseCommandArguments(command);\n if (args.length <= 0) return; // Log an error?\n\n switch (args[0].toLowerCase()) {\n case \"automate\":\n this.executeAutomateConsoleCommand(args);\n break;\n case \"clear\":\n case \"cls\":\n this.clearConsole();\n break;\n case \"help\":\n this.executeHelpConsoleCommand(args);\n break;\n case \"log\":\n this.executeLogConsoleCommand(args);\n break;\n case \"skill\":\n this.executeSkillConsoleCommand(args);\n break;\n case \"start\":\n this.executeStartConsoleCommand(player, args);\n break;\n case \"stop\":\n this.resetAction();\n break;\n default:\n this.postToConsole(\"Invalid console command\");\n break;\n }\n }\n\n triggerMigration(sourceCityName: string): void {\n let destCityName = BladeburnerConstants.CityNames[getRandomInt(0, 5)];\n while (destCityName === sourceCityName) {\n destCityName = BladeburnerConstants.CityNames[getRandomInt(0, 5)];\n }\n const destCity = this.cities[destCityName];\n const sourceCity = this.cities[sourceCityName];\n if (destCity == null || sourceCity == null) {\n throw new Error(\"Failed to find City with name: \" + destCityName);\n }\n const rand = Math.random();\n let percentage = getRandomInt(3, 15) / 100;\n\n if (rand < 0.05 && sourceCity.comms > 0) {\n // 5% chance for community migration\n percentage *= getRandomInt(2, 4); // Migration increases population change\n --sourceCity.comms;\n ++destCity.comms;\n }\n const count = Math.round(sourceCity.pop * percentage);\n sourceCity.pop -= count;\n destCity.pop += count;\n }\n\n triggerPotentialMigration(sourceCityName: string, chance: number): void {\n if (chance == null || isNaN(chance)) {\n console.error(\"Invalid 'chance' parameter passed into Bladeburner.triggerPotentialMigration()\");\n }\n if (chance > 1) {\n chance /= 100;\n }\n if (Math.random() < chance) {\n this.triggerMigration(sourceCityName);\n }\n }\n\n randomEvent(): void {\n const chance = Math.random();\n\n // Choose random source/destination city for events\n const sourceCityName = BladeburnerConstants.CityNames[getRandomInt(0, 5)];\n const sourceCity = this.cities[sourceCityName];\n if (!(sourceCity instanceof City)) {\n throw new Error(\"sourceCity was not a City object in Bladeburner.randomEvent()\");\n }\n\n let destCityName = BladeburnerConstants.CityNames[getRandomInt(0, 5)];\n while (destCityName === sourceCityName) {\n destCityName = BladeburnerConstants.CityNames[getRandomInt(0, 5)];\n }\n const destCity = this.cities[destCityName];\n\n if (!(sourceCity instanceof City) || !(destCity instanceof City)) {\n throw new Error(\"sourceCity/destCity was not a City object in Bladeburner.randomEvent()\");\n }\n\n if (chance <= 0.05) {\n // New Synthoid Community, 5%\n ++sourceCity.comms;\n const percentage = getRandomInt(10, 20) / 100;\n const count = Math.round(sourceCity.pop * percentage);\n sourceCity.pop += count;\n if (this.logging.events) {\n this.log(\"Intelligence indicates that a new Synthoid community was formed in a city\");\n }\n } else if (chance <= 0.1) {\n // Synthoid Community Migration, 5%\n if (sourceCity.comms <= 0) {\n // If no comms in source city, then instead trigger a new Synthoid community event\n ++sourceCity.comms;\n const percentage = getRandomInt(10, 20) / 100;\n const count = Math.round(sourceCity.pop * percentage);\n sourceCity.pop += count;\n if (this.logging.events) {\n this.log(\"Intelligence indicates that a new Synthoid community was formed in a city\");\n }\n } else {\n --sourceCity.comms;\n ++destCity.comms;\n\n // Change pop\n const percentage = getRandomInt(10, 20) / 100;\n const count = Math.round(sourceCity.pop * percentage);\n sourceCity.pop -= count;\n destCity.pop += count;\n\n if (this.logging.events) {\n this.log(\n \"Intelligence indicates that a Synthoid community migrated from \" + sourceCityName + \" to some other city\",\n );\n }\n }\n } else if (chance <= 0.3) {\n // New Synthoids (non community), 20%\n const percentage = getRandomInt(8, 24) / 100;\n const count = Math.round(sourceCity.pop * percentage);\n sourceCity.pop += count;\n if (this.logging.events) {\n this.log(\n \"Intelligence indicates that the Synthoid population of \" + sourceCityName + \" just changed significantly\",\n );\n }\n } else if (chance <= 0.5) {\n // Synthoid migration (non community) 20%\n this.triggerMigration(sourceCityName);\n if (this.logging.events) {\n this.log(\n \"Intelligence indicates that a large number of Synthoids migrated from \" +\n sourceCityName +\n \" to some other city\",\n );\n }\n } else if (chance <= 0.7) {\n // Synthoid Riots (+chaos), 20%\n sourceCity.chaos += 1;\n sourceCity.chaos *= 1 + getRandomInt(5, 20) / 100;\n if (this.logging.events) {\n this.log(\"Tensions between Synthoids and humans lead to riots in \" + sourceCityName + \"! Chaos increased\");\n }\n } else if (chance <= 0.9) {\n // Less Synthoids, 20%\n const percentage = getRandomInt(8, 20) / 100;\n const count = Math.round(sourceCity.pop * percentage);\n sourceCity.pop -= count;\n if (this.logging.events) {\n this.log(\n \"Intelligence indicates that the Synthoid population of \" + sourceCityName + \" just changed significantly\",\n );\n }\n }\n // 10% chance of nothing happening\n }\n\n /**\n * Process stat gains from Contracts, Operations, and Black Operations\n * @param action(Action obj) - Derived action class\n * @param success(bool) - Whether action was successful\n */\n gainActionStats(player: IPlayer, action: IAction, success: boolean): void {\n const difficulty = action.getDifficulty();\n\n /**\n * Gain multiplier based on difficulty. If it changes then the\n * same variable calculated in completeAction() needs to change too\n */\n const difficultyMult =\n Math.pow(difficulty, BladeburnerConstants.DiffMultExponentialFactor) +\n difficulty / BladeburnerConstants.DiffMultLinearFactor;\n\n const time = this.actionTimeToComplete;\n const successMult = success ? 1 : 0.5;\n\n const unweightedGain = time * BladeburnerConstants.BaseStatGain * successMult * difficultyMult;\n const unweightedIntGain = time * BladeburnerConstants.BaseIntGain * successMult * difficultyMult;\n const skillMult = this.skillMultipliers.expGain;\n player.gainHackingExp(unweightedGain * action.weights.hack * player.hacking_exp_mult * skillMult);\n player.gainStrengthExp(unweightedGain * action.weights.str * player.strength_exp_mult * skillMult);\n player.gainDefenseExp(unweightedGain * action.weights.def * player.defense_exp_mult * skillMult);\n player.gainDexterityExp(unweightedGain * action.weights.dex * player.dexterity_exp_mult * skillMult);\n player.gainAgilityExp(unweightedGain * action.weights.agi * player.agility_exp_mult * skillMult);\n player.gainCharismaExp(unweightedGain * action.weights.cha * player.charisma_exp_mult * skillMult);\n let intExp = unweightedIntGain * action.weights.int * skillMult;\n if (intExp > 1) {\n intExp = Math.pow(intExp, 0.8);\n }\n player.gainIntelligenceExp(intExp);\n }\n\n getDiplomacyEffectiveness(player: IPlayer): number {\n // Returns a decimal by which the city's chaos level should be multiplied (e.g. 0.98)\n const CharismaLinearFactor = 1e3;\n const CharismaExponentialFactor = 0.045;\n\n const charismaEff = Math.pow(player.charisma, CharismaExponentialFactor) + player.charisma / CharismaLinearFactor;\n return (100 - charismaEff) / 100;\n }\n\n getRecruitmentSuccessChance(player: IPlayer): number {\n return Math.pow(player.charisma, 0.45) / (this.teamSize + 1);\n }\n\n getRecruitmentTime(player: IPlayer): number {\n const effCharisma = player.charisma * this.skillMultipliers.effCha;\n const charismaFactor = Math.pow(effCharisma, 0.81) + effCharisma / 90;\n return Math.max(10, Math.round(BladeburnerConstants.BaseRecruitmentTimeNeeded - charismaFactor));\n }\n\n resetSkillMultipliers(): void {\n this.skillMultipliers = {\n successChanceAll: 1,\n successChanceStealth: 1,\n successChanceKill: 1,\n successChanceContract: 1,\n successChanceOperation: 1,\n successChanceEstimate: 1,\n actionTime: 1,\n effHack: 1,\n effStr: 1,\n effDef: 1,\n effDex: 1,\n effAgi: 1,\n effCha: 1,\n effInt: 1,\n stamina: 1,\n money: 1,\n expGain: 1,\n };\n }\n\n updateSkillMultipliers(): void {\n this.resetSkillMultipliers();\n for (const skillName in this.skills) {\n if (this.skills.hasOwnProperty(skillName)) {\n const skill = Skills[skillName];\n if (skill == null) {\n throw new Error(\"Could not find Skill Object for: \" + skillName);\n }\n const level = this.skills[skillName];\n if (level == null || level <= 0) {\n continue;\n } //Not upgraded\n\n const multiplierNames = Object.keys(this.skillMultipliers);\n for (let i = 0; i < multiplierNames.length; ++i) {\n const multiplierName = multiplierNames[i];\n if (skill.getMultiplier(multiplierName) != null && !isNaN(skill.getMultiplier(multiplierName))) {\n const value = skill.getMultiplier(multiplierName) * level;\n let multiplierValue = 1 + value / 100;\n if (multiplierName === \"actionTime\") {\n multiplierValue = 1 - value / 100;\n }\n this.skillMultipliers[multiplierName] *= multiplierValue;\n }\n }\n }\n }\n }\n\n completeOperation(success: boolean): void {\n if (this.action.type !== ActionTypes.Operation) {\n throw new Error(\"completeOperation() called even though current action is not an Operation\");\n }\n const action = this.getActionObject(this.action);\n if (action == null) {\n throw new Error(\"Failed to get Contract/Operation Object for: \" + this.action.name);\n }\n\n // Calculate team losses\n const teamCount = action.teamCount;\n if (teamCount >= 1) {\n let max;\n if (success) {\n max = Math.ceil(teamCount / 2);\n } else {\n max = Math.floor(teamCount);\n }\n const losses = getRandomInt(0, max);\n this.teamSize -= losses;\n this.teamLost += losses;\n if (this.logging.ops && losses > 0) {\n this.log(\"Lost \" + formatNumber(losses, 0) + \" team members during this \" + action.name);\n }\n }\n\n const city = this.getCurrentCity();\n switch (action.name) {\n case \"Investigation\":\n if (success) {\n city.improvePopulationEstimateByPercentage(0.4 * this.skillMultipliers.successChanceEstimate);\n if (Math.random() < 0.02 * this.skillMultipliers.successChanceEstimate) {\n city.improveCommunityEstimate(1);\n }\n } else {\n this.triggerPotentialMigration(this.city, 0.1);\n }\n break;\n case \"Undercover Operation\":\n if (success) {\n city.improvePopulationEstimateByPercentage(0.8 * this.skillMultipliers.successChanceEstimate);\n if (Math.random() < 0.02 * this.skillMultipliers.successChanceEstimate) {\n city.improveCommunityEstimate(1);\n }\n } else {\n this.triggerPotentialMigration(this.city, 0.15);\n }\n break;\n case \"Sting Operation\":\n if (success) {\n city.changePopulationByPercentage(-0.1, {\n changeEstEqually: true,\n nonZero: true,\n });\n }\n city.changeChaosByCount(0.1);\n break;\n case \"Raid\":\n if (success) {\n city.changePopulationByPercentage(-1, {\n changeEstEqually: true,\n nonZero: true,\n });\n --city.comms;\n --city.commsEst;\n } else {\n const change = getRandomInt(-10, -5) / 10;\n city.changePopulationByPercentage(change, {\n nonZero: true,\n changeEstEqually: false,\n });\n }\n city.changeChaosByPercentage(getRandomInt(1, 5));\n break;\n case \"Stealth Retirement Operation\":\n if (success) {\n city.changePopulationByPercentage(-0.5, {\n changeEstEqually: true,\n nonZero: true,\n });\n }\n city.changeChaosByPercentage(getRandomInt(-3, -1));\n break;\n case \"Assassination\":\n if (success) {\n city.changePopulationByCount(-1, { estChange: -1, estOffset: 0 });\n }\n city.changeChaosByPercentage(getRandomInt(-5, 5));\n break;\n default:\n throw new Error(\"Invalid Action name in completeOperation: \" + this.action.name);\n }\n }\n\n getActionObject(actionId: IActionIdentifier): IAction | null {\n /**\n * Given an ActionIdentifier object, returns the corresponding\n * GeneralAction, Contract, Operation, or BlackOperation object\n */\n switch (actionId.type) {\n case ActionTypes[\"Contract\"]:\n return this.contracts[actionId.name];\n case ActionTypes[\"Operation\"]:\n return this.operations[actionId.name];\n case ActionTypes[\"BlackOp\"]:\n case ActionTypes[\"BlackOperation\"]:\n return BlackOperations[actionId.name];\n case ActionTypes[\"Training\"]:\n return GeneralActions[\"Training\"];\n case ActionTypes[\"Field Analysis\"]:\n return GeneralActions[\"Field Analysis\"];\n case ActionTypes[\"Recruitment\"]:\n return GeneralActions[\"Recruitment\"];\n case ActionTypes[\"Diplomacy\"]:\n return GeneralActions[\"Diplomacy\"];\n case ActionTypes[\"Hyperbolic Regeneration Chamber\"]:\n return GeneralActions[\"Hyperbolic Regeneration Chamber\"];\n default:\n return null;\n }\n }\n\n completeContract(success: boolean): void {\n if (this.action.type !== ActionTypes.Contract) {\n throw new Error(\"completeContract() called even though current action is not a Contract\");\n }\n const city = this.getCurrentCity();\n if (success) {\n switch (this.action.name) {\n case \"Tracking\":\n // Increase estimate accuracy by a relatively small amount\n city.improvePopulationEstimateByCount(getRandomInt(100, 1e3));\n break;\n case \"Bounty Hunter\":\n city.changePopulationByCount(-1, { estChange: -1, estOffset: 0 });\n city.changeChaosByCount(0.02);\n break;\n case \"Retirement\":\n city.changePopulationByCount(-1, { estChange: -1, estOffset: 0 });\n city.changeChaosByCount(0.04);\n break;\n default:\n throw new Error(\"Invalid Action name in completeContract: \" + this.action.name);\n }\n }\n }\n\n completeAction(router: IRouter, player: IPlayer): void {\n switch (this.action.type) {\n case ActionTypes[\"Contract\"]:\n case ActionTypes[\"Operation\"]: {\n try {\n const isOperation = this.action.type === ActionTypes[\"Operation\"];\n const action = this.getActionObject(this.action);\n if (action == null) {\n throw new Error(\"Failed to get Contract/Operation Object for: \" + this.action.name);\n }\n const difficulty = action.getDifficulty();\n const difficultyMultiplier =\n Math.pow(difficulty, BladeburnerConstants.DiffMultExponentialFactor) +\n difficulty / BladeburnerConstants.DiffMultLinearFactor;\n const rewardMultiplier = Math.pow(action.rewardFac, action.level - 1);\n\n // Stamina loss is based on difficulty\n this.stamina -= BladeburnerConstants.BaseStaminaLoss * difficultyMultiplier;\n if (this.stamina < 0) {\n this.stamina = 0;\n }\n\n // Process Contract/Operation success/failure\n if (action.attempt(this)) {\n this.gainActionStats(player, action, true);\n ++action.successes;\n --action.count;\n\n // Earn money for contracts\n let moneyGain = 0;\n if (!isOperation) {\n moneyGain = BladeburnerConstants.ContractBaseMoneyGain * rewardMultiplier * this.skillMultipliers.money;\n player.gainMoney(moneyGain);\n player.recordMoneySource(moneyGain, \"bladeburner\");\n }\n\n if (isOperation) {\n action.setMaxLevel(BladeburnerConstants.OperationSuccessesPerLevel);\n } else {\n action.setMaxLevel(BladeburnerConstants.ContractSuccessesPerLevel);\n }\n if (action.rankGain) {\n const gain = addOffset(action.rankGain * rewardMultiplier * BitNodeMultipliers.BladeburnerRank, 10);\n this.changeRank(player, gain);\n if (isOperation && this.logging.ops) {\n this.log(action.name + \" successfully completed! Gained \" + formatNumber(gain, 3) + \" rank\");\n } else if (!isOperation && this.logging.contracts) {\n this.log(\n action.name +\n \" contract successfully completed! Gained \" +\n formatNumber(gain, 3) +\n \" rank and \" +\n numeralWrapper.formatMoney(moneyGain),\n );\n }\n }\n isOperation ? this.completeOperation(true) : this.completeContract(true);\n } else {\n this.gainActionStats(player, action, false);\n ++action.failures;\n let loss = 0,\n damage = 0;\n if (action.rankLoss) {\n loss = addOffset(action.rankLoss * rewardMultiplier, 10);\n this.changeRank(player, -1 * loss);\n }\n if (action.hpLoss) {\n damage = action.hpLoss * difficultyMultiplier;\n damage = Math.ceil(addOffset(damage, 10));\n this.hpLost += damage;\n const cost = calculateHospitalizationCost(player, damage);\n if (player.takeDamage(damage)) {\n ++this.numHosp;\n this.moneyLost += cost;\n }\n }\n let logLossText = \"\";\n if (loss > 0) {\n logLossText += \"Lost \" + formatNumber(loss, 3) + \" rank. \";\n }\n if (damage > 0) {\n logLossText += \"Took \" + formatNumber(damage, 0) + \" damage.\";\n }\n if (isOperation && this.logging.ops) {\n this.log(action.name + \" failed! \" + logLossText);\n } else if (!isOperation && this.logging.contracts) {\n this.log(action.name + \" contract failed! \" + logLossText);\n }\n isOperation ? this.completeOperation(false) : this.completeContract(false);\n }\n if (action.autoLevel) {\n action.level = action.maxLevel;\n } // Autolevel\n this.startAction(player, this.action); // Repeat action\n } catch (e) {\n exceptionAlert(e);\n }\n break;\n }\n case ActionTypes[\"BlackOp\"]:\n case ActionTypes[\"BlackOperation\"]: {\n try {\n const action = this.getActionObject(this.action);\n if (action == null || !(action instanceof BlackOperation)) {\n throw new Error(\"Failed to get BlackOperation Object for: \" + this.action.name);\n }\n const difficulty = action.getDifficulty();\n const difficultyMultiplier =\n Math.pow(difficulty, BladeburnerConstants.DiffMultExponentialFactor) +\n difficulty / BladeburnerConstants.DiffMultLinearFactor;\n\n // Stamina loss is based on difficulty\n this.stamina -= BladeburnerConstants.BaseStaminaLoss * difficultyMultiplier;\n if (this.stamina < 0) {\n this.stamina = 0;\n }\n\n // Team loss variables\n const teamCount = action.teamCount;\n let teamLossMax;\n\n if (action.attempt(this)) {\n this.gainActionStats(player, action, true);\n action.count = 0;\n this.blackops[action.name] = true;\n let rankGain = 0;\n if (action.rankGain) {\n rankGain = addOffset(action.rankGain * BitNodeMultipliers.BladeburnerRank, 10);\n this.changeRank(player, rankGain);\n }\n teamLossMax = Math.ceil(teamCount / 2);\n\n // Operation Daedalus\n if (action.name === \"Operation Daedalus\") {\n this.resetAction();\n return router.toBitVerse(false, false);\n }\n\n if (this.logging.blackops) {\n this.log(action.name + \" successful! Gained \" + formatNumber(rankGain, 1) + \" rank\");\n }\n } else {\n this.gainActionStats(player, action, false);\n let rankLoss = 0;\n let damage = 0;\n if (action.rankLoss) {\n rankLoss = addOffset(action.rankLoss, 10);\n this.changeRank(player, -1 * rankLoss);\n }\n if (action.hpLoss) {\n damage = action.hpLoss * difficultyMultiplier;\n damage = Math.ceil(addOffset(damage, 10));\n const cost = calculateHospitalizationCost(player, damage);\n if (player.takeDamage(damage)) {\n ++this.numHosp;\n this.moneyLost += cost;\n }\n }\n teamLossMax = Math.floor(teamCount);\n\n if (this.logging.blackops) {\n this.log(\n action.name +\n \" failed! Lost \" +\n formatNumber(rankLoss, 1) +\n \" rank and took \" +\n formatNumber(damage, 0) +\n \" damage\",\n );\n }\n }\n\n this.resetAction(); // Stop regardless of success or fail\n\n // Calculate team lossses\n if (teamCount >= 1) {\n const losses = getRandomInt(1, teamLossMax);\n this.teamSize -= losses;\n this.teamLost += losses;\n if (this.logging.blackops) {\n this.log(\"You lost \" + formatNumber(losses, 0) + \" team members during \" + action.name);\n }\n }\n } catch (e) {\n exceptionAlert(e);\n }\n break;\n }\n case ActionTypes[\"Training\"]: {\n this.stamina -= 0.5 * BladeburnerConstants.BaseStaminaLoss;\n const strExpGain = 30 * player.strength_exp_mult,\n defExpGain = 30 * player.defense_exp_mult,\n dexExpGain = 30 * player.dexterity_exp_mult,\n agiExpGain = 30 * player.agility_exp_mult,\n staminaGain = 0.04 * this.skillMultipliers.stamina;\n player.gainStrengthExp(strExpGain);\n player.gainDefenseExp(defExpGain);\n player.gainDexterityExp(dexExpGain);\n player.gainAgilityExp(agiExpGain);\n this.staminaBonus += staminaGain;\n if (this.logging.general) {\n this.log(\n \"Training completed. Gained: \" +\n formatNumber(strExpGain, 1) +\n \" str exp, \" +\n formatNumber(defExpGain, 1) +\n \" def exp, \" +\n formatNumber(dexExpGain, 1) +\n \" dex exp, \" +\n formatNumber(agiExpGain, 1) +\n \" agi exp, \" +\n formatNumber(staminaGain, 3) +\n \" max stamina\",\n );\n }\n this.startAction(player, this.action); // Repeat action\n break;\n }\n case ActionTypes[\"FieldAnalysis\"]:\n case ActionTypes[\"Field Analysis\"]: {\n // Does not use stamina. Effectiveness depends on hacking, int, and cha\n let eff =\n 0.04 * Math.pow(player.hacking_skill, 0.3) +\n 0.04 * Math.pow(player.intelligence, 0.9) +\n 0.02 * Math.pow(player.charisma, 0.3);\n eff *= player.bladeburner_analysis_mult;\n if (isNaN(eff) || eff < 0) {\n throw new Error(\"Field Analysis Effectiveness calculated to be NaN or negative\");\n }\n const hackingExpGain = 20 * player.hacking_exp_mult,\n charismaExpGain = 20 * player.charisma_exp_mult;\n player.gainHackingExp(hackingExpGain);\n player.gainIntelligenceExp(BladeburnerConstants.BaseIntGain);\n player.gainCharismaExp(charismaExpGain);\n this.changeRank(player, 0.1 * BitNodeMultipliers.BladeburnerRank);\n this.getCurrentCity().improvePopulationEstimateByPercentage(eff * this.skillMultipliers.successChanceEstimate);\n if (this.logging.general) {\n this.log(\n \"Field analysis completed. Gained 0.1 rank, \" +\n formatNumber(hackingExpGain, 1) +\n \" hacking exp, and \" +\n formatNumber(charismaExpGain, 1) +\n \" charisma exp\",\n );\n }\n this.startAction(player, this.action); // Repeat action\n break;\n }\n case ActionTypes[\"Recruitment\"]: {\n const successChance = this.getRecruitmentSuccessChance(player);\n if (Math.random() < successChance) {\n const expGain = 2 * BladeburnerConstants.BaseStatGain * this.actionTimeToComplete;\n player.gainCharismaExp(expGain);\n ++this.teamSize;\n if (this.logging.general) {\n this.log(\"Successfully recruited a team member! Gained \" + formatNumber(expGain, 1) + \" charisma exp\");\n }\n } else {\n const expGain = BladeburnerConstants.BaseStatGain * this.actionTimeToComplete;\n player.gainCharismaExp(expGain);\n if (this.logging.general) {\n this.log(\"Failed to recruit a team member. Gained \" + formatNumber(expGain, 1) + \" charisma exp\");\n }\n }\n this.startAction(player, this.action); // Repeat action\n break;\n }\n case ActionTypes[\"Diplomacy\"]: {\n const eff = this.getDiplomacyEffectiveness(player);\n this.getCurrentCity().chaos *= eff;\n if (this.getCurrentCity().chaos < 0) {\n this.getCurrentCity().chaos = 0;\n }\n if (this.logging.general) {\n this.log(\n `Diplomacy completed. Chaos levels in the current city fell by ${numeralWrapper.formatPercentage(1 - eff)}`,\n );\n }\n this.startAction(player, this.action); // Repeat Action\n break;\n }\n case ActionTypes[\"Hyperbolic Regeneration Chamber\"]: {\n player.regenerateHp(BladeburnerConstants.HrcHpGain);\n\n const staminaGain = this.maxStamina * (BladeburnerConstants.HrcStaminaGain / 100);\n this.stamina = Math.min(this.maxStamina, this.stamina + staminaGain);\n this.startAction(player, this.action);\n if (this.logging.general) {\n this.log(\n `Rested in Hyperbolic Regeneration Chamber. Restored ${\n BladeburnerConstants.HrcHpGain\n } HP and gained ${numeralWrapper.formatStamina(staminaGain)} stamina`,\n );\n }\n break;\n }\n default:\n console.error(`Bladeburner.completeAction() called for invalid action: ${this.action.type}`);\n break;\n }\n }\n\n changeRank(player: IPlayer, change: number): void {\n if (isNaN(change)) {\n throw new Error(\"NaN passed into Bladeburner.changeRank()\");\n }\n this.rank += change;\n if (this.rank < 0) {\n this.rank = 0;\n }\n this.maxRank = Math.max(this.rank, this.maxRank);\n\n const bladeburnersFactionName = \"Bladeburners\";\n if (factionExists(bladeburnersFactionName)) {\n const bladeburnerFac = Factions[bladeburnersFactionName];\n if (!(bladeburnerFac instanceof Faction)) {\n throw new Error(\"Could not properly get Bladeburner Faction object in Bladeburner UI Overview Faction button\");\n }\n if (bladeburnerFac.isMember) {\n const favorBonus = 1 + bladeburnerFac.favor / 100;\n bladeburnerFac.playerReputation +=\n BladeburnerConstants.RankToFactionRepFactor * change * player.faction_rep_mult * favorBonus;\n }\n }\n\n // Gain skill points\n const rankNeededForSp = (this.totalSkillPoints + 1) * BladeburnerConstants.RanksPerSkillPoint;\n if (this.maxRank >= rankNeededForSp) {\n // Calculate how many skill points to gain\n const gainedSkillPoints = Math.floor(\n (this.maxRank - rankNeededForSp) / BladeburnerConstants.RanksPerSkillPoint + 1,\n );\n this.skillPoints += gainedSkillPoints;\n this.totalSkillPoints += gainedSkillPoints;\n }\n }\n\n processAction(router: IRouter, player: IPlayer, seconds: number): void {\n if (this.action.type === ActionTypes[\"Idle\"]) return;\n if (this.actionTimeToComplete <= 0) {\n throw new Error(`Invalid actionTimeToComplete value: ${this.actionTimeToComplete}, type; ${this.action.type}`);\n }\n if (!(this.action instanceof ActionIdentifier)) {\n throw new Error(\"Bladeburner.action is not an ActionIdentifier Object\");\n }\n\n // If the previous action went past its completion time, add to the next action\n // This is not added inmediatly in case the automation changes the action\n this.actionTimeCurrent += seconds + this.actionTimeOverflow;\n this.actionTimeOverflow = 0;\n if (this.actionTimeCurrent >= this.actionTimeToComplete) {\n this.actionTimeOverflow = this.actionTimeCurrent - this.actionTimeToComplete;\n return this.completeAction(router, player);\n }\n }\n\n calculateStaminaGainPerSecond(player: IPlayer): number {\n const effAgility = player.agility * this.skillMultipliers.effAgi;\n const maxStaminaBonus = this.maxStamina / BladeburnerConstants.MaxStaminaToGainFactor;\n const gain = (BladeburnerConstants.StaminaGainPerSecond + maxStaminaBonus) * Math.pow(effAgility, 0.17);\n return gain * (this.skillMultipliers.stamina * player.bladeburner_stamina_gain_mult);\n }\n\n calculateMaxStamina(player: IPlayer): void {\n const effAgility = player.agility * this.skillMultipliers.effAgi;\n const maxStamina =\n (Math.pow(effAgility, 0.8) + this.staminaBonus) *\n this.skillMultipliers.stamina *\n player.bladeburner_max_stamina_mult;\n if (this.maxStamina !== maxStamina) {\n const oldMax = this.maxStamina;\n this.maxStamina = maxStamina;\n this.stamina = (this.maxStamina * this.stamina) / oldMax;\n }\n if (isNaN(maxStamina)) {\n throw new Error(\"Max Stamina calculated to be NaN in Bladeburner.calculateMaxStamina()\");\n }\n }\n\n create(): void {\n this.contracts[\"Tracking\"] = new Contract({\n name: \"Tracking\",\n desc:\n \"Identify and locate Synthoids. This contract involves reconnaissance \" +\n \"and information-gathering ONLY. Do NOT engage. Stealth is of the utmost importance.

\" +\n \"Successfully completing Tracking contracts will slightly improve your Synthoid population estimate for \" +\n \"whatever city you are currently in.\",\n baseDifficulty: 125,\n difficultyFac: 1.02,\n rewardFac: 1.041,\n rankGain: 0.3,\n hpLoss: 0.5,\n count: getRandomInt(25, 150),\n weights: {\n hack: 0,\n str: 0.05,\n def: 0.05,\n dex: 0.35,\n agi: 0.35,\n cha: 0.1,\n int: 0.05,\n },\n decays: {\n hack: 0,\n str: 0.91,\n def: 0.91,\n dex: 0.91,\n agi: 0.91,\n cha: 0.9,\n int: 1,\n },\n isStealth: true,\n });\n this.contracts[\"Bounty Hunter\"] = new Contract({\n name: \"Bounty Hunter\",\n desc:\n \"Hunt down and capture fugitive Synthoids. These Synthoids are wanted alive.

\" +\n \"Successfully completing a Bounty Hunter contract will lower the population in your \" +\n \"current city, and will also increase its chaos level.\",\n baseDifficulty: 250,\n difficultyFac: 1.04,\n rewardFac: 1.085,\n rankGain: 0.9,\n hpLoss: 1,\n count: getRandomInt(5, 150),\n weights: {\n hack: 0,\n str: 0.15,\n def: 0.15,\n dex: 0.25,\n agi: 0.25,\n cha: 0.1,\n int: 0.1,\n },\n decays: {\n hack: 0,\n str: 0.91,\n def: 0.91,\n dex: 0.91,\n agi: 0.91,\n cha: 0.8,\n int: 0.9,\n },\n isKill: true,\n });\n this.contracts[\"Retirement\"] = new Contract({\n name: \"Retirement\",\n desc:\n \"Hunt down and retire (kill) rogue Synthoids.

\" +\n \"Successfully completing a Retirement contract will lower the population in your current \" +\n \"city, and will also increase its chaos level.\",\n baseDifficulty: 200,\n difficultyFac: 1.03,\n rewardFac: 1.065,\n rankGain: 0.6,\n hpLoss: 1,\n count: getRandomInt(5, 150),\n weights: {\n hack: 0,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0.1,\n int: 0.1,\n },\n decays: {\n hack: 0,\n str: 0.91,\n def: 0.91,\n dex: 0.91,\n agi: 0.91,\n cha: 0.8,\n int: 0.9,\n },\n isKill: true,\n });\n\n this.operations[\"Investigation\"] = new Operation({\n name: \"Investigation\",\n desc:\n \"As a field agent, investigate and identify Synthoid \" +\n \"populations, movements, and operations.

Successful \" +\n \"Investigation ops will increase the accuracy of your \" +\n \"synthoid data.

\" +\n \"You will NOT lose HP from failed Investigation ops.\",\n baseDifficulty: 400,\n difficultyFac: 1.03,\n rewardFac: 1.07,\n reqdRank: 25,\n rankGain: 2.2,\n rankLoss: 0.2,\n count: getRandomInt(1, 100),\n weights: {\n hack: 0.25,\n str: 0.05,\n def: 0.05,\n dex: 0.2,\n agi: 0.1,\n cha: 0.25,\n int: 0.1,\n },\n decays: {\n hack: 0.85,\n str: 0.9,\n def: 0.9,\n dex: 0.9,\n agi: 0.9,\n cha: 0.7,\n int: 0.9,\n },\n isStealth: true,\n });\n this.operations[\"Undercover Operation\"] = new Operation({\n name: \"Undercover Operation\",\n desc:\n \"Conduct undercover operations to identify hidden \" +\n \"and underground Synthoid communities and organizations.

\" +\n \"Successful Undercover ops will increase the accuracy of your synthoid \" +\n \"data.\",\n baseDifficulty: 500,\n difficultyFac: 1.04,\n rewardFac: 1.09,\n reqdRank: 100,\n rankGain: 4.4,\n rankLoss: 0.4,\n hpLoss: 2,\n count: getRandomInt(1, 100),\n weights: {\n hack: 0.2,\n str: 0.05,\n def: 0.05,\n dex: 0.2,\n agi: 0.2,\n cha: 0.2,\n int: 0.1,\n },\n decays: {\n hack: 0.8,\n str: 0.9,\n def: 0.9,\n dex: 0.9,\n agi: 0.9,\n cha: 0.7,\n int: 0.9,\n },\n isStealth: true,\n });\n this.operations[\"Sting Operation\"] = new Operation({\n name: \"Sting Operation\",\n desc: \"Conduct a sting operation to bait and capture particularly \" + \"notorious Synthoid criminals.\",\n baseDifficulty: 650,\n difficultyFac: 1.04,\n rewardFac: 1.095,\n reqdRank: 500,\n rankGain: 5.5,\n rankLoss: 0.5,\n hpLoss: 2.5,\n count: getRandomInt(1, 150),\n weights: {\n hack: 0.25,\n str: 0.05,\n def: 0.05,\n dex: 0.25,\n agi: 0.1,\n cha: 0.2,\n int: 0.1,\n },\n decays: {\n hack: 0.8,\n str: 0.85,\n def: 0.85,\n dex: 0.85,\n agi: 0.85,\n cha: 0.7,\n int: 0.9,\n },\n isStealth: true,\n });\n this.operations[\"Raid\"] = new Operation({\n name: \"Raid\",\n desc:\n \"Lead an assault on a known Synthoid community. Note that \" +\n \"there must be an existing Synthoid community in your current city \" +\n \"in order for this Operation to be successful.\",\n baseDifficulty: 800,\n difficultyFac: 1.045,\n rewardFac: 1.1,\n reqdRank: 3000,\n rankGain: 55,\n rankLoss: 2.5,\n hpLoss: 50,\n count: getRandomInt(1, 150),\n weights: {\n hack: 0.1,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.7,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.9,\n },\n isKill: true,\n });\n this.operations[\"Stealth Retirement Operation\"] = new Operation({\n name: \"Stealth Retirement Operation\",\n desc:\n \"Lead a covert operation to retire Synthoids. The \" +\n \"objective is to complete the task without \" +\n \"drawing any attention. Stealth and discretion are key.\",\n baseDifficulty: 1000,\n difficultyFac: 1.05,\n rewardFac: 1.11,\n reqdRank: 20e3,\n rankGain: 22,\n rankLoss: 2,\n hpLoss: 10,\n count: getRandomInt(1, 150),\n weights: {\n hack: 0.1,\n str: 0.1,\n def: 0.1,\n dex: 0.3,\n agi: 0.3,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.7,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.9,\n },\n isStealth: true,\n isKill: true,\n });\n this.operations[\"Assassination\"] = new Operation({\n name: \"Assassination\",\n desc:\n \"Assassinate Synthoids that have been identified as \" +\n \"important, high-profile social and political leaders \" +\n \"in the Synthoid communities.\",\n baseDifficulty: 1500,\n difficultyFac: 1.06,\n rewardFac: 1.14,\n reqdRank: 50e3,\n rankGain: 44,\n rankLoss: 4,\n hpLoss: 5,\n count: getRandomInt(1, 150),\n weights: {\n hack: 0.1,\n str: 0.1,\n def: 0.1,\n dex: 0.3,\n agi: 0.3,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.8,\n },\n isStealth: true,\n isKill: true,\n });\n }\n\n process(router: IRouter, player: IPlayer): void {\n // Edge case condition...if Operation Daedalus is complete trigger the BitNode\n if (redPillFlag === false && this.blackops.hasOwnProperty(\"Operation Daedalus\")) {\n return router.toBitVerse(false, false);\n }\n\n // If the Player starts doing some other actions, set action to idle and alert\n if (Augmentations[AugmentationNames.BladesSimulacrum].owned === false && player.isWorking) {\n if (this.action.type !== ActionTypes[\"Idle\"]) {\n let msg = \"Your Bladeburner action was cancelled because you started doing something else.\";\n if (this.automateEnabled) {\n msg += `

Your automation was disabled as well. You will have to re-enable it through the Bladeburner console`;\n this.automateEnabled = false;\n }\n if (!Settings.SuppressBladeburnerPopup) {\n dialogBoxCreate(msg);\n }\n }\n this.resetAction();\n }\n\n // If the Player has no Stamina, set action to idle\n if (this.stamina <= 0) {\n this.log(\"Your Bladeburner action was cancelled because your stamina hit 0\");\n this.resetAction();\n }\n\n // A 'tick' for this mechanic is one second (= 5 game cycles)\n if (this.storedCycles >= BladeburnerConstants.CyclesPerSecond) {\n let seconds = Math.floor(this.storedCycles / BladeburnerConstants.CyclesPerSecond);\n seconds = Math.min(seconds, 5); // Max of 5 'ticks'\n this.storedCycles -= seconds * BladeburnerConstants.CyclesPerSecond;\n\n // Stamina\n this.calculateMaxStamina(player);\n this.stamina += this.calculateStaminaGainPerSecond(player) * seconds;\n this.stamina = Math.min(this.maxStamina, this.stamina);\n\n // Count increase for contracts/operations\n for (const contract of Object.values(this.contracts) as Contract[]) {\n const growthF = Growths[contract.name];\n if (growthF === undefined) throw new Error(`growth formula for action '${contract.name}' is undefined`);\n contract.count += (seconds * growthF()) / BladeburnerConstants.ActionCountGrowthPeriod;\n }\n for (const op of Object.values(this.operations) as Operation[]) {\n const growthF = Growths[op.name];\n if (growthF === undefined) throw new Error(`growth formula for action '${op.name}' is undefined`);\n if (growthF !== undefined) {\n op.count += (seconds * growthF()) / BladeburnerConstants.ActionCountGrowthPeriod;\n }\n }\n\n // Chaos goes down very slowly\n for (const cityName of BladeburnerConstants.CityNames) {\n const city = this.cities[cityName];\n if (!(city instanceof City)) {\n throw new Error(\"Invalid City object when processing passive chaos reduction in Bladeburner.process\");\n }\n city.chaos -= 0.0001 * seconds;\n city.chaos = Math.max(0, city.chaos);\n }\n\n // Random Events\n this.randomEventCounter -= seconds;\n if (this.randomEventCounter <= 0) {\n this.randomEvent();\n // Add instead of setting because we might have gone over the required time for the event\n this.randomEventCounter += getRandomInt(240, 600);\n }\n\n this.processAction(router, player, seconds);\n\n // Automation\n if (this.automateEnabled) {\n // Note: Do NOT set this.action = this.automateActionHigh/Low since it creates a reference\n if (this.stamina <= this.automateThreshLow) {\n if (this.action.name !== this.automateActionLow.name || this.action.type !== this.automateActionLow.type) {\n this.action = new ActionIdentifier({\n type: this.automateActionLow.type,\n name: this.automateActionLow.name,\n });\n this.startAction(player, this.action);\n }\n } else if (this.stamina >= this.automateThreshHigh) {\n if (this.action.name !== this.automateActionHigh.name || this.action.type !== this.automateActionHigh.type) {\n this.action = new ActionIdentifier({\n type: this.automateActionHigh.type,\n name: this.automateActionHigh.name,\n });\n this.startAction(player, this.action);\n }\n }\n }\n }\n }\n\n getTypeAndNameFromActionId(actionId: IActionIdentifier): {\n type: string;\n name: string;\n } {\n const res = { type: \"\", name: \"\" };\n const types = Object.keys(ActionTypes);\n for (let i = 0; i < types.length; ++i) {\n if (actionId.type === ActionTypes[types[i]]) {\n res.type = types[i];\n break;\n }\n }\n if (res.type == null) {\n res.type = \"Idle\";\n }\n\n res.name = actionId.name != null ? actionId.name : \"Idle\";\n return res;\n }\n\n getContractNamesNetscriptFn(): string[] {\n return Object.keys(this.contracts);\n }\n\n getOperationNamesNetscriptFn(): string[] {\n return Object.keys(this.operations);\n }\n\n getBlackOpNamesNetscriptFn(): string[] {\n return Object.keys(BlackOperations);\n }\n\n getGeneralActionNamesNetscriptFn(): string[] {\n return Object.keys(GeneralActions);\n }\n\n getSkillNamesNetscriptFn(): string[] {\n return Object.keys(Skills);\n }\n\n startActionNetscriptFn(player: IPlayer, type: string, name: string, workerScript: WorkerScript): boolean {\n const errorLogText = `Invalid action: type='${type}' name='${name}'`;\n const actionId = this.getActionIdFromTypeAndName(type, name);\n if (actionId == null) {\n workerScript.log(\"bladeburner.startAction\", errorLogText);\n return false;\n }\n\n // Special logic for Black Ops\n if (actionId.type === ActionTypes[\"BlackOp\"]) {\n // Can't start a BlackOp if you don't have the required rank\n const action = this.getActionObject(actionId);\n if (action == null) throw new Error(`Action not found ${actionId.type}, ${actionId.name}`);\n if (!(action instanceof BlackOperation)) throw new Error(`Action should be BlackOperation but isn't`);\n //const blackOp = (action as BlackOperation);\n if (action.reqdRank > this.rank) {\n workerScript.log(\"bladeburner.startAction\", `Insufficient rank to start Black Op '${actionId.name}'.`);\n return false;\n }\n\n // Can't start a BlackOp if its already been done\n if (this.blackops[actionId.name] != null) {\n workerScript.log(\"bladeburner.startAction\", `Black Op ${actionId.name} has already been completed.`);\n return false;\n }\n\n // Can't start a BlackOp if you haven't done the one before it\n const blackops = [];\n for (const nm in BlackOperations) {\n if (BlackOperations.hasOwnProperty(nm)) {\n blackops.push(nm);\n }\n }\n blackops.sort(function (a, b) {\n return BlackOperations[a].reqdRank - BlackOperations[b].reqdRank; // Sort black ops in intended order\n });\n\n const i = blackops.indexOf(actionId.name);\n if (i === -1) {\n workerScript.log(\"bladeburner.startAction\", `Invalid Black Op: '${name}'`);\n return false;\n }\n\n if (i > 0 && this.blackops[blackops[i - 1]] == null) {\n workerScript.log(\n \"bladeburner.startAction\",\n `Preceding Black Op must be completed before starting '${actionId.name}'.`,\n );\n return false;\n }\n }\n\n try {\n this.startAction(player, actionId);\n workerScript.log(\"bladeburner.startAction\", `Starting bladeburner action with type '${type}' and name ${name}\"`);\n return true;\n } catch (e) {\n this.resetAction();\n workerScript.log(\"bladeburner.startAction\", errorLogText);\n return false;\n }\n }\n\n getActionTimeNetscriptFn(player: IPlayer, type: string, name: string, workerScript: WorkerScript): number {\n const errorLogText = `Invalid action: type='${type}' name='${name}'`;\n const actionId = this.getActionIdFromTypeAndName(type, name);\n if (actionId == null) {\n workerScript.log(\"bladeburner.getActionTime\", errorLogText);\n return -1;\n }\n\n const actionObj = this.getActionObject(actionId);\n if (actionObj == null) {\n workerScript.log(\"bladeburner.getActionTime\", errorLogText);\n return -1;\n }\n\n switch (actionId.type) {\n case ActionTypes[\"Contract\"]:\n case ActionTypes[\"Operation\"]:\n case ActionTypes[\"BlackOp\"]:\n case ActionTypes[\"BlackOperation\"]:\n return actionObj.getActionTime(this);\n case ActionTypes[\"Training\"]:\n case ActionTypes[\"Field Analysis\"]:\n case ActionTypes[\"FieldAnalysis\"]:\n return 30;\n case ActionTypes[\"Recruitment\"]:\n return this.getRecruitmentTime(player);\n case ActionTypes[\"Diplomacy\"]:\n case ActionTypes[\"Hyperbolic Regeneration Chamber\"]:\n return 60;\n default:\n workerScript.log(\"bladeburner.getActionTime\", errorLogText);\n return -1;\n }\n }\n\n getActionEstimatedSuccessChanceNetscriptFn(\n player: IPlayer,\n type: string,\n name: string,\n workerScript: WorkerScript,\n ): number[] {\n const errorLogText = `Invalid action: type='${type}' name='${name}'`;\n const actionId = this.getActionIdFromTypeAndName(type, name);\n if (actionId == null) {\n workerScript.log(\"bladeburner.getActionEstimatedSuccessChance\", errorLogText);\n return [-1, -1];\n }\n\n const actionObj = this.getActionObject(actionId);\n if (actionObj == null) {\n workerScript.log(\"bladeburner.getActionEstimatedSuccessChance\", errorLogText);\n return [-1, -1];\n }\n\n switch (actionId.type) {\n case ActionTypes[\"Contract\"]:\n case ActionTypes[\"Operation\"]:\n case ActionTypes[\"BlackOp\"]:\n case ActionTypes[\"BlackOperation\"]:\n return actionObj.getEstSuccessChance(this);\n case ActionTypes[\"Training\"]:\n case ActionTypes[\"Field Analysis\"]:\n case ActionTypes[\"FieldAnalysis\"]:\n case ActionTypes[\"Diplomacy\"]:\n case ActionTypes[\"Hyperbolic Regeneration Chamber\"]:\n return [1, 1];\n case ActionTypes[\"Recruitment\"]: {\n const recChance = this.getRecruitmentSuccessChance(player);\n return [recChance, recChance];\n }\n default:\n workerScript.log(\"bladeburner.getActionEstimatedSuccessChance\", errorLogText);\n return [-1, -1];\n }\n }\n\n getActionCountRemainingNetscriptFn(type: string, name: string, workerScript: WorkerScript): number {\n const errorLogText = `Invalid action: type='${type}' name='${name}'`;\n const actionId = this.getActionIdFromTypeAndName(type, name);\n if (actionId == null) {\n workerScript.log(\"bladeburner.getActionCountRemaining\", errorLogText);\n return -1;\n }\n\n const actionObj = this.getActionObject(actionId);\n if (actionObj == null) {\n workerScript.log(\"bladeburner.getActionCountRemaining\", errorLogText);\n return -1;\n }\n\n switch (actionId.type) {\n case ActionTypes[\"Contract\"]:\n case ActionTypes[\"Operation\"]:\n return Math.floor(actionObj.count);\n case ActionTypes[\"BlackOp\"]:\n case ActionTypes[\"BlackOperation\"]:\n if (this.blackops[name] != null) {\n return 0;\n } else {\n return 1;\n }\n case ActionTypes[\"Training\"]:\n case ActionTypes[\"Recruitment\"]:\n case ActionTypes[\"Field Analysis\"]:\n case ActionTypes[\"FieldAnalysis\"]:\n case ActionTypes[\"Diplomacy\"]:\n case ActionTypes[\"Hyperbolic Regeneration Chamber\"]:\n return Infinity;\n default:\n workerScript.log(\"bladeburner.getActionCountRemaining\", errorLogText);\n return -1;\n }\n }\n\n getSkillLevelNetscriptFn(skillName: string, workerScript: WorkerScript): number {\n if (skillName === \"\" || !Skills.hasOwnProperty(skillName)) {\n workerScript.log(\"bladeburner.getSkillLevel\", `Invalid skill: '${skillName}'`);\n return -1;\n }\n\n if (this.skills[skillName] == null) {\n return 0;\n } else {\n return this.skills[skillName];\n }\n }\n\n getSkillUpgradeCostNetscriptFn(skillName: string, workerScript: WorkerScript): number {\n if (skillName === \"\" || !Skills.hasOwnProperty(skillName)) {\n workerScript.log(\"bladeburner.getSkillUpgradeCost\", `Invalid skill: '${skillName}'`);\n return -1;\n }\n\n const skill = Skills[skillName];\n if (this.skills[skillName] == null) {\n return skill.calculateCost(0);\n } else {\n return skill.calculateCost(this.skills[skillName]);\n }\n }\n\n upgradeSkillNetscriptFn(skillName: string, workerScript: WorkerScript): boolean {\n const errorLogText = `Invalid skill: '${skillName}'`;\n if (!Skills.hasOwnProperty(skillName)) {\n workerScript.log(\"bladeburner.upgradeSkill\", errorLogText);\n return false;\n }\n\n const skill = Skills[skillName];\n let currentLevel = 0;\n if (this.skills[skillName] && !isNaN(this.skills[skillName])) {\n currentLevel = this.skills[skillName];\n }\n const cost = skill.calculateCost(currentLevel);\n\n if (skill.maxLvl && currentLevel >= skill.maxLvl) {\n workerScript.log(\"bladeburner.upgradeSkill\", `Skill '${skillName}' is already maxed.`);\n return false;\n }\n\n if (this.skillPoints < cost) {\n workerScript.log(\n \"bladeburner.upgradeSkill\",\n `You do not have enough skill points to upgrade ${skillName} (You have ${this.skillPoints}, you need ${cost})`,\n );\n return false;\n }\n\n this.skillPoints -= cost;\n this.upgradeSkill(skill);\n workerScript.log(\"bladeburner.upgradeSkill\", `'${skillName}' upgraded to level ${this.skills[skillName]}`);\n return true;\n }\n\n getTeamSizeNetscriptFn(type: string, name: string, workerScript: WorkerScript): number {\n if (type === \"\" && name === \"\") {\n return this.teamSize;\n }\n\n const errorLogText = `Invalid action: type='${type}' name='${name}'`;\n const actionId = this.getActionIdFromTypeAndName(type, name);\n if (actionId == null) {\n workerScript.log(\"bladeburner.getTeamSize\", errorLogText);\n return -1;\n }\n\n const actionObj = this.getActionObject(actionId);\n if (actionObj == null) {\n workerScript.log(\"bladeburner.getTeamSize\", errorLogText);\n return -1;\n }\n\n if (\n actionId.type === ActionTypes[\"Operation\"] ||\n actionId.type === ActionTypes[\"BlackOp\"] ||\n actionId.type === ActionTypes[\"BlackOperation\"]\n ) {\n return actionObj.teamCount;\n } else {\n return 0;\n }\n }\n\n setTeamSizeNetscriptFn(type: string, name: string, size: number, workerScript: WorkerScript): number {\n const errorLogText = `Invalid action: type='${type}' name='${name}'`;\n const actionId = this.getActionIdFromTypeAndName(type, name);\n if (actionId == null) {\n workerScript.log(\"bladeburner.setTeamSize\", errorLogText);\n return -1;\n }\n\n if (\n actionId.type !== ActionTypes[\"Operation\"] &&\n actionId.type !== ActionTypes[\"BlackOp\"] &&\n actionId.type !== ActionTypes[\"BlackOperation\"]\n ) {\n workerScript.log(\"bladeburner.setTeamSize\", \"Only valid for 'Operations' and 'BlackOps'\");\n return -1;\n }\n\n const actionObj = this.getActionObject(actionId);\n if (actionObj == null) {\n workerScript.log(\"bladeburner.setTeamSize\", errorLogText);\n return -1;\n }\n\n let sanitizedSize = Math.round(size);\n if (isNaN(sanitizedSize) || sanitizedSize < 0) {\n workerScript.log(\"bladeburner.setTeamSize\", `Invalid size: ${size}`);\n return -1;\n }\n if (this.teamSize < sanitizedSize) {\n sanitizedSize = this.teamSize;\n }\n actionObj.teamCount = sanitizedSize;\n workerScript.log(\"bladeburner.setTeamSize\", `Team size for '${name}' set to ${sanitizedSize}.`);\n return sanitizedSize;\n }\n\n joinBladeburnerFactionNetscriptFn(workerScript: WorkerScript): boolean {\n const bladeburnerFac = Factions[\"Bladeburners\"];\n if (bladeburnerFac.isMember) {\n return true;\n } else if (this.rank >= BladeburnerConstants.RankNeededForFaction) {\n joinFaction(bladeburnerFac);\n workerScript.log(\"bladeburner.joinBladeburnerFaction\", \"Joined Bladeburners faction.\");\n return true;\n } else {\n workerScript.log(\n \"bladeburner.joinBladeburnerFaction\",\n `You do not have the required rank (${this.rank}/${BladeburnerConstants.RankNeededForFaction}).`,\n );\n return false;\n }\n }\n\n /**\n * Serialize the current object to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"Bladeburner\", this);\n }\n\n /**\n * Initiatizes a Bladeburner object from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Bladeburner {\n return Generic_fromJSON(Bladeburner, value.data);\n }\n}\n\nReviver.constructors.Bladeburner = Bladeburner;\n","import { CompanyPosition } from \"./CompanyPosition\";\nimport * as posNames from \"./data/companypositionnames\";\n\nimport { CONSTANTS } from \"../Constants\";\nimport { IMap } from \"../types\";\n\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\nexport interface IConstructorParams {\n name: string;\n info: string;\n companyPositions: IMap;\n expMultiplier: number;\n salaryMultiplier: number;\n jobStatReqOffset: number;\n isMegacorp?: boolean;\n}\n\nconst DefaultConstructorParams: IConstructorParams = {\n name: \"\",\n info: \"\",\n companyPositions: {},\n expMultiplier: 1,\n salaryMultiplier: 1,\n jobStatReqOffset: 0,\n};\n\nexport class Company {\n /**\n * Company name\n */\n name: string;\n\n /**\n * Description and general information about company\n */\n info: string;\n\n /**\n * Has faction associated.\n */\n isMegacorp: boolean;\n\n /**\n * Object that holds all available positions in this Company.\n * Position names are held in keys.\n * The values for the keys don't matter, but we'll make them booleans\n *\n * Must match names of Company Positions, defined in data/companypositionnames.ts\n */\n companyPositions: IMap;\n\n /**\n * Company-specific multiplier for earnings\n */\n expMultiplier: number;\n salaryMultiplier: number;\n\n /**\n * The additional levels of stats you need to quality for a job\n * in this company.\n *\n * For example, the base stat requirement for an intern position is 1.\n * But if a company has a offset of 200, then you would need stat(s) of 201\n */\n jobStatReqOffset: number;\n\n /**\n * Properties to track the player's progress in this company\n */\n isPlayerEmployed: boolean;\n playerReputation: number;\n favor: number;\n rolloverRep: number;\n\n constructor(p: IConstructorParams = DefaultConstructorParams) {\n this.name = p.name;\n this.info = p.info;\n this.companyPositions = p.companyPositions;\n this.expMultiplier = p.expMultiplier;\n this.salaryMultiplier = p.salaryMultiplier;\n this.jobStatReqOffset = p.jobStatReqOffset;\n\n this.isPlayerEmployed = false;\n this.playerReputation = 1;\n this.favor = 0;\n this.rolloverRep = 0;\n this.isMegacorp = false;\n if (p.isMegacorp) this.isMegacorp = true;\n }\n\n hasPosition(pos: CompanyPosition | string): boolean {\n if (pos instanceof CompanyPosition) {\n return this.companyPositions[pos.name] != null;\n } else {\n return this.companyPositions[pos] != null;\n }\n }\n\n hasAgentPositions(): boolean {\n return this.companyPositions[posNames.AgentCompanyPositions[0]] != null;\n }\n\n hasBusinessConsultantPositions(): boolean {\n return this.companyPositions[posNames.BusinessConsultantCompanyPositions[0]] != null;\n }\n\n hasBusinessPositions(): boolean {\n return this.companyPositions[posNames.BusinessCompanyPositions[0]] != null;\n }\n\n hasEmployeePositions(): boolean {\n return this.companyPositions[posNames.MiscCompanyPositions[1]] != null;\n }\n\n hasITPositions(): boolean {\n return this.companyPositions[posNames.ITCompanyPositions[0]] != null;\n }\n\n hasSecurityPositions(): boolean {\n return this.companyPositions[posNames.SecurityCompanyPositions[2]] != null;\n }\n\n hasSoftwareConsultantPositions(): boolean {\n return this.companyPositions[posNames.SoftwareConsultantCompanyPositions[0]] != null;\n }\n\n hasSoftwarePositions(): boolean {\n return this.companyPositions[posNames.SoftwareCompanyPositions[0]] != null;\n }\n\n hasWaiterPositions(): boolean {\n return this.companyPositions[posNames.MiscCompanyPositions[0]] != null;\n }\n\n gainFavor(): void {\n if (this.favor == null) {\n this.favor = 0;\n }\n if (this.rolloverRep == null) {\n this.rolloverRep = 0;\n }\n const res = this.getFavorGain();\n if (res.length != 2) {\n console.error(\"Invalid result from getFavorGain() function\");\n return;\n }\n\n this.favor += res[0];\n this.rolloverRep = res[1];\n }\n\n getFavorGain(): number[] {\n if (this.favor == null) {\n this.favor = 0;\n }\n if (this.rolloverRep == null) {\n this.rolloverRep = 0;\n }\n let favorGain = 0,\n rep = this.playerReputation + this.rolloverRep;\n let reqdRep = CONSTANTS.CompanyReputationToFavorBase * Math.pow(CONSTANTS.CompanyReputationToFavorMult, this.favor);\n while (rep > 0) {\n if (rep >= reqdRep) {\n ++favorGain;\n rep -= reqdRep;\n } else {\n break;\n }\n reqdRep *= CONSTANTS.FactionReputationToFavorMult;\n }\n return [favorGain, rep];\n }\n\n /**\n * Serialize the current object to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"Company\", this);\n }\n\n /**\n * Initiatizes a Company from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Company {\n return Generic_fromJSON(Company, value.data);\n }\n}\n\nReviver.constructors.Company = Company;\n","/**\n * Implements functions for purchasing servers or purchasing more RAM for\n * the home computer\n */\nimport { AddToAllServers, createUniqueRandomIp } from \"./AllServers\";\nimport { safetlyCreateUniqueServer } from \"./ServerHelpers\";\n\nimport { BitNodeMultipliers } from \"../BitNode/BitNodeMultipliers\";\nimport { CONSTANTS } from \"../Constants\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\n\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\nimport { isPowerOfTwo } from \"../../utils/helpers/isPowerOfTwo\";\n\n// Returns the cost of purchasing a server with the given RAM\n// Returns Infinity for invalid 'ram' arguments\n/**\n * @param ram Amount of RAM on purchased server (GB)\n * @returns Cost of purchasing the given server. Returns infinity for invalid arguments\n */\nexport function getPurchaseServerCost(ram: number): number {\n const sanitizedRam = Math.round(ram);\n if (isNaN(sanitizedRam) || !isPowerOfTwo(sanitizedRam)) {\n return Infinity;\n }\n\n if (sanitizedRam > getPurchaseServerMaxRam()) {\n return Infinity;\n }\n\n return sanitizedRam * CONSTANTS.BaseCostFor1GBOfRamServer * BitNodeMultipliers.PurchasedServerCost;\n}\n\nexport function getPurchaseServerLimit(): number {\n return Math.round(CONSTANTS.PurchasedServerLimit * BitNodeMultipliers.PurchasedServerLimit);\n}\n\nexport function getPurchaseServerMaxRam(): number {\n const ram = Math.round(CONSTANTS.PurchasedServerMaxRam * BitNodeMultipliers.PurchasedServerMaxRam);\n\n // Round this to the nearest power of 2\n return 1 << (31 - Math.clz32(ram));\n}\n\n// Manually purchase a server (NOT through Netscript)\nexport function purchaseServer(hostname: string, ram: number, cost: number, p: IPlayer): void {\n //Check if player has enough money\n if (!p.canAfford(cost)) {\n dialogBoxCreate(\"You don't have enough money to purchase this server!\", false);\n return;\n }\n\n //Maximum server limit\n if (p.purchasedServers.length >= getPurchaseServerLimit()) {\n dialogBoxCreate(\n \"You have reached the maximum limit of \" +\n getPurchaseServerLimit() +\n \" servers. \" +\n \"You cannot purchase any more. You can \" +\n \"delete some of your purchased servers using the deleteServer() Netscript function in a script\",\n );\n return;\n }\n\n if (hostname == \"\") {\n dialogBoxCreate(\"You must enter a hostname for your new server!\");\n return;\n }\n\n // Create server\n const newServ = safetlyCreateUniqueServer({\n adminRights: true,\n hostname: hostname,\n ip: createUniqueRandomIp(),\n isConnectedTo: false,\n maxRam: ram,\n organizationName: \"\",\n purchasedByPlayer: true,\n });\n AddToAllServers(newServ);\n\n // Add to Player's purchasedServers array\n p.purchasedServers.push(newServ.ip);\n\n // Connect new server to home computer\n const homeComputer = p.getHomeComputer();\n homeComputer.serversOnNetwork.push(newServ.ip);\n newServ.serversOnNetwork.push(homeComputer.ip);\n\n p.loseMoney(cost);\n\n dialogBoxCreate(\"Server successfully purchased with hostname \" + hostname);\n}\n\n// Manually upgrade RAM on home computer (NOT through Netscript)\nexport function purchaseRamForHomeComputer(p: IPlayer): void {\n const cost = p.getUpgradeHomeRamCost();\n if (!p.canAfford(cost)) {\n dialogBoxCreate(\"You do not have enough money to purchase additional RAM for your home computer\");\n return;\n }\n\n const homeComputer = p.getHomeComputer();\n if (homeComputer.maxRam >= CONSTANTS.HomeComputerMaxRam) {\n dialogBoxCreate(`You cannot upgrade your home computer RAM because it is at its maximum possible value`);\n return;\n }\n\n homeComputer.maxRam *= 2;\n p.loseMoney(cost);\n}\n","import { Material } from \"./Material\";\nimport { ICorporation } from \"./ICorporation\";\nimport { IIndustry } from \"./IIndustry\";\nimport { MaterialSizes } from \"./MaterialSizes\";\nimport { IMap } from \"../types\";\nimport { numeralWrapper } from \"../ui/numeralFormat\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\nimport { exceptionAlert } from \"../../utils/helpers/exceptionAlert\";\n\ninterface IConstructorParams {\n corp?: ICorporation;\n industry?: IIndustry;\n loc?: string;\n size?: number;\n}\n\nexport class Warehouse {\n // Text that describes how the space in this Warehouse is being used\n // Used to create a tooltip in the UI\n breakdown = \"\";\n\n // Warehouse's level, which affects its maximum size\n level = 1;\n\n // City that this Warehouse is in\n loc: string;\n\n // Map of Materials held by this Warehouse\n materials: IMap;\n\n // Maximum amount warehouse can hold\n size: number;\n\n // Amount of space currently used by warehouse\n sizeUsed = 0;\n\n // Whether Smart Supply is enabled for this Industry (the Industry that this Warehouse is for)\n smartSupplyEnabled = false;\n\n // Decide if smart supply should use the materials already in the warehouse when deciding on the amount to buy.\n smartSupplyUseLeftovers: { [key: string]: boolean | undefined } = {};\n\n // Stores the amount of product to be produced. Used for Smart Supply unlock.\n // The production tracked by smart supply is always based on the previous cycle,\n // so it will always trail the \"true\" production by 1 cycle\n smartSupplyStore = 0;\n\n constructor(params: IConstructorParams = {}) {\n this.loc = params.loc ? params.loc : \"\";\n this.size = params.size ? params.size : 0;\n\n this.materials = {\n Water: new Material({ name: \"Water\" }),\n Energy: new Material({ name: \"Energy\" }),\n Food: new Material({ name: \"Food\" }),\n Plants: new Material({ name: \"Plants\" }),\n Metal: new Material({ name: \"Metal\" }),\n Hardware: new Material({ name: \"Hardware\" }),\n Chemicals: new Material({ name: \"Chemicals\" }),\n Drugs: new Material({ name: \"Drugs\" }),\n Robots: new Material({ name: \"Robots\" }),\n AICores: new Material({ name: \"AI Cores\" }),\n RealEstate: new Material({ name: \"Real Estate\" }),\n };\n\n this.smartSupplyUseLeftovers = {\n Water: true,\n Energy: true,\n Food: true,\n Plants: true,\n Metal: true,\n Hardware: true,\n Chemicals: true,\n Drugs: true,\n Robots: true,\n AICores: true,\n RealEstate: true,\n };\n\n if (params.corp && params.industry) {\n this.updateSize(params.corp, params.industry);\n }\n\n // Default smart supply to being enabled if the upgrade is unlocked\n if (params.corp?.unlockUpgrades[1]) {\n this.smartSupplyEnabled = true;\n }\n }\n\n // Re-calculate how much space is being used by this Warehouse\n updateMaterialSizeUsed(): void {\n this.sizeUsed = 0;\n this.breakdown = \"\";\n for (const matName in this.materials) {\n const mat = this.materials[matName];\n if (MaterialSizes.hasOwnProperty(matName)) {\n this.sizeUsed += mat.qty * MaterialSizes[matName];\n if (mat.qty > 0) {\n this.breakdown += matName + \": \" + numeralWrapper.format(mat.qty * MaterialSizes[matName], \"0,0.0\") + \"
\";\n }\n }\n }\n if (this.sizeUsed > this.size) {\n console.warn(\"Warehouse size used greater than capacity, something went wrong\");\n }\n }\n\n updateSize(corporation: ICorporation, industry: IIndustry): void {\n try {\n this.size = this.level * 100 * corporation.getStorageMultiplier() * industry.getStorageMultiplier();\n } catch (e) {\n exceptionAlert(e);\n }\n }\n\n // Serialize the current object to a JSON save state.\n toJSON(): any {\n return Generic_toJSON(\"Warehouse\", this);\n }\n\n // Initiatizes a Warehouse object from a JSON save state.\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Warehouse {\n return Generic_fromJSON(Warehouse, value.data);\n }\n}\n\nReviver.constructors.Warehouse = Warehouse;\n","import { gangMemberTasksMetadata } from \"./data/tasks\";\nimport { GangMemberTask } from \"./GangMemberTask\";\n\nexport const GangMemberTasks: {\n [key: string]: GangMemberTask;\n} = {};\n\n(function () {\n gangMemberTasksMetadata.forEach((e) => {\n GangMemberTasks[e.name] = new GangMemberTask(e.name, e.desc, e.isHacking, e.isCombat, e.params);\n });\n})();\n","import { BitNodeMultipliers } from \"../../BitNode/BitNodeMultipliers\";\nimport { HacknetServerConstants } from \"../data/Constants\";\n\nexport function calculateHashGainRate(\n level: number,\n ramUsed: number,\n maxRam: number,\n cores: number,\n mult: number,\n): number {\n const baseGain = HacknetServerConstants.HashesPerLevel * level;\n const ramMultiplier = Math.pow(1.07, Math.log2(maxRam));\n const coreMultiplier = 1 + (cores - 1) / 5;\n const ramRatio = 1 - ramUsed / maxRam;\n\n return baseGain * ramMultiplier * coreMultiplier * ramRatio * mult * BitNodeMultipliers.HacknetNodeMoney;\n}\n\nexport function calculateLevelUpgradeCost(startingLevel: number, extraLevels = 1, costMult = 1): number {\n const sanitizedLevels = Math.round(extraLevels);\n if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {\n return 0;\n }\n\n if (startingLevel >= HacknetServerConstants.MaxLevel) {\n return Infinity;\n }\n\n const mult = HacknetServerConstants.UpgradeLevelMult;\n let totalMultiplier = 0;\n let currLevel = startingLevel;\n for (let i = 0; i < sanitizedLevels; ++i) {\n totalMultiplier += Math.pow(mult, currLevel);\n ++currLevel;\n }\n\n return 10 * HacknetServerConstants.BaseCost * totalMultiplier * costMult;\n}\n\nexport function calculateRamUpgradeCost(startingRam: number, extraLevels = 1, costMult = 1): number {\n const sanitizedLevels = Math.round(extraLevels);\n if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {\n return 0;\n }\n\n if (startingRam >= HacknetServerConstants.MaxRam) {\n return Infinity;\n }\n\n let totalCost = 0;\n let numUpgrades = Math.round(Math.log2(startingRam));\n let currentRam = startingRam;\n for (let i = 0; i < sanitizedLevels; ++i) {\n const baseCost = currentRam * HacknetServerConstants.RamBaseCost;\n const mult = Math.pow(HacknetServerConstants.UpgradeRamMult, numUpgrades);\n\n totalCost += baseCost * mult;\n\n currentRam *= 2;\n ++numUpgrades;\n }\n totalCost *= costMult;\n\n return totalCost;\n}\n\nexport function calculateCoreUpgradeCost(startingCores: number, extraLevels = 1, costMult = 1): number {\n const sanitizedLevels = Math.round(extraLevels);\n if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {\n return 0;\n }\n\n if (startingCores >= HacknetServerConstants.MaxCores) {\n return Infinity;\n }\n\n const mult = HacknetServerConstants.UpgradeCoreMult;\n let totalCost = 0;\n let currentCores = startingCores;\n for (let i = 0; i < sanitizedLevels; ++i) {\n totalCost += Math.pow(mult, currentCores - 1);\n ++currentCores;\n }\n totalCost *= HacknetServerConstants.CoreBaseCost;\n totalCost *= costMult;\n\n return totalCost;\n}\n\nexport function calculateCacheUpgradeCost(startingCache: number, extraLevels = 1): number {\n const sanitizedLevels = Math.round(extraLevels);\n if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {\n return 0;\n }\n\n if (startingCache >= HacknetServerConstants.MaxCache) {\n return Infinity;\n }\n\n const mult = HacknetServerConstants.UpgradeCacheMult;\n let totalCost = 0;\n let currentCache = startingCache;\n for (let i = 0; i < sanitizedLevels; ++i) {\n totalCost += Math.pow(mult, currentCache - 1);\n ++currentCache;\n }\n totalCost *= HacknetServerConstants.CacheBaseCost;\n\n return totalCost;\n}\n\nexport function calculateServerCost(n: number, mult = 1): number {\n if (n - 1 >= HacknetServerConstants.MaxServers) {\n return Infinity;\n }\n\n return HacknetServerConstants.BaseCost * Math.pow(HacknetServerConstants.PurchaseMult, n - 1) * mult;\n}\n","import { BitNodeMultipliers } from \"../BitNode/BitNodeMultipliers\";\n\ninterface ISkillParams {\n name: string;\n desc: string;\n\n baseCost?: number;\n costInc?: number;\n maxLvl?: number;\n\n successChanceAll?: number;\n successChanceStealth?: number;\n successChanceKill?: number;\n successChanceContract?: number;\n successChanceOperation?: number;\n successChanceEstimate?: number;\n\n actionTime?: number;\n\n effHack?: number;\n effStr?: number;\n effDef?: number;\n effDex?: number;\n effAgi?: number;\n effCha?: number;\n\n stamina?: number;\n money?: number;\n expGain?: number;\n}\n\nexport class Skill {\n name: string;\n desc: string;\n // Cost is in Skill Points\n baseCost = 1;\n // Additive cost increase per level\n costInc = 1;\n maxLvl = 0;\n\n /**\n * These benefits are additive. So total multiplier will be level (handled externally) times the\n * effects below\n */\n successChanceAll = 0;\n successChanceStealth = 0;\n successChanceKill = 0;\n successChanceContract = 0;\n successChanceOperation = 0;\n\n /**\n * This multiplier affects everything that increases synthoid population/community estimate\n * e.g. Field analysis, Investigation Op, Undercover Op\n */\n successChanceEstimate = 0;\n actionTime = 0;\n effHack = 0;\n effStr = 0;\n effDef = 0;\n effDex = 0;\n effAgi = 0;\n effCha = 0;\n stamina = 0;\n money = 0;\n expGain = 0;\n\n constructor(params: ISkillParams = { name: \"foo\", desc: \"foo\" }) {\n if (!params.name) {\n throw new Error(\"Failed to initialize Bladeburner Skill. No name was specified in ctor\");\n }\n if (!params.desc) {\n throw new Error(\"Failed to initialize Bladeburner Skills. No desc was specified in ctor\");\n }\n this.name = params.name;\n this.desc = params.desc;\n this.baseCost = params.baseCost ? params.baseCost : 1;\n this.costInc = params.costInc ? params.costInc : 1;\n\n if (params.maxLvl) {\n this.maxLvl = params.maxLvl;\n }\n\n if (params.successChanceAll) {\n this.successChanceAll = params.successChanceAll;\n }\n if (params.successChanceStealth) {\n this.successChanceStealth = params.successChanceStealth;\n }\n if (params.successChanceKill) {\n this.successChanceKill = params.successChanceKill;\n }\n if (params.successChanceContract) {\n this.successChanceContract = params.successChanceContract;\n }\n if (params.successChanceOperation) {\n this.successChanceOperation = params.successChanceOperation;\n }\n\n if (params.successChanceEstimate) {\n this.successChanceEstimate = params.successChanceEstimate;\n }\n\n if (params.actionTime) {\n this.actionTime = params.actionTime;\n }\n if (params.effHack) {\n this.effHack = params.effHack;\n }\n if (params.effStr) {\n this.effStr = params.effStr;\n }\n if (params.effDef) {\n this.effDef = params.effDef;\n }\n if (params.effDex) {\n this.effDex = params.effDex;\n }\n if (params.effAgi) {\n this.effAgi = params.effAgi;\n }\n if (params.effCha) {\n this.effCha = params.effCha;\n }\n\n if (params.stamina) {\n this.stamina = params.stamina;\n }\n if (params.money) {\n this.money = params.money;\n }\n if (params.expGain) {\n this.expGain = params.expGain;\n }\n }\n\n calculateCost(currentLevel: number): number {\n return Math.floor((this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost);\n }\n\n getMultiplier(name: string): number {\n if (name === \"successChanceAll\") return this.successChanceAll;\n if (name === \"successChanceStealth\") return this.successChanceStealth;\n if (name === \"successChanceKill\") return this.successChanceKill;\n if (name === \"successChanceContract\") return this.successChanceContract;\n if (name === \"successChanceOperation\") return this.successChanceOperation;\n if (name === \"successChanceEstimate\") return this.successChanceEstimate;\n\n if (name === \"actionTime\") return this.actionTime;\n\n if (name === \"effHack\") return this.effHack;\n if (name === \"effStr\") return this.effStr;\n if (name === \"effDef\") return this.effDef;\n if (name === \"effDex\") return this.effDex;\n if (name === \"effAgi\") return this.effAgi;\n if (name === \"effCha\") return this.effCha;\n\n if (name === \"stamina\") return this.stamina;\n if (name === \"money\") return this.money;\n if (name === \"expGain\") return this.expGain;\n return 0;\n }\n}\n","import * as React from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\n\nexport function Hashes(hashes: number | string): JSX.Element {\n return (\n \n {typeof hashes === \"number\" ? numeralWrapper.formatHashes(hashes) : hashes}\n \n );\n}\n","import React from \"react\";\n\nimport { Table, TableCell } from \"./Table\";\nimport TableBody from \"@mui/material/TableBody\";\nimport { Table as MuiTable } from \"@mui/material\";\nimport TableRow from \"@mui/material/TableRow\";\nimport Typography from \"@mui/material/Typography\";\n\ninterface IProps {\n rows: any[][];\n title?: string;\n wide?: boolean;\n}\n\nexport function StatsTable({ rows, title, wide }: IProps): React.ReactElement {\n const T = wide ? MuiTable : Table;\n return (\n <>\n {title && {title}}\n \n \n {rows.map((row: any[]) => (\n \n {row.map((elem: any, i: number) => (\n \n {elem}\n \n ))}\n \n ))}\n \n \n \n );\n}\n","/**\n * Adds a random offset to a number within a certain percentage\n * @example\n * // Returns between 95-105\n * addOffset(100, 5);\n * @example\n * // Returns between 63-77\n * addOffSet(70, 10);\n * @param midpoint The number to be the midpoint of the offset range\n * @param percentage The percentage (in a range of 0-100) to offset\n */\nexport function addOffset(midpoint: number, percentage: number): number {\n const maxPercent = 100;\n if (percentage < 0 || percentage > maxPercent) {\n return midpoint;\n }\n\n const offset: number = midpoint * (percentage / maxPercent);\n\n // Double the range to account for both sides of the midpoint.\n // tslint:disable-next-line:no-magic-numbers\n return midpoint + (Math.random() * (offset * 2) - offset);\n}\n","import { IPlayer } from \"../IPlayer\";\nimport { Faction } from \"../../Faction/Faction\";\nimport { CONSTANTS } from \"../../Constants\";\nimport { BitNodeMultipliers } from \"../../BitNode/BitNodeMultipliers\";\n\nfunction mult(f: Faction): number {\n let favorMult = 1 + f.favor / 100;\n if (isNaN(favorMult)) {\n favorMult = 1;\n }\n return favorMult * BitNodeMultipliers.FactionWorkRepGain;\n}\n\nexport function getHackingWorkRepGain(p: IPlayer, f: Faction): number {\n return (\n ((p.hacking_skill + p.intelligence / 3) / CONSTANTS.MaxSkillLevel) *\n p.faction_rep_mult *\n p.getIntelligenceBonus(1) *\n mult(f)\n );\n}\n\nexport function getFactionSecurityWorkRepGain(p: IPlayer, f: Faction): number {\n const t =\n (0.9 *\n (p.hacking_skill / CONSTANTS.MaxSkillLevel +\n p.strength / CONSTANTS.MaxSkillLevel +\n p.defense / CONSTANTS.MaxSkillLevel +\n p.dexterity / CONSTANTS.MaxSkillLevel +\n p.agility / CONSTANTS.MaxSkillLevel +\n p.intelligence / CONSTANTS.MaxSkillLevel)) /\n 4.5;\n return t * p.faction_rep_mult * mult(f) * p.getIntelligenceBonus(1);\n}\n\nexport function getFactionFieldWorkRepGain(p: IPlayer, f: Faction): number {\n const t =\n (0.9 *\n (p.hacking_skill / CONSTANTS.MaxSkillLevel +\n p.strength / CONSTANTS.MaxSkillLevel +\n p.defense / CONSTANTS.MaxSkillLevel +\n p.dexterity / CONSTANTS.MaxSkillLevel +\n p.agility / CONSTANTS.MaxSkillLevel +\n p.charisma / CONSTANTS.MaxSkillLevel +\n p.intelligence / CONSTANTS.MaxSkillLevel)) /\n 5.5;\n return t * p.faction_rep_mult * mult(f) * p.getIntelligenceBonus(1);\n}\n","import { Skill } from \"./Skill\";\nimport { SkillNames } from \"./data/SkillNames\";\nimport { IMap } from \"../types\";\n\nexport const Skills: IMap = {};\n\n(function () {\n Skills[SkillNames.BladesIntuition] = new Skill({\n name: SkillNames.BladesIntuition,\n desc:\n \"Each level of this skill increases your success chance \" + \"for all Contracts, Operations, and BlackOps by 3%\",\n baseCost: 3,\n costInc: 2.1,\n successChanceAll: 3,\n });\n Skills[SkillNames.Cloak] = new Skill({\n name: SkillNames.Cloak,\n desc:\n \"Each level of this skill increases your \" +\n \"success chance in stealth-related Contracts, Operations, and BlackOps by 5.5%\",\n baseCost: 2,\n costInc: 1.1,\n successChanceStealth: 5.5,\n });\n Skills[SkillNames.ShortCircuit] = new Skill({\n name: SkillNames.ShortCircuit,\n desc:\n \"Each level of this skill increases your success chance \" +\n \"in Contracts, Operations, and BlackOps that involve retirement by 5.5%\",\n baseCost: 2,\n costInc: 2.1,\n successChanceKill: 5.5,\n });\n Skills[SkillNames.DigitalObserver] = new Skill({\n name: SkillNames.DigitalObserver,\n desc: \"Each level of this skill increases your success chance in \" + \"all Operations and BlackOps by 4%\",\n baseCost: 2,\n costInc: 2.1,\n successChanceOperation: 4,\n });\n Skills[SkillNames.Tracer] = new Skill({\n name: SkillNames.Tracer,\n desc: \"Each level of this skill increases your success chance in \" + \"all Contracts by 4%\",\n baseCost: 2,\n costInc: 2.1,\n successChanceContract: 4,\n });\n Skills[SkillNames.Overclock] = new Skill({\n name: SkillNames.Overclock,\n desc:\n \"Each level of this skill decreases the time it takes \" +\n \"to attempt a Contract, Operation, and BlackOp by 1% (Max Level: 90)\",\n baseCost: 3,\n costInc: 1.4,\n maxLvl: 90,\n actionTime: 1,\n });\n Skills[SkillNames.Reaper] = new Skill({\n name: SkillNames.Reaper,\n desc: \"Each level of this skill increases your effective combat stats for Bladeburner actions by 2%\",\n baseCost: 2,\n costInc: 2.1,\n effStr: 2,\n effDef: 2,\n effDex: 2,\n effAgi: 2,\n });\n Skills[SkillNames.EvasiveSystem] = new Skill({\n name: SkillNames.EvasiveSystem,\n desc: \"Each level of this skill increases your effective \" + \"dexterity and agility for Bladeburner actions by 4%\",\n baseCost: 2,\n costInc: 2.1,\n effDex: 4,\n effAgi: 4,\n });\n Skills[SkillNames.Datamancer] = new Skill({\n name: SkillNames.Datamancer,\n desc:\n \"Each level of this skill increases your effectiveness in \" +\n \"synthoid population analysis and investigation by 5%. \" +\n \"This affects all actions that can potentially increase \" +\n \"the accuracy of your synthoid population/community estimates.\",\n baseCost: 3,\n costInc: 1,\n successChanceEstimate: 5,\n });\n Skills[SkillNames.CybersEdge] = new Skill({\n name: SkillNames.CybersEdge,\n desc: \"Each level of this skill increases your max stamina by 2%\",\n baseCost: 1,\n costInc: 3,\n stamina: 2,\n });\n Skills[SkillNames.HandsOfMidas] = new Skill({\n name: SkillNames.HandsOfMidas,\n desc: \"Each level of this skill increases the amount of money you receive from Contracts by 10%\",\n baseCost: 2,\n costInc: 2.5,\n money: 10,\n });\n Skills[SkillNames.Hyperdrive] = new Skill({\n name: SkillNames.Hyperdrive,\n desc: \"Each level of this skill increases the experience earned from Contracts, Operations, and BlackOps by 10%\",\n baseCost: 1,\n costInc: 2.5,\n expGain: 10,\n });\n})();\n","// Enum values are lowercased to match css classes\nexport enum Suit {\n Clubs = \"clubs\",\n Diamonds = \"diamonds\",\n Hearts = \"hearts\",\n Spades = \"spades\",\n}\n\nexport class Card {\n constructor(readonly value: number, readonly suit: Suit) {\n if (value < 1 || value > 13) {\n throw new Error(`Card instantiated with improper value: ${value}`);\n }\n }\n\n formatValue(): string {\n switch (this.value) {\n case 1:\n return \"A\";\n case 11:\n return \"J\";\n case 12:\n return \"Q\";\n case 13:\n return \"K\";\n default:\n return `${this.value}`;\n }\n }\n\n isRedSuit(): boolean {\n return this.suit === Suit.Hearts || this.suit === Suit.Diamonds;\n }\n\n getStringRepresentation(): string {\n const value = this.formatValue();\n\n return `${value} of ${this.suit}`;\n }\n}\n","import { IActionIdentifier } from \"./IActionIdentifier\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\ninterface IParams {\n name?: string;\n type?: number;\n}\n\nexport class ActionIdentifier implements IActionIdentifier {\n name = \"\";\n type = -1;\n\n constructor(params: IParams = {}) {\n if (params.name) this.name = params.name;\n if (params.type) this.type = params.type;\n }\n\n toJSON(): any {\n return Generic_toJSON(\"ActionIdentifier\", this);\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): ActionIdentifier {\n return Generic_fromJSON(ActionIdentifier, value.data);\n }\n}\n\nReviver.constructors.ActionIdentifier = ActionIdentifier;\n","/**\n * Generic Event Emitter class following a subscribe/publish paradigm.\n */\n\ntype cbFn = (...args: any[]) => any;\n\nexport interface ISubscriber {\n /**\n * Callback function that will be run when an event is emitted\n */\n cb: cbFn;\n\n /**\n * Name/identifier for this subscriber\n */\n id: string;\n}\n\nfunction uuidv4(): string {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n const r = (Math.random() * 16) | 0,\n v = c == \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\nexport class EventEmitter {\n subscribers: { [key: string]: (...args: [...T]) => void | undefined } = {};\n\n subscribe(s: (...args: [...T]) => void): () => void {\n let uuid = uuidv4();\n while (this.subscribers[uuid] !== undefined) uuid = uuidv4();\n this.subscribers[uuid] = s;\n\n return () => {\n delete this.subscribers[uuid];\n };\n }\n\n emit(...args: [...T]): void {\n for (const s in this.subscribers) {\n const sub = this.subscribers[s];\n if (sub === undefined) continue;\n\n sub(...args);\n }\n }\n}\n","/**\n * Map of all Locations in the game\n * Key = Location name, value = Location object\n */\nimport { City } from \"./City\";\nimport { Cities } from \"./Cities\";\nimport { Location, IConstructorParams } from \"./Location\";\nimport { CityName } from \"./data/CityNames\";\nimport { LocationsMetadata } from \"./data/LocationsMetadata\";\n\nimport { IMap } from \"../types\";\n\nexport const Locations: IMap = {};\n\n/**\n * Here, we'll initialize both Locations and Cities data. These can both\n * be initialized from the `LocationsMetadata`\n */\nfunction constructLocation(p: IConstructorParams): Location {\n if (!p.name) {\n throw new Error(`Invalid constructor parameters for Location. No 'name' property`);\n }\n\n if (Locations[p.name] instanceof Location) {\n console.warn(`Property with name ${p.name} already exists and is being overwritten`);\n }\n\n Locations[p.name] = new Location(p);\n\n return Locations[p.name];\n}\n\n// First construct all cities\nCities[CityName.Aevum] = new City(CityName.Aevum);\nCities[CityName.Chongqing] = new City(CityName.Chongqing);\nCities[CityName.Ishima] = new City(CityName.Ishima);\nCities[CityName.NewTokyo] = new City(CityName.NewTokyo);\nCities[CityName.Sector12] = new City(CityName.Sector12);\nCities[CityName.Volhaven] = new City(CityName.Volhaven);\n\nCities[CityName.Aevum].asciiArt = `\n [aevum police headquarters] 26 \n o \n I \\\\ [bachman & associates] \n \\\\ 56 B \n x \\\\ [summit university] \n \\\\ \\\\ 28 \n \\\\ [snap fitness gym] x o--L-----------N \n K \\\\ / \n \\\\ \\\\ Q [casino] \n x 58 \\\\ / [travel agency] \n \\\\ 94 95 o \n 90 x 59 o------o | \n \\\\ / \\\\ | 98 102 103 \n o--------O------x----o 93 96 o-----+------------o o----o \n \\\\ | \\\\ / \n [hospital] \\\\ 61 [ecorp] x 31 99 o-F-o 101 \n o | \n | o---E-- | [fulcrum tech.] \n x 62 / A [aerocorp] \n [crush fitness gym] | / | \n | / | \n o--------D------+--o o \n | |\\\\ [rho construction] \n H [netlink tech.] | J \n | | \\\\ \n | 34 x \\\\ \n [clarke inc.] C | \\\\ [world stock exchange] \n | | \\\\ \n | | o-M-------R--------o \n[galactic cybersystems] G 35 x \n | [watchdog security] \n | \n 67 o \n \n [the slums] P `;\nCities[CityName.Chongqing].asciiArt = `\n | \n 75 o \n \\\\ \n o 76 \n 7 | | \n | + 77 \n [world stock exchange] F | \n \\\\ o 78 [kuaigong international] \n \\\\ / \n 38 o----x--x------x------A--------- \n / 39 | 41 \n 37 o + 79 o--x--x-C-0 \n / | / \n / x-----+-----x-----0 [hospital] \n[solaris space system] B | \n | + 80 \n | | \n 34 o E [travel agency] \n | \n | \n x 82 \n [the slums] D `;\nCities[CityName.Ishima].asciiArt = `\n o 59 \n o o | \n [storm tech.] | | G [world stock exchange] \n | | 28 | \n 23 o--C------o--------+----x----o | \n / / 25 | 27 \\\\ x 57 \n / / | \\\\ | \n / / | \\\\ | \n o 22 o | \\\\| 29/56 \n | | o \n | [hospital] D / \\\\ 3 2 1 \n o | / \\\\ o-------x------o \n / o / \\\\ / \n 48 o / 55 x \\\\ / \n \\\\ / / x \n \\\\ / [nova medical] / 4/30 \\\\ \n 49 x A \\\\ \n / \\\\ / \\\\ \n / \\\\ [travel agency] F o 31 \n / \\\\ 51 / \n / o----B------x-----o \n o 50 52 \n [omega soft.] \n [the slums] E `;\nCities[CityName.NewTokyo].asciiArt = `\n \n \n o \n \\\\ \n \\\\ [defcomm] \n \\\\ \n o--x---A--x--o [travel agency] \n 7 8 10 G \n [vitalife] o 12 [global pharmaceuticals] \n | \n o--D-x----x-------x-C-+--------x--x-B-x---x-o \n 21 22 23 \\\\ 24 25 26 27 \n \\\\ \n [noodle bar] x 14 \n \\\\ \n \\\\ \n [hospital] o 15 [world stock exchange] \n | \n o--x--E--x-----x-----x---+---x----x--H--x-o \n | \n | \n o 17 \n \n \n \n F [the slums] \n `;\nCities[CityName.Sector12].asciiArt = `\n 78 o 97 \n o [icarus microsystems] / \n N [powerhouse gym] o I \n 1 | | / \n o-----+---x----o 4 A [alpha ent.] o-------o / \n | 3 \\\\ | \\\\ / \n | \\\\ | [iron gym] x 95 \n (79) x \\\\ | / \\\\ \n | o-E----+----x----J--o 10 / o----T--o \n | | 8 \\\\ 94 x \n 80 x [city hall] | x 11 / [world stock exchange]\n | | \\\\ / \n | C [cia] \\\\ / \n Q [hospital] | F P [universal energy] \n | o [deltaone] \\\\ / \n | 35 o---------x 13/92/36 \n L [megacorp] 33 / / \\\\ \n | o------------o 34 / \\\\ \n (29) | / [carmichael sec.] D \\\\ \n o-----+-----x------o / O [rothman university] \n | 31 32 [nsa] M \n | / \n B [blade industries] H \n | / [four sigma] \n | [joe's guns] / \n | / \n 85 o--G--------K--------S-------o 88 [the slums] R \n \n [foodnstuff] [travel agency] `;\nCities[CityName.Volhaven].asciiArt = `\n [omnia cybersystems] \n 17 66 68 \n o o------G-------o \n \\\\ / \\\\ \n \\\\ o 65 o 69 \n [syscore sec.] H | | \n \\\\ | | [millenium fitness gym] \n \\\\ | 21 22 23 24 | 26 \n o----+--x--x----x---x---+-----x-------D-----o \n 19 | | 28 \n | F [omnitek inc.] \n [hospital] J 63 o \n | / 72 \n 3 | 5 6 / 9 \n o--------+----x-----x----+----------M-------o \n / | | \n / 61 x [helios labs] B [world stock exchange] \n [travel agency] L | | \n / | o \n / E [nwo] / 75 \n / [computek] | / \n / A-------o------I-----o \n 1 o | | \n | [zb] o 77 \n [lexocorp] C \n | \n o \n 57 \n \n \n [the slums] K `;\n\n// Then construct all locations, and add them to the cities as we go.\nfor (const metadata of LocationsMetadata) {\n const loc = constructLocation(metadata);\n\n const cityName = loc.city;\n if (cityName === null) {\n // Generic location, add to all cities\n for (const city in Cities) {\n Cities[city].addLocation(loc.name);\n }\n } else {\n Cities[cityName].addLocation(loc.name);\n }\n}\n","import React from \"react\";\n\nexport function random(min: number, max: number): number {\n return Math.random() * (max - min) + min;\n}\n\nexport function getArrow(event: React.KeyboardEvent): string {\n switch (event.keyCode) {\n case 38:\n case 87:\n return \"↑\";\n case 65:\n case 37:\n return \"←\";\n case 40:\n case 83:\n return \"↓\";\n case 39:\n case 68:\n return \"→\";\n }\n return \"\";\n}\n","/**\n * Implementation for what happens when you destroy a BitNode\n */\nimport { Player } from \"./Player\";\nimport { prestigeSourceFile } from \"./Prestige\";\nimport { PlayerOwnedSourceFile } from \"./SourceFile/PlayerOwnedSourceFile\";\nimport { SourceFileFlags } from \"./SourceFile/SourceFileFlags\";\nimport { SourceFiles } from \"./SourceFile/SourceFiles\";\n\nimport { dialogBoxCreate } from \"../utils/DialogBox\";\n\nexport let redPillFlag = false;\n\nexport function setRedPillFlag(b) {\n redPillFlag = b;\n}\n\nfunction giveSourceFile(bitNodeNumber) {\n var sourceFileKey = \"SourceFile\" + bitNodeNumber.toString();\n var sourceFile = SourceFiles[sourceFileKey];\n if (sourceFile == null) {\n console.error(`Could not find source file for Bit node: ${bitNodeNumber}`);\n return;\n }\n\n // Check if player already has this source file\n var alreadyOwned = false;\n var ownedSourceFile = null;\n for (var i = 0; i < Player.sourceFiles.length; ++i) {\n if (Player.sourceFiles[i].n === bitNodeNumber) {\n alreadyOwned = true;\n ownedSourceFile = Player.sourceFiles[i];\n break;\n }\n }\n\n if (alreadyOwned && ownedSourceFile) {\n if (ownedSourceFile.lvl >= 3 && ownedSourceFile.n !== 12) {\n dialogBoxCreate(\n \"The Source-File for the BitNode you just destroyed, \" + sourceFile.name + \", \" + \"is already at max level!\",\n );\n } else {\n ++ownedSourceFile.lvl;\n dialogBoxCreate(\n sourceFile.name +\n \" was upgraded to level \" +\n ownedSourceFile.lvl +\n \" for \" +\n \"destroying its corresponding BitNode!\",\n );\n }\n } else {\n var playerSrcFile = new PlayerOwnedSourceFile(bitNodeNumber, 1);\n Player.sourceFiles.push(playerSrcFile);\n if (bitNodeNumber === 5 && Player.intelligence === 0) {\n // Artificial Intelligence\n Player.intelligence = 1;\n }\n dialogBoxCreate(\n \"You received a Source-File for destroying a BitNode!

\" + sourceFile.name + \"

\" + sourceFile.info,\n );\n }\n}\n\nexport function enterBitNode(router, flume, destroyedBitNode, newBitNode) {\n if (!flume) {\n giveSourceFile(destroyedBitNode);\n } else {\n if (SourceFileFlags[5] === 0 && newBitNode !== 5) {\n Player.intelligence = 0;\n Player.intelligence_exp = 0;\n }\n }\n if (newBitNode === 5 && Player.intelligence === 0) {\n Player.intelligence = 1;\n }\n redPillFlag = false;\n // Set new Bit Node\n Player.bitNodeN = newBitNode;\n\n if (newBitNode === 6) {\n router.toBladeburnerCinematic();\n } else {\n router.toTerminal();\n }\n prestigeSourceFile(flume);\n}\n","import { CONSTANTS } from \"../Constants\";\nimport { Player } from \"../Player\";\nimport { AllServers } from \"../Server/AllServers\";\nimport { processSingleServerGrowth } from \"../Server/ServerHelpers\";\n\nimport { numeralWrapper } from \"../ui/numeralFormat\";\n\nimport { compareArrays } from \"../../utils/helpers/compareArrays\";\n\nexport function scriptCalculateOfflineProduction(runningScriptObj) {\n //The Player object stores the last update time from when we were online\n const thisUpdate = new Date().getTime();\n const lastUpdate = Player.lastUpdate;\n const timePassed = (thisUpdate - lastUpdate) / 1000; //Seconds\n\n //Calculate the \"confidence\" rating of the script's true production. This is based\n //entirely off of time. We will arbitrarily say that if a script has been running for\n //4 hours (14400 sec) then we are completely confident in its ability\n let confidence = runningScriptObj.onlineRunningTime / 14400;\n if (confidence >= 1) {\n confidence = 1;\n }\n\n //Data map: [MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]\n\n // Grow\n for (const ip in runningScriptObj.dataMap) {\n if (runningScriptObj.dataMap.hasOwnProperty(ip)) {\n if (runningScriptObj.dataMap[ip][2] == 0 || runningScriptObj.dataMap[ip][2] == null) {\n continue;\n }\n const serv = AllServers[ip];\n if (serv == null) {\n continue;\n }\n const timesGrown = Math.round(\n ((0.5 * runningScriptObj.dataMap[ip][2]) / runningScriptObj.onlineRunningTime) * timePassed,\n );\n runningScriptObj.log(`Called on ${serv.hostname} ${timesGrown} times while offline`);\n const host = AllServers[runningScriptObj.server];\n const growth = processSingleServerGrowth(serv, timesGrown, Player, host.cpuCores);\n runningScriptObj.log(\n `'${serv.hostname}' grown by ${numeralWrapper.format(growth * 100 - 100, \"0.000000%\")} while offline`,\n );\n }\n }\n\n // Offline EXP gain\n // A script's offline production will always be at most half of its online production.\n const expGain = confidence * (runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime) * timePassed;\n Player.gainHackingExp(expGain);\n\n // Update script stats\n runningScriptObj.offlineRunningTime += timePassed;\n runningScriptObj.offlineExpGained += expGain;\n\n // Weaken\n for (const ip in runningScriptObj.dataMap) {\n if (runningScriptObj.dataMap.hasOwnProperty(ip)) {\n if (runningScriptObj.dataMap[ip][3] == 0 || runningScriptObj.dataMap[ip][3] == null) {\n continue;\n }\n const serv = AllServers[ip];\n if (serv == null) {\n continue;\n }\n const host = AllServers[runningScriptObj.server];\n const timesWeakened = Math.round(\n ((0.5 * runningScriptObj.dataMap[ip][3]) / runningScriptObj.onlineRunningTime) * timePassed,\n );\n runningScriptObj.log(`Called weaken() on ${serv.hostname} ${timesWeakened} times while offline`);\n const coreBonus = 1 + (host.cpuCores - 1) / 16;\n serv.weaken(CONSTANTS.ServerWeakenAmount * timesWeakened * coreBonus);\n }\n }\n}\n\n//Returns a RunningScript object matching the filename and arguments on the\n//designated server, and false otherwise\nexport function findRunningScript(filename, args, server) {\n for (var i = 0; i < server.runningScripts.length; ++i) {\n if (server.runningScripts[i].filename === filename && compareArrays(server.runningScripts[i].args, args)) {\n return server.runningScripts[i];\n }\n }\n return null;\n}\n\n//Returns a RunningScript object matching the pid on the\n//designated server, and false otherwise\nexport function findRunningScriptByPid(pid, server) {\n for (var i = 0; i < server.runningScripts.length; ++i) {\n if (server.runningScripts[i].pid === pid) {\n return server.runningScripts[i];\n }\n }\n return null;\n}\n","import { setTimeoutRef } from \"./utils/SetTimeoutRef\";\nimport { dialogBoxCreate } from \"../utils/DialogBox\";\nimport { BaseServer } from \"./Server/BaseServer\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../utils/JSONReviver\";\n\n/**\n * Represents a plain text file that is typically stored on a server.\n */\nexport class TextFile {\n /**\n * The full file name.\n */\n fn: string;\n\n /**\n * The content of the file.\n */\n text: string;\n\n constructor(fn = \"\", txt = \"\") {\n this.fn = (fn.endsWith(\".txt\") ? fn : `${fn}.txt`).replace(/\\s+/g, \"\");\n this.text = txt;\n }\n\n /**\n * Concatenates the raw values to the end of current content.\n */\n append(txt: string): void {\n this.text += txt;\n }\n\n /**\n * Serves the file to the user as a downloadable resource through the browser.\n */\n download(): void {\n const filename: string = this.fn;\n const file: Blob = new Blob([this.text], { type: \"text/plain\" });\n /* tslint:disable-next-line:strict-boolean-expressions */\n if (window.navigator.msSaveOrOpenBlob) {\n // IE10+\n window.navigator.msSaveOrOpenBlob(file, filename);\n } else {\n // Others\n const a: HTMLAnchorElement = document.createElement(\"a\");\n const url: string = URL.createObjectURL(file);\n a.href = url;\n a.download = this.fn;\n document.body.appendChild(a);\n a.click();\n setTimeoutRef(() => {\n document.body.removeChild(a);\n window.URL.revokeObjectURL(url);\n }, 0);\n }\n }\n\n /**\n * Retrieve the content of the file.\n */\n read(): string {\n return this.text;\n }\n\n /**\n * Shows the content to the user via the game's dialog box.\n */\n show(): void {\n dialogBoxCreate(`${this.fn}

${this.text}`, true);\n }\n\n /**\n * Serialize the current file to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"TextFile\", this);\n }\n\n /**\n * Replaces the current content with the text provided.\n */\n write(txt: string): void {\n this.text = txt;\n }\n\n /**\n * Initiatizes a TextFile from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): TextFile {\n return Generic_fromJSON(TextFile, value.data);\n }\n}\n\nReviver.constructors.TextFile = TextFile;\n\n/**\n * Retrieve the file object for the filename on the specified server.\n * @param fn The file name to look for\n * @param server The server object to look in\n * @returns The file object, or null if it couldn't find it.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getTextFile(fn: string, server: BaseServer): TextFile | null {\n const filename: string = !fn.endsWith(\".txt\") ? `${fn}.txt` : fn;\n\n for (const file of server.textFiles as TextFile[]) {\n if (file.fn === filename) {\n return file;\n }\n }\n\n return null;\n}\n\n/**\n * Creates a TextFile on the target server.\n * @param fn The file name to create.\n * @param txt The contents of the file.\n * @param server The server that the file should be created on.\n * @returns The instance of the file.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function createTextFile(fn: string, txt: string, server: BaseServer): TextFile | undefined {\n if (getTextFile(fn, server) !== null) {\n // This should probably be a `throw`...\n /* tslint:disable-next-line:no-console */\n console.error(`A file named \"${fn}\" already exists on server ${server.hostname}.`);\n\n return undefined;\n }\n const file: TextFile = new TextFile(fn, txt);\n server.textFiles.push(file);\n\n return file;\n}\n","import { dialogBoxCreate } from \"../DialogBox\";\n\ninterface IError {\n fileName?: string;\n lineNumber?: number;\n}\n\nexport function exceptionAlert(e: IError): void {\n console.error(e);\n dialogBoxCreate(\n \"Caught an exception: \" +\n e +\n \"

\" +\n \"Filename: \" +\n (e.fileName || \"UNKNOWN FILE NAME\") +\n \"

\" +\n \"Line Number: \" +\n (e.lineNumber || \"UNKNOWN LINE NUMBER\") +\n \"

\" +\n \"This is a bug, please report to game developer with this \" +\n \"message as well as details about how to reproduce the bug.

\" +\n \"If you want to be safe, I suggest refreshing the game WITHOUT saving so that your \" +\n \"safe doesn't get corrupted\",\n false,\n );\n}\n","import { Message } from \"./Message\";\nimport { Augmentations } from \"../Augmentation/Augmentations\";\nimport { AugmentationNames } from \"../Augmentation/data/AugmentationNames\";\nimport { Programs } from \"../Programs/Programs\";\nimport { inMission } from \"../Missions\";\nimport { Player } from \"../Player\";\nimport { redPillFlag } from \"../RedPill\";\nimport { GetServerByHostname } from \"../Server/ServerHelpers\";\nimport { Settings } from \"../Settings/Settings\";\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\nimport { Reviver } from \"../../utils/JSONReviver\";\n\n//Sends message to player, including a pop up\nfunction sendMessage(msg, forced = false) {\n msg.recvd = true;\n if (forced || !Settings.SuppressMessages) {\n showMessage(msg);\n }\n addMessageToServer(msg, \"home\");\n}\n\nfunction showMessage(msg) {\n var txt =\n \"Message received from unknown sender:

\" +\n \"\" +\n msg.msg +\n \"

\" +\n \"This message was saved as \" +\n msg.filename +\n \" onto your home computer.\";\n dialogBoxCreate(txt);\n}\n\n//Adds a message to a server\nfunction addMessageToServer(msg, serverHostname) {\n var server = GetServerByHostname(serverHostname);\n if (server == null) {\n console.warn(`Could not find server ${serverHostname}`);\n return;\n }\n for (var i = 0; i < server.messages.length; ++i) {\n if (server.messages[i].filename === msg.filename) {\n return; //Already exists\n }\n }\n server.messages.push(msg);\n}\n\n//Checks if any of the 'timed' messages should be sent\nfunction checkForMessagesToSend() {\n if (redPillFlag) return;\n const jumper0 = Messages[MessageFilenames.Jumper0];\n const jumper1 = Messages[MessageFilenames.Jumper1];\n const jumper2 = Messages[MessageFilenames.Jumper2];\n const jumper3 = Messages[MessageFilenames.Jumper3];\n const jumper4 = Messages[MessageFilenames.Jumper4];\n const cybersecTest = Messages[MessageFilenames.CyberSecTest];\n const nitesecTest = Messages[MessageFilenames.NiteSecTest];\n const bitrunnersTest = Messages[MessageFilenames.BitRunnersTest];\n const redpill = Messages[MessageFilenames.RedPill];\n\n let redpillOwned = false;\n if (Augmentations[AugmentationNames.TheRedPill].owned) {\n redpillOwned = true;\n }\n\n if (redpill && redpillOwned && Player.sourceFiles.length === 0 && !redPillFlag && !inMission) {\n sendMessage(redpill, true);\n } else if (redpill && redpillOwned) {\n //If player has already destroyed a BitNode, message is not forced\n if (!redPillFlag && !inMission) {\n sendMessage(redpill);\n }\n } else if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) {\n sendMessage(jumper0);\n const flightName = Programs.Flight.name;\n const homeComp = Player.getHomeComputer();\n if (!homeComp.programs.includes(flightName)) {\n homeComp.programs.push(flightName);\n }\n } else if (jumper1 && !jumper1.recvd && Player.hacking_skill >= 40) {\n sendMessage(jumper1);\n } else if (cybersecTest && !cybersecTest.recvd && Player.hacking_skill >= 50) {\n sendMessage(cybersecTest);\n } else if (jumper2 && !jumper2.recvd && Player.hacking_skill >= 175) {\n sendMessage(jumper2);\n } else if (nitesecTest && !nitesecTest.recvd && Player.hacking_skill >= 200) {\n sendMessage(nitesecTest);\n } else if (jumper3 && !jumper3.recvd && Player.hacking_skill >= 350) {\n sendMessage(jumper3);\n } else if (jumper4 && !jumper4.recvd && Player.hacking_skill >= 490) {\n sendMessage(jumper4);\n } else if (bitrunnersTest && !bitrunnersTest.recvd && Player.hacking_skill >= 500) {\n sendMessage(bitrunnersTest);\n }\n}\n\nfunction AddToAllMessages(msg) {\n Messages[msg.filename] = msg;\n}\n\nlet Messages = {};\n\nfunction loadMessages(saveString) {\n Messages = JSON.parse(saveString, Reviver);\n}\n\nlet MessageFilenames = {\n Jumper0: \"j0.msg\",\n Jumper1: \"j1.msg\",\n Jumper2: \"j2.msg\",\n Jumper3: \"j3.msg\",\n Jumper4: \"j4.msg\",\n CyberSecTest: \"csec-test.msg\",\n NiteSecTest: \"nitesec-test.msg\",\n BitRunnersTest: \"19dfj3l1nd.msg\",\n RedPill: \"icarus.msg\",\n};\n\nfunction initMessages() {\n //Reset\n Messages = {};\n\n //jump3R Messages\n AddToAllMessages(\n new Message(\n MessageFilenames.Jumper0,\n \"I know you can sense it. I know you're searching for it. \" +\n \"It's why you spend night after \" +\n \"night at your computer.

It's real, I've seen it. And I can \" +\n \"help you find it. But not right now. You're not ready yet.

\" +\n \"Use this program to track your progress

\" +\n \"The fl1ght.exe program was added to your home computer

\" +\n \"-jump3R\",\n ),\n );\n AddToAllMessages(\n new Message(\n MessageFilenames.Jumper1,\n \"Soon you will be contacted by a hacking group known as CyberSec. \" +\n \"They can help you with your search.

\" +\n \"You should join them, garner their favor, and \" +\n \"exploit them for their Augmentations. But do not trust them. \" +\n \"They are not what they seem. No one is.

\" +\n \"-jump3R\",\n ),\n );\n AddToAllMessages(\n new Message(\n MessageFilenames.Jumper2,\n \"Do not try to save the world. There is no world to save. If \" +\n \"you want to find the truth, worry only about yourself. Ethics and \" +\n \"morals will get you killed.

Watch out for a hacking group known as NiteSec.\" +\n \"

-jump3R\",\n ),\n );\n AddToAllMessages(\n new Message(\n MessageFilenames.Jumper3,\n \"You must learn to walk before you can run. And you must \" +\n \"run before you can fly. Look for the black hand.

\" +\n \"I.I.I.I

-jump3R\",\n ),\n );\n AddToAllMessages(\n new Message(\n MessageFilenames.Jumper4,\n \"To find what you are searching for, you must understand the bits. \" +\n \"The bits are all around us. The runners will help you.

\" +\n \"-jump3R\",\n ),\n );\n\n //Messages from hacking factions\n AddToAllMessages(\n new Message(\n MessageFilenames.CyberSecTest,\n \"We've been watching you. Your skills are very impressive. But you're wasting \" +\n \"your talents. If you join us, you can put your skills to good use and change \" +\n \"the world for the better. If you join us, we can unlock your full potential.

\" +\n \"But first, you must pass our test. Find and install the backdoor on our server.

\" +\n \"-CyberSec\",\n ),\n );\n AddToAllMessages(\n new Message(\n MessageFilenames.NiteSecTest,\n \"People say that the corrupted governments and corporations rule the world. \" +\n \"Yes, maybe they do. But do you know who everyone really fears? People \" +\n \"like us. Because they can't hide from us. Because they can't fight shadows \" +\n \"and ideas with bullets.

\" +\n \"Join us, and people will fear you, too.

\" +\n \"Find and install the backdoor on our server. Then, we will contact you again.\" +\n \"

-NiteSec\",\n ),\n );\n AddToAllMessages(\n new Message(\n MessageFilenames.BitRunnersTest,\n \"We know what you are doing. We know what drives you. We know \" +\n \"what you are looking for.

\" +\n \"We can help you find the answers.

\" +\n \"run4theh111z\",\n ),\n );\n\n AddToAllMessages(\n new Message(\n MessageFilenames.RedPill,\n \"@)(#V%*N)@(#*)*C)@#%*)*V)@#(*%V@)(#VN%*)@#(*%
\" +\n \")@B(*#%)@)M#B*%V)____FIND___#$@)#%(B*)@#(*%B)
\" +\n \"@_#(%_@#M(BDSPOMB__THE-CAVE_#)$(*@#$)@#BNBEGB
\" +\n \"DFLSMFVMV)#@($*)@#*$MV)@#(*$V)M#(*$)M@(#*VM$)\",\n ),\n );\n}\n\nexport { Messages, checkForMessagesToSend, sendMessage, showMessage, loadMessages, initMessages, Message };\n","export function calculateSkill(exp: number, mult = 1): number {\n return Math.max(Math.floor(mult * (32 * Math.log(exp + 534.5) - 200)), 1);\n}\n\nexport function calculateExp(skill: number, mult = 1): number {\n return Math.exp((skill / mult + 200) / 32) - 534.6;\n}\n","import { BitNodeMultipliers } from \"../../BitNode/BitNodeMultipliers\";\nimport { HacknetNodeConstants } from \"../data/Constants\";\n\nexport function calculateMoneyGainRate(level: number, ram: number, cores: number, mult: number): number {\n const gainPerLevel = HacknetNodeConstants.MoneyGainPerLevel;\n\n const levelMult = level * gainPerLevel;\n const ramMult = Math.pow(1.035, ram - 1);\n const coresMult = (cores + 5) / 6;\n return levelMult * ramMult * coresMult * mult * BitNodeMultipliers.HacknetNodeMoney;\n}\n\nexport function calculateLevelUpgradeCost(startingLevel: number, extraLevels = 1, costMult = 1): number {\n const sanitizedLevels = Math.round(extraLevels);\n if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {\n return 0;\n }\n\n if (startingLevel >= HacknetNodeConstants.MaxLevel) {\n return Infinity;\n }\n\n const mult = HacknetNodeConstants.UpgradeLevelMult;\n let totalMultiplier = 0;\n let currLevel = startingLevel;\n for (let i = 0; i < sanitizedLevels; ++i) {\n totalMultiplier += HacknetNodeConstants.LevelBaseCost * Math.pow(mult, currLevel);\n ++currLevel;\n }\n\n return (HacknetNodeConstants.BaseCost / 2) * totalMultiplier * costMult;\n}\n\nexport function calculateRamUpgradeCost(startingRam: number, extraLevels = 1, costMult = 1): number {\n const sanitizedLevels = Math.round(extraLevels);\n if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {\n return 0;\n }\n\n if (startingRam >= HacknetNodeConstants.MaxRam) {\n return Infinity;\n }\n\n let totalCost = 0;\n let numUpgrades = Math.round(Math.log2(startingRam));\n let currentRam = startingRam;\n\n for (let i = 0; i < sanitizedLevels; ++i) {\n const baseCost = currentRam * HacknetNodeConstants.RamBaseCost;\n const mult = Math.pow(HacknetNodeConstants.UpgradeRamMult, numUpgrades);\n\n totalCost += baseCost * mult;\n\n currentRam *= 2;\n ++numUpgrades;\n }\n\n totalCost *= costMult;\n\n return totalCost;\n}\n\nexport function calculateCoreUpgradeCost(startingCore: number, extraLevels = 1, costMult = 1): number {\n const sanitizedCores = Math.round(extraLevels);\n if (isNaN(sanitizedCores) || sanitizedCores < 1) {\n return 0;\n }\n\n if (startingCore >= HacknetNodeConstants.MaxCores) {\n return Infinity;\n }\n\n const coreBaseCost = HacknetNodeConstants.CoreBaseCost;\n const mult = HacknetNodeConstants.UpgradeCoreMult;\n let totalCost = 0;\n let currentCores = startingCore;\n for (let i = 0; i < sanitizedCores; ++i) {\n totalCost += coreBaseCost * Math.pow(mult, currentCores - 1);\n ++currentCores;\n }\n\n totalCost *= costMult;\n\n return totalCost;\n}\n\nexport function calculateNodeCost(n: number, mult = 1): number {\n if (n <= 0) {\n return 0;\n }\n return HacknetNodeConstants.BaseCost * Math.pow(HacknetNodeConstants.PurchaseNextMult, n - 1) * mult;\n}\n","import { BlackOperation } from \"./BlackOperation\";\nimport { IMap } from \"../types\";\n\nexport const BlackOperations: IMap = {};\n\n(function () {\n BlackOperations[\"Operation Typhoon\"] = new BlackOperation({\n name: \"Operation Typhoon\",\n desc:\n \"Obadiah Zenyatta is the leader of a RedWater PMC. It has long \" +\n \"been known among the intelligence community that Zenyatta, along \" +\n \"with the rest of the PMC, is a Synthoid.

\" +\n \"The goal of Operation Typhoon is to find and eliminate \" +\n \"Zenyatta and RedWater by any means necessary. After the task \" +\n \"is completed, the actions must be covered up from the general public.\",\n baseDifficulty: 2000,\n reqdRank: 2.5e3,\n rankGain: 50,\n rankLoss: 10,\n hpLoss: 100,\n weights: {\n hack: 0.1,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Zero\"] = new BlackOperation({\n name: \"Operation Zero\",\n desc:\n \"AeroCorp is one of the world's largest defense contractors. \" +\n \"Its leader, Steve Watataki, is thought to be a supporter of \" +\n \"Synthoid rights. He must be removed.

\" +\n \"The goal of Operation Zero is to covertly infiltrate AeroCorp and \" +\n \"uncover any incriminating evidence or \" +\n \"information against Watataki that will cause him to be removed \" +\n \"from his position at AeroCorp. Incriminating evidence can be \" +\n \"fabricated as a last resort. Be warned that AeroCorp has some of \" +\n \"the most advanced security measures in the world.\",\n baseDifficulty: 2500,\n reqdRank: 5e3,\n rankGain: 60,\n rankLoss: 15,\n hpLoss: 50,\n weights: {\n hack: 0.2,\n str: 0.15,\n def: 0.15,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isStealth: true,\n });\n BlackOperations[\"Operation X\"] = new BlackOperation({\n name: \"Operation X\",\n desc:\n \"We have recently discovered an underground publication \" +\n \"group called Samizdat. Even though most of their publications \" +\n \"are nonsensical conspiracy theories, the average human is \" +\n \"gullible enough to believe them. Many of their works discuss \" +\n \"Synthoids and pose a threat to society. The publications are spreading \" +\n \"rapidly in China and other Eastern countries.

\" +\n \"Samizdat has done a good job of keeping hidden and anonymous. \" +\n \"However, we've just received intelligence that their base of \" +\n \"operations is in Ishima's underground sewer systems. Your task is to \" +\n \"investigate the sewer systems, and eliminate Samizdat. They must \" +\n \"never publish anything again.\",\n baseDifficulty: 3000,\n reqdRank: 7.5e3,\n rankGain: 75,\n rankLoss: 15,\n hpLoss: 100,\n weights: {\n hack: 0.1,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Titan\"] = new BlackOperation({\n name: \"Operation Titan\",\n desc:\n \"Several months ago Titan Laboratories' Bioengineering department \" +\n \"was infiltrated by Synthoids. As far as we know, Titan Laboratories' \" +\n \"management has no knowledge about this. We don't know what the \" +\n \"Synthoids are up to, but the research that they could \" +\n \"be conducting using Titan Laboraties' vast resources is potentially \" +\n \"very dangerous.

\" +\n \"Your goal is to enter and destroy the Bioengineering department's \" +\n \"facility in Aevum. The task is not just to retire the Synthoids there, but \" +\n \"also to destroy any information or research at the facility that \" +\n \"is relevant to the Synthoids and their goals.\",\n baseDifficulty: 4000,\n reqdRank: 10e3,\n rankGain: 100,\n rankLoss: 20,\n hpLoss: 100,\n weights: {\n hack: 0.1,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Ares\"] = new BlackOperation({\n name: \"Operation Ares\",\n desc:\n \"One of our undercover agents, Agent Carter, has informed us of a \" +\n \"massive weapons deal going down in Dubai between rogue Russian \" +\n \"militants and a radical Synthoid community. These weapons are next-gen \" +\n \"plasma and energy weapons. It is critical for the safety of humanity \" +\n \"that this deal does not happen.

\" +\n \"Your task is to intercept the deal. Leave no survivors.\",\n baseDifficulty: 5000,\n reqdRank: 12.5e3,\n rankGain: 125,\n rankLoss: 20,\n hpLoss: 200,\n weights: {\n hack: 0,\n str: 0.25,\n def: 0.25,\n dex: 0.25,\n agi: 0.25,\n cha: 0,\n int: 0,\n },\n decays: {\n hack: 0,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Archangel\"] = new BlackOperation({\n name: \"Operation Archangel\",\n desc:\n \"Our analysts have discovered that the popular Red Rabbit brothel in \" +\n \"Amsterdam is run and 'staffed' by MK-VI Synthoids. Intelligence \" +\n \"suggests that the profit from this brothel is used to fund a large \" +\n \"black market arms trafficking operation.

\" +\n \"The goal of this operation is to take out the leaders that are running \" +\n \"the Red Rabbit brothel. Try to limit the number of other casualties, \" +\n \"but do what you must to complete the mission.\",\n baseDifficulty: 7500,\n reqdRank: 15e3,\n rankGain: 200,\n rankLoss: 20,\n hpLoss: 25,\n weights: {\n hack: 0,\n str: 0.2,\n def: 0.2,\n dex: 0.3,\n agi: 0.3,\n cha: 0,\n int: 0,\n },\n decays: {\n hack: 0,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Juggernaut\"] = new BlackOperation({\n name: \"Operation Juggernaut\",\n desc:\n \"The CIA has just encountered a new security threat. A new \" +\n \"criminal group, lead by a shadowy operative who calls himself \" +\n \"Juggernaut, has been smuggling drugs and weapons (including \" +\n \"suspected bioweapons) into Sector-12. We also have reason \" +\n \"to believe the tried to break into one of Universal Energy's \" +\n \"facilities in order to cause a city-wide blackout. The CIA \" +\n \"suspects that Juggernaut is a heavily-augmented Synthoid, and \" +\n \"have thus enlisted our help.

\" +\n \"Your mission is to eradicate Juggernaut and his followers.\",\n baseDifficulty: 10e3,\n reqdRank: 20e3,\n rankGain: 300,\n rankLoss: 40,\n hpLoss: 300,\n weights: {\n hack: 0,\n str: 0.25,\n def: 0.25,\n dex: 0.25,\n agi: 0.25,\n cha: 0,\n int: 0,\n },\n decays: {\n hack: 0,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Red Dragon\"] = new BlackOperation({\n name: \"Operation Red Dragon\",\n desc:\n \"The Tetrads criminal organization is suspected of \" +\n \"reverse-engineering the MK-VI Synthoid design. We believe \" +\n \"they altered and possibly improved the design and began \" +\n \"manufacturing their own Synthoid models in order to bolster \" +\n \"their criminal activities.

\" +\n \"Your task is to infiltrate and destroy the Tetrads' base of operations \" +\n \"in Los Angeles. Intelligence tells us that their base houses \" +\n \"one of their Synthoid manufacturing units.\",\n baseDifficulty: 12.5e3,\n reqdRank: 25e3,\n rankGain: 500,\n rankLoss: 50,\n hpLoss: 500,\n weights: {\n hack: 0.05,\n str: 0.2,\n def: 0.2,\n dex: 0.25,\n agi: 0.25,\n cha: 0,\n int: 0.05,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation K\"] = new BlackOperation({\n name: \"Operation K\",\n desc:\n \"CODE RED SITUATION. Our intelligence tells us that VitaLife \" +\n \"has discovered a new android cloning technology. This technology \" +\n \"is supposedly capable of cloning Synthoid, not only physically \" +\n \"but also their advanced AI modules. We do not believe that \" +\n \"VitaLife is trying to use this technology illegally or \" +\n \"maliciously, but if any Synthoids were able to infiltrate the \" +\n \"corporation and take advantage of this technology then the \" +\n \"results would be catastrophic.

\" +\n \"We do not have the power or jurisdiction to shutdown this down \" +\n \"through legal or political means, so we must resort to a covert \" +\n \"operation. Your goal is to destroy this technology and eliminate \" +\n \"anyone who was involved in its creation.\",\n baseDifficulty: 15e3,\n reqdRank: 30e3,\n rankGain: 750,\n rankLoss: 60,\n hpLoss: 1000,\n weights: {\n hack: 0.05,\n str: 0.2,\n def: 0.2,\n dex: 0.25,\n agi: 0.25,\n cha: 0,\n int: 0.05,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Deckard\"] = new BlackOperation({\n name: \"Operation Deckard\",\n desc:\n \"Despite your success in eliminating VitaLife's new android-replicating \" +\n \"technology in Operation K, we've discovered that a small group of \" +\n \"MK-VI Synthoids were able to make off with the schematics and design \" +\n \"of the technology before the Operation. It is almost a certainty that \" +\n \"these Synthoids are some of the rogue MK-VI ones from the Synthoid Uprising.

\" +\n \"The goal of Operation Deckard is to hunt down these Synthoids and retire \" +\n \"them. I don't need to tell you how critical this mission is.\",\n baseDifficulty: 20e3,\n reqdRank: 40e3,\n rankGain: 1e3,\n rankLoss: 75,\n hpLoss: 200,\n weights: {\n hack: 0,\n str: 0.24,\n def: 0.24,\n dex: 0.24,\n agi: 0.24,\n cha: 0,\n int: 0.04,\n },\n decays: {\n hack: 0,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Tyrell\"] = new BlackOperation({\n name: \"Operation Tyrell\",\n desc:\n \"A week ago Blade Industries reported a small break-in at one \" +\n \"of their Aevum Augmentation storage facitilities. We figured out \" +\n \"that The Dark Army was behind the heist, and didn't think any more \" +\n \"of it. However, we've just discovered that several known MK-VI Synthoids \" +\n \"were part of that break-in group.

\" +\n \"We cannot have Synthoids upgrading their already-enhanced abilities \" +\n \"with Augmentations. Your task is to hunt down the associated Dark Army \" +\n \"members and eliminate them.\",\n baseDifficulty: 25e3,\n reqdRank: 50e3,\n rankGain: 1.5e3,\n rankLoss: 100,\n hpLoss: 500,\n weights: {\n hack: 0.1,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Wallace\"] = new BlackOperation({\n name: \"Operation Wallace\",\n desc:\n \"Based on information gathered from Operation Tyrell, we've discovered \" +\n \"that The Dark Army was well aware that there were Synthoids amongst \" +\n \"their ranks. Even worse, we believe that The Dark Army is working \" +\n \"together with other criminal organizations such as The Syndicate and \" +\n \"that they are planning some sort of large-scale takeover of multiple major \" +\n \"cities, most notably Aevum. We suspect that Synthoids have infiltrated \" +\n \"the ranks of these criminal factions and are trying to stage another \" +\n \"Synthoid uprising.

\" +\n \"The best way to deal with this is to prevent it before it even happens. \" +\n \"The goal of Operation Wallace is to destroy the Dark Army and \" +\n \"Syndicate factions in Aevum immediately. Leave no survivors.\",\n baseDifficulty: 30e3,\n reqdRank: 75e3,\n rankGain: 2e3,\n rankLoss: 150,\n hpLoss: 1500,\n weights: {\n hack: 0,\n str: 0.24,\n def: 0.24,\n dex: 0.24,\n agi: 0.24,\n cha: 0,\n int: 0.04,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Shoulder of Orion\"] = new BlackOperation({\n name: \"Operation Shoulder of Orion\",\n desc:\n \"China's Solaris Space Systems is secretly launching the first \" +\n \"manned spacecraft in over a decade using Synthoids. We believe \" +\n \"China is trying to establish the first off-world colonies.

\" +\n \"The mission is to prevent this launch without instigating an \" +\n \"international conflict. When you accept this mission you will be \" +\n \"officially disavowed by the NSA and the national government until after you \" +\n \"successfully return. In the event of failure, all of the operation's \" +\n \"team members must not let themselves be captured alive.\",\n baseDifficulty: 35e3,\n reqdRank: 100e3,\n rankGain: 2.5e3,\n rankLoss: 500,\n hpLoss: 1500,\n weights: {\n hack: 0.1,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isStealth: true,\n });\n BlackOperations[\"Operation Hyron\"] = new BlackOperation({\n name: \"Operation Hyron\",\n desc:\n \"Our intelligence tells us that Fulcrum Technologies is developing \" +\n \"a quantum supercomputer using human brains as core \" +\n \"processors. This supercomputer \" +\n \"is rumored to be able to store vast amounts of data and \" +\n \"perform computations unmatched by any other supercomputer on the \" +\n \"planet. But more importantly, the use of organic human brains \" +\n \"means that the supercomputer may be able to reason abstractly \" +\n \"and become self-aware.

\" +\n \"I do not need to remind you why sentient-level AIs pose a serious \" +\n \"threat to all of mankind.

\" +\n \"The research for this project is being conducted at one of Fulcrum \" +\n \"Technologies secret facilities in Aevum, codenamed 'Alpha Ranch'. \" +\n \"Infiltrate the compound, delete and destroy the work, and then find and kill the \" +\n \"project lead.\",\n baseDifficulty: 40e3,\n reqdRank: 125e3,\n rankGain: 3e3,\n rankLoss: 1e3,\n hpLoss: 500,\n weights: {\n hack: 0.1,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Morpheus\"] = new BlackOperation({\n name: \"Operation Morpheus\",\n desc:\n \"DreamSense Technologies is an advertising company that uses \" +\n \"special technology to transmit their ads into the peoples \" +\n \"dreams and subconcious. They do this using broadcast transmitter \" +\n \"towers. Based on information from our agents and informants in \" +\n \"Chonqging, we have reason to believe that one of the broadcast \" +\n \"towers there has been compromised by Synthoids and is being used \" +\n \"to spread pro-Synthoid propaganda.

\" +\n \"The mission is to destroy this broadcast tower. Speed and \" +\n \"stealth are of the upmost important for this.\",\n baseDifficulty: 45e3,\n reqdRank: 150e3,\n rankGain: 4e3,\n rankLoss: 1e3,\n hpLoss: 100,\n weights: {\n hack: 0.05,\n str: 0.15,\n def: 0.15,\n dex: 0.3,\n agi: 0.3,\n cha: 0,\n int: 0.05,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isStealth: true,\n });\n BlackOperations[\"Operation Ion Storm\"] = new BlackOperation({\n name: \"Operation Ion Storm\",\n desc:\n \"Our analysts have uncovered a gathering of MK-VI Synthoids \" +\n \"that have taken up residence in the Sector-12 Slums. We \" +\n \"don't know if they are rogue Synthoids from the Uprising, \" +\n \"but we do know that they have been stockpiling \" +\n \"weapons, money, and other resources. This makes them dangerous.

\" +\n \"This is a full-scale assault operation to find and retire all of these \" +\n \"Synthoids in the Sector-12 Slums.\",\n baseDifficulty: 50e3,\n reqdRank: 175e3,\n rankGain: 5e3,\n rankLoss: 1e3,\n hpLoss: 5000,\n weights: {\n hack: 0,\n str: 0.24,\n def: 0.24,\n dex: 0.24,\n agi: 0.24,\n cha: 0,\n int: 0.04,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Annihilus\"] = new BlackOperation({\n name: \"Operation Annihilus\",\n desc:\n \"Our superiors have ordered us to eradicate everything and everyone \" +\n \"in an underground facility located in Aevum. They tell us \" +\n \"that the facility houses many dangerous Synthoids and \" +\n \"belongs to a terrorist organization called \" +\n \"'The Covenant'. We have no prior intelligence about this \" +\n \"organization, so you are going in blind.\",\n baseDifficulty: 55e3,\n reqdRank: 200e3,\n rankGain: 7.5e3,\n rankLoss: 1e3,\n hpLoss: 10e3,\n weights: {\n hack: 0,\n str: 0.24,\n def: 0.24,\n dex: 0.24,\n agi: 0.24,\n cha: 0,\n int: 0.04,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Ultron\"] = new BlackOperation({\n name: \"Operation Ultron\",\n desc:\n \"OmniTek Incorporated, the original designer and manufacturer of Synthoids, \" +\n \"has notified us of a malfunction in their AI design. This malfunction, \" +\n \"when triggered, causes MK-VI Synthoids to become radicalized and seek out \" +\n \"the destruction of humanity. They say that this bug affects all MK-VI Synthoids, \" +\n \"not just the rogue ones from the Uprising.

\" +\n \"OmniTek has also told us they they believe someone has triggered this \" +\n \"malfunction in a large group of MK-VI Synthoids, and that these newly-radicalized Synthoids \" +\n \"are now amassing in Volhaven to form a terrorist group called Ultron.

\" +\n \"Intelligence suggests Ultron is heavily armed and that their members are \" +\n \"augmented. We believe Ultron is making moves to take control of \" +\n \"and weaponize DeltaOne's Tactical High-Energy Satellite Laser Array (THESLA).

\" +\n \"Your task is to find and destroy Ultron.\",\n baseDifficulty: 60e3,\n reqdRank: 250e3,\n rankGain: 10e3,\n rankLoss: 2e3,\n hpLoss: 10e3,\n weights: {\n hack: 0.1,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n isKill: true,\n });\n BlackOperations[\"Operation Centurion\"] = new BlackOperation({\n name: \"Operation Centurion\",\n desc:\n \"D)@#)($M)C0293c40($*)@#D0JUMP3Rm0C<*@#)*$)#02c94830c(#$*D)

\" +\n \"Throughout all of humanity's history, we have relied on \" +\n \"technology to survive, conquer, and progress. Its advancement became our primary goal. \" +\n \"And at the peak of human civilization technology turned into \" +\n \"power. Global, absolute power.

\" +\n \"It seems that the universe is not without a sense of irony.

\" +\n \"D)@#)($M)C0293c40($*)@#D0JUMP3Rm0C<*@#)*$)#02c94830c(#$*D)\",\n baseDifficulty: 70e3,\n reqdRank: 300e3,\n rankGain: 15e3,\n rankLoss: 5e3,\n hpLoss: 10e3,\n weights: {\n hack: 0.1,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n });\n BlackOperations[\"Operation Vindictus\"] = new BlackOperation({\n name: \"Operation Vindictus\",\n desc:\n \"D)@#)($M)C0293c40($*)@#D0JUMP3Rm0C<*@#)*$)#02c94830c(#$*D)

\" +\n \"The bits are all around us. The daemons that hold the Node \" +\n \"together can manifest themselves in many different ways.

\" +\n \"D)@#)($M)C0293c40($*)@#D0JUMP3Rm0C<*@#)*$)#02c94830c(#$*D)\",\n baseDifficulty: 75e3,\n reqdRank: 350e3,\n rankGain: 20e3,\n rankLoss: 20e3,\n hpLoss: 20e3,\n weights: {\n hack: 0.1,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n });\n BlackOperations[\"Operation Daedalus\"] = new BlackOperation({\n name: \"Operation Daedalus\",\n desc: \"Yesterday we obeyed kings and bent our neck to emperors. \" + \"Today we kneel only to truth.\",\n baseDifficulty: 80e3,\n reqdRank: 400e3,\n rankGain: 40e3,\n rankLoss: 10e3,\n hpLoss: 100e3,\n weights: {\n hack: 0.1,\n str: 0.2,\n def: 0.2,\n dex: 0.2,\n agi: 0.2,\n cha: 0,\n int: 0.1,\n },\n decays: {\n hack: 0.6,\n str: 0.8,\n def: 0.8,\n dex: 0.8,\n agi: 0.8,\n cha: 0,\n int: 0.75,\n },\n });\n})();\n","import { Action } from \"./Action\";\nimport { IMap } from \"../types\";\n\nexport const GeneralActions: IMap = {};\n\n(function () {\n // General Actions\n let actionName;\n actionName = \"Training\";\n GeneralActions[actionName] = new Action({\n name: actionName,\n desc:\n \"Improve your abilities at the Bladeburner unit's specialized training \" +\n \"center. Doing this gives experience for all combat stats and also \" +\n \"increases your max stamina.\",\n });\n\n actionName = \"Field Analysis\";\n GeneralActions[actionName] = new Action({\n name: actionName,\n desc:\n \"Mine and analyze Synthoid-related data. This improves the \" +\n \"Bladeburner's unit intelligence on Synthoid locations and \" +\n \"activities. Completing this action will improve the accuracy \" +\n \"of your Synthoid population estimated in the current city.

\" +\n \"Does NOT require stamina.\",\n });\n\n actionName = \"Recruitment\";\n GeneralActions[actionName] = new Action({\n name: actionName,\n desc:\n \"Attempt to recruit members for your Bladeburner team. These members \" +\n \"can help you conduct operations.

\" +\n \"Does NOT require stamina.\",\n });\n\n actionName = \"Diplomacy\";\n GeneralActions[actionName] = new Action({\n name: actionName,\n desc:\n \"Improve diplomatic relations with the Synthoid population. \" +\n \"Completing this action will reduce the Chaos level in your current city.

\" +\n \"Does NOT require stamina.\",\n });\n\n actionName = \"Hyperbolic Regeneration Chamber\";\n GeneralActions[actionName] = new Action({\n name: actionName,\n desc:\n \"Enter cryogenic stasis using the Bladeburner division's hi-tech Regeneration Chamber. \" +\n \"This will slowly heal your wounds and slightly increase your stamina.

\",\n });\n})();\n","import { BitNodes } from \"../BitNode/BitNode\";\n\nexport class SourceFile {\n info: string;\n lvl = 1;\n n: number;\n name: string;\n owned = false;\n\n constructor(number: number, info = \"\") {\n const bitnodeKey = \"BitNode\" + number;\n const bitnode = BitNodes[bitnodeKey];\n if (bitnode == null) {\n throw new Error(\"Invalid Bit Node for this Source File\");\n }\n\n this.n = number;\n this.name = `Source-File ${number}: ${bitnode.name}`;\n this.info = info;\n }\n}\n","import * as React from \"react\";\n\nexport const stealthIcon = (\n \n \n \n \n \n \n);\nexport const killIcon = (\n \n \n \n \n \n \n);\n","/**\n * Map of all Hash Upgrades\n * Key = Hash name, Value = HashUpgrade object\n */\nimport { HashUpgrade, IConstructorParams } from \"./HashUpgrade\";\nimport { HashUpgradesMetadata } from \"./data/HashUpgradesMetadata\";\nimport { IMap } from \"../types\";\n\nexport const HashUpgrades: IMap = {};\n\nfunction createHashUpgrade(p: IConstructorParams): void {\n HashUpgrades[p.name] = new HashUpgrade(p);\n}\n\nfor (const metadata of HashUpgradesMetadata) {\n createHashUpgrade(metadata);\n}\n","/**\n * Returns the input array as a comma separated string.\n *\n * Does several things that Array.toString() doesn't do\n * - Adds brackets around the array\n * - Adds quotation marks around strings\n */\nexport function arrayToString(a: T[]): string {\n const vals: any[] = [];\n for (let i = 0; i < a.length; ++i) {\n let elem: any = a[i];\n if (Array.isArray(elem)) {\n elem = arrayToString(elem);\n } else if (typeof elem === \"string\") {\n elem = `\"${elem}\"`;\n }\n vals.push(elem);\n }\n\n return `[${vals.join(\", \")}]`;\n}\n","import { BitNodeMultipliers } from \"../BitNode/BitNodeMultipliers\";\nimport { CONSTANTS } from \"../Constants\";\n\nexport function getStockMarketAccountCost(): number {\n return CONSTANTS.WSEAccountCost;\n}\n\nexport function getStockMarketTixApiCost(): number {\n return CONSTANTS.TIXAPICost;\n}\n\nexport function getStockMarket4SDataCost(): number {\n return CONSTANTS.MarketData4SCost * BitNodeMultipliers.FourSigmaMarketDataCost;\n}\n\nexport function getStockMarket4STixApiCost(): number {\n return CONSTANTS.MarketDataTixApi4SCost * BitNodeMultipliers.FourSigmaMarketDataApiCost;\n}\n","/**\n * React Component for a button that's used to apply for a job\n */\nimport * as React from \"react\";\n\nimport { Company } from \"../../Company/Company\";\nimport { CompanyPosition } from \"../../Company/CompanyPosition\";\nimport { getJobRequirementText } from \"../../Company/GetJobRequirementText\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nimport { StdButton } from \"../../ui/React/StdButton\";\n\ntype IProps = {\n company: Company;\n entryPosType: CompanyPosition;\n onClick: (e: React.MouseEvent) => void;\n p: IPlayer;\n style?: any;\n text: string;\n};\n\nexport class ApplyToJobButton extends React.Component {\n constructor(props: IProps) {\n super(props);\n\n this.getJobRequirementTooltip = this.getJobRequirementTooltip.bind(this);\n }\n\n getJobRequirementTooltip(): string {\n const pos = this.props.p.getNextCompanyPosition(this.props.company, this.props.entryPosType);\n if (pos == null) {\n return \"\";\n }\n\n if (!this.props.company.hasPosition(pos)) {\n return \"\";\n }\n\n return getJobRequirementText(this.props.company, pos, true);\n }\n\n render(): React.ReactNode {\n return (\n \n );\n }\n}\n","/**\n * React component to create an accordion element\n */\nimport * as React from \"react\";\n\ntype IProps = {\n headerClass?: string; // Override default class\n headerContent: React.ReactElement;\n panelClass?: string; // Override default class\n panelContent: React.ReactElement;\n panelInitiallyOpened?: boolean;\n style?: string;\n};\n\ntype IState = {\n panelOpened: boolean;\n};\n\nexport class BBAccordion extends React.Component {\n constructor(props: IProps) {\n super(props);\n\n this.handleHeaderClick = this.handleHeaderClick.bind(this);\n\n this.state = {\n panelOpened: props.panelInitiallyOpened ? props.panelInitiallyOpened : false,\n };\n }\n\n handleHeaderClick(): void {\n this.setState({\n panelOpened: !this.state.panelOpened,\n });\n }\n\n render(): React.ReactNode {\n let className = \"accordion-header\";\n if (typeof this.props.headerClass === \"string\") {\n className = this.props.headerClass;\n }\n\n if (this.state.panelOpened) className += \" active\";\n\n return (\n <>\n \n \n \n );\n }\n}\n\ntype IPanelProps = {\n opened: boolean;\n panelClass?: string; // Override default class\n panelContent: React.ReactElement;\n};\n\nclass AccordionPanel extends React.Component {\n shouldComponentUpdate(nextProps: IPanelProps): boolean {\n return this.props.opened || nextProps.opened;\n }\n\n render(): React.ReactNode {\n let className = \"accordion-panel\";\n if (typeof this.props.panelClass === \"string\") {\n className = this.props.panelClass;\n }\n\n if (!this.props.opened) return <>;\n\n return (\n
\n {this.props.panelContent}\n
\n );\n }\n}\n","/*\nThe game cannot block every possible exploits. Specially since one of them is\nthat you can just edit your save file and that's impragmatic to prevent.\n\nSo instead we have source file minus 1. It is not obtained by destroying a\nBitNode but instead it is awarded when the player finds innovative ways to break\nthe game, this serves 2 purpose, [one] the developpers don't have to spend time\ntrying to implement anti-cheat measures and [two] finding ways to break a\nhacking game is very much in the spirit of the game.\nSource-File minus 1 is extremely weak because it can be fully level up quickly.\n*/\n\nexport enum Exploit {\n UndocumentedFunctionCall = \"UndocumentedFunctionCall\",\n Unclickable = \"Unclickable\",\n PrototypeTampering = \"PrototypeTampering\",\n Bypass = \"Bypass\",\n // To the players reading this. Yes you're supposed to add EditSaveFile by\n // editing your save file, yes you could add them all, no we don't care\n // that's not the point.\n EditSaveFile = \"EditSaveFile\",\n}\n\nconst names: {\n [key: string]: string;\n} = {\n UndocumentedFunctionCall: \"by looking beyond the documentation.\",\n EditSaveFile: \"by editing your save file.\",\n PrototypeTampering: \"by tampering with Numbers prototype.\",\n Unclickable: \"by clicking the unclickable.\",\n Bypass: \"by circumventing the ram cost of document.\",\n};\n\nexport function ExploitName(exploit: string): string {\n return names[exploit];\n}\n\nexport function sanitizeExploits(exploits: string[]): string[] {\n return exploits.filter((e: string) => Object.keys(Exploit).includes(e));\n}\n","/**\n * Event emitter that triggers when scripts are started/stopped\n */\nimport { EventEmitter } from \"../utils/EventEmitter\";\n\nexport const WorkerScriptStartStopEventEmitter = new EventEmitter<[]>();\n","/**\n * Stateless button that represents something that has been purchased.\n */\nimport * as React from \"react\";\n\ninterface IStdButtonPurchasedProps {\n onClick?: (e: React.MouseEvent) => any;\n style?: any;\n text: string;\n tooltip?: string;\n}\n\ntype IInnerHTMLMarkup = {\n __html: string;\n};\n\nexport class StdButtonPurchased extends React.Component {\n constructor(props: IStdButtonPurchasedProps) {\n super(props);\n this.hasTooltip = this.hasTooltip.bind(this);\n this.tooltip = this.tooltip.bind(this);\n }\n\n hasTooltip(): boolean {\n return this.props.tooltip != null && this.props.tooltip !== \"\";\n }\n\n tooltip(): string {\n if (!this.props.tooltip) return \"\";\n return this.props.tooltip;\n }\n\n render(): React.ReactNode {\n let className = \"std-button-bought\";\n if (this.hasTooltip()) {\n className += \" tooltip\";\n }\n\n // Tooltip will be set using inner HTML\n let tooltipMarkup: IInnerHTMLMarkup = {\n __html: \"\",\n };\n if (this.hasTooltip()) {\n tooltipMarkup = {\n __html: this.tooltip(),\n };\n }\n\n return (\n \n );\n }\n}\n","import { DarkWebItem } from \"./DarkWebItem\";\nimport { IMap } from \"../types\";\nimport { Programs } from \"../Programs/Programs\";\n\nexport const DarkWebItems: IMap = {\n BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram.name, 500e3, \"Opens up SSH Ports\"),\n FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram.name, 1500e3, \"Opens up FTP Ports\"),\n RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram.name, 5e6, \"Opens up SMTP Ports\"),\n HTTPWormProgram: new DarkWebItem(Programs.HTTPWormProgram.name, 30e6, \"Opens up HTTP Ports\"),\n SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram.name, 250e6, \"Opens up SQL Ports\"),\n DeepscanV1: new DarkWebItem(Programs.DeepscanV1.name, 500000, \"Enables 'scan-analyze' with a depth up to 5\"),\n DeepscanV2: new DarkWebItem(Programs.DeepscanV2.name, 25e6, \"Enables 'scan-analyze' with a depth up to 10\"),\n AutolinkProgram: new DarkWebItem(Programs.AutoLink.name, 1e6, \"Enables direct connect via 'scan-analyze'\"),\n ServerProfilerProgram: new DarkWebItem(\n Programs.ServerProfiler.name,\n 1e6,\n \"Displays hacking and Netscript-related information about a server\",\n ),\n};\n","export enum RamCalculationErrorCode {\n SyntaxError = -1,\n ImportError = -2,\n URLImportError = -3,\n}\n","export const GangConstants: {\n GangRespectToReputationRatio: number;\n MaximumGangMembers: number;\n CyclesPerTerritoryAndPowerUpdate: number;\n AscensionMultiplierRatio: number;\n Names: string[];\n} = {\n // Respect is divided by this to get rep gain\n GangRespectToReputationRatio: 25,\n MaximumGangMembers: 12,\n CyclesPerTerritoryAndPowerUpdate: 100,\n // Portion of upgrade multiplier that is kept after ascending\n AscensionMultiplierRatio: 0.15,\n // Names of possible Gangs\n Names: [\n \"Slum Snakes\",\n \"Tetrads\",\n \"The Syndicate\",\n \"The Dark Army\",\n \"Speakers for the Dead\",\n \"NiteSec\",\n \"The Black Hand\",\n ],\n};\n","import { getElementById } from \"./getElementById\";\nimport { removeElement } from \"./removeElement\";\n\n/**\n * Given its id, this function removes an element AND its children\n * @param id The HTML identifier to search for and remove.\n */\nexport function removeElementById(id: string): void {\n try {\n const elem: HTMLElement = getElementById(id);\n removeElement(elem);\n } catch (e) {\n // Probably should log this as we're trying to remove elements that don't exist.\n }\n}\n","import { getRandomByte } from \"./helpers/getRandomByte\";\n\n/**\n * Generate a random IP address\n * Does not check to see if the IP already exists in the game\n */\nexport function createRandomIp(): string {\n const ip: string = getRandomByte(99) + \".\" + getRandomByte(9) + \".\" + getRandomByte(9) + \".\" + getRandomByte(9);\n\n return ip;\n}\n","/**\n * Does a shallow compare of two arrays to determine if they are equal.\n * @param a1 The first array\n * @param a2 The second array\n */\nexport function compareArrays(a1: T[], a2: T[]): boolean {\n if (a1.length !== a2.length) {\n return false;\n }\n\n for (let i = 0; i < a1.length; ++i) {\n if (Array.isArray(a1[i])) {\n // If the other element is not an array, then these cannot be equal\n if (!Array.isArray(a2[i])) {\n return false;\n }\n\n const elem1 = a1[i] as any;\n const elem2 = a2[i] as any;\n if (!compareArrays(elem1, elem2)) {\n return false;\n }\n } else if (a1[i] !== a2[i]) {\n return false;\n }\n }\n\n return true;\n}\n","import React, { useState, useEffect } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { killWorkerScript } from \"../src/Netscript/killWorkerScript\";\nimport { RunningScript } from \"../src/Script/RunningScript\";\n\nimport { createElement } from \"./uiHelpers/createElement\";\nimport { removeElementById } from \"./uiHelpers/removeElementById\";\n\nlet gameContainer: HTMLElement;\n\n(function () {\n function getGameContainer(): void {\n const container = document.getElementById(\"entire-game-container\");\n if (container == null) {\n throw new Error(`Failed to find game container DOM element`);\n }\n\n gameContainer = container;\n document.removeEventListener(\"DOMContentLoaded\", getGameContainer);\n }\n\n document.addEventListener(\"DOMContentLoaded\", getGameContainer);\n})();\n\ninterface IProps {\n script: RunningScript;\n container: HTMLElement;\n id: string;\n}\n\nfunction ScriptLogPopup(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => {\n const id = setInterval(rerender, 1000);\n return () => clearInterval(id);\n }, []);\n\n function close(): void {\n const content = document.getElementById(props.id);\n if (content == null) return;\n ReactDOM.unmountComponentAtNode(content);\n removeElementById(props.id);\n }\n\n useEffect(() => {\n function closeHandler(event: KeyboardEvent): void {\n if (event.keyCode === 27) {\n close();\n }\n }\n\n document.addEventListener(\"keydown\", closeHandler);\n\n return () => {\n document.removeEventListener(\"keydown\", closeHandler);\n };\n }, []);\n\n function kill(): void {\n killWorkerScript(props.script, props.script.server, true);\n close();\n }\n\n function drag(event: React.MouseEvent): void {\n event.preventDefault();\n let x = event.clientX;\n let y = event.clientY;\n let left = props.container.offsetLeft + props.container.clientWidth / 2;\n let top = props.container.offsetTop + props.container.clientWidth / 5;\n function mouseMove(event: MouseEvent): void {\n left += event.clientX - x;\n top += event.clientY - y;\n props.container.style.left = left + \"px\";\n props.container.style.top = top + \"px\";\n // reset right and bottom to avoid the window stretching\n props.container.style.right = \"\";\n props.container.style.bottom = \"\";\n x = event.clientX;\n y = event.clientY;\n }\n function mouseUp(): void {\n document.removeEventListener(\"mouseup\", mouseUp);\n document.removeEventListener(\"mousemove\", mouseMove);\n }\n document.addEventListener(\"mouseup\", mouseUp);\n document.addEventListener(\"mousemove\", mouseMove);\n }\n\n return (\n <>\n
\n

\n {props.script.filename} {props.script.args.map((x: any): string => `${x}`).join(\" \")}\n

\n
\n \n \n
\n
\n
\n

\n {props.script.logs.map(\n (line: string, i: number): JSX.Element => (\n \n {line}\n
\n
\n ),\n )}\n

\n
\n \n );\n}\n\nexport function logBoxCreate(script: RunningScript): void {\n const id = script.server + \"-\" + script.filename + script.args.map((x: any): string => `${x}`).join(\"-\");\n if (document.getElementById(id) !== null) return;\n const container = createElement(\"div\", {\n class: \"log-box-container\",\n id: id,\n });\n gameContainer.appendChild(container);\n ReactDOM.render(, container);\n}\n","import { Player } from \"../Player\";\nimport { getRandomInt } from \"../../utils/helpers/getRandomInt\";\nimport { addOffset } from \"../../utils/helpers/addOffset\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\nimport { BladeburnerConstants } from \"./data/Constants\";\nimport { IBladeburner } from \"./IBladeburner\";\nimport { IAction, ISuccessChanceParams } from \"./IAction\";\n\nclass StatsMultiplier {\n [key: string]: number;\n\n hack = 0;\n str = 0;\n def = 0;\n dex = 0;\n agi = 0;\n cha = 0;\n int = 0;\n}\n\nexport interface IActionParams {\n name?: string;\n desc?: string;\n level?: number;\n maxLevel?: number;\n autoLevel?: boolean;\n baseDifficulty?: number;\n difficultyFac?: number;\n rewardFac?: number;\n successes?: number;\n failures?: number;\n rankGain?: number;\n rankLoss?: number;\n hpLoss?: number;\n hpLost?: number;\n isStealth?: boolean;\n isKill?: boolean;\n count?: number;\n weights?: StatsMultiplier;\n decays?: StatsMultiplier;\n teamCount?: number;\n}\n\nexport class Action implements IAction {\n name = \"\";\n desc = \"\";\n\n // Difficulty scales with level. See getDifficulty() method\n level = 1;\n maxLevel = 1;\n autoLevel = true;\n baseDifficulty = 100;\n difficultyFac = 1.01;\n\n // Rank increase/decrease is affected by this exponent\n rewardFac = 1.02;\n\n successes = 0;\n failures = 0;\n\n // All of these scale with level/difficulty\n rankGain = 0;\n rankLoss = 0;\n hpLoss = 0;\n hpLost = 0;\n\n // Action Category. Current categories are stealth and kill\n isStealth = false;\n isKill = false;\n\n /**\n * Number of this contract remaining, and its growth rate\n * Growth rate is an integer and the count will increase by that integer every \"cycle\"\n */\n count: number = getRandomInt(1e3, 25e3);\n\n // Weighting of each stat in determining action success rate\n weights: StatsMultiplier = {\n hack: 1 / 7,\n str: 1 / 7,\n def: 1 / 7,\n dex: 1 / 7,\n agi: 1 / 7,\n cha: 1 / 7,\n int: 1 / 7,\n };\n // Diminishing returns of stats (stat ^ decay where 0 <= decay <= 1)\n decays: StatsMultiplier = {\n hack: 0.9,\n str: 0.9,\n def: 0.9,\n dex: 0.9,\n agi: 0.9,\n cha: 0.9,\n int: 0.9,\n };\n teamCount = 0;\n\n // Base Class for Contracts, Operations, and BlackOps\n constructor(params: IActionParams | null = null) {\n // | null = null\n if (params && params.name) this.name = params.name;\n if (params && params.desc) this.desc = params.desc;\n\n if (params && params.baseDifficulty) this.baseDifficulty = addOffset(params.baseDifficulty, 10);\n if (params && params.difficultyFac) this.difficultyFac = params.difficultyFac;\n\n if (params && params.rewardFac) this.rewardFac = params.rewardFac;\n if (params && params.rankGain) this.rankGain = params.rankGain;\n if (params && params.rankLoss) this.rankLoss = params.rankLoss;\n if (params && params.hpLoss) this.hpLoss = params.hpLoss;\n\n if (params && params.isStealth) this.isStealth = params.isStealth;\n if (params && params.isKill) this.isKill = params.isKill;\n\n if (params && params.count) this.count = params.count;\n\n if (params && params.weights) this.weights = params.weights;\n if (params && params.decays) this.decays = params.decays;\n\n // Check to make sure weights are summed properly\n let sum = 0;\n for (const weight in this.weights) {\n if (this.weights.hasOwnProperty(weight)) {\n sum += this.weights[weight];\n }\n }\n if (sum - 1 >= 10 * Number.EPSILON) {\n throw new Error(\n \"Invalid weights when constructing Action \" +\n this.name +\n \". The weights should sum up to 1. They sum up to :\" +\n 1,\n );\n }\n\n for (const decay in this.decays) {\n if (this.decays.hasOwnProperty(decay)) {\n if (this.decays[decay] > 1) {\n throw new Error(\n \"Invalid decays when constructing \" + \"Action \" + this.name + \". \" + \"Decay value cannot be greater than 1\",\n );\n }\n }\n }\n }\n\n getDifficulty(): number {\n const difficulty = this.baseDifficulty * Math.pow(this.difficultyFac, this.level - 1);\n if (isNaN(difficulty)) {\n throw new Error(\"Calculated NaN in Action.getDifficulty()\");\n }\n return difficulty;\n }\n\n /**\n * Tests for success. Should be called when an action has completed\n * @param inst {Bladeburner} - Bladeburner instance\n */\n attempt(inst: IBladeburner): boolean {\n return Math.random() < this.getSuccessChance(inst);\n }\n\n // To be implemented by subtypes\n getActionTimePenalty(): number {\n return 1;\n }\n\n getActionTime(inst: IBladeburner): number {\n const difficulty = this.getDifficulty();\n let baseTime = difficulty / BladeburnerConstants.DifficultyToTimeFactor;\n const skillFac = inst.skillMultipliers.actionTime; // Always < 1\n\n const effAgility = Player.agility * inst.skillMultipliers.effAgi;\n const effDexterity = Player.dexterity * inst.skillMultipliers.effDex;\n const statFac =\n 0.5 *\n (Math.pow(effAgility, BladeburnerConstants.EffAgiExponentialFactor) +\n Math.pow(effDexterity, BladeburnerConstants.EffDexExponentialFactor) +\n effAgility / BladeburnerConstants.EffAgiLinearFactor +\n effDexterity / BladeburnerConstants.EffDexLinearFactor); // Always > 1\n\n baseTime = Math.max(1, (baseTime * skillFac) / statFac);\n\n return Math.ceil(baseTime * this.getActionTimePenalty());\n }\n\n // For actions that have teams. To be implemented by subtypes.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getTeamSuccessBonus(inst: IBladeburner): number {\n return 1;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getActionTypeSkillSuccessBonus(inst: IBladeburner): number {\n return 1;\n }\n\n getChaosCompetencePenalty(inst: IBladeburner, params: ISuccessChanceParams): number {\n const city = inst.getCurrentCity();\n if (params.est) {\n return Math.pow(city.popEst / BladeburnerConstants.PopulationThreshold, BladeburnerConstants.PopulationExponent);\n } else {\n return Math.pow(city.pop / BladeburnerConstants.PopulationThreshold, BladeburnerConstants.PopulationExponent);\n }\n }\n\n getChaosDifficultyBonus(inst: IBladeburner /*, params: ISuccessChanceParams*/): number {\n const city = inst.getCurrentCity();\n if (city.chaos > BladeburnerConstants.ChaosThreshold) {\n const diff = 1 + (city.chaos - BladeburnerConstants.ChaosThreshold);\n const mult = Math.pow(diff, 0.1);\n return mult;\n }\n\n return 1;\n }\n\n getEstSuccessChance(inst: IBladeburner): number[] {\n function clamp(x: number): number {\n return Math.max(0, Math.min(x, 1));\n }\n const est = this.getSuccessChance(inst, { est: true });\n const real = this.getSuccessChance(inst);\n const diff = Math.abs(real - est);\n let low = real - diff;\n let high = real + diff;\n const city = inst.getCurrentCity();\n const r = city.pop / city.popEst;\n\n if (r < 1) low *= r;\n else high *= r;\n return [clamp(low), clamp(high)];\n }\n\n /**\n * @inst - Bladeburner Object\n * @params - options:\n * est (bool): Get success chance estimate instead of real success chance\n */\n getSuccessChance(inst: IBladeburner, params: ISuccessChanceParams = { est: false }): number {\n if (inst == null) {\n throw new Error(\"Invalid Bladeburner instance passed into Action.getSuccessChance\");\n }\n let difficulty = this.getDifficulty();\n let competence = 0;\n for (const stat in this.weights) {\n if (this.weights.hasOwnProperty(stat)) {\n const playerStatLvl = Player.queryStatFromString(stat);\n const key = \"eff\" + stat.charAt(0).toUpperCase() + stat.slice(1);\n let effMultiplier = inst.skillMultipliers[key];\n if (effMultiplier == null) {\n console.error(`Failed to find Bladeburner Skill multiplier for: ${stat}`);\n effMultiplier = 1;\n }\n competence += this.weights[stat] * Math.pow(effMultiplier * playerStatLvl, this.decays[stat]);\n }\n }\n competence *= Player.getIntelligenceBonus(0.75);\n competence *= inst.calculateStaminaPenalty();\n\n competence *= this.getTeamSuccessBonus(inst);\n\n competence *= this.getChaosCompetencePenalty(inst, params);\n difficulty *= this.getChaosDifficultyBonus(inst);\n\n if (this.name == \"Raid\" && inst.getCurrentCity().comms <= 0) {\n return 0;\n }\n\n // Factor skill multipliers into success chance\n competence *= inst.skillMultipliers.successChanceAll;\n competence *= this.getActionTypeSkillSuccessBonus(inst);\n if (this.isStealth) {\n competence *= inst.skillMultipliers.successChanceStealth;\n }\n if (this.isKill) {\n competence *= inst.skillMultipliers.successChanceKill;\n }\n\n // Augmentation multiplier\n competence *= Player.bladeburner_success_chance_mult;\n\n if (isNaN(competence)) {\n throw new Error(\"Competence calculated as NaN in Action.getSuccessChance()\");\n }\n return Math.min(1, competence / difficulty);\n }\n\n getSuccessesNeededForNextLevel(baseSuccessesPerLevel: number): number {\n return Math.ceil(0.5 * this.maxLevel * (2 * baseSuccessesPerLevel + (this.maxLevel - 1)));\n }\n\n setMaxLevel(baseSuccessesPerLevel: number): void {\n if (this.successes >= this.getSuccessesNeededForNextLevel(baseSuccessesPerLevel)) {\n ++this.maxLevel;\n }\n }\n\n toJSON(): any {\n return Generic_toJSON(\"Action\", this);\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Action {\n return Generic_fromJSON(Action, value.data);\n }\n}\n\nReviver.constructors.Action = Action;\n","/**\n * Game engine. Handles the main game loop.\n */\nimport { convertTimeMsToTimeElapsedString } from \"../utils/StringHelperFunctions\";\nimport { Augmentations } from \"./Augmentation/Augmentations\";\nimport { initAugmentations } from \"./Augmentation/AugmentationHelpers\";\nimport { AugmentationNames } from \"./Augmentation/data/AugmentationNames\";\nimport { initBitNodeMultipliers } from \"./BitNode/BitNode\";\nimport { Bladeburner } from \"./Bladeburner/Bladeburner\";\nimport { generateRandomContract } from \"./CodingContractGenerator\";\nimport { initCompanies } from \"./Company/Companies\";\nimport { Corporation } from \"./Corporation/Corporation\";\nimport { CONSTANTS } from \"./Constants\";\nimport { Factions, initFactions } from \"./Faction/Factions\";\nimport { processPassiveFactionRepGain, inviteToFaction } from \"./Faction/FactionHelpers\";\nimport { Router } from \"./ui/GameRoot\";\n\nimport {\n getHackingWorkRepGain,\n getFactionSecurityWorkRepGain,\n getFactionFieldWorkRepGain,\n} from \"./PersonObjects/formulas/reputation\";\nimport { hasHacknetServers, processHacknetEarnings } from \"./Hacknet/HacknetHelpers\";\nimport { iTutorialStart } from \"./InteractiveTutorial\";\nimport { checkForMessagesToSend, initMessages } from \"./Message/MessageHelpers\";\nimport { inMission, currMission } from \"./Missions\";\nimport { loadAllRunningScripts, updateOnlineScriptTimes } from \"./NetscriptWorker\";\nimport { Player } from \"./Player\";\nimport { saveObject, loadGame } from \"./SaveObject\";\nimport { initForeignServers } from \"./Server/AllServers\";\nimport { Settings } from \"./Settings/Settings\";\nimport { updateSourceFileFlags } from \"./SourceFile/SourceFileFlags\";\nimport { initSpecialServerIps } from \"./Server/SpecialServerIps\";\nimport { initSymbolToStockMap, processStockPrices } from \"./StockMarket/StockMarket\";\nimport { Terminal } from \"./Terminal\";\nimport { Sleeve } from \"./PersonObjects/Sleeve/Sleeve\";\nimport { Locations } from \"./Locations/Locations\";\nimport { LocationName } from \"./Locations/data/LocationNames\";\n\nimport { Money } from \"./ui/React/Money\";\nimport { Hashes } from \"./ui/React/Hashes\";\nimport { Reputation } from \"./ui/React/Reputation\";\n\nimport { dialogBoxCreate } from \"../utils/DialogBox\";\nimport { exceptionAlert } from \"../utils/helpers/exceptionAlert\";\n\nimport { startTampering } from \"./Exploits/tampering\";\nimport { startUnclickable } from \"./Exploits/unclickable\";\n\nimport React from \"react\";\n\nconst Engine = {\n // Time variables (milliseconds unix epoch time)\n _lastUpdate: new Date().getTime(),\n\n updateGame: function (numCycles = 1) {\n const time = numCycles * CONSTANTS._idleSpeed;\n if (Player.totalPlaytime == null) {\n Player.totalPlaytime = 0;\n }\n if (Player.playtimeSinceLastAug == null) {\n Player.playtimeSinceLastAug = 0;\n }\n if (Player.playtimeSinceLastBitnode == null) {\n Player.playtimeSinceLastBitnode = 0;\n }\n Player.totalPlaytime += time;\n Player.playtimeSinceLastAug += time;\n Player.playtimeSinceLastBitnode += time;\n\n Terminal.process(Router, Player, numCycles);\n\n // Working\n if (Player.isWorking) {\n if (Player.workType == CONSTANTS.WorkTypeFaction) {\n if (Player.workForFaction(numCycles)) {\n Router.toFaction();\n }\n } else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {\n if (Player.createProgramWork(numCycles)) {\n Router.toTerminal();\n }\n } else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {\n if (Player.takeClass(numCycles)) {\n Router.toCity();\n }\n } else if (Player.workType == CONSTANTS.WorkTypeCrime) {\n if (Player.commitCrime(numCycles)) {\n Router.toLocation(Locations[LocationName.Slums]);\n }\n } else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) {\n if (Player.workPartTime(numCycles)) {\n Router.toCity();\n }\n } else {\n if (Player.work(numCycles)) {\n Router.toCity();\n }\n }\n }\n\n // Update stock prices\n if (Player.hasWseAccount) {\n processStockPrices(numCycles);\n }\n\n // Gang, if applicable\n if (Player.inGang()) {\n Player.gang.process(numCycles, Player);\n }\n\n // Mission\n if (inMission && currMission) {\n currMission.process(numCycles);\n }\n\n // Corporation\n if (Player.corporation instanceof Corporation) {\n // Stores cycles in a \"buffer\". Processed separately using Engine Counters\n Player.corporation.storeCycles(numCycles);\n }\n\n if (Player.bladeburner instanceof Bladeburner) {\n Player.bladeburner.storeCycles(numCycles);\n }\n\n // Sleeves\n for (let i = 0; i < Player.sleeves.length; ++i) {\n if (Player.sleeves[i] instanceof Sleeve) {\n const expForOtherSleeves = Player.sleeves[i].process(Player, numCycles);\n\n // This sleeve earns experience for other sleeves\n if (expForOtherSleeves == null) {\n continue;\n }\n for (let j = 0; j < Player.sleeves.length; ++j) {\n if (j === i) {\n continue;\n }\n Player.sleeves[j].gainExperience(Player, expForOtherSleeves, numCycles, true);\n }\n }\n }\n\n // Counters\n Engine.decrementAllCounters(numCycles);\n Engine.checkCounters();\n\n // Update the running time of all active scripts\n updateOnlineScriptTimes(numCycles);\n\n // Hacknet Nodes\n processHacknetEarnings(Player, numCycles);\n },\n\n /**\n * Counters for the main event loop. Represent the number of game cycles that\n * are required for something to happen. These counters are in game cycles,\n * which is once every 200ms\n */\n Counters: {\n autoSaveCounter: 300,\n updateSkillLevelsCounter: 10,\n updateDisplays: 3,\n updateDisplaysLong: 15,\n updateActiveScriptsDisplay: 5,\n createProgramNotifications: 10,\n augmentationsNotifications: 10,\n checkFactionInvitations: 100,\n passiveFactionGrowth: 5,\n messages: 150,\n mechanicProcess: 5, // Processes certain mechanics (Corporation, Bladeburner)\n contractGeneration: 3000, // Generate Coding Contracts\n },\n\n decrementAllCounters: function (numCycles = 1) {\n for (var counter in Engine.Counters) {\n if (Engine.Counters.hasOwnProperty(counter)) {\n Engine.Counters[counter] = Engine.Counters[counter] - numCycles;\n }\n }\n },\n\n /**\n * Checks if any counters are 0. If they are, executes whatever\n * is necessary and then resets the counter\n */\n checkCounters: function () {\n if (Engine.Counters.autoSaveCounter <= 0) {\n if (Settings.AutosaveInterval == null) {\n Settings.AutosaveInterval = 60;\n }\n if (Settings.AutosaveInterval === 0) {\n Engine.Counters.autoSaveCounter = Infinity;\n } else {\n Engine.Counters.autoSaveCounter = Settings.AutosaveInterval * 5;\n saveObject.saveGame();\n }\n }\n\n if (Engine.Counters.checkFactionInvitations <= 0) {\n const invitedFactions = Player.checkForFactionInvitations();\n if (invitedFactions.length > 0) {\n const randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)];\n inviteToFaction(randFaction);\n }\n Engine.Counters.checkFactionInvitations = 100;\n }\n\n if (Engine.Counters.passiveFactionGrowth <= 0) {\n var adjustedCycles = Math.floor(5 - Engine.Counters.passiveFactionGrowth);\n processPassiveFactionRepGain(adjustedCycles);\n Engine.Counters.passiveFactionGrowth = 5;\n }\n\n if (Engine.Counters.messages <= 0) {\n checkForMessagesToSend();\n if (Augmentations[AugmentationNames.TheRedPill].owned) {\n Engine.Counters.messages = 4500; // 15 minutes for Red pill message\n } else {\n Engine.Counters.messages = 150;\n }\n }\n\n if (Engine.Counters.mechanicProcess <= 0) {\n if (Player.corporation instanceof Corporation) {\n Player.corporation.process(Player);\n }\n if (Player.bladeburner instanceof Bladeburner) {\n try {\n Player.bladeburner.process(Router, Player);\n } catch (e) {\n exceptionAlert(\"Exception caught in Bladeburner.process(): \" + e);\n }\n }\n Engine.Counters.mechanicProcess = 5;\n }\n\n if (Engine.Counters.contractGeneration <= 0) {\n // X% chance of a contract being generated\n if (Math.random() <= 0.25) {\n generateRandomContract();\n }\n Engine.Counters.contractGeneration = 3000;\n }\n },\n\n load: function (saveString) {\n startTampering();\n startUnclickable();\n // Load game from save or create new game\n if (loadGame(saveString)) {\n initBitNodeMultipliers(Player);\n updateSourceFileFlags(Player);\n initAugmentations(); // Also calls Player.reapplyAllAugmentations()\n Player.reapplyAllSourceFiles();\n if (Player.hasWseAccount) {\n initSymbolToStockMap();\n }\n\n // Calculate the number of cycles have elapsed while offline\n Engine._lastUpdate = new Date().getTime();\n const lastUpdate = Player.lastUpdate;\n const timeOffline = Engine._lastUpdate - lastUpdate;\n const numCyclesOffline = Math.floor(timeOffline / CONSTANTS._idleSpeed);\n\n let offlineReputation = 0;\n const offlineHackingIncome = (Player.moneySourceA.hacking / Player.playtimeSinceLastAug) * timeOffline * 0.75;\n Player.gainMoney(offlineHackingIncome);\n // Process offline progress\n loadAllRunningScripts(); // This also takes care of offline production for those scripts\n if (Player.isWorking) {\n Player.focus = true;\n if (Player.workType == CONSTANTS.WorkTypeFaction) {\n Player.workForFaction(numCyclesOffline);\n } else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {\n Player.createProgramWork(numCyclesOffline);\n } else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {\n Player.takeClass(numCyclesOffline);\n } else if (Player.workType == CONSTANTS.WorkTypeCrime) {\n Player.commitCrime(numCyclesOffline);\n } else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) {\n Player.workPartTime(numCyclesOffline);\n } else {\n Player.work(numCyclesOffline);\n }\n } else {\n for (let i = 0; i < Player.factions.length; i++) {\n const facName = Player.factions[i];\n if (!Factions.hasOwnProperty(facName)) continue;\n const faction = Factions[facName];\n if (!faction.isMember) continue;\n // No rep for special factions.\n const info = faction.getInfo();\n if (!info.offersWork()) continue;\n // No rep for gangs.\n if (Player.getGangName() === facName) continue;\n\n const hRep = getHackingWorkRepGain(Player, faction);\n const sRep = getFactionSecurityWorkRepGain(Player, faction);\n const fRep = getFactionFieldWorkRepGain(Player, faction);\n // can be infinite, doesn't matter.\n const reputationRate = Math.max(hRep, sRep, fRep) / Player.factions.length;\n\n const rep = reputationRate * numCyclesOffline;\n faction.playerReputation += rep;\n offlineReputation += rep;\n }\n }\n\n // Hacknet Nodes offline progress\n var offlineProductionFromHacknetNodes = processHacknetEarnings(Player, numCyclesOffline);\n const hacknetProdInfo = hasHacknetServers(Player) ? (\n <>{Hashes(offlineProductionFromHacknetNodes)} hashes\n ) : (\n \n );\n\n // Passive faction rep gain offline\n processPassiveFactionRepGain(numCyclesOffline);\n\n // Stock Market offline progress\n if (Player.hasWseAccount) {\n processStockPrices(numCyclesOffline);\n }\n\n // Gang progress for BitNode 2\n if (Player.inGang()) {\n Player.gang.process(numCyclesOffline, Player);\n }\n\n // Corporation offline progress\n if (Player.corporation instanceof Corporation) {\n Player.corporation.storeCycles(numCyclesOffline);\n }\n\n // Bladeburner offline progress\n if (Player.bladeburner instanceof Bladeburner) {\n Player.bladeburner.storeCycles(numCyclesOffline);\n }\n\n // Sleeves offline progress\n for (let i = 0; i < Player.sleeves.length; ++i) {\n if (Player.sleeves[i] instanceof Sleeve) {\n const expForOtherSleeves = Player.sleeves[i].process(Player, numCyclesOffline);\n\n // This sleeve earns experience for other sleeves\n if (expForOtherSleeves == null) {\n continue;\n }\n for (let j = 0; j < Player.sleeves.length; ++j) {\n if (j === i) {\n continue;\n }\n Player.sleeves[j].gainExperience(Player, expForOtherSleeves, numCyclesOffline, true);\n }\n }\n }\n\n // Update total playtime\n var time = numCyclesOffline * CONSTANTS._idleSpeed;\n if (Player.totalPlaytime == null) {\n Player.totalPlaytime = 0;\n }\n if (Player.playtimeSinceLastAug == null) {\n Player.playtimeSinceLastAug = 0;\n }\n if (Player.playtimeSinceLastBitnode == null) {\n Player.playtimeSinceLastBitnode = 0;\n }\n Player.totalPlaytime += time;\n Player.playtimeSinceLastAug += time;\n Player.playtimeSinceLastBitnode += time;\n\n Player.lastUpdate = Engine._lastUpdate;\n Engine.start(); // Run main game loop and Scripts loop\n const timeOfflineString = convertTimeMsToTimeElapsedString(time);\n dialogBoxCreate(\n <>\n Offline for {timeOfflineString}. While you were offline, your scripts generated{\" \"}\n , your Hacknet Nodes generated {hacknetProdInfo} and you gained{\" \"}\n {Reputation(offlineReputation)} divided amongst your factions.\n ,\n );\n } else {\n // No save found, start new game\n initBitNodeMultipliers(Player);\n initSpecialServerIps();\n Engine.start(); // Run main game loop and Scripts loop\n Player.init();\n initForeignServers(Player.getHomeComputer());\n initCompanies();\n initFactions();\n initAugmentations();\n initMessages();\n updateSourceFileFlags(Player);\n\n // Start interactive tutorial\n iTutorialStart();\n }\n },\n\n start: function () {\n // Get time difference\n const _thisUpdate = new Date().getTime();\n let diff = _thisUpdate - Engine._lastUpdate;\n const offset = diff % CONSTANTS._idleSpeed;\n\n // Divide this by cycle time to determine how many cycles have elapsed since last update\n diff = Math.floor(diff / CONSTANTS._idleSpeed);\n\n if (diff > 0) {\n // Update the game engine by the calculated number of cycles\n Engine._lastUpdate = _thisUpdate - offset;\n Player.lastUpdate = _thisUpdate - offset;\n Engine.updateGame(diff);\n }\n\n window.requestAnimationFrame(Engine.start);\n },\n};\n\nexport { Engine };\n","import { loadAliases, loadGlobalAliases, Aliases, GlobalAliases } from \"./Alias\";\nimport { Companies, loadCompanies } from \"./Company/Companies\";\nimport { CONSTANTS } from \"./Constants\";\nimport { Engine } from \"./engine\";\nimport { Factions, loadFactions } from \"./Faction/Factions\";\nimport { loadAllGangs, AllGangs } from \"./Gang/AllGangs\";\nimport { loadMessages, initMessages, Messages } from \"./Message/MessageHelpers\";\nimport { Player, loadPlayer } from \"./Player\";\nimport { AllServers, loadAllServers } from \"./Server/AllServers\";\nimport { Settings } from \"./Settings/Settings\";\nimport { loadSpecialServerIps, SpecialServerIps } from \"./Server/SpecialServerIps\";\nimport { SourceFileFlags } from \"./SourceFile/SourceFileFlags\";\nimport { loadStockMarket, StockMarket } from \"./StockMarket/StockMarket\";\n\nimport { createStatusText } from \"./ui/createStatusText\";\n\nimport { setTimeoutRef } from \"./utils/SetTimeoutRef\";\nimport * as ExportBonus from \"./ExportBonus\";\n\nimport { dialogBoxCreate } from \"../utils/DialogBox\";\nimport { clearEventListeners } from \"../utils/uiHelpers/clearEventListeners\";\nimport { Reviver, Generic_toJSON, Generic_fromJSON } from \"../utils/JSONReviver\";\nimport { save } from \"./db\";\n\nimport Decimal from \"decimal.js\";\n\n/* SaveObject.js\n * Defines the object used to save/load games\n */\nlet saveObject = new BitburnerSaveObject();\n\nfunction BitburnerSaveObject() {\n this.PlayerSave = \"\";\n this.AllServersSave = \"\";\n this.CompaniesSave = \"\";\n this.FactionsSave = \"\";\n this.SpecialServerIpsSave = \"\";\n this.AliasesSave = \"\";\n this.GlobalAliasesSave = \"\";\n this.MessagesSave = \"\";\n this.StockMarketSave = \"\";\n this.SettingsSave = \"\";\n this.VersionSave = \"\";\n this.AllGangsSave = \"\";\n this.LastExportBonus = \"\";\n}\n\nBitburnerSaveObject.prototype.getSaveString = function () {\n this.PlayerSave = JSON.stringify(Player);\n\n // Delete all logs from all running scripts\n var TempAllServers = JSON.parse(JSON.stringify(AllServers), Reviver);\n for (var ip in TempAllServers) {\n var server = TempAllServers[ip];\n if (server == null) {\n continue;\n }\n for (var i = 0; i < server.runningScripts.length; ++i) {\n var runningScriptObj = server.runningScripts[i];\n runningScriptObj.logs.length = 0;\n runningScriptObj.logs = [];\n }\n }\n\n this.AllServersSave = JSON.stringify(TempAllServers);\n this.CompaniesSave = JSON.stringify(Companies);\n this.FactionsSave = JSON.stringify(Factions);\n this.SpecialServerIpsSave = JSON.stringify(SpecialServerIps);\n this.AliasesSave = JSON.stringify(Aliases);\n this.GlobalAliasesSave = JSON.stringify(GlobalAliases);\n this.MessagesSave = JSON.stringify(Messages);\n this.StockMarketSave = JSON.stringify(StockMarket);\n this.SettingsSave = JSON.stringify(Settings);\n this.VersionSave = JSON.stringify(CONSTANTS.Version);\n this.LastExportBonus = JSON.stringify(ExportBonus.LastExportBonus);\n if (Player.inGang()) {\n this.AllGangsSave = JSON.stringify(AllGangs);\n }\n var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));\n\n return saveString;\n};\n\nBitburnerSaveObject.prototype.saveGame = function () {\n const saveString = this.getSaveString();\n\n save(saveString)\n .then(() => createStatusText(\"Game saved!\"))\n .catch((err) => console.error(err));\n};\n\n// Makes necessary changes to the loaded/imported data to ensure\n// the game stills works with new versions\nfunction evaluateVersionCompatibility(ver) {\n // This version refactored the Company/job-related code\n if (ver <= \"0.41.2\") {\n // Player's company position is now a string\n if (Player.companyPosition != null && typeof Player.companyPosition !== \"string\") {\n Player.companyPosition = Player.companyPosition.data.positionName;\n if (Player.companyPosition == null) {\n Player.companyPosition = \"\";\n }\n }\n\n // The \"companyName\" property of all Companies is renamed to \"name\"\n for (var companyName in Companies) {\n const company = Companies[companyName];\n if ((company.name == null || company.name === 0 || company.name === \"\") && company.companyName != null) {\n company.name = company.companyName;\n }\n\n if (company.companyPositions instanceof Array) {\n const pos = {};\n\n for (let i = 0; i < company.companyPositions.length; ++i) {\n pos[company.companyPositions[i]] = true;\n }\n company.companyPositions = pos;\n }\n }\n }\n\n // This version allowed players to hold multiple jobs\n if (ver < \"0.43.0\") {\n if (Player.companyName !== \"\" && Player.companyPosition != null && Player.companyPosition !== \"\") {\n Player.jobs[Player.companyName] = Player.companyPosition;\n }\n\n delete Player.companyPosition;\n }\n}\n\nfunction loadGame(saveString) {\n if (!saveString) return false;\n saveString = decodeURIComponent(escape(atob(saveString)));\n\n const saveObj = JSON.parse(saveString, Reviver);\n\n loadPlayer(saveObj.PlayerSave);\n loadAllServers(saveObj.AllServersSave);\n loadCompanies(saveObj.CompaniesSave);\n loadFactions(saveObj.FactionsSave);\n loadSpecialServerIps(saveObj.SpecialServerIpsSave);\n\n if (saveObj.hasOwnProperty(\"AliasesSave\")) {\n try {\n loadAliases(saveObj.AliasesSave);\n } catch (e) {\n console.warn(`Could not load Aliases from save`);\n loadAliases(\"\");\n }\n } else {\n console.warn(`Save file did not contain an Aliases property`);\n loadAliases(\"\");\n }\n if (saveObj.hasOwnProperty(\"GlobalAliasesSave\")) {\n try {\n loadGlobalAliases(saveObj.GlobalAliasesSave);\n } catch (e) {\n console.warn(`Could not load GlobalAliases from save`);\n loadGlobalAliases(\"\");\n }\n } else {\n console.warn(`Save file did not contain a GlobalAliases property`);\n loadGlobalAliases(\"\");\n }\n if (saveObj.hasOwnProperty(\"MessagesSave\")) {\n try {\n loadMessages(saveObj.MessagesSave);\n } catch (e) {\n console.warn(`Could not load Messages from save`);\n initMessages();\n }\n } else {\n console.warn(`Save file did not contain a Messages property`);\n initMessages();\n }\n if (saveObj.hasOwnProperty(\"StockMarketSave\")) {\n try {\n loadStockMarket(saveObj.StockMarketSave);\n } catch (e) {\n loadStockMarket(\"\");\n }\n } else {\n loadStockMarket(\"\");\n }\n if (saveObj.hasOwnProperty(\"SettingsSave\")) {\n try {\n Settings.load(saveObj.SettingsSave);\n } catch (e) {\n console.error(\"ERROR: Failed to parse Settings. Re-initing default values\");\n Settings.init();\n }\n } else {\n Settings.init();\n }\n if (saveObj.hasOwnProperty(\"LastExportBonus\")) {\n try {\n ExportBonus.setLastExportBonus(JSON.parse(saveObj.LastExportBonus));\n } catch (err) {\n ExportBonus.setLastExportBonus(new Date().getTime());\n console.error(\"ERROR: Failed to parse last export bonus Settings \" + err);\n }\n }\n if (saveObj.hasOwnProperty(\"VersionSave\")) {\n try {\n var ver = JSON.parse(saveObj.VersionSave, Reviver);\n evaluateVersionCompatibility(ver);\n\n if (window.location.href.toLowerCase().includes(\"bitburner-beta\")) {\n // Beta branch, always show changes\n createBetaUpdateText();\n } else if (ver != CONSTANTS.Version) {\n createNewUpdateText();\n }\n } catch (e) {\n createNewUpdateText();\n }\n } else {\n createNewUpdateText();\n }\n if (Player.inGang() && saveObj.hasOwnProperty(\"AllGangsSave\")) {\n try {\n loadAllGangs(saveObj.AllGangsSave);\n } catch (e) {\n console.error(\"ERROR: Failed to parse AllGangsSave: \" + e);\n }\n }\n\n return true;\n}\n\nBitburnerSaveObject.prototype.exportGame = function () {\n const saveString = this.getSaveString();\n\n // Save file name is based on current timestamp and BitNode\n const epochTime = Math.round(Date.now() / 1000);\n const bn = Player.bitNodeN;\n const filename = `bitburnerSave_BN${bn}x${SourceFileFlags[bn]}_${epochTime}.json`;\n var file = new Blob([saveString], { type: \"text/plain\" });\n if (window.navigator.msSaveOrOpenBlob) {\n // IE10+\n window.navigator.msSaveOrOpenBlob(file, filename);\n } else {\n // Others\n var a = document.createElement(\"a\"),\n url = URL.createObjectURL(file);\n a.href = url;\n a.download = filename;\n document.body.appendChild(a);\n a.click();\n setTimeoutRef(function () {\n document.body.removeChild(a);\n window.URL.revokeObjectURL(url);\n }, 0);\n }\n};\n\nfunction createNewUpdateText() {\n dialogBoxCreate(\n \"New update!
\" +\n \"Please report any bugs/issues through the github repository \" +\n \"or the Bitburner subreddit (reddit.com/r/bitburner).

\" +\n CONSTANTS.LatestUpdate,\n );\n}\n\nfunction createBetaUpdateText() {\n dialogBoxCreate(\n \"You are playing on the beta environment! This branch of the game \" +\n \"features the latest developments in the game. This version may be unstable.
\" +\n \"Please report any bugs/issues through the github repository (https://github.com/danielyxie/bitburner/issues) \" +\n \"or the Bitburner subreddit (reddit.com/r/bitburner).

\" +\n CONSTANTS.LatestUpdate,\n );\n}\n\nBitburnerSaveObject.prototype.toJSON = function () {\n return Generic_toJSON(\"BitburnerSaveObject\", this);\n};\n\nBitburnerSaveObject.fromJSON = function (value) {\n return Generic_fromJSON(BitburnerSaveObject, value.data);\n};\n\nReviver.constructors.BitburnerSaveObject = BitburnerSaveObject;\n\nexport { saveObject, loadGame };\n","/**\n * Sleeves are bodies that contain the player's cloned consciousness.\n * The player can use these bodies to perform different tasks synchronously.\n *\n * Each sleeve is its own individual, meaning it has its own stats/exp\n *\n * Sleeves are unlocked in BitNode-10.\n */\nimport { SleeveTaskType } from \"./SleeveTaskTypesEnum\";\n\nimport { IPlayer } from \"../IPlayer\";\nimport { Person, ITaskTracker, createTaskTracker } from \"../Person\";\n\nimport { Augmentation } from \"../../Augmentation/Augmentation\";\n\nimport { BitNodeMultipliers } from \"../../BitNode/BitNodeMultipliers\";\n\nimport { Crime } from \"../../Crime/Crime\";\nimport { Crimes } from \"../../Crime/Crimes\";\n\nimport { Companies } from \"../../Company/Companies\";\nimport { Company } from \"../../Company/Company\";\nimport { CompanyPosition } from \"../../Company/CompanyPosition\";\nimport { CompanyPositions } from \"../../Company/CompanyPositions\";\n\nimport { CONSTANTS } from \"../../Constants\";\n\nimport { Faction } from \"../../Faction/Faction\";\nimport { Factions } from \"../../Faction/Factions\";\nimport { FactionWorkType } from \"../../Faction/FactionWorkTypeEnum\";\n\nimport { CityName } from \"../../Locations/data/CityNames\";\nimport { LocationName } from \"../../Locations/data/LocationNames\";\n\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../../utils/JSONReviver\";\n\nexport class Sleeve extends Person {\n /**\n * Stores the name of the class that the player is currently taking\n */\n className = \"\";\n\n /**\n * Stores the type of crime the sleeve is currently attempting\n * Must match the name of a Crime object\n */\n crimeType = \"\";\n\n /**\n * Enum value for current task\n */\n currentTask: SleeveTaskType = SleeveTaskType.Idle;\n\n /**\n * Contains details about the sleeve's current task. The info stored\n * in this depends on the task type\n *\n * Faction/Company Work: Name of Faction/Company\n * Crime: Money earned if successful\n * Class/Gym: Name of university/gym\n */\n currentTaskLocation = \"\";\n\n /**\n * Maximum amount of time (in milliseconds) that can be spent on current task.\n */\n currentTaskMaxTime = 0;\n\n /**\n * Milliseconds spent on current task\n */\n currentTaskTime = 0;\n\n /**\n * Keeps track of experience earned for other sleeves\n */\n earningsForSleeves: ITaskTracker = createTaskTracker();\n\n /**\n * Keeps track of experience + money earned for player\n */\n earningsForPlayer: ITaskTracker = createTaskTracker();\n\n /**\n * Keeps track of experienced earned in the current task/action\n */\n earningsForTask: ITaskTracker = createTaskTracker();\n\n /**\n * Keeps track of what type of work sleeve is doing for faction, if applicable\n */\n factionWorkType: FactionWorkType = FactionWorkType.None;\n\n /**\n * Records experience gain rate for the current task\n */\n gainRatesForTask: ITaskTracker = createTaskTracker();\n\n /**\n * String that stores what stat the sleeve is training at the gym\n */\n gymStatType = \"\";\n\n /**\n * Keeps track of events/notifications for this sleeve\n */\n logs: string[] = [];\n\n /**\n * Clone retains 'memory' synchronization (and maybe exp?) upon prestige/installing Augs\n */\n memory = 1;\n\n /**\n * Sleeve shock. Number between 0 and 100\n * Trauma/shock that comes with being in a sleeve. Experience earned\n * is multipled by shock%. This gets applied before synchronization\n *\n * Reputation earned is also multiplied by shock%\n */\n shock = 1;\n\n /**\n * Stored number of game \"loop\" cycles\n */\n storedCycles = 0;\n\n /**\n * Synchronization. Number between 0 and 100\n * When experience is earned by sleeve, both the player and the sleeve get\n * sync% of the experience earned. Other sleeves get sync^2% of exp\n */\n sync = 1;\n\n constructor(p: IPlayer | null = null) {\n super();\n if (p != null) {\n this.shockRecovery(p);\n }\n }\n\n /**\n * Commit crimes\n */\n commitCrime(p: IPlayer, crimeKey: string): boolean {\n const crime: Crime | null = Crimes[crimeKey];\n if (!(crime instanceof Crime)) {\n return false;\n }\n\n if (this.currentTask !== SleeveTaskType.Idle) {\n this.finishTask(p);\n } else {\n this.resetTaskStatus();\n }\n\n this.gainRatesForTask.hack = crime.hacking_exp * this.hacking_exp_mult * BitNodeMultipliers.CrimeExpGain;\n this.gainRatesForTask.str = crime.strength_exp * this.strength_exp_mult * BitNodeMultipliers.CrimeExpGain;\n this.gainRatesForTask.def = crime.defense_exp * this.defense_exp_mult * BitNodeMultipliers.CrimeExpGain;\n this.gainRatesForTask.dex = crime.dexterity_exp * this.dexterity_exp_mult * BitNodeMultipliers.CrimeExpGain;\n this.gainRatesForTask.agi = crime.agility_exp * this.agility_exp_mult * BitNodeMultipliers.CrimeExpGain;\n this.gainRatesForTask.cha = crime.charisma_exp * this.charisma_exp_mult * BitNodeMultipliers.CrimeExpGain;\n this.gainRatesForTask.money = crime.money * this.crime_money_mult * BitNodeMultipliers.CrimeMoney;\n\n this.currentTaskLocation = String(this.gainRatesForTask.money);\n\n this.crimeType = crimeKey;\n this.currentTaskMaxTime = crime.time;\n this.currentTask = SleeveTaskType.Crime;\n return true;\n }\n\n /**\n * Called to stop the current task\n */\n finishTask(p: IPlayer): ITaskTracker {\n let retValue: ITaskTracker = createTaskTracker(); // Amount of exp to be gained by other sleeves\n\n if (this.currentTask === SleeveTaskType.Crime) {\n // For crimes, all experience and money is gained at the end\n if (this.currentTaskTime >= this.currentTaskMaxTime) {\n const crime: Crime | null = Crimes[this.crimeType];\n if (!(crime instanceof Crime)) {\n console.error(`Invalid data stored in sleeve.crimeType: ${this.crimeType}`);\n this.resetTaskStatus();\n return retValue;\n }\n if (Math.random() < crime.successRate(this)) {\n // Success\n const successGainRates: ITaskTracker = createTaskTracker();\n\n const keysForIteration: (keyof ITaskTracker)[] = Object.keys(successGainRates) as (keyof ITaskTracker)[];\n for (let i = 0; i < keysForIteration.length; ++i) {\n const key = keysForIteration[i];\n successGainRates[key] = this.gainRatesForTask[key] * 2;\n }\n retValue = this.gainExperience(p, successGainRates);\n this.gainMoney(p, this.gainRatesForTask);\n\n p.karma -= crime.karma * (this.sync / 100);\n } else {\n retValue = this.gainExperience(p, this.gainRatesForTask);\n }\n\n // Do not reset task to IDLE\n this.currentTaskTime = 0;\n return retValue;\n }\n } else {\n // For other crimes... I dont think anything else needs to be done\n }\n\n this.resetTaskStatus();\n\n return retValue;\n }\n\n /**\n * Earn experience for any stats (supports multiple)\n * This function also handles experience propogating to Player and other sleeves\n */\n gainExperience(p: IPlayer, exp: ITaskTracker, numCycles = 1, fromOtherSleeve = false): ITaskTracker {\n // If the experience is coming from another sleeve, it is not multiplied by anything.\n // Also the player does not earn anything\n if (fromOtherSleeve) {\n if (exp.hack > 0) {\n this.hacking_exp += exp.hack;\n }\n\n if (exp.str > 0) {\n this.strength_exp += exp.str;\n }\n\n if (exp.def > 0) {\n this.defense_exp += exp.def;\n }\n\n if (exp.dex > 0) {\n this.dexterity_exp += exp.dex;\n }\n\n if (exp.agi > 0) {\n this.agility_exp += exp.agi;\n }\n\n if (exp.cha > 0) {\n this.charisma_exp += exp.cha;\n }\n\n return createTaskTracker();\n }\n\n // Experience is first multiplied by shock. Then 'synchronization'\n // is accounted for\n\n const multFac = (this.shock / 100) * (this.sync / 100) * numCycles;\n const pHackExp = exp.hack * multFac;\n const pStrExp = exp.str * multFac;\n const pDefExp = exp.def * multFac;\n const pDexExp = exp.dex * multFac;\n const pAgiExp = exp.agi * multFac;\n const pChaExp = exp.cha * multFac;\n\n // Experience is gained by both this sleeve and player\n if (pHackExp > 0) {\n this.hacking_exp += pHackExp;\n p.gainHackingExp(pHackExp);\n this.earningsForPlayer.hack += pHackExp;\n this.earningsForTask.hack += pHackExp;\n }\n\n if (pStrExp > 0) {\n this.strength_exp += pStrExp;\n p.gainStrengthExp(pStrExp);\n this.earningsForPlayer.str += pStrExp;\n this.earningsForTask.str += pStrExp;\n }\n\n if (pDefExp > 0) {\n this.defense_exp += pDefExp;\n p.gainDefenseExp(pDefExp);\n this.earningsForPlayer.def += pDefExp;\n this.earningsForTask.def += pDefExp;\n }\n\n if (pDexExp > 0) {\n this.dexterity_exp += pDexExp;\n p.gainDexterityExp(pDexExp);\n this.earningsForPlayer.dex += pDexExp;\n this.earningsForTask.dex += pDexExp;\n }\n\n if (pAgiExp > 0) {\n this.agility_exp += pAgiExp;\n p.gainAgilityExp(pAgiExp);\n this.earningsForPlayer.agi += pAgiExp;\n this.earningsForTask.agi += pAgiExp;\n }\n\n if (pChaExp > 0) {\n this.charisma_exp += pChaExp;\n p.gainCharismaExp(pChaExp);\n this.earningsForPlayer.cha += pChaExp;\n this.earningsForTask.cha += pChaExp;\n }\n\n // Record earnings for other sleeves\n this.earningsForSleeves.hack += pHackExp * (this.sync / 100);\n this.earningsForSleeves.str += pStrExp * (this.sync / 100);\n this.earningsForSleeves.def += pDefExp * (this.sync / 100);\n this.earningsForSleeves.dex += pDexExp * (this.sync / 100);\n this.earningsForSleeves.agi += pAgiExp * (this.sync / 100);\n this.earningsForSleeves.cha += pChaExp * (this.sync / 100);\n\n // Return the experience to be gained by other sleeves\n return {\n hack: pHackExp * (this.sync / 100),\n str: pStrExp * (this.sync / 100),\n def: pDefExp * (this.sync / 100),\n dex: pDexExp * (this.sync / 100),\n agi: pAgiExp * (this.sync / 100),\n cha: pChaExp * (this.sync / 100),\n money: 0,\n };\n }\n\n /**\n * Earn money for player\n */\n gainMoney(p: IPlayer, task: ITaskTracker, numCycles = 1): void {\n const gain: number = task.money * numCycles;\n this.earningsForTask.money += gain;\n this.earningsForPlayer.money += gain;\n p.gainMoney(gain);\n p.recordMoneySource(gain, \"sleeves\");\n }\n\n /**\n * Returns the cost of upgrading this sleeve's memory by a certain amount\n */\n getMemoryUpgradeCost(n: number): number {\n const amt = Math.round(n);\n if (amt < 0) {\n return 0;\n }\n\n if (this.memory + amt > 100) {\n return this.getMemoryUpgradeCost(100 - this.memory);\n }\n\n const mult = 1.02;\n const baseCost = 1e12;\n let currCost = 0;\n let currMemory = this.memory - 1;\n for (let i = 0; i < n; ++i) {\n currCost += Math.pow(mult, currMemory);\n ++currMemory;\n }\n\n return currCost * baseCost;\n }\n\n /**\n * Gets reputation gain for the current task\n * Only applicable when working for company or faction\n */\n getRepGain(p: IPlayer): number {\n if (this.currentTask === SleeveTaskType.Faction) {\n let favorMult = 1;\n const fac: Faction | null = Factions[this.currentTaskLocation];\n if (fac != null) {\n favorMult = 1 + fac.favor / 100;\n }\n\n switch (this.factionWorkType) {\n case FactionWorkType.Hacking:\n return this.getFactionHackingWorkRepGain() * (this.shock / 100) * favorMult;\n case FactionWorkType.Field:\n return this.getFactionFieldWorkRepGain() * (this.shock / 100) * favorMult;\n case FactionWorkType.Security:\n return this.getFactionSecurityWorkRepGain() * (this.shock / 100) * favorMult;\n default:\n console.warn(`Invalid Sleeve.factionWorkType property in Sleeve.getRepGain(): ${this.factionWorkType}`);\n return 0;\n }\n } else if (this.currentTask === SleeveTaskType.Company) {\n const companyName: string = this.currentTaskLocation;\n const company: Company | null = Companies[companyName];\n if (company == null) {\n console.error(`Invalid company found when trying to calculate rep gain: ${companyName}`);\n return 0;\n }\n\n const companyPosition: CompanyPosition | null = CompanyPositions[p.jobs[companyName]];\n if (companyPosition == null) {\n console.error(`Invalid company position name found when trying to calculate rep gain: ${p.jobs[companyName]}`);\n return 0;\n }\n\n const jobPerformance: number = companyPosition.calculateJobPerformance(\n this.hacking_skill,\n this.strength,\n this.defense,\n this.dexterity,\n this.agility,\n this.charisma,\n );\n const favorMult = 1 + company.favor / 100;\n\n return jobPerformance * this.company_rep_mult * favorMult;\n } else {\n console.warn(`Sleeve.getRepGain() called for invalid task type: ${this.currentTask}`);\n return 0;\n }\n }\n\n installAugmentation(aug: Augmentation): void {\n this.hacking_exp = 0;\n this.strength_exp = 0;\n this.defense_exp = 0;\n this.dexterity_exp = 0;\n this.agility_exp = 0;\n this.charisma_exp = 0;\n this.applyAugmentation(aug);\n this.augmentations.push({ name: aug.name, level: 1 });\n this.updateStatLevels();\n }\n\n log(entry: string): void {\n const MaxLogSize = 50;\n this.logs.push(entry);\n if (this.logs.length > MaxLogSize) {\n this.logs.shift();\n }\n }\n\n /**\n * Called on every sleeve for a Source File prestige\n */\n prestige(p: IPlayer): void {\n // Reset exp\n this.hacking_exp = 0;\n this.strength_exp = 0;\n this.defense_exp = 0;\n this.dexterity_exp = 0;\n this.agility_exp = 0;\n this.charisma_exp = 0;\n\n // Reset task-related stuff\n this.resetTaskStatus();\n this.earningsForSleeves = createTaskTracker();\n this.earningsForPlayer = createTaskTracker();\n this.shockRecovery(p);\n\n // Reset augs and multipliers\n this.augmentations = [];\n this.resetMultipliers();\n\n // Reset sleeve-related stats\n this.shock = 1;\n this.storedCycles = 0;\n this.sync = Math.max(this.memory, 1);\n\n this.logs = [];\n }\n\n /**\n * Process loop\n * Returns an object containing the amount of experience that should be\n * transferred to all other sleeves\n */\n process(p: IPlayer, numCycles = 1): ITaskTracker | null {\n // Only process once every second (5 cycles)\n const CyclesPerSecond = 1000 / CONSTANTS.MilliPerCycle;\n this.storedCycles += numCycles;\n if (this.storedCycles < CyclesPerSecond) {\n return null;\n }\n\n let time = this.storedCycles * CONSTANTS.MilliPerCycle;\n let cyclesUsed = this.storedCycles;\n if (this.currentTaskMaxTime !== 0 && this.currentTaskTime + time > this.currentTaskMaxTime) {\n time = this.currentTaskMaxTime - this.currentTaskTime;\n cyclesUsed = Math.floor(time / CONSTANTS.MilliPerCycle);\n\n if (time < 0 || cyclesUsed < 0) {\n console.warn(`Sleeve.process() calculated negative cycle usage`);\n time = 0;\n cyclesUsed = 0;\n }\n }\n this.currentTaskTime += time;\n\n // Shock gradually goes towards 100\n this.shock = Math.min(100, this.shock + 0.0001 * cyclesUsed);\n\n let retValue: ITaskTracker = createTaskTracker();\n switch (this.currentTask) {\n case SleeveTaskType.Idle:\n break;\n case SleeveTaskType.Class:\n case SleeveTaskType.Gym:\n this.updateTaskGainRates(p);\n retValue = this.gainExperience(p, this.gainRatesForTask, cyclesUsed);\n this.gainMoney(p, this.gainRatesForTask, cyclesUsed);\n break;\n case SleeveTaskType.Faction: {\n retValue = this.gainExperience(p, this.gainRatesForTask, cyclesUsed);\n this.gainMoney(p, this.gainRatesForTask, cyclesUsed);\n\n // Gain faction reputation\n const fac: Faction = Factions[this.currentTaskLocation];\n if (!(fac instanceof Faction)) {\n console.error(`Invalid faction for Sleeve task: ${this.currentTaskLocation}`);\n break;\n }\n\n fac.playerReputation += this.getRepGain(p) * cyclesUsed;\n break;\n }\n case SleeveTaskType.Company: {\n retValue = this.gainExperience(p, this.gainRatesForTask, cyclesUsed);\n this.gainMoney(p, this.gainRatesForTask, cyclesUsed);\n\n const company: Company = Companies[this.currentTaskLocation];\n if (!(company instanceof Company)) {\n console.error(`Invalid company for Sleeve task: ${this.currentTaskLocation}`);\n break;\n }\n\n company.playerReputation += this.getRepGain(p) * cyclesUsed;\n break;\n }\n case SleeveTaskType.Recovery:\n this.shock = Math.min(100, this.shock + 0.0002 * cyclesUsed);\n break;\n case SleeveTaskType.Synchro:\n this.sync = Math.min(100, this.sync + p.getIntelligenceBonus(0.5) * 0.0002 * cyclesUsed);\n break;\n default:\n break;\n }\n\n if (this.currentTaskMaxTime !== 0 && this.currentTaskTime >= this.currentTaskMaxTime) {\n if (this.currentTask === SleeveTaskType.Crime) {\n retValue = this.finishTask(p);\n } else {\n this.finishTask(p);\n }\n }\n\n this.updateStatLevels();\n\n this.storedCycles -= cyclesUsed;\n\n return retValue;\n }\n\n /**\n * Resets all parameters used to keep information about the current task\n */\n resetTaskStatus(): void {\n this.earningsForTask = createTaskTracker();\n this.gainRatesForTask = createTaskTracker();\n this.currentTask = SleeveTaskType.Idle;\n this.currentTaskTime = 0;\n this.currentTaskMaxTime = 0;\n this.factionWorkType = FactionWorkType.None;\n this.crimeType = \"\";\n this.currentTaskLocation = \"\";\n this.gymStatType = \"\";\n this.className = \"\";\n }\n\n shockRecovery(p: IPlayer): boolean {\n if (this.currentTask !== SleeveTaskType.Idle) {\n this.finishTask(p);\n } else {\n this.resetTaskStatus();\n }\n\n this.currentTask = SleeveTaskType.Recovery;\n return true;\n }\n\n synchronize(p: IPlayer): boolean {\n if (this.currentTask !== SleeveTaskType.Idle) {\n this.finishTask(p);\n } else {\n this.resetTaskStatus();\n }\n\n this.currentTask = SleeveTaskType.Synchro;\n return true;\n }\n\n /**\n * Take a course at a university\n */\n takeUniversityCourse(p: IPlayer, universityName: string, className: string): boolean {\n if (this.currentTask !== SleeveTaskType.Idle) {\n this.finishTask(p);\n } else {\n this.resetTaskStatus();\n }\n\n // Set exp/money multipliers based on which university.\n // Also check that the sleeve is in the right city\n let costMult = 1;\n switch (universityName.toLowerCase()) {\n case LocationName.AevumSummitUniversity.toLowerCase():\n if (this.city !== CityName.Aevum) {\n return false;\n }\n this.currentTaskLocation = LocationName.AevumSummitUniversity;\n costMult = 4;\n break;\n case LocationName.Sector12RothmanUniversity.toLowerCase():\n if (this.city !== CityName.Sector12) {\n return false;\n }\n this.currentTaskLocation = LocationName.Sector12RothmanUniversity;\n costMult = 3;\n break;\n case LocationName.VolhavenZBInstituteOfTechnology.toLowerCase():\n if (this.city !== CityName.Volhaven) {\n return false;\n }\n this.currentTaskLocation = LocationName.VolhavenZBInstituteOfTechnology;\n costMult = 5;\n break;\n default:\n return false;\n }\n\n // Set experience/money gains based on class\n switch (className.toLowerCase()) {\n case \"study computer science\":\n break;\n case \"data structures\":\n this.gainRatesForTask.money = -1 * (CONSTANTS.ClassDataStructuresBaseCost * costMult);\n break;\n case \"networks\":\n this.gainRatesForTask.money = -1 * (CONSTANTS.ClassNetworksBaseCost * costMult);\n break;\n case \"algorithms\":\n this.gainRatesForTask.money = -1 * (CONSTANTS.ClassAlgorithmsBaseCost * costMult);\n break;\n case \"management\":\n this.gainRatesForTask.money = -1 * (CONSTANTS.ClassManagementBaseCost * costMult);\n break;\n case \"leadership\":\n this.gainRatesForTask.money = -1 * (CONSTANTS.ClassLeadershipBaseCost * costMult);\n break;\n default:\n return false;\n }\n\n this.className = className;\n this.currentTask = SleeveTaskType.Class;\n return true;\n }\n\n /**\n * Travel to another City. Costs money from player\n */\n travel(p: IPlayer, newCity: CityName): boolean {\n p.loseMoney(CONSTANTS.TravelCost);\n this.city = newCity;\n\n return true;\n }\n\n tryBuyAugmentation(p: IPlayer, aug: Augmentation): boolean {\n if (!p.canAfford(aug.startingCost)) {\n return false;\n }\n\n // Verify that this sleeve does not already have that augmentation.\n if (this.augmentations.some((a) => a.name === aug.name)) {\n return false;\n }\n\n p.loseMoney(aug.startingCost);\n this.installAugmentation(aug);\n return true;\n }\n\n updateTaskGainRates(p: IPlayer): void {\n if (this.currentTask === SleeveTaskType.Class) {\n let expMult = 1;\n switch (this.currentTaskLocation.toLowerCase()) {\n case LocationName.AevumSummitUniversity.toLowerCase():\n expMult = 3;\n break;\n case LocationName.Sector12RothmanUniversity.toLowerCase():\n expMult = 2;\n break;\n case LocationName.VolhavenZBInstituteOfTechnology.toLowerCase():\n expMult = 4;\n break;\n default:\n return;\n }\n\n const totalExpMult = expMult * p.hashManager.getStudyMult();\n switch (this.className.toLowerCase()) {\n case \"study computer science\":\n this.gainRatesForTask.hack =\n CONSTANTS.ClassStudyComputerScienceBaseExp * totalExpMult * this.hacking_exp_mult;\n break;\n case \"data structures\":\n this.gainRatesForTask.hack = CONSTANTS.ClassDataStructuresBaseExp * totalExpMult * this.hacking_exp_mult;\n break;\n case \"networks\":\n this.gainRatesForTask.hack = CONSTANTS.ClassNetworksBaseExp * totalExpMult * this.hacking_exp_mult;\n break;\n case \"algorithms\":\n this.gainRatesForTask.hack = CONSTANTS.ClassAlgorithmsBaseExp * totalExpMult * this.hacking_exp_mult;\n break;\n case \"management\":\n this.gainRatesForTask.cha = CONSTANTS.ClassManagementBaseExp * totalExpMult * this.charisma_exp_mult;\n break;\n case \"leadership\":\n this.gainRatesForTask.cha = CONSTANTS.ClassLeadershipBaseExp * totalExpMult * this.charisma_exp_mult;\n break;\n default:\n break;\n }\n\n return;\n }\n\n if (this.currentTask === SleeveTaskType.Gym) {\n // Get gym exp multiplier\n let expMult = 1;\n switch (this.currentTaskLocation.toLowerCase()) {\n case LocationName.AevumCrushFitnessGym.toLowerCase():\n expMult = 2;\n break;\n case LocationName.AevumSnapFitnessGym.toLowerCase():\n expMult = 5;\n break;\n case LocationName.Sector12IronGym.toLowerCase():\n expMult = 1;\n break;\n case LocationName.Sector12PowerhouseGym.toLowerCase():\n expMult = 10;\n break;\n case LocationName.VolhavenMilleniumFitnessGym:\n expMult = 4;\n break;\n default:\n return;\n }\n\n // Set stat gain rate\n const baseGymExp = 1;\n const totalExpMultiplier = p.hashManager.getTrainingMult() * expMult;\n const sanitizedStat: string = this.gymStatType.toLowerCase();\n if (sanitizedStat.includes(\"str\")) {\n this.gainRatesForTask.str = baseGymExp * totalExpMultiplier * this.strength_exp_mult;\n } else if (sanitizedStat.includes(\"def\")) {\n this.gainRatesForTask.def = baseGymExp * totalExpMultiplier * this.defense_exp_mult;\n } else if (sanitizedStat.includes(\"dex\")) {\n this.gainRatesForTask.dex = baseGymExp * totalExpMultiplier * this.dexterity_exp_mult;\n } else if (sanitizedStat.includes(\"agi\")) {\n this.gainRatesForTask.agi = baseGymExp * totalExpMultiplier * this.agility_exp_mult;\n }\n\n return;\n }\n\n console.warn(`Sleeve.updateTaskGainRates() called for unexpected task type ${this.currentTask}`);\n }\n\n upgradeMemory(n: number): void {\n if (n < 0) {\n console.warn(`Sleeve.upgradeMemory() called with negative value: ${n}`);\n return;\n }\n\n this.memory = Math.min(100, Math.round(this.memory + n));\n }\n\n /**\n * Start work for one of the player's companies\n * Returns boolean indicating success\n */\n workForCompany(p: IPlayer, companyName: string): boolean {\n if (!(Companies[companyName] instanceof Company) || p.jobs[companyName] == null) {\n return false;\n }\n\n if (this.currentTask !== SleeveTaskType.Idle) {\n this.finishTask(p);\n } else {\n this.resetTaskStatus();\n }\n\n const company: Company | null = Companies[companyName];\n const companyPosition: CompanyPosition | null = CompanyPositions[p.jobs[companyName]];\n if (company == null) {\n return false;\n }\n if (companyPosition == null) {\n return false;\n }\n this.gainRatesForTask.money =\n companyPosition.baseSalary *\n company.salaryMultiplier *\n this.work_money_mult *\n BitNodeMultipliers.CompanyWorkMoney;\n this.gainRatesForTask.hack =\n companyPosition.hackingExpGain *\n company.expMultiplier *\n this.hacking_exp_mult *\n BitNodeMultipliers.CompanyWorkExpGain;\n this.gainRatesForTask.str =\n companyPosition.strengthExpGain *\n company.expMultiplier *\n this.strength_exp_mult *\n BitNodeMultipliers.CompanyWorkExpGain;\n this.gainRatesForTask.def =\n companyPosition.defenseExpGain *\n company.expMultiplier *\n this.defense_exp_mult *\n BitNodeMultipliers.CompanyWorkExpGain;\n this.gainRatesForTask.dex =\n companyPosition.dexterityExpGain *\n company.expMultiplier *\n this.dexterity_exp_mult *\n BitNodeMultipliers.CompanyWorkExpGain;\n this.gainRatesForTask.agi =\n companyPosition.agilityExpGain *\n company.expMultiplier *\n this.agility_exp_mult *\n BitNodeMultipliers.CompanyWorkExpGain;\n this.gainRatesForTask.cha =\n companyPosition.charismaExpGain *\n company.expMultiplier *\n this.charisma_exp_mult *\n BitNodeMultipliers.CompanyWorkExpGain;\n\n this.currentTaskLocation = companyName;\n this.currentTask = SleeveTaskType.Company;\n this.currentTaskMaxTime = CONSTANTS.MillisecondsPer8Hours;\n\n return true;\n }\n\n /**\n * Start work for one of the player's factions\n * Returns boolean indicating success\n */\n workForFaction(p: IPlayer, factionName: string, workType: string): boolean {\n if (factionName === \"\") {\n return false;\n }\n if (!(Factions[factionName] instanceof Faction) || !p.factions.includes(factionName)) {\n return false;\n }\n\n if (this.currentTask !== SleeveTaskType.Idle) {\n this.finishTask(p);\n } else {\n this.resetTaskStatus();\n }\n\n const factionInfo = Factions[factionName].getInfo();\n\n // Set type of work (hacking/field/security), and the experience gains\n const sanitizedWorkType: string = workType.toLowerCase();\n if (sanitizedWorkType.includes(\"hack\")) {\n if (!factionInfo.offerHackingWork) {\n return false;\n }\n this.factionWorkType = FactionWorkType.Hacking;\n this.gainRatesForTask.hack = 0.15 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n } else if (sanitizedWorkType.includes(\"field\")) {\n if (!factionInfo.offerFieldWork) {\n return false;\n }\n this.factionWorkType = FactionWorkType.Field;\n this.gainRatesForTask.hack = 0.1 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n this.gainRatesForTask.str = 0.1 * this.strength_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n this.gainRatesForTask.def = 0.1 * this.defense_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n this.gainRatesForTask.dex = 0.1 * this.dexterity_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n this.gainRatesForTask.agi = 0.1 * this.agility_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n this.gainRatesForTask.cha = 0.1 * this.charisma_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n } else if (sanitizedWorkType.includes(\"security\")) {\n if (!factionInfo.offerSecurityWork) {\n return false;\n }\n this.factionWorkType = FactionWorkType.Security;\n this.gainRatesForTask.hack = 0.1 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n this.gainRatesForTask.str = 0.15 * this.strength_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n this.gainRatesForTask.def = 0.15 * this.defense_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n this.gainRatesForTask.dex = 0.15 * this.dexterity_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n this.gainRatesForTask.agi = 0.15 * this.agility_exp_mult * BitNodeMultipliers.FactionWorkExpGain;\n } else {\n return false;\n }\n\n this.currentTaskLocation = factionName;\n this.currentTask = SleeveTaskType.Faction;\n this.currentTaskMaxTime = CONSTANTS.MillisecondsPer20Hours;\n\n return true;\n }\n\n /**\n * Begin a gym workout task\n */\n workoutAtGym(p: IPlayer, gymName: string, stat: string): boolean {\n if (this.currentTask !== SleeveTaskType.Idle) {\n this.finishTask(p);\n } else {\n this.resetTaskStatus();\n }\n\n // Set exp/money multipliers based on which university.\n // Also check that the sleeve is in the right city\n let costMult = 1;\n switch (gymName.toLowerCase()) {\n case LocationName.AevumCrushFitnessGym.toLowerCase():\n if (this.city != CityName.Aevum) {\n return false;\n }\n this.currentTaskLocation = LocationName.AevumCrushFitnessGym;\n costMult = 3;\n break;\n case LocationName.AevumSnapFitnessGym.toLowerCase():\n if (this.city != CityName.Aevum) {\n return false;\n }\n this.currentTaskLocation = LocationName.AevumSnapFitnessGym;\n costMult = 10;\n break;\n case LocationName.Sector12IronGym.toLowerCase():\n if (this.city != CityName.Sector12) {\n return false;\n }\n this.currentTaskLocation = LocationName.Sector12IronGym;\n costMult = 1;\n break;\n case LocationName.Sector12PowerhouseGym.toLowerCase():\n if (this.city != CityName.Sector12) {\n return false;\n }\n this.currentTaskLocation = LocationName.Sector12PowerhouseGym;\n costMult = 20;\n break;\n case LocationName.VolhavenMilleniumFitnessGym.toLowerCase():\n if (this.city != CityName.Volhaven) {\n return false;\n }\n this.currentTaskLocation = LocationName.VolhavenMilleniumFitnessGym;\n costMult = 7;\n break;\n default:\n return false;\n }\n\n // Set experience/money gains based on class\n const sanitizedStat: string = stat.toLowerCase();\n\n // Set cost\n this.gainRatesForTask.money = -1 * (CONSTANTS.ClassGymBaseCost * costMult);\n\n // Validate \"stat\" argument\n if (\n !sanitizedStat.includes(\"str\") &&\n !sanitizedStat.includes(\"def\") &&\n !sanitizedStat.includes(\"dex\") &&\n !sanitizedStat.includes(\"agi\")\n ) {\n return false;\n }\n\n this.gymStatType = stat;\n this.currentTask = SleeveTaskType.Gym;\n\n return true;\n }\n\n /**\n * Serialize the current object to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"Sleeve\", this);\n }\n\n /**\n * Initiatizes a Sleeve object from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Sleeve {\n return Generic_fromJSON(Sleeve, value.data);\n }\n}\n\nReviver.constructors.Sleeve = Sleeve;\n","import { TextFile } from \"../TextFile\";\nimport { Script } from \"../Script/Script\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { IRouter } from \"../ui/Router\";\nimport { Settings } from \"../Settings/Settings\";\nimport { getTimestamp } from \"../../utils/helpers/getTimestamp\";\n\nexport class Output {\n text: string;\n color: \"inherit\" | \"initial\" | \"primary\" | \"secondary\" | \"error\" | \"textPrimary\" | \"textSecondary\" | undefined;\n constructor(\n text: string,\n color: \"inherit\" | \"initial\" | \"primary\" | \"secondary\" | \"error\" | \"textPrimary\" | \"textSecondary\" | undefined,\n ) {\n if (Settings.EnableTimestamps) text = \"[\" + getTimestamp() + \"] \" + text;\n this.text = text;\n this.color = color;\n }\n}\n\nexport class Link {\n hostname: string;\n dashes: string;\n constructor(dashes: string, hostname: string) {\n if (Settings.EnableTimestamps) dashes = \"[\" + getTimestamp() + \"] \" + dashes;\n this.hostname = hostname;\n this.dashes = dashes;\n }\n}\n\nexport class TTimer {\n time: number;\n timeLeft: number;\n action: \"h\" | \"b\" | \"a\";\n\n constructor(time: number, action: \"h\" | \"b\" | \"a\") {\n this.time = time;\n this.timeLeft = time;\n this.action = action;\n }\n}\n\nexport interface ITerminal {\n action: TTimer | null;\n\n commandHistory: string[];\n commandHistoryIndex: number;\n\n outputHistory: (Output | Link)[];\n\n // True if a Coding Contract prompt is opened\n contractOpen: boolean;\n\n // Full Path of current directory\n // Excludes the trailing forward slash\n currDir: string;\n\n print(s: string): void;\n error(s: string): void;\n\n clear(): void;\n startAnalyze(): void;\n startBackdoor(player: IPlayer): void;\n startHack(player: IPlayer): void;\n finishHack(router: IRouter, player: IPlayer, cancelled?: boolean): void;\n finishBackdoor(router: IRouter, player: IPlayer, cancelled?: boolean): void;\n finishAnalyze(player: IPlayer, cancelled?: boolean): void;\n finishAction(router: IRouter, player: IPlayer, cancelled?: boolean): void;\n getFilepath(filename: string): string;\n getFile(player: IPlayer, filename: string): Script | TextFile | string | null;\n getScript(player: IPlayer, filename: string): Script | null;\n getTextFile(player: IPlayer, filename: string): TextFile | null;\n getLitFile(player: IPlayer, filename: string): string | null;\n cwd(): string;\n setcwd(dir: string): void;\n runContract(player: IPlayer, name: string): void;\n executeScanAnalyzeCommand(player: IPlayer, depth?: number, all?: boolean): void;\n connectToServer(player: IPlayer, server: string): void;\n executeCommand(router: IRouter, player: IPlayer, command: string): void;\n executeCommands(router: IRouter, player: IPlayer, commands: string): void;\n // If there was any changes, will return true, once.\n process(router: IRouter, player: IPlayer, cycles: number): void;\n prestige(): void;\n getProgressText(): string;\n}\n","import { EventEmitter } from \"../utils/EventEmitter\";\nexport const TerminalEvents = new EventEmitter<[]>();\nexport const TerminalClearEvents = new EventEmitter<[]>();\n","/**\n * Hacknet Node Class\n *\n * Hacknet Nodes are specialized machines that passively earn the player money over time.\n * They can be upgraded to increase their production\n */\nimport { IHacknetNode } from \"./IHacknetNode\";\n\nimport { CONSTANTS } from \"../Constants\";\n\nimport {\n calculateMoneyGainRate,\n calculateLevelUpgradeCost,\n calculateCoreUpgradeCost,\n calculateRamUpgradeCost,\n} from \"./formulas/HacknetNodes\";\nimport { HacknetNodeConstants } from \"./data/Constants\";\n\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\nexport class HacknetNode implements IHacknetNode {\n // Node's number of cores\n cores = 1;\n\n // Node's Level\n level = 1;\n\n // Node's production per second\n moneyGainRatePerSecond = 0;\n\n // Identifier for Node. Includes the full \"name\" (hacknet-node-N)\n name: string;\n\n // How long this Node has existed, in seconds\n onlineTimeSeconds = 0;\n\n // Node's RAM (GB)\n ram = 1;\n\n // Total money earned by this Node\n totalMoneyGenerated = 0;\n\n constructor(name = \"\", prodMult = 1) {\n this.name = name;\n\n this.updateMoneyGainRate(prodMult);\n }\n\n // Get the cost to upgrade this Node's number of cores\n calculateCoreUpgradeCost(levels = 1, costMult: number): number {\n return calculateCoreUpgradeCost(this.cores, levels, costMult);\n }\n\n // Get the cost to upgrade this Node's level\n calculateLevelUpgradeCost(levels = 1, costMult: number): number {\n return calculateLevelUpgradeCost(this.level, levels, costMult);\n }\n\n // Get the cost to upgrade this Node's RAM\n calculateRamUpgradeCost(levels = 1, costMult: number): number {\n return calculateRamUpgradeCost(this.ram, levels, costMult);\n }\n\n // Process this Hacknet Node in the game loop.\n // Returns the amount of money generated\n process(numCycles = 1): number {\n const seconds = (numCycles * CONSTANTS.MilliPerCycle) / 1000;\n let gain = this.moneyGainRatePerSecond * seconds;\n if (isNaN(gain)) {\n console.error(`Hacknet Node ${this.name} calculated earnings of NaN`);\n gain = 0;\n }\n\n this.totalMoneyGenerated += gain;\n this.onlineTimeSeconds += seconds;\n\n return gain;\n }\n\n // Upgrade this Node's number of cores, if possible\n // Returns a boolean indicating whether new cores were successfully bought\n upgradeCore(levels = 1, prodMult: number): void {\n this.cores = Math.min(HacknetNodeConstants.MaxCores, Math.round(this.cores + levels));\n this.updateMoneyGainRate(prodMult);\n }\n\n // Upgrade this Node's level, if possible\n // Returns a boolean indicating whether the level was successfully updated\n upgradeLevel(levels = 1, prodMult: number): void {\n this.level = Math.min(HacknetNodeConstants.MaxLevel, Math.round(this.level + levels));\n this.updateMoneyGainRate(prodMult);\n }\n\n // Upgrade this Node's RAM, if possible\n // Returns a boolean indicating whether the RAM was successfully upgraded\n upgradeRam(levels = 1, prodMult: number): void {\n for (let i = 0; i < levels; ++i) {\n this.ram *= 2; // Ram is always doubled\n }\n this.ram = Math.round(this.ram); // Handle any floating point precision issues\n this.updateMoneyGainRate(prodMult);\n }\n\n // Re-calculate this Node's production and update the moneyGainRatePerSecond prop\n updateMoneyGainRate(prodMult: number): void {\n this.moneyGainRatePerSecond = calculateMoneyGainRate(this.level, this.ram, this.cores, prodMult);\n if (isNaN(this.moneyGainRatePerSecond)) {\n this.moneyGainRatePerSecond = 0;\n dialogBoxCreate(\"Error in calculating Hacknet Node production. Please report to game developer\", false);\n }\n }\n\n /**\n * Serialize the current object to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"HacknetNode\", this);\n }\n\n /**\n * Initiatizes a HacknetNode object from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): HacknetNode {\n return Generic_fromJSON(HacknetNode, value.data);\n }\n}\n\nReviver.constructors.HacknetNode = HacknetNode;\n","/**\n * The worker agent for running a script instance. Each running script instance\n * has its own underlying WorkerScript object.\n *\n * Note that these objects are not saved and re-loaded when the game is refreshed.\n * Instead, whenever the game is opened, WorkerScripts are re-created from\n * RunningScript objects\n */\nimport { Environment } from \"./Environment\";\nimport { RamCostConstants } from \"./RamCostGenerator\";\n\nimport { RunningScript } from \"../Script/RunningScript\";\nimport { Script } from \"../Script/Script\";\nimport { AllServers } from \"../Server/AllServers\";\nimport { BaseServer } from \"../Server/BaseServer\";\nimport { IMap } from \"../types\";\n\nexport class WorkerScript {\n /**\n * Script's arguments\n */\n args: any[];\n\n /**\n * Copy of the script's code\n */\n code = \"\";\n\n /**\n * Holds the timeoutID (numeric value) for whenever this script is blocked by a\n * timed Netscript function. i.e. Holds the return value of setTimeout()\n */\n delay: number | null = null;\n\n /**\n * Holds the Promise resolve() function for when the script is \"blocked\" by an async op\n */\n delayResolve?: () => void;\n\n /**\n * Stores names of all functions that have logging disabled\n */\n disableLogs: IMap = {};\n\n /**\n * Used for dynamic RAM calculation. Stores names of all functions that have\n * already been checked by this script.\n * TODO: Could probably just combine this with loadedFns?\n */\n dynamicLoadedFns: IMap = {};\n\n /**\n * Tracks dynamic RAM usage\n */\n dynamicRamUsage: number = RamCostConstants.ScriptBaseRamCost;\n\n /**\n * Netscript Environment for this script\n */\n env: Environment;\n\n /**\n * Status message in case of script error. Currently unused I think\n */\n errorMessage = \"\";\n\n /**\n * Used for static RAM calculation. Stores names of all functions that have\n * already been checked by this script\n */\n loadedFns: IMap = {};\n\n /**\n * Filename of script\n */\n name: string;\n\n /**\n * Script's output/return value. Currently not used or implemented\n */\n output = \"\";\n\n /**\n * Process ID. Must be an integer. Used for efficient script\n * killing and removal.\n */\n pid: number;\n\n /**\n * Script's Static RAM usage. Equivalent to underlying script's RAM usage\n */\n ramUsage = 0;\n\n /**\n * Whether or not this workerScript is currently running\n */\n running = false;\n\n /**\n * Reference to underlying RunningScript object\n */\n scriptRef: RunningScript;\n\n /**\n * IP Address on which this script is running\n */\n serverIp: string;\n\n constructor(runningScriptObj: RunningScript, pid: number, nsFuncsGenerator?: (ws: WorkerScript) => any) {\n this.name = runningScriptObj.filename;\n this.serverIp = runningScriptObj.server;\n\n const sanitizedPid = Math.round(pid);\n if (typeof sanitizedPid !== \"number\" || isNaN(sanitizedPid)) {\n throw new Error(`Invalid PID when constructing WorkerScript: ${pid}`);\n }\n this.pid = sanitizedPid;\n runningScriptObj.pid = sanitizedPid;\n\n // Get the underlying script's code\n const server = AllServers[this.serverIp];\n if (server == null) {\n throw new Error(`WorkerScript constructed with invalid server ip: ${this.serverIp}`);\n }\n let found = false;\n for (let i = 0; i < server.scripts.length; ++i) {\n if (server.scripts[i].filename === this.name) {\n found = true;\n this.code = server.scripts[i].code;\n }\n }\n if (!found) {\n throw new Error(`WorkerScript constructed with invalid script filename: ${this.name}`);\n }\n\n this.env = new Environment(null);\n if (typeof nsFuncsGenerator === \"function\") {\n this.env.vars = nsFuncsGenerator(this);\n }\n this.env.set(\"args\", runningScriptObj.args.slice());\n\n this.scriptRef = runningScriptObj;\n this.args = runningScriptObj.args.slice();\n }\n\n /**\n * Returns the Server on which this script is running\n */\n getServer(): BaseServer {\n const server = AllServers[this.serverIp];\n if (server == null) throw new Error(`Script ${this.name} pid ${this.pid} is running on non-existent server?`);\n return server;\n }\n\n /**\n * Returns the Script object for the underlying script.\n * Returns null if it cannot be found (which would be a bug)\n */\n getScript(): Script | null {\n const server = this.getServer();\n for (let i = 0; i < server.scripts.length; ++i) {\n if (server.scripts[i].filename === this.name) {\n return server.scripts[i];\n }\n }\n\n console.error(\n \"Failed to find underlying Script object in WorkerScript.getScript(). This probably means somethings wrong\",\n );\n return null;\n }\n\n /**\n * Returns the script with the specified filename on the specified server,\n * or null if it cannot be found\n */\n getScriptOnServer(fn: string, server: BaseServer): Script | null {\n if (server == null) {\n server = this.getServer();\n }\n\n for (let i = 0; i < server.scripts.length; ++i) {\n if (server.scripts[i].filename === fn) {\n return server.scripts[i];\n }\n }\n\n return null;\n }\n\n shouldLog(fn: string): boolean {\n return this.disableLogs[fn] == null;\n }\n\n log(func: string, txt: string): void {\n if (this.shouldLog(func)) {\n if (func && txt) {\n this.scriptRef.log(`${func}: ${txt}`);\n } else if (func) {\n this.scriptRef.log(func);\n } else {\n this.scriptRef.log(txt);\n }\n }\n }\n\n print(txt: string): void {\n this.scriptRef.log(txt);\n }\n}\n","export class DarkWebItem {\n program: string;\n price: number;\n description: string;\n\n constructor(program: string, price: number, description: string) {\n this.program = program;\n this.price = price;\n this.description = description;\n }\n}\n","/**\n * Helper functions for determine whether Limit and Stop orders should\n * be executed (and executing them)\n */\nimport { buyStock, sellStock, shortStock, sellShort } from \"./BuyingAndSelling\";\nimport { IOrderBook } from \"./IOrderBook\";\nimport { IStockMarket } from \"./IStockMarket\";\nimport { Order } from \"./Order\";\nimport { Stock } from \"./Stock\";\n\nimport { OrderTypes } from \"./data/OrderTypes\";\nimport { PositionTypes } from \"./data/PositionTypes\";\n\nimport { IMap } from \"../types\";\n\nimport { numeralWrapper } from \"../ui/numeralFormat\";\nimport { Money } from \"../ui/React/Money\";\n\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\n\nimport * as React from \"react\";\n\nexport interface IProcessOrderRefs {\n stockMarket: IStockMarket;\n symbolToStockMap: IMap;\n}\n\n/**\n * Search for all orders of a specific type and execute them if appropriate\n * @param {Stock} stock - Stock for which orders should be processed\n * @param {OrderTypes} orderType - Type of order to check (Limit/Stop buy/sell)\n * @param {PositionTypes} posType - Long or short\n * @param {IProcessOrderRefs} refs - References to objects/functions that are required for this function\n */\nexport function processOrders(\n stock: Stock,\n orderType: OrderTypes,\n posType: PositionTypes,\n refs: IProcessOrderRefs,\n): void {\n const orderBook = refs.stockMarket[\"Orders\"];\n if (orderBook == null) {\n const orders: IOrderBook = {};\n for (const name in refs.stockMarket) {\n const stock = refs.stockMarket[name];\n if (!(stock instanceof Stock)) {\n continue;\n }\n orders[stock.symbol] = [];\n }\n refs.stockMarket[\"Orders\"] = orders;\n return; // Newly created, so no orders to process\n }\n let stockOrders = orderBook[stock.symbol];\n if (stockOrders == null || !(stockOrders.constructor === Array)) {\n console.error(`Invalid Order book for ${stock.symbol} in processOrders(): ${stockOrders}`);\n stockOrders = [];\n return;\n }\n\n for (const order of stockOrders) {\n if (order.type === orderType && order.pos === posType) {\n switch (order.type) {\n case OrderTypes.LimitBuy:\n if (order.pos === PositionTypes.Long && stock.price <= order.price) {\n executeOrder(/*66*/ order, refs);\n } else if (order.pos === PositionTypes.Short && stock.price >= order.price) {\n executeOrder(/*66*/ order, refs);\n }\n break;\n case OrderTypes.LimitSell:\n if (order.pos === PositionTypes.Long && stock.price >= order.price) {\n executeOrder(/*66*/ order, refs);\n } else if (order.pos === PositionTypes.Short && stock.price <= order.price) {\n executeOrder(/*66*/ order, refs);\n }\n break;\n case OrderTypes.StopBuy:\n if (order.pos === PositionTypes.Long && stock.price >= order.price) {\n executeOrder(/*66*/ order, refs);\n } else if (order.pos === PositionTypes.Short && stock.price <= order.price) {\n executeOrder(/*66*/ order, refs);\n }\n break;\n case OrderTypes.StopSell:\n if (order.pos === PositionTypes.Long && stock.price <= order.price) {\n executeOrder(/*66*/ order, refs);\n } else if (order.pos === PositionTypes.Short && stock.price >= order.price) {\n executeOrder(/*66*/ order, refs);\n }\n break;\n default:\n console.warn(`Invalid order type: ${order.type}`);\n return;\n }\n }\n }\n}\n\n/**\n * Execute a Stop or Limit Order.\n * @param {Order} order - Order being executed\n * @param {IProcessOrderRefs} refs - References to objects/functions that are required for this function\n */\nfunction executeOrder(order: Order, refs: IProcessOrderRefs): void {\n const stock = refs.symbolToStockMap[order.stockSymbol];\n if (!(stock instanceof Stock)) {\n console.error(`Could not find stock for this order: ${order.stockSymbol}`);\n return;\n }\n const stockMarket = refs.stockMarket;\n const orderBook = stockMarket[\"Orders\"];\n const stockOrders = orderBook[stock.symbol];\n\n // When orders are executed, the buying and selling functions shouldn't\n // emit popup dialog boxes. This options object configures the functions for that\n const opts = {\n suppressDialog: true,\n };\n\n let res = true;\n let isBuy = false;\n switch (order.type) {\n case OrderTypes.LimitBuy:\n case OrderTypes.StopBuy:\n isBuy = true;\n if (order.pos === PositionTypes.Long) {\n res = buyStock(stock, order.shares, null, opts) && res;\n } else if (order.pos === PositionTypes.Short) {\n res = shortStock(stock, order.shares, null, opts) && res;\n }\n break;\n case OrderTypes.LimitSell:\n case OrderTypes.StopSell:\n if (order.pos === PositionTypes.Long) {\n res = sellStock(stock, order.shares, null, opts) && res;\n } else if (order.pos === PositionTypes.Short) {\n res = sellShort(stock, order.shares, null, opts) && res;\n }\n break;\n default:\n console.warn(`Invalid order type: ${order.type}`);\n return;\n }\n\n // Position type, for logging/message purposes\n const pos = order.pos === PositionTypes.Long ? \"Long\" : \"Short\";\n\n if (res) {\n for (let i = 0; i < stockOrders.length; ++i) {\n if (order == stockOrders[i]) {\n stockOrders.splice(i, 1);\n dialogBoxCreate(\n <>\n {order.type} for {stock.symbol} @ ({pos}) was filled (\n {numeralWrapper.formatShares(Math.round(order.shares))} shares)\n ,\n );\n return;\n }\n }\n\n console.error(\"Could not find the following Order in Order Book: \");\n console.error(order);\n } else {\n if (isBuy) {\n dialogBoxCreate(\n <>\n Failed to execute {order.type} for {stock.symbol} @ ({pos}). This is most likely\n because you do not have enough money or the order would exceed the stock's maximum number of shares\n ,\n );\n }\n }\n}\n","import { CorporationState } from \"./CorporationState\";\nimport { CorporationUnlockUpgrade, CorporationUnlockUpgrades } from \"./data/CorporationUnlockUpgrades\";\nimport { CorporationUpgrade, CorporationUpgrades } from \"./data/CorporationUpgrades\";\nimport { Warehouse } from \"./Warehouse\";\nimport { CorporationConstants } from \"./data/Constants\";\nimport { Industry } from \"./Industry\";\n\nimport { BitNodeMultipliers } from \"../BitNode/BitNodeMultipliers\";\nimport { showLiterature } from \"../Literature/LiteratureHelpers\";\nimport { LiteratureNames } from \"../Literature/data/LiteratureNames\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\n\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\nimport { Reviver, Generic_toJSON, Generic_fromJSON } from \"../../utils/JSONReviver\";\nimport { isString } from \"../../utils/helpers/isString\";\n\n// UI Related Imports\n\nimport Decimal from \"decimal.js\";\n\ninterface IParams {\n name?: string;\n}\n\nexport class Corporation {\n name = \"The Corporation\";\n\n //A division/business sector is represented by the object:\n divisions: Industry[] = [];\n\n //Financial stats\n funds = new Decimal(150e9);\n revenue = new Decimal(0);\n expenses = new Decimal(0);\n fundingRound = 0;\n public = false; //Publicly traded\n totalShares = CorporationConstants.INITIALSHARES; // Total existing shares\n numShares = CorporationConstants.INITIALSHARES; // Total shares owned by player\n shareSalesUntilPriceUpdate = CorporationConstants.SHARESPERPRICEUPDATE;\n shareSaleCooldown = 0; // Game cycles until player can sell shares again\n issueNewSharesCooldown = 0; // Game cycles until player can issue shares again\n dividendPercentage = 0;\n dividendTaxPercentage = 50;\n issuedShares = 0;\n sharePrice = 0;\n storedCycles = 0;\n\n unlockUpgrades: number[];\n upgrades: number[];\n upgradeMultipliers: number[];\n\n state = new CorporationState();\n\n constructor(params: IParams = {}) {\n this.name = params.name ? params.name : \"The Corporation\";\n const numUnlockUpgrades = Object.keys(CorporationUnlockUpgrades).length;\n const numUpgrades = Object.keys(CorporationUpgrades).length;\n this.unlockUpgrades = Array(numUnlockUpgrades).fill(0);\n this.upgrades = Array(numUpgrades).fill(0);\n this.upgradeMultipliers = Array(numUpgrades).fill(1);\n }\n\n addFunds(amt: number): void {\n if (!isFinite(amt)) {\n console.error(\"Trying to add invalid amount of funds. Report to a developper.\");\n return;\n }\n this.funds = this.funds.plus(amt);\n }\n\n getState(): string {\n return this.state.getState();\n }\n\n storeCycles(numCycles = 1): void {\n this.storedCycles += numCycles;\n }\n\n process(player: IPlayer): void {\n if (this.storedCycles >= CorporationConstants.CyclesPerIndustryStateCycle) {\n const state = this.getState();\n const marketCycles = 1;\n const gameCycles = marketCycles * CorporationConstants.CyclesPerIndustryStateCycle;\n this.storedCycles -= gameCycles;\n\n this.divisions.forEach((ind) => {\n ind.process(marketCycles, state, this);\n });\n\n // Process cooldowns\n if (this.shareSaleCooldown > 0) {\n this.shareSaleCooldown -= gameCycles;\n }\n if (this.issueNewSharesCooldown > 0) {\n this.issueNewSharesCooldown -= gameCycles;\n }\n\n //At the start of a new cycle, calculate profits from previous cycle\n if (state === \"START\") {\n this.revenue = new Decimal(0);\n this.expenses = new Decimal(0);\n this.divisions.forEach((ind) => {\n if (ind.lastCycleRevenue === -Infinity || ind.lastCycleRevenue === Infinity) {\n return;\n }\n if (ind.lastCycleExpenses === -Infinity || ind.lastCycleExpenses === Infinity) {\n return;\n }\n this.revenue = this.revenue.plus(ind.lastCycleRevenue);\n this.expenses = this.expenses.plus(ind.lastCycleExpenses);\n });\n const profit = this.revenue.minus(this.expenses);\n const cycleProfit = profit.times(marketCycles * CorporationConstants.SecsPerMarketCycle);\n if (isNaN(this.funds) || this.funds === Infinity || this.funds === -Infinity) {\n dialogBoxCreate(\n \"There was an error calculating your Corporations funds and they got reset to 0. \" +\n \"This is a bug. Please report to game developer.

\" +\n \"(Your funds have been set to $150b for the inconvenience)\",\n );\n this.funds = new Decimal(150e9);\n }\n\n // Process dividends\n if (this.dividendPercentage > 0 && cycleProfit > 0) {\n // Validate input again, just to be safe\n if (\n isNaN(this.dividendPercentage) ||\n this.dividendPercentage < 0 ||\n this.dividendPercentage > CorporationConstants.DividendMaxPercentage * 100\n ) {\n console.error(`Invalid Corporation dividend percentage: ${this.dividendPercentage}`);\n } else {\n const totalDividends = (this.dividendPercentage / 100) * cycleProfit;\n const retainedEarnings = cycleProfit - totalDividends;\n const dividendsPerShare = totalDividends / this.totalShares;\n const profit = this.numShares * dividendsPerShare * (1 - this.dividendTaxPercentage / 100);\n player.gainMoney(profit);\n player.recordMoneySource(profit, \"corporation\");\n this.addFunds(retainedEarnings);\n }\n } else {\n this.addFunds(cycleProfit);\n }\n\n this.updateSharePrice();\n }\n\n this.state.nextState();\n }\n }\n\n determineValuation(): number {\n let val,\n profit = this.revenue.minus(this.expenses).toNumber();\n if (this.public) {\n // Account for dividends\n if (this.dividendPercentage > 0) {\n profit *= (100 - this.dividendPercentage) / 100;\n }\n\n val = this.funds.toNumber() + profit * 85e3;\n val *= Math.pow(1.1, this.divisions.length);\n val = Math.max(val, 0);\n } else {\n val = 10e9 + Math.max(this.funds.toNumber(), 0) / 3; //Base valuation\n if (profit > 0) {\n val += profit * 315e3;\n val *= Math.pow(1.1, this.divisions.length);\n } else {\n val = 10e9 * Math.pow(1.1, this.divisions.length);\n }\n val -= val % 1e6; //Round down to nearest millionth\n }\n return val * BitNodeMultipliers.CorporationValuation;\n }\n\n getTargetSharePrice(): number {\n // Note: totalShares - numShares is not the same as issuedShares because\n // issuedShares does not account for private investors\n return this.determineValuation() / (2 * (this.totalShares - this.numShares) + 1);\n }\n\n updateSharePrice(): void {\n const targetPrice = this.getTargetSharePrice();\n if (this.sharePrice <= targetPrice) {\n this.sharePrice *= 1 + Math.random() * 0.01;\n } else {\n this.sharePrice *= 1 - Math.random() * 0.01;\n }\n if (this.sharePrice <= 0.01) {\n this.sharePrice = 0.01;\n }\n }\n\n immediatelyUpdateSharePrice(): void {\n this.sharePrice = this.getTargetSharePrice();\n }\n\n // Calculates how much money will be made and what the resulting stock price\n // will be when the player sells his/her shares\n // @return - [Player profit, final stock price, end shareSalesUntilPriceUpdate property]\n calculateShareSale(numShares: number): [number, number, number] {\n let sharesTracker = numShares;\n let sharesUntilUpdate = this.shareSalesUntilPriceUpdate;\n let sharePrice = this.sharePrice;\n let sharesSold = 0;\n let profit = 0;\n\n const maxIterations = Math.ceil(numShares / CorporationConstants.SHARESPERPRICEUPDATE);\n if (isNaN(maxIterations) || maxIterations > 10e6) {\n console.error(\n `Something went wrong or unexpected when calculating share sale. Maxiterations calculated to be ${maxIterations}`,\n );\n return [0, 0, 0];\n }\n\n for (let i = 0; i < maxIterations; ++i) {\n if (sharesTracker < sharesUntilUpdate) {\n profit += sharePrice * sharesTracker;\n sharesUntilUpdate -= sharesTracker;\n break;\n } else {\n profit += sharePrice * sharesUntilUpdate;\n sharesUntilUpdate = CorporationConstants.SHARESPERPRICEUPDATE;\n sharesTracker -= sharesUntilUpdate;\n sharesSold += sharesUntilUpdate;\n\n // Calculate what new share price would be\n sharePrice = this.determineValuation() / (2 * (this.totalShares + sharesSold - this.numShares));\n }\n }\n\n return [profit, sharePrice, sharesUntilUpdate];\n }\n\n convertCooldownToString(cd: number): string {\n // The cooldown value is based on game cycles. Convert to a simple string\n const seconds = cd / 5;\n\n const SecondsPerMinute = 60;\n const SecondsPerHour = 3600;\n\n if (seconds > SecondsPerHour) {\n return `${Math.floor(seconds / SecondsPerHour)} hour(s)`;\n } else if (seconds > SecondsPerMinute) {\n return `${Math.floor(seconds / SecondsPerMinute)} minute(s)`;\n } else {\n return `${Math.floor(seconds)} second(s)`;\n }\n }\n\n //One time upgrades that unlock new features\n unlock(upgrade: CorporationUnlockUpgrade): void {\n const upgN = upgrade[0],\n price = upgrade[1];\n while (this.unlockUpgrades.length <= upgN) {\n this.unlockUpgrades.push(0);\n }\n if (this.funds.lt(price)) {\n dialogBoxCreate(\"You don't have enough funds to unlock this!\");\n return;\n }\n this.unlockUpgrades[upgN] = 1;\n this.funds = this.funds.minus(price);\n\n // Apply effects for one-time upgrades\n if (upgN === 5) {\n this.dividendTaxPercentage -= 5;\n } else if (upgN === 6) {\n this.dividendTaxPercentage -= 10;\n }\n }\n\n //Levelable upgrades\n upgrade(upgrade: CorporationUpgrade): void {\n const upgN = upgrade[0],\n basePrice = upgrade[1],\n priceMult = upgrade[2],\n upgradeAmt = upgrade[3]; //Amount by which the upgrade multiplier gets increased (additive)\n while (this.upgrades.length <= upgN) {\n this.upgrades.push(0);\n }\n while (this.upgradeMultipliers.length <= upgN) {\n this.upgradeMultipliers.push(1);\n }\n const totalCost = basePrice * Math.pow(priceMult, this.upgrades[upgN]);\n if (this.funds.lt(totalCost)) {\n dialogBoxCreate(\"You don't have enough funds to purchase this!\");\n return;\n }\n ++this.upgrades[upgN];\n this.funds = this.funds.minus(totalCost);\n\n //Increase upgrade multiplier\n this.upgradeMultipliers[upgN] = 1 + this.upgrades[upgN] * upgradeAmt;\n\n //If storage size is being updated, update values in Warehouse objects\n if (upgN === 1) {\n for (let i = 0; i < this.divisions.length; ++i) {\n const industry = this.divisions[i];\n for (const city in industry.warehouses) {\n const warehouse = industry.warehouses[city];\n if (warehouse === 0) continue;\n if (industry.warehouses.hasOwnProperty(city) && warehouse instanceof Warehouse) {\n warehouse.updateSize(this, industry);\n }\n }\n }\n }\n }\n\n getProductionMultiplier(): number {\n const mult = this.upgradeMultipliers[0];\n if (isNaN(mult) || mult < 1) {\n return 1;\n } else {\n return mult;\n }\n }\n\n getStorageMultiplier(): number {\n const mult = this.upgradeMultipliers[1];\n if (isNaN(mult) || mult < 1) {\n return 1;\n } else {\n return mult;\n }\n }\n\n getDreamSenseGain(): number {\n const gain = this.upgradeMultipliers[2] - 1;\n return gain <= 0 ? 0 : gain;\n }\n\n getAdvertisingMultiplier(): number {\n const mult = this.upgradeMultipliers[3];\n if (isNaN(mult) || mult < 1) {\n return 1;\n } else {\n return mult;\n }\n }\n\n getEmployeeCreMultiplier(): number {\n const mult = this.upgradeMultipliers[4];\n if (isNaN(mult) || mult < 1) {\n return 1;\n } else {\n return mult;\n }\n }\n\n getEmployeeChaMultiplier(): number {\n const mult = this.upgradeMultipliers[5];\n if (isNaN(mult) || mult < 1) {\n return 1;\n } else {\n return mult;\n }\n }\n\n getEmployeeIntMultiplier(): number {\n const mult = this.upgradeMultipliers[6];\n if (isNaN(mult) || mult < 1) {\n return 1;\n } else {\n return mult;\n }\n }\n\n getEmployeeEffMultiplier(): number {\n const mult = this.upgradeMultipliers[7];\n if (isNaN(mult) || mult < 1) {\n return 1;\n } else {\n return mult;\n }\n }\n\n getSalesMultiplier(): number {\n const mult = this.upgradeMultipliers[8];\n if (isNaN(mult) || mult < 1) {\n return 1;\n } else {\n return mult;\n }\n }\n\n getScientificResearchMultiplier(): number {\n const mult = this.upgradeMultipliers[9];\n if (isNaN(mult) || mult < 1) {\n return 1;\n } else {\n return mult;\n }\n }\n\n // Adds the Corporation Handbook (Starter Guide) to the player's home computer.\n // This is a lit file that gives introductory info to the player\n // This occurs when the player clicks the \"Getting Started Guide\" button on the overview panel\n getStarterGuide(player: IPlayer): void {\n // Check if player already has Corporation Handbook\n const homeComp = player.getHomeComputer();\n let hasHandbook = false;\n const handbookFn = LiteratureNames.CorporationManagementHandbook;\n for (let i = 0; i < homeComp.messages.length; ++i) {\n if (isString(homeComp.messages[i]) && homeComp.messages[i] === handbookFn) {\n hasHandbook = true;\n break;\n }\n }\n\n if (!hasHandbook) {\n homeComp.messages.push(handbookFn);\n }\n showLiterature(handbookFn);\n return;\n }\n\n /**\n * Serialize the current object to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"Corporation\", this);\n }\n\n /**\n * Initiatizes a Corporation object from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Corporation {\n return Generic_fromJSON(Corporation, value.data);\n }\n}\n\nReviver.constructors.Corporation = Corporation;\n","import { IBladeburner } from \"./IBladeburner\";\nimport { BladeburnerConstants } from \"./data/Constants\";\nimport { Action, IActionParams } from \"./Action\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\nexport interface IOperationParams extends IActionParams {\n reqdRank?: number;\n teamCount?: number;\n}\n\nexport class Operation extends Action {\n reqdRank = 100;\n teamCount = 0;\n\n constructor(params: IOperationParams | null = null) {\n super(params);\n if (params && params.reqdRank) this.reqdRank = params.reqdRank;\n if (params && params.teamCount) this.teamCount = params.teamCount;\n }\n\n // For actions that have teams. To be implemented by subtypes.\n getTeamSuccessBonus(inst: IBladeburner): number {\n if (this.teamCount && this.teamCount > 0) {\n this.teamCount = Math.min(this.teamCount, inst.teamSize);\n const teamMultiplier = Math.pow(this.teamCount, 0.05);\n return teamMultiplier;\n }\n\n return 1;\n }\n\n getActionTypeSkillSuccessBonus(inst: IBladeburner): number {\n return inst.skillMultipliers.successChanceOperation;\n }\n\n getChaosDifficultyBonus(inst: IBladeburner /*, params: ISuccessChanceParams*/): number {\n const city = inst.getCurrentCity();\n if (city.chaos > BladeburnerConstants.ChaosThreshold) {\n const diff = 1 + (city.chaos - BladeburnerConstants.ChaosThreshold);\n const mult = Math.pow(diff, 0.1);\n return mult;\n }\n\n return 1;\n }\n\n toJSON(): any {\n return Generic_toJSON(\"Operation\", this);\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Operation {\n return Generic_fromJSON(Operation, value.data);\n }\n}\n\nReviver.constructors.Operation = Operation;\n","/**\n * Implements the purchasing of extra Duplicate Sleeves from The Covenant,\n * as well as the purchasing of upgrades (memory)\n */\nimport { IPlayer } from \"../IPlayer\";\n\nimport { CovenantPurchasesRoot } from \"./ui/CovenantPurchasesRoot\";\nimport { createPopup, removePopup } from \"../../ui/React/createPopup\";\n\nexport const MaxSleevesFromCovenant = 5;\nexport const BaseCostPerSleeve = 10e12;\nexport const PopupId = \"covenant-sleeve-purchases-popup\";\n\nexport function createSleevePurchasesFromCovenantPopup(p: IPlayer): void {\n createPopup(PopupId, CovenantPurchasesRoot, {\n p: p,\n closeFn: () => removePopup(PopupId),\n });\n}\n","/**\n * Returns a reference to the first object with the specified value of the ID or NAME attribute,\n * throwing an error if it is unable to find it.\n * @param elementId The HTML ID to retrieve the element by.\n * @throws {Error} When the 'elementId' cannot be found.\n */\nexport function getElementById(elementId: string): HTMLElement {\n const el: HTMLElement | null = document.getElementById(elementId);\n if (el === null) {\n throw new Error(`Unable to find element with id '${elementId}'`);\n }\n\n return el;\n}\n","import { Augmentations } from \"./Augmentation/Augmentations\";\nimport { augmentationExists, initAugmentations } from \"./Augmentation/AugmentationHelpers\";\nimport { AugmentationNames } from \"./Augmentation/data/AugmentationNames\";\nimport { initBitNodeMultipliers } from \"./BitNode/BitNode\";\nimport { Bladeburner } from \"./Bladeburner/Bladeburner\";\nimport { Companies, initCompanies } from \"./Company/Companies\";\nimport { resetIndustryResearchTrees } from \"./Corporation/IndustryData\";\nimport { Programs } from \"./Programs/Programs\";\nimport { Engine } from \"./engine\";\nimport { Faction } from \"./Faction/Faction\";\nimport { Factions, initFactions } from \"./Faction/Factions\";\nimport { joinFaction } from \"./Faction/FactionHelpers\";\nimport { updateHashManagerCapacity } from \"./Hacknet/HacknetHelpers\";\nimport { initMessages } from \"./Message/MessageHelpers\";\nimport { prestigeWorkerScripts } from \"./NetscriptWorker\";\nimport { Player } from \"./Player\";\nimport { resetPidCounter } from \"./Netscript/Pid\";\nimport { LiteratureNames } from \"./Literature/data/LiteratureNames\";\n\nimport { AllServers, AddToAllServers, initForeignServers, prestigeAllServers } from \"./Server/AllServers\";\nimport { prestigeHomeComputer } from \"./Server/ServerHelpers\";\nimport { SourceFileFlags, updateSourceFileFlags } from \"./SourceFile/SourceFileFlags\";\nimport { SpecialServerIps, prestigeSpecialServerIps, SpecialServerNames } from \"./Server/SpecialServerIps\";\nimport { deleteStockMarket, initStockMarket, initSymbolToStockMap } from \"./StockMarket/StockMarket\";\nimport { Terminal } from \"./Terminal\";\n\nimport { dialogBoxCreate } from \"../utils/DialogBox\";\n\nimport Decimal from \"decimal.js\";\n\nconst BitNode8StartingMoney = 250e6;\n\n// Prestige by purchasing augmentation\nfunction prestigeAugmentation() {\n initBitNodeMultipliers(Player);\n\n const maintainMembership = Player.factions.filter(function (faction) {\n return Factions[faction].getInfo().keep;\n });\n Player.prestigeAugmentation();\n\n // Delete all Worker Scripts objects\n prestigeWorkerScripts();\n\n var homeComp = Player.getHomeComputer();\n // Delete all servers except home computer\n prestigeAllServers();\n\n // Delete Special Server IPs\n prestigeSpecialServerIps(); // Must be done before initForeignServers()\n\n // Reset home computer (only the programs) and add to AllServers\n AddToAllServers(homeComp);\n prestigeHomeComputer(homeComp);\n\n if (augmentationExists(AugmentationNames.Neurolink) && Augmentations[AugmentationNames.Neurolink].owned) {\n homeComp.programs.push(Programs.FTPCrackProgram.name);\n homeComp.programs.push(Programs.RelaySMTPProgram.name);\n }\n if (augmentationExists(AugmentationNames.CashRoot) && Augmentations[AugmentationNames.CashRoot].owned) {\n Player.setMoney(1e6);\n homeComp.programs.push(Programs.BruteSSHProgram.name);\n }\n if (augmentationExists(AugmentationNames.PCMatrix) && Augmentations[AugmentationNames.PCMatrix].owned) {\n homeComp.programs.push(Programs.DeepscanV1.name);\n homeComp.programs.push(Programs.AutoLink.name);\n }\n\n // Re-create foreign servers\n initForeignServers(Player.getHomeComputer());\n\n // Gain favor for Companies\n for (var member in Companies) {\n if (Companies.hasOwnProperty(member)) {\n Companies[member].gainFavor();\n }\n }\n\n // Gain favor for factions\n for (var member in Factions) {\n if (Factions.hasOwnProperty(member)) {\n Factions[member].gainFavor();\n }\n }\n\n // Stop a Terminal action if there is onerror\n if (Engine._actionInProgress) {\n Engine._actionInProgress = false;\n Terminal.finishAction(true);\n }\n\n // Re-initialize things - This will update any changes\n initFactions(); // Factions must be initialized before augmentations\n\n Player.factions = Player.factions.concat(maintainMembership);\n Player.factions.map((f) => (Factions[f].isMember = true));\n initAugmentations(); // Calls reapplyAllAugmentations() and resets Player multipliers\n Player.reapplyAllSourceFiles();\n initCompanies();\n\n // Messages\n initMessages();\n\n // Gang\n if (Player.inGang()) {\n const faction = Factions[Player.gang.facName];\n if (faction instanceof Faction) {\n joinFaction(faction);\n }\n }\n\n // Cancel Bladeburner action\n if (Player.bladeburner instanceof Bladeburner) {\n Player.bladeburner.prestige();\n }\n\n // BitNode 8: Ghost of Wall Street\n if (Player.bitNodeN === 8) {\n Player.money = new Decimal(BitNode8StartingMoney);\n }\n if (Player.bitNodeN === 8 || SourceFileFlags[8] > 0) {\n Player.hasWseAccount = true;\n Player.hasTixApiAccess = true;\n }\n\n // Reset Stock market\n if (Player.hasWseAccount) {\n initStockMarket();\n initSymbolToStockMap();\n }\n\n // Red Pill\n if (augmentationExists(AugmentationNames.TheRedPill) && Augmentations[AugmentationNames.TheRedPill].owned) {\n var WorldDaemon = AllServers[SpecialServerIps[SpecialServerNames.WorldDaemon]];\n var DaedalusServer = AllServers[SpecialServerIps[SpecialServerNames.DaedalusServer]];\n if (WorldDaemon && DaedalusServer) {\n WorldDaemon.serversOnNetwork.push(DaedalusServer.ip);\n DaedalusServer.serversOnNetwork.push(WorldDaemon.ip);\n }\n }\n\n resetPidCounter();\n}\n\n// Prestige by destroying Bit Node and gaining a Source File\nfunction prestigeSourceFile(flume) {\n initBitNodeMultipliers(Player);\n updateSourceFileFlags(Player);\n\n Player.prestigeSourceFile();\n prestigeWorkerScripts(); // Delete all Worker Scripts objects\n\n var homeComp = Player.getHomeComputer();\n\n // Delete all servers except home computer\n prestigeAllServers(); // Must be done before initForeignServers()\n\n // Delete Special Server IPs\n prestigeSpecialServerIps();\n\n // Reset home computer (only the programs) and add to AllServers\n AddToAllServers(homeComp);\n prestigeHomeComputer(homeComp);\n\n // Re-create foreign servers\n initForeignServers(Player.getHomeComputer());\n\n if (SourceFileFlags[9] >= 2) {\n homeComp.setMaxRam(128);\n } else if (SourceFileFlags[1] > 0) {\n homeComp.setMaxRam(32);\n } else {\n homeComp.setMaxRam(8);\n }\n homeComp.cpuCores = 1;\n\n // Reset favor for Companies\n for (var member in Companies) {\n if (Companies.hasOwnProperty(member)) {\n Companies[member].favor = 0;\n }\n }\n\n // Reset favor for factions\n for (var member in Factions) {\n if (Factions.hasOwnProperty(member)) {\n Factions[member].favor = 0;\n }\n }\n\n // Stop a Terminal action if there is one\n if (Engine._actionInProgress) {\n Engine._actionInProgress = false;\n Terminal.finishAction(true);\n }\n\n // Delete all Augmentations\n for (var name in Augmentations) {\n if (Augmentations.hasOwnProperty(name)) {\n delete Augmentations[name];\n }\n }\n\n // Give levels of NeuroFluxGoverner for Source-File 12. Must be done here before Augmentations are recalculated\n if (SourceFileFlags[12] > 0) {\n Player.augmentations.push({\n name: AugmentationNames.NeuroFluxGovernor,\n level: SourceFileFlags[12],\n });\n }\n\n // Re-initialize things - This will update any changes\n initFactions(); // Factions must be initialized before augmentations\n initAugmentations(); // Calls reapplyAllAugmentations() and resets Player multipliers\n Player.reapplyAllSourceFiles();\n initCompanies();\n\n // Messages\n initMessages();\n\n // BitNode 3: Corporatocracy\n if (Player.bitNodeN === 3) {\n homeComp.messages.push(LiteratureNames.CorporationManagementHandbook);\n dialogBoxCreate(\n \"You received a copy of the Corporation Management Handbook on your home computer. \" +\n \"Read it if you need help getting started with Corporations!\",\n );\n }\n\n // BitNode 8: Ghost of Wall Street\n if (Player.bitNodeN === 8) {\n Player.money = new Decimal(BitNode8StartingMoney);\n }\n if (Player.bitNodeN === 8 || SourceFileFlags[8] > 0) {\n Player.hasWseAccount = true;\n Player.hasTixApiAccess = true;\n }\n\n // Bit Node 10: Digital Carbon\n if (Player.bitNodeN === 10) {\n dialogBoxCreate(\"Visit VitaLife in New Tokyo if you'd like to purchase a new sleeve!\");\n }\n\n // Reset Stock market, gang, and corporation\n if (Player.hasWseAccount) {\n initStockMarket();\n initSymbolToStockMap();\n } else {\n deleteStockMarket();\n }\n\n if (Player.inGang()) clearGangUI();\n Player.gang = null;\n Player.corporation = null;\n resetIndustryResearchTrees();\n Player.bladeburner = null;\n\n // Source-File 9 (level 3) effect\n if (SourceFileFlags[9] >= 3) {\n const hserver = Player.createHacknetServer();\n\n hserver.level = 100;\n hserver.cores = 10;\n hserver.cache = 5;\n hserver.updateHashRate(Player.hacknet_node_money_mult);\n hserver.updateHashCapacity();\n updateHashManagerCapacity(Player);\n }\n\n // Gain int exp\n if (SourceFileFlags[5] !== 0 && !flume) Player.gainIntelligenceExp(300);\n\n resetPidCounter();\n}\n\nexport { prestigeAugmentation, prestigeSourceFile };\n","export class PlayerOwnedAugmentation {\n level = 1;\n name = \"\";\n\n constructor(name = \"\") {\n this.name = name;\n }\n}\n\nexport interface IPlayerOwnedAugmentation {\n level: number;\n name: string;\n}\n","export interface RNG {\n random(): number;\n}\n\n/*\n * very bad RNG, meant to be used as introduction to RNG manipulation. It has a\n * period of 1024.\n */\nclass RNG0 implements RNG {\n x: number;\n m = 1024;\n a = 341;\n c = 1;\n\n constructor() {\n this.x = 0;\n this.reset();\n }\n\n step(): void {\n this.x = (this.a * this.x + this.c) % this.m;\n }\n\n random(): number {\n this.step();\n return this.x / this.m;\n }\n\n reset(): void {\n this.x = new Date().getTime() % this.m;\n }\n}\n\nexport const BadRNG: RNG0 = new RNG0();\n\n/*\n * Wichmann–Hill PRNG\n * The period is 6e12.\n */\nexport class WHRNG implements RNG {\n s1 = 0;\n s2 = 0;\n s3 = 0;\n\n constructor(totalPlaytime: number) {\n // This one is seeded by the players total play time.\n const v: number = (totalPlaytime / 1000) % 30000;\n this.s1 = v;\n this.s2 = v;\n this.s3 = v;\n }\n\n step(): void {\n this.s1 = (171 * this.s1) % 30269;\n this.s2 = (172 * this.s2) % 30307;\n this.s3 = (170 * this.s3) % 30323;\n }\n\n random(): number {\n this.step();\n return (this.s1 / 30269.0 + this.s2 / 30307.0 + this.s3 / 30323.0) % 1.0;\n }\n}\n","import { CONSTANTS } from \"../Constants\";\nimport * as names from \"./data/companypositionnames\";\n\n/* tslint:disable:completed-docs */\n\nexport interface IConstructorParams {\n name: string;\n nextPosition: string | null;\n baseSalary: number;\n repMultiplier: number;\n\n reqdHacking?: number;\n reqdStrength?: number;\n reqdDefense?: number;\n reqdDexterity?: number;\n reqdAgility?: number;\n reqdCharisma?: number;\n reqdReputation?: number;\n\n hackingEffectiveness?: number;\n strengthEffectiveness?: number;\n defenseEffectiveness?: number;\n dexterityEffectiveness?: number;\n agilityEffectiveness?: number;\n charismaEffectiveness?: number;\n\n hackingExpGain?: number;\n strengthExpGain?: number;\n defenseExpGain?: number;\n dexterityExpGain?: number;\n agilityExpGain?: number;\n charismaExpGain?: number;\n}\n\nexport class CompanyPosition {\n /**\n * Position title\n */\n name: string;\n\n /**\n * Title of next position to be promoted to\n */\n nextPosition: string | null;\n\n /**\n * Base salary for this position ($ per 200ms game cycle)\n * Will be multiplier by a company-specific multiplier for final salary\n */\n baseSalary: number;\n\n /**\n * Reputation multiplier\n */\n repMultiplier: number;\n\n /**\n * Required stats to earn this position\n */\n requiredAgility: number;\n requiredCharisma: number;\n requiredDefense: number;\n requiredDexterity: number;\n requiredHacking: number;\n requiredStrength: number;\n\n /**\n * Required company reputation to earn this position\n */\n requiredReputation: number;\n\n /**\n * Effectiveness of each stat time for job performance\n */\n hackingEffectiveness: number;\n strengthEffectiveness: number;\n defenseEffectiveness: number;\n dexterityEffectiveness: number;\n agilityEffectiveness: number;\n charismaEffectiveness: number;\n\n /**\n * Experience gain for performing job (per 200ms game cycle)\n */\n hackingExpGain: number;\n strengthExpGain: number;\n defenseExpGain: number;\n dexterityExpGain: number;\n agilityExpGain: number;\n charismaExpGain: number;\n\n constructor(p: IConstructorParams) {\n this.name = p.name;\n this.nextPosition = p.nextPosition;\n this.baseSalary = p.baseSalary;\n this.repMultiplier = p.repMultiplier;\n\n this.requiredHacking = p.reqdHacking != null ? p.reqdHacking : 0;\n this.requiredStrength = p.reqdStrength != null ? p.reqdStrength : 0;\n this.requiredDefense = p.reqdDefense != null ? p.reqdDefense : 0;\n this.requiredDexterity = p.reqdDexterity != null ? p.reqdDexterity : 0;\n this.requiredAgility = p.reqdAgility != null ? p.reqdAgility : 0;\n this.requiredCharisma = p.reqdCharisma != null ? p.reqdCharisma : 0;\n this.requiredReputation = p.reqdReputation != null ? p.reqdReputation : 0;\n\n this.hackingEffectiveness = p.hackingEffectiveness != null ? p.hackingEffectiveness : 0;\n this.strengthEffectiveness = p.strengthEffectiveness != null ? p.strengthEffectiveness : 0;\n this.defenseEffectiveness = p.defenseEffectiveness != null ? p.defenseEffectiveness : 0;\n this.dexterityEffectiveness = p.dexterityEffectiveness != null ? p.dexterityEffectiveness : 0;\n this.agilityEffectiveness = p.agilityEffectiveness != null ? p.agilityEffectiveness : 0;\n this.charismaEffectiveness = p.charismaEffectiveness != null ? p.charismaEffectiveness : 0;\n\n if (\n Math.round(\n this.hackingEffectiveness +\n this.strengthEffectiveness +\n this.defenseEffectiveness +\n this.dexterityEffectiveness +\n this.agilityEffectiveness +\n this.charismaEffectiveness,\n ) !== 100\n ) {\n console.error(`CompanyPosition ${this.name} parameters do not sum to 100`);\n }\n\n this.hackingExpGain = p.hackingExpGain != null ? p.hackingExpGain : 0;\n this.strengthExpGain = p.strengthExpGain != null ? p.strengthExpGain : 0;\n this.defenseExpGain = p.defenseExpGain != null ? p.defenseExpGain : 0;\n this.dexterityExpGain = p.dexterityExpGain != null ? p.dexterityExpGain : 0;\n this.agilityExpGain = p.agilityExpGain != null ? p.agilityExpGain : 0;\n this.charismaExpGain = p.charismaExpGain != null ? p.charismaExpGain : 0;\n }\n\n calculateJobPerformance(hack: number, str: number, def: number, dex: number, agi: number, cha: number): number {\n const hackRatio: number = (this.hackingEffectiveness * hack) / CONSTANTS.MaxSkillLevel;\n const strRatio: number = (this.strengthEffectiveness * str) / CONSTANTS.MaxSkillLevel;\n const defRatio: number = (this.defenseEffectiveness * def) / CONSTANTS.MaxSkillLevel;\n const dexRatio: number = (this.dexterityEffectiveness * dex) / CONSTANTS.MaxSkillLevel;\n const agiRatio: number = (this.agilityEffectiveness * agi) / CONSTANTS.MaxSkillLevel;\n const chaRatio: number = (this.charismaEffectiveness * cha) / CONSTANTS.MaxSkillLevel;\n\n let reputationGain: number =\n (this.repMultiplier * (hackRatio + strRatio + defRatio + dexRatio + agiRatio + chaRatio)) / 100;\n if (isNaN(reputationGain)) {\n console.error(\"Company reputation gain calculated to be NaN\");\n reputationGain = 0;\n }\n\n return reputationGain;\n }\n\n isSoftwareJob(): boolean {\n return names.SoftwareCompanyPositions.includes(this.name);\n }\n\n isITJob(): boolean {\n return names.ITCompanyPositions.includes(this.name);\n }\n\n isSecurityEngineerJob(): boolean {\n return names.SecurityEngineerCompanyPositions.includes(this.name);\n }\n\n isNetworkEngineerJob(): boolean {\n return names.NetworkEngineerCompanyPositions.includes(this.name);\n }\n\n isBusinessJob(): boolean {\n return names.BusinessCompanyPositions.includes(this.name);\n }\n\n isSecurityJob(): boolean {\n return names.SecurityCompanyPositions.includes(this.name);\n }\n\n isAgentJob(): boolean {\n return names.AgentCompanyPositions.includes(this.name);\n }\n\n isSoftwareConsultantJob(): boolean {\n return names.SoftwareConsultantCompanyPositions.includes(this.name);\n }\n\n isBusinessConsultantJob(): boolean {\n return names.BusinessConsultantCompanyPositions.includes(this.name);\n }\n\n isPartTimeJob(): boolean {\n return names.PartTimeCompanyPositions.includes(this.name);\n }\n}\n","import { SourceFile } from \"./SourceFile\";\nimport { IMap } from \"../types\";\n\nexport const SourceFiles: IMap = {};\n\nSourceFiles[\"SourceFile1\"] = new SourceFile(\n 1,\n \"This Source-File lets the player start with 32GB of RAM on his/her \" +\n \"home computer. It also increases all of the player's multipliers by:

\" +\n \"Level 1: 16%
\" +\n \"Level 2: 24%
\" +\n \"Level 3: 28%\",\n);\nSourceFiles[\"SourceFile2\"] = new SourceFile(\n 2,\n \"This Source-File allows you to form gangs in other BitNodes \" +\n \"once your karma decreases to a certain value. It also increases the player's \" +\n \"crime success rate, crime money, and charisma multipliers by:

\" +\n \"Level 1: 24%
\" +\n \"Level 2: 36%
\" +\n \"Level 3: 42%\",\n);\nSourceFiles[\"SourceFile3\"] = new SourceFile(\n 3,\n \"This Source-File lets you create corporations on other BitNodes (although \" +\n \"some BitNodes will disable this mechanic). This Source-File also increases your charisma and company salary multipliers by:
\" +\n \"Level 1: 8%
\" +\n \"Level 2: 12%
\" +\n \"Level 3: 14%\",\n);\nSourceFiles[\"SourceFile4\"] = new SourceFile(\n 4,\n \"This Source-File lets you access and use the Singularity Functions in every BitNode. Every \" +\n \"level of this Source-File opens up more of the Singularity Functions you can use.\",\n);\nSourceFiles[\"SourceFile5\"] = new SourceFile(\n 5,\n \"This Source-File grants a special new stat called Intelligence. Intelligence \" +\n \"is unique because it is permanent and persistent (it never gets reset back to 1). However, \" +\n \"gaining Intelligence experience is much slower than other stats, and it is also hidden (you won't \" +\n \"know when you gain experience and how much). Higher Intelligence levels will boost your production \" +\n \"for many actions in the game. In addition, this Source-File will unlock the getBitNodeMultipliers() \" +\n \"and getServer() Netscript functions, as well as the formulas API, and will raise all of your \" +\n \"hacking-related multipliers by:

\" +\n \"Level 1: 8%
\" +\n \"Level 2: 12%
\" +\n \"Level 3: 14%\",\n);\nSourceFiles[\"SourceFile6\"] = new SourceFile(\n 6,\n \"This Source-File allows you to access the NSA's Bladeburner Division in other \" +\n \"BitNodes. In addition, this Source-File will raise both the level and experience gain rate of all your combat stats by:

\" +\n \"Level 1: 8%
\" +\n \"Level 2: 12%
\" +\n \"Level 3: 14%\",\n);\nSourceFiles[\"SourceFile7\"] = new SourceFile(\n 7,\n \"This Source-File allows you to access the Bladeburner Netscript API in other \" +\n \"BitNodes. In addition, this Source-File will increase all of your Bladeburner multipliers by:

\" +\n \"Level 1: 8%
\" +\n \"Level 2: 12%
\" +\n \"Level 3: 14%\",\n);\nSourceFiles[\"SourceFile8\"] = new SourceFile(\n 8,\n \"This Source-File grants the following benefits:

\" +\n \"Level 1: Permanent access to WSE and TIX API
\" +\n \"Level 2: Ability to short stocks in other BitNodes
\" +\n \"Level 3: Ability to use limit/stop orders in other BitNodes

\" +\n \"This Source-File also increases your hacking growth multipliers by: \" +\n \"
Level 1: 12%
Level 2: 18%
Level 3: 21%\",\n);\nSourceFiles[\"SourceFile9\"] = new SourceFile(\n 9,\n \"This Source-File grants the following benefits:

\" +\n \"Level 1: Permanently unlocks the Hacknet Server in other BitNodes
\" +\n \"Level 2: You start with 128GB of RAM on your home computer when entering a new BitNode
\" +\n \"Level 3: Grants a highly-upgraded Hacknet Server when entering a new BitNode

\" +\n \"(Note that the Level 3 effect of this Source-File only applies when entering a new BitNode, NOT \" +\n \"when installing Augmentations)\",\n);\nSourceFiles[\"SourceFile10\"] = new SourceFile(\n 10,\n \"This Source-File unlocks Sleeve technology in other BitNodes. Each level of this \" +\n \"Source-File also grants you a Duplicate Sleeve\",\n);\nSourceFiles[\"SourceFile11\"] = new SourceFile(\n 11,\n \"This Source-File makes it so that company favor increases BOTH the player's salary and reputation gain rate \" +\n \"at that company by 1% per favor (rather than just the reputation gain). This Source-File also \" +\n \" increases the player's company salary and reputation gain multipliers by:

\" +\n \"Level 1: 32%
\" +\n \"Level 2: 48%
\" +\n \"Level 3: 56%

\" +\n \"It also reduces the price increase for every aug bought by:

\" +\n \"Level 1: 4%
\" +\n \"Level 2: 6%
\" +\n \"Level 3: 7%\",\n);\nSourceFiles[\"SourceFile12\"] = new SourceFile(\n 12,\n \"This Source-File lets the player start with Neuroflux Governor equal to the level of this Source-File.\",\n);\n","import React from \"react\";\nimport { Theme } from \"@mui/material\";\nimport makeStyles from \"@mui/styles/makeStyles\";\nimport createStyles from \"@mui/styles/createStyles\";\nimport M from \"@mui/material/Modal\";\nimport Fade from \"@mui/material/Fade\";\nimport Box from \"@mui/material/Box\";\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n modal: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n paper: {\n backgroundColor: theme.palette.background.default,\n border: \"2px solid \" + theme.palette.primary.main,\n boxShadow: `0px 3px 5px -1px ${theme.palette.primary.dark},0px 5px 8px 0px ${theme.palette.primary.dark},0px 1px 14px 0px ${theme.palette.primary.dark}`,\n padding: 2,\n maxWidth: \"80%\",\n maxHeight: \"80%\",\n overflow: \"auto\",\n \"&::-webkit-scrollbar\": {\n // webkit\n display: \"none\",\n },\n scrollbarWidth: \"none\", // firefox\n },\n }),\n);\n\ninterface IProps {\n open: boolean;\n onClose: () => void;\n children: JSX.Element[] | JSX.Element | React.ReactElement[] | React.ReactElement;\n}\n\nexport const Modal = (props: IProps): React.ReactElement => {\n const classes = useStyles();\n return (\n \n \n
\n {props.children}\n
\n
\n
\n );\n};\n","import * as React from \"react\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\n\nconst gainLimit = 10e9;\n\nexport class Game extends React.Component {\n win(p: IPlayer, n: number): void {\n p.gainMoney(n);\n p.recordMoneySource(n, \"casino\");\n }\n\n reachedLimit(p: IPlayer): boolean {\n const reached = p.getCasinoWinnings() > gainLimit;\n if (reached) {\n dialogBoxCreate(<>Alright cheater get out of here. You're not allowed here anymore.);\n }\n return reached;\n }\n}\n","/**\n * Class representing a Script instance that is actively running.\n * A Script can have multiple active instances\n */\nimport { Script } from \"./Script\";\nimport { FconfSettings } from \"../Fconf/FconfSettings\";\nimport { Settings } from \"../Settings/Settings\";\nimport { IMap } from \"../types\";\nimport { Terminal } from \"../Terminal\";\n\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\nimport { getTimestamp } from \"../../utils/helpers/getTimestamp\";\n\nexport class RunningScript {\n // Script arguments\n args: any[] = [];\n\n // Map of [key: server ip] -> Hacking data. Used for offline progress calculations.\n // Hacking data format: [MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]\n dataMap: IMap = {};\n\n // Script filename\n filename = \"\";\n\n // This script's logs. An array of log entries\n logs: string[] = [];\n\n // Flag indicating whether the logs have been updated since\n // the last time the UI was updated\n logUpd = false;\n\n // Total amount of hacking experience earned from this script when offline\n offlineExpGained = 0;\n\n // Total amount of money made by this script when offline\n offlineMoneyMade = 0;\n\n // Number of seconds that the script has been running offline\n offlineRunningTime = 0.01;\n\n // Total amount of hacking experience earned from this script when online\n onlineExpGained = 0;\n\n // Total amount of money made by this script when online\n onlineMoneyMade = 0;\n\n // Number of seconds that this script has been running online\n onlineRunningTime = 0.01;\n\n // Process ID. Must be an integer and equals the PID of corresponding WorkerScript\n pid = -1;\n\n // How much RAM this script uses for ONE thread\n ramUsage = 0;\n\n // IP of the server on which this script is running\n server = \"\";\n\n // Number of threads that this script is running with\n threads = 1;\n\n constructor(script: Script | null = null, args: any[] = []) {\n if (script == null) {\n return;\n }\n this.filename = script.filename;\n this.args = args;\n this.server = script.server;\n this.ramUsage = script.ramUsage;\n }\n\n log(txt: string): void {\n if (this.logs.length > Settings.MaxLogCapacity) {\n this.logs.shift();\n }\n\n let logEntry = txt;\n if (Settings.EnableTimestamps) {\n logEntry = \"[\" + getTimestamp() + \"] \" + logEntry;\n }\n\n this.logs.push(logEntry);\n this.logUpd = true;\n }\n\n displayLog(): void {\n for (let i = 0; i < this.logs.length; ++i) {\n Terminal.print(this.logs[i]);\n }\n }\n\n clearLog(): void {\n this.logs.length = 0;\n }\n\n // Update the moneyStolen and numTimesHack maps when hacking\n recordHack(serverIp: string, moneyGained: number, n = 1): void {\n if (this.dataMap[serverIp] == null || this.dataMap[serverIp].constructor !== Array) {\n this.dataMap[serverIp] = [0, 0, 0, 0];\n }\n this.dataMap[serverIp][0] += moneyGained;\n this.dataMap[serverIp][1] += n;\n }\n\n // Update the grow map when calling grow()\n recordGrow(serverIp: string, n = 1): void {\n if (this.dataMap[serverIp] == null || this.dataMap[serverIp].constructor !== Array) {\n this.dataMap[serverIp] = [0, 0, 0, 0];\n }\n this.dataMap[serverIp][2] += n;\n }\n\n // Update the weaken map when calling weaken() {\n recordWeaken(serverIp: string, n = 1): void {\n if (this.dataMap[serverIp] == null || this.dataMap[serverIp].constructor !== Array) {\n this.dataMap[serverIp] = [0, 0, 0, 0];\n }\n this.dataMap[serverIp][3] += n;\n }\n\n // Serialize the current object to a JSON save state\n toJSON(): any {\n return Generic_toJSON(\"RunningScript\", this);\n }\n\n // Initializes a RunningScript Object from a JSON save state\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): RunningScript {\n return Generic_fromJSON(RunningScript, value.data);\n }\n}\n\nReviver.constructors.RunningScript = RunningScript;\n","/**\n * Class representing a script file.\n *\n * This does NOT represent a script that is actively running and\n * being evaluated. See RunningScript for that\n */\nimport { calculateRamUsage } from \"./RamCalculations\";\nimport { ScriptUrl } from \"./ScriptUrl\";\n\nimport { setTimeoutRef } from \"../utils/SetTimeoutRef\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\nimport { roundToTwo } from \"../../utils/helpers/roundToTwo\";\n\nlet globalModuleSequenceNumber = 0;\n\nexport class Script {\n // Code for this script\n code = \"\";\n\n // Filename for the script file\n filename = \"\";\n\n // url of the script if any, only for NS2.\n url = \"\";\n\n // The dynamic module generated for this script when it is run.\n // This is only applicable for NetscriptJS\n module: any = \"\";\n\n // The timestamp when when the script was last updated.\n moduleSequenceNumber: number;\n\n // Only used with NS2 scripts; the list of dependency script filenames. This is constructed\n // whenever the script is first evaluated, and therefore may be out of date if the script\n // has been updated since it was last run.\n dependencies: ScriptUrl[] = [];\n\n // Amount of RAM this Script requres to run\n ramUsage = 0;\n\n // IP of server that this script is on.\n server = \"\";\n\n constructor(fn = \"\", code = \"\", server = \"\", otherScripts: Script[] = []) {\n this.filename = fn;\n this.code = code;\n this.ramUsage = 0;\n this.server = server; // IP of server this script is on\n this.module = \"\";\n this.moduleSequenceNumber = ++globalModuleSequenceNumber;\n if (this.code !== \"\") {\n this.updateRamUsage(otherScripts);\n }\n }\n\n /**\n * Download the script as a file\n */\n download(): void {\n const filename = this.filename + \".js\";\n const file = new Blob([this.code], { type: \"text/plain\" });\n if (window.navigator.msSaveOrOpenBlob) {\n // IE10+\n window.navigator.msSaveOrOpenBlob(file, filename);\n } else {\n // Others\n const a = document.createElement(\"a\"),\n url = URL.createObjectURL(file);\n a.href = url;\n a.download = filename;\n document.body.appendChild(a);\n a.click();\n setTimeoutRef(function () {\n document.body.removeChild(a);\n window.URL.revokeObjectURL(url);\n }, 0);\n }\n }\n\n /**\n * Marks this script as having been updated. It will be recompiled next time something tries\n * to exec it.\n */\n markUpdated(): void {\n this.module = \"\";\n this.moduleSequenceNumber = ++globalModuleSequenceNumber;\n }\n\n /**\n * Save a script from the script editor\n * @param {string} code - The new contents of the script\n * @param {Script[]} otherScripts - Other scripts on the server. Used to process imports\n */\n saveScript(code: string, serverIp: string, otherScripts: Script[]): void {\n // Update code and filename\n this.code = code.replace(/^\\s+|\\s+$/g, \"\");\n\n const filenameElem: HTMLInputElement | null = document.getElementById(\"script-editor-filename\") as HTMLInputElement;\n if (filenameElem == null) {\n console.error(`Failed to get Script filename DOM element`);\n return;\n }\n this.filename = filenameElem.value;\n this.server = serverIp;\n this.updateRamUsage(otherScripts);\n this.markUpdated();\n }\n\n /**\n * Calculates and updates the script's RAM usage based on its code\n * @param {Script[]} otherScripts - Other scripts on the server. Used to process imports\n */\n async updateRamUsage(otherScripts: Script[]): Promise {\n const res = await calculateRamUsage(this.code, otherScripts);\n if (res > 0) {\n this.ramUsage = roundToTwo(res);\n }\n }\n\n // Serialize the current object to a JSON save state\n toJSON(): any {\n return Generic_toJSON(\"Script\", this);\n }\n\n // Initializes a Script Object from a JSON save state\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Script {\n return Generic_fromJSON(Script, value.data);\n }\n}\n\nReviver.constructors.Script = Script;\n","// The Research Map is an object that holds all Corporation Research objects\n// as values. They are identified by their names\nimport { Research, IConstructorParams } from \"./Research\";\nimport { researchMetadata } from \"./data/ResearchMetadata\";\nimport { IMap } from \"../types\";\n\nexport const ResearchMap: IMap = {};\n\nfunction addResearch(p: IConstructorParams): void {\n if (ResearchMap[p.name] != null) {\n console.warn(`Duplicate Research being defined: ${p.name}`);\n }\n ResearchMap[p.name] = new Research(p);\n}\n\nfor (const metadata of researchMetadata) {\n addResearch(metadata);\n}\n","import {\n CodingContract,\n CodingContractRewardType,\n CodingContractTypes,\n ICodingContractReward,\n} from \"./CodingContracts\";\nimport { Factions } from \"./Faction/Factions\";\nimport { Player } from \"./Player\";\nimport { AllServers } from \"./Server/AllServers\";\nimport { GetServerByHostname } from \"./Server/ServerHelpers\";\nimport { SpecialServerNames } from \"./Server/SpecialServerIps\";\nimport { Server } from \"./Server/Server\";\nimport { HacknetServer } from \"./Hacknet/HacknetServer\";\n\nimport { getRandomInt } from \"../utils/helpers/getRandomInt\";\n\nexport function generateRandomContract(): void {\n // First select a random problem type\n const problemType = getRandomProblemType();\n\n // Then select a random reward type. 'Money' will always be the last reward type\n const reward = getRandomReward();\n\n // Choose random server\n const randServer = getRandomServer();\n\n const contractFn = getRandomFilename(randServer, reward);\n const contract = new CodingContract(contractFn, problemType, reward);\n\n randServer.addContract(contract);\n}\n\nexport function generateRandomContractOnHome(): void {\n // First select a random problem type\n const problemType = getRandomProblemType();\n\n // Then select a random reward type. 'Money' will always be the last reward type\n const reward = getRandomReward();\n\n // Choose random server\n const serv = Player.getHomeComputer();\n\n const contractFn = getRandomFilename(serv, reward);\n const contract = new CodingContract(contractFn, problemType, reward);\n\n serv.addContract(contract);\n}\n\nexport interface IGenerateContractParams {\n problemType?: string;\n server?: string;\n fn?: string;\n}\n\nexport function generateContract(params: IGenerateContractParams): void {\n // Problem Type\n let problemType;\n const problemTypes = Object.keys(CodingContractTypes);\n if (params.problemType != null && problemTypes.includes(params.problemType)) {\n problemType = params.problemType;\n } else {\n problemType = getRandomProblemType();\n }\n\n // Reward Type - This is always random for now\n const reward = getRandomReward();\n\n // Server\n let server;\n if (params.server != null) {\n server = GetServerByHostname(params.server);\n if (server == null) {\n server = AllServers[params.server];\n }\n if (server == null) {\n server = getRandomServer();\n }\n } else {\n server = getRandomServer();\n }\n\n // Filename\n let fn;\n if (params.fn != null) {\n fn = params.fn;\n } else {\n fn = getRandomFilename(server, reward);\n }\n\n const contract = new CodingContract(fn, problemType, reward);\n server.addContract(contract);\n}\n\n// Ensures that a contract's reward type is valid\nfunction sanitizeRewardType(rewardType: CodingContractRewardType): CodingContractRewardType {\n let type = rewardType; // Create copy\n\n const factionsThatAllowHacking = Player.factions.filter((fac) => {\n try {\n return Factions[fac].getInfo().offerHackingWork;\n } catch (e) {\n console.error(`Error when trying to filter Hacking Factions for Coding Contract Generation: ${e}`);\n return false;\n }\n });\n if (type === CodingContractRewardType.FactionReputation && factionsThatAllowHacking.length === 0) {\n type = CodingContractRewardType.CompanyReputation;\n }\n if (type === CodingContractRewardType.FactionReputationAll && factionsThatAllowHacking.length === 0) {\n type = CodingContractRewardType.CompanyReputation;\n }\n if (type === CodingContractRewardType.CompanyReputation && Object.keys(Player.jobs).length === 0) {\n type = CodingContractRewardType.Money;\n }\n\n return type;\n}\n\nfunction getRandomProblemType(): string {\n const problemTypes = Object.keys(CodingContractTypes);\n const randIndex = getRandomInt(0, problemTypes.length - 1);\n\n return problemTypes[randIndex];\n}\n\nfunction getRandomReward(): ICodingContractReward {\n const reward: ICodingContractReward = {\n name: \"\",\n type: getRandomInt(0, CodingContractRewardType.Money),\n };\n reward.type = sanitizeRewardType(reward.type);\n\n // Add additional information based on the reward type\n const factionsThatAllowHacking = Player.factions.filter((fac) => {\n try {\n return Factions[fac].getInfo().offerHackingWork;\n } catch (e) {\n console.error(`Error when trying to filter Hacking Factions for Coding Contract Generation: ${e}`);\n return false;\n }\n });\n\n switch (reward.type) {\n case CodingContractRewardType.FactionReputation: {\n // Get a random faction that player is a part of. That\n // faction must allow hacking contracts\n const numFactions = factionsThatAllowHacking.length;\n const randFaction = factionsThatAllowHacking[getRandomInt(0, numFactions - 1)];\n reward.name = randFaction;\n break;\n }\n case CodingContractRewardType.CompanyReputation: {\n const allJobs = Object.keys(Player.jobs);\n if (allJobs.length > 0) {\n reward.name = allJobs[getRandomInt(0, allJobs.length - 1)];\n } else {\n reward.type = CodingContractRewardType.Money;\n }\n break;\n }\n default:\n break;\n }\n\n return reward;\n}\n\nfunction getRandomServer(): Server | HacknetServer {\n const servers = Object.keys(AllServers);\n let randIndex = getRandomInt(0, servers.length - 1);\n let randServer = AllServers[servers[randIndex]];\n\n // An infinite loop shouldn't ever happen, but to be safe we'll use\n // a for loop with a limited number of tries\n for (let i = 0; i < 200; ++i) {\n if (\n randServer instanceof Server &&\n !randServer.purchasedByPlayer &&\n randServer.hostname !== SpecialServerNames.WorldDaemon\n ) {\n break;\n }\n randIndex = getRandomInt(0, servers.length - 1);\n randServer = AllServers[servers[randIndex]];\n }\n\n return randServer;\n}\n\nfunction getRandomFilename(server: Server | HacknetServer, reward: ICodingContractReward): string {\n let contractFn = `contract-${getRandomInt(0, 1e6)}`;\n\n for (let i = 0; i < 1000; ++i) {\n if (\n server.contracts.filter((c: CodingContract) => {\n return c.fn === contractFn;\n }).length <= 0\n ) {\n break;\n }\n contractFn = `contract-${getRandomInt(0, 1e6)}`;\n }\n\n if (reward.name) {\n contractFn += `-${reward.name.replace(/\\s/g, \"\")}`;\n }\n\n return contractFn;\n}\n","import { Factions } from \"./Faction/Factions\";\nimport { IPlayer } from \"./PersonObjects/IPlayer\";\n\nexport let LastExportBonus = 0;\n\nconst bonusTimer = 24 * 60 * 60 * 1000; // 24h\nexport function canGetBonus(): boolean {\n const now = new Date().getTime();\n if (now - LastExportBonus > bonusTimer) return true;\n return false;\n}\n\nexport function onExport(p: IPlayer): void {\n if (!canGetBonus()) return;\n for (const facName of p.factions) {\n Factions[facName].favor++;\n }\n LastExportBonus = new Date().getTime();\n}\n\nexport function setLastExportBonus(unixTime: number): void {\n LastExportBonus = unixTime;\n}\n","import { EventEmitter } from \"../../utils/EventEmitter\";\nexport const ITutorialEvents = new EventEmitter<[]>();\n","import { EmployeePositions } from \"./EmployeePositions\";\nimport { CorporationConstants } from \"./data/Constants\";\nimport { getRandomInt } from \"../../utils/helpers/getRandomInt\";\nimport { generateRandomString } from \"../../utils/StringHelperFunctions\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\nimport { Employee } from \"./Employee\";\nimport { IIndustry } from \"./IIndustry\";\nimport { ICorporation } from \"./ICorporation\";\n\ninterface IParams {\n loc?: string;\n size?: number;\n}\n\nexport class OfficeSpace {\n loc: string;\n size: number;\n minEne = 0;\n maxEne = 100;\n minHap = 0;\n maxHap = 100;\n maxMor = 100;\n employees: Employee[] = [];\n employeeProd: { [key: string]: number } = {\n [EmployeePositions.Operations]: 0,\n [EmployeePositions.Engineer]: 0,\n [EmployeePositions.Business]: 0,\n [EmployeePositions.Management]: 0,\n [EmployeePositions.RandD]: 0,\n total: 0,\n };\n\n constructor(params: IParams = {}) {\n this.loc = params.loc ? params.loc : \"\";\n this.size = params.size ? params.size : 1;\n }\n\n atCapacity(): boolean {\n return this.employees.length >= this.size;\n }\n\n process(marketCycles = 1, corporation: ICorporation, industry: IIndustry): number {\n // HRBuddy AutoRecruitment and training\n if (industry.hasResearch(\"HRBuddy-Recruitment\") && !this.atCapacity()) {\n const emp = this.hireRandomEmployee();\n if (industry.hasResearch(\"HRBuddy-Training\") && emp !== undefined) {\n emp.pos = EmployeePositions.Training;\n }\n }\n\n // Process Office properties\n this.maxEne = 100;\n this.maxHap = 100;\n this.maxMor = 100;\n if (industry.hasResearch(\"Go-Juice\")) {\n this.maxEne += 10;\n }\n if (industry.hasResearch(\"JoyWire\")) {\n this.maxHap += 10;\n }\n if (industry.hasResearch(\"Sti.mu\")) {\n this.maxMor += 10;\n }\n\n // Calculate changes in Morale/Happiness/Energy for Employees\n let perfMult = 1; //Multiplier for employee morale/happiness/energy based on company performance\n if (corporation.funds < 0 && industry.lastCycleRevenue < 0) {\n perfMult = Math.pow(0.99, marketCycles);\n } else if (corporation.funds > 0 && industry.lastCycleRevenue > 0) {\n perfMult = Math.pow(1.01, marketCycles);\n }\n\n const hasAutobrew = industry.hasResearch(\"AutoBrew\");\n const hasAutoparty = industry.hasResearch(\"AutoPartyManager\");\n\n let salaryPaid = 0;\n for (let i = 0; i < this.employees.length; ++i) {\n const emp = this.employees[i];\n if (hasAutoparty) {\n emp.mor = this.maxMor;\n emp.hap = this.maxHap;\n } else {\n emp.mor *= perfMult;\n emp.hap *= perfMult;\n emp.mor = Math.min(emp.mor, this.maxMor);\n emp.hap = Math.min(emp.hap, this.maxHap);\n }\n\n if (hasAutobrew) {\n emp.ene = this.maxEne;\n } else {\n emp.ene *= perfMult;\n emp.ene = Math.min(emp.ene, this.maxEne);\n }\n\n const salary = emp.process(marketCycles, this);\n salaryPaid += salary;\n }\n\n this.calculateEmployeeProductivity(corporation, industry);\n return salaryPaid;\n }\n\n calculateEmployeeProductivity(corporation: ICorporation, industry: IIndustry): void {\n //Reset\n for (const name in this.employeeProd) {\n this.employeeProd[name] = 0;\n }\n\n let total = 0;\n for (let i = 0; i < this.employees.length; ++i) {\n const employee = this.employees[i];\n const prod = employee.calculateProductivity(corporation, industry);\n this.employeeProd[employee.pos] += prod;\n total += prod;\n }\n this.employeeProd.total = total;\n }\n\n hireRandomEmployee(): Employee | undefined {\n if (this.atCapacity()) return;\n if (document.getElementById(\"cmpy-mgmt-hire-employee-popup\") != null) return;\n\n //Generate three random employees (meh, decent, amazing)\n const mult = getRandomInt(76, 100) / 100;\n const int = getRandomInt(50, 100),\n cha = getRandomInt(50, 100),\n exp = getRandomInt(50, 100),\n cre = getRandomInt(50, 100),\n eff = getRandomInt(50, 100),\n sal = CorporationConstants.EmployeeSalaryMultiplier * (int + cha + exp + cre + eff);\n\n const emp = new Employee({\n intelligence: int * mult,\n charisma: cha * mult,\n experience: exp * mult,\n creativity: cre * mult,\n efficiency: eff * mult,\n salary: sal * mult,\n });\n\n const name = generateRandomString(7);\n\n for (let i = 0; i < this.employees.length; ++i) {\n if (this.employees[i].name === name) {\n return this.hireRandomEmployee();\n }\n }\n emp.name = name;\n this.employees.push(emp);\n\n return emp;\n }\n\n //Finds the first unassigned employee and assigns its to the specified job\n assignEmployeeToJob(job: string): boolean {\n for (let i = 0; i < this.employees.length; ++i) {\n if (this.employees[i].pos === EmployeePositions.Unassigned) {\n this.employees[i].pos = job;\n return true;\n }\n }\n return false;\n }\n\n //Finds the first employee with the given job and unassigns it\n unassignEmployeeFromJob(job: string): boolean {\n for (let i = 0; i < this.employees.length; ++i) {\n if (this.employees[i].pos === job) {\n this.employees[i].pos = EmployeePositions.Unassigned;\n return true;\n }\n }\n return false;\n }\n\n copy(): OfficeSpace {\n const office = new OfficeSpace();\n office.loc = this.loc;\n office.size = this.size;\n office.minEne = this.minEne;\n office.maxEne = this.maxEne;\n office.minHap = this.minHap;\n office.maxHap = this.maxHap;\n office.maxMor = this.maxMor;\n office.employeeProd = {\n [EmployeePositions.Operations]: this.employeeProd[EmployeePositions.Operations],\n [EmployeePositions.Engineer]: this.employeeProd[EmployeePositions.Engineer],\n [EmployeePositions.Business]: this.employeeProd[EmployeePositions.Business],\n [EmployeePositions.Management]: this.employeeProd[EmployeePositions.Management],\n [EmployeePositions.RandD]: this.employeeProd[EmployeePositions.RandD],\n total: this.employeeProd[\"total\"],\n };\n office.employees = [];\n for (const employee of this.employees) {\n office.employees.push(employee.copy());\n }\n return office;\n }\n\n toJSON(): any {\n return Generic_toJSON(\"OfficeSpace\", this);\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): OfficeSpace {\n return Generic_fromJSON(OfficeSpace, value.data);\n }\n}\n\nReviver.constructors.OfficeSpace = OfficeSpace;\n","import { IMap } from \"../types\";\n\nexport type IndustryUpgrade = [number, number, number, number, string, string];\n\n// Industry upgrades\n// The data structure is an array with the following format:\n// [index in array, base price, price mult, benefit mult (if applicable), name, desc]\nexport const IndustryUpgrades: IMap = {\n \"0\": [0, 500e3, 1, 1.05, \"Coffee\", \"Provide your employees with coffee, increasing their energy by 5%.\"],\n \"1\": [\n 1,\n 1e9,\n 1.06,\n 1.03,\n \"AdVert.Inc\",\n \"Hire AdVert.Inc to advertise your company. Each level of \" +\n \"this upgrade grants your company a static increase of 3 and 1 to its awareness and \" +\n \"popularity, respectively. It will then increase your company's awareness by 1%, and its popularity \" +\n \"by a random percentage between 1% and 3%. These effects are increased by other upgrades \" +\n \"that increase the power of your advertising.\",\n ],\n};\n","/**\n * This is a central class for storing and managing the player's hashes,\n * which are generated by Hacknet Servers\n *\n * It is also used to keep track of what upgrades the player has bought with\n * his hashes, and contains method for grabbing the data/multipliers from\n * those upgrades\n */\nimport { HashUpgrades } from \"./HashUpgrades\";\nimport { HashUpgrade } from \"./HashUpgrade\";\n\nimport { IMap } from \"../types\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\nexport class HashManager {\n // Max number of hashes this can hold. Equal to the sum of capacities of\n // all Hacknet Servers\n capacity = 0;\n\n // Number of hashes currently in storage\n hashes = 0;\n\n // Map of Hash Upgrade Name -> levels in that upgrade\n upgrades: IMap = {};\n\n constructor() {\n for (const name in HashUpgrades) {\n this.upgrades[name] = 0;\n }\n }\n\n /**\n * Generic helper function for getting a multiplier from a HashUpgrade\n */\n getMult(upgName: string): number {\n const upg = HashUpgrades[upgName];\n const currLevel = this.upgrades[upgName];\n if (upg == null || currLevel == null) {\n console.error(`Could not find Hash Study upgrade`);\n return 1;\n }\n\n return 1 + (upg.value * currLevel) / 100;\n }\n\n /**\n * One of the Hash upgrades improves studying. This returns that multiplier\n */\n getStudyMult(): number {\n const upgName = \"Improve Studying\";\n\n return this.getMult(upgName);\n }\n\n /**\n * One of the Hash upgrades improves gym training. This returns that multiplier\n */\n getTrainingMult(): number {\n const upgName = \"Improve Gym Training\";\n\n return this.getMult(upgName);\n }\n\n getUpgrade(upgName: string): HashUpgrade | null {\n const upg = HashUpgrades[upgName];\n if (!upg) {\n console.error(`Invalid Upgrade Name given to HashManager.getUpgrade(): ${upgName}`);\n return null;\n }\n return upg;\n }\n\n /**\n * Get the cost (in hashes) of an upgrade\n */\n getUpgradeCost(upgName: string): number {\n const upg = this.getUpgrade(upgName);\n const currLevel = this.upgrades[upgName];\n if (upg == null || currLevel == null) {\n console.error(`Invalid Upgrade Name given to HashManager.getUpgradeCost(): ${upgName}`);\n return Infinity;\n }\n\n return upg.getCost(currLevel);\n }\n\n prestige(): void {\n for (const name in HashUpgrades) {\n this.upgrades[name] = 0;\n }\n this.hashes = 0;\n\n // When prestiging, player's hacknet nodes are always reset. So capacity = 0\n this.updateCapacity(0);\n }\n\n /**\n * Reverts an upgrade and refunds the hashes used to buy it\n */\n refundUpgrade(upgName: string): void {\n const upg = HashUpgrades[upgName];\n\n // Reduce the level first, so we get the right cost\n --this.upgrades[upgName];\n\n const currLevel = this.upgrades[upgName];\n if (upg == null || currLevel == null || currLevel < 0) {\n console.error(`Invalid Upgrade Name given to HashManager.upgrade(): ${upgName}`);\n return;\n }\n\n const cost = upg.getCost(currLevel);\n this.hashes += cost;\n }\n\n storeHashes(numHashes: number): void {\n this.hashes += numHashes;\n this.hashes = Math.min(this.hashes, this.capacity);\n }\n\n updateCapacity(newCap: number): void {\n if (newCap < 0) {\n this.capacity = 0;\n }\n this.capacity = Math.max(newCap, 0);\n }\n\n /**\n * Returns boolean indicating whether or not the upgrade was successfully purchased\n * Note that this does NOT actually implement the effect\n */\n upgrade(upgName: string): boolean {\n const upg = HashUpgrades[upgName];\n if (upg == null) {\n console.error(`Invalid Upgrade Name given to HashManager.upgrade(): ${upgName}`);\n return false;\n }\n\n const cost = this.getUpgradeCost(upgName);\n\n if (this.hashes < cost) {\n return false;\n }\n\n this.hashes -= cost;\n ++this.upgrades[upgName];\n\n return true;\n }\n\n //Serialize the current object to a JSON save state.\n toJSON(): any {\n return Generic_toJSON(\"HashManager\", this);\n }\n\n // Initiatizes a HashManager object from a JSON save state.\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): HashManager {\n return Generic_fromJSON(HashManager, value.data);\n }\n}\n\nReviver.constructors.HashManager = HashManager;\n","import * as React from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\n\nexport function Favor(favor: number | string): JSX.Element {\n return (\n \n {typeof favor === \"number\" ? numeralWrapper.formatFavor(favor) : favor}\n \n );\n}\n","import React from \"react\";\nimport { createTheme, ThemeProvider, Theme, StyledEngineProvider } from \"@mui/material/styles\";\nimport { EventEmitter } from \"../../utils/EventEmitter\";\nimport { Settings } from \"../../Settings/Settings\";\n\nexport const ThemeEvents = new EventEmitter<[]>();\n\ndeclare module \"@mui/material/styles\" {\n interface Theme {\n colors: {\n hp: React.CSSProperties[\"color\"];\n money: React.CSSProperties[\"color\"];\n hack: React.CSSProperties[\"color\"];\n combat: React.CSSProperties[\"color\"];\n cha: React.CSSProperties[\"color\"];\n int: React.CSSProperties[\"color\"];\n rep: React.CSSProperties[\"color\"];\n };\n }\n interface ThemeOptions {\n colors: {\n hp: React.CSSProperties[\"color\"];\n money: React.CSSProperties[\"color\"];\n hack: React.CSSProperties[\"color\"];\n combat: React.CSSProperties[\"color\"];\n cha: React.CSSProperties[\"color\"];\n int: React.CSSProperties[\"color\"];\n rep: React.CSSProperties[\"color\"];\n };\n }\n}\n\nlet theme: Theme;\n\nexport function refreshTheme() {\n theme = createTheme({\n colors: {\n hp: Settings.theme.hp,\n money: Settings.theme.money,\n hack: Settings.theme.hack,\n combat: Settings.theme.combat,\n cha: Settings.theme.cha,\n int: Settings.theme.int,\n rep: Settings.theme.rep,\n },\n palette: {\n primary: {\n light: Settings.theme.primarylight,\n main: Settings.theme.primary,\n dark: Settings.theme.primarydark,\n },\n secondary: {\n light: Settings.theme.secondarylight,\n main: Settings.theme.secondary,\n dark: Settings.theme.secondarydark,\n },\n error: {\n light: Settings.theme.errorlight,\n main: Settings.theme.error,\n dark: Settings.theme.errordark,\n },\n info: {\n light: Settings.theme.infolight,\n main: Settings.theme.info,\n dark: Settings.theme.infodark,\n },\n warning: {\n light: Settings.theme.warninglight,\n main: Settings.theme.warning,\n dark: Settings.theme.warningdark,\n },\n background: {\n default: Settings.theme.black,\n paper: Settings.theme.well,\n },\n },\n typography: {\n fontFamily: \"monospace\",\n button: {\n textTransform: \"none\",\n },\n },\n components: {\n MuiInputBase: {\n styleOverrides: {\n root: {\n backgroundColor: Settings.theme.well,\n color: Settings.theme.primary,\n },\n input: {\n \"&::placeholder\": {\n userSelect: \"none\",\n color: Settings.theme.primarydark,\n },\n },\n },\n },\n\n MuiInput: {\n styleOverrides: {\n root: {\n backgroundColor: Settings.theme.well,\n borderBottomColor: \"#fff\",\n },\n underline: {\n \"&:hover\": {\n borderBottomColor: Settings.theme.primarydark,\n },\n \"&:before\": {\n borderBottomColor: Settings.theme.primary,\n },\n \"&:after\": {\n borderBottomColor: Settings.theme.primarylight,\n },\n },\n },\n },\n\n MuiInputLabel: {\n styleOverrides: {\n root: {\n color: Settings.theme.primarydark, // why is this switched?\n userSelect: \"none\",\n \"&:before\": {\n color: Settings.theme.primarylight,\n },\n },\n },\n },\n MuiButton: {\n styleOverrides: {\n root: {\n backgroundColor: \"#333\",\n border: \"1px solid \" + Settings.theme.well,\n // color: Settings.theme.primary,\n \"&:hover\": {\n backgroundColor: Settings.theme.black,\n },\n\n borderRadius: 0,\n },\n },\n },\n MuiSelect: {\n styleOverrides: {\n icon: {\n color: Settings.theme.primary,\n },\n },\n },\n MuiMenu: {\n styleOverrides: {\n list: {\n backgroundColor: Settings.theme.well,\n },\n },\n },\n MuiMenuItem: {\n styleOverrides: {\n root: {\n color: Settings.theme.primary,\n },\n },\n },\n MuiAccordionSummary: {\n styleOverrides: {\n root: {\n backgroundColor: \"#111\",\n },\n },\n },\n MuiAccordionDetails: {\n styleOverrides: {\n root: {\n backgroundColor: Settings.theme.black,\n },\n },\n },\n MuiIconButton: {\n styleOverrides: {\n root: {\n color: Settings.theme.primary,\n },\n },\n },\n MuiTooltip: {\n styleOverrides: {\n tooltip: {\n fontSize: \"1em\",\n color: Settings.theme.primary,\n backgroundColor: Settings.theme.well,\n borderRadius: 0,\n border: \"2px solid white\",\n maxWidth: \"100vh\",\n },\n },\n },\n MuiSlider: {\n styleOverrides: {\n valueLabel: {\n color: Settings.theme.primary,\n backgroundColor: Settings.theme.well,\n },\n },\n },\n MuiDrawer: {\n styleOverrides: {\n paper: {\n \"&::-webkit-scrollbar\": {\n // webkit\n display: \"none\",\n },\n scrollbarWidth: \"none\", // firefox\n backgroundColor: Settings.theme.black,\n },\n paperAnchorDockedLeft: {\n borderRight: \"1px solid \" + Settings.theme.welllight,\n },\n },\n },\n MuiDivider: {\n styleOverrides: {\n root: {\n backgroundColor: Settings.theme.welllight,\n },\n },\n },\n MuiFormControlLabel: {\n styleOverrides: {\n root: {\n color: Settings.theme.primary,\n },\n },\n },\n MuiSwitch: {\n styleOverrides: {\n switchBase: {\n color: Settings.theme.primarydark,\n },\n track: {\n backgroundColor: Settings.theme.welllight,\n },\n },\n },\n MuiPaper: {\n styleOverrides: {\n root: {\n borderRadius: 0,\n backgroundColor: Settings.theme.black,\n border: \"1px solid \" + Settings.theme.welllight,\n },\n },\n },\n MuiTablePagination: {\n styleOverrides: {\n select: {\n color: Settings.theme.primary,\n },\n },\n },\n },\n });\n}\nrefreshTheme();\n\ninterface IProps {\n children: JSX.Element[] | JSX.Element;\n}\n\nexport const TTheme = ({ children }: IProps): React.ReactElement => (\n \n {children}\n \n);\n","/**\n * This is an object that is used to keep track of where all of the player's\n * money is coming from (or going to)\n */\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\nexport class MoneySourceTracker {\n // eslint-disable-next-line @typescript-eslint/ban-types\n [key: string]: number | Function;\n\n bladeburner = 0;\n casino = 0;\n class = 0;\n codingcontract = 0;\n corporation = 0;\n crime = 0;\n gang = 0;\n hacking = 0;\n hacknetnode = 0;\n hospitalization = 0;\n infiltration = 0;\n sleeves = 0;\n stock = 0;\n total = 0;\n work = 0;\n\n // Record money earned\n record(amt: number, source: string): void {\n const sanitizedSource = source.toLowerCase();\n if (typeof this[sanitizedSource] !== \"number\") {\n console.warn(`MoneySourceTracker.record() called with invalid source: ${source}`);\n return;\n }\n\n (this[sanitizedSource] as number) += amt;\n this.total += amt;\n }\n\n // Reset the money tracker by setting all stats to 0\n reset(): void {\n for (const prop in this) {\n if (typeof this[prop] === \"number\") {\n (this[prop] as number) = 0;\n }\n }\n }\n\n // Serialize the current object to a JSON save state.\n toJSON(): any {\n return Generic_toJSON(\"MoneySourceTracker\", this);\n }\n\n // Initiatizes a MoneySourceTracker object from a JSON save state.\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): MoneySourceTracker {\n return Generic_fromJSON(MoneySourceTracker, value.data);\n }\n}\n\nReviver.constructors.MoneySourceTracker = MoneySourceTracker;\n","/**\n * React component for a selectable option on the Faction UI. These\n * options including working for the faction, hacking missions, purchasing\n * augmentations, etc.\n */\nimport * as React from \"react\";\n\nimport { StdButton } from \"../../ui/React/StdButton\";\n\nimport Typography from \"@mui/material/Typography\";\nimport Button from \"@mui/material/Button\";\nimport Paper from \"@mui/material/Paper\";\nimport Box from \"@mui/material/Box\";\n\ntype IProps = {\n buttonText: string;\n infoText: string;\n onClick: (e: React.MouseEvent) => void;\n};\n\nexport function Option(props: IProps): React.ReactElement {\n return (\n \n \n \n {props.infoText}\n \n \n );\n}\n","/**\n * Returns a MM/DD HH:MM timestamp for the current time\n */\nexport function getTimestamp(): string {\n const d: Date = new Date();\n // A negative slice value takes from the end of the string rather than the beginning.\n const stringWidth = -2;\n const formattedHours: string = `0${d.getHours()}`.slice(stringWidth);\n const formattedMinutes: string = `0${d.getMinutes()}`.slice(stringWidth);\n\n return `${d.getMonth() + 1}/${d.getDate()} ${formattedHours}:${formattedMinutes}`;\n}\n","/**\n * Rounds a number to two decimal places.\n * @param decimal A decimal value to trim to two places.\n */\nexport function roundToTwo(decimal: number): number {\n const leftShift: number = Math.round(parseFloat(`${decimal}e+2`));\n\n return +`${leftShift}e-2`;\n}\n","export function calculateIntelligenceBonus(intelligence: number, weight = 1): number {\n return 1 + (weight * Math.pow(intelligence, 0.8)) / 600;\n}\n","import { CONSTANTS } from \"../Constants\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\n\nexport function getHospitalizationCost(p: IPlayer): number {\n let money;\n if (typeof p.money === \"number\") {\n money = p.money;\n } else {\n money = p.money.toNumber();\n }\n\n if (money < 0) {\n return 0;\n }\n\n return Math.min(money * 0.1, (p.max_hp - p.hp) * CONSTANTS.HospitalCostPerHp);\n}\n\nexport function calculateHospitalizationCost(p: IPlayer, damage: number): number {\n const oldhp = p.hp;\n p.hp -= damage;\n const cost = getHospitalizationCost(p);\n p.hp = oldhp;\n return cost;\n}\n","import { Engine } from \"./engine\";\nimport { createStatusText } from \"./ui/createStatusText\";\n\nfunction getDB(): Promise {\n return new Promise((resolve, reject) => {\n if (!window.indexedDB) {\n reject(\"Indexed DB does not exists\");\n }\n /**\n * DB is called bitburnerSave\n * Object store is called savestring\n * key for the Object store is called save\n * Version `1` is important\n */\n const indexedDbRequest: IDBOpenDBRequest = window.indexedDB.open(\"bitburnerSave\", 1);\n\n // This is called when there's no db to begin with. It's important, don't remove it.\n indexedDbRequest.onupgradeneeded = function (this: IDBRequest) {\n const db = this.result;\n db.createObjectStore(\"savestring\");\n };\n\n indexedDbRequest.onerror = function (this: IDBRequest, ev: Event) {\n reject(`Failed to get IDB ${ev}`);\n };\n\n indexedDbRequest.onsuccess = function (this: IDBRequest, ev: Event) {\n const db = this.result;\n if (!db) {\n reject(\"database loadign result was undefined\");\n return;\n }\n resolve(db.transaction([\"savestring\"], \"readwrite\").objectStore(\"savestring\"));\n };\n });\n}\n\ninterface ILoadCallback {\n success: (s: string) => void;\n error?: () => void;\n}\n\nexport function load(): Promise {\n return new Promise(async (resolve, reject) => {\n await getDB()\n .then((db) => {\n return new Promise((resolve, reject) => {\n const request: IDBRequest = db.get(\"save\");\n request.onerror = function (this: IDBRequest, ev: Event) {\n reject(\"Error in Database request to get savestring: \" + ev);\n };\n\n request.onsuccess = function (this: IDBRequest) {\n resolve(this.result);\n };\n }).then((saveString) => resolve(saveString));\n })\n .catch((r) => reject(r));\n });\n}\n\ninterface ISaveCallback {\n success: () => void;\n error?: () => void;\n}\n\nexport function save(saveString: string): Promise {\n return getDB().then((db) => {\n return new Promise((resolve, reject) => {\n // We'll save to both localstorage and indexedDb\n const request = db.put(saveString, \"save\");\n\n request.onerror = function (e) {\n reject(\"Error saving game to IndexedDB: \" + e);\n };\n\n request.onsuccess = () => resolve();\n });\n });\n}\n\nexport function deleteGame(): Promise {\n return getDB().then((db) => {\n db.delete(\"save\");\n });\n}\n","import { EmployeePositions } from \"./EmployeePositions\";\nimport { MaterialSizes } from \"./MaterialSizes\";\nimport { IIndustry } from \"./IIndustry\";\nimport { ProductRatingWeights, IProductRatingWeight } from \"./ProductRatingWeights\";\n\nimport { createCityMap } from \"../Locations/createCityMap\";\nimport { IMap } from \"../types\";\n\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\nimport { getRandomInt } from \"../../utils/helpers/getRandomInt\";\n\ninterface IConstructorParams {\n name?: string;\n demand?: number;\n competition?: number;\n markup?: number;\n createCity?: string;\n designCost?: number;\n advCost?: number;\n quality?: number;\n performance?: number;\n durability?: number;\n reliability?: number;\n aesthetics?: number;\n features?: number;\n loc?: string;\n size?: number;\n req?: IMap;\n}\n\nexport class Product {\n // Product name\n name = \"\";\n\n // The demand for this Product in the market. Gradually decreases\n dmd = 0;\n\n // How much competition there is in the market for this Product\n cmp = 0;\n\n // Markup. Affects how high of a price you can charge for this Product\n // without suffering a loss in the # of sales\n mku = 0;\n\n // Production cost - estimation of how much money it costs to make this Product\n pCost = 0;\n\n // Sell cost\n sCost: string | number = 0;\n\n // Variables for handling the creation process of this Product\n fin = false; // Whether this Product has finished being created\n prog = 0; // Creation progress - A number betwee 0-100 representing percentage\n createCity = \"\"; // City in which the product is/was being created\n designCost = 0; // How much money was invested into designing this Product\n advCost = 0; // How much money was invested into advertising this Product\n\n // Aggregate score for this Product's 'rating'\n // This is based on the stats/properties below. The weighting of the\n // stats/properties below differs between different industries\n rat = 0;\n\n // Stats/properties of this Product\n qlt = 0;\n per = 0;\n dur = 0;\n rel = 0;\n aes = 0;\n fea = 0;\n\n // Data refers to the production, sale, and quantity of the products\n // These values are specific to a city\n // For each city, the data is [qty, prod, sell]\n data: IMap = createCityMap([0, 0, 0]);\n\n // Location of this Product\n // Only applies for location-based products like restaurants/hospitals\n loc = \"\";\n\n // How much space 1 unit of the Product takes (in the warehouse)\n // Not applicable for all Products\n siz = 0;\n\n // Material requirements. An object that maps the name of a material to how much it requires\n // to make 1 unit of the product.\n reqMats: IMap = {};\n\n // Data to keep track of whether production/sale of this Product is\n // manually limited. These values are specific to a city\n // [Whether production/sale is limited, limit amount]\n prdman: IMap = createCityMap([false, 0]);\n sllman: IMap = createCityMap([false, 0]);\n\n // Flags that signal whether automatic sale pricing through Market TA is enabled\n marketTa1 = false;\n marketTa2 = false;\n marketTa2Price: IMap = createCityMap(0);\n\n constructor(params: IConstructorParams = {}) {\n this.name = params.name ? params.name : \"\";\n this.dmd = params.demand ? params.demand : 0;\n this.cmp = params.competition ? params.competition : 0;\n this.mku = params.markup ? params.markup : 0;\n this.createCity = params.createCity ? params.createCity : \"\";\n this.designCost = params.designCost ? params.designCost : 0;\n this.advCost = params.advCost ? params.advCost : 0;\n this.qlt = params.quality ? params.quality : 0;\n this.per = params.performance ? params.performance : 0;\n this.dur = params.durability ? params.durability : 0;\n this.rel = params.reliability ? params.reliability : 0;\n this.aes = params.aesthetics ? params.aesthetics : 0;\n this.fea = params.features ? params.features : 0;\n this.loc = params.loc ? params.loc : \"\";\n this.siz = params.size ? params.size : 0;\n this.reqMats = params.req ? params.req : {};\n }\n\n // empWorkMult is a multiplier that increases progress rate based on\n // productivity of employees\n createProduct(marketCycles = 1, empWorkMult = 1): void {\n if (this.fin) {\n return;\n }\n this.prog += marketCycles * 0.01 * empWorkMult;\n }\n\n // @param industry - Industry object. Reference to industry that makes this Product\n finishProduct(employeeProd: { [key: string]: number }, industry: IIndustry): void {\n this.fin = true;\n\n //Calculate properties\n const progrMult = this.prog / 100;\n\n const engrRatio = employeeProd[EmployeePositions.Engineer] / employeeProd[\"total\"];\n const mgmtRatio = employeeProd[EmployeePositions.Management] / employeeProd[\"total\"];\n const rndRatio = employeeProd[EmployeePositions.RandD] / employeeProd[\"total\"];\n const opsRatio = employeeProd[EmployeePositions.Operations] / employeeProd[\"total\"];\n const busRatio = employeeProd[EmployeePositions.Business] / employeeProd[\"total\"];\n const designMult = 1 + Math.pow(this.designCost, 0.1) / 100;\n const balanceMult = 1.2 * engrRatio + 0.9 * mgmtRatio + 1.3 * rndRatio + 1.5 * opsRatio + busRatio;\n const sciMult = 1 + Math.pow(industry.sciResearch.qty, industry.sciFac) / 800;\n const totalMult = progrMult * balanceMult * designMult * sciMult;\n\n this.qlt =\n totalMult *\n (0.1 * employeeProd[EmployeePositions.Engineer] +\n 0.05 * employeeProd[EmployeePositions.Management] +\n 0.05 * employeeProd[EmployeePositions.RandD] +\n 0.02 * employeeProd[EmployeePositions.Operations] +\n 0.02 * employeeProd[EmployeePositions.Business]);\n this.per =\n totalMult *\n (0.15 * employeeProd[EmployeePositions.Engineer] +\n 0.02 * employeeProd[EmployeePositions.Management] +\n 0.02 * employeeProd[EmployeePositions.RandD] +\n 0.02 * employeeProd[EmployeePositions.Operations] +\n 0.02 * employeeProd[EmployeePositions.Business]);\n this.dur =\n totalMult *\n (0.05 * employeeProd[EmployeePositions.Engineer] +\n 0.02 * employeeProd[EmployeePositions.Management] +\n 0.08 * employeeProd[EmployeePositions.RandD] +\n 0.05 * employeeProd[EmployeePositions.Operations] +\n 0.05 * employeeProd[EmployeePositions.Business]);\n this.rel =\n totalMult *\n (0.02 * employeeProd[EmployeePositions.Engineer] +\n 0.08 * employeeProd[EmployeePositions.Management] +\n 0.02 * employeeProd[EmployeePositions.RandD] +\n 0.05 * employeeProd[EmployeePositions.Operations] +\n 0.08 * employeeProd[EmployeePositions.Business]);\n this.aes =\n totalMult *\n (0.0 * employeeProd[EmployeePositions.Engineer] +\n 0.08 * employeeProd[EmployeePositions.Management] +\n 0.05 * employeeProd[EmployeePositions.RandD] +\n 0.02 * employeeProd[EmployeePositions.Operations] +\n 0.1 * employeeProd[EmployeePositions.Business]);\n this.fea =\n totalMult *\n (0.08 * employeeProd[EmployeePositions.Engineer] +\n 0.05 * employeeProd[EmployeePositions.Management] +\n 0.02 * employeeProd[EmployeePositions.RandD] +\n 0.05 * employeeProd[EmployeePositions.Operations] +\n 0.05 * employeeProd[EmployeePositions.Business]);\n this.calculateRating(industry);\n const advMult = 1 + Math.pow(this.advCost, 0.1) / 100;\n this.mku = 100 / (advMult * Math.pow(this.qlt + 0.001, 0.65) * (busRatio + mgmtRatio));\n\n // I actually don't understand well enough to know if this is right.\n // I'm adding this to prevent a crash.\n if (this.mku === 0) this.mku = 1;\n\n this.dmd =\n industry.awareness === 0 ? 20 : Math.min(100, advMult * (100 * (industry.popularity / industry.awareness)));\n this.cmp = getRandomInt(0, 70);\n\n //Calculate the product's required materials\n //For now, just set it to be the same as the requirements to make materials\n for (const matName in industry.reqMats) {\n if (industry.reqMats.hasOwnProperty(matName)) {\n const reqMat = industry.reqMats[matName];\n if (reqMat === undefined) continue;\n this.reqMats[matName] = reqMat;\n }\n }\n\n //Calculate the product's size\n //For now, just set it to be the same size as the requirements to make materials\n this.siz = 0;\n for (const matName in industry.reqMats) {\n const reqMat = industry.reqMats[matName];\n if (reqMat === undefined) continue;\n this.siz += MaterialSizes[matName] * reqMat;\n }\n }\n\n calculateRating(industry: IIndustry): void {\n const weights: IProductRatingWeight = ProductRatingWeights[industry.type];\n if (weights == null) {\n console.error(`Could not find product rating weights for: ${industry}`);\n return;\n }\n this.rat = 0;\n this.rat += weights.Quality ? this.qlt * weights.Quality : 0;\n this.rat += weights.Performance ? this.per * weights.Performance : 0;\n this.rat += weights.Durability ? this.dur * weights.Durability : 0;\n this.rat += weights.Reliability ? this.rel * weights.Reliability : 0;\n this.rat += weights.Aesthetics ? this.aes * weights.Aesthetics : 0;\n this.rat += weights.Features ? this.fea * weights.Features : 0;\n }\n\n // Serialize the current object to a JSON save state.\n toJSON(): any {\n return Generic_toJSON(\"Product\", this);\n }\n\n // Initiatizes a Product object from a JSON save state.\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Product {\n return Generic_fromJSON(Product, value.data);\n }\n}\n\nReviver.constructors.Product = Product;\n","import { BladeburnerConstants } from \"./data/Constants\";\nimport { getRandomInt } from \"../../utils/helpers/getRandomInt\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\nimport { addOffset } from \"../../utils/helpers/addOffset\";\n\ninterface IChangePopulationByCountParams {\n estChange: number;\n estOffset: number;\n}\n\ninterface IChangePopulationByPercentageParams {\n nonZero: boolean;\n changeEstEqually: boolean;\n}\n\nexport class City {\n /**\n * Name of the city.\n */\n name = \"\";\n\n /**\n * Population of the city.\n */\n pop = 0;\n\n /**\n * Population estimation of the city.\n */\n popEst = 0;\n\n /**\n * Number of communities in the city.\n */\n comms = 0;\n\n /**\n * Estimated number of communities in the city.\n */\n commsEst = 0;\n\n /**\n * Chaos level of the city.\n */\n chaos = 0;\n\n constructor(name: string = BladeburnerConstants.CityNames[2]) {\n this.name = name;\n\n // Synthoid population and estimate\n this.pop = getRandomInt(BladeburnerConstants.PopulationThreshold, 1.5 * BladeburnerConstants.PopulationThreshold);\n this.popEst = this.pop * (Math.random() + 0.5);\n\n // Number of Synthoid communities population and estimate\n this.comms = getRandomInt(5, 150);\n this.commsEst = this.comms + getRandomInt(-5, 5);\n if (this.commsEst < 0) this.commsEst = 0;\n this.chaos = 0;\n }\n\n /**\n * p is the percentage, not the multiplier (e.g. pass in p = 5 for 5%)\n */\n changeChaosByPercentage(p: number): void {\n if (isNaN(p)) {\n throw new Error(\"NaN passed into City.chaosChaosByPercentage()\");\n }\n if (p === 0) {\n return;\n }\n this.chaos += this.chaos * (p / 100);\n if (this.chaos < 0) {\n this.chaos = 0;\n }\n }\n\n improvePopulationEstimateByCount(n: number): void {\n if (isNaN(n)) {\n throw new Error(\"NaN passeed into City.improvePopulationEstimateByCount()\");\n }\n if (this.popEst < this.pop) {\n this.popEst += n;\n if (this.popEst > this.pop) {\n this.popEst = this.pop;\n }\n } else if (this.popEst > this.pop) {\n this.popEst -= n;\n if (this.popEst < this.pop) {\n this.popEst = this.pop;\n }\n }\n }\n\n /**\n * p is the percentage, not the multiplier (e.g. pass in p = 5 for 5%)\n */\n improvePopulationEstimateByPercentage(p: number, skillMult = 1): void {\n p = p * skillMult;\n if (isNaN(p)) {\n throw new Error(\"NaN passed into City.improvePopulationEstimateByPercentage()\");\n }\n if (this.popEst < this.pop) {\n ++this.popEst; // In case estimate is 0\n this.popEst *= 1 + p / 100;\n if (this.popEst > this.pop) {\n this.popEst = this.pop;\n }\n } else if (this.popEst > this.pop) {\n this.popEst *= 1 - p / 100;\n if (this.popEst < this.pop) {\n this.popEst = this.pop;\n }\n }\n }\n\n improveCommunityEstimate(n = 1): void {\n if (isNaN(n)) {\n throw new Error(\"NaN passed into City.improveCommunityEstimate()\");\n }\n if (this.commsEst < this.comms) {\n this.commsEst += n;\n if (this.commsEst > this.comms) {\n this.commsEst = this.comms;\n }\n } else if (this.commsEst > this.comms) {\n this.commsEst -= n;\n if (this.commsEst < this.comms) {\n this.commsEst = this.comms;\n }\n }\n }\n\n /**\n * @params options:\n * estChange(int): How much the estimate should change by\n * estOffset(int): Add offset to estimate (offset by percentage)\n */\n changePopulationByCount(n: number, params: IChangePopulationByCountParams = { estChange: 0, estOffset: 0 }): void {\n if (isNaN(n)) {\n throw new Error(\"NaN passed into City.changePopulationByCount()\");\n }\n this.pop += n;\n if (params.estChange && !isNaN(params.estChange)) {\n this.popEst += params.estChange;\n }\n if (params.estOffset) {\n this.popEst = addOffset(this.popEst, params.estOffset);\n }\n this.popEst = Math.max(this.popEst, 0);\n }\n\n /**\n * @p is the percentage, not the multiplier. e.g. pass in p = 5 for 5%\n * @params options:\n * changeEstEqually(bool) - Change the population estimate by an equal amount\n * nonZero (bool) - Set to true to ensure that population always changes by at least 1\n */\n changePopulationByPercentage(\n p: number,\n params: IChangePopulationByPercentageParams = {\n nonZero: false,\n changeEstEqually: false,\n },\n ): number {\n if (isNaN(p)) {\n throw new Error(\"NaN passed into City.changePopulationByPercentage()\");\n }\n if (p === 0) {\n return 0;\n }\n let change = Math.round(this.pop * (p / 100));\n\n // Population always changes by at least 1\n if (params.nonZero && change === 0) {\n p > 0 ? (change = 1) : (change = -1);\n }\n\n this.pop += change;\n if (params.changeEstEqually) {\n this.popEst += change;\n if (this.popEst < 0) {\n this.popEst = 0;\n }\n }\n return change;\n }\n\n changeChaosByCount(n: number): void {\n if (isNaN(n)) {\n throw new Error(\"NaN passed into City.changeChaosByCount()\");\n }\n if (n === 0) {\n return;\n }\n this.chaos += n;\n if (this.chaos < 0) {\n this.chaos = 0;\n }\n }\n\n /**\n * Serialize the current object to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"City\", this);\n }\n\n /**\n * Initiatizes a City object from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): City {\n return Generic_fromJSON(City, value.data);\n }\n}\n\nReviver.constructors.City = City;\n","/**\n * Class representing a City in the game\n */\nimport { CityName } from \"./data/CityNames\";\nimport { LocationName } from \"./data/LocationNames\";\n\nexport class City {\n /**\n * List of all locations in this city\n */\n locations: LocationName[];\n\n /**\n * Name of this city\n */\n name: CityName;\n\n /**\n * Metro map ascii art\n */\n asciiArt: string;\n\n constructor(name: CityName, locations: LocationName[] = [], asciiArt = \"\") {\n this.name = name;\n this.locations = locations;\n this.asciiArt = asciiArt;\n }\n\n addLocation(loc: LocationName): void {\n this.locations.push(loc);\n }\n}\n","/**\n * React component for the tickers configuration section of the Stock Market UI.\n * This config lets you change the way stock tickers are displayed (watchlist,\n * all/portoflio mode, etc)\n */\nimport * as React from \"react\";\n\nimport { StdButton } from \"../../ui/React/StdButton\";\n\nexport enum TickerDisplayMode {\n AllStocks,\n Portfolio,\n}\n\ntype IProps = {\n changeDisplayMode: () => void;\n changeWatchlistFilter: (e: React.ChangeEvent) => void;\n collapseAllTickers: () => void;\n expandAllTickers: () => void;\n tickerDisplayMode: TickerDisplayMode;\n};\n\nexport class StockTickersConfig extends React.Component {\n constructor(props: IProps) {\n super(props);\n }\n\n renderDisplayModeButton(): React.ReactNode {\n let txt = \"\";\n let tooltip = \"\";\n if (this.props.tickerDisplayMode === TickerDisplayMode.Portfolio) {\n txt = \"Switch to 'All Stocks' Mode\";\n tooltip = \"Displays all stocks on the WSE\";\n } else {\n txt = \"Switch to 'Portfolio' Mode\";\n tooltip = \"Displays only the stocks for which you have shares or orders\";\n }\n\n return ;\n }\n\n render(): React.ReactNode {\n return (\n
\n {this.renderDisplayModeButton()}\n \n \n\n \n
\n );\n }\n}\n","/**\n * For a given element, this function removes it AND its children\n * @param elem The element to remove.\n */\nexport function removeElement(elem: Element | null): void {\n if (elem === null) {\n // tslint:disable-next-line:no-console\n console.debug(\"The element passed into 'removeElement' was null.\");\n\n return;\n }\n if (!(elem instanceof Element)) {\n // tslint:disable-next-line:no-console\n console.debug(\"The element passed into 'removeElement' was not an instance of an Element.\");\n\n return;\n }\n\n while (elem.firstChild !== null) {\n elem.removeChild(elem.firstChild);\n }\n\n if (elem.parentNode !== null) {\n elem.parentNode.removeChild(elem);\n }\n}\n","import { IMap } from \"../../types\";\n\nexport type CorporationUnlockUpgrade = [number, number, string, string];\n\n// Corporation Unlock Upgrades\n// Upgrades for entire corporation, unlocks features, either you have it or you dont\n// The data structure is an array with the following format:\n// [index in Corporation feature upgrades array, price, name, description]\nexport const CorporationUnlockUpgrades: IMap = {\n //Lets you export goods\n \"0\": [\n 0,\n 20e9,\n \"Export\",\n \"Develop infrastructure to export your materials to your other facilities. \" +\n \"This allows you to move materials around between different divisions and cities.\",\n ],\n\n //Lets you buy exactly however many required materials you need for production\n \"1\": [\n 1,\n 25e9,\n \"Smart Supply\",\n \"Use advanced AI to anticipate your supply needs. \" +\n \"This allows you to purchase exactly however many materials you need for production.\",\n ],\n\n //Displays each material/product's demand\n \"2\": [\n 2,\n 5e9,\n \"Market Research - Demand\",\n \"Mine and analyze market data to determine the demand of all resources. \" +\n \"The demand attribute, which affects sales, will be displayed for every material and product.\",\n ],\n\n //Display's each material/product's competition\n \"3\": [\n 3,\n 5e9,\n \"Market Data - Competition\",\n \"Mine and analyze market data to determine how much competition there is on the market \" +\n \"for all resources. The competition attribute, which affects sales, will be displayed for \" +\n \"every material and product.\",\n ],\n \"4\": [\n 4,\n 10e9,\n \"VeChain\",\n \"Use AI and blockchain technology to identify where you can improve your supply chain systems. \" +\n \"This upgrade will allow you to view a wide array of useful statistics about your \" +\n \"Corporation.\",\n ],\n \"5\": [\n 5,\n 500e9,\n \"Shady Accounting\",\n \"Utilize unscrupulous accounting practices and pay off government officials to save money \" +\n \"on taxes. This reduces the dividend tax rate by 5%.\",\n ],\n \"6\": [\n 6,\n 2e12,\n \"Government Partnership\",\n \"Help national governments further their agendas in exchange for lowered taxes. \" +\n \"This reduces the dividend tax rate by 10%\",\n ],\n};\n","import { IMap } from \"../../types\";\n\nexport type CorporationUpgrade = [number, number, number, number, string, string];\n\n// Corporation Upgrades\n// Upgrades for entire corporation, levelable upgrades\n// The data structure is an array with the following format\n// [index in Corporation upgrades array, base price, price mult, benefit mult (additive), name, desc]\nexport const CorporationUpgrades: IMap = {\n //Smart factories, increases production\n \"0\": [\n 0,\n 2e9,\n 1.06,\n 0.03,\n \"Smart Factories\",\n \"Advanced AI automatically optimizes the operation and productivity \" +\n \"of factories. Each level of this upgrade increases your global production by 3% (additive).\",\n ],\n\n //Smart warehouses, increases storage size\n \"1\": [\n 1,\n 2e9,\n 1.06,\n 0.1,\n \"Smart Storage\",\n \"Advanced AI automatically optimizes your warehouse storage methods. \" +\n \"Each level of this upgrade increases your global warehouse storage size by 10% (additive).\",\n ],\n\n //Advertise through dreams, passive popularity/ awareness gain\n \"2\": [\n 2,\n 4e9,\n 1.1,\n 0.001,\n \"DreamSense\",\n \"Use DreamSense LCC Technologies to advertise your corporation \" +\n \"to consumers through their dreams. Each level of this upgrade provides a passive \" +\n \"increase in awareness of all of your companies (divisions) by 0.004 / market cycle,\" +\n \"and in popularity by 0.001 / market cycle. A market cycle is approximately \" +\n \"15 seconds.\",\n ],\n\n //Makes advertising more effective\n \"3\": [\n 3,\n 4e9,\n 1.12,\n 0.005,\n \"Wilson Analytics\",\n \"Purchase data and analysis from Wilson, a marketing research \" +\n \"firm. Each level of this upgrades increases the effectiveness of your \" +\n \"advertising by 0.5% (additive).\",\n ],\n\n //Augmentation for employees, increases cre\n \"4\": [\n 4,\n 1e9,\n 1.06,\n 0.1,\n \"Nuoptimal Nootropic Injector Implants\",\n \"Purchase the Nuoptimal Nootropic \" +\n \"Injector augmentation for your employees. Each level of this upgrade \" +\n \"globally increases the creativity of your employees by 10% (additive).\",\n ],\n\n //Augmentation for employees, increases cha\n \"5\": [\n 5,\n 1e9,\n 1.06,\n 0.1,\n \"Speech Processor Implants\",\n \"Purchase the Speech Processor augmentation for your employees. \" +\n \"Each level of this upgrade globally increases the charisma of your employees by 10% (additive).\",\n ],\n\n //Augmentation for employees, increases int\n \"6\": [\n 6,\n 1e9,\n 1.06,\n 0.1,\n \"Neural Accelerators\",\n \"Purchase the Neural Accelerator augmentation for your employees. \" +\n \"Each level of this upgrade globally increases the intelligence of your employees \" +\n \"by 10% (additive).\",\n ],\n\n //Augmentation for employees, increases eff\n \"7\": [\n 7,\n 1e9,\n 1.06,\n 0.1,\n \"FocusWires\",\n \"Purchase the FocusWire augmentation for your employees. Each level \" +\n \"of this upgrade globally increases the efficiency of your employees by 10% (additive).\",\n ],\n\n //Improves sales of materials/products\n \"8\": [\n 8,\n 1e9,\n 1.07,\n 0.01,\n \"ABC SalesBots\",\n \"Always Be Closing. Purchase these robotic salesmen to increase the amount of \" +\n \"materials and products you sell. Each level of this upgrade globally increases your sales \" +\n \"by 1% (additive).\",\n ],\n\n //Improves scientific research rate\n \"9\": [\n 9,\n 5e9,\n 1.07,\n 0.05,\n \"Project Insight\",\n \"Purchase 'Project Insight', a R&D service provided by the secretive \" +\n \"Fulcrum Technologies. Each level of this upgrade globally increases the amount of \" +\n \"Scientific Research you produce by 5% (additive).\",\n ],\n};\n","import React from \"react\";\nimport { CityName } from \"../../Locations/data/CityNames\";\n\ninterface ICityProps {\n currentCity: CityName;\n city: CityName;\n onTravel: (city: CityName) => void;\n}\n\nfunction City(props: ICityProps): React.ReactElement {\n if (props.city !== props.currentCity) {\n return (\n props.onTravel(props.city)}\n >\n {props.city}\n {props.city[0]}\n \n );\n }\n return {props.city[0]};\n}\n\ninterface IProps {\n currentCity: CityName;\n onTravel: (city: CityName) => void;\n}\n\nexport function WorldMap(props: IProps): React.ReactElement {\n // prettier-ignore\n return (\n
\n
               ,_   .  ._. _.  .
\n
           , _-\\','|~\\~      ~/      ;-'_   _-'     ,;_;_,    ~~-
\n
  /~~-\\_/-'~'--' \\~~| ',    ,'      /  / ~|-_\\_/~/~      ~~--~~~~'--_
\n
  /              ,/'-/~ '\\ ,' _  , ','|~                   ._/-, /~
\n
  ~/-'~\\_,       '-,| '|. '   ~  ,\\ /'~                /    /_  /~
\n
.-~      '|        '',\\~|\\       _\\~     ,_  ,              /,
\n
          '\\       /'~          |_/~\\\\,-,~  \\ \"         ,_,/ |
\n
           |       /            ._-~'\\_ _~|              \\ ) 
\n
            \\   __-\\           '/      ~ |\\  \\_          /  ~
\n
  .,         '\\ |,  ~-_      - |          \\\\_' ~|  /\\  \\~ ,
\n
               ~-_'  _;       '\\           '-,   \\,' /\\/  |
\n
                 '\\_,~'\\_       \\_ _,       /'    '  |, /|'
\n
                   /     \\_       ~ |      /         \\  ~'; -,_.
\n
                   |       ~\\        |    |  ,        '-_, ,; ~ ~\\
\n
                    \\,     /        \\    / /|            ,-, ,   -,
\n
                     |    ,/          |  |' |/          ,-   ~ \\   '.
\n
                    ,|   ,/           \\ ,/              \\      |
\n
                    /    |             ~                 -~~-, /   _
\n
                    | ,-'                                    ~    /
\n
                    / ,'                                      ~
\n
                    ',|  ~
\n
                      ~'
\n
\n );\n}\n","import React from \"react\";\nimport { formatNumber } from \"../../../utils/StringHelperFunctions\";\n\ninterface IProps {\n chance: number[];\n}\n\nexport function SuccessChance(props: IProps): React.ReactElement {\n if (props.chance[0] === props.chance[1]) {\n return <>{formatNumber(props.chance[0] * 100, 1)}%;\n }\n\n return (\n <>\n {formatNumber(props.chance[0] * 100, 1)}% ~ {formatNumber(props.chance[1] * 100, 1)}%\n \n );\n}\n","import { CorporationConstants } from \"./data/Constants\";\nimport { getRandomInt } from \"../../utils/helpers/getRandomInt\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\nimport { createElement } from \"../../utils/uiHelpers/createElement\";\nimport { EmployeePositions } from \"./EmployeePositions\";\nimport { ICorporation } from \"./ICorporation\";\nimport { numeralWrapper } from \"../ui/numeralFormat\";\nimport { formatNumber } from \"../../utils/StringHelperFunctions\";\nimport { OfficeSpace } from \"./OfficeSpace\";\nimport { IIndustry } from \"./IIndustry\";\n\ninterface IParams {\n name?: string;\n morale?: number;\n happiness?: number;\n energy?: number;\n intelligence?: number;\n charisma?: number;\n experience?: number;\n creativity?: number;\n efficiency?: number;\n salary?: number;\n loc?: string;\n}\n\nexport class Employee {\n name: string;\n mor: number;\n hap: number;\n ene: number;\n int: number;\n cha: number;\n exp: number;\n cre: number;\n eff: number;\n sal: number;\n pro = 0;\n cyclesUntilRaise = CorporationConstants.CyclesPerEmployeeRaise;\n loc: string;\n pos: string;\n\n constructor(params: IParams = {}) {\n this.name = params.name ? params.name : \"Bobby\";\n\n //Morale, happiness, and energy are 0-100\n this.mor = params.morale ? params.morale : getRandomInt(50, 100);\n this.hap = params.happiness ? params.happiness : getRandomInt(50, 100);\n this.ene = params.energy ? params.energy : getRandomInt(50, 100);\n\n this.int = params.intelligence ? params.intelligence : getRandomInt(10, 50);\n this.cha = params.charisma ? params.charisma : getRandomInt(10, 50);\n this.exp = params.experience ? params.experience : getRandomInt(10, 50);\n this.cre = params.creativity ? params.creativity : getRandomInt(10, 50);\n this.eff = params.efficiency ? params.efficiency : getRandomInt(10, 50);\n this.sal = params.salary ? params.salary : getRandomInt(0.1, 5);\n\n this.loc = params.loc ? params.loc : \"\";\n this.pos = EmployeePositions.Unassigned;\n }\n\n //Returns the amount the employee needs to be paid\n process(marketCycles = 1, office: OfficeSpace): number {\n const gain = 0.003 * marketCycles,\n det = gain * Math.random();\n this.exp += gain;\n\n // Employee salaries slowly go up over time\n this.cyclesUntilRaise -= marketCycles;\n if (this.cyclesUntilRaise <= 0) {\n this.sal += CorporationConstants.EmployeeRaiseAmount;\n this.cyclesUntilRaise += CorporationConstants.CyclesPerEmployeeRaise;\n }\n\n //Training\n const trainingEff = gain * Math.random();\n if (this.pos === EmployeePositions.Training) {\n //To increase creativity and intelligence special upgrades are needed\n this.cha += trainingEff;\n this.exp += trainingEff;\n this.eff += trainingEff;\n }\n\n this.ene -= det;\n this.hap -= det;\n\n if (this.ene < office.minEne) {\n this.ene = office.minEne;\n }\n if (this.hap < office.minHap) {\n this.hap = office.minHap;\n }\n const salary = this.sal * marketCycles * CorporationConstants.SecsPerMarketCycle;\n return salary;\n }\n\n calculateProductivity(corporation: ICorporation, industry: IIndustry): number {\n const effCre = this.cre * corporation.getEmployeeCreMultiplier() * industry.getEmployeeCreMultiplier(),\n effCha = this.cha * corporation.getEmployeeChaMultiplier() * industry.getEmployeeChaMultiplier(),\n effInt = this.int * corporation.getEmployeeIntMultiplier() * industry.getEmployeeIntMultiplier(),\n effEff = this.eff * corporation.getEmployeeEffMultiplier() * industry.getEmployeeEffMultiplier();\n const prodBase = this.mor * this.hap * this.ene * 1e-6;\n let prodMult = 0;\n switch (this.pos) {\n //Calculate productivity based on position. This is multipled by prodBase\n //to get final value\n case EmployeePositions.Operations:\n prodMult = 0.6 * effInt + 0.1 * effCha + this.exp + 0.5 * effCre + effEff;\n break;\n case EmployeePositions.Engineer:\n prodMult = effInt + 0.1 * effCha + 1.5 * this.exp + effEff;\n break;\n case EmployeePositions.Business:\n prodMult = 0.4 * effInt + effCha + 0.5 * this.exp;\n break;\n case EmployeePositions.Management:\n prodMult = 2 * effCha + this.exp + 0.2 * effCre + 0.7 * effEff;\n break;\n case EmployeePositions.RandD:\n prodMult = 1.5 * effInt + 0.8 * this.exp + effCre + 0.5 * effEff;\n break;\n case EmployeePositions.Unassigned:\n case EmployeePositions.Training:\n prodMult = 0;\n break;\n default:\n console.error(`Invalid employee position: ${this.pos}`);\n break;\n }\n return prodBase * prodMult;\n }\n\n //Process benefits from having an office party thrown\n throwParty(money: number): number {\n const mult = 1 + money / 10e6;\n this.mor *= mult;\n this.mor = Math.min(100, this.mor);\n this.hap *= mult;\n this.hap = Math.min(100, this.hap);\n return mult;\n }\n\n //'panel' is the DOM element on which to create the UI\n createUI(panel: HTMLElement, corporation: ICorporation, industry: IIndustry): void {\n const effCre = this.cre * corporation.getEmployeeCreMultiplier() * industry.getEmployeeCreMultiplier(),\n effCha = this.cha * corporation.getEmployeeChaMultiplier() * industry.getEmployeeChaMultiplier(),\n effInt = this.int * corporation.getEmployeeIntMultiplier() * industry.getEmployeeIntMultiplier(),\n effEff = this.eff * corporation.getEmployeeEffMultiplier() * industry.getEmployeeEffMultiplier();\n panel.style.color = \"white\";\n panel.appendChild(\n createElement(\"p\", {\n id: \"cmpy-mgmt-employee-\" + this.name + \"-panel-text\",\n innerHTML:\n \"Morale: \" +\n formatNumber(this.mor, 3) +\n \"
\" +\n \"Happiness: \" +\n formatNumber(this.hap, 3) +\n \"
\" +\n \"Energy: \" +\n formatNumber(this.ene, 3) +\n \"
\" +\n \"Intelligence: \" +\n formatNumber(effInt, 3) +\n \"
\" +\n \"Charisma: \" +\n formatNumber(effCha, 3) +\n \"
\" +\n \"Experience: \" +\n formatNumber(this.exp, 3) +\n \"
\" +\n \"Creativity: \" +\n formatNumber(effCre, 3) +\n \"
\" +\n \"Efficiency: \" +\n formatNumber(effEff, 3) +\n \"
\" +\n \"Salary: \" +\n numeralWrapper.format(this.sal, \"$0.000a\") +\n \"/ s
\",\n }),\n );\n\n //Selector for employee position\n const selector = createElement(\"select\", {}) as HTMLSelectElement;\n for (const key in EmployeePositions) {\n if (EmployeePositions.hasOwnProperty(key)) {\n selector.add(\n createElement(\"option\", {\n text: EmployeePositions[key],\n value: EmployeePositions[key],\n }) as HTMLOptionElement,\n );\n }\n }\n\n selector.addEventListener(\"change\", () => {\n this.pos = selector.options[selector.selectedIndex].value;\n });\n\n //Set initial value of selector\n for (let i = 0; i < selector.length; ++i) {\n if (selector.options[i].value === this.pos) {\n selector.selectedIndex = i;\n break;\n }\n }\n panel.appendChild(selector);\n }\n\n copy(): Employee {\n const employee = new Employee();\n employee.name = this.name;\n employee.mor = this.mor;\n employee.hap = this.hap;\n employee.ene = this.ene;\n employee.int = this.int;\n employee.cha = this.cha;\n employee.exp = this.exp;\n employee.cre = this.cre;\n employee.eff = this.eff;\n employee.sal = this.sal;\n employee.pro = this.pro;\n employee.cyclesUntilRaise = this.cyclesUntilRaise;\n employee.loc = this.loc;\n employee.pos = this.pos;\n return employee;\n }\n\n toJSON(): any {\n return Generic_toJSON(\"Employee\", this);\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Employee {\n return Generic_fromJSON(Employee, value.data);\n }\n}\n\nReviver.constructors.Employee = Employee;\n","import { Crimes } from \"./Crimes\";\nimport { Crime } from \"./Crime\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\n\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\n\nexport function determineCrimeSuccess(p: IPlayer, type: string): boolean {\n let chance = 0;\n let found = false;\n for (const i in Crimes) {\n const crime = Crimes[i];\n if (crime.type == type) {\n chance = crime.successRate(p);\n found = true;\n break;\n }\n }\n\n if (!found) {\n dialogBoxCreate(`ERR: Unrecognized crime type: ${type} This is probably a bug please contact the developer`, false);\n return false;\n }\n\n if (Math.random() <= chance) {\n //Success\n return true;\n } else {\n //Failure\n return false;\n }\n}\n\nexport function findCrime(roughName: string): Crime | null {\n if (roughName.includes(\"shoplift\")) {\n return Crimes.Shoplift;\n } else if (roughName.includes(\"rob\") && roughName.includes(\"store\")) {\n return Crimes.RobStore;\n } else if (roughName.includes(\"mug\")) {\n return Crimes.Mug;\n } else if (roughName.includes(\"larceny\")) {\n return Crimes.Larceny;\n } else if (roughName.includes(\"drugs\")) {\n return Crimes.DealDrugs;\n } else if (roughName.includes(\"bond\") && roughName.includes(\"forge\")) {\n return Crimes.BondForgery;\n } else if (roughName.includes(\"traffick\") && roughName.includes(\"arms\")) {\n return Crimes.TraffickArms;\n } else if (roughName.includes(\"homicide\")) {\n return Crimes.Homicide;\n } else if (roughName.includes(\"grand\") && roughName.includes(\"auto\")) {\n return Crimes.GrandTheftAuto;\n } else if (roughName.includes(\"kidnap\")) {\n return Crimes.Kidnap;\n } else if (roughName.includes(\"assassinate\") || roughName.includes(\"assassination\")) {\n return Crimes.Assassination;\n } else if (roughName.includes(\"heist\")) {\n return Crimes.Heist;\n }\n\n return null;\n}\n","import { DarkWebItems } from \"./DarkWebItems\";\n\nimport { Player } from \"../Player\";\nimport { Terminal } from \"../Terminal\";\nimport { SpecialServerIps } from \"../Server/SpecialServerIps\";\nimport { numeralWrapper } from \"../ui/numeralFormat\";\n\nimport { isValidIPAddress } from \"../../utils/helpers/isValidIPAddress\";\n\n//Posts a \"help\" message if connected to DarkWeb\nexport function checkIfConnectedToDarkweb(): void {\n if (SpecialServerIps.hasOwnProperty(\"Darkweb Server\")) {\n const darkwebIp = SpecialServerIps.getIp(\"Darkweb Server\");\n if (!isValidIPAddress(darkwebIp)) {\n return;\n }\n if (darkwebIp == Player.getCurrentServer().ip) {\n Terminal.print(\n \"You are now connected to the dark web. From the dark web you can purchase illegal items. \" +\n \"Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] \" +\n \"to purchase an item.\",\n );\n }\n }\n}\n\nexport function listAllDarkwebItems(): void {\n for (const key in DarkWebItems) {\n const item = DarkWebItems[key];\n Terminal.print(`${item.program} - ${numeralWrapper.formatMoney(item.price)} - ${item.description}`);\n }\n}\n\nexport function buyDarkwebItem(itemName: string): void {\n itemName = itemName.toLowerCase();\n\n // find the program that matches, if any\n let item = null;\n for (const key in DarkWebItems) {\n const i = DarkWebItems[key];\n if (i.program.toLowerCase() == itemName) {\n item = i;\n }\n }\n\n // return if invalid\n if (item === null) {\n Terminal.print(\"Unrecognized item: \" + itemName);\n return;\n }\n\n // return if the player already has it.\n if (Player.hasProgram(item.program)) {\n Terminal.print(\"You already have the \" + item.program + \" program\");\n return;\n }\n\n // return if the player doesn't have enough money\n if (Player.money.lt(item.price)) {\n Terminal.print(\"Not enough money to purchase \" + item.program);\n return;\n }\n\n // buy and push\n Player.loseMoney(item.price);\n Player.getHomeComputer().programs.push(item.program);\n Terminal.print(\n \"You have purchased the \" + item.program + \" program. The new program can be found on your home computer.\",\n );\n}\n","import { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { Reputation } from \"../../ui/React/Reputation\";\n\nexport function ReputationRate(reputation: number): JSX.Element {\n return Reputation(`${numeralWrapper.formatReputation(reputation)} / sec`);\n}\n","import { Company } from \"./Company\";\nimport { CompanyPosition } from \"./CompanyPosition\";\n\n/**\n * Returns a string with the given CompanyPosition's stat requirements\n */\n\nexport function getJobRequirementText(company: Company, pos: CompanyPosition, tooltiptext = false): string {\n let reqText = \"\";\n const offset: number = company.jobStatReqOffset;\n const reqHacking: number = pos.requiredHacking > 0 ? pos.requiredHacking + offset : 0;\n const reqStrength: number = pos.requiredStrength > 0 ? pos.requiredStrength + offset : 0;\n const reqDefense: number = pos.requiredDefense > 0 ? pos.requiredDefense + offset : 0;\n const reqDexterity: number = pos.requiredDexterity > 0 ? pos.requiredDexterity + offset : 0;\n const reqAgility: number = pos.requiredDexterity > 0 ? pos.requiredDexterity + offset : 0;\n const reqCharisma: number = pos.requiredCharisma > 0 ? pos.requiredCharisma + offset : 0;\n const reqRep: number = pos.requiredReputation;\n if (tooltiptext) {\n reqText = \"Requires:
\";\n reqText += reqHacking.toString() + \" hacking
\";\n reqText += reqStrength.toString() + \" strength
\";\n reqText += reqDefense.toString() + \" defense
\";\n reqText += reqDexterity.toString() + \" dexterity
\";\n reqText += reqAgility.toString() + \" agility
\";\n reqText += reqCharisma.toString() + \" charisma
\";\n reqText += reqRep.toString() + \" reputation\";\n } else {\n reqText = \"(Requires \";\n if (reqHacking > 0) {\n reqText += reqHacking + \" hacking, \";\n }\n if (reqStrength > 0) {\n reqText += reqStrength + \" strength, \";\n }\n if (reqDefense > 0) {\n reqText += reqDefense + \" defense, \";\n }\n if (reqDexterity > 0) {\n reqText += reqDexterity + \" dexterity, \";\n }\n if (reqAgility > 0) {\n reqText += reqAgility + \" agility, \";\n }\n if (reqCharisma > 0) {\n reqText += reqCharisma + \" charisma, \";\n }\n if (reqRep > 1) {\n reqText += reqRep + \" reputation, \";\n }\n reqText = reqText.substring(0, reqText.length - 2);\n reqText += \")\";\n }\n return reqText;\n}\n","import { vsprintf, sprintf } from \"sprintf-js\";\nimport * as libarg from \"arg\";\n\nimport { getRamCost } from \"./Netscript/RamCostGenerator\";\nimport { WorkerScriptStartStopEventEmitter } from \"./Netscript/WorkerScriptStartStopEventEmitter\";\n\nimport { Augmentations } from \"./Augmentation/Augmentations\";\nimport { augmentationExists, installAugmentations } from \"./Augmentation/AugmentationHelpers\";\nimport { prestigeAugmentation } from \"./Prestige\";\nimport { AugmentationNames } from \"./Augmentation/data/AugmentationNames\";\nimport { BitNodeMultipliers } from \"./BitNode/BitNodeMultipliers\";\nimport { findCrime } from \"./Crime/CrimeHelpers\";\nimport { Bladeburner } from \"./Bladeburner/Bladeburner\";\nimport { Company } from \"./Company/Company\";\nimport { Companies } from \"./Company/Companies\";\nimport { CompanyPosition } from \"./Company/CompanyPosition\";\nimport { CompanyPositions } from \"./Company/CompanyPositions\";\nimport { CONSTANTS } from \"./Constants\";\nimport { DarkWebItems } from \"./DarkWeb/DarkWebItems\";\nimport {\n NewIndustry,\n NewCity,\n UnlockUpgrade,\n LevelUpgrade,\n IssueDividends,\n SellMaterial,\n SellProduct,\n SetSmartSupply,\n BuyMaterial,\n AssignJob,\n UpgradeOfficeSize,\n ThrowParty,\n PurchaseWarehouse,\n UpgradeWarehouse,\n BuyCoffee,\n HireAdVert,\n MakeProduct,\n Research,\n ExportMaterial,\n CancelExportMaterial,\n SetMaterialMarketTA1,\n SetMaterialMarketTA2,\n SetProductMarketTA1,\n SetProductMarketTA2,\n} from \"./Corporation/Actions\";\nimport { CorporationUnlockUpgrades } from \"./Corporation/data/CorporationUnlockUpgrades\";\nimport { CorporationUpgrades } from \"./Corporation/data/CorporationUpgrades\";\nimport {\n calculateHackingChance,\n calculateHackingExpGain,\n calculatePercentMoneyHacked,\n calculateHackingTime,\n calculateGrowTime,\n calculateWeakenTime,\n} from \"./Hacking\";\nimport { calculateServerGrowth } from \"./Server/formulas/grow\";\nimport { Gang } from \"./Gang/Gang\";\nimport { AllGangs } from \"./Gang/AllGangs\";\nimport { GangMemberTasks } from \"./Gang/GangMemberTasks\";\nimport { GangMemberUpgrades } from \"./Gang/GangMemberUpgrades\";\nimport { Factions, factionExists } from \"./Faction/Factions\";\nimport { joinFaction, purchaseAugmentation } from \"./Faction/FactionHelpers\";\nimport { FactionWorkType } from \"./Faction/FactionWorkTypeEnum\";\nimport { netscriptCanGrow, netscriptCanHack, netscriptCanWeaken } from \"./Hacking/netscriptCanHack\";\n\nimport {\n getCostOfNextHacknetNode,\n getCostOfNextHacknetServer,\n hasHacknetServers,\n purchaseHacknet,\n purchaseLevelUpgrade,\n purchaseRamUpgrade,\n purchaseCoreUpgrade,\n purchaseCacheUpgrade,\n purchaseHashUpgrade,\n updateHashManagerCapacity,\n} from \"./Hacknet/HacknetHelpers\";\nimport {\n calculateMoneyGainRate,\n calculateLevelUpgradeCost,\n calculateRamUpgradeCost,\n calculateCoreUpgradeCost,\n calculateNodeCost,\n} from \"./Hacknet/formulas/HacknetNodes\";\nimport {\n calculateHashGainRate as HScalculateHashGainRate,\n calculateLevelUpgradeCost as HScalculateLevelUpgradeCost,\n calculateRamUpgradeCost as HScalculateRamUpgradeCost,\n calculateCoreUpgradeCost as HScalculateCoreUpgradeCost,\n calculateCacheUpgradeCost as HScalculateCacheUpgradeCost,\n calculateServerCost as HScalculateServerCost,\n} from \"./Hacknet/formulas/HacknetServers\";\nimport { HacknetNodeConstants, HacknetServerConstants } from \"./Hacknet/data/Constants\";\nimport { HacknetServer } from \"./Hacknet/HacknetServer\";\nimport { CityName } from \"./Locations/data/CityNames\";\nimport { LocationName } from \"./Locations/data/LocationNames\";\nimport { Terminal } from \"./Terminal\";\nimport { calculateSkill, calculateExp } from \"./PersonObjects/formulas/skill\";\n\nimport { Message } from \"./Message/Message\";\nimport { inMission } from \"./Missions\";\nimport { Player } from \"./Player\";\nimport { Programs } from \"./Programs/Programs\";\nimport { Script } from \"./Script/Script\";\nimport { findRunningScript, findRunningScriptByPid } from \"./Script/ScriptHelpers\";\nimport { isScriptFilename } from \"./Script/ScriptHelpersTS\";\nimport { AllServers, AddToAllServers, createUniqueRandomIp } from \"./Server/AllServers\";\nimport { RunningScript } from \"./Script/RunningScript\";\nimport {\n GetServerByHostname,\n getServer,\n getServerOnNetwork,\n numCycleForGrowth,\n processSingleServerGrowth,\n safetlyCreateUniqueServer,\n} from \"./Server/ServerHelpers\";\nimport { getPurchaseServerCost, getPurchaseServerLimit, getPurchaseServerMaxRam } from \"./Server/ServerPurchases\";\nimport { SpecialServerIps } from \"./Server/SpecialServerIps\";\nimport { SourceFileFlags } from \"./SourceFile/SourceFileFlags\";\nimport { buyStock, sellStock, shortStock, sellShort } from \"./StockMarket/BuyingAndSelling\";\nimport { influenceStockThroughServerHack, influenceStockThroughServerGrow } from \"./StockMarket/PlayerInfluencing\";\nimport { StockMarket, SymbolToStockMap, placeOrder, cancelOrder } from \"./StockMarket/StockMarket\";\nimport { getBuyTransactionCost, getSellTransactionGain } from \"./StockMarket/StockMarketHelpers\";\nimport { OrderTypes } from \"./StockMarket/data/OrderTypes\";\nimport { PositionTypes } from \"./StockMarket/data/PositionTypes\";\nimport { StockSymbols } from \"./StockMarket/data/StockSymbols\";\nimport { getStockMarket4SDataCost, getStockMarket4STixApiCost } from \"./StockMarket/StockMarketCosts\";\nimport { isValidFilePath, removeLeadingSlash } from \"./Terminal/DirectoryHelpers\";\nimport { TextFile, getTextFile, createTextFile } from \"./TextFile\";\n\nimport { NetscriptPorts, runScriptFromScript, startWorkerScript } from \"./NetscriptWorker\";\nimport { killWorkerScript } from \"./Netscript/killWorkerScript\";\nimport { workerScripts } from \"./Netscript/WorkerScripts\";\nimport { makeRuntimeRejectMsg, netscriptDelay, resolveNetscriptRequestedThreads } from \"./NetscriptEvaluator\";\nimport { Interpreter } from \"./JSInterpreter\";\nimport { NetscriptPort } from \"./NetscriptPort\";\nimport { SleeveTaskType } from \"./PersonObjects/Sleeve/SleeveTaskTypesEnum\";\nimport { findSleevePurchasableAugs } from \"./PersonObjects/Sleeve/SleeveHelpers\";\nimport { Exploit } from \"./Exploits/Exploit\";\nimport { Router } from \"./ui/GameRoot\";\n\nimport { numeralWrapper } from \"./ui/numeralFormat\";\nimport { setTimeoutRef } from \"./utils/SetTimeoutRef\";\nimport { is2DArray } from \"./utils/helpers/is2DArray\";\nimport { convertTimeMsToTimeElapsedString } from \"../utils/StringHelperFunctions\";\n\nimport { logBoxCreate } from \"../utils/LogBox\";\nimport { arrayToString } from \"../utils/helpers/arrayToString\";\nimport { isString } from \"../utils/helpers/isString\";\n\nimport { createElement } from \"../utils/uiHelpers/createElement\";\nimport { createPopup } from \"../utils/uiHelpers/createPopup\";\nimport { removeElementById } from \"../utils/uiHelpers/removeElementById\";\n\nconst defaultInterpreter = new Interpreter(\"\", () => undefined);\n\n// the acorn interpreter has a bug where it doesn't convert arrays correctly.\n// so we have to more or less copy it here.\nfunction toNative(pseudoObj) {\n if (pseudoObj == null) return null;\n if (\n !pseudoObj.hasOwnProperty(\"properties\") ||\n !pseudoObj.hasOwnProperty(\"getter\") ||\n !pseudoObj.hasOwnProperty(\"setter\") ||\n !pseudoObj.hasOwnProperty(\"proto\")\n ) {\n return pseudoObj; // it wasn't a pseudo object anyway.\n }\n\n let nativeObj;\n if (pseudoObj.hasOwnProperty(\"class\") && pseudoObj.class === \"Array\") {\n nativeObj = [];\n const length = defaultInterpreter.getProperty(pseudoObj, \"length\");\n for (let i = 0; i < length; i++) {\n if (defaultInterpreter.hasProperty(pseudoObj, i)) {\n nativeObj[i] = toNative(defaultInterpreter.getProperty(pseudoObj, i));\n }\n }\n } else {\n // Object.\n nativeObj = {};\n for (var key in pseudoObj.properties) {\n const val = pseudoObj.properties[key];\n nativeObj[key] = toNative(val);\n }\n }\n return nativeObj;\n}\n\nfunction NetscriptFunctions(workerScript) {\n const updateDynamicRam = function (fnName, ramCost) {\n if (workerScript.dynamicLoadedFns[fnName]) {\n return;\n }\n workerScript.dynamicLoadedFns[fnName] = true;\n\n let threads = workerScript.scriptRef.threads;\n if (typeof threads !== \"number\") {\n console.warn(`WorkerScript detected NaN for threadcount for ${workerScript.name} on ${workerScript.serverIp}`);\n threads = 1;\n }\n\n workerScript.dynamicRamUsage += ramCost * threads;\n if (workerScript.dynamicRamUsage > 1.01 * workerScript.ramUsage) {\n throw makeRuntimeRejectMsg(\n workerScript,\n `Dynamic RAM usage calculated to be greater than initial RAM usage on fn: ${fnName}.\n This is probably because you somehow circumvented the static RAM calculation.\n\n Dynamic RAM Usage: ${numeralWrapper.formatRAM(workerScript.dynamicRamUsage)}\n Static RAM Usage: ${numeralWrapper.formatRAM(workerScript.ramUsage)}\n\n One of these could be the reason:\n * Using eval() to get a reference to a ns function\n   const scan = eval('ns.scan');\n\n * Using map access to do the same\n   const scan = ns['scan'];\n\n * Saving script in the improper order.\n   Increase the cost of an imported script, save it, then run the\n   parent. To fix this just re-open & save every script in order\n   from most imported to least imported (parent script).\n\n Sorry :(`,\n );\n }\n };\n\n /**\n * Gets the Server for a specific hostname/ip, throwing an error\n * if the server doesn't exist.\n * @param {string} ip - Hostname or IP of the server\n * @param {string} callingFnName - Name of calling function. For logging purposes\n * @returns {Server} The specified Server\n */\n const safeGetServer = function (ip, callingFnName = \"\") {\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(callingFnName, `Invalid IP/hostname: ${ip}`);\n }\n return server;\n };\n\n /**\n * Searches for and returns the RunningScript object for the specified script.\n * If the 'fn' argument is not specified, this returns the current RunningScript.\n * @param {string} fn - Filename of script\n * @param {string} ip - Hostname/ip of the server on which the script resides\n * @param {any[]} scriptArgs - Running script's arguments\n * @returns {RunningScript}\n * Running script identified by the parameters, or null if no such script\n * exists, or the current running script if the first argument 'fn'\n * is not specified.\n */\n const getRunningScript = function (fn, ip, callingFnName, scriptArgs) {\n if (typeof callingFnName !== \"string\" || callingFnName === \"\") {\n callingFnName = \"getRunningScript\";\n }\n\n if (!Array.isArray(scriptArgs)) {\n throw makeRuntimeRejectMsg(\n workerScript,\n `Invalid scriptArgs argument passed into getRunningScript() from ${callingFnName}(). ` +\n `This is probably a bug. Please report to game developer`,\n );\n }\n\n if (fn != null && typeof fn === \"string\") {\n // Get Logs of another script\n if (ip == null) {\n ip = workerScript.serverIp;\n }\n const server = safeGetServer(ip, callingFnName);\n\n return findRunningScript(fn, scriptArgs, server);\n }\n\n // If no arguments are specified, return the current RunningScript\n return workerScript.scriptRef;\n };\n\n const getRunningScriptByPid = function (pid, callingFnName) {\n if (typeof callingFnName !== \"string\" || callingFnName === \"\") {\n callingFnName = \"getRunningScriptgetRunningScriptByPid\";\n }\n\n for (const name of Object.keys(AllServers)) {\n const server = AllServers[name];\n const runningScript = findRunningScriptByPid(pid, server);\n if (runningScript) return runningScript;\n }\n return null;\n };\n\n /**\n * Helper function for getting the error log message when the user specifies\n * a nonexistent running script\n * @param {string} fn - Filename of script\n * @param {string} ip - Hostname/ip of the server on which the script resides\n * @param {any[]} scriptArgs - Running script's arguments\n * @returns {string} Error message to print to logs\n */\n const getCannotFindRunningScriptErrorMessage = function (fn, ip, scriptArgs) {\n if (!Array.isArray(scriptArgs)) {\n scriptArgs = [];\n }\n\n return `Cannot find running script ${fn} on server ${ip} with args: ${arrayToString(scriptArgs)}`;\n };\n\n /**\n * Checks if the player has TIX API access. Throws an error if the player does not\n */\n const checkTixApiAccess = function (callingFn = \"\") {\n if (!Player.hasWseAccount) {\n throw makeRuntimeErrorMsg(callingFn, `You don't have WSE Access! Cannot use ${callingFn}()`);\n }\n if (!Player.hasTixApiAccess) {\n throw makeRuntimeErrorMsg(callingFn, `You don't have TIX API Access! Cannot use ${callingFn}()`);\n }\n };\n\n /**\n * Gets a stock, given its symbol. Throws an error if the symbol is invalid\n * @param {string} symbol - Stock's symbol\n * @returns {Stock} stock object\n */\n const getStockFromSymbol = function (symbol, callingFn = \"\") {\n const stock = SymbolToStockMap[symbol];\n if (stock == null) {\n throw makeRuntimeErrorMsg(callingFn, `Invalid stock symbol: '${symbol}'`);\n }\n\n return stock;\n };\n\n /**\n * Used to fail a function if the function's target is a Hacknet Server.\n * This is used for functions that should run on normal Servers, but not Hacknet Servers\n * @param {Server} server - Target server\n * @param {string} callingFn - Name of calling function. For logging purposes\n * @returns {boolean} True if the server is a Hacknet Server, false otherwise\n */\n const failOnHacknetServer = function (server, callingFn = \"\") {\n if (server instanceof HacknetServer) {\n workerScript.log(callingFn, `Does not work on Hacknet Servers`);\n return true;\n } else {\n return false;\n }\n };\n\n // Utility function to get Hacknet Node object\n const getHacknetNode = function (i, callingFn = \"\") {\n if (isNaN(i)) {\n throw makeRuntimeErrorMsg(callingFn, \"Invalid index specified for Hacknet Node: \" + i);\n }\n if (i < 0 || i >= Player.hacknetNodes.length) {\n throw makeRuntimeErrorMsg(callingFn, \"Index specified for Hacknet Node is out-of-bounds: \" + i);\n }\n\n if (hasHacknetServers(Player)) {\n const hserver = AllServers[Player.hacknetNodes[i]];\n if (hserver == null) {\n throw makeRuntimeErrorMsg(\n callingFn,\n `Could not get Hacknet Server for index ${i}. This is probably a bug, please report to game dev`,\n );\n }\n\n return hserver;\n } else {\n return Player.hacknetNodes[i];\n }\n };\n\n const makeRuntimeErrorMsg = function (caller, msg) {\n const stack = new Error().stack.split(\"\\n\").slice(1);\n const scripts = workerScript.getServer().scripts;\n const userstack = [];\n for (const stackline of stack) {\n let filename;\n for (const script of scripts) {\n if (script.url && stackline.includes(script.url)) {\n filename = script.filename;\n }\n for (const dependency of script.dependencies) {\n if (stackline.includes(dependency.url)) {\n filename = dependency.filename;\n }\n }\n }\n if (!filename) continue;\n\n function parseChromeStackline(line) {\n const lineRe = /.*:(\\d+):\\d+.*/;\n const funcRe = /.*at (.+) \\(.*/;\n\n const lineMatch = line.match(lineRe);\n const funcMatch = line.match(funcRe);\n if (lineMatch && funcMatch) {\n return { line: lineMatch[1], func: funcMatch[1] };\n }\n return null;\n }\n let call = { line: \"-1\", func: \"unknown\" };\n const chromeCall = parseChromeStackline(stackline);\n if (chromeCall) {\n call = chromeCall;\n }\n\n function parseFirefoxStackline(line) {\n const lineRe = /.*:(\\d+):\\d+$/;\n const lineMatch = line.match(lineRe);\n\n const lio = line.lastIndexOf(\"@\");\n\n if (lineMatch && lio !== -1) {\n return { line: lineMatch[1], func: line.slice(0, lio) };\n }\n return null;\n }\n\n let firefoxCall = parseFirefoxStackline(stackline);\n if (firefoxCall) {\n call = firefoxCall;\n }\n\n userstack.push(`${filename}:L${call.line}@${call.func}`);\n }\n\n workerScript.log(caller, msg);\n let rejectMsg = `${caller}: ${msg}`;\n if (userstack.length !== 0) rejectMsg += `

Stack:
${userstack.join(\"
\")}`;\n return makeRuntimeRejectMsg(workerScript, rejectMsg);\n };\n\n const checkFormulasAccess = function (func, n) {\n if ((SourceFileFlags[5] < 1 && Player.bitNodeN !== 5) || (SourceFileFlags[n] < 1 && Player.bitNodeN !== n)) {\n let extra = \"\";\n if (n !== 5) {\n extra = ` and Source-File ${n}-1`;\n }\n throw makeRuntimeErrorMsg(`formulas.${func}`, `Requires Source-File 5-1${extra} to run.`);\n }\n };\n\n const checkSingularityAccess = function (func, n) {\n if (Player.bitNodeN !== 4) {\n if (SourceFileFlags[4] < n) {\n throw makeRuntimeErrorMsg(func, `This singularity function requires Source-File 4-${n} to run.`);\n }\n }\n };\n\n const checkBladeburnerAccess = function (func, skipjoined = false) {\n const apiAccess =\n Player.bitNodeN === 7 ||\n Player.sourceFiles.some((a) => {\n return a.n === 7;\n });\n if (!apiAccess) {\n const apiDenied = `You do not currently have access to the Bladeburner API. You must either be in BitNode-7 or have Source-File 7.`;\n throw makeRuntimeErrorMsg(`bladeburner.${func}`, apiDenied);\n }\n if (!skipjoined) {\n const bladeburnerAccess = Player.bladeburner instanceof Bladeburner;\n if (!bladeburnerAccess) {\n const bladeburnerDenied = `You must be a member of the Bladeburner division to use this API.`;\n throw makeRuntimeErrorMsg(`bladeburner.${func}`, bladeburnerDenied);\n }\n }\n };\n\n const checkBladeburnerCity = function (func, city) {\n if (!Player.bladeburner.cities.hasOwnProperty(city)) {\n throw makeRuntimeErrorMsg(`bladeburner.${func}`, `Invalid city: ${city}`);\n }\n };\n\n const checkSleeveAPIAccess = function (func) {\n if (Player.bitNodeN !== 10 && !SourceFileFlags[10]) {\n throw makeRuntimeErrorMsg(\n `sleeve.${func}`,\n \"You do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10\",\n );\n }\n };\n\n const checkSleeveNumber = function (func, sleeveNumber) {\n if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) {\n const msg = `Invalid sleeve number: ${sleeveNumber}`;\n workerScript.log(func, msg);\n throw makeRuntimeErrorMsg(`sleeve.${func}`, msg);\n }\n };\n\n const getCodingContract = function (func, ip, fn) {\n const server = safeGetServer(ip, func);\n const contract = server.getContract(fn);\n if (contract == null) {\n throw makeRuntimeErrorMsg(`codingcontract.${func}`, `Cannot find contract '${fn}' on server '${ip}'`);\n }\n\n return contract;\n };\n\n const checkGangApiAccess = function (func) {\n const hasAccess = Player.gang instanceof Gang;\n if (!hasAccess) {\n throw makeRuntimeErrorMsg(`gang.${func}`, `You do not currently have a Gang`);\n }\n };\n\n const getGangMember = function (func, name) {\n for (const member of Player.gang.members) if (member.name === name) return member;\n throw makeRuntimeErrorMsg(`gang.${func}`, `Invalid gang member: '${name}'`);\n };\n\n const getGangTask = function (func, name) {\n const task = GangMemberTasks[name];\n if (!task) {\n throw makeRuntimeErrorMsg(`gang.${func}`, `Invalid task: '${name}'`);\n }\n\n return task;\n };\n\n const getBladeburnerActionObject = function (func, type, name) {\n const actionId = Player.bladeburner.getActionIdFromTypeAndName(type, name);\n if (!actionId) {\n throw makeRuntimeErrorMsg(`bladeburner.${func}`, `Invalid action type='${type}', name='${name}'`);\n }\n const actionObj = Player.bladeburner.getActionObject(actionId);\n if (!actionObj) {\n throw makeRuntimeErrorMsg(`bladeburner.${func}`, `Invalid action type='${type}', name='${name}'`);\n }\n\n return actionObj;\n };\n\n const getCompany = function (func, name) {\n const company = Companies[name];\n if (company == null || !(company instanceof Company)) {\n throw makeRuntimeErrorMsg(func, `Invalid company name: '${name}'`);\n }\n return company;\n };\n\n const getFaction = function (func, name) {\n if (!factionExists(name)) {\n throw makeRuntimeErrorMsg(func, `Invalid faction name: '${name}`);\n }\n\n return Factions[name];\n };\n\n const getAugmentation = function (func, name) {\n if (!augmentationExists(name)) {\n throw makeRuntimeErrorMsg(func, `Invalid augmentation: '${name}'`);\n }\n\n return Augmentations[name];\n };\n\n function getDivision(divisionName) {\n const division = Player.corporation.divisions.find((div) => div.name === divisionName);\n if (division === undefined) throw new Error(`No division named '${divisionName}'`);\n return division;\n }\n\n function getOffice(divisionName, cityName) {\n const division = getDivision(divisionName);\n if (!(cityName in division.offices)) throw new Error(`Invalid city name '${cityName}'`);\n const office = division.offices[cityName];\n if (office === 0) throw new Error(`${division.name} has not expanded to '${cityName}'`);\n return office;\n }\n\n function getWarehouse(divisionName, cityName) {\n const division = getDivision(divisionName);\n if (!(cityName in division.warehouses)) throw new Error(`Invalid city name '${cityName}'`);\n const warehouse = division.warehouses[cityName];\n if (warehouse === 0) throw new Error(`${division.name} has not expanded to '${cityName}'`);\n return warehouse;\n }\n\n function getMaterial(divisionName, cityName, materialName) {\n const warehouse = getWarehouse(divisionName, cityName);\n const material = warehouse.materials[materialName];\n if (material === undefined) throw new Error(`Invalid material name: '${materialName}'`);\n return material;\n }\n\n function getProduct(divisionName, productName) {\n const division = getDivision(divisionName);\n const product = division.products[productName];\n if (product === undefined) throw new Error(`Invalid product name: '${productName}'`);\n return product;\n }\n\n function getEmployee(divisionName, cityName, employeeName) {\n const office = getOffice(divisionName, cityName);\n const employee = office.employees.find((e) => e.name === employeeName);\n if (employee === undefined) throw new Error(`Invalid employee name: '${employeeName}'`);\n return employee;\n }\n\n const runAfterReset = function (cbScript = null) {\n //Run a script after reset\n if (cbScript && isString(cbScript)) {\n const home = Player.getHomeComputer();\n for (const script of home.scripts) {\n if (script.filename === cbScript) {\n const ramUsage = script.ramUsage;\n const ramAvailable = home.maxRam - home.ramUsed;\n if (ramUsage > ramAvailable) {\n return; // Not enough RAM\n }\n const runningScriptObj = new RunningScript(script, []); // No args\n runningScriptObj.threads = 1; // Only 1 thread\n startWorkerScript(runningScriptObj, home);\n }\n }\n }\n };\n\n const hack = function (ip, manual, { threads: requestedThreads, stock } = {}) {\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"hack\", \"Takes 1 argument.\");\n }\n const threads = resolveNetscriptRequestedThreads(workerScript, \"hack\", requestedThreads);\n const server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"hack\", `Invalid IP/hostname: ${ip}.`);\n }\n\n // Calculate the hacking time\n var hackingTime = calculateHackingTime(server, Player); // This is in seconds\n\n // No root access or skill level too low\n const canHack = netscriptCanHack(server, Player);\n if (!canHack.res) {\n throw makeRuntimeErrorMsg(\"hack\", canHack.msg);\n }\n\n workerScript.log(\n \"hack\",\n `Executing ${ip} in ${convertTimeMsToTimeElapsedString(\n hackingTime * 1000,\n true,\n )} (t=${numeralWrapper.formatThreads(threads)})`,\n );\n\n return netscriptDelay(hackingTime * 1000, workerScript).then(function () {\n if (workerScript.env.stopFlag) {\n return Promise.reject(workerScript);\n }\n var hackChance = calculateHackingChance(server, Player);\n var rand = Math.random();\n var expGainedOnSuccess = calculateHackingExpGain(server, Player) * threads;\n var expGainedOnFailure = expGainedOnSuccess / 4;\n if (rand < hackChance) {\n // Success!\n const percentHacked = calculatePercentMoneyHacked(server, Player);\n let maxThreadNeeded = Math.ceil((1 / percentHacked) * (server.moneyAvailable / server.moneyMax));\n if (isNaN(maxThreadNeeded)) {\n // Server has a 'max money' of 0 (probably). We'll set this to an arbitrarily large value\n maxThreadNeeded = 1e6;\n }\n\n let moneyDrained = Math.floor(server.moneyAvailable * percentHacked) * threads;\n\n // Over-the-top safety checks\n if (moneyDrained <= 0) {\n moneyDrained = 0;\n expGainedOnSuccess = expGainedOnFailure;\n }\n if (moneyDrained > server.moneyAvailable) {\n moneyDrained = server.moneyAvailable;\n }\n server.moneyAvailable -= moneyDrained;\n if (server.moneyAvailable < 0) {\n server.moneyAvailable = 0;\n }\n\n const moneyGained = moneyDrained * BitNodeMultipliers.ScriptHackMoneyGain;\n\n Player.gainMoney(moneyGained);\n workerScript.scriptRef.onlineMoneyMade += moneyGained;\n Player.scriptProdSinceLastAug += moneyGained;\n Player.recordMoneySource(moneyGained, \"hacking\");\n workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);\n Player.gainHackingExp(expGainedOnSuccess);\n workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;\n workerScript.log(\n \"hack\",\n `Successfully hacked '${server.hostname}' for ${numeralWrapper.formatMoney(\n moneyGained,\n )} and ${numeralWrapper.formatExp(expGainedOnSuccess)} exp (t=${numeralWrapper.formatThreads(threads)})`,\n );\n server.fortify(CONSTANTS.ServerFortifyAmount * Math.min(threads, maxThreadNeeded));\n if (stock) {\n influenceStockThroughServerHack(server, moneyGained);\n }\n if (manual) {\n server.backdoorInstalled = true;\n }\n return Promise.resolve(moneyGained);\n } else {\n // Player only gains 25% exp for failure?\n Player.gainHackingExp(expGainedOnFailure);\n workerScript.scriptRef.onlineExpGained += expGainedOnFailure;\n workerScript.log(\n \"hack\",\n `Failed to hack '${server.hostname}'. Gained ${numeralWrapper.formatExp(\n expGainedOnFailure,\n )} exp (t=${numeralWrapper.formatThreads(threads)})`,\n );\n return Promise.resolve(0);\n }\n });\n };\n\n const argsToString = function (args) {\n let out = \"\";\n for (let arg of args) {\n arg = toNative(arg);\n if (typeof arg === \"object\") {\n out += JSON.stringify(arg);\n continue;\n }\n out += `${arg}`;\n }\n\n return out;\n };\n\n const functions = {\n hacknet: {\n numNodes: function () {\n return Player.hacknetNodes.length;\n },\n maxNumNodes: function () {\n if (hasHacknetServers(Player)) {\n return HacknetServerConstants.MaxServers;\n }\n return Infinity;\n },\n purchaseNode: function () {\n return purchaseHacknet(Player);\n },\n getPurchaseNodeCost: function () {\n if (hasHacknetServers(Player)) {\n return getCostOfNextHacknetServer(Player);\n } else {\n return getCostOfNextHacknetNode(Player);\n }\n },\n getNodeStats: function (i) {\n const node = getHacknetNode(i, \"getNodeStats\");\n const hasUpgraded = hasHacknetServers(Player);\n const res = {\n name: hasUpgraded ? node.hostname : node.name,\n level: node.level,\n ram: hasUpgraded ? node.maxRam : node.ram,\n cores: node.cores,\n production: hasUpgraded ? node.hashRate : node.moneyGainRatePerSecond,\n timeOnline: node.onlineTimeSeconds,\n totalProduction: hasUpgraded ? node.totalHashesGenerated : node.totalMoneyGenerated,\n };\n\n if (hasUpgraded) {\n res.cache = node.cache;\n res.hashCapacity = node.hashCapacity;\n }\n\n return res;\n },\n upgradeLevel: function (i, n) {\n const node = getHacknetNode(i, \"upgradeLevel\");\n return purchaseLevelUpgrade(Player, node, n);\n },\n upgradeRam: function (i, n) {\n const node = getHacknetNode(i, \"upgradeRam\");\n return purchaseRamUpgrade(Player, node, n);\n },\n upgradeCore: function (i, n) {\n const node = getHacknetNode(i, \"upgradeCore\");\n return purchaseCoreUpgrade(Player, node, n);\n },\n upgradeCache: function (i, n) {\n if (!hasHacknetServers(Player)) {\n return false;\n }\n const node = getHacknetNode(i, \"upgradeCache\");\n const res = purchaseCacheUpgrade(Player, node, n);\n if (res) {\n updateHashManagerCapacity(Player);\n }\n return res;\n },\n getLevelUpgradeCost: function (i, n) {\n const node = getHacknetNode(i, \"upgradeLevel\");\n return node.calculateLevelUpgradeCost(n, Player.hacknet_node_level_cost_mult);\n },\n getRamUpgradeCost: function (i, n) {\n const node = getHacknetNode(i, \"upgradeRam\");\n return node.calculateRamUpgradeCost(n, Player.hacknet_node_ram_cost_mult);\n },\n getCoreUpgradeCost: function (i, n) {\n const node = getHacknetNode(i, \"upgradeCore\");\n return node.calculateCoreUpgradeCost(n, Player.hacknet_node_core_cost_mult);\n },\n getCacheUpgradeCost: function (i, n) {\n if (!hasHacknetServers(Player)) {\n return Infinity;\n }\n const node = getHacknetNode(i, \"upgradeCache\");\n return node.calculateCacheUpgradeCost(n);\n },\n numHashes: function () {\n if (!hasHacknetServers(Player)) {\n return 0;\n }\n return Player.hashManager.hashes;\n },\n hashCapacity: function () {\n if (!hasHacknetServers(Player)) {\n return 0;\n }\n return Player.hashManager.capacity;\n },\n hashCost: function (upgName) {\n if (!hasHacknetServers(Player)) {\n return Infinity;\n }\n\n return Player.hashManager.getUpgradeCost(upgName);\n },\n spendHashes: function (upgName, upgTarget) {\n if (!hasHacknetServers(Player)) {\n return false;\n }\n return purchaseHashUpgrade(Player, upgName, upgTarget);\n },\n getHashUpgradeLevel: function (upgName) {\n const level = Player.hashManager.upgrades[upgName];\n if (level === undefined) {\n throw makeRuntimeErrorMsg(\"hacknet.hashUpgradeLevel\", `Invalid Hash Upgrade: ${upgName}`);\n }\n return level;\n },\n getStudyMult: function () {\n if (!hasHacknetServers(Player)) {\n return false;\n }\n return Player.hashManager.getStudyMult();\n },\n getTrainingMult: function () {\n if (!hasHacknetServers(Player)) {\n return false;\n }\n return Player.hashManager.getTrainingMult();\n },\n },\n sprintf: sprintf,\n vsprintf: vsprintf,\n scan: function (ip = workerScript.serverIp, hostnames = true) {\n updateDynamicRam(\"scan\", getRamCost(\"scan\"));\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"scan\", `Invalid IP/hostname: ${ip}.`);\n }\n var out = [];\n for (var i = 0; i < server.serversOnNetwork.length; i++) {\n var entry;\n if (hostnames) {\n entry = getServerOnNetwork(server, i).hostname;\n } else {\n entry = getServerOnNetwork(server, i).ip;\n }\n if (entry == null) {\n continue;\n }\n out.push(entry);\n }\n workerScript.log(\"scan\", `returned ${server.serversOnNetwork.length} connections for ${server.hostname}`);\n return out;\n },\n hack: function (ip, { threads: requestedThreads, stock } = {}) {\n updateDynamicRam(\"hack\", getRamCost(\"hack\"));\n return hack(ip, false, { threads: requestedThreads, stock: stock });\n },\n hackAnalyzeThreads: function (ip, hackAmount) {\n updateDynamicRam(\"hackAnalyzeThreads\", getRamCost(\"hackAnalyzeThreads\"));\n\n // Check argument validity\n const server = safeGetServer(ip, \"hackAnalyzeThreads\");\n if (isNaN(hackAmount)) {\n throw makeRuntimeErrorMsg(\n workerScript,\n `Invalid growth argument passed into hackAnalyzeThreads: ${hackAmount}. Must be numeric.`,\n );\n }\n\n if (hackAmount < 0 || hackAmount > server.moneyAvailable) {\n return -1;\n }\n\n const percentHacked = calculatePercentMoneyHacked(server, Player);\n\n return hackAmount / Math.floor(server.moneyAvailable * percentHacked);\n },\n hackAnalyzePercent: function (ip) {\n updateDynamicRam(\"hackAnalyzePercent\", getRamCost(\"hackAnalyzePercent\"));\n\n const server = safeGetServer(ip, \"hackAnalyzePercent\");\n\n return calculatePercentMoneyHacked(server, Player) * 100;\n },\n hackChance: function (ip) {\n updateDynamicRam(\"hackChance\", getRamCost(\"hackChance\"));\n\n const server = safeGetServer(ip, \"hackChance\");\n\n return calculateHackingChance(server, Player);\n },\n sleep: function (time) {\n if (time === undefined) {\n throw makeRuntimeErrorMsg(\"sleep\", \"Takes 1 argument.\");\n }\n workerScript.log(\"sleep\", `Sleeping for ${time} milliseconds`);\n return netscriptDelay(time, workerScript).then(function () {\n return Promise.resolve(true);\n });\n },\n grow: function (ip, { threads: requestedThreads, stock } = {}) {\n updateDynamicRam(\"grow\", getRamCost(\"grow\"));\n const threads = resolveNetscriptRequestedThreads(workerScript, \"grow\", requestedThreads);\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"grow\", \"Takes 1 argument.\");\n }\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"grow\", `Invalid IP/hostname: ${ip}.`);\n }\n\n const host = getServer(workerScript.serverIp);\n\n // No root access or skill level too low\n const canHack = netscriptCanGrow(server);\n if (!canHack.res) {\n throw makeRuntimeErrorMsg(\"grow\", canHack.msg);\n }\n\n var growTime = calculateGrowTime(server, Player);\n workerScript.log(\n \"grow\",\n `Executing on '${server.hostname}' in ${convertTimeMsToTimeElapsedString(\n growTime * 1000,\n true,\n )} (t=${numeralWrapper.formatThreads(threads)}).`,\n );\n return netscriptDelay(growTime * 1000, workerScript).then(function () {\n if (workerScript.env.stopFlag) {\n return Promise.reject(workerScript);\n }\n const moneyBefore = server.moneyAvailable <= 0 ? 1 : server.moneyAvailable;\n server.moneyAvailable += 1 * threads; // It can be grown even if it has no money\n processSingleServerGrowth(server, threads, Player, host.cpuCores);\n const moneyAfter = server.moneyAvailable;\n workerScript.scriptRef.recordGrow(server.ip, threads);\n var expGain = calculateHackingExpGain(server, Player) * threads;\n const logGrowPercent = moneyAfter / moneyBefore - 1;\n workerScript.log(\n \"grow\",\n `Available money on '${server.hostname}' grown by ${numeralWrapper.formatPercentage(\n logGrowPercent,\n 6,\n )}. Gained ${numeralWrapper.formatExp(expGain)} hacking exp (t=${numeralWrapper.formatThreads(threads)}).`,\n );\n workerScript.scriptRef.onlineExpGained += expGain;\n Player.gainHackingExp(expGain);\n if (stock) {\n influenceStockThroughServerGrow(server, moneyAfter - moneyBefore);\n }\n return Promise.resolve(moneyAfter / moneyBefore);\n });\n },\n growthAnalyze: function (ip, growth) {\n updateDynamicRam(\"growthAnalyze\", getRamCost(\"growthAnalyze\"));\n\n // Check argument validity\n const server = safeGetServer(ip, \"growthAnalyze\");\n if (typeof growth !== \"number\" || isNaN(growth) || growth < 1 || !isFinite(growth)) {\n throw makeRuntimeErrorMsg(\"growthAnalyze\", `Invalid argument: growth must be numeric and >= 1, is ${growth}.`);\n }\n\n return numCycleForGrowth(server, Number(growth), Player);\n },\n weaken: function (ip, { threads: requestedThreads } = {}) {\n updateDynamicRam(\"weaken\", getRamCost(\"weaken\"));\n var threads = resolveNetscriptRequestedThreads(workerScript, \"weaken\", requestedThreads);\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"weaken\", \"Takes 1 argument.\");\n }\n const server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"weaken\", `Invalid IP/hostname: ${ip}`);\n }\n\n // No root access or skill level too low\n const canHack = netscriptCanWeaken(server);\n if (!canHack.res) {\n throw makeRuntimeErrorMsg(\"weaken\", canHack.msg);\n }\n\n const weakenTime = calculateWeakenTime(server, Player);\n workerScript.log(\n \"weaken\",\n `Executing on '${server.hostname}' in ${convertTimeMsToTimeElapsedString(\n weakenTime * 1000,\n true,\n )} (t=${numeralWrapper.formatThreads(threads)})`,\n );\n return netscriptDelay(weakenTime * 1000, workerScript).then(function () {\n if (workerScript.env.stopFlag) return Promise.reject(workerScript);\n const host = getServer(workerScript.serverIp);\n const coreBonus = 1 + (host.cpuCores - 1) / 16;\n server.weaken(CONSTANTS.ServerWeakenAmount * threads * coreBonus);\n workerScript.scriptRef.recordWeaken(server.ip, threads);\n const expGain = calculateHackingExpGain(server, Player) * threads;\n workerScript.log(\n \"weaken\",\n `'${server.hostname}' security level weakened to ${server.hackDifficulty}. Gained ${numeralWrapper.formatExp(\n expGain,\n )} hacking exp (t=${numeralWrapper.formatThreads(threads)})`,\n );\n workerScript.scriptRef.onlineExpGained += expGain;\n Player.gainHackingExp(expGain);\n return Promise.resolve(CONSTANTS.ServerWeakenAmount * threads);\n });\n },\n print: function () {\n if (arguments.length === 0) {\n throw makeRuntimeErrorMsg(\"print\", \"Takes at least 1 argument.\");\n }\n workerScript.print(argsToString(arguments));\n },\n tprint: function () {\n if (arguments.length === 0) {\n throw makeRuntimeErrorMsg(\"tprint\", \"Takes at least 1 argument.\");\n }\n Terminal.print(`${workerScript.scriptRef.filename}: ${argsToString(arguments)}`);\n },\n tprintf: function (format, ...args) {\n Terminal.print(vsprintf(format, args));\n },\n clearLog: function () {\n workerScript.scriptRef.clearLog();\n },\n disableLog: function (fn) {\n if (fn === \"ALL\") {\n for (fn in possibleLogs) {\n workerScript.disableLogs[fn] = true;\n }\n workerScript.log(\"disableLog\", `Disabled logging for all functions`);\n } else if (possibleLogs[fn] === undefined) {\n throw makeRuntimeErrorMsg(\"disableLog\", `Invalid argument: ${fn}.`);\n } else {\n workerScript.disableLogs[fn] = true;\n workerScript.log(\"disableLog\", `Disabled logging for ${fn}`);\n }\n },\n enableLog: function (fn) {\n if (possibleLogs[fn] === undefined) {\n throw makeRuntimeErrorMsg(\"enableLog\", `Invalid argument: ${fn}.`);\n }\n delete workerScript.disableLogs[fn];\n workerScript.log(\"enableLog\", `Enabled logging for ${fn}`);\n },\n isLogEnabled: function (fn) {\n if (possibleLogs[fn] === undefined) {\n throw makeRuntimeErrorMsg(\"isLogEnabled\", `Invalid argument: ${fn}.`);\n }\n return workerScript.disableLogs[fn] ? false : true;\n },\n getScriptLogs: function (fn, ip, ...scriptArgs) {\n const runningScriptObj = getRunningScript(fn, ip, \"getScriptLogs\", scriptArgs);\n if (runningScriptObj == null) {\n workerScript.log(\"getScriptLogs\", getCannotFindRunningScriptErrorMessage(fn, ip, scriptArgs));\n return \"\";\n }\n\n return runningScriptObj.logs.slice();\n },\n tail: function (fn, ip = workerScript.serverIp, ...scriptArgs) {\n let runningScriptObj;\n if (arguments.length === 0) {\n runningScriptObj = workerScript.scriptRef;\n } else if (typeof fn === \"number\") {\n runningScriptObj = getRunningScriptByPid(fn, \"tail\");\n } else {\n runningScriptObj = getRunningScript(fn, ip, \"tail\", scriptArgs);\n }\n if (runningScriptObj == null) {\n workerScript.log(\"tail\", getCannotFindRunningScriptErrorMessage(fn, ip, scriptArgs));\n return;\n }\n\n logBoxCreate(runningScriptObj);\n },\n nuke: function (ip) {\n updateDynamicRam(\"nuke\", getRamCost(\"nuke\"));\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"nuke\", \"Takes 1 argument.\");\n }\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"nuke\", `Invalid IP/hostname: ${ip}.`);\n }\n if (!Player.hasProgram(Programs.NukeProgram.name)) {\n throw makeRuntimeErrorMsg(\"nuke\", \"You do not have the NUKE.exe virus!\");\n }\n if (server.openPortCount < server.numOpenPortsRequired) {\n throw makeRuntimeErrorMsg(\"nuke\", \"Not enough ports opened to use NUKE.exe virus.\");\n }\n if (server.hasAdminRights) {\n workerScript.log(\"nuke\", `Already have root access to '${server.hostname}'.`);\n } else {\n server.hasAdminRights = true;\n workerScript.log(\"nuke\", `Executed NUKE.exe virus on '${server.hostname}' to gain root access.`);\n }\n return true;\n },\n brutessh: function (ip) {\n updateDynamicRam(\"brutessh\", getRamCost(\"brutessh\"));\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"brutessh\", \"Takes 1 argument.\");\n }\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"brutessh\", `Invalid IP/hostname: ${ip}.`);\n }\n if (!Player.hasProgram(Programs.BruteSSHProgram.name)) {\n throw makeRuntimeErrorMsg(\"brutessh\", \"You do not have the BruteSSH.exe program!\");\n }\n if (!server.sshPortOpen) {\n workerScript.log(\"brutessh\", `Executed BruteSSH.exe on '${server.hostname}' to open SSH port (22).`);\n server.sshPortOpen = true;\n ++server.openPortCount;\n } else {\n workerScript.log(\"brutessh\", `SSH Port (22) already opened on '${server.hostname}'.`);\n }\n return true;\n },\n ftpcrack: function (ip) {\n updateDynamicRam(\"ftpcrack\", getRamCost(\"ftpcrack\"));\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"ftpcrack\", \"Takes 1 argument.\");\n }\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"ftpcrack\", `Invalid IP/hostname: ${ip}.`);\n }\n if (!Player.hasProgram(Programs.FTPCrackProgram.name)) {\n throw makeRuntimeErrorMsg(\"ftpcrack\", \"You do not have the FTPCrack.exe program!\");\n }\n if (!server.ftpPortOpen) {\n workerScript.log(\"ftpcrack\", `Executed FTPCrack.exe on '${server.hostname}' to open FTP port (21).`);\n server.ftpPortOpen = true;\n ++server.openPortCount;\n } else {\n workerScript.log(\"ftpcrack\", `FTP Port (21) already opened on '${server.hostname}'.`);\n }\n return true;\n },\n relaysmtp: function (ip) {\n updateDynamicRam(\"relaysmtp\", getRamCost(\"relaysmtp\"));\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"relaysmtp\", \"Takes 1 argument.\");\n }\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"relaysmtp\", `Invalid IP/hostname: ${ip}.`);\n }\n if (!Player.hasProgram(Programs.RelaySMTPProgram.name)) {\n throw makeRuntimeErrorMsg(\"relaysmtp\", \"You do not have the relaySMTP.exe program!\");\n }\n if (!server.smtpPortOpen) {\n workerScript.log(\"relaysmtp\", `Executed relaySMTP.exe on '${server.hostname}' to open SMTP port (25).`);\n server.smtpPortOpen = true;\n ++server.openPortCount;\n } else {\n workerScript.log(\"relaysmtp\", `SMTP Port (25) already opened on '${server.hostname}'.`);\n }\n return true;\n },\n httpworm: function (ip) {\n updateDynamicRam(\"httpworm\", getRamCost(\"httpworm\"));\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"httpworm\", \"Takes 1 argument\");\n }\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"httpworm\", `Invalid IP/hostname: ${ip}`);\n }\n if (!Player.hasProgram(Programs.HTTPWormProgram.name)) {\n throw makeRuntimeErrorMsg(\"httpworm\", \"You do not have the HTTPWorm.exe program!\");\n }\n if (!server.httpPortOpen) {\n workerScript.log(\"httpworm\", `Executed HTTPWorm.exe on '${server.hostname}' to open HTTP port (80).`);\n server.httpPortOpen = true;\n ++server.openPortCount;\n } else {\n workerScript.log(\"httpworm\", `HTTP Port (80) already opened on '${server.hostname}'.`);\n }\n return true;\n },\n sqlinject: function (ip) {\n updateDynamicRam(\"sqlinject\", getRamCost(\"sqlinject\"));\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"sqlinject\", \"Takes 1 argument.\");\n }\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"sqlinject\", `Invalid IP/hostname: ${ip}`);\n }\n if (!Player.hasProgram(Programs.SQLInjectProgram.name)) {\n throw makeRuntimeErrorMsg(\"sqlinject\", \"You do not have the SQLInject.exe program!\");\n }\n if (!server.sqlPortOpen) {\n workerScript.log(\"sqlinject\", `Executed SQLInject.exe on '${server.hostname}' to open SQL port (1433).`);\n server.sqlPortOpen = true;\n ++server.openPortCount;\n } else {\n workerScript.log(\"sqlinject\", `SQL Port (1433) already opened on '${server.hostname}'.`);\n }\n return true;\n },\n run: function (scriptname, threads = 1) {\n updateDynamicRam(\"run\", getRamCost(\"run\"));\n if (scriptname === undefined) {\n throw makeRuntimeErrorMsg(\"run\", \"Usage: run(scriptname, [numThreads], [arg1], [arg2]...)\");\n }\n if (isNaN(threads) || threads <= 0) {\n throw makeRuntimeErrorMsg(\"run\", `Invalid thread count. Must be numeric and > 0, is ${threads}`);\n }\n var argsForNewScript = [];\n for (var i = 2; i < arguments.length; ++i) {\n argsForNewScript.push(arguments[i]);\n }\n var scriptServer = getServer(workerScript.serverIp);\n if (scriptServer == null) {\n throw makeRuntimeErrorMsg(\"run\", \"Could not find server. This is a bug. Report to dev.\");\n }\n\n return runScriptFromScript(\"run\", scriptServer, scriptname, argsForNewScript, workerScript, threads);\n },\n exec: function (scriptname, ip, threads = 1) {\n updateDynamicRam(\"exec\", getRamCost(\"exec\"));\n if (scriptname === undefined || ip === undefined) {\n throw makeRuntimeErrorMsg(\"exec\", \"Usage: exec(scriptname, server, [numThreads], [arg1], [arg2]...)\");\n }\n if (isNaN(threads) || threads <= 0) {\n throw makeRuntimeErrorMsg(\"exec\", `Invalid thread count. Must be numeric and > 0, is ${threads}`);\n }\n var argsForNewScript = [];\n for (var i = 3; i < arguments.length; ++i) {\n argsForNewScript.push(arguments[i]);\n }\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"exec\", `Invalid IP/hostname: ${ip}`);\n }\n return runScriptFromScript(\"exec\", server, scriptname, argsForNewScript, workerScript, threads);\n },\n spawn: function (scriptname, threads) {\n updateDynamicRam(\"spawn\", getRamCost(\"spawn\"));\n if (!scriptname || !threads) {\n throw makeRuntimeErrorMsg(\"spawn\", \"Usage: spawn(scriptname, threads)\");\n }\n\n const spawnDelay = 10;\n setTimeoutRef(() => {\n if (isNaN(threads) || threads <= 0) {\n throw makeRuntimeErrorMsg(\"spawn\", `Invalid thread count. Must be numeric and > 0, is ${threads}`);\n }\n var argsForNewScript = [];\n for (var i = 2; i < arguments.length; ++i) {\n argsForNewScript.push(arguments[i]);\n }\n var scriptServer = getServer(workerScript.serverIp);\n if (scriptServer == null) {\n throw makeRuntimeErrorMsg(\"spawn\", \"Could not find server. This is a bug. Report to dev\");\n }\n\n return runScriptFromScript(\"spawn\", scriptServer, scriptname, argsForNewScript, workerScript, threads);\n }, spawnDelay * 1e3);\n\n workerScript.log(\"spawn\", `Will execute '${scriptname}' in ${spawnDelay} seconds`);\n\n workerScript.running = false; // Prevent workerScript from \"finishing execution naturally\"\n if (killWorkerScript(workerScript)) {\n workerScript.log(\"spawn\", \"Exiting...\");\n }\n },\n kill: function (filename, ip, ...scriptArgs) {\n updateDynamicRam(\"kill\", getRamCost(\"kill\"));\n\n let res;\n const killByPid = typeof filename === \"number\";\n if (killByPid) {\n // Kill by pid\n res = killWorkerScript(filename);\n } else {\n // Kill by filename/ip\n if (filename === undefined || ip === undefined) {\n throw makeRuntimeErrorMsg(\"kill\", \"Usage: kill(scriptname, server, [arg1], [arg2]...)\");\n }\n\n const server = safeGetServer(ip);\n const runningScriptObj = getRunningScript(filename, ip, \"kill\", scriptArgs);\n if (runningScriptObj == null) {\n workerScript.log(\"kill\", getCannotFindRunningScriptErrorMessage(filename, ip, scriptArgs));\n return false;\n }\n\n res = killWorkerScript(runningScriptObj, server.ip);\n }\n\n if (res) {\n if (killByPid) {\n workerScript.log(\"kill\", `Killing script with PID ${filename}`);\n } else {\n workerScript.log(\"kill\", `Killing '${filename}' on '${ip}' with args: ${arrayToString(scriptArgs)}.`);\n }\n return true;\n } else {\n if (killByPid) {\n workerScript.log(\"kill\", `No script with PID ${filename}`);\n } else {\n workerScript.log(\"kill\", `No such script '${filename}' on '${ip}' with args: ${arrayToString(scriptArgs)}`);\n }\n return false;\n }\n },\n killall: function (ip = workerScript.serverIp) {\n updateDynamicRam(\"killall\", getRamCost(\"killall\"));\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"killall\", \"Takes 1 argument\");\n }\n const server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"killall\", `Invalid IP/hostname: ${ip}`);\n }\n const scriptsRunning = server.runningScripts.length > 0;\n for (let i = server.runningScripts.length - 1; i >= 0; --i) {\n killWorkerScript(server.runningScripts[i], server.ip, false);\n }\n WorkerScriptStartStopEventEmitter.emit();\n workerScript.log(\n \"killall\",\n `Killing all scripts on '${server.hostname}'. May take a few minutes for the scripts to die.`,\n );\n\n return scriptsRunning;\n },\n exit: function () {\n workerScript.running = false; // Prevent workerScript from \"finishing execution naturally\"\n if (killWorkerScript(workerScript)) {\n workerScript.log(\"exit\", \"Exiting...\");\n } else {\n workerScript.log(\"exit\", \"Failed. This is a bug. Report to dev.\");\n }\n },\n scp: function (scriptname, ip1, ip2) {\n updateDynamicRam(\"scp\", getRamCost(\"scp\"));\n if (arguments.length !== 2 && arguments.length !== 3) {\n throw makeRuntimeErrorMsg(\"scp\", \"Takes 2 or 3 arguments\");\n }\n if (scriptname && scriptname.constructor === Array) {\n // Recursively call scp on all elements of array\n var res = false;\n scriptname.forEach(function (script) {\n if (NetscriptFunctions(workerScript).scp(script, ip1, ip2)) {\n res = true;\n }\n });\n return res;\n }\n\n // Invalid file type\n if (!isValidFilePath(scriptname)) {\n throw makeRuntimeErrorMsg(\"scp\", `Invalid filename: '${scriptname}'`);\n }\n\n // Invalid file name\n if (!scriptname.endsWith(\".lit\") && !isScriptFilename(scriptname) && !scriptname.endsWith(\"txt\")) {\n throw makeRuntimeErrorMsg(\"scp\", \"Only works for .script, .lit, and .txt files\");\n }\n\n var destServer, currServ;\n\n if (ip2 != null) {\n // 3 Argument version: scriptname, source, destination\n if (scriptname === undefined || ip1 === undefined || ip2 === undefined) {\n throw makeRuntimeErrorMsg(\"scp\", \"Takes 2 or 3 arguments\");\n }\n destServer = getServer(ip2);\n if (destServer == null) {\n throw makeRuntimeErrorMsg(\"scp\", `Invalid IP/hostname: ${ip2}`);\n }\n\n currServ = getServer(ip1);\n if (currServ == null) {\n throw makeRuntimeErrorMsg(\"scp\", `Invalid IP/hostname: ${ip1}`);\n }\n } else if (ip1 != null) {\n // 2 Argument version: scriptname, destination\n if (scriptname === undefined || ip1 === undefined) {\n throw makeRuntimeErrorMsg(\"scp\", \"Takes 2 or 3 arguments\");\n }\n destServer = getServer(ip1);\n if (destServer == null) {\n throw makeRuntimeErrorMsg(\"scp\", `Invalid IP/hostname: ${ip1}`);\n }\n\n currServ = getServer(workerScript.serverIp);\n if (currServ == null) {\n throw makeRuntimeErrorMsg(\"scp\", \"Could not find server ip for this script. This is a bug. Report to dev.\");\n }\n } else {\n throw makeRuntimeErrorMsg(\"scp\", \"Takes 2 or 3 arguments\");\n }\n\n // Scp for lit files\n if (scriptname.endsWith(\".lit\")) {\n var found = false;\n for (var i = 0; i < currServ.messages.length; ++i) {\n if (!(currServ.messages[i] instanceof Message) && currServ.messages[i] == scriptname) {\n found = true;\n break;\n }\n }\n\n if (!found) {\n workerScript.log(\"scp\", `File '${scriptname}' does not exist.`);\n return false;\n }\n\n for (var i = 0; i < destServer.messages.length; ++i) {\n if (destServer.messages[i] === scriptname) {\n workerScript.log(\"scp\", `File '${scriptname}' copied over to '${destServer.hostname}'.`);\n return true; // Already exists\n }\n }\n destServer.messages.push(scriptname);\n workerScript.log(\"scp\", `File '${scriptname}' copied over to '${destServer.hostname}'.`);\n return true;\n }\n\n // Scp for text files\n if (scriptname.endsWith(\".txt\")) {\n var found = false,\n txtFile;\n for (var i = 0; i < currServ.textFiles.length; ++i) {\n if (currServ.textFiles[i].fn === scriptname) {\n found = true;\n txtFile = currServ.textFiles[i];\n break;\n }\n }\n\n if (!found) {\n workerScript.log(\"scp\", `File '${scriptname}' does not exist.`);\n return false;\n }\n\n for (var i = 0; i < destServer.textFiles.length; ++i) {\n if (destServer.textFiles[i].fn === scriptname) {\n // Overwrite\n destServer.textFiles[i].text = txtFile.text;\n workerScript.log(\"scp\", `File '${scriptname}' copied over to '${destServer.hostname}'.`);\n return true;\n }\n }\n var newFile = new TextFile(txtFile.fn, txtFile.text);\n destServer.textFiles.push(newFile);\n workerScript.log(\"scp\", `File '${scriptname}' copied over to '${destServer.hostname}'.`);\n return true;\n }\n\n // Scp for script files\n let sourceScript = null;\n for (let i = 0; i < currServ.scripts.length; ++i) {\n if (scriptname == currServ.scripts[i].filename) {\n sourceScript = currServ.scripts[i];\n break;\n }\n }\n if (sourceScript == null) {\n workerScript.log(\"scp\", `File '${scriptname}' does not exist.`);\n return false;\n }\n\n // Overwrite script if it already exists\n for (let i = 0; i < destServer.scripts.length; ++i) {\n if (scriptname == destServer.scripts[i].filename) {\n workerScript.log(\"scp\", `WARNING: File '${scriptname}' overwritten on '${destServer.hostname}'`);\n const oldScript = destServer.scripts[i];\n // If it's the exact same file don't actually perform the\n // copy to avoid recompiling uselessly. Players tend to scp\n // liberally.\n if (oldScript.code === sourceScript.code) return true;\n oldScript.code = sourceScript.code;\n oldScript.ramUsage = sourceScript.ramUsage;\n oldScript.markUpdated();\n return true;\n }\n }\n\n // Create new script if it does not already exist\n const newScript = new Script(scriptname);\n newScript.code = sourceScript.code;\n newScript.ramUsage = sourceScript.ramUsage;\n newScript.server = destServer.ip;\n destServer.scripts.push(newScript);\n workerScript.log(\"scp\", `File '${scriptname}' copied over to '${destServer.hostname}'.`);\n return true;\n },\n ls: function (ip, grep) {\n updateDynamicRam(\"ls\", getRamCost(\"ls\"));\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"ls\", \"Usage: ls(ip/hostname, [grep filter])\");\n }\n const server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"ls\", `Invalid IP/hostname: ${ip}`);\n }\n\n // Get the grep filter, if one exists\n let filter = false;\n if (arguments.length >= 2) {\n filter = grep.toString();\n }\n\n const allFiles = [];\n for (let i = 0; i < server.programs.length; i++) {\n if (filter) {\n if (server.programs[i].includes(filter)) {\n allFiles.push(server.programs[i]);\n }\n } else {\n allFiles.push(server.programs[i]);\n }\n }\n for (let i = 0; i < server.scripts.length; i++) {\n if (filter) {\n if (server.scripts[i].filename.includes(filter)) {\n allFiles.push(server.scripts[i].filename);\n }\n } else {\n allFiles.push(server.scripts[i].filename);\n }\n }\n for (let i = 0; i < server.messages.length; i++) {\n if (filter) {\n if (server.messages[i] instanceof Message) {\n if (server.messages[i].filename.includes(filter)) {\n allFiles.push(server.messages[i].filename);\n }\n } else if (server.messages[i].includes(filter)) {\n allFiles.push(server.messages[i]);\n }\n } else {\n if (server.messages[i] instanceof Message) {\n allFiles.push(server.messages[i].filename);\n } else {\n allFiles.push(server.messages[i]);\n }\n }\n }\n\n for (var i = 0; i < server.textFiles.length; i++) {\n if (filter) {\n if (server.textFiles[i].fn.includes(filter)) {\n allFiles.push(server.textFiles[i].fn);\n }\n } else {\n allFiles.push(server.textFiles[i].fn);\n }\n }\n\n for (var i = 0; i < server.contracts.length; ++i) {\n if (filter) {\n if (server.contracts[i].fn.includes(filter)) {\n allFiles.push(server.contracts[i].fn);\n }\n } else {\n allFiles.push(server.contracts[i].fn);\n }\n }\n\n // Sort the files alphabetically then print each\n allFiles.sort();\n return allFiles;\n },\n ps: function (ip = workerScript.serverIp) {\n updateDynamicRam(\"ps\", getRamCost(\"ps\"));\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"ps\", `Invalid IP/hostname: ${ip}`);\n }\n const processes = [];\n for (const i in server.runningScripts) {\n const script = server.runningScripts[i];\n processes.push({\n filename: script.filename,\n threads: script.threads,\n args: script.args.slice(),\n pid: script.pid,\n });\n }\n return processes;\n },\n hasRootAccess: function (ip) {\n updateDynamicRam(\"hasRootAccess\", getRamCost(\"hasRootAccess\"));\n if (ip === undefined) {\n throw makeRuntimeErrorMsg(\"hasRootAccess\", \"Takes 1 argument\");\n }\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"hasRootAccess\", `Invalid IP/hostname: ${ip}`);\n }\n return server.hasAdminRights;\n },\n getIp: function () {\n updateDynamicRam(\"getIp\", getRamCost(\"getIp\"));\n var scriptServer = getServer(workerScript.serverIp);\n if (scriptServer == null) {\n throw makeRuntimeErrorMsg(\"getIp\", \"Could not find server. This is a bug. Report to dev.\");\n }\n return scriptServer.ip;\n },\n getHostname: function () {\n updateDynamicRam(\"getHostname\", getRamCost(\"getHostname\"));\n var scriptServer = getServer(workerScript.serverIp);\n if (scriptServer == null) {\n throw makeRuntimeErrorMsg(workerScript, \"Could not find server. This is a bug. Report to dev.\");\n }\n return scriptServer.hostname;\n },\n getHackingLevel: function () {\n updateDynamicRam(\"getHackingLevel\", getRamCost(\"getHackingLevel\"));\n Player.updateSkillLevels();\n workerScript.log(\"getHackingLevel\", `returned ${Player.hacking_skill}`);\n return Player.hacking_skill;\n },\n getHackingMultipliers: function () {\n updateDynamicRam(\"getHackingMultipliers\", getRamCost(\"getHackingMultipliers\"));\n return {\n chance: Player.hacking_chance_mult,\n speed: Player.hacking_speed_mult,\n money: Player.hacking_money_mult,\n growth: Player.hacking_grow_mult,\n };\n },\n getHacknetMultipliers: function () {\n updateDynamicRam(\"getHacknetMultipliers\", getRamCost(\"getHacknetMultipliers\"));\n return {\n production: Player.hacknet_node_money_mult,\n purchaseCost: Player.hacknet_node_purchase_cost_mult,\n ramCost: Player.hacknet_node_ram_cost_mult,\n coreCost: Player.hacknet_node_core_cost_mult,\n levelCost: Player.hacknet_node_level_cost_mult,\n };\n },\n getBitNodeMultipliers: function () {\n updateDynamicRam(\"getBitNodeMultipliers\", getRamCost(\"getBitNodeMultipliers\"));\n if (SourceFileFlags[5] <= 0 && Player.bitNodeN !== 5) {\n throw makeRuntimeErrorMsg(\"getBitNodeMultipliers\", \"Requires Source-File 5 to run.\");\n }\n let copy = Object.assign({}, BitNodeMultipliers);\n return copy;\n },\n getServer: function (ip) {\n updateDynamicRam(\"getServer\", getRamCost(\"getServer\"));\n if (SourceFileFlags[5] <= 0 && Player.bitNodeN !== 5) {\n throw makeRuntimeErrorMsg(\"getServer\", \"Requires Source-File 5 to run.\");\n }\n const server = safeGetServer(ip, \"getServer\");\n const copy = Object.assign({}, server);\n // These fields should be hidden.\n copy.contracts = undefined;\n copy.messages = undefined;\n copy.runningScripts = undefined;\n copy.scripts = undefined;\n copy.textFiles = undefined;\n copy.programs = undefined;\n copy.serversOnNetwork = undefined;\n return copy;\n },\n getServerMoneyAvailable: function (ip) {\n updateDynamicRam(\"getServerMoneyAvailable\", getRamCost(\"getServerMoneyAvailable\"));\n const server = safeGetServer(ip, \"getServerMoneyAvailable\");\n if (failOnHacknetServer(server, \"getServerMoneyAvailable\")) {\n return 0;\n }\n if (server.hostname == \"home\") {\n // Return player's money\n workerScript.log(\n \"getServerMoneyAvailable\",\n `returned player's money: ${numeralWrapper.formatMoney(Player.money.toNumber())}`,\n );\n return Player.money.toNumber();\n }\n workerScript.log(\n \"getServerMoneyAvailable\",\n `returned ${numeralWrapper.formatMoney(server.moneyAvailable)} for '${server.hostname}'`,\n );\n return server.moneyAvailable;\n },\n getServerSecurityLevel: function (ip) {\n updateDynamicRam(\"getServerSecurityLevel\", getRamCost(\"getServerSecurityLevel\"));\n const server = safeGetServer(ip, \"getServerSecurityLevel\");\n if (failOnHacknetServer(server, \"getServerSecurityLevel\")) {\n return 1;\n }\n workerScript.log(\n \"getServerSecurityLevel\",\n `returned ${numeralWrapper.formatServerSecurity(server.hackDifficulty, 3)} for '${server.hostname}'`,\n );\n return server.hackDifficulty;\n },\n getServerBaseSecurityLevel: function (ip) {\n updateDynamicRam(\"getServerBaseSecurityLevel\", getRamCost(\"getServerBaseSecurityLevel\"));\n const server = safeGetServer(ip, \"getServerBaseSecurityLevel\");\n if (failOnHacknetServer(server, \"getServerBaseSecurityLevel\")) {\n return 1;\n }\n workerScript.log(\n \"getServerBaseSecurityLevel\",\n `returned ${numeralWrapper.formatServerSecurity(server.baseDifficulty, 3)} for '${server.hostname}'`,\n );\n return server.baseDifficulty;\n },\n getServerMinSecurityLevel: function (ip) {\n updateDynamicRam(\"getServerMinSecurityLevel\", getRamCost(\"getServerMinSecurityLevel\"));\n const server = safeGetServer(ip, \"getServerMinSecurityLevel\");\n if (failOnHacknetServer(server, \"getServerMinSecurityLevel\")) {\n return 1;\n }\n workerScript.log(\n \"getServerMinSecurityLevel\",\n `returned ${numeralWrapper.formatServerSecurity(server.minDifficulty, 3)} for ${server.hostname}`,\n );\n return server.minDifficulty;\n },\n getServerRequiredHackingLevel: function (ip) {\n updateDynamicRam(\"getServerRequiredHackingLevel\", getRamCost(\"getServerRequiredHackingLevel\"));\n const server = safeGetServer(ip, \"getServerRequiredHackingLevel\");\n if (failOnHacknetServer(server, \"getServerRequiredHackingLevel\")) {\n return 1;\n }\n workerScript.log(\n \"getServerRequiredHackingLevel\",\n `returned ${numeralWrapper.formatSkill(server.requiredHackingSkill, 0)} for '${server.hostname}'`,\n );\n return server.requiredHackingSkill;\n },\n getServerMaxMoney: function (ip) {\n updateDynamicRam(\"getServerMaxMoney\", getRamCost(\"getServerMaxMoney\"));\n const server = safeGetServer(ip, \"getServerMaxMoney\");\n if (failOnHacknetServer(server, \"getServerMaxMoney\")) {\n return 0;\n }\n workerScript.log(\n \"getServerMaxMoney\",\n `returned ${numeralWrapper.formatMoney(server.moneyMax)} for '${server.hostname}'`,\n );\n return server.moneyMax;\n },\n getServerGrowth: function (ip) {\n updateDynamicRam(\"getServerGrowth\", getRamCost(\"getServerGrowth\"));\n const server = safeGetServer(ip, \"getServerGrowth\");\n if (failOnHacknetServer(server, \"getServerGrowth\")) {\n return 1;\n }\n workerScript.log(\"getServerGrowth\", `returned ${server.serverGrowth} for '${server.hostname}'`);\n return server.serverGrowth;\n },\n getServerNumPortsRequired: function (ip) {\n updateDynamicRam(\"getServerNumPortsRequired\", getRamCost(\"getServerNumPortsRequired\"));\n const server = safeGetServer(ip, \"getServerNumPortsRequired\");\n if (failOnHacknetServer(server, \"getServerNumPortsRequired\")) {\n return 5;\n }\n workerScript.log(\"getServerNumPortsRequired\", `returned ${server.numOpenPortsRequired} for '${server.hostname}'`);\n return server.numOpenPortsRequired;\n },\n getServerRam: function (ip) {\n updateDynamicRam(\"getServerRam\", getRamCost(\"getServerRam\"));\n const server = safeGetServer(ip, \"getServerRam\");\n workerScript.log(\n \"getServerRam\",\n `returned [${numeralWrapper.formatRAM(server.maxRam, 2)}, ${numeralWrapper.formatRAM(server.ramUsed, 2)}]`,\n );\n return [server.maxRam, server.ramUsed];\n },\n getServerMaxRam: function (ip) {\n updateDynamicRam(\"getServerMaxRam\", getRamCost(\"getServerMaxRam\"));\n const server = safeGetServer(ip, \"getServerMaxRam\");\n workerScript.log(\"getServerMaxRam\", `returned ${numeralWrapper.formatRAM(server.maxRam, 2)}`);\n return server.maxRam;\n },\n getServerUsedRam: function (ip) {\n updateDynamicRam(\"getServerUsedRam\", getRamCost(\"getServerUsedRam\"));\n const server = safeGetServer(ip, \"getServerUsedRam\");\n workerScript.log(\"getServerUsedRam\", `returned ${numeralWrapper.formatRAM(server.ramUsed, 2)}`);\n return server.ramUsed;\n },\n serverExists: function (ip) {\n updateDynamicRam(\"serverExists\", getRamCost(\"serverExists\"));\n return getServer(ip) !== null;\n },\n fileExists: function (filename, ip = workerScript.serverIp) {\n updateDynamicRam(\"fileExists\", getRamCost(\"fileExists\"));\n if (filename === undefined) {\n throw makeRuntimeErrorMsg(\"fileExists\", \"Usage: fileExists(scriptname, [server])\");\n }\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"fileExists\", `Invalid IP/hostname: ${ip}`);\n }\n for (var i = 0; i < server.scripts.length; ++i) {\n if (filename == server.scripts[i].filename) {\n return true;\n }\n }\n for (var i = 0; i < server.programs.length; ++i) {\n if (filename.toLowerCase() == server.programs[i].toLowerCase()) {\n return true;\n }\n }\n for (var i = 0; i < server.messages.length; ++i) {\n if (!(server.messages[i] instanceof Message) && filename.toLowerCase() === server.messages[i]) {\n return true;\n }\n }\n var txtFile = getTextFile(filename, server);\n if (txtFile != null) {\n return true;\n }\n return false;\n },\n isRunning: function (fn, ip = workerScript.serverIp, ...scriptArgs) {\n updateDynamicRam(\"isRunning\", getRamCost(\"isRunning\"));\n if (fn === undefined || ip === undefined) {\n throw makeRuntimeErrorMsg(\"isRunning\", \"Usage: isRunning(scriptname, server, [arg1], [arg2]...)\");\n }\n if (typeof fn === \"number\") {\n return getRunningScriptByPid(fn, \"isRunning\") != null;\n } else {\n return getRunningScript(fn, ip, \"isRunning\", scriptArgs) != null;\n }\n },\n getStockSymbols: function () {\n updateDynamicRam(\"getStockSymbols\", getRamCost(\"getStockSymbols\"));\n checkTixApiAccess(\"getStockSymbols\");\n return Object.values(StockSymbols);\n },\n getStockPrice: function (symbol) {\n updateDynamicRam(\"getStockPrice\", getRamCost(\"getStockPrice\"));\n checkTixApiAccess(\"getStockPrice\");\n const stock = getStockFromSymbol(symbol, \"getStockPrice\");\n\n return stock.price;\n },\n getStockAskPrice: function (symbol) {\n updateDynamicRam(\"getStockAskPrice\", getRamCost(\"getStockAskPrice\"));\n checkTixApiAccess(\"getStockAskPrice\");\n const stock = getStockFromSymbol(symbol, \"getStockAskPrice\");\n\n return stock.getAskPrice();\n },\n getStockBidPrice: function (symbol) {\n updateDynamicRam(\"getStockBidPrice\", getRamCost(\"getStockBidPrice\"));\n checkTixApiAccess(\"getStockBidPrice\");\n const stock = getStockFromSymbol(symbol, \"getStockBidPrice\");\n\n return stock.getBidPrice();\n },\n getStockPosition: function (symbol) {\n updateDynamicRam(\"getStockPosition\", getRamCost(\"getStockPosition\"));\n checkTixApiAccess(\"getStockPosition\");\n var stock = SymbolToStockMap[symbol];\n if (stock == null) {\n throw makeRuntimeErrorMsg(\"getStockPosition\", `Invalid stock symbol: ${symbol}`);\n }\n return [stock.playerShares, stock.playerAvgPx, stock.playerShortShares, stock.playerAvgShortPx];\n },\n getStockMaxShares: function (symbol) {\n updateDynamicRam(\"getStockMaxShares\", getRamCost(\"getStockMaxShares\"));\n checkTixApiAccess(\"getStockMaxShares\");\n const stock = getStockFromSymbol(symbol, \"getStockMaxShares\");\n\n return stock.maxShares;\n },\n getStockPurchaseCost: function (symbol, shares, posType) {\n updateDynamicRam(\"getStockPurchaseCost\", getRamCost(\"getStockPurchaseCost\"));\n checkTixApiAccess(\"getStockPurchaseCost\");\n const stock = getStockFromSymbol(symbol, \"getStockPurchaseCost\");\n shares = Math.round(shares);\n\n let pos;\n const sanitizedPosType = posType.toLowerCase();\n if (sanitizedPosType.includes(\"l\")) {\n pos = PositionTypes.Long;\n } else if (sanitizedPosType.includes(\"s\")) {\n pos = PositionTypes.Short;\n } else {\n return Infinity;\n }\n\n const res = getBuyTransactionCost(stock, shares, pos);\n if (res == null) {\n return Infinity;\n }\n\n return res;\n },\n getStockSaleGain: function (symbol, shares, posType) {\n updateDynamicRam(\"getStockSaleGain\", getRamCost(\"getStockSaleGain\"));\n checkTixApiAccess(\"getStockSaleGain\");\n const stock = getStockFromSymbol(symbol, \"getStockSaleGain\");\n shares = Math.round(shares);\n\n let pos;\n const sanitizedPosType = posType.toLowerCase();\n if (sanitizedPosType.includes(\"l\")) {\n pos = PositionTypes.Long;\n } else if (sanitizedPosType.includes(\"s\")) {\n pos = PositionTypes.Short;\n } else {\n return 0;\n }\n\n const res = getSellTransactionGain(stock, shares, pos);\n if (res == null) {\n return 0;\n }\n\n return res;\n },\n buyStock: function (symbol, shares) {\n updateDynamicRam(\"buyStock\", getRamCost(\"buyStock\"));\n checkTixApiAccess(\"buyStock\");\n const stock = getStockFromSymbol(symbol, \"buyStock\");\n const res = buyStock(stock, shares, workerScript, {});\n return res ? stock.price : 0;\n },\n sellStock: function (symbol, shares) {\n updateDynamicRam(\"sellStock\", getRamCost(\"sellStock\"));\n checkTixApiAccess(\"sellStock\");\n const stock = getStockFromSymbol(symbol, \"sellStock\");\n const res = sellStock(stock, shares, workerScript, {});\n\n return res ? stock.price : 0;\n },\n shortStock: function (symbol, shares) {\n updateDynamicRam(\"shortStock\", getRamCost(\"shortStock\"));\n checkTixApiAccess(\"shortStock\");\n if (Player.bitNodeN !== 8) {\n if (SourceFileFlags[8] <= 1) {\n throw makeRuntimeErrorMsg(\n shortStock,\n \"You must either be in BitNode-8 or you must have Source-File 8 Level 2.\",\n );\n }\n }\n const stock = getStockFromSymbol(symbol, \"shortStock\");\n const res = shortStock(stock, shares, workerScript, {});\n\n return res ? stock.price : 0;\n },\n sellShort: function (symbol, shares) {\n updateDynamicRam(\"sellShort\", getRamCost(\"sellShort\"));\n checkTixApiAccess(\"sellShort\");\n if (Player.bitNodeN !== 8) {\n if (SourceFileFlags[8] <= 1) {\n throw makeRuntimeErrorMsg(\n \"sellShort\",\n \"You must either be in BitNode-8 or you must have Source-File 8 Level 2.\",\n );\n }\n }\n const stock = getStockFromSymbol(symbol, \"sellShort\");\n const res = sellShort(stock, shares, workerScript, {});\n\n return res ? stock.price : 0;\n },\n placeOrder: function (symbol, shares, price, type, pos) {\n updateDynamicRam(\"placeOrder\", getRamCost(\"placeOrder\"));\n checkTixApiAccess(\"placeOrder\");\n if (Player.bitNodeN !== 8) {\n if (SourceFileFlags[8] <= 2) {\n throw makeRuntimeErrorMsg(\n \"placeOrder\",\n \"You must either be in BitNode-8 or you must have Source-File 8 Level 3.\",\n );\n }\n }\n const stock = getStockFromSymbol(symbol, \"placeOrder\");\n\n let orderType, orderPos;\n ltype = type.toLowerCase();\n if (ltype.includes(\"limit\") && ltype.includes(\"buy\")) {\n orderType = OrderTypes.LimitBuy;\n } else if (ltype.includes(\"limit\") && ltype.includes(\"sell\")) {\n orderType = OrderTypes.LimitSell;\n } else if (ltype.includes(\"stop\") && ltype.includes(\"buy\")) {\n orderType = OrderTypes.StopBuy;\n } else if (ltype.includes(\"stop\") && ltype.includes(\"sell\")) {\n orderType = OrderTypes.StopSell;\n } else {\n throw makeRuntimeErrorMsg(\"placeOrder\", `Invalid order type: ${type}`);\n }\n\n lpos = pos.toLowerCase();\n if (lpos.includes(\"l\")) {\n orderPos = PositionTypes.Long;\n } else if (lpos.includes(\"s\")) {\n orderPos = PositionTypes.Short;\n } else {\n throw makeRuntimeErrorMsg(\"placeOrder\", `Invalid position type: ${pos}`);\n }\n\n return placeOrder(stock, shares, price, orderType, orderPos, workerScript);\n },\n cancelOrder: function (symbol, shares, price, type, pos) {\n updateDynamicRam(\"cancelOrder\", getRamCost(\"cancelOrder\"));\n checkTixApiAccess(\"cancelOrder\");\n if (Player.bitNodeN !== 8) {\n if (SourceFileFlags[8] <= 2) {\n throw makeRuntimeErrorMsg(\n \"cancelOrder\",\n \"You must either be in BitNode-8 or you must have Source-File 8 Level 3.\",\n );\n }\n }\n const stock = getStockFrom(symbol, \"cancelOrder\");\n if (isNaN(shares) || isNaN(price)) {\n throw makeRuntimeErrorMsg(\n \"cancelOrder\",\n `Invalid shares or price. Must be numeric. shares=${shares}, price=${price}`,\n );\n }\n var orderType, orderPos;\n ltype = type.toLowerCase();\n if (ltype.includes(\"limit\") && ltype.includes(\"buy\")) {\n orderType = OrderTypes.LimitBuy;\n } else if (ltype.includes(\"limit\") && ltype.includes(\"sell\")) {\n orderType = OrderTypes.LimitSell;\n } else if (ltype.includes(\"stop\") && ltype.includes(\"buy\")) {\n orderType = OrderTypes.StopBuy;\n } else if (ltype.includes(\"stop\") && ltype.includes(\"sell\")) {\n orderType = OrderTypes.StopSell;\n } else {\n throw makeRuntimeErrorMsg(\"cancelOrder\", `Invalid order type: ${type}`);\n }\n\n lpos = pos.toLowerCase();\n if (lpos.includes(\"l\")) {\n orderPos = PositionTypes.Long;\n } else if (lpos.includes(\"s\")) {\n orderPos = PositionTypes.Short;\n } else {\n throw makeRuntimeErrorMsg(\"cancelOrder\", `Invalid position type: ${pos}`);\n }\n var params = {\n stock: stock,\n shares: shares,\n price: price,\n type: orderType,\n pos: orderPos,\n };\n return cancelOrder(params, workerScript);\n },\n getOrders: function () {\n updateDynamicRam(\"getOrders\", getRamCost(\"getOrders\"));\n checkTixApiAccess(\"getOrders\");\n if (Player.bitNodeN !== 8) {\n if (SourceFileFlags[8] <= 2) {\n throw makeRuntimeErrorMsg(workerScript, \"You must either be in BitNode-8 or have Source-File 8 Level 3.\");\n }\n }\n\n const orders = {};\n\n const stockMarketOrders = StockMarket[\"Orders\"];\n for (let symbol in stockMarketOrders) {\n const orderBook = stockMarketOrders[symbol];\n if (orderBook.constructor === Array && orderBook.length > 0) {\n orders[symbol] = [];\n for (let i = 0; i < orderBook.length; ++i) {\n orders[symbol].push({\n shares: orderBook[i].shares,\n price: orderBook[i].price,\n type: orderBook[i].type,\n position: orderBook[i].pos,\n });\n }\n }\n }\n\n return orders;\n },\n getStockVolatility: function (symbol) {\n updateDynamicRam(\"getStockVolatility\", getRamCost(\"getStockVolatility\"));\n if (!Player.has4SDataTixApi) {\n throw makeRuntimeErrorMsg(\"getStockVolatility\", \"You don't have 4S Market Data TIX API Access!\");\n }\n const stock = getStockFromSymbol(symbol, \"getStockVolatility\");\n\n return stock.mv / 100; // Convert from percentage to decimal\n },\n getStockForecast: function (symbol) {\n updateDynamicRam(\"getStockForecast\", getRamCost(\"getStockForecast\"));\n if (!Player.has4SDataTixApi) {\n throw makeRuntimeErrorMsg(\"getStockForecast\", \"You don't have 4S Market Data TIX API Access!\");\n }\n const stock = getStockFromSymbol(symbol, \"getStockForecast\");\n\n var forecast = 50;\n stock.b ? (forecast += stock.otlkMag) : (forecast -= stock.otlkMag);\n return forecast / 100; // Convert from percentage to decimal\n },\n purchase4SMarketData: function () {\n updateDynamicRam(\"purchase4SMarketData\", getRamCost(\"purchase4SMarketData\"));\n checkTixApiAccess(\"purchase4SMarketData\");\n\n if (Player.has4SData) {\n workerScript.log(\"purchase4SMarketData\", \"Already purchased 4S Market Data.\");\n return true;\n }\n\n if (Player.money.lt(getStockMarket4SDataCost())) {\n workerScript.log(\"purchase4SMarketData\", \"Not enough money to purchase 4S Market Data.\");\n return false;\n }\n\n Player.has4SData = true;\n Player.loseMoney(getStockMarket4SDataCost());\n workerScript.log(\"purchase4SMarketData\", \"Purchased 4S Market Data\");\n return true;\n },\n purchase4SMarketDataTixApi: function () {\n updateDynamicRam(\"purchase4SMarketDataTixApi\", getRamCost(\"purchase4SMarketDataTixApi\"));\n checkTixApiAccess(\"purchase4SMarketDataTixApi\");\n\n if (Player.has4SDataTixApi) {\n workerScript.log(\"purchase4SMarketDataTixApi\", \"Already purchased 4S Market Data TIX API\");\n return true;\n }\n\n if (Player.money.lt(getStockMarket4STixApiCost())) {\n workerScript.log(\"purchase4SMarketDataTixApi\", \"Not enough money to purchase 4S Market Data TIX API\");\n return false;\n }\n\n Player.has4SDataTixApi = true;\n Player.loseMoney(getStockMarket4STixApiCost());\n workerScript.log(\"purchase4SMarketDataTixApi\", \"Purchased 4S Market Data TIX API\");\n return true;\n },\n getPurchasedServerLimit: function () {\n updateDynamicRam(\"getPurchasedServerLimit\", getRamCost(\"getPurchasedServerLimit\"));\n\n return getPurchaseServerLimit();\n },\n getPurchasedServerMaxRam: function () {\n updateDynamicRam(\"getPurchasedServerMaxRam\", getRamCost(\"getPurchasedServerMaxRam\"));\n\n return getPurchaseServerMaxRam();\n },\n getPurchasedServerCost: function (ram) {\n updateDynamicRam(\"getPurchasedServerCost\", getRamCost(\"getPurchasedServerCost\"));\n\n const cost = getPurchaseServerCost(ram);\n if (cost === Infinity) {\n workerScript.log(\"getPurchasedServerCost\", `Invalid argument: ram='${ram}'`);\n return Infinity;\n }\n\n return cost;\n },\n purchaseServer: function (hostname, ram) {\n updateDynamicRam(\"purchaseServer\", getRamCost(\"purchaseServer\"));\n var hostnameStr = String(hostname);\n hostnameStr = hostnameStr.replace(/\\s+/g, \"\");\n if (hostnameStr == \"\") {\n workerScript.log(\"purchaseServer\", `Invalid argument: hostname='${hostnameStr}'`);\n return \"\";\n }\n\n if (Player.purchasedServers.length >= getPurchaseServerLimit()) {\n workerScript.log(\n \"purchaseServer\",\n `You have reached the maximum limit of ${getPurchaseServerLimit()} servers. You cannot purchase any more.`,\n );\n return \"\";\n }\n\n const cost = getPurchaseServerCost(ram);\n if (cost === Infinity) {\n workerScript.log(\"purchaseServer\", `Invalid argument: ram='${ram}'`);\n return \"\";\n }\n\n if (Player.money.lt(cost)) {\n workerScript.log(\n \"purchaseServer\",\n `Not enough money to purchase server. Need ${numeralWrapper.formatMoney(cost)}`,\n );\n return \"\";\n }\n var newServ = safetlyCreateUniqueServer({\n ip: createUniqueRandomIp(),\n hostname: hostnameStr,\n organizationName: \"\",\n isConnectedTo: false,\n adminRights: true,\n purchasedByPlayer: true,\n maxRam: ram,\n });\n AddToAllServers(newServ);\n\n Player.purchasedServers.push(newServ.ip);\n var homeComputer = Player.getHomeComputer();\n homeComputer.serversOnNetwork.push(newServ.ip);\n newServ.serversOnNetwork.push(homeComputer.ip);\n Player.loseMoney(cost);\n workerScript.log(\n \"purchaseServer\",\n `Purchased new server with hostname '${newServ.hostname}' for ${numeralWrapper.formatMoney(cost)}`,\n );\n return newServ.hostname;\n },\n deleteServer: function (hostname) {\n updateDynamicRam(\"deleteServer\", getRamCost(\"deleteServer\"));\n var hostnameStr = String(hostname);\n hostnameStr = hostnameStr.replace(/\\s\\s+/g, \"\");\n var server = GetServerByHostname(hostnameStr);\n if (server == null) {\n workerScript.log(\"deleteServer\", `Invalid argument: hostname='${hostnameStr}'`);\n return false;\n }\n\n if (!server.purchasedByPlayer || server.hostname === \"home\") {\n workerScript.log(\"deleteServer\", \"Cannot delete non-purchased server.\");\n return false;\n }\n\n var ip = server.ip;\n\n // Can't delete server you're currently connected to\n if (server.isConnectedTo) {\n workerScript.log(\"deleteServer\", \"You are currently connected to the server you are trying to delete.\");\n return false;\n }\n\n // A server cannot delete itself\n if (ip === workerScript.serverIp) {\n workerScript.log(\"deleteServer\", \"Cannot delete the server this script is running on.\");\n return false;\n }\n\n // Delete all scripts running on server\n if (server.runningScripts.length > 0) {\n workerScript.log(\n \"deleteServer\",\n `Cannot delete server '${server.hostname}' because it still has scripts running.`,\n );\n return false;\n }\n\n // Delete from player's purchasedServers array\n var found = false;\n for (var i = 0; i < Player.purchasedServers.length; ++i) {\n if (ip == Player.purchasedServers[i]) {\n found = true;\n Player.purchasedServers.splice(i, 1);\n break;\n }\n }\n\n if (!found) {\n workerScript.log(\n \"deleteServer\",\n `Could not identify server ${server.hostname} as a purchased server. This is a bug. Report to dev.`,\n );\n return false;\n }\n\n // Delete from all servers\n delete AllServers[ip];\n\n // Delete from home computer\n found = false;\n var homeComputer = Player.getHomeComputer();\n for (var i = 0; i < homeComputer.serversOnNetwork.length; ++i) {\n if (ip == homeComputer.serversOnNetwork[i]) {\n homeComputer.serversOnNetwork.splice(i, 1);\n workerScript.log(\"deleteServer\", `Deleted server '${hostnameStr}`);\n return true;\n }\n }\n // Wasn't found on home computer\n workerScript.log(\n \"deleteServer\",\n `Could not find server ${server.hostname} as a purchased server. This is a bug. Report to dev.`,\n );\n return false;\n },\n getPurchasedServers: function (hostname = true) {\n updateDynamicRam(\"getPurchasedServers\", getRamCost(\"getPurchasedServers\"));\n var res = [];\n Player.purchasedServers.forEach(function (ip) {\n if (hostname) {\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"getPurchasedServers\", \"Could not find server. This is a bug. Report to dev.\");\n }\n res.push(server.hostname);\n } else {\n res.push(ip);\n }\n });\n return res;\n },\n write: function (port, data = \"\", mode = \"a\") {\n updateDynamicRam(\"write\", getRamCost(\"write\"));\n if (!isNaN(port)) {\n // Write to port\n // Port 1-10\n port = Math.round(port);\n if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {\n throw makeRuntimeErrorMsg(\n \"write\",\n `Trying to write to invalid port: ${port}. Only ports 1-${CONSTANTS.NumNetscriptPorts} are valid.`,\n );\n }\n var port = NetscriptPorts[port - 1];\n if (port == null || !(port instanceof Object)) {\n throw makeRuntimeErrorMsg(\"write\", `Could not find port: ${port}. This is a bug. Report to dev.`);\n }\n return port.write(data);\n } else if (isString(port)) {\n // Write to script or text file\n let fn = port;\n if (!isValidFilePath(fn)) {\n throw makeRuntimeErrorMsg(\"write\", `Invalid filepath: ${fn}`);\n }\n\n if (fn.lastIndexOf(\"/\") === 0) {\n fn = removeLeadingSlash(fn);\n }\n\n // Coerce 'data' to be a string\n try {\n data = String(data);\n } catch (e) {\n throw makeRuntimeErrorMsg(\"write\", `Invalid data (${e}). Data being written must be convertible to a string`);\n }\n\n const server = workerScript.getServer();\n if (server == null) {\n throw makeRuntimeErrorMsg(\"write\", \"Error getting Server. This is a bug. Report to dev.\");\n }\n if (isScriptFilename(fn)) {\n // Write to script\n let script = workerScript.getScriptOnServer(fn);\n if (script == null) {\n // Create a new script\n script = new Script(fn, data, server.ip, server.scripts);\n server.scripts.push(script);\n return true;\n }\n mode === \"w\" ? (script.code = data) : (script.code += data);\n script.updateRamUsage(server.scripts);\n script.markUpdated();\n } else {\n // Write to text file\n let txtFile = getTextFile(fn, server);\n if (txtFile == null) {\n txtFile = createTextFile(fn, data, server);\n return true;\n }\n if (mode === \"w\") {\n txtFile.write(data);\n } else {\n txtFile.append(data);\n }\n }\n return true;\n } else {\n throw makeRuntimeErrorMsg(\"write\", `Invalid argument: ${port}`);\n }\n },\n tryWrite: function (port, data = \"\") {\n updateDynamicRam(\"tryWrite\", getRamCost(\"tryWrite\"));\n if (!isNaN(port)) {\n port = Math.round(port);\n if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {\n throw makeRuntimeErrorMsg(\n \"tryWrite\",\n `Invalid port: ${port}. Only ports 1-${CONSTANTS.NumNetscriptPorts} are valid.`,\n );\n }\n var port = NetscriptPorts[port - 1];\n if (port == null || !(port instanceof Object)) {\n throw makeRuntimeErrorMsg(\"tryWrite\", `Could not find port: ${port}. This is a bug. Report to dev.`);\n }\n return port.tryWrite(data);\n } else {\n throw makeRuntimeErrorMsg(\"tryWrite\", `Invalid argument: ${port}`);\n }\n },\n read: function (port) {\n updateDynamicRam(\"read\", getRamCost(\"read\"));\n if (!isNaN(port)) {\n // Read from port\n // Port 1-10\n port = Math.round(port);\n if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {\n throw makeRuntimeErrorMsg(\n \"read\",\n `Invalid port: ${port}. Only ports 1-${CONSTANTS.NumNetscriptPorts} are valid.`,\n );\n }\n var port = NetscriptPorts[port - 1];\n if (port == null || !(port instanceof Object)) {\n throw makeRuntimeErrorMsg(\"read\", `Could not find port: ${port}. This is a bug. Report to dev.`);\n }\n return port.read();\n } else if (isString(port)) {\n // Read from script or text file\n let fn = port;\n let server = getServer(workerScript.serverIp);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"read\", \"Error getting Server. This is a bug. Report to dev.\");\n }\n if (isScriptFilename(fn)) {\n // Read from script\n let script = workerScript.getScriptOnServer(fn);\n if (script == null) {\n return \"\";\n }\n return script.code;\n } else {\n // Read from text file\n let txtFile = getTextFile(fn, server);\n if (txtFile !== null) {\n return txtFile.text;\n } else {\n return \"\";\n }\n }\n } else {\n throw makeRuntimeErrorMsg(\"read\", `Invalid argument: ${port}`);\n }\n },\n peek: function (port) {\n updateDynamicRam(\"peek\", getRamCost(\"peek\"));\n if (isNaN(port)) {\n throw makeRuntimeErrorMsg(\n \"peek\",\n `Invalid argument. Must be a port number between 1 and ${CONSTANTS.NumNetscriptPorts}, is ${port}`,\n );\n }\n port = Math.round(port);\n if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {\n throw makeRuntimeErrorMsg(\n \"peek\",\n `Invalid argument. Must be a port number between 1 and ${CONSTANTS.NumNetscriptPorts}, is ${port}`,\n );\n }\n var port = NetscriptPorts[port - 1];\n if (port == null || !(port instanceof Object)) {\n throw makeRuntimeErrorMsg(\"peek\", `Could not find port: ${port}. This is a bug. Report to dev.`);\n }\n return port.peek();\n },\n clear: function (port) {\n updateDynamicRam(\"clear\", getRamCost(\"clear\"));\n if (!isNaN(port)) {\n // Clear port\n port = Math.round(port);\n if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {\n throw makeRuntimeErrorMsg(\n \"clear\",\n `Trying to clear invalid port: ${port}. Only ports 1-${CONSTANTS.NumNetscriptPorts} are valid`,\n );\n }\n var port = NetscriptPorts[port - 1];\n if (port == null || !(port instanceof Object)) {\n throw makeRuntimeErrorMsg(\"clear\", `Could not find port: ${port}. This is a bug. Report to dev.`);\n }\n return port.clear();\n } else if (isString(port)) {\n // Clear text file\n var fn = port;\n var server = getServer(workerScript.serverIp);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"clear\", \"Error getting Server. This is a bug. Report to dev.\");\n }\n var txtFile = getTextFile(fn, server);\n if (txtFile != null) {\n txtFile.write(\"\");\n }\n } else {\n throw makeRuntimeErrorMsg(\"clear\", `Invalid argument: ${port}`);\n }\n return 0;\n },\n getPortHandle: function (port) {\n updateDynamicRam(\"getPortHandle\", getRamCost(\"getPortHandle\"));\n if (isNaN(port)) {\n throw makeRuntimeErrorMsg(\n \"getPortHandle\",\n `Invalid port: ${port} Must be an integer between 1 and ${CONSTANTS.NumNetscriptPorts}.`,\n );\n }\n port = Math.round(port);\n if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {\n throw makeRuntimeErrorMsg(\n \"getPortHandle\",\n `Invalid port: ${port}. Only ports 1-${CONSTANTS.NumNetscriptPorts} are valid.`,\n );\n }\n var port = NetscriptPorts[port - 1];\n if (port == null || !(port instanceof Object)) {\n throw makeRuntimeErrorMsg(\"getPortHandle\", `Could not find port: ${port}. This is a bug. Report to dev.`);\n }\n return port;\n },\n rm: function (fn, ip) {\n updateDynamicRam(\"rm\", getRamCost(\"rm\"));\n\n if (ip == null || ip === \"\") {\n ip = workerScript.serverIp;\n }\n const s = safeGetServer(ip, \"rm\");\n\n const status = s.removeFile(fn);\n if (!status.res) {\n workerScript.log(\"rm\", status.msg);\n }\n\n return status.res;\n },\n scriptRunning: function (scriptname, ip) {\n updateDynamicRam(\"scriptRunning\", getRamCost(\"scriptRunning\"));\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"scriptRunning\", `Invalid IP/hostname: ${ip}`);\n }\n for (var i = 0; i < server.runningScripts.length; ++i) {\n if (server.runningScripts[i].filename == scriptname) {\n return true;\n }\n }\n return false;\n },\n scriptKill: function (scriptname, ip) {\n updateDynamicRam(\"scriptKill\", getRamCost(\"scriptKill\"));\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"scriptKill\", `Invalid IP/hostname: ${ip}`);\n }\n var suc = false;\n for (var i = 0; i < server.runningScripts.length; ++i) {\n if (server.runningScripts[i].filename == scriptname) {\n killWorkerScript(server.runningScripts[i], server.ip);\n suc = true;\n }\n }\n return suc;\n },\n getScriptName: function () {\n return workerScript.name;\n },\n getScriptRam: function (scriptname, ip = workerScript.serverIp) {\n updateDynamicRam(\"getScriptRam\", getRamCost(\"getScriptRam\"));\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"getScriptRam\", `Invalid IP/hostname: ${ip}`);\n }\n for (var i = 0; i < server.scripts.length; ++i) {\n if (server.scripts[i].filename == scriptname) {\n return server.scripts[i].ramUsage;\n }\n }\n return 0;\n },\n getRunningScript: function (fn, ip) {\n updateDynamicRam(\"getRunningScript\", getRamCost(\"getRunningScript\"));\n\n let runningScript;\n if (arguments.length === 0) {\n runningScript = workerScript.scriptRef;\n } else if (typeof fn === \"number\") {\n runningScript = getRunningScriptByPid(fn, \"getRunningScript\");\n } else {\n const scriptArgs = [];\n for (var i = 2; i < arguments.length; ++i) {\n scriptArgs.push(arguments[i]);\n }\n runningScript = getRunningScript(fn, ip, \"getRunningScript\", scriptArgs);\n }\n if (runningScript === null) return null;\n return {\n args: runningScript.args.slice(),\n filename: runningScript.filename,\n logs: runningScript.logs.slice(),\n offlineExpGained: runningScript.offlineExpGained,\n offlineMoneyMade: runningScript.offlineMoneyMade,\n offlineRunningTime: runningScript.offlineRunningTime,\n onlineExpGained: runningScript.onlineExpGained,\n onlineMoneyMade: runningScript.onlineMoneyMade,\n onlineRunningTime: runningScript.onlineRunningTime,\n pid: runningScript.pid,\n ramUsage: runningScript.ramUsage,\n server: runningScript.server,\n threads: runningScript.threads,\n };\n },\n getHackTime: function (ip) {\n updateDynamicRam(\"getHackTime\", getRamCost(\"getHackTime\"));\n const server = safeGetServer(ip, \"getHackTime\");\n if (failOnHacknetServer(server, \"getHackTime\")) {\n return Infinity;\n }\n\n return calculateHackingTime(server, Player); // Returns seconds\n },\n getGrowTime: function (ip) {\n updateDynamicRam(\"getGrowTime\", getRamCost(\"getGrowTime\"));\n const server = safeGetServer(ip, \"getGrowTime\");\n if (failOnHacknetServer(server, \"getGrowTime\")) {\n return Infinity;\n }\n\n return calculateGrowTime(server, Player); // Returns seconds\n },\n getWeakenTime: function (ip) {\n updateDynamicRam(\"getWeakenTime\", getRamCost(\"getWeakenTime\"));\n const server = safeGetServer(ip, \"getWeakenTime\");\n if (failOnHacknetServer(server, \"getWeakenTime\")) {\n return Infinity;\n }\n\n return calculateWeakenTime(server, Player); // Returns seconds\n },\n getScriptIncome: function (scriptname, ip) {\n updateDynamicRam(\"getScriptIncome\", getRamCost(\"getScriptIncome\"));\n if (arguments.length === 0) {\n var res = [];\n\n // First element is total income of all currently running scripts\n let total = 0;\n for (const script of workerScripts.values()) {\n total += script.scriptRef.onlineMoneyMade / script.scriptRef.onlineRunningTime;\n }\n res.push(total);\n\n // Second element is total income you've earned from scripts since you installed Augs\n res.push(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug / 1000));\n return res;\n } else {\n // Get income for a particular script\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"getScriptIncome\", `Invalid IP/hostnamed: ${ip}`);\n }\n var argsForScript = [];\n for (var i = 2; i < arguments.length; ++i) {\n argsForScript.push(arguments[i]);\n }\n var runningScriptObj = findRunningScript(scriptname, argsForScript, server);\n if (runningScriptObj == null) {\n workerScript.log(\n \"getScriptIncome\",\n `No such script '${scriptname}' on '${server.hostname}' with args: ${arrayToString(argsForScript)}`,\n );\n return -1;\n }\n return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime;\n }\n },\n getScriptExpGain: function (scriptname, ip) {\n updateDynamicRam(\"getScriptExpGain\", getRamCost(\"getScriptExpGain\"));\n if (arguments.length === 0) {\n var total = 0;\n for (const ws of workerScripts.values()) {\n total += ws.scriptRef.onlineExpGained / ws.scriptRef.onlineRunningTime;\n }\n return total;\n } else {\n // Get income for a particular script\n var server = getServer(ip);\n if (server == null) {\n throw makeRuntimeErrorMsg(\"getScriptExpGain\", `Invalid IP/hostnamed: ${ip}`);\n }\n var argsForScript = [];\n for (var i = 2; i < arguments.length; ++i) {\n argsForScript.push(arguments[i]);\n }\n var runningScriptObj = findRunningScript(scriptname, argsForScript, server);\n if (runningScriptObj == null) {\n workerScript.log(\n \"getScriptExpGain\",\n `No such script '${scriptname}' on '${server.hostname}' with args: ${arrayToString(argsForScript)}`,\n );\n return -1;\n }\n return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime;\n }\n },\n nFormat: function (n, format) {\n if (isNaN(n) || isNaN(parseFloat(n)) || typeof format !== \"string\") {\n return \"\";\n }\n\n return numeralWrapper.format(parseFloat(n), format);\n },\n tFormat: function (milliseconds, milliPrecision = false) {\n return convertTimeMsToTimeElapsedString(milliseconds, milliPrecision);\n },\n getTimeSinceLastAug: function () {\n updateDynamicRam(\"getTimeSinceLastAug\", getRamCost(\"getTimeSinceLastAug\"));\n return Player.playtimeSinceLastAug;\n },\n prompt: function (txt) {\n if (!isString(txt)) {\n txt = JSON.stringify(txt);\n }\n\n // The id for this popup will consist of the first 20 characters of the prompt string..\n // Thats hopefully good enough to be unique\n const popupId = `prompt-popup-${txt.slice(0, 20)}`;\n const textElement = createElement(\"p\", { innerHTML: txt });\n\n return new Promise(function (resolve) {\n const yesBtn = createElement(\"button\", {\n class: \"popup-box-button\",\n innerText: \"Yes\",\n clickListener: () => {\n removeElementById(popupId);\n resolve(true);\n },\n });\n\n const noBtn = createElement(\"button\", {\n class: \"popup-box-button\",\n innerText: \"No\",\n clickListener: () => {\n removeElementById(popupId);\n resolve(false);\n },\n });\n\n createPopup(popupId, [textElement, yesBtn, noBtn]);\n });\n },\n wget: async function (url, target, ip = workerScript.serverIp) {\n if (!isScriptFilename(target) && !target.endsWith(\".txt\")) {\n workerScript.log(\"wget\", `Invalid target file: '${target}'. Must be a script or text file.`);\n return Promise.resolve(false);\n }\n var s = safeGetServer(ip, \"wget\");\n return new Promise(function (resolve) {\n $.get(\n url,\n function (data) {\n let res;\n if (isScriptFilename(target)) {\n res = s.writeToScriptFile(target, data);\n } else {\n res = s.writeToTextFile(target, data);\n }\n if (!res.success) {\n workerScript.log(\"wget\", \"Failed.\");\n return resolve(false);\n }\n if (res.overwritten) {\n workerScript.log(\"wget\", `Successfully retrieved content and overwrote '${target}' on '${ip}'`);\n return resolve(true);\n }\n workerScript.log(\"wget\", `Successfully retrieved content to new file '${target}' on '${ip}'`);\n return resolve(true);\n },\n \"text\",\n ).fail(function (e) {\n workerScript.log(\"wget\", JSON.stringify(e));\n return resolve(false);\n });\n });\n },\n getFavorToDonate: function () {\n updateDynamicRam(\"getFavorToDonate\", getRamCost(\"getFavorToDonate\"));\n return Math.floor(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction);\n },\n\n /* Singularity Functions */\n universityCourse: function (universityName, className) {\n updateDynamicRam(\"universityCourse\", getRamCost(\"universityCourse\"));\n checkSingularityAccess(\"universityCourse\", 1);\n if (inMission) {\n workerScript.log(\"universityCourse\", \"You are in the middle of a mission.\");\n return;\n }\n if (Player.isWorking) {\n var txt = Player.singularityStopWork();\n workerScript.log(\"universityCourse\", txt);\n }\n\n var costMult, expMult;\n switch (universityName.toLowerCase()) {\n case LocationName.AevumSummitUniversity.toLowerCase():\n if (Player.city != CityName.Aevum) {\n workerScript.log(\n \"universityCourse\",\n \"You cannot study at 'Summit University' because you are not in 'Aevum'.\",\n );\n return false;\n }\n Player.gotoLocation(LocationName.AevumSummitUniversity);\n costMult = 4;\n expMult = 3;\n break;\n case LocationName.Sector12RothmanUniversity.toLowerCase():\n if (Player.city != CityName.Sector12) {\n workerScript.log(\n \"universityCourse\",\n \"You cannot study at 'Rothman University' because you are not in 'Sector-12'.\",\n );\n return false;\n }\n Player.location = LocationName.Sector12RothmanUniversity;\n costMult = 3;\n expMult = 2;\n break;\n case LocationName.VolhavenZBInstituteOfTechnology.toLowerCase():\n if (Player.city != CityName.Volhaven) {\n workerScript.log(\n \"universityCourse\",\n \"You cannot study at 'ZB Institute of Technology' because you are not in 'Volhaven'.\",\n );\n return false;\n }\n Player.location = LocationName.VolhavenZBInstituteOfTechnology;\n costMult = 5;\n expMult = 4;\n break;\n default:\n workerScript.log(\"universityCourse\", `Invalid university name: '${universityName}'.`);\n return false;\n }\n\n var task;\n switch (className.toLowerCase()) {\n case \"Study Computer Science\".toLowerCase():\n task = CONSTANTS.ClassStudyComputerScience;\n break;\n case \"Data Structures\".toLowerCase():\n task = CONSTANTS.ClassDataStructures;\n break;\n case \"Networks\".toLowerCase():\n task = CONSTANTS.ClassNetworks;\n break;\n case \"Algorithms\".toLowerCase():\n task = CONSTANTS.ClassAlgorithms;\n break;\n case \"Management\".toLowerCase():\n task = CONSTANTS.ClassManagement;\n break;\n case \"Leadership\".toLowerCase():\n task = CONSTANTS.ClassLeadership;\n break;\n default:\n workerScript.log(\"universityCourse\", `Invalid class name: ${className}.`);\n return false;\n }\n Player.startClass(Router, costMult, expMult, task);\n workerScript.log(\"universityCourse\", `Started ${task} at ${universityName}`);\n return true;\n },\n\n gymWorkout: function (gymName, stat) {\n updateDynamicRam(\"gymWorkout\", getRamCost(\"gymWorkout\"));\n checkSingularityAccess(\"gymWorkout\", 1);\n if (inMission) {\n workerScript.log(\"gymWorkout\", \"You are in the middle of a mission.\");\n return;\n }\n if (Player.isWorking) {\n var txt = Player.singularityStopWork();\n workerScript.log(\"gymWorkout\", txt);\n }\n var costMult, expMult;\n switch (gymName.toLowerCase()) {\n case LocationName.AevumCrushFitnessGym.toLowerCase():\n if (Player.city != CityName.Aevum) {\n workerScript.log(\"gymWorkout\", \"You cannot workout at 'Crush Fitness' because you are not in 'Aevum'.\");\n return false;\n }\n Player.location = LocationName.AevumCrushFitnessGym;\n costMult = 3;\n expMult = 2;\n break;\n case LocationName.AevumSnapFitnessGym.toLowerCase():\n if (Player.city != CityName.Aevum) {\n workerScript.log(\"gymWorkout\", \"You cannot workout at 'Snap Fitness' because you are not in 'Aevum'.\");\n return false;\n }\n Player.location = LocationName.AevumSnapFitnessGym;\n costMult = 10;\n expMult = 5;\n break;\n case LocationName.Sector12IronGym.toLowerCase():\n if (Player.city != CityName.Sector12) {\n workerScript.log(\"gymWorkout\", \"You cannot workout at 'Iron Gym' because you are not in 'Sector-12'.\");\n return false;\n }\n Player.location = LocationName.Sector12IronGym;\n costMult = 1;\n expMult = 1;\n break;\n case LocationName.Sector12PowerhouseGym.toLowerCase():\n if (Player.city != CityName.Sector12) {\n workerScript.log(\n \"gymWorkout\",\n \"You cannot workout at 'Powerhouse Gym' because you are not in 'Sector-12'.\",\n );\n return false;\n }\n Player.location = LocationName.Sector12PowerhouseGym;\n costMult = 20;\n expMult = 10;\n break;\n case LocationName.VolhavenMilleniumFitnessGym.toLowerCase():\n if (Player.city != CityName.Volhaven) {\n workerScript.log(\n \"gymWorkout\",\n \"You cannot workout at 'Millenium Fitness Gym' because you are not in 'Volhaven'.\",\n );\n return false;\n }\n Player.location = LocationName.VolhavenMilleniumFitnessGym;\n costMult = 7;\n expMult = 4;\n break;\n default:\n workerScript.log(\"gymWorkout\", `Invalid gym name: ${gymName}. gymWorkout() failed`);\n return false;\n }\n\n switch (stat.toLowerCase()) {\n case \"strength\".toLowerCase():\n case \"str\".toLowerCase():\n Player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymStrength);\n break;\n case \"defense\".toLowerCase():\n case \"def\".toLowerCase():\n Player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymDefense);\n break;\n case \"dexterity\".toLowerCase():\n case \"dex\".toLowerCase():\n Player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymDexterity);\n break;\n case \"agility\".toLowerCase():\n case \"agi\".toLowerCase():\n Player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymAgility);\n break;\n default:\n workerScript.log(\"gymWorkout\", `Invalid stat: ${stat}.`);\n return false;\n }\n workerScript.log(\"gymWorkout\", `Started training ${stat} at ${gymName}`);\n return true;\n },\n\n travelToCity: function (cityname) {\n updateDynamicRam(\"travelToCity\", getRamCost(\"travelToCity\"));\n checkSingularityAccess(\"travelToCity\", 1);\n\n switch (cityname) {\n case CityName.Aevum:\n case CityName.Chongqing:\n case CityName.Sector12:\n case CityName.NewTokyo:\n case CityName.Ishima:\n case CityName.Volhaven:\n if (Player.money.lt(CONSTANTS.TravelCost)) {\n throw makeRuntimeErrorMsg(\"travelToCity\", \"Not enough money to travel.\");\n }\n Player.loseMoney(CONSTANTS.TravelCost);\n Player.city = cityname;\n workerScript.log(\"travelToCity\", `Traveled to ${cityname}`);\n return true;\n default:\n workerScript.log(\"travelToCity\", `Invalid city name: '${cityname}'.`);\n return false;\n }\n },\n\n purchaseTor: function () {\n updateDynamicRam(\"purchaseTor\", getRamCost(\"purchaseTor\"));\n checkSingularityAccess(\"purchaseTor\", 1);\n\n if (SpecialServerIps[\"Darkweb Server\"] != null) {\n workerScript.log(\"purchaseTor\", \"You already have a TOR router!\");\n return false;\n }\n\n if (Player.money.lt(CONSTANTS.TorRouterCost)) {\n workerScript.log(\"purchaseTor\", \"You cannot afford to purchase a Tor router.\");\n return false;\n }\n Player.loseMoney(CONSTANTS.TorRouterCost);\n\n var darkweb = safetlyCreateUniqueServer({\n ip: createUniqueRandomIp(),\n hostname: \"darkweb\",\n organizationName: \"\",\n isConnectedTo: false,\n adminRights: false,\n purchasedByPlayer: false,\n maxRam: 1,\n });\n AddToAllServers(darkweb);\n SpecialServerIps.addIp(\"Darkweb Server\", darkweb.ip);\n\n Player.getHomeComputer().serversOnNetwork.push(darkweb.ip);\n darkweb.serversOnNetwork.push(Player.getHomeComputer().ip);\n Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);\n workerScript.log(\"purchaseTor\", \"You have purchased a Tor router!\");\n return true;\n },\n purchaseProgram: function (programName) {\n updateDynamicRam(\"purchaseProgram\", getRamCost(\"purchaseProgram\"));\n checkSingularityAccess(\"purchaseProgram\", 1);\n\n if (SpecialServerIps[\"Darkweb Server\"] == null) {\n workerScript.log(\"purchaseProgram\", \"You do not have the TOR router.\");\n return false;\n }\n\n programName = programName.toLowerCase();\n\n let item = null;\n for (const key in DarkWebItems) {\n const i = DarkWebItems[key];\n if (i.program.toLowerCase() == programName) {\n item = i;\n }\n }\n\n if (item == null) {\n workerScript.log(\"purchaseProgram\", `Invalid program name: '${programName}.`);\n return false;\n }\n\n if (Player.money.lt(item.price)) {\n workerScript.log(\n \"purchaseProgram\",\n `Not enough money to purchase '${item.program}'. Need ${numeralWrapper.formatMoney(item.price)}`,\n );\n return false;\n }\n\n if (Player.hasProgram(item.program)) {\n workerScript.log(\"purchaseProgram\", `You already have the '${item.program}' program`);\n return true;\n }\n\n Player.loseMoney(item.price);\n Player.getHomeComputer().programs.push(item.program);\n workerScript.log(\n \"purchaseProgram\",\n `You have purchased the '${item.program}' program. The new program can be found on your home computer.`,\n );\n return true;\n },\n getCurrentServer: function () {\n updateDynamicRam(\"getCurrentServer\", getRamCost(\"getCurrentServer\"));\n checkSingularityAccess(\"getCurrentServer\", 1);\n return Player.getCurrentServer().hostname;\n },\n connect: function (hostname) {\n updateDynamicRam(\"connect\", getRamCost(\"connect\"));\n checkSingularityAccess(\"connect\", 1);\n if (!hostname) {\n throw makeRuntimeErrorMsg(\"connect\", `Invalid hostname: '${hostname}'`);\n }\n\n let target = getServer(hostname);\n if (target == null) {\n throw makeRuntimeErrorMsg(\"connect\", `Invalid hostname: '${hostname}'`);\n return;\n }\n\n if (hostname === \"home\") {\n Player.getCurrentServer().isConnectedTo = false;\n Player.currentServer = Player.getHomeComputer().ip;\n Player.getCurrentServer().isConnectedTo = true;\n Terminal.setcwd(\"/\");\n return true;\n }\n\n const server = Player.getCurrentServer();\n for (let i = 0; i < server.serversOnNetwork.length; i++) {\n const other = getServerOnNetwork(server, i);\n if (other.ip == hostname || other.hostname == hostname) {\n Player.getCurrentServer().isConnectedTo = false;\n Player.currentServer = target.ip;\n Player.getCurrentServer().isConnectedTo = true;\n Terminal.setcwd(\"/\");\n return true;\n }\n }\n\n return false;\n },\n manualHack: function () {\n updateDynamicRam(\"manualHack\", getRamCost(\"manualHack\"));\n checkSingularityAccess(\"manualHack\", 1);\n const server = Player.getCurrentServer();\n return hack(server.hostname, true);\n },\n installBackdoor: function () {\n updateDynamicRam(\"installBackdoor\", getRamCost(\"installBackdoor\"));\n checkSingularityAccess(\"installBackdoor\", 1);\n const server = Player.getCurrentServer();\n const installTime = (calculateHackingTime(server, Player) / 4) * 1000;\n\n // No root access or skill level too low\n const canHack = netscriptCanHack(server, Player);\n if (!canHack.res) {\n throw makeRuntimeErrorMsg(\"installBackdoor\", canHack.msg);\n }\n\n workerScript.log(\n \"installBackdoor\",\n `Installing backdoor on '${server.hostname}' in ${convertTimeMsToTimeElapsedString(installTime, true)}`,\n );\n\n return netscriptDelay(installTime, workerScript).then(function () {\n if (workerScript.env.stopFlag) {\n return Promise.reject(workerScript);\n }\n workerScript.log(\"installBackdoor\", `Successfully installed backdoor on '${server.hostname}'`);\n\n server.backdoorInstalled = true;\n return Promise.resolve();\n });\n },\n getStats: function () {\n updateDynamicRam(\"getStats\", getRamCost(\"getStats\"));\n checkSingularityAccess(\"getStats\", 1);\n workerScript.log(\"getStats\", `getStats is deprecated, please use getPlayer`);\n\n return {\n hacking: Player.hacking_skill,\n strength: Player.strength,\n defense: Player.defense,\n dexterity: Player.dexterity,\n agility: Player.agility,\n charisma: Player.charisma,\n intelligence: Player.intelligence,\n };\n },\n getCharacterInformation: function () {\n updateDynamicRam(\"getCharacterInformation\", getRamCost(\"getCharacterInformation\"));\n checkSingularityAccess(\"getCharacterInformation\", 1);\n workerScript.log(\"getCharacterInformation\", `getCharacterInformation is deprecated, please use getPlayer`);\n\n return {\n bitnode: Player.bitNodeN,\n city: Player.city,\n factions: Player.factions.slice(),\n hp: Player.hp,\n jobs: Object.keys(Player.jobs),\n jobTitles: Object.values(Player.jobs),\n maxHp: Player.max_hp,\n mult: {\n agility: Player.agility_mult,\n agilityExp: Player.agility_exp_mult,\n companyRep: Player.company_rep_mult,\n crimeMoney: Player.crime_money_mult,\n crimeSuccess: Player.crime_success_mult,\n defense: Player.defense_mult,\n defenseExp: Player.defense_exp_mult,\n dexterity: Player.dexterity_mult,\n dexterityExp: Player.dexterity_exp_mult,\n factionRep: Player.faction_rep_mult,\n hacking: Player.hacking_mult,\n hackingExp: Player.hacking_exp_mult,\n strength: Player.strength_mult,\n strengthExp: Player.strength_exp_mult,\n workMoney: Player.work_money_mult,\n },\n timeWorked: Player.timeWorked,\n tor: SpecialServerIps.hasOwnProperty(\"Darkweb Server\"),\n workHackExpGain: Player.workHackExpGained,\n workStrExpGain: Player.workStrExpGained,\n workDefExpGain: Player.workDefExpGained,\n workDexExpGain: Player.workDexExpGained,\n workAgiExpGain: Player.workAgiExpGained,\n workChaExpGain: Player.workChaExpGained,\n workRepGain: Player.workRepGained,\n workMoneyGain: Player.workMoneyGained,\n hackingExp: Player.hacking_exp,\n strengthExp: Player.strength_exp,\n defenseExp: Player.defense_exp,\n dexterityExp: Player.dexterity_exp,\n agilityExp: Player.agility_exp,\n charismaExp: Player.charisma_exp,\n };\n },\n getPlayer: function () {\n updateDynamicRam(\"getPlayer\", getRamCost(\"getPlayer\"));\n\n const data = {\n hacking_skill: Player.hacking_skill,\n hp: Player.hp,\n max_hp: Player.max_hp,\n strength: Player.strength,\n defense: Player.defense,\n dexterity: Player.dexterity,\n agility: Player.agility,\n charisma: Player.charisma,\n intelligence: Player.intelligence,\n hacking_chance_mult: Player.hacking_chance_mult,\n hacking_speed_mult: Player.hacking_speed_mult,\n hacking_money_mult: Player.hacking_money_mult,\n hacking_grow_mult: Player.hacking_grow_mult,\n hacking_exp: Player.hacking_exp,\n strength_exp: Player.strength_exp,\n defense_exp: Player.defense_exp,\n dexterity_exp: Player.dexterity_exp,\n agility_exp: Player.agility_exp,\n charisma_exp: Player.charisma_exp,\n hacking_mult: Player.hacking_mult,\n strength_mult: Player.strength_mult,\n defense_mult: Player.defense_mult,\n dexterity_mult: Player.dexterity_mult,\n agility_mult: Player.agility_mult,\n charisma_mult: Player.charisma_mult,\n hacking_exp_mult: Player.hacking_exp_mult,\n strength_exp_mult: Player.strength_exp_mult,\n defense_exp_mult: Player.defense_exp_mult,\n dexterity_exp_mult: Player.dexterity_exp_mult,\n agility_exp_mult: Player.agility_exp_mult,\n charisma_exp_mult: Player.charisma_exp_mult,\n company_rep_mult: Player.company_rep_mult,\n faction_rep_mult: Player.faction_rep_mult,\n numPeopleKilled: Player.numPeopleKilled,\n money: Player.money.toNumber(),\n city: Player.city,\n location: Player.location,\n companyName: Player.companyName,\n crime_money_mult: Player.crime_money_mult,\n crime_success_mult: Player.crime_success_mult,\n isWorking: Player.isWorking,\n workType: Player.workType,\n currentWorkFactionName: Player.currentWorkFactionName,\n currentWorkFactionDescription: Player.currentWorkFactionDescription,\n workHackExpGainRate: Player.workHackExpGainRate,\n workStrExpGainRate: Player.workStrExpGainRate,\n workDefExpGainRate: Player.workDefExpGainRate,\n workDexExpGainRate: Player.workDexExpGainRate,\n workAgiExpGainRate: Player.workAgiExpGainRate,\n workChaExpGainRate: Player.workChaExpGainRate,\n workRepGainRate: Player.workRepGainRate,\n workMoneyGainRate: Player.workMoneyGainRate,\n workMoneyLossRate: Player.workMoneyLossRate,\n workHackExpGained: Player.workHackExpGained,\n workStrExpGained: Player.workStrExpGained,\n workDefExpGained: Player.workDefExpGained,\n workDexExpGained: Player.workDexExpGained,\n workAgiExpGained: Player.workAgiExpGained,\n workChaExpGained: Player.workChaExpGained,\n workRepGained: Player.workRepGained,\n workMoneyGained: Player.workMoneyGained,\n createProgramName: Player.createProgramName,\n createProgramReqLvl: Player.createProgramReqLvl,\n className: Player.className,\n crimeType: Player.crimeType,\n work_money_mult: Player.work_money_mult,\n hacknet_node_money_mult: Player.hacknet_node_money_mult,\n hacknet_node_purchase_cost_mult: Player.hacknet_node_purchase_cost_mult,\n hacknet_node_ram_cost_mult: Player.hacknet_node_ram_cost_mult,\n hacknet_node_core_cost_mult: Player.hacknet_node_core_cost_mult,\n hacknet_node_level_cost_mult: Player.hacknet_node_level_cost_mult,\n hasWseAccount: Player.hasWseAccount,\n hasTixApiAccess: Player.hasTixApiAccess,\n has4SData: Player.has4SData,\n has4SDataTixApi: Player.has4SDataTixApi,\n bladeburner_max_stamina_mult: Player.bladeburner_max_stamina_mult,\n bladeburner_stamina_gain_mult: Player.bladeburner_stamina_gain_mult,\n bladeburner_analysis_mult: Player.bladeburner_analysis_mult,\n bladeburner_success_chance_mult: Player.bladeburner_success_chance_mult,\n bitNodeN: Player.bitNodeN,\n totalPlaytime: Player.totalPlaytime,\n playtimeSinceLastAug: Player.playtimeSinceLastAug,\n playtimeSinceLastBitnode: Player.playtimeSinceLastBitnode,\n jobs: {},\n factions: Player.factions.slice(),\n tor: SpecialServerIps.hasOwnProperty(\"Darkweb Server\"),\n };\n Object.assign(data.jobs, Player.jobs);\n return data;\n },\n hospitalize: function () {\n updateDynamicRam(\"hospitalize\", getRamCost(\"hospitalize\"));\n checkSingularityAccess(\"hospitalize\", 1);\n return Player.hospitalize();\n },\n isBusy: function () {\n updateDynamicRam(\"isBusy\", getRamCost(\"isBusy\"));\n checkSingularityAccess(\"isBusy\", 1);\n return Player.isWorking || inMission;\n },\n stopAction: function () {\n updateDynamicRam(\"stopAction\", getRamCost(\"stopAction\"));\n checkSingularityAccess(\"stopAction\", 1);\n if (Player.isWorking) {\n Router.toTerminal();\n var txt = Player.singularityStopWork();\n workerScript.log(\"stopAction\", txt);\n return true;\n }\n return false;\n },\n upgradeHomeRam: function () {\n updateDynamicRam(\"upgradeHomeRam\", getRamCost(\"upgradeHomeRam\"));\n checkSingularityAccess(\"upgradeHomeRam\", 2);\n\n // Check if we're at max RAM\n const homeComputer = Player.getHomeComputer();\n if (homeComputer.maxRam >= CONSTANTS.HomeComputerMaxRam) {\n workerScript.log(\"upgradeHomeRam\", `Your home computer is at max RAM.`);\n return false;\n }\n\n const cost = Player.getUpgradeHomeRamCost();\n if (Player.money.lt(cost)) {\n workerScript.log(\"upgradeHomeRam\", `You don't have enough money. Need ${numeralWrapper.formatMoney(cost)}`);\n return false;\n }\n\n homeComputer.maxRam *= 2;\n Player.loseMoney(cost);\n\n Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);\n workerScript.log(\n \"upgradeHomeRam\",\n `Purchased additional RAM for home computer! It now has ${homeComputer.maxRam}GB of RAM.`,\n );\n return true;\n },\n getUpgradeHomeRamCost: function () {\n updateDynamicRam(\"getUpgradeHomeRamCost\", getRamCost(\"getUpgradeHomeRamCost\"));\n checkSingularityAccess(\"getUpgradeHomeRamCost\", 2);\n\n return Player.getUpgradeHomeRamCost();\n },\n workForCompany: function (companyName) {\n updateDynamicRam(\"workForCompany\", getRamCost(\"workForCompany\"));\n checkSingularityAccess(\"workForCompany\", 2);\n\n // Sanitize input\n if (companyName == null) {\n companyName = Player.companyName;\n }\n\n // Make sure its a valid company\n if (companyName == null || companyName === \"\" || !(Companies[companyName] instanceof Company)) {\n workerScript.log(\"workForCompany\", `Invalid company: '${companyName}'`);\n return false;\n }\n\n // Make sure player is actually employed at the comapny\n if (!Object.keys(Player.jobs).includes(companyName)) {\n workerScript.log(\"workForCompany\", `You do not have a job at '${companyName}'`);\n return false;\n }\n\n // Cant work while in a mission\n if (inMission) {\n workerScript.log(\"workForCompany\", \"You are in the middle of a mission.\");\n return false;\n }\n\n // Check to make sure company position data is valid\n const companyPositionName = Player.jobs[companyName];\n const companyPosition = CompanyPositions[companyPositionName];\n if (companyPositionName === \"\" || !(companyPosition instanceof CompanyPosition)) {\n workerScript.log(\"workForCompany\", \"You do not have a job\");\n return false;\n }\n\n if (Player.isWorking) {\n var txt = Player.singularityStopWork();\n workerScript.log(\"workForCompany\", txt);\n }\n\n if (companyPosition.isPartTimeJob()) {\n Player.startWorkPartTime(Router, companyName);\n } else {\n Player.startWork(Router, companyName);\n }\n workerScript.log(\"workForCompany\", `Began working at '${Player.companyName}' as a '${companyPositionName}'`);\n return true;\n },\n applyToCompany: function (companyName, field) {\n updateDynamicRam(\"applyToCompany\", getRamCost(\"applyToCompany\"));\n checkSingularityAccess(\"applyToCompany\", 2);\n getCompany(\"applyToCompany\", companyName);\n\n Player.location = companyName;\n var res;\n switch (field.toLowerCase()) {\n case \"software\":\n res = Player.applyForSoftwareJob(true);\n break;\n case \"software consultant\":\n res = Player.applyForSoftwareConsultantJob(true);\n break;\n case \"it\":\n res = Player.applyForItJob(true);\n break;\n case \"security engineer\":\n res = Player.applyForSecurityEngineerJob(true);\n break;\n case \"network engineer\":\n res = Player.applyForNetworkEngineerJob(true);\n break;\n case \"business\":\n res = Player.applyForBusinessJob(true);\n break;\n case \"business consultant\":\n res = Player.applyForBusinessConsultantJob(true);\n break;\n case \"security\":\n res = Player.applyForSecurityJob(true);\n break;\n case \"agent\":\n res = Player.applyForAgentJob(true);\n break;\n case \"employee\":\n res = Player.applyForEmployeeJob(true);\n break;\n case \"part-time employee\":\n res = Player.applyForPartTimeEmployeeJob(true);\n break;\n case \"waiter\":\n res = Player.applyForWaiterJob(true);\n break;\n case \"part-time waiter\":\n res = Player.applyForPartTimeWaiterJob(true);\n break;\n default:\n workerScript.log(\"applyToCompany\", `Invalid job: '${field}'.`);\n return false;\n }\n // The Player object's applyForJob function can return string with special error messages\n if (isString(res)) {\n workerScript.log(\"applyToCompany\", res);\n return false;\n }\n if (res) {\n workerScript.log(\n \"applyToCompany\",\n `You were offered a new job at '${companyName}' as a '${Player.jobs[companyName]}'`,\n );\n } else {\n workerScript.log(\n \"applyToCompany\",\n `You failed to get a new job/promotion at '${companyName}' in the '${field}' field.`,\n );\n }\n return res;\n },\n getCompanyRep: function (companyName) {\n updateDynamicRam(\"getCompanyRep\", getRamCost(\"getCompanyRep\"));\n checkSingularityAccess(\"getCompanyRep\", 2);\n const company = getCompany(\"getCompanyRep\", companyName);\n return company.playerReputation;\n },\n getCompanyFavor: function (companyName) {\n updateDynamicRam(\"getCompanyFavor\", getRamCost(\"getCompanyFavor\"));\n checkSingularityAccess(\"getCompanyFavor\", 2);\n const company = getCompany(\"getCompanyFavor\", companyName);\n return company.favor;\n },\n getCompanyFavorGain: function (companyName) {\n updateDynamicRam(\"getCompanyFavorGain\", getRamCost(\"getCompanyFavorGain\"));\n checkSingularityAccess(\"getCompanyFavorGain\", 2);\n const company = getCompany(\"getCompanyFavorGain\", companyName);\n return company.getFavorGain()[0];\n },\n checkFactionInvitations: function () {\n updateDynamicRam(\"checkFactionInvitations\", getRamCost(\"checkFactionInvitations\"));\n checkSingularityAccess(\"checkFactionInvitations\", 2);\n // Make a copy of Player.factionInvitations\n return Player.factionInvitations.slice();\n },\n joinFaction: function (name) {\n updateDynamicRam(\"joinFaction\", getRamCost(\"joinFaction\"));\n checkSingularityAccess(\"joinFaction\", 2);\n getFaction(\"joinFaction\", name);\n\n if (!Player.factionInvitations.includes(name)) {\n workerScript.log(\"joinFaction\", `You have not been invited by faction '${name}'`);\n return false;\n }\n const fac = Factions[name];\n joinFaction(fac);\n\n // Update Faction Invitation list to account for joined + banned factions\n for (let i = 0; i < Player.factionInvitations.length; ++i) {\n if (Player.factionInvitations[i] == name || Factions[Player.factionInvitations[i]].isBanned) {\n Player.factionInvitations.splice(i, 1);\n i--;\n }\n }\n Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);\n workerScript.log(\"joinFaction\", `Joined the '${name}' faction.`);\n return true;\n },\n workForFaction: function (name, type) {\n updateDynamicRam(\"workForFaction\", getRamCost(\"workForFaction\"));\n checkSingularityAccess(\"workForFaction\", 2);\n getFaction(\"workForFaction\", name);\n\n // if the player is in a gang and the target faction is any of the gang faction, fail\n if (Player.inGang() && AllGangs[name] !== undefined) {\n workerScript.log(\"workForFaction\", `Faction '${name}' does not offer work at the moment.`);\n return;\n }\n\n if (inMission) {\n workerScript.log(\"workForFaction\", \"You are in the middle of a mission.\");\n return;\n }\n\n if (!Player.factions.includes(name)) {\n workerScript.log(\"workForFaction\", `You are not a member of '${name}'`);\n return false;\n }\n\n if (Player.isWorking) {\n const txt = Player.singularityStopWork();\n workerScript.log(\"workForFaction\", txt);\n }\n\n var fac = Factions[name];\n // Arrays listing factions that allow each time of work\n var hackAvailable = [\n \"Illuminati\",\n \"Daedalus\",\n \"The Covenant\",\n \"ECorp\",\n \"MegaCorp\",\n \"Bachman & Associates\",\n \"Blade Industries\",\n \"NWO\",\n \"Clarke Incorporated\",\n \"OmniTek Incorporated\",\n \"Four Sigma\",\n \"KuaiGong International\",\n \"Fulcrum Secret Technologies\",\n \"BitRunners\",\n \"The Black Hand\",\n \"NiteSec\",\n \"Chongqing\",\n \"Sector-12\",\n \"New Tokyo\",\n \"Aevum\",\n \"Ishima\",\n \"Volhaven\",\n \"Speakers for the Dead\",\n \"The Dark Army\",\n \"The Syndicate\",\n \"Silhouette\",\n \"Netburners\",\n \"Tian Di Hui\",\n \"CyberSec\",\n ];\n var fdWkAvailable = [\n \"Illuminati\",\n \"Daedalus\",\n \"The Covenant\",\n \"ECorp\",\n \"MegaCorp\",\n \"Bachman & Associates\",\n \"Blade Industries\",\n \"NWO\",\n \"Clarke Incorporated\",\n \"OmniTek Incorporated\",\n \"Four Sigma\",\n \"KuaiGong International\",\n \"The Black Hand\",\n \"Chongqing\",\n \"Sector-12\",\n \"New Tokyo\",\n \"Aevum\",\n \"Ishima\",\n \"Volhaven\",\n \"Speakers for the Dead\",\n \"The Dark Army\",\n \"The Syndicate\",\n \"Silhouette\",\n \"Tetrads\",\n \"Slum Snakes\",\n ];\n var scWkAvailable = [\n \"ECorp\",\n \"MegaCorp\",\n \"Bachman & Associates\",\n \"Blade Industries\",\n \"NWO\",\n \"Clarke Incorporated\",\n \"OmniTek Incorporated\",\n \"Four Sigma\",\n \"KuaiGong International\",\n \"Fulcrum Secret Technologies\",\n \"Chongqing\",\n \"Sector-12\",\n \"New Tokyo\",\n \"Aevum\",\n \"Ishima\",\n \"Volhaven\",\n \"Speakers for the Dead\",\n \"The Syndicate\",\n \"Tetrads\",\n \"Slum Snakes\",\n \"Tian Di Hui\",\n ];\n\n switch (type.toLowerCase()) {\n case \"hacking\":\n case \"hacking contracts\":\n case \"hackingcontracts\":\n if (!hackAvailable.includes(fac.name)) {\n workerScript.log(\"workForFaction\", `Faction '${fac.name}' do not need help with hacking contracts.`);\n return false;\n }\n Player.startFactionHackWork(Router, fac);\n workerScript.log(\"workForFaction\", `Started carrying out hacking contracts for '${fac.name}'`);\n return true;\n case \"field\":\n case \"fieldwork\":\n case \"field work\":\n if (!fdWkAvailable.includes(fac.name)) {\n workerScript.log(\"workForFaction\", `Faction '${fac.name}' do not need help with field missions.`);\n return false;\n }\n Player.startFactionFieldWork(Router, fac);\n workerScript.log(\"workForFaction\", `Started carrying out field missions for '${fac.name}'`);\n return true;\n case \"security\":\n case \"securitywork\":\n case \"security work\":\n if (!scWkAvailable.includes(fac.name)) {\n workerScript.log(\"workForFaction\", `Faction '${fac.name}' do not need help with security work.`);\n return false;\n }\n Player.startFactionSecurityWork(Router, fac);\n workerScript.log(\"workForFaction\", `Started carrying out security work for '${fac.name}'`);\n return true;\n default:\n workerScript.log(\"workForFaction\", `Invalid work type: '${type}`);\n }\n return true;\n },\n getFactionRep: function (name) {\n updateDynamicRam(\"getFactionRep\", getRamCost(\"getFactionRep\"));\n checkSingularityAccess(\"getFactionRep\", 2);\n const faction = getFaction(\"getFactionRep\", name);\n return faction.playerReputation;\n },\n getFactionFavor: function (name) {\n updateDynamicRam(\"getFactionFavor\", getRamCost(\"getFactionFavor\"));\n checkSingularityAccess(\"getFactionFavor\", 2);\n const faction = getFaction(\"getFactionFavor\", name);\n return faction.favor;\n },\n getFactionFavorGain: function (name) {\n updateDynamicRam(\"getFactionFavorGain\", getRamCost(\"getFactionFavorGain\"));\n checkSingularityAccess(\"getFactionFavorGain\", 2);\n const faction = getFaction(\"getFactionFavorGain\", name);\n return faction.getFavorGain()[0];\n },\n donateToFaction: function (name, amt) {\n updateDynamicRam(\"donateToFaction\", getRamCost(\"donateToFaction\"));\n checkSingularityAccess(\"donateToFaction\", 3);\n const faction = getFaction(\"donateToFaction\", name);\n\n if (typeof amt !== \"number\" || amt <= 0) {\n workerScript.log(\"donateToFaction\", `Invalid donation amount: '${amt}'.`);\n return false;\n }\n if (Player.money.lt(amt)) {\n workerScript.log(\n \"donateToFaction\",\n `You do not have enough money to donate ${numeralWrapper.formatMoney(amt)} to '${name}'`,\n );\n return false;\n }\n const repNeededToDonate = Math.round(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction);\n if (faction.favor < repNeededToDonate) {\n workerScript.log(\n \"donateToFaction\",\n `You do not have enough favor to donate to this faction. Have ${faction.favor}, need ${repNeededToDonate}`,\n );\n return false;\n }\n const repGain = (amt / CONSTANTS.DonateMoneyToRepDivisor) * Player.faction_rep_mult;\n faction.playerReputation += repGain;\n Player.loseMoney(amt);\n workerScript.log(\n \"donateToFaction\",\n `${numeralWrapper.formatMoney(amt)} donated to '${name}' for ${numeralWrapper.formatReputation(\n repGain,\n )} reputation`,\n );\n return true;\n },\n createProgram: function (name) {\n updateDynamicRam(\"createProgram\", getRamCost(\"createProgram\"));\n checkSingularityAccess(\"createProgram\", 3);\n\n if (inMission) {\n workerScript.log(\"createProgram\", \"You are in the middle of a mission.\");\n return;\n }\n if (Player.isWorking) {\n var txt = Player.singularityStopWork();\n workerScript.log(\"createProgram\", txt);\n }\n\n name = name.toLowerCase();\n\n let p = null;\n for (const key in Programs) {\n if (Programs[key].name.toLowerCase() == name) {\n p = Programs[key];\n }\n }\n\n if (p == null) {\n workerScript.log(\"createProgram\", `The specified program does not exist: '${name}`);\n return false;\n }\n\n if (Player.hasProgram(p.name)) {\n workerScript.log(\"createProgram\", `You already have the '${p.name}' program`);\n return false;\n }\n\n if (!p.create.req(Player)) {\n workerScript.log(\n \"createProgram\",\n `Hacking level is too low to create '${p.name}' (level ${p.create.level} req)`,\n );\n return false;\n }\n\n Player.startCreateProgramWork(Router, p.name, p.create.time, p.create.level);\n workerScript.log(\"createProgram\", `Began creating program: '${name}'`);\n return true;\n },\n commitCrime: function (crimeRoughName) {\n updateDynamicRam(\"commitCrime\", getRamCost(\"commitCrime\"));\n checkSingularityAccess(\"commitCrime\", 3);\n if (inMission) {\n workerScript.log(\"commitCrime\", \"You are in the middle of a mission.\");\n return;\n }\n if (Player.isWorking) {\n const txt = Player.singularityStopWork();\n workerScript.log(\"commitCrime\", txt);\n }\n\n // Set Location to slums\n Player.gotoLocation(LocationName.Slums);\n\n const crime = findCrime(crimeRoughName.toLowerCase());\n if (crime == null) {\n // couldn't find crime\n throw makeRuntimeErrorMsg(\"commitCrime\", `Invalid crime: '${crimeRoughName}'`);\n }\n workerScript.log(\"commitCrime\", `Attempting to commit ${crime.name}...`);\n return crime.commit(Router, Player, 1, { workerscript: workerScript });\n },\n getCrimeChance: function (crimeRoughName) {\n updateDynamicRam(\"getCrimeChance\", getRamCost(\"getCrimeChance\"));\n checkSingularityAccess(\"getCrimeChance\", 3);\n\n const crime = findCrime(crimeRoughName.toLowerCase());\n if (crime == null) {\n throw makeRuntimeErrorMsg(\"getCrimeChance\", `Invalid crime: ${crimeRoughName}`);\n }\n\n return crime.successRate(Player);\n },\n getCrimeStats: function (crimeRoughName) {\n updateDynamicRam(\"getCrimeStats\", getRamCost(\"getCrimeStats\"));\n checkSingularityAccess(\"getCrimeStats\", 3);\n\n const crime = findCrime(crimeRoughName.toLowerCase());\n if (crime == null) {\n throw makeRuntimeErrorMsg(\"getCrimeStats\", `Invalid crime: ${crimeRoughName}`);\n }\n\n return Object.assign({}, crime);\n },\n getOwnedAugmentations: function (purchased = false) {\n updateDynamicRam(\"getOwnedAugmentations\", getRamCost(\"getOwnedAugmentations\"));\n checkSingularityAccess(\"getOwnedAugmentations\", 3);\n var res = [];\n for (var i = 0; i < Player.augmentations.length; ++i) {\n res.push(Player.augmentations[i].name);\n }\n if (purchased) {\n for (var i = 0; i < Player.queuedAugmentations.length; ++i) {\n res.push(Player.queuedAugmentations[i].name);\n }\n }\n return res;\n },\n getOwnedSourceFiles: function () {\n updateDynamicRam(\"getOwnedSourceFiles\", getRamCost(\"getOwnedSourceFiles\"));\n checkSingularityAccess(\"getOwnedSourceFiles\", 3);\n let res = [];\n for (let i = 0; i < Player.sourceFiles.length; ++i) {\n res.push({\n n: Player.sourceFiles[i].n,\n lvl: Player.sourceFiles[i].lvl,\n });\n }\n return res;\n },\n getAugmentationsFromFaction: function (facname) {\n updateDynamicRam(\"getAugmentationsFromFaction\", getRamCost(\"getAugmentationsFromFaction\"));\n checkSingularityAccess(\"getAugmentationsFromFaction\", 3);\n const faction = getFaction(\"getAugmentationsFromFaction\", facname);\n\n // If player has a gang with this faction, return all augmentations.\n if (Player.hasGangWith(facname)) {\n const res = [];\n for (const augName in Augmentations) {\n const aug = Augmentations[augName];\n if (!aug.isSpecial) {\n res.push(augName);\n }\n }\n\n return res;\n }\n\n return faction.augmentations.slice();\n },\n getAugmentationCost: function (name) {\n updateDynamicRam(\"getAugmentationCost\", getRamCost(\"getAugmentationCost\"));\n checkSingularityAccess(\"getAugmentationCost\", 3);\n const aug = getAugmentation(\"getAugmentationCost\", name);\n return [aug.baseRepRequirement, aug.baseCost];\n },\n getAugmentationPrereq: function (name) {\n updateDynamicRam(\"getAugmentationPrereq\", getRamCost(\"getAugmentationPrereq\"));\n checkSingularityAccess(\"getAugmentationPrereq\", 3);\n const aug = getAugmentation(\"getAugmentationPrereq\", name);\n return aug.prereqs.slice();\n },\n getAugmentationPrice: function (name) {\n updateDynamicRam(\"getAugmentationPrice\", getRamCost(\"getAugmentationPrice\"));\n checkSingularityAccess(\"getAugmentationPrice\", 3);\n const aug = getAugmentation(\"getAugmentationPrice\", name);\n return aug.baseCost;\n },\n getAugmentationRepReq: function (name) {\n updateDynamicRam(\"getAugmentationRepReq\", getRamCost(\"getAugmentationRepReq\"));\n checkSingularityAccess(\"getAugmentationRepReq\", 3);\n const aug = getAugmentation(\"getAugmentationRepReq\", name);\n return aug.baseRepRequirement;\n },\n getAugmentationStats: function (name) {\n updateDynamicRam(\"getAugmentationStats\", getRamCost(\"getAugmentationStats\"));\n checkSingularityAccess(\"getAugmentationStats\", 3);\n const aug = getAugmentation(\"getAugmentationStats\", name);\n return Object.assign({}, aug.mults);\n },\n purchaseAugmentation: function (faction, name) {\n updateDynamicRam(\"purchaseAugmentation\", getRamCost(\"purchaseAugmentation\"));\n checkSingularityAccess(\"purchaseAugmentation\", 3);\n const fac = getFaction(\"purchaseAugmentation\", faction);\n const aug = getAugmentation(\"purchaseAugmentation\", name);\n\n let augs = [];\n if (Player.hasGangWith(faction)) {\n for (const augName in Augmentations) {\n const tempAug = Augmentations[augName];\n if (!tempAug.isSpecial) {\n augs.push(augName);\n }\n }\n } else {\n augs = fac.augmentations;\n }\n\n if (!augs.includes(name)) {\n workerScript.log(\"purchaseAugmentation\", `Faction '${faction}' does not have the '${name}' augmentation.`);\n return false;\n }\n\n const isNeuroflux = aug.name === AugmentationNames.NeuroFluxGovernor;\n if (!isNeuroflux) {\n for (let j = 0; j < Player.queuedAugmentations.length; ++j) {\n if (Player.queuedAugmentations[j].name === aug.name) {\n workerScript.log(\"purchaseAugmentation\", `You already have the '${name}' augmentation.`);\n return false;\n }\n }\n for (let j = 0; j < Player.augmentations.length; ++j) {\n if (Player.augmentations[j].name === aug.name) {\n workerScript.log(\"purchaseAugmentation\", `You already have the '${name}' augmentation.`);\n return false;\n }\n }\n }\n\n if (fac.playerReputation < aug.baseRepRequirement) {\n workerScript.log(\"purchaseAugmentation\", `You do not have enough reputation with '${fac.name}'.`);\n return false;\n }\n\n const res = purchaseAugmentation(aug, fac, true);\n workerScript.log(\"purchaseAugmentation\", res);\n if (isString(res) && res.startsWith(\"You purchased\")) {\n Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);\n return true;\n } else {\n return false;\n }\n },\n softReset: function (cbScript) {\n updateDynamicRam(\"softReset\", getRamCost(\"softReset\"));\n checkSingularityAccess(\"softReset\", 3);\n\n workerScript.log(\"softReset\", \"Soft resetting. This will cause this script to be killed\");\n setTimeoutRef(() => {\n prestigeAugmentation();\n runAfterReset(cbScript);\n }, 0);\n\n // Prevent workerScript from \"finishing execution naturally\"\n workerScript.running = false;\n killWorkerScript(workerScript);\n },\n installAugmentations: function (cbScript) {\n updateDynamicRam(\"installAugmentations\", getRamCost(\"installAugmentations\"));\n checkSingularityAccess(\"installAugmentations\", 3);\n\n if (Player.queuedAugmentations.length === 0) {\n workerScript.log(\"installAugmentations\", \"You do not have any Augmentations to be installed.\");\n return false;\n }\n Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);\n workerScript.log(\"installAugmentations\", \"Installing Augmentations. This will cause this script to be killed\");\n setTimeoutRef(() => {\n installAugmentations();\n runAfterReset(cbScript);\n }, 0);\n\n workerScript.running = false; // Prevent workerScript from \"finishing execution naturally\"\n killWorkerScript(workerScript);\n },\n\n // Gang API\n gang: {\n createGang: function (faction) {\n updateDynamicRam(\"createGang\", getRamCost(\"gang\", \"createGang\"));\n // this list is copied from Faction/ui/Root.tsx\n const GangNames = [\n \"Slum Snakes\",\n \"Tetrads\",\n \"The Syndicate\",\n \"The Dark Army\",\n \"Speakers for the Dead\",\n \"NiteSec\",\n \"The Black Hand\",\n ];\n if (!Player.canAccessGang() || !GangNames.includes(faction)) return false;\n if (Player.inGang()) return false;\n if (!Player.factions.includes(faction)) return false;\n\n const isHacking = faction === \"NiteSec\" || faction === \"The Black Hand\";\n Player.startGang(faction, isHacking);\n return true;\n },\n inGang: function () {\n updateDynamicRam(\"inGang\", getRamCost(\"gang\", \"inGang\"));\n return Player.inGang();\n },\n getMemberNames: function () {\n updateDynamicRam(\"getMemberNames\", getRamCost(\"gang\", \"getMemberNames\"));\n checkGangApiAccess(\"getMemberNames\");\n return Player.gang.members.map((member) => member.name);\n },\n getGangInformation: function () {\n updateDynamicRam(\"getGangInformation\", getRamCost(\"gang\", \"getGangInformation\"));\n checkGangApiAccess(\"getGangInformation\");\n return {\n faction: Player.gang.facName,\n isHacking: Player.gang.isHackingGang,\n moneyGainRate: Player.gang.moneyGainRate,\n power: Player.gang.getPower(),\n respect: Player.gang.respect,\n respectGainRate: Player.gang.respectGainRate,\n territory: Player.gang.getTerritory(),\n territoryClashChance: Player.gang.territoryClashChance,\n territoryWarfareEngaged: Player.gang.territoryWarfareEngaged,\n wantedLevel: Player.gang.wanted,\n wantedLevelGainRate: Player.gang.wantedGainRate,\n };\n },\n getOtherGangInformation: function () {\n updateDynamicRam(\"getOtherGangInformation\", getRamCost(\"gang\", \"getOtherGangInformation\"));\n checkGangApiAccess(\"getOtherGangInformation\");\n const cpy = {};\n for (const gang in AllGangs) {\n cpy[gang] = Object.assign({}, AllGangs[gang]);\n }\n\n return cpy;\n },\n getMemberInformation: function (name) {\n updateDynamicRam(\"getMemberInformation\", getRamCost(\"gang\", \"getMemberInformation\"));\n checkGangApiAccess(\"getMemberInformation\");\n const member = getGangMember(\"getMemberInformation\", name);\n return {\n name: member.name,\n task: member.task,\n earnedRespect: member.earnedRespect,\n hack: member.hack,\n str: member.str,\n def: member.def,\n dex: member.dex,\n agi: member.agi,\n cha: member.cha,\n\n hack_exp: member.hack_exp,\n str_exp: member.str_exp,\n def_exp: member.def_exp,\n dex_exp: member.dex_exp,\n agi_exp: member.agi_exp,\n cha_exp: member.cha_exp,\n\n hack_mult: member.hack_mult,\n str_mult: member.str_mult,\n def_mult: member.def_mult,\n dex_mult: member.dex_mult,\n agi_mult: member.agi_mult,\n cha_mult: member.cha_mult,\n\n hack_asc_mult: member.calculateAscensionMult(member.hack_asc_points),\n str_asc_mult: member.calculateAscensionMult(member.str_asc_points),\n def_asc_mult: member.calculateAscensionMult(member.def_asc_points),\n dex_asc_mult: member.calculateAscensionMult(member.dex_asc_points),\n agi_asc_mult: member.calculateAscensionMult(member.agi_asc_points),\n cha_asc_mult: member.calculateAscensionMult(member.cha_asc_points),\n\n hack_asc_points: member.hack_asc_points,\n str_asc_points: member.str_asc_points,\n def_asc_points: member.def_asc_points,\n dex_asc_points: member.dex_asc_points,\n agi_asc_points: member.agi_asc_points,\n cha_asc_points: member.cha_asc_points,\n\n upgrades: member.upgrades.slice(),\n augmentations: member.augmentations.slice(),\n };\n },\n canRecruitMember: function () {\n updateDynamicRam(\"canRecruitMember\", getRamCost(\"gang\", \"canRecruitMember\"));\n checkGangApiAccess(\"canRecruitMember\");\n return Player.gang.canRecruitMember();\n },\n recruitMember: function (name) {\n updateDynamicRam(\"recruitMember\", getRamCost(\"gang\", \"recruitMember\"));\n checkGangApiAccess(\"recruitMember\");\n const recruited = Player.gang.recruitMember(name);\n if (recruited) {\n workerScript.log(\"recruitMember\", `Successfully recruited Gang Member '${name}'`);\n } else {\n workerScript.log(\"recruitMember\", `Failed to recruit Gang Member '${name}'`);\n }\n\n return recruited;\n },\n getTaskNames: function () {\n updateDynamicRam(\"getTaskNames\", getRamCost(\"gang\", \"getTaskNames\"));\n checkGangApiAccess(\"getTaskNames\");\n const tasks = Player.gang.getAllTaskNames();\n tasks.unshift(\"Unassigned\");\n return tasks;\n },\n setMemberTask: function (memberName, taskName) {\n updateDynamicRam(\"setMemberTask\", getRamCost(\"gang\", \"setMemberTask\"));\n checkGangApiAccess(\"setMemberTask\");\n const member = getGangMember(\"setMemberTask\", memberName);\n const success = member.assignToTask(taskName);\n if (success) {\n workerScript.log(\"setMemberTask\", `Successfully assigned Gang Member '${memberName}' to '${taskName}' task`);\n } else {\n workerScript.log(\n \"setMemberTask\",\n `Failed to assign Gang Member '${memberName}' to '${taskName}' task. '${memberName}' is now Unassigned`,\n );\n }\n\n return success;\n },\n getTaskStats: function (taskName) {\n updateDynamicRam(\"getTaskStats\", getRamCost(\"gang\", \"getTaskStats\"));\n checkGangApiAccess(\"getTaskStats\");\n const task = getGangTask(\"getTaskStats\", taskName);\n const copy = Object.assign({}, task);\n copy.territory = Object.assign({}, task.territory);\n return copy;\n },\n getEquipmentNames: function () {\n updateDynamicRam(\"getEquipmentNames\", getRamCost(\"gang\", \"getEquipmentNames\"));\n checkGangApiAccess(\"getEquipmentNames\");\n return Object.keys(GangMemberUpgrades);\n },\n getEquipmentCost: function (equipName) {\n updateDynamicRam(\"getEquipmentCost\", getRamCost(\"gang\", \"getEquipmentCost\"));\n checkGangApiAccess(\"getEquipmentCost\");\n const upg = GangMemberUpgrades[equipName];\n if (upg === null) return Infinity;\n return Player.gang.getUpgradeCost(upg);\n },\n getEquipmentType: function (equipName) {\n updateDynamicRam(\"getEquipmentType\", getRamCost(\"gang\", \"getEquipmentType\"));\n checkGangApiAccess(\"getEquipmentType\");\n const upg = GangMemberUpgrades[equipName];\n if (upg == null) return \"\";\n return upg.getType();\n },\n getEquipmentStats: function (equipName) {\n updateDynamicRam(\"getEquipmentStats\", getRamCost(\"gang\", \"getEquipmentStats\"));\n checkGangApiAccess(\"getEquipmentStats\");\n const equipment = GangMemberUpgrades[equipName];\n if (!equipment) {\n throw makeRuntimeErrorMsg(\"getEquipmentStats\", `Invalid equipment: ${equipName}`);\n }\n return Object.assign({}, equipment.mults);\n },\n purchaseEquipment: function (memberName, equipName) {\n updateDynamicRam(\"purchaseEquipment\", getRamCost(\"gang\", \"purchaseEquipment\"));\n checkGangApiAccess(\"purchaseEquipment\");\n const member = getGangMember(\"purchaseEquipment\", memberName);\n const equipment = GangMemberUpgrades[equipName];\n if (!equipment) return false;\n const res = member.buyUpgrade(equipment, Player, Player.gang);\n if (res) {\n workerScript.log(\"purchaseEquipment\", `Purchased '${equipName}' for Gang member '${memberName}'`);\n } else {\n workerScript.log(\"purchaseEquipment\", `Failed to purchase '${equipName}' for Gang member '${memberName}'`);\n }\n\n return res;\n },\n ascendMember: function (name) {\n updateDynamicRam(\"ascendMember\", getRamCost(\"gang\", \"ascendMember\"));\n checkGangApiAccess(\"ascendMember\");\n const member = getGangMember(\"ascendMember\", name);\n if (!member.canAscend()) return;\n return Player.gang.ascendMember(member, workerScript);\n },\n setTerritoryWarfare: function (engage) {\n updateDynamicRam(\"setTerritoryWarfare\", getRamCost(\"gang\", \"setTerritoryWarfare\"));\n checkGangApiAccess(\"setTerritoryWarfare\");\n if (engage) {\n Player.gang.territoryWarfareEngaged = true;\n workerScript.log(\"setTerritoryWarfare\", \"Engaging in Gang Territory Warfare\");\n } else {\n Player.gang.territoryWarfareEngaged = false;\n workerScript.log(\"setTerritoryWarfare\", \"Disengaging in Gang Territory Warfare\");\n }\n },\n getChanceToWinClash: function (otherGang) {\n updateDynamicRam(\"getChanceToWinClash\", getRamCost(\"gang\", \"getChanceToWinClash\"));\n checkGangApiAccess(\"getChanceToWinClash\");\n if (AllGangs[otherGang] == null) {\n throw makeRuntimeErrorMsg(`gang.${getChanceToWinClash}`, `Invalid gang: ${otherGang}`);\n }\n\n const playerPower = AllGangs[Player.gang.facName].power;\n const otherPower = AllGangs[otherGang].power;\n\n return playerPower / (otherPower + playerPower);\n },\n getBonusTime: function () {\n updateDynamicRam(\"getBonusTime\", getRamCost(\"gang\", \"getBonusTime\"));\n checkGangApiAccess(\"getBonusTime\");\n return Math.round(Player.gang.storedCycles / 5);\n },\n }, // end gang namespace\n\n // Bladeburner API\n bladeburner: {\n getContractNames: function () {\n updateDynamicRam(\"getContractNames\", getRamCost(\"bladeburner\", \"getContractNames\"));\n checkBladeburnerAccess(\"getContractNames\");\n return Player.bladeburner.getContractNamesNetscriptFn();\n },\n getOperationNames: function () {\n updateDynamicRam(\"getOperationNames\", getRamCost(\"bladeburner\", \"getOperationNames\"));\n checkBladeburnerAccess(\"getOperationNames\");\n return Player.bladeburner.getOperationNamesNetscriptFn();\n },\n getBlackOpNames: function () {\n updateDynamicRam(\"getBlackOpNames\", getRamCost(\"bladeburner\", \"getBlackOpNames\"));\n checkBladeburnerAccess(\"getBlackOpNames\");\n return Player.bladeburner.getBlackOpNamesNetscriptFn();\n },\n getBlackOpRank: function (name = \"\") {\n updateDynamicRam(\"getBlackOpRank\", getRamCost(\"bladeburner\", \"getBlackOpRank\"));\n checkBladeburnerAccess(\"getBlackOpRank\");\n const action = getBladeburnerActionObject(\"getBlackOpRank\", \"blackops\", name);\n return action.reqdRank;\n },\n getGeneralActionNames: function () {\n updateDynamicRam(\"getGeneralActionNames\", getRamCost(\"bladeburner\", \"getGeneralActionNames\"));\n checkBladeburnerAccess(\"getGeneralActionNames\");\n return Player.bladeburner.getGeneralActionNamesNetscriptFn();\n },\n getSkillNames: function () {\n updateDynamicRam(\"getSkillNames\", getRamCost(\"bladeburner\", \"getSkillNames\"));\n checkBladeburnerAccess(\"getSkillNames\");\n return Player.bladeburner.getSkillNamesNetscriptFn();\n },\n startAction: function (type = \"\", name = \"\") {\n updateDynamicRam(\"startAction\", getRamCost(\"bladeburner\", \"startAction\"));\n checkBladeburnerAccess(\"startAction\");\n try {\n return Player.bladeburner.startActionNetscriptFn(Player, type, name, workerScript);\n } catch (e) {\n throw makeRuntimeErrorMsg(\"bladeburner.startAction\", e);\n }\n },\n stopBladeburnerAction: function () {\n updateDynamicRam(\"stopBladeburnerAction\", getRamCost(\"bladeburner\", \"stopBladeburnerAction\"));\n checkBladeburnerAccess(\"stopBladeburnerAction\");\n return Player.bladeburner.resetAction();\n },\n getCurrentAction: function () {\n updateDynamicRam(\"getCurrentAction\", getRamCost(\"bladeburner\", \"getCurrentAction\"));\n checkBladeburnerAccess(\"getCurrentAction\");\n return Player.bladeburner.getTypeAndNameFromActionId(Player.bladeburner.action);\n },\n getActionTime: function (type = \"\", name = \"\") {\n updateDynamicRam(\"getActionTime\", getRamCost(\"bladeburner\", \"getActionTime\"));\n checkBladeburnerAccess(\"getActionTime\");\n try {\n return Player.bladeburner.getActionTimeNetscriptFn(Player, type, name, workerScript);\n } catch (e) {\n throw makeRuntimeErrorMsg(\"bladeburner.getActionTime\", e);\n }\n },\n getActionEstimatedSuccessChance: function (type = \"\", name = \"\") {\n updateDynamicRam(\n \"getActionEstimatedSuccessChance\",\n getRamCost(\"bladeburner\", \"getActionEstimatedSuccessChance\"),\n );\n checkBladeburnerAccess(\"getActionEstimatedSuccessChance\");\n try {\n return Player.bladeburner.getActionEstimatedSuccessChanceNetscriptFn(Player, type, name, workerScript);\n } catch (e) {\n throw makeRuntimeErrorMsg(\"bladeburner.getActionEstimatedSuccessChance\", e);\n }\n },\n getActionRepGain: function (type = \"\", name = \"\", level) {\n updateDynamicRam(\"getActionRepGain\", getRamCost(\"bladeburner\", \"getActionRepGain\"));\n checkBladeburnerAccess(\"getActionRepGain\");\n const action = getBladeburnerActionObject(\"getActionRepGain\", type, name);\n let rewardMultiplier;\n if (level == null || isNaN(level)) {\n rewardMultiplier = Math.pow(action.rewardFac, action.level - 1);\n } else {\n rewardMultiplier = Math.pow(action.rewardFac, level - 1);\n }\n\n return action.rankGain * rewardMultiplier * BitNodeMultipliers.BladeburnerRank;\n },\n getActionCountRemaining: function (type = \"\", name = \"\") {\n updateDynamicRam(\"getActionCountRemaining\", getRamCost(\"bladeburner\", \"getActionCountRemaining\"));\n checkBladeburnerAccess(\"getActionCountRemaining\");\n try {\n return Player.bladeburner.getActionCountRemainingNetscriptFn(type, name, workerScript);\n } catch (e) {\n throw makeRuntimeErrorMsg(\"bladeburner.getActionCountRemaining\", e);\n }\n },\n getActionMaxLevel: function (type = \"\", name = \"\") {\n updateDynamicRam(\"getActionMaxLevel\", getRamCost(\"bladeburner\", \"getActionMaxLevel\"));\n checkBladeburnerAccess(\"getActionMaxLevel\");\n const action = getBladeburnerActionObject(\"getActionMaxLevel\", type, name);\n return action.maxLevel;\n },\n getActionCurrentLevel: function (type = \"\", name = \"\") {\n updateDynamicRam(\"getActionCurrentLevel\", getRamCost(\"bladeburner\", \"getActionCurrentLevel\"));\n checkBladeburnerAccess(\"getActionCurrentLevel\");\n const action = getBladeburnerActionObject(\"getActionCurrentLevel\", type, name);\n return action.level;\n },\n getActionAutolevel: function (type = \"\", name = \"\") {\n updateDynamicRam(\"getActionAutolevel\", getRamCost(\"bladeburner\", \"getActionAutolevel\"));\n checkBladeburnerAccess(\"getActionAutolevel\");\n const action = getBladeburnerActionObject(\"getActionCurrentLevel\", type, name);\n return action.autoLevel;\n },\n setActionAutolevel: function (type = \"\", name = \"\", autoLevel = true) {\n updateDynamicRam(\"setActionAutolevel\", getRamCost(\"bladeburner\", \"setActionAutolevel\"));\n checkBladeburnerAccess(\"setActionAutolevel\");\n const action = getBladeburnerActionObject(\"setActionAutolevel\", type, name);\n action.autoLevel = autoLevel;\n },\n setActionLevel: function (type = \"\", name = \"\", level = 1) {\n updateDynamicRam(\"setActionLevel\", getRamCost(\"bladeburner\", \"setActionLevel\"));\n checkBladeburnerAccess(\"setActionLevel\");\n const action = getBladeburnerActionObject(\"setActionLevel\", type, name);\n if (level < 1 || level > action.maxLevel) {\n throw makeRuntimeErrorMsg(\n \"bladeburner.setActionLevel\",\n `Level must be between 1 and ${action.maxLevel}, is ${level}`,\n );\n }\n action.level = level;\n },\n getRank: function () {\n updateDynamicRam(\"getRank\", getRamCost(\"bladeburner\", \"getRank\"));\n checkBladeburnerAccess(\"getRank\");\n return Player.bladeburner.rank;\n },\n getSkillPoints: function () {\n updateDynamicRam(\"getSkillPoints\", getRamCost(\"bladeburner\", \"getSkillPoints\"));\n checkBladeburnerAccess(\"getSkillPoints\");\n return Player.bladeburner.skillPoints;\n },\n getSkillLevel: function (skillName = \"\") {\n updateDynamicRam(\"getSkillLevel\", getRamCost(\"bladeburner\", \"getSkillLevel\"));\n checkBladeburnerAccess(\"getSkillLevel\");\n try {\n return Player.bladeburner.getSkillLevelNetscriptFn(skillName, workerScript);\n } catch (e) {\n throw makeRuntimeErrorMsg(\"bladeburner.getSkillLevel\", e);\n }\n },\n getSkillUpgradeCost: function (skillName = \"\") {\n updateDynamicRam(\"getSkillUpgradeCost\", getRamCost(\"bladeburner\", \"getSkillUpgradeCost\"));\n checkBladeburnerAccess(\"getSkillUpgradeCost\");\n try {\n return Player.bladeburner.getSkillUpgradeCostNetscriptFn(skillName, workerScript);\n } catch (e) {\n throw makeRuntimeErrorMsg(\"bladeburner.getSkillUpgradeCost\", e);\n }\n },\n upgradeSkill: function (skillName) {\n updateDynamicRam(\"upgradeSkill\", getRamCost(\"bladeburner\", \"upgradeSkill\"));\n checkBladeburnerAccess(\"upgradeSkill\");\n try {\n return Player.bladeburner.upgradeSkillNetscriptFn(skillName, workerScript);\n } catch (e) {\n throw makeRuntimeErrorMsg(\"bladeburner.upgradeSkill\", e);\n }\n },\n getTeamSize: function (type = \"\", name = \"\") {\n updateDynamicRam(\"getTeamSize\", getRamCost(\"bladeburner\", \"getTeamSize\"));\n checkBladeburnerAccess(\"getTeamSize\");\n try {\n return Player.bladeburner.getTeamSizeNetscriptFn(type, name, workerScript);\n } catch (e) {\n throw makeRuntimeErrorMsg(\"bladeburner.getTeamSize\", e);\n }\n },\n setTeamSize: function (type = \"\", name = \"\", size) {\n updateDynamicRam(\"setTeamSize\", getRamCost(\"bladeburner\", \"setTeamSize\"));\n checkBladeburnerAccess(\"setTeamSize\");\n try {\n return Player.bladeburner.setTeamSizeNetscriptFn(type, name, size, workerScript);\n } catch (e) {\n throw makeRuntimeErrorMsg(\"bladeburner.setTeamSize\", e);\n }\n },\n getCityEstimatedPopulation: function (cityName) {\n updateDynamicRam(\"getCityEstimatedPopulation\", getRamCost(\"bladeburner\", \"getCityEstimatedPopulation\"));\n checkBladeburnerAccess(\"getCityEstimatedPopulation\");\n checkBladeburnerCity(\"getCityEstimatedPopulation\", cityName);\n return Player.bladeburner.cities[cityName].popEst;\n },\n getCityEstimatedCommunities: function (cityName) {\n updateDynamicRam(\"getCityEstimatedCommunities\", getRamCost(\"bladeburner\", \"getCityEstimatedCommunities\"));\n checkBladeburnerAccess(\"getCityEstimatedCommunities\");\n checkBladeburnerCity(\"getCityEstimatedCommunities\", cityName);\n return Player.bladeburner.cities[cityName].commsEst;\n },\n getCityChaos: function (cityName) {\n updateDynamicRam(\"getCityChaos\", getRamCost(\"bladeburner\", \"getCityChaos\"));\n checkBladeburnerAccess(\"getCityChaos\");\n checkBladeburnerCity(\"getCityChaos\", cityName);\n return Player.bladeburner.cities[cityName].chaos;\n },\n getCity: function () {\n updateDynamicRam(\"getCity\", getRamCost(\"bladeburner\", \"getCity\"));\n checkBladeburnerAccess(\"getCityChaos\");\n return Player.bladeburner.city;\n },\n switchCity: function (cityName) {\n updateDynamicRam(\"switchCity\", getRamCost(\"bladeburner\", \"switchCity\"));\n checkBladeburnerAccess(\"switchCity\");\n checkBladeburnerCity(\"switchCity\", cityName);\n return (Player.bladeburner.city = cityName);\n },\n getStamina: function () {\n updateDynamicRam(\"getStamina\", getRamCost(\"bladeburner\", \"getStamina\"));\n checkBladeburnerAccess(\"getStamina\");\n return [Player.bladeburner.stamina, Player.bladeburner.maxStamina];\n },\n joinBladeburnerFaction: function () {\n updateDynamicRam(\"joinBladeburnerFaction\", getRamCost(\"bladeburner\", \"joinBladeburnerFaction\"));\n checkBladeburnerAccess(\"joinBladeburnerFaction\", true);\n return Player.bladeburner.joinBladeburnerFactionNetscriptFn(workerScript);\n },\n joinBladeburnerDivision: function () {\n updateDynamicRam(\"joinBladeburnerDivision\", getRamCost(\"bladeburner\", \"joinBladeburnerDivision\"));\n checkBladeburnerAccess(\"joinBladeburnerDivision\", true);\n if (Player.bitNodeN === 7 || SourceFileFlags[7] > 0) {\n if (Player.bitNodeN === 8) {\n return false;\n }\n if (Player.bladeburner instanceof Bladeburner) {\n return true; // Already member\n } else if (\n Player.strength >= 100 &&\n Player.defense >= 100 &&\n Player.dexterity >= 100 &&\n Player.agility >= 100\n ) {\n Player.bladeburner = new Bladeburner(Player);\n workerScript.log(\"joinBladeburnerDivision\", \"You have been accepted into the Bladeburner division\");\n\n const worldHeader = document.getElementById(\"world-menu-header\");\n if (worldHeader instanceof HTMLElement) {\n worldHeader.click();\n worldHeader.click();\n }\n\n return true;\n } else {\n workerScript.log(\n \"joinBladeburnerDivision\",\n \"You do not meet the requirements for joining the Bladeburner division\",\n );\n return false;\n }\n }\n },\n getBonusTime: function () {\n updateDynamicRam(\"getBonusTime\", getRamCost(\"bladeburner\", \"getBonusTime\"));\n checkBladeburnerAccess(\"getBonusTime\");\n return Math.round(Player.bladeburner.storedCycles / 5);\n },\n }, // End Bladeburner\n\n // Hi, if you're reading this you're a bit nosy.\n // There's a corporation API but it's very imbalanced right now.\n // It's here so players can test with if they want.\n corporation: {\n expandIndustry: function (industryName, divisionName) {\n NewIndustry(Player.corporation, industryName, divisionName);\n },\n expandCity: function (divisionName, cityName) {\n const division = getDivision(divisionName);\n NewCity(Player.corporation, division, cityName);\n },\n unlockUpgrade: function (upgradeName) {\n const upgrade = Object.values(CorporationUnlockUpgrades).find((upgrade) => upgrade[2] === upgradeName);\n if (upgrade === undefined) throw new Error(`No upgrade named '${upgradeName}'`);\n UnlockUpgrade(Player.corporation, upgrade);\n },\n levelUpgrade: function (upgradeName) {\n const upgrade = Object.values(CorporationUpgrades).find((upgrade) => upgrade[4] === upgradeName);\n if (upgrade === undefined) throw new Error(`No upgrade named '${upgradeName}'`);\n LevelUpgrade(Player.corporation, upgrade);\n },\n issueDividends: function (percent) {\n IssueDividends(Player.corporation, percent);\n },\n sellMaterial: function (divisionName, cityName, materialName, amt, price) {\n const material = getMaterial(divisionName, cityName, materialName);\n SellMaterial(material, amt, price);\n },\n sellProduct: function (divisionName, cityName, productName, amt, price, all) {\n const product = getProduct(divisionName, productName);\n SellProduct(product, cityName, amt, price, all);\n },\n discontinueProduct: function (divisionName, productName) {\n getDivision(divisionName).discontinueProduct(getProduct(divisionName, productName));\n },\n setSmartSupply: function (divisionName, cityName, enabled) {\n const warehouse = getWarehouse(divisionName, cityName);\n SetSmartSupply(warehouse, enabled);\n },\n setSmartSupplyUseLeftovers: function () {},\n buyMaterial: function (divisionName, cityName, materialName, amt) {\n const material = getMaterial(divisionName, cityName, materialName);\n BuyMaterial(material, amt);\n },\n employees: function (divisionName, cityName) {\n const office = getOffice(divisionName, cityName);\n return office.employees.map((e) => Object.assign({}, e));\n },\n assignJob: function (divisionName, cityName, employeeName, job) {\n const employee = getEmployee(divisionName, cityName, employeeName);\n AssignJob(employee, job);\n },\n hireEmployee: function (divisionName, cityName) {\n const office = getOffice(divisionName, cityName);\n office.hireRandomEmployee();\n },\n upgradeOfficeSize: function (divisionName, cityName, size) {\n const office = getOffice(divisionName, cityName);\n UpgradeOfficeSize(Player.corporation, office, size);\n },\n throwParty: function (divisionName, cityName, costPerEmployee) {\n const office = getOffice(divisionName, cityName);\n ThrowParty(Player.corporation, office, costPerEmployee);\n },\n purchaseWarehouse: function (divisionName, cityName) {\n PurchaseWarehouse(Player.corporation, getDivision(divisionName), cityName);\n },\n upgradeWarehouse: function (divisionName, cityName) {\n UpgradeWarehouse(Player.corporation, getDivision(divisionName), getWarehouse(divisionName, cityName));\n },\n buyCoffee: function (divisionName, cityName) {\n BuyCoffee(Player.corporation, getDivision(divisionName), getOffice(divisionName, cityName));\n },\n hireAdVert: function (divisionName) {\n HireAdVert(Player.corporation, getDivision(divisionName), getOffice(divisionName, \"Sector-12\"));\n },\n makeProduct: function (divisionName, cityName, productName, designInvest, marketingInvest) {\n MakeProduct(\n Player.corporation,\n getDivision(divisionName),\n cityName,\n productName,\n designInvest,\n marketingInvest,\n );\n },\n research: function (divisionName, researchName) {\n Research(getDivision(divisionName), researchName);\n },\n exportMaterial: function (sourceDivision, sourceCity, targetDivision, targetCity, materialName, amt) {\n ExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName), amt + \"\");\n },\n cancelExportMaterial: function (sourceDivision, sourceCity, targetDivision, targetCity, materialName, amt) {\n CancelExportMaterial(\n targetDivision,\n targetCity,\n getMaterial(sourceDivision, sourceCity, materialName),\n amt + \"\",\n );\n },\n setMaterialMarketTA1: function (divisionName, cityName, materialName, on) {\n SetMaterialMarketTA1(getMaterial(divisionName, cityName, materialName), on);\n },\n setMaterialMarketTA2: function (divisionName, cityName, materialName, on) {\n SetMaterialMarketTA2(getMaterial(divisionName, cityName, materialName), on);\n },\n setProductMarketTA1: function (divisionName, productName, on) {\n SetProductMarketTA1(getProduct(divisionName, productName), on);\n },\n setProductMarketTA2: function (divisionName, productName, on) {\n SetProductMarketTA2(getProduct(divisionName, productName), on);\n },\n // If you modify these objects you will affect them for real, it's not\n // copies.\n getDivision: function (divisionName) {\n return getDivision(divisionName);\n },\n getOffice: function (divisionName, cityName) {\n return getOffice(divisionName, cityName);\n },\n getWarehouse: function (divisionName, cityName) {\n return getWarehouse(divisionName, cityName);\n },\n getMaterial: function (divisionName, cityName, materialName) {\n return getMaterial(divisionName, cityName, materialName);\n },\n getProduct: function (divisionName, productName) {\n return getProduct(divisionName, productName);\n },\n getEmployee: function (divisionName, cityName, employeeName) {\n return getEmployee(divisionName, cityName, employeeName);\n },\n }, // End Corporation API\n\n // Coding Contract API\n codingcontract: {\n attempt: function (answer, fn, ip = workerScript.serverIp, { returnReward } = {}) {\n updateDynamicRam(\"attempt\", getRamCost(\"codingcontract\", \"attempt\"));\n const contract = getCodingContract(\"attempt\", ip, fn);\n\n // Convert answer to string. If the answer is a 2D array, then we have to\n // manually add brackets for the inner arrays\n if (is2DArray(answer)) {\n let answerComponents = [];\n for (let i = 0; i < answer.length; ++i) {\n answerComponents.push([\"[\", answer[i].toString(), \"]\"].join(\"\"));\n }\n\n answer = answerComponents.join(\",\");\n } else {\n answer = String(answer);\n }\n\n const serv = safeGetServer(ip, \"codingcontract.attempt\");\n if (contract.isSolution(answer)) {\n const reward = Player.gainCodingContractReward(contract.reward, contract.getDifficulty());\n workerScript.log(\"attempt\", `Successfully completed Coding Contract '${fn}'. Reward: ${reward}`);\n serv.removeContract(fn);\n return returnReward ? reward : true;\n } else {\n ++contract.tries;\n if (contract.tries >= contract.getMaxNumTries()) {\n workerScript.log(\"attempt\", `Coding Contract attempt '${fn}' failed. Contract is now self-destructing`);\n serv.removeContract(fn);\n } else {\n workerScript.log(\n \"attempt\",\n `Coding Contract attempt '${fn}' failed. ${\n contract.getMaxNumTries() - contract.tries\n } attempts remaining.`,\n );\n }\n\n return returnReward ? \"\" : false;\n }\n },\n getContractType: function (fn, ip = workerScript.serverIp) {\n updateDynamicRam(\"getContractType\", getRamCost(\"codingcontract\", \"getContractType\"));\n const contract = getCodingContract(\"getContractType\", ip, fn);\n return contract.getType();\n },\n getData: function (fn, ip = workerScript.serverIp) {\n updateDynamicRam(\"getData\", getRamCost(\"codingcontract\", \"getData\"));\n const contract = getCodingContract(\"getData\", ip, fn);\n const data = contract.getData();\n if (data.constructor === Array) {\n // For two dimensional arrays, we have to copy the internal arrays using\n // slice() as well. As of right now, no contract has arrays that have\n // more than two dimensions\n const copy = data.slice();\n for (let i = 0; i < copy.length; ++i) {\n if (data[i].constructor === Array) {\n copy[i] = data[i].slice();\n }\n }\n\n return copy;\n } else {\n return data;\n }\n },\n getDescription: function (fn, ip = workerScript.serverIp) {\n updateDynamicRam(\"getDescription\", getRamCost(\"codingcontract\", \"getDescription\"));\n const contract = getCodingContract(\"getDescription\", ip, fn);\n return contract.getDescription();\n },\n getNumTriesRemaining: function (fn, ip = workerScript.serverIp) {\n updateDynamicRam(\"getNumTriesRemaining\", getRamCost(\"codingcontract\", \"getNumTriesRemaining\"));\n const contract = getCodingContract(\"getNumTriesRemaining\", ip, fn);\n return contract.getMaxNumTries() - contract.tries;\n },\n }, // End coding contracts\n\n // Duplicate Sleeve API\n sleeve: {\n getNumSleeves: function () {\n updateDynamicRam(\"getNumSleeves\", getRamCost(\"sleeve\", \"getNumSleeves\"));\n checkSleeveAPIAccess(\"getNumSleeves\");\n return Player.sleeves.length;\n },\n setToShockRecovery: function (sleeveNumber = 0) {\n updateDynamicRam(\"setToShockRecovery\", getRamCost(\"sleeve\", \"setToShockRecovery\"));\n checkSleeveAPIAccess(\"setToShockRecovery\");\n checkSleeveNumber(\"setToShockRecovery\", sleeveNumber);\n return Player.sleeves[sleeveNumber].shockRecovery(Player);\n },\n setToSynchronize: function (sleeveNumber = 0) {\n updateDynamicRam(\"setToSynchronize\", getRamCost(\"sleeve\", \"setToSynchronize\"));\n checkSleeveAPIAccess(\"setToSynchronize\");\n checkSleeveNumber(\"setToSynchronize\", sleeveNumber);\n return Player.sleeves[sleeveNumber].synchronize(Player);\n },\n setToCommitCrime: function (sleeveNumber = 0, crimeName = \"\") {\n updateDynamicRam(\"setToCommitCrime\", getRamCost(\"sleeve\", \"setToCommitCrime\"));\n checkSleeveAPIAccess(\"setToCommitCrime\");\n checkSleeveNumber(\"setToCommitCrime\", sleeveNumber);\n return Player.sleeves[sleeveNumber].commitCrime(Player, crimeName);\n },\n setToUniversityCourse: function (sleeveNumber = 0, universityName = \"\", className = \"\") {\n updateDynamicRam(\"setToUniversityCourse\", getRamCost(\"sleeve\", \"setToUniversityCourse\"));\n checkSleeveAPIAccess(\"setToUniversityCourse\");\n checkSleeveNumber(\"setToUniversityCourse\", sleeveNumber);\n return Player.sleeves[sleeveNumber].takeUniversityCourse(Player, universityName, className);\n },\n travel: function (sleeveNumber = 0, cityName = \"\") {\n updateDynamicRam(\"travel\", getRamCost(\"sleeve\", \"travel\"));\n checkSleeveAPIAccess(\"travel\");\n checkSleeveNumber(\"travel\", sleeveNumber);\n return Player.sleeves[sleeveNumber].travel(Player, cityName);\n },\n setToCompanyWork: function (sleeveNumber = 0, companyName = \"\") {\n updateDynamicRam(\"setToCompanyWork\", getRamCost(\"sleeve\", \"setToCompanyWork\"));\n checkSleeveAPIAccess(\"setToCompanyWork\");\n checkSleeveNumber(\"setToCompanyWork\", sleeveNumber);\n\n // Cannot work at the same company that another sleeve is working at\n for (let i = 0; i < Player.sleeves.length; ++i) {\n if (i === sleeveNumber) {\n continue;\n }\n const other = Player.sleeves[i];\n if (other.currentTask === SleeveTaskType.Company && other.currentTaskLocation === companyName) {\n throw makeRuntimeErrorMsg(\n \"sleeve.setToFactionWork\",\n `Sleeve ${sleeveNumber} cannot work for company ${companyName} because Sleeve ${i} is already working for them.`,\n );\n }\n }\n\n return Player.sleeves[sleeveNumber].workForCompany(Player, companyName);\n },\n setToFactionWork: function (sleeveNumber = 0, factionName = \"\", workType = \"\") {\n updateDynamicRam(\"setToFactionWork\", getRamCost(\"sleeve\", \"setToFactionWork\"));\n checkSleeveAPIAccess(\"setToFactionWork\");\n checkSleeveNumber(\"setToFactionWork\", sleeveNumber);\n\n // Cannot work at the same faction that another sleeve is working at\n for (let i = 0; i < Player.sleeves.length; ++i) {\n if (i === sleeveNumber) {\n continue;\n }\n const other = Player.sleeves[i];\n if (other.currentTask === SleeveTaskType.Faction && other.currentTaskLocation === factionName) {\n throw makeRuntimeErrorMsg(\n \"sleeve.setToFactionWork\",\n `Sleeve ${sleeveNumber} cannot work for faction ${factionName} because Sleeve ${i} is already working for them.`,\n );\n }\n }\n\n return Player.sleeves[sleeveNumber].workForFaction(Player, factionName, workType);\n },\n setToGymWorkout: function (sleeveNumber = 0, gymName = \"\", stat = \"\") {\n updateDynamicRam(\"setToGymWorkout\", getRamCost(\"sleeve\", \"setToGymWorkout\"));\n checkSleeveAPIAccess(\"setToGymWorkout\");\n checkSleeveNumber(\"setToGymWorkout\", sleeveNumber);\n\n return Player.sleeves[sleeveNumber].workoutAtGym(Player, gymName, stat);\n },\n getSleeveStats: function (sleeveNumber = 0) {\n updateDynamicRam(\"getSleeveStats\", getRamCost(\"sleeve\", \"getSleeveStats\"));\n checkSleeveAPIAccess(\"getSleeveStats\");\n checkSleeveNumber(\"getSleeveStats\", sleeveNumber);\n\n const sl = Player.sleeves[sleeveNumber];\n return {\n shock: 100 - sl.shock,\n sync: sl.sync,\n hacking_skill: sl.hacking_skill,\n strength: sl.strength,\n defense: sl.defense,\n dexterity: sl.dexterity,\n agility: sl.agility,\n charisma: sl.charisma,\n };\n },\n getTask: function (sleeveNumber = 0) {\n updateDynamicRam(\"getTask\", getRamCost(\"sleeve\", \"getTask\"));\n checkSleeveAPIAccess(\"getTask\");\n checkSleeveNumber(\"getTask\", sleeveNumber);\n\n const sl = Player.sleeves[sleeveNumber];\n return {\n task: SleeveTaskType[sl.currentTask],\n crime: sl.crimeType,\n location: sl.currentTaskLocation,\n gymStatType: sl.gymStatType,\n factionWorkType: FactionWorkType[sl.factionWorkType],\n };\n },\n getInformation: function (sleeveNumber = 0) {\n updateDynamicRam(\"getInformation\", getRamCost(\"sleeve\", \"getInformation\"));\n checkSleeveAPIAccess(\"getInformation\");\n checkSleeveNumber(\"getInformation\", sleeveNumber);\n\n const sl = Player.sleeves[sleeveNumber];\n return {\n city: sl.city,\n hp: sl.hp,\n jobs: Object.keys(Player.jobs), // technically sleeves have the same jobs as the player.\n jobTitle: Object.values(Player.jobs),\n maxHp: sl.max_hp,\n tor: SpecialServerIps.hasOwnProperty(\"Darkweb Server\"), // There's no reason not to give that infomation here as well. Worst case scenario it isn't used.\n\n mult: {\n agility: sl.agility_mult,\n agilityExp: sl.agility_exp_mult,\n companyRep: sl.company_rep_mult,\n crimeMoney: sl.crime_money_mult,\n crimeSuccess: sl.crime_success_mult,\n defense: sl.defense_mult,\n defenseExp: sl.defense_exp_mult,\n dexterity: sl.dexterity_mult,\n dexterityExp: sl.dexterity_exp_mult,\n factionRep: sl.faction_rep_mult,\n hacking: sl.hacking_mult,\n hackingExp: sl.hacking_exp_mult,\n strength: sl.strength_mult,\n strengthExp: sl.strength_exp_mult,\n workMoney: sl.work_money_mult,\n },\n\n timeWorked: sl.currentTaskTime,\n earningsForSleeves: {\n workHackExpGain: sl.earningsForSleeves.hack,\n workStrExpGain: sl.earningsForSleeves.str,\n workDefExpGain: sl.earningsForSleeves.def,\n workDexExpGain: sl.earningsForSleeves.dex,\n workAgiExpGain: sl.earningsForSleeves.agi,\n workChaExpGain: sl.earningsForSleeves.cha,\n workMoneyGain: sl.earningsForSleeves.money,\n },\n earningsForPlayer: {\n workHackExpGain: sl.earningsForPlayer.hack,\n workStrExpGain: sl.earningsForPlayer.str,\n workDefExpGain: sl.earningsForPlayer.def,\n workDexExpGain: sl.earningsForPlayer.dex,\n workAgiExpGain: sl.earningsForPlayer.agi,\n workChaExpGain: sl.earningsForPlayer.cha,\n workMoneyGain: sl.earningsForPlayer.money,\n },\n earningsForTask: {\n workHackExpGain: sl.earningsForTask.hack,\n workStrExpGain: sl.earningsForTask.str,\n workDefExpGain: sl.earningsForTask.def,\n workDexExpGain: sl.earningsForTask.dex,\n workAgiExpGain: sl.earningsForTask.agi,\n workChaExpGain: sl.earningsForTask.cha,\n workMoneyGain: sl.earningsForTask.money,\n },\n workRepGain: sl.getRepGain(Player),\n };\n },\n getSleeveAugmentations: function (sleeveNumber = 0) {\n updateDynamicRam(\"getSleeveAugmentations\", getRamCost(\"sleeve\", \"getSleeveAugmentations\"));\n checkSleeveAPIAccess(\"getSleeveAugmentations\");\n checkSleeveNumber(\"getSleeveAugmentations\", sleeveNumber);\n\n const augs = [];\n for (let i = 0; i < Player.sleeves[sleeveNumber].augmentations.length; i++) {\n augs.push(Player.sleeves[sleeveNumber].augmentations[i].name);\n }\n return augs;\n },\n getSleevePurchasableAugs: function (sleeveNumber = 0) {\n updateDynamicRam(\"getSleevePurchasableAugs\", getRamCost(\"sleeve\", \"getSleevePurchasableAugs\"));\n checkSleeveAPIAccess(\"getSleevePurchasableAugs\");\n checkSleeveNumber(\"getSleevePurchasableAugs\", sleeveNumber);\n\n const purchasableAugs = findSleevePurchasableAugs(Player.sleeves[sleeveNumber], Player);\n const augs = [];\n for (let i = 0; i < purchasableAugs.length; i++) {\n const aug = purchasableAugs[i];\n augs.push({\n name: aug.name,\n cost: aug.startingCost,\n });\n }\n\n return augs;\n },\n purchaseSleeveAug: function (sleeveNumber = 0, augName = \"\") {\n updateDynamicRam(\"purchaseSleeveAug\", getRamCost(\"sleeve\", \"purchaseSleeveAug\"));\n checkSleeveAPIAccess(\"purchaseSleeveAug\");\n checkSleeveNumber(\"purchaseSleeveAug\", sleeveNumber);\n\n const aug = Augmentations[augName];\n if (!aug) {\n throw makeRuntimeErrorMsg(\"sleeve.purchaseSleeveAug\", `Invalid aug: ${augName}`);\n }\n\n return Player.sleeves[sleeveNumber].tryBuyAugmentation(Player, aug);\n },\n }, // End sleeve\n formulas: {\n basic: {\n calculateSkill: function (exp, mult = 1) {\n checkFormulasAccess(\"basic.calculateSkill\", 5);\n return calculateSkill(exp, mult);\n },\n calculateExp: function (skill, mult = 1) {\n checkFormulasAccess(\"basic.calculateExp\", 5);\n return calculateExp(skill, mult);\n },\n hackChance: function (server, player) {\n checkFormulasAccess(\"basic.hackChance\", 5);\n return calculateHackingChance(server, player);\n },\n hackExp: function (server, player) {\n checkFormulasAccess(\"basic.hackExp\", 5);\n return calculateHackingExpGain(server, player);\n },\n hackPercent: function (server, player) {\n checkFormulasAccess(\"basic.hackPercent\", 5);\n return calculatePercentMoneyHacked(server, player);\n },\n growPercent: function (server, threads, player, cores = 1) {\n checkFormulasAccess(\"basic.growPercent\", 5);\n return calculateServerGrowth(server, threads, player, cores);\n },\n hackTime: function (server, player) {\n checkFormulasAccess(\"basic.hackTime\", 5);\n return calculateHackingTime(server, player);\n },\n growTime: function (server, player) {\n checkFormulasAccess(\"basic.growTime\", 5);\n return calculateGrowTime(server, player);\n },\n weakenTime: function (server, player) {\n checkFormulasAccess(\"basic.weakenTime\", 5);\n return calculateWeakenTime(server, player);\n },\n },\n hacknetNodes: {\n moneyGainRate: function (level, ram, cores, mult = 1) {\n checkFormulasAccess(\"hacknetNodes.moneyGainRate\", 5);\n return calculateMoneyGainRate(level, ram, cores, mult);\n },\n levelUpgradeCost: function (startingLevel, extraLevels = 1, costMult = 1) {\n checkFormulasAccess(\"hacknetNodes.levelUpgradeCost\", 5);\n return calculateLevelUpgradeCost(startingLevel, extraLevels, costMult);\n },\n ramUpgradeCost: function (startingRam, extraLevels = 1, costMult = 1) {\n checkFormulasAccess(\"hacknetNodes.ramUpgradeCost\", 5);\n return calculateRamUpgradeCost(startingRam, extraLevels, costMult);\n },\n coreUpgradeCost: function (startingCore, extraCores = 1, costMult = 1) {\n checkFormulasAccess(\"hacknetNodes.coreUpgradeCost\", 5);\n return calculateCoreUpgradeCost(startingCore, extraCores, costMult);\n },\n hacknetNodeCost: function (n, mult) {\n checkFormulasAccess(\"hacknetNodes.hacknetNodeCost\", 5);\n return calculateNodeCost(n, mult);\n },\n constants: function () {\n checkFormulasAccess(\"hacknetNodes.constants\", 5);\n return Object.assign({}, HacknetNodeConstants);\n },\n },\n hacknetServers: {\n hashGainRate: function (level, ramUsed, maxRam, cores, mult = 1) {\n checkFormulasAccess(\"hacknetServers.hashGainRate\", 9);\n return HScalculateHashGainRate(level, ramUsed, maxRam, cores, mult);\n },\n levelUpgradeCost: function (startingLevel, extraLevels = 1, costMult = 1) {\n checkFormulasAccess(\"hacknetServers.levelUpgradeCost\", 9);\n return HScalculateLevelUpgradeCost(startingLevel, extraLevels, costMult);\n },\n ramUpgradeCost: function (startingRam, extraLevels = 1, costMult = 1) {\n checkFormulasAccess(\"hacknetServers.ramUpgradeCost\", 9);\n return HScalculateRamUpgradeCost(startingRam, extraLevels, costMult);\n },\n coreUpgradeCost: function (startingCore, extraCores = 1, costMult = 1) {\n checkFormulasAccess(\"hacknetServers.coreUpgradeCost\", 9);\n return HScalculateCoreUpgradeCost(startingCore, extraCores, costMult);\n },\n cacheUpgradeCost: function (startingCache, extraCache = 1, costMult = 1) {\n checkFormulasAccess(\"hacknetServers.cacheUpgradeCost\", 9);\n return HScalculateCacheUpgradeCost(startingCache, extraCache, costMult);\n },\n hashUpgradeCost: function (upgName, level) {\n checkFormulasAccess(\"hacknetServers.hashUpgradeCost\", 9);\n const upg = Player.hashManager.getUpgrade(upgName);\n if (!upg) {\n throw makeRuntimeErrorMsg(\n \"formulas.hacknetServers.calculateHashUpgradeCost\",\n `Invalid Hash Upgrade: ${upgName}`,\n );\n }\n return upg.getCost(level);\n },\n hacknetServerCost: function (n, mult) {\n checkFormulasAccess(\"hacknetServers.hacknetServerCost\", 9);\n return HScalculateServerCost(n, mult);\n },\n constants: function () {\n checkFormulasAccess(\"hacknetServers.constants\", 9);\n return Object.assign({}, HacknetServerConstants);\n },\n },\n }, // end formulas\n heart: {\n // Easter egg function\n break: function () {\n return Player.karma;\n },\n },\n exploit: function () {\n Player.giveExploit(Exploit.UndocumentedFunctionCall);\n },\n bypass: function (doc) {\n // reset both fields first\n doc.completely_unused_field = undefined;\n document.completely_unused_field = undefined;\n // set one to true and check that it affected the other.\n document.completely_unused_field = true;\n if (doc.completely_unused_field && workerScript.ramUsage === 1.6) {\n Player.giveExploit(Exploit.Bypass);\n }\n doc.completely_unused_field = undefined;\n document.completely_unused_field = undefined;\n },\n flags: function (data) {\n data = toNative(data);\n // We always want the help flag.\n const args = {};\n\n for (const d of data) {\n let t = String;\n if (typeof d[1] === \"number\") {\n t = Number;\n } else if (typeof d[1] === \"boolean\") {\n t = Boolean;\n } else if (Array.isArray(d[1])) {\n t = [String];\n }\n const numDashes = d[0].length > 1 ? 2 : 1;\n args[\"-\".repeat(numDashes) + d[0]] = t;\n }\n const ret = libarg(args, { argv: workerScript.args });\n for (const d of data) {\n if (!ret.hasOwnProperty(\"--\" + d[0]) || !ret.hasOwnProperty(\"-\" + d[0])) ret[d[0]] = d[1];\n }\n for (const key of Object.keys(ret)) {\n if (!key.startsWith(\"-\")) continue;\n const value = ret[key];\n delete ret[key];\n const numDashes = key.length === 2 ? 1 : 2;\n ret[key.slice(numDashes)] = value;\n }\n return ret;\n },\n };\n\n function getFunctionNames(obj) {\n const functionNames = [];\n for (const [key, value] of Object.entries(obj)) {\n if (typeof value == \"function\") {\n functionNames.push(key);\n } else if (typeof value == \"object\") {\n functionNames.push(...getFunctionNames(value));\n }\n }\n return functionNames;\n }\n\n const possibleLogs = Object.fromEntries([...getFunctionNames(functions)].map((a) => [a, true]));\n\n return functions;\n} // End NetscriptFunction()\n\nexport { NetscriptFunctions };\n","/**\n * TODO\n * Add police clashes\n * balance point to keep them from running out of control\n */\n\nimport { Faction } from \"../Faction/Faction\";\nimport { Factions } from \"../Faction/Factions\";\n\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\nimport { Reviver, Generic_toJSON, Generic_fromJSON } from \"../../utils/JSONReviver\";\n\nimport { exceptionAlert } from \"../../utils/helpers/exceptionAlert\";\nimport { getRandomInt } from \"../../utils/helpers/getRandomInt\";\n\nimport { GangMemberUpgrade } from \"./GangMemberUpgrade\";\nimport { GangConstants } from \"./data/Constants\";\nimport { CONSTANTS } from \"../Constants\";\nimport { GangMemberTasks } from \"./GangMemberTasks\";\nimport { IAscensionResult } from \"./IAscensionResult\";\n\nimport { AllGangs } from \"./AllGangs\";\nimport { GangMember } from \"./GangMember\";\n\nimport { WorkerScript } from \"../Netscript/WorkerScript\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\n\nexport class Gang {\n facName: string;\n members: GangMember[];\n wanted: number;\n respect: number;\n\n isHackingGang: boolean;\n\n respectGainRate: number;\n wantedGainRate: number;\n moneyGainRate: number;\n\n storedCycles: number;\n\n storedTerritoryAndPowerCycles: number;\n\n territoryClashChance: number;\n territoryWarfareEngaged: boolean;\n\n notifyMemberDeath: boolean;\n\n constructor(facName = \"\", hacking = false) {\n this.facName = facName;\n this.members = [];\n this.wanted = 1;\n this.respect = 1;\n\n this.isHackingGang = hacking;\n\n this.respectGainRate = 0;\n this.wantedGainRate = 0;\n this.moneyGainRate = 0;\n\n // When processing gains, this stores the number of cycles until some\n // limit is reached, and then calculates and applies the gains only at that limit\n this.storedCycles = 0;\n\n // Separate variable to keep track of cycles for Territry + Power gang, which\n // happens on a slower \"clock\" than normal processing\n this.storedTerritoryAndPowerCycles = 0;\n\n this.territoryClashChance = 0;\n this.territoryWarfareEngaged = false;\n\n this.notifyMemberDeath = true;\n }\n\n getPower(): number {\n return AllGangs[this.facName].power;\n }\n\n getTerritory(): number {\n return AllGangs[this.facName].territory;\n }\n\n process(numCycles = 1, player: IPlayer): void {\n const CyclesPerSecond = 1000 / CONSTANTS._idleSpeed;\n\n if (isNaN(numCycles)) {\n console.error(`NaN passed into Gang.process(): ${numCycles}`);\n }\n this.storedCycles += numCycles;\n\n // Only process if there are at least 2 seconds, and at most 5 seconds\n if (this.storedCycles < 2 * CyclesPerSecond) return;\n const cycles = Math.min(this.storedCycles, 5 * CyclesPerSecond);\n\n try {\n this.processGains(cycles, player);\n this.processExperienceGains(cycles);\n this.processTerritoryAndPowerGains(cycles);\n this.storedCycles -= cycles;\n } catch (e) {\n console.error(`Exception caught when processing Gang: ${e}`);\n }\n }\n\n processGains(numCycles = 1, player: IPlayer): void {\n // Get gains per cycle\n let moneyGains = 0;\n let respectGains = 0;\n let wantedLevelGains = 0;\n let justice = 0;\n for (let i = 0; i < this.members.length; ++i) {\n respectGains += this.members[i].calculateRespectGain(this);\n moneyGains += this.members[i].calculateMoneyGain(this);\n const wantedLevelGain = this.members[i].calculateWantedLevelGain(this);\n wantedLevelGains += wantedLevelGain;\n if (this.members[i].getTask().baseWanted < 0) justice++; // this member is lowering wanted.\n }\n this.respectGainRate = respectGains;\n this.wantedGainRate = wantedLevelGains;\n this.moneyGainRate = moneyGains;\n const gain = respectGains * numCycles;\n this.respect += gain;\n // Faction reputation gains is respect gain divided by some constant\n const fac = Factions[this.facName];\n if (!(fac instanceof Faction)) {\n dialogBoxCreate(\n \"ERROR: Could not get Faction associates with your gang. This is a bug, please report to game dev\",\n );\n throw new Error(\"Could not find the faction associated with this gang.\");\n }\n const favorMult = 1 + fac.favor / 100;\n\n fac.playerReputation += (player.faction_rep_mult * gain * favorMult) / GangConstants.GangRespectToReputationRatio;\n\n // Keep track of respect gained per member\n for (let i = 0; i < this.members.length; ++i) {\n this.members[i].recordEarnedRespect(numCycles, this);\n }\n if (!(this.wanted === 1 && wantedLevelGains < 0)) {\n const oldWanted = this.wanted;\n let newWanted = oldWanted + wantedLevelGains * numCycles;\n newWanted = newWanted * (1 - justice * 0.001); // safeguard\n // Prevent overflow\n if (wantedLevelGains <= 0 && newWanted > oldWanted) newWanted = 1;\n\n this.wanted = newWanted;\n if (this.wanted < 1) this.wanted = 1;\n }\n player.gainMoney(moneyGains * numCycles);\n player.recordMoneySource(moneyGains * numCycles, \"gang\");\n }\n\n processTerritoryAndPowerGains(numCycles = 1): void {\n this.storedTerritoryAndPowerCycles += numCycles;\n if (this.storedTerritoryAndPowerCycles < GangConstants.CyclesPerTerritoryAndPowerUpdate) return;\n this.storedTerritoryAndPowerCycles -= GangConstants.CyclesPerTerritoryAndPowerUpdate;\n\n // Process power first\n const gangName = this.facName;\n for (const name in AllGangs) {\n if (AllGangs.hasOwnProperty(name)) {\n if (name == gangName) {\n AllGangs[name].power += this.calculatePower();\n } else {\n // All NPC gangs get random power gains\n const gainRoll = Math.random();\n if (gainRoll < 0.5) {\n // Multiplicative gain (50% chance)\n // This is capped per cycle, to prevent it from getting out of control\n const multiplicativeGain = AllGangs[name].power * 0.005;\n AllGangs[name].power += Math.min(0.85, multiplicativeGain);\n } else {\n // Additive gain (50% chance)\n const additiveGain = 0.75 * gainRoll * AllGangs[name].territory;\n AllGangs[name].power += additiveGain;\n }\n }\n }\n }\n\n // Determine if territory should be processed\n if (this.territoryWarfareEngaged) {\n this.territoryClashChance = 1;\n } else if (this.territoryClashChance > 0) {\n // Engagement turned off, but still a positive clash chance. So there's\n // still a chance of clashing but it slowly goes down over time\n this.territoryClashChance = Math.max(0, this.territoryClashChance - 0.01);\n }\n\n // Then process territory\n for (let i = 0; i < GangConstants.Names.length; ++i) {\n const others = GangConstants.Names.filter((e) => {\n return e !== GangConstants.Names[i];\n });\n const other = getRandomInt(0, others.length - 1);\n\n const thisGang = GangConstants.Names[i];\n const otherGang = others[other];\n\n // If either of the gangs involved in this clash is the player, determine\n // whether to skip or process it using the clash chance\n if (thisGang === gangName || otherGang === gangName) {\n if (!(Math.random() < this.territoryClashChance)) continue;\n }\n\n const thisPwr = AllGangs[thisGang].power;\n const otherPwr = AllGangs[otherGang].power;\n const thisChance = thisPwr / (thisPwr + otherPwr);\n\n function calculateTerritoryGain(winGang: string, loseGang: string): number {\n const powerBonus = Math.max(1, 1 + Math.log(AllGangs[winGang].power / AllGangs[loseGang].power) / Math.log(50));\n const gains = Math.min(AllGangs[loseGang].territory, powerBonus * 0.0001 * (Math.random() + 0.5));\n return gains;\n }\n\n if (Math.random() < thisChance) {\n if (AllGangs[otherGang].territory <= 0) return;\n const territoryGain = calculateTerritoryGain(thisGang, otherGang);\n AllGangs[thisGang].territory += territoryGain;\n AllGangs[otherGang].territory -= territoryGain;\n if (thisGang === gangName) {\n this.clash(true); // Player won\n AllGangs[otherGang].power *= 1 / 1.01;\n } else if (otherGang === gangName) {\n this.clash(false); // Player lost\n } else {\n AllGangs[otherGang].power *= 1 / 1.01;\n }\n } else {\n if (AllGangs[thisGang].territory <= 0) return;\n const territoryGain = calculateTerritoryGain(otherGang, thisGang);\n AllGangs[thisGang].territory -= territoryGain;\n AllGangs[otherGang].territory += territoryGain;\n if (thisGang === gangName) {\n this.clash(false); // Player lost\n } else if (otherGang === gangName) {\n this.clash(true); // Player won\n AllGangs[thisGang].power *= 1 / 1.01;\n } else {\n AllGangs[thisGang].power *= 1 / 1.01;\n }\n }\n }\n }\n\n processExperienceGains(numCycles = 1): void {\n for (let i = 0; i < this.members.length; ++i) {\n this.members[i].gainExperience(numCycles);\n this.members[i].updateSkillLevels();\n }\n }\n\n clash(won = false): void {\n // Determine if a gang member should die\n let baseDeathChance = 0.01;\n if (won) baseDeathChance /= 2;\n // If the clash was lost, the player loses a small percentage of power\n else AllGangs[this.facName].power *= 1 / 1.008;\n\n // Deaths can only occur during X% of clashes\n if (Math.random() < 0.65) return;\n\n for (let i = this.members.length - 1; i >= 0; --i) {\n const member = this.members[i];\n\n // Only members assigned to Territory Warfare can die\n if (member.task !== \"Territory Warfare\") continue;\n\n // Chance to die is decreased based on defense\n const modifiedDeathChance = baseDeathChance / Math.pow(member.def, 0.6);\n if (Math.random() < modifiedDeathChance) {\n this.killMember(member);\n }\n }\n }\n\n canRecruitMember(): boolean {\n if (this.members.length >= GangConstants.MaximumGangMembers) return false;\n return this.respect >= this.getRespectNeededToRecruitMember();\n }\n\n getRespectNeededToRecruitMember(): number {\n // First N gang members are free (can be recruited at 0 respect)\n const numFreeMembers = 3;\n if (this.members.length < numFreeMembers) return 0;\n\n const i = this.members.length - (numFreeMembers - 1);\n return Math.pow(5, i);\n }\n\n recruitMember(name: string): boolean {\n name = String(name);\n if (name === \"\" || !this.canRecruitMember()) return false;\n\n // Check for already-existing names\n const sameNames = this.members.filter((m) => m.name === name);\n if (sameNames.length >= 1) return false;\n\n const member = new GangMember(name);\n this.members.push(member);\n return true;\n }\n\n // Money and Respect gains multiplied by this number (< 1)\n getWantedPenalty(): number {\n return this.respect / (this.respect + this.wanted);\n }\n\n //Calculates power GAIN, which is added onto the Gang's existing power\n calculatePower(): number {\n let memberTotal = 0;\n for (let i = 0; i < this.members.length; ++i) {\n if (!GangMemberTasks.hasOwnProperty(this.members[i].task) || this.members[i].task !== \"Territory Warfare\")\n continue;\n memberTotal += this.members[i].calculatePower();\n }\n return 0.015 * Math.max(0.002, this.getTerritory()) * memberTotal;\n }\n\n killMember(member: GangMember): void {\n // Player loses a percentage of total respect, plus whatever respect that member has earned\n const totalRespect = this.respect;\n const lostRespect = 0.05 * totalRespect + member.earnedRespect;\n this.respect = Math.max(0, totalRespect - lostRespect);\n\n for (let i = 0; i < this.members.length; ++i) {\n if (member.name === this.members[i].name) {\n this.members.splice(i, 1);\n break;\n }\n }\n\n // Notify of death\n if (this.notifyMemberDeath) {\n dialogBoxCreate(`${member.name} was killed in a gang clash! You lost ${lostRespect} respect`);\n }\n }\n\n ascendMember(member: GangMember, workerScript?: WorkerScript): IAscensionResult {\n try {\n const res = member.ascend();\n this.respect = Math.max(1, this.respect - res.respect);\n if (workerScript) {\n workerScript.log(\"ascend\", `Ascended Gang member ${member.name}`);\n }\n return res;\n } catch (e) {\n if (workerScript == null) {\n exceptionAlert(e);\n }\n throw e; // Re-throw, will be caught in the Netscript Function\n }\n }\n\n // Cost of upgrade gets cheaper as gang increases in respect + power\n getDiscount(): number {\n const power = this.getPower();\n const respect = this.respect;\n\n const respectLinearFac = 5e6;\n const powerLinearFac = 1e6;\n const discount =\n Math.pow(respect, 0.01) + respect / respectLinearFac + Math.pow(power, 0.01) + power / powerLinearFac - 1;\n return Math.max(1, discount);\n }\n\n // Returns only valid tasks for this gang. Excludes 'Unassigned'\n getAllTaskNames(): string[] {\n return Object.keys(GangMemberTasks).filter((taskName: string) => {\n const task = GangMemberTasks[taskName];\n if (task == null) return false;\n if (task.name === \"Unassigned\") return false;\n // yes you need both checks\n return this.isHackingGang === task.isHacking || !this.isHackingGang === task.isCombat;\n });\n }\n\n getUpgradeCost(upg: GangMemberUpgrade | null): number {\n if (upg == null) {\n return Infinity;\n }\n return upg.cost / this.getDiscount();\n }\n\n /**\n * Serialize the current object to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"Gang\", this);\n }\n\n /**\n * Initiatizes a Gang object from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Gang {\n return Generic_fromJSON(Gang, value.data);\n }\n}\n\nReviver.constructors.Gang = Gang;\n","/**\n * Implementation of the mechanisms that allow the player to affect the\n * Stock Market\n */\nimport { Stock } from \"./Stock\";\nimport { StockMarket } from \"./StockMarket\";\n\nimport { Company } from \"../Company/Company\";\nimport { Server } from \"../Server/Server\";\n\n// Change in second-order forecast due to hacks/grows\nexport const forecastForecastChangeFromHack = 0.1;\n\n// Change in second-order forecast due to company work\nexport const forecastForecastChangeFromCompanyWork = 0.001;\n\n/**\n * Potentially decreases a stock's second-order forecast when its corresponding\n * server is hacked. The chance of the hack decreasing the stock's second-order\n * forecast is dependent on what percentage of the server's money is hacked\n * @param {Server} server - Server being hack()ed\n * @param {number} moneyHacked - Amount of money stolen from the server\n */\nexport function influenceStockThroughServerHack(server: Server, moneyHacked: number): void {\n const orgName = server.organizationName;\n let stock: Stock | null = null;\n if (typeof orgName === \"string\" && orgName !== \"\") {\n stock = StockMarket[orgName];\n }\n if (!(stock instanceof Stock)) {\n return;\n }\n\n const percTotalMoneyHacked = moneyHacked / server.moneyMax;\n if (Math.random() < percTotalMoneyHacked) {\n stock.changeForecastForecast(stock.otlkMagForecast - forecastForecastChangeFromHack);\n }\n}\n\n/**\n * Potentially increases a stock's second-order forecast when its corresponding\n * server is grown (grow()). The chance of the grow() to increase the stock's\n * second-order forecast is dependent on how much money is added to the server\n * @param {Server} server - Server being grow()n\n * @param {number} moneyHacked - Amount of money added to the server\n */\nexport function influenceStockThroughServerGrow(server: Server, moneyGrown: number): void {\n const orgName = server.organizationName;\n let stock: Stock | null = null;\n if (typeof orgName === \"string\" && orgName !== \"\") {\n stock = StockMarket[orgName];\n }\n if (!(stock instanceof Stock)) {\n return;\n }\n\n const percTotalMoneyGrown = moneyGrown / server.moneyMax;\n if (Math.random() < percTotalMoneyGrown) {\n stock.changeForecastForecast(stock.otlkMagForecast + forecastForecastChangeFromHack);\n }\n}\n\n/**\n * Potentially increases a stock's second-order forecast when the player works for\n * its corresponding company.\n * @param {Company} company - Company being worked for\n * @param {number} performanceMult - Effectiveness of player's work. Affects influence\n * @param {number} cyclesOfWork - # game cycles of work being processed\n */\nexport function influenceStockThroughCompanyWork(\n company: Company,\n performanceMult: number,\n cyclesOfWork: number,\n): void {\n const compName = company.name;\n let stock: Stock | null = null;\n if (typeof compName === \"string\" && compName !== \"\") {\n stock = StockMarket[compName];\n }\n if (!(stock instanceof Stock)) {\n return;\n }\n\n if (Math.random() < 0.002 * cyclesOfWork) {\n const change = forecastForecastChangeFromCompanyWork * performanceMult;\n stock.changeForecastForecast(stock.otlkMagForecast + change);\n }\n}\n","import { workerScripts } from \"./WorkerScripts\";\n\nlet pidCounter = 1;\n\n/**\n * Find and return the next availble PID for a script\n */\nexport function generateNextPid(): number {\n let tempCounter = pidCounter;\n\n // Cap the number of search iterations at some arbitrary value to avoid\n // infinite loops. We'll assume that players wont have 1mil+ running scripts\n let found = false;\n for (let i = 0; i < 1e6; ) {\n if (!workerScripts.has(tempCounter + i)) {\n found = true;\n tempCounter = tempCounter + i;\n break;\n }\n\n if (i === Number.MAX_SAFE_INTEGER - 1) {\n i = 1;\n } else {\n ++i;\n }\n }\n\n if (found) {\n pidCounter = tempCounter + 1;\n if (pidCounter >= Number.MAX_SAFE_INTEGER) {\n pidCounter = 1;\n }\n\n return tempCounter;\n } else {\n return -1;\n }\n}\n\nexport function resetPidCounter(): void {\n pidCounter = 1;\n}\n","import React, { useState } from \"react\";\n\nimport { CinematicLine } from \"./CinematicLine\";\n\ninterface IProps {\n lines: string[];\n auto?: boolean;\n onDone?: () => void;\n}\n\nexport function CinematicText(props: IProps): React.ReactElement {\n const [i, setI] = useState(0);\n const [done, setDone] = useState(false);\n\n function advance(): void {\n const newI = i + 1;\n setI(newI);\n if (newI >= props.lines.length) {\n if (props.onDone && props.auto) props.onDone();\n setDone(true);\n }\n }\n\n return (\n
\n {props.lines.slice(0, i).map((line, i) => (\n
{line}
\n ))}\n {props.lines.length > i && }\n {!props.auto && props.onDone && done && (\n \n )}\n
\n );\n}\n","import { getRandomInt } from \"./getRandomInt\";\n\n/**\n * Gets a random value in the range of a byte (0 - 255), or up to the maximum.\n * @param max The maximum value (up to 255).\n */\nexport function getRandomByte(max: number): number {\n // Technically 2^8 is 256, but the values are 0-255, not 1-256.\n const byteMaximum = 255;\n const upper: number = Math.max(Math.min(max, byteMaximum), 0);\n\n return getRandomInt(0, upper);\n}\n","/**\n * Utility function that creates a \"city map\", which is an object where\n * each city is a key (property).\n *\n * This map uses the official name of the city, NOT its key in the 'Cities' object\n */\nimport { Cities } from \"./Cities\";\nimport { IMap } from \"../types\";\n\nexport function createCityMap(initValue: T): IMap {\n const map: IMap = {};\n const cities = Object.keys(Cities);\n for (let i = 0; i < cities.length; ++i) {\n map[cities[i]] = initValue;\n }\n\n return map;\n}\n","/**\n * Represents a Hand of cards.\n *\n * This class is IMMUTABLE\n */\n\nimport { Card } from \"./Card\";\n\nexport class Hand {\n constructor(readonly cards: readonly Card[]) {}\n\n addCards(...cards: Card[]): Hand {\n return new Hand([...this.cards, ...cards]);\n }\n\n removeByIndex(i: number): Hand {\n if (i >= this.cards.length) {\n throw new Error(`Tried to remove invalid card from Hand by index: ${i}`);\n }\n\n return new Hand([...this.cards.slice().splice(i, 1)]);\n }\n}\n","/**\n * Functions used to determine whether the target can be hacked (or grown/weakened).\n * Meant to be used for Netscript implementation\n *\n * The returned status object's message should be used for logging in Netscript\n */\nimport { IReturnStatus } from \"../types\";\n\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { Server } from \"../Server/Server\";\n\nfunction baseCheck(server: Server, fnName: string): IReturnStatus {\n const hostname = server.hostname;\n\n if (!(\"requiredHackingSkill\" in server)) {\n return {\n res: false,\n msg: `Cannot ${fnName} ${hostname} server because it is a Hacknet Node`,\n };\n }\n\n if (server.hasAdminRights === false) {\n return {\n res: false,\n msg: `Cannot ${fnName} ${hostname} server because you do not have root access`,\n };\n }\n\n return { res: true };\n}\n\nexport function netscriptCanHack(server: Server, p: IPlayer): IReturnStatus {\n const initialCheck = baseCheck(server, \"hack\");\n if (!initialCheck.res) {\n return initialCheck;\n }\n\n const s = server;\n if (s.requiredHackingSkill > p.hacking_skill) {\n return {\n res: false,\n msg: `Cannot hack ${server.hostname} server because your hacking skill is not high enough`,\n };\n }\n\n return { res: true };\n}\n\nexport function netscriptCanGrow(server: Server): IReturnStatus {\n return baseCheck(server, \"grow\");\n}\n\nexport function netscriptCanWeaken(server: Server): IReturnStatus {\n return baseCheck(server, \"weaken\");\n}\n","/**\n * React Component for a button that initiates a transaction on the Stock Market UI\n * (Buy, Sell, Buy Max, etc.)\n */\nimport * as React from \"react\";\n\ntype IProps = {\n onClick: () => void;\n text: string;\n tooltip?: JSX.Element | null;\n};\n\nexport function StockTickerTxButton(props: IProps): React.ReactElement {\n let className = \"stock-market-input std-button\";\n\n const hasTooltip = props.tooltip != null;\n if (hasTooltip) {\n className += \" tooltip\";\n }\n\n return (\n \n );\n}\n","import React, { useState } from \"react\";\n\nimport { removePopup } from \"../../ui/React/createPopup\";\n\ninterface IProps {\n text: string;\n placeText: string;\n place: (price: number) => void;\n popupId: string;\n}\n\nexport function PlaceOrderPopup(props: IProps): React.ReactElement {\n const [price, setPrice] = useState(null);\n function onClick(): void {\n if (price === null) return;\n if (isNaN(price)) return;\n props.place(price);\n removePopup(props.popupId);\n }\n\n function onChange(event: React.ChangeEvent): void {\n if (event.target.value === \"\") setPrice(null);\n else setPrice(parseFloat(event.target.value));\n }\n return (\n <>\n

{props.text}

\n \n \n \n );\n}\n","/**\n * Abstract Base Class for any Server object\n */\nimport { CodingContract } from \"../CodingContracts\";\nimport { Message } from \"../Message/Message\";\nimport { RunningScript } from \"../Script/RunningScript\";\nimport { Script } from \"../Script/Script\";\nimport { isValidFilePath } from \"../Terminal/DirectoryHelpers\";\nimport { TextFile } from \"../TextFile\";\nimport { IReturnStatus } from \"../types\";\n\nimport { isScriptFilename } from \"../Script/ScriptHelpersTS\";\n\nimport { createRandomIp } from \"../../utils/IPAddress\";\nimport { compareArrays } from \"../../utils/helpers/compareArrays\";\n\ninterface IConstructorParams {\n adminRights?: boolean;\n hostname: string;\n ip?: string;\n isConnectedTo?: boolean;\n maxRam?: number;\n organizationName?: string;\n}\n\ninterface writeResult {\n success: boolean;\n overwritten: boolean;\n}\n\nexport class BaseServer {\n // Coding Contract files on this server\n contracts: CodingContract[] = [];\n\n // How many CPU cores this server has. Maximum of 8.\n // Currently, this only affects hacking missions\n cpuCores = 1;\n\n // Flag indicating whether the FTP port is open\n ftpPortOpen = false;\n\n // Flag indicating whether player has admin/root access to this server\n hasAdminRights = false;\n\n // Hostname. Must be unique\n hostname = \"\";\n\n // Flag indicating whether HTTP Port is open\n httpPortOpen = false;\n\n // IP Address. Must be unique\n ip = \"\";\n\n // Flag indicating whether player is curently connected to this server\n isConnectedTo = false;\n\n // RAM (GB) available on this server\n maxRam = 0;\n\n // Message files AND Literature files on this Server\n // For Literature files, this array contains only the filename (string)\n // For Messages, it contains the actual Message object\n // TODO Separate literature files into its own property\n messages: (Message | string)[] = [];\n\n // Name of company/faction/etc. that this server belongs to.\n // Optional, not applicable to all Servers\n organizationName = \"\";\n\n // Programs on this servers. Contains only the names of the programs\n programs: string[] = [];\n\n // RAM (GB) used. i.e. unavailable RAM\n ramUsed = 0;\n\n // RunningScript files on this server\n runningScripts: RunningScript[] = [];\n\n // Script files on this Server\n scripts: Script[] = [];\n\n // Contains the IP Addresses of all servers that are immediately\n // reachable from this one\n serversOnNetwork: string[] = [];\n\n // Flag indicating whether SMTP Port is open\n smtpPortOpen = false;\n\n // Flag indicating whether SQL Port is open\n sqlPortOpen = false;\n\n // Flag indicating whether the SSH Port is open\n sshPortOpen = false;\n\n // Text files on this server\n textFiles: TextFile[] = [];\n\n constructor(params: IConstructorParams = { hostname: \"\", ip: createRandomIp() }) {\n this.ip = params.ip ? params.ip : createRandomIp();\n\n this.hostname = params.hostname;\n this.organizationName = params.organizationName != null ? params.organizationName : \"\";\n this.isConnectedTo = params.isConnectedTo != null ? params.isConnectedTo : false;\n\n //Access information\n this.hasAdminRights = params.adminRights != null ? params.adminRights : false;\n }\n\n addContract(contract: CodingContract): void {\n this.contracts.push(contract);\n }\n\n getContract(contractName: string): CodingContract | null {\n for (const contract of this.contracts) {\n if (contract.fn === contractName) {\n return contract;\n }\n }\n return null;\n }\n\n /**\n * Find an actively running script on this server\n * @param scriptName - Filename of script to search for\n * @param scriptArgs - Arguments that script is being run with\n * @returns RunningScript for the specified active script\n * Returns null if no such script can be found\n */\n getRunningScript(scriptName: string, scriptArgs: any[]): RunningScript | null {\n for (const rs of this.runningScripts) {\n if (rs.filename === scriptName && compareArrays(rs.args, scriptArgs)) {\n return rs;\n }\n }\n\n return null;\n }\n\n /**\n * Given the name of the script, returns the corresponding\n * Script object on the server (if it exists)\n */\n getScript(scriptName: string): Script | null {\n for (let i = 0; i < this.scripts.length; i++) {\n if (this.scripts[i].filename === scriptName) {\n return this.scripts[i];\n }\n }\n\n return null;\n }\n\n /**\n * Returns boolean indicating whether the given script is running on this server\n */\n isRunning(fn: string): boolean {\n for (const runningScriptObj of this.runningScripts) {\n if (runningScriptObj.filename === fn) {\n return true;\n }\n }\n\n return false;\n }\n\n removeContract(contract: CodingContract): void {\n if (contract instanceof CodingContract) {\n this.contracts = this.contracts.filter((c) => {\n return c.fn !== contract.fn;\n });\n } else {\n this.contracts = this.contracts.filter((c) => {\n return c.fn !== contract;\n });\n }\n }\n\n /**\n * Remove a file from the server\n * @param fn {string} Name of file to be deleted\n * @returns {IReturnStatus} Return status object indicating whether or not file was deleted\n */\n removeFile(fn: string): IReturnStatus {\n if (fn.endsWith(\".exe\") || fn.match(/^.+\\.exe-\\d+(?:\\.\\d*)?%-INC$/) != null) {\n for (let i = 0; i < this.programs.length; ++i) {\n if (this.programs[i] === fn) {\n this.programs.splice(i, 1);\n return { res: true };\n }\n }\n } else if (isScriptFilename(fn)) {\n for (let i = 0; i < this.scripts.length; ++i) {\n if (this.scripts[i].filename === fn) {\n if (this.isRunning(fn)) {\n return {\n res: false,\n msg: \"Cannot delete a script that is currently running!\",\n };\n }\n\n this.scripts.splice(i, 1);\n return { res: true };\n }\n }\n } else if (fn.endsWith(\".lit\")) {\n for (let i = 0; i < this.messages.length; ++i) {\n const f = this.messages[i];\n if (typeof f === \"string\" && f === fn) {\n this.messages.splice(i, 1);\n return { res: true };\n }\n }\n } else if (fn.endsWith(\".txt\")) {\n for (let i = 0; i < this.textFiles.length; ++i) {\n if (this.textFiles[i].fn === fn) {\n this.textFiles.splice(i, 1);\n return { res: true };\n }\n }\n } else if (fn.endsWith(\".cct\")) {\n for (let i = 0; i < this.contracts.length; ++i) {\n if (this.contracts[i].fn === fn) {\n this.contracts.splice(i, 1);\n return { res: true };\n }\n }\n }\n\n return { res: false, msg: \"No such file exists\" };\n }\n\n /**\n * Called when a script is run on this server.\n * All this function does is add a RunningScript object to the\n * `runningScripts` array. It does NOT check whether the script actually can\n * be run.\n */\n runScript(script: RunningScript): void {\n this.runningScripts.push(script);\n }\n\n setMaxRam(ram: number): void {\n this.maxRam = ram;\n }\n\n /**\n * Write to a script file\n * Overwrites existing files. Creates new files if the script does not eixst\n */\n writeToScriptFile(fn: string, code: string): writeResult {\n const ret = { success: false, overwritten: false };\n if (!isValidFilePath(fn) || !isScriptFilename(fn)) {\n return ret;\n }\n\n // Check if the script already exists, and overwrite it if it does\n for (let i = 0; i < this.scripts.length; ++i) {\n if (fn === this.scripts[i].filename) {\n const script = this.scripts[i];\n script.code = code;\n script.updateRamUsage(this.scripts);\n script.markUpdated();\n ret.overwritten = true;\n ret.success = true;\n return ret;\n }\n }\n\n // Otherwise, create a new script\n const newScript = new Script(fn, code, this.ip, this.scripts);\n this.scripts.push(newScript);\n ret.success = true;\n return ret;\n }\n\n // Write to a text file\n // Overwrites existing files. Creates new files if the text file does not exist\n writeToTextFile(fn: string, txt: string): writeResult {\n const ret = { success: false, overwritten: false };\n if (!isValidFilePath(fn) || !fn.endsWith(\"txt\")) {\n return ret;\n }\n\n // Check if the text file already exists, and overwrite if it does\n for (let i = 0; i < this.textFiles.length; ++i) {\n if (this.textFiles[i].fn === fn) {\n ret.overwritten = true;\n this.textFiles[i].text = txt;\n ret.success = true;\n return ret;\n }\n }\n\n // Otherwise create a new text file\n const newFile = new TextFile(fn, txt);\n this.textFiles.push(newFile);\n ret.success = true;\n return ret;\n }\n}\n","/**\n * Implements RAM Calculation functionality.\n *\n * Uses the acorn.js library to parse a script's code into an AST and\n * recursively walk through that AST, calculating RAM usage along\n * the way\n */\nimport * as walk from \"acorn-walk\";\nimport { parse } from \"acorn\";\n\nimport { RamCalculationErrorCode } from \"./RamCalculationErrorCodes\";\n\nimport { RamCosts, RamCostConstants } from \"../Netscript/RamCostGenerator\";\n\n// These special strings are used to reference the presence of a given logical\n// construct within a user script.\nconst specialReferenceIF = \"__SPECIAL_referenceIf\";\nconst specialReferenceFOR = \"__SPECIAL_referenceFor\";\nconst specialReferenceWHILE = \"__SPECIAL_referenceWhile\";\n\n// The global scope of a script is registered under this key during parsing.\nconst memCheckGlobalKey = \".__GLOBAL__\";\n\n/**\n * Parses code into an AST and walks through it recursively to calculate\n * RAM usage. Also accounts for imported modules.\n * @param {Script[]} otherScripts - All other scripts on the server. Used to account for imported scripts\n * @param {string} codeCopy - The code being parsed\n * @param {WorkerScript} workerScript - Object containing RAM costs of Netscript functions. Also used to\n * keep track of what functions have/havent been accounted for\n */\nasync function parseOnlyRamCalculate(otherScripts, code, workerScript) {\n try {\n /**\n * Maps dependent identifiers to their dependencies.\n *\n * The initial identifier is __SPECIAL_INITIAL_MODULE__.__GLOBAL__.\n * It depends on all the functions declared in the module, all the global scopes\n * of its imports, and any identifiers referenced in this global scope. Each\n * function depends on all the identifiers referenced internally.\n * We walk the dependency graph to calculate RAM usage, given that some identifiers\n * reference Netscript functions which have a RAM cost.\n */\n let dependencyMap = {};\n\n // Scripts we've parsed.\n const completedParses = new Set();\n\n // Scripts we've discovered that need to be parsed.\n const parseQueue = [];\n\n // Parses a chunk of code with a given module name, and updates parseQueue and dependencyMap.\n function parseCode(code, moduleName) {\n const result = parseOnlyCalculateDeps(code, moduleName);\n completedParses.add(moduleName);\n\n // Add any additional modules to the parse queue;\n for (let i = 0; i < result.additionalModules.length; ++i) {\n if (!completedParses.has(result.additionalModules[i])) {\n parseQueue.push(result.additionalModules[i]);\n }\n }\n\n // Splice all the references in\n dependencyMap = Object.assign(dependencyMap, result.dependencyMap);\n }\n\n // Parse the initial module, which is the \"main\" script that is being run\n const initialModule = \"__SPECIAL_INITIAL_MODULE__\";\n parseCode(code, initialModule);\n\n // Process additional modules, which occurs if the \"main\" script has any imports\n while (parseQueue.length > 0) {\n const nextModule = parseQueue.shift();\n\n // Additional modules can either be imported from the web (in which case we use\n // a dynamic import), or from other in-game scripts\n let code;\n if (nextModule.startsWith(\"https://\") || nextModule.startsWith(\"http://\")) {\n try {\n // eslint-disable-next-line no-await-in-loop\n const module = await eval(\"import(nextModule)\");\n code = \"\";\n for (const prop in module) {\n if (typeof module[prop] === \"function\") {\n code += module[prop].toString() + \";\\n\";\n }\n }\n } catch (e) {\n console.error(`Error dynamically importing module from ${nextModule} for RAM calculations: ${e}`);\n return RamCalculationErrorCode.URLImportError;\n }\n } else {\n if (!Array.isArray(otherScripts)) {\n console.warn(`parseOnlyRamCalculate() not called with array of scripts`);\n return RamCalculationErrorCode.ImportError;\n }\n\n let script = null;\n let fn = nextModule.startsWith(\"./\") ? nextModule.slice(2) : nextModule;\n for (const s of otherScripts) {\n if (s.filename === fn) {\n script = s;\n break;\n }\n }\n\n if (script == null) {\n return RamCalculationErrorCode.ImportError; // No such script on the server\n }\n\n code = script.code;\n }\n\n parseCode(code, nextModule);\n }\n\n // Finally, walk the reference map and generate a ram cost. The initial set of keys to scan\n // are those that start with __SPECIAL_INITIAL_MODULE__.\n let ram = RamCostConstants.ScriptBaseRamCost;\n const unresolvedRefs = Object.keys(dependencyMap).filter((s) => s.startsWith(initialModule));\n const resolvedRefs = new Set();\n while (unresolvedRefs.length > 0) {\n const ref = unresolvedRefs.shift();\n\n // Check if this is one of the special keys, and add the appropriate ram cost if so.\n if (ref === \"hacknet\" && !resolvedRefs.has(\"hacknet\")) {\n ram += RamCostConstants.ScriptHacknetNodesRamCost;\n }\n if (ref === \"document\" && !resolvedRefs.has(\"document\")) {\n ram += RamCostConstants.ScriptDomRamCost;\n }\n if (ref === \"window\" && !resolvedRefs.has(\"window\")) {\n ram += RamCostConstants.ScriptDomRamCost;\n }\n\n resolvedRefs.add(ref);\n\n if (ref.endsWith(\".*\")) {\n // A prefix reference. We need to find all matching identifiers.\n const prefix = ref.slice(0, ref.length - 2);\n for (let ident of Object.keys(dependencyMap).filter((k) => k.startsWith(prefix))) {\n for (let dep of dependencyMap[ident] || []) {\n if (!resolvedRefs.has(dep)) unresolvedRefs.push(dep);\n }\n }\n } else {\n // An exact reference. Add all dependencies of this ref.\n for (let dep of dependencyMap[ref] || []) {\n if (!resolvedRefs.has(dep)) unresolvedRefs.push(dep);\n }\n }\n\n // Check if this identifier is a function in the workerScript environment.\n // If it is, then we need to get its RAM cost.\n try {\n function applyFuncRam(func) {\n if (typeof func === \"function\") {\n try {\n let res;\n if (func.constructor.name === \"AsyncFunction\") {\n res = 0; // Async functions will always be 0 RAM\n } else {\n res = func.apply(null, []);\n }\n if (typeof res === \"number\") {\n return res;\n }\n return 0;\n } catch (e) {\n console.error(`Error applying function: ${e}`);\n return 0;\n }\n } else {\n return 0;\n }\n }\n\n // Only count each function once\n if (workerScript.loadedFns[ref]) {\n continue;\n } else {\n workerScript.loadedFns[ref] = true;\n }\n\n // This accounts for namespaces (Bladeburner, CodingCpntract, etc.)\n let func;\n if (ref in workerScript.env.vars.bladeburner) {\n func = workerScript.env.vars.bladeburner[ref];\n } else if (ref in workerScript.env.vars.codingcontract) {\n func = workerScript.env.vars.codingcontract[ref];\n } else if (ref in workerScript.env.vars.gang) {\n func = workerScript.env.vars.gang[ref];\n } else if (ref in workerScript.env.vars.sleeve) {\n func = workerScript.env.vars.sleeve[ref];\n } else {\n func = workerScript.env.vars[ref];\n }\n ram += applyFuncRam(func);\n } catch (error) {\n continue;\n }\n }\n return ram;\n } catch (error) {\n // console.info(\"parse or eval error: \", error);\n // This is not unexpected. The user may be editing a script, and it may be in\n // a transitory invalid state.\n return RamCalculationErrorCode.SyntaxError;\n }\n}\n\n/**\n * Helper function that parses a single script. It returns a map of all dependencies,\n * which are items in the code's AST that potentially need to be evaluated\n * for RAM usage calculations. It also returns an array of additional modules\n * that need to be parsed (i.e. are 'import'ed scripts).\n */\nfunction parseOnlyCalculateDeps(code, currentModule) {\n const ast = parse(code, { sourceType: \"module\", ecmaVersion: \"latest\" });\n\n // Everything from the global scope goes in \".\". Everything else goes in \".function\", where only\n // the outermost layer of functions counts.\n const globalKey = currentModule + memCheckGlobalKey;\n const dependencyMap = {};\n dependencyMap[globalKey] = new Set();\n\n // If we reference this internal name, we're really referencing that external name.\n // Filled when we import names from other modules.\n let internalToExternal = {};\n\n var additionalModules = [];\n\n // References get added pessimistically. They are added for thisModule.name, name, and for\n // any aliases.\n function addRef(key, name) {\n const s = dependencyMap[key] || (dependencyMap[key] = new Set());\n if (name in internalToExternal) {\n s.add(internalToExternal[name]);\n }\n s.add(currentModule + \".\" + name);\n s.add(name); // For builtins like hack.\n }\n\n //A list of identifiers that resolve to \"native Javascript code\"\n const objectPrototypeProperties = Object.getOwnPropertyNames(Object.prototype);\n\n // If we discover a dependency identifier, state.key is the dependent identifier.\n // walkDeeper is for doing recursive walks of expressions in composites that we handle.\n function commonVisitors() {\n return {\n Identifier: (node, st) => {\n if (objectPrototypeProperties.includes(node.name)) {\n return;\n }\n addRef(st.key, node.name);\n },\n WhileStatement: (node, st, walkDeeper) => {\n addRef(st.key, specialReferenceWHILE);\n node.test && walkDeeper(node.test, st);\n node.body && walkDeeper(node.body, st);\n },\n DoWhileStatement: (node, st, walkDeeper) => {\n addRef(st.key, specialReferenceWHILE);\n node.test && walkDeeper(node.test, st);\n node.body && walkDeeper(node.body, st);\n },\n ForStatement: (node, st, walkDeeper) => {\n addRef(st.key, specialReferenceFOR);\n node.init && walkDeeper(node.init, st);\n node.test && walkDeeper(node.test, st);\n node.update && walkDeeper(node.update, st);\n node.body && walkDeeper(node.body, st);\n },\n IfStatement: (node, st, walkDeeper) => {\n addRef(st.key, specialReferenceIF);\n node.test && walkDeeper(node.test, st);\n node.consequent && walkDeeper(node.consequent, st);\n node.alternate && walkDeeper(node.alternate, st);\n },\n MemberExpression: (node, st, walkDeeper) => {\n node.object && walkDeeper(node.object, st);\n node.property && walkDeeper(node.property, st);\n },\n };\n }\n\n walk.recursive(\n ast,\n { key: globalKey },\n Object.assign(\n {\n ImportDeclaration: (node, st) => {\n const importModuleName = node.source.value;\n additionalModules.push(importModuleName);\n\n // This module's global scope refers to that module's global scope, no matter how we\n // import it.\n dependencyMap[st.key].add(importModuleName + memCheckGlobalKey);\n\n for (let i = 0; i < node.specifiers.length; ++i) {\n const spec = node.specifiers[i];\n if (spec.imported !== undefined && spec.local !== undefined) {\n // We depend on specific things.\n internalToExternal[spec.local.name] = importModuleName + \".\" + spec.imported.name;\n } else {\n // We depend on everything.\n dependencyMap[st.key].add(importModuleName + \".*\");\n }\n }\n },\n FunctionDeclaration: (node) => {\n const key = currentModule + \".\" + node.id.name;\n walk.recursive(node, { key: key }, commonVisitors());\n },\n },\n commonVisitors(),\n ),\n );\n\n return { dependencyMap: dependencyMap, additionalModules: additionalModules };\n}\n\n/**\n * Calculate's a scripts RAM Usage\n * @param {string} codeCopy - The script's code\n * @param {Script[]} otherScripts - All other scripts on the server.\n * Used to account for imported scripts\n */\nexport async function calculateRamUsage(codeCopy, otherScripts) {\n // We don't need a real WorkerScript for this. Just an object that keeps\n // track of whatever's needed for RAM calculations\n const workerScript = {\n loadedFns: {},\n env: {\n vars: RamCosts,\n },\n };\n\n try {\n return await parseOnlyRamCalculate(otherScripts, codeCopy, workerScript);\n } catch (e) {\n console.error(`Failed to parse script for RAM calculations:`);\n console.error(e);\n return RamCalculationErrorCode.SyntaxError;\n }\n\n return RamCalculationErrorCode.SyntaxError;\n}\n","import { CONSTANTS } from \"../../Constants\";\nimport { Server } from \"../Server\";\nimport { BitNodeMultipliers } from \"../../BitNode/BitNodeMultipliers\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nexport function calculateServerGrowth(server: Server, threads: number, p: IPlayer, cores = 1): number {\n const numServerGrowthCycles = Math.max(Math.floor(threads), 0);\n\n //Get adjusted growth rate, which accounts for server security\n const growthRate = CONSTANTS.ServerBaseGrowthRate;\n let adjGrowthRate = 1 + (growthRate - 1) / server.hackDifficulty;\n if (adjGrowthRate > CONSTANTS.ServerMaxGrowthRate) {\n adjGrowthRate = CONSTANTS.ServerMaxGrowthRate;\n }\n\n //Calculate adjusted server growth rate based on parameters\n const serverGrowthPercentage = server.serverGrowth / 100;\n const numServerGrowthCyclesAdjusted =\n numServerGrowthCycles * serverGrowthPercentage * BitNodeMultipliers.ServerGrowthRate;\n\n //Apply serverGrowth for the calculated number of growth cycles\n const coreBonus = 1 + (cores - 1) / 16;\n return Math.pow(adjGrowthRate, numServerGrowthCyclesAdjusted * p.hacking_grow_mult * coreBonus);\n}\n","/**\n * Checks whether a IP Address string is valid.\n * @param ipaddress A string representing a potential IP Address\n */\nexport function isValidIPAddress(ipaddress: string): boolean {\n const byteRange = \"(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\";\n const regexStr = `^${byteRange}\\.${byteRange}\\.${byteRange}\\.${byteRange}$`;\n const ipAddressRegex = new RegExp(regexStr);\n\n return ipAddressRegex.test(ipaddress);\n}\n","import { Literatures } from \"./Literatures\";\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\n\nexport function showLiterature(fn: string): void {\n const litObj = Literatures[fn];\n if (litObj == null) {\n return;\n }\n const txt = `${litObj.title}

${litObj.txt}`;\n dialogBoxCreate(txt);\n}\n","import React from \"react\";\nimport { IMap } from \"../types\";\n\n/**\n * Contains the \"information\" property for all the Factions, which is just a description of each faction\n */\nexport class FactionInfo {\n /**\n * The multiplier to apply to augmentation base purchase price.\n */\n augmentationPriceMult: number;\n\n /**\n * The multiplier to apply to augmentation reputation base requirement.\n */\n augmentationRepRequirementMult: number;\n\n /**\n * The names of all other factions considered to be enemies to this faction.\n */\n enemies: string[];\n\n /**\n * The descriptive text to show on the faction's page.\n */\n infoText: JSX.Element;\n\n /**\n * A flag indicating if the faction supports field work to earn reputation.\n */\n offerFieldWork: boolean;\n\n /**\n * A flag indicating if the faction supports hacking missions to earn reputation.\n */\n offerHackingMission: boolean;\n\n /**\n * A flag indicating if the faction supports hacking work to earn reputation.\n */\n offerHackingWork: boolean;\n\n /**\n * A flag indicating if the faction supports security work to earn reputation.\n */\n offerSecurityWork: boolean;\n\n /**\n * Keep faction on install.\n */\n keep: boolean;\n\n constructor(\n infoText: JSX.Element,\n enemies: string[],\n offerHackingMission: boolean,\n offerHackingWork: boolean,\n offerFieldWork: boolean,\n offerSecurityWork: boolean,\n keep: boolean,\n ) {\n this.infoText = infoText;\n this.enemies = enemies;\n this.offerHackingMission = offerHackingMission;\n this.offerHackingWork = offerHackingWork;\n this.offerFieldWork = offerFieldWork;\n this.offerSecurityWork = offerSecurityWork;\n\n // These are always all 1 for now.\n this.augmentationPriceMult = 1;\n this.augmentationRepRequirementMult = 1;\n this.keep = keep;\n }\n\n offersWork(): boolean {\n return this.offerFieldWork || this.offerHackingMission || this.offerHackingWork || this.offerSecurityWork;\n }\n}\n\n/**\n * A map of all factions and associated info to them.\n */\n// tslint:disable-next-line:variable-name\nexport const FactionInfos: IMap = {\n // Endgame\n Illuminati: new FactionInfo(\n (\n <>\n Humanity never changes. No matter how civilized society becomes, it will eventually fall back into chaos. And\n from this chaos, we are the invisible hand that guides them to order.{\" \"}\n \n ),\n [],\n true,\n true,\n true,\n false,\n false,\n ),\n\n Daedalus: new FactionInfo(\n <>Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth.,\n [],\n true,\n true,\n true,\n false,\n false,\n ),\n\n \"The Covenant\": new FactionInfo(\n (\n <>\n Surrender yourself. Give up your empty individuality to become part of something great, something eternal.\n Become a slave. Submit your mind, body, and soul. Only then can you set yourself free.\n
\n
\n Only then can you discover immortality.\n \n ),\n [],\n true,\n true,\n true,\n false,\n false,\n ),\n\n // Megacorporations, each forms its own faction\n ECorp: new FactionInfo(\n (\n <>\n ECorp's mission is simple: to connect the world of today with the technology of tomorrow. With our wide range of\n Internet-related software and commercial hardware, ECorp makes the world's information universally accessible.\n \n ),\n [],\n true,\n true,\n true,\n true,\n true,\n ),\n\n MegaCorp: new FactionInfo(\n (\n <>\n MegaCorp does what no other dares to do. We imagine. We create. We invent. We create what others have never even\n dreamed of. Our work fills the world's needs for food, water, power, and transporation on an unprecendented\n scale, in ways that no other company can.\n
\n
\n In our labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.\n \n ),\n [],\n true,\n true,\n true,\n true,\n true,\n ),\n\n \"Bachman & Associates\": new FactionInfo(\n (\n <>\n Where Law and Business meet - thats where we are.\n
\n
\n Legal Insight - Business Instinct - Innovative Experience.\n \n ),\n [],\n true,\n true,\n true,\n true,\n true,\n ),\n\n \"Blade Industries\": new FactionInfo(<>Augmentation is Salvation., [], true, true, true, true, true),\n\n NWO: new FactionInfo(\n (\n <>\n Humans don't truly desire freedom. They want to be observed, understood, and judged. They want to be given\n purpose and direction in life. That is why they created God. And that is why they created civilization - not\n because of willingness, but because of a need to be incorporated into higher orders of structure and meaning.\n \n ),\n [],\n true,\n true,\n true,\n true,\n true,\n ),\n\n \"Clarke Incorporated\": new FactionInfo(<>The Power of the Genome - Unlocked., [], true, true, true, true, true),\n\n \"OmniTek Incorporated\": new FactionInfo(\n <>Simply put, our mission is to design and build robots that make a difference.,\n [],\n true,\n true,\n true,\n true,\n true,\n ),\n\n \"Four Sigma\": new FactionInfo(\n (\n <>\n The scientific method is the best way to approach investing. Big strategies backed up with big data. Driven by\n deep learning and innovative ideas. And improved by iteration. That's Four Sigma.\n \n ),\n [],\n true,\n true,\n true,\n true,\n true,\n ),\n\n \"KuaiGong International\": new FactionInfo(<>Dream big. Work hard. Make history., [], true, true, true, true, true),\n\n // Other Corporations\n \"Fulcrum Secret Technologies\": new FactionInfo(\n (\n <>\n The human organism has an innate desire to worship. That is why they created gods. If there were no gods, it\n would be necessary to create them. And now we can.\n \n ),\n [],\n true,\n true,\n false,\n true,\n true,\n ),\n\n // Hacker groups\n BitRunners: new FactionInfo(\n (\n <>\n Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. It's all\n transformed into bits, stored in bits, communicated through bits. It’s impossible for any person to move, to\n live, to operate at any level without the use of bits. And when a person moves, lives, and operates, they leave\n behind their bits, mere traces of seemingly meaningless fragments of information. But these bits can be\n reconstructed. Transformed. Used.\n
\n
\n Those who run the bits, run the world.\n \n ),\n [],\n true,\n true,\n false,\n false,\n false,\n ),\n\n \"The Black Hand\": new FactionInfo(\n (\n <>\n The world, so afraid of strong government, now has no government. Only power - Digital power. Financial power.\n Technological power. And those at the top rule with an invisible hand. They built a society where the rich get\n richer, and everyone else suffers.\n
\n
\n So much pain. So many lives. Their darkness must end.\n \n ),\n [],\n true,\n true,\n true,\n false,\n false,\n ),\n\n // prettier-ignore\n NiteSec: new FactionInfo(<>\n{\" __..__ \"}
\n{\" _.nITESECNIt. \"}
\n{\" .-'NITESECNITESEc. \"}
\n{\" .' NITESECNITESECn \"}
\n{\" / NITESECNITESEC; \"}
\n{\" : :NITESECNITESEC; \"}
\n{\" ; $ NITESECNITESECN \"}
\n{\" : _, ,N'ITESECNITESEC \"}
\n{\" : .+^^`, : `NITESECNIT \"}
\n{\" ) /), `-,-=,NITESECNI \"}
\n{\" / ^ ,-;|NITESECN; \"}
\n{\" / _.' '-';NITESECN \"}
\n{\" ( , ,-''`^NITE' \"}
\n{\" )` :`. .' \"}
\n{\" )-- ; `- / \"}
\n{\" ' _.-' : \"}
\n{\" ( _.-' . \"}
\n{\" ------. \"}
\n{\" . \"}
\n{\" _.nIt \"}
\n{\" _.nITESECNi \"}
\n{\" nITESECNIT^' \"}
\n{\" NITE^' ___ \"}
\n{\" / .gP''''Tp. \"}
\n{\" : d' . `b \"}
\n{\" ; d' o `b ; \"}
\n{\" / d; `b| \"}
\n{\" /, $; @ `: \"}
\n{\" /' $$ ; \"}
\n{\" .' $$b o | \"}
\n{\" .' d$$$; : \"}
\n{\" / .d$$$$; , ; \"}
\n{\" d .dNITESEC $ | \"}
\n{\" :bp.__.gNITESEC$$ :$ ; \"}
\n{\" NITESECNITESECNIT $$b : \"}
,\n [],\n true,\n true,\n false,\n false,\n false,\n ),\n\n // City factions, essentially governments\n Aevum: new FactionInfo(\n <>The Silicon City.,\n [\"Chongqing\", \"New Tokyo\", \"Ishima\", \"Volhaven\"],\n true,\n true,\n true,\n true,\n false,\n ),\n Chongqing: new FactionInfo(<>Serve the People., [\"Sector-12\", \"Aevum\", \"Volhaven\"], true, true, true, true, false),\n Ishima: new FactionInfo(\n <>The East Asian Order of the Future.,\n [\"Sector-12\", \"Aevum\", \"Volhaven\"],\n true,\n true,\n true,\n true,\n false,\n ),\n \"New Tokyo\": new FactionInfo(\n <>Asia's World City.,\n [\"Sector-12\", \"Aevum\", \"Volhaven\"],\n true,\n true,\n true,\n true,\n false,\n ),\n \"Sector-12\": new FactionInfo(\n <>The City of the Future.,\n [\"Chongqing\", \"New Tokyo\", \"Ishima\", \"Volhaven\"],\n true,\n true,\n true,\n true,\n false,\n ),\n Volhaven: new FactionInfo(\n <>Benefit, Honor, and Glory.,\n [\"Chongqing\", \"Sector-12\", \"New Tokyo\", \"Aevum\", \"Ishima\"],\n true,\n true,\n true,\n true,\n false,\n ),\n\n // Criminal Organizations/Gangs\n \"Speakers for the Dead\": new FactionInfo(\n <>It is better to reign in Hell than to serve in Heaven.,\n [],\n true,\n true,\n true,\n true,\n false,\n ),\n\n \"The Dark Army\": new FactionInfo(\n <>The World doesn't care about right or wrong. It only cares about power.,\n [],\n true,\n true,\n true,\n false,\n false,\n ),\n\n \"The Syndicate\": new FactionInfo(<>Honor holds you back., [], true, true, true, true, false),\n\n Silhouette: new FactionInfo(\n (\n <>\n Corporations have filled the void of power left behind by the collapse of Western government. The issue is\n they've become so big that you don't know who they're working for. And if you're employed at one of these\n corporations, you don't even know who you're working for.\n
\n
\n That's terror. Terror, fear, and corruption. All born into the system, all propagated by the system.\n \n ),\n [],\n true,\n true,\n true,\n false,\n false,\n ),\n\n Tetrads: new FactionInfo(\n <>Following the mandate of Heaven and carrying out the way.,\n [],\n false,\n false,\n true,\n true,\n false,\n ),\n\n \"Slum Snakes\": new FactionInfo(<>Slum Snakes rule!, [], false, false, true, true, false),\n\n // Earlygame factions - factions the player will prestige with early on that don't belong in other categories.\n Netburners: new FactionInfo(<>{\"~~//*>H4CK||3T 8URN3R5**>?>\\\\~~\"}, [], true, true, false, false, false),\n\n \"Tian Di Hui\": new FactionInfo(<>Obey Heaven and work righteously., [], true, true, false, true, false),\n\n CyberSec: new FactionInfo(\n (\n <>\n The Internet is the first thing that was built that we don't fully understand, the largest experiment in anarchy\n that we have ever had. And as the world becomes increasingly dominated by it, society approaches the brink of\n total chaos. We serve only to protect society, to protect humanity, to protect the world from imminent collapse.\n \n ),\n [],\n true,\n true,\n false,\n false,\n false,\n ),\n\n // Special Factions\n Bladeburners: new FactionInfo(\n (\n <>\n It's too bad they won't live. But then again, who does?\n
\n
\n Note that for this faction, reputation can only be gained through Bladeburner actions. Completing Bladeburner\n contracts/operations will increase your reputation.\n \n ),\n [],\n false,\n false,\n false,\n false,\n false,\n ),\n};\n","import { createElement } from \"./createElement\";\nimport { getElementById } from \"./getElementById\";\n\ninterface ICreatePopupOptions {\n backgroundColor?: string;\n}\n\n/**\n * Creates the necessary DOM elements to present an in-game popup to the player.\n * @param id The (hopefully) unique identifier for the popup container.\n * @param elems The collection of HTML Elements to show within the popup.\n */\nexport function createPopup(id: string, elems: HTMLElement[], options: ICreatePopupOptions = {}): HTMLDivElement {\n const container: HTMLDivElement = createElement(\"div\", {\n class: \"popup-box-container\",\n display: \"flex\",\n id: id,\n }) as HTMLDivElement;\n const content: HTMLElement = createElement(\"div\", {\n class: \"popup-box-content\",\n id: `${id}-content`,\n });\n\n for (const elem of elems) {\n content.appendChild(elem);\n }\n\n // Configurable Options\n if (options.backgroundColor) {\n content.style.backgroundColor = options.backgroundColor;\n }\n\n container.appendChild(content);\n getElementById(\"entire-game-container\").appendChild(container);\n\n return container;\n}\n","import { Programs } from \"./Programs\";\nimport { Program } from \"./Program\";\n\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\n\n//Returns the programs this player can create.\nexport function getAvailableCreatePrograms(player: IPlayer): Program[] {\n const programs: Program[] = [];\n for (const key in Programs) {\n // Non-creatable program\n const create = Programs[key].create;\n if (create == null) continue;\n\n // Already has program\n if (player.hasProgram(Programs[key].name)) continue;\n\n // Does not meet requirements\n if (!create.req(player)) continue;\n\n programs.push(Programs[key]);\n }\n\n return programs;\n}\n","/**\n * React Component for displaying a single Augmentation as an accordion.\n *\n * The header of the accordion contains the Augmentation's name (and level, if\n * applicable), and the accordion's panel contains the Augmentation's description.\n */\nimport * as React from \"react\";\n\nimport { BBAccordion } from \"./BBAccordion\";\n\nimport { Augmentation } from \"../../Augmentation/Augmentation\";\nimport { AugmentationNames } from \"../../Augmentation/data/AugmentationNames\";\n\ntype IProps = {\n aug: Augmentation;\n level?: number | string | null;\n};\n\nexport function AugmentationAccordion(props: IProps): React.ReactElement {\n let displayName = props.aug.name;\n if (props.level != null) {\n if (props.aug.name === AugmentationNames.NeuroFluxGovernor) {\n displayName += ` - Level ${props.level}`;\n }\n }\n\n if (typeof props.aug.info === \"string\") {\n return (\n {displayName}}\n panelContent={\n

\n \n
\n
\n {props.aug.stats}\n

\n }\n />\n );\n }\n\n return (\n {displayName}}\n panelContent={\n

\n {props.aug.info}\n
\n
\n {props.aug.stats}\n

\n }\n />\n );\n}\n","export class PlayerOwnedSourceFile {\n // Source-File level\n lvl = 1;\n\n // Source-File number\n n = 1;\n\n constructor(n: number, level: number) {\n this.n = n;\n this.lvl = level;\n }\n}\n\nexport interface IPlayerOwnedSourceFile {\n lvl: number;\n n: number;\n}\n","import React, { useState } from \"react\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { Action } from \"../Action\";\nimport { IBladeburner } from \"../IBladeburner\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n action: Action;\n popupId: string;\n}\n\nexport function TeamSizePopup(props: IProps): React.ReactElement {\n const [teamSize, setTeamSize] = useState();\n\n function confirmTeamSize(): void {\n if (teamSize === undefined) return;\n const num = Math.round(teamSize);\n if (isNaN(num) || num < 0) {\n dialogBoxCreate(\"Invalid value entered for number of Team Members (must be numeric, positive)\");\n } else {\n props.action.teamCount = num;\n }\n removePopup(props.popupId);\n }\n\n return (\n <>\n

\n Enter the amount of team members you would like to take on this Op. If you do not have the specified number of\n team members, then as many as possible will be used. Note that team members may be lost during operations.\n

\n setTeamSize(parseFloat(event.target.value))}\n />\n
\n Confirm\n \n \n );\n}\n","import { ITaskParams, ITerritory } from \"./ITaskParams\";\n\nexport class GangMemberTask {\n name: string;\n desc: string;\n\n isHacking: boolean;\n isCombat: boolean;\n\n baseRespect: number;\n baseWanted: number;\n baseMoney: number;\n\n hackWeight: number;\n strWeight: number;\n defWeight: number;\n dexWeight: number;\n agiWeight: number;\n chaWeight: number;\n\n difficulty: number;\n\n territory: ITerritory;\n\n // Defines tasks that Gang Members can work on\n constructor(name: string, desc: string, isHacking: boolean, isCombat: boolean, params: ITaskParams) {\n this.name = name;\n this.desc = desc;\n\n // Flags that describe whether this Task is applicable for Hacking/Combat gangs\n this.isHacking = isHacking;\n this.isCombat = isCombat;\n\n // Base gain rates for respect/wanted/money\n this.baseRespect = params.baseRespect ? params.baseRespect : 0;\n this.baseWanted = params.baseWanted ? params.baseWanted : 0;\n this.baseMoney = params.baseMoney ? params.baseMoney : 0;\n\n // Weighting for the effect that each stat has on the tasks effectiveness.\n // Weights must add up to 100\n this.hackWeight = params.hackWeight ? params.hackWeight : 0;\n this.strWeight = params.strWeight ? params.strWeight : 0;\n this.defWeight = params.defWeight ? params.defWeight : 0;\n this.dexWeight = params.dexWeight ? params.dexWeight : 0;\n this.agiWeight = params.agiWeight ? params.agiWeight : 0;\n this.chaWeight = params.chaWeight ? params.chaWeight : 0;\n\n if (\n Math.round(\n this.hackWeight + this.strWeight + this.defWeight + this.dexWeight + this.agiWeight + this.chaWeight,\n ) != 100\n ) {\n console.error(`GangMemberTask ${this.name} weights do not add up to 100`);\n }\n\n // 1 - 100\n this.difficulty = params.difficulty ? params.difficulty : 1;\n\n // Territory Factors. Exponential factors that dictate how territory affects gains\n // Formula: Territory Mutiplier = (Territory * 100) ^ factor / 100\n // So factor should be > 1 if something should scale exponentially with territory\n // and should be < 1 if it should have diminshing returns\n this.territory = params.territory ? params.territory : { money: 1, respect: 1, wanted: 1 };\n }\n}\n","import React from \"react\";\n\nexport function BlinkingCursor(): React.ReactElement {\n return (\n \n |\n \n );\n}\n","/**\n * Implements the Re-sleeving mechanic for BitNode-10.\n * This allows the player to purchase and \"use\" new sleeves at VitaLife.\n * These new sleeves come with different starting experience and Augmentations\n * The cost of these new sleeves scales based on the exp and Augs.\n *\n * Note that this is different from the \"Sleeve mechanic\". The \"Sleeve\" mechanic\n * provides new sleeves, essentially clones. This Re-sleeving mechanic lets\n * the player purchase a new body with pre-existing Augmentations and experience\n *\n * As of right now, this feature is only available in BitNode 10\n */\nimport { Resleeve } from \"./Resleeve\";\nimport { IPlayer } from \"../IPlayer\";\n\nimport { Augmentation } from \"../../Augmentation/Augmentation\";\nimport { Augmentations } from \"../../Augmentation/Augmentations\";\nimport { IPlayerOwnedAugmentation, PlayerOwnedAugmentation } from \"../../Augmentation/PlayerOwnedAugmentation\";\nimport { AugmentationNames } from \"../../Augmentation/data/AugmentationNames\";\n\nimport { getRandomInt } from \"../../../utils/helpers/getRandomInt\";\n\n// Executes the actual re-sleeve when one is purchased\nexport function purchaseResleeve(r: Resleeve, p: IPlayer): boolean {\n const cost: number = r.getCost();\n if (!p.canAfford(cost)) {\n return false;\n }\n p.loseMoney(cost);\n\n // Set the player's exp\n p.hacking_exp = r.hacking_exp;\n p.strength_exp = r.strength_exp;\n p.defense_exp = r.defense_exp;\n p.dexterity_exp = r.dexterity_exp;\n p.agility_exp = r.agility_exp;\n p.charisma_exp = r.charisma_exp;\n\n // Reset Augmentation \"owned\" data\n for (const augKey in Augmentations) {\n Augmentations[augKey].owned = false;\n }\n\n // Clear all of the player's augmentations, except the NeuroFlux Governor\n // which is kept\n for (let i = p.augmentations.length - 1; i >= 0; --i) {\n if (p.augmentations[i].name !== AugmentationNames.NeuroFluxGovernor) {\n p.augmentations.splice(i, 1);\n } else {\n // NeuroFlux Governor\n Augmentations[AugmentationNames.NeuroFluxGovernor].owned = true;\n }\n }\n\n for (let i = 0; i < r.augmentations.length; ++i) {\n p.augmentations.push(new PlayerOwnedAugmentation(r.augmentations[i].name));\n Augmentations[r.augmentations[i].name].owned = true;\n }\n\n // The player's purchased Augmentations should remain the same, but any purchased\n // Augmentations that are given by the resleeve should be removed so there are no duplicates\n for (let i = p.queuedAugmentations.length - 1; i >= 0; --i) {\n const name: string = p.queuedAugmentations[i].name;\n\n if (\n p.augmentations.filter((e: IPlayerOwnedAugmentation) => {\n return e.name !== AugmentationNames.NeuroFluxGovernor && e.name === name;\n }).length >= 1\n ) {\n p.queuedAugmentations.splice(i, 1);\n }\n }\n\n p.reapplyAllAugmentations(true);\n p.reapplyAllSourceFiles(); //Multipliers get reset, so have to re-process source files too\n return true;\n}\n\n// Creates all of the Re-sleeves that will be available for purchase at VitaLife\nexport function generateResleeves(): Resleeve[] {\n const NumResleeves = 40; // Total number of Resleeves to generate\n\n const ret: Resleeve[] = [];\n for (let i = 0; i < NumResleeves; ++i) {\n // i will be a number indicating how \"powerful\" the Re-sleeve should be\n const r: Resleeve = new Resleeve();\n\n // Generate experience\n const expMult: number = 5 * i + 1;\n r.hacking_exp = expMult * getRandomInt(1000, 5000);\n r.strength_exp = expMult * getRandomInt(1000, 5000);\n r.defense_exp = expMult * getRandomInt(1000, 5000);\n r.dexterity_exp = expMult * getRandomInt(1000, 5000);\n r.agility_exp = expMult * getRandomInt(1000, 5000);\n r.charisma_exp = expMult * getRandomInt(1000, 5000);\n\n // Generate Augs\n // Augmentation prequisites will be ignored for this\n const baseNumAugs: number = Math.max(2, Math.ceil((i + 3) / 2));\n const numAugs: number = getRandomInt(baseNumAugs, baseNumAugs + 2);\n const augKeys: string[] = Object.keys(Augmentations);\n for (let a = 0; a < numAugs; ++a) {\n // Get a random aug\n const randIndex: number = getRandomInt(0, augKeys.length - 1);\n const randKey: string = augKeys[randIndex];\n\n // Forbidden augmentations\n if (randKey === AugmentationNames.TheRedPill || randKey === AugmentationNames.NeuroFluxGovernor) {\n continue;\n }\n\n const randAug: Augmentation | null = Augmentations[randKey];\n if (randAug === null) throw new Error(`null augmentation: ${randKey}`);\n r.augmentations.push({ name: randAug.name, level: 1 });\n r.applyAugmentation(Augmentations[randKey]);\n r.updateStatLevels();\n\n // Remove Augmentation so that there are no duplicates\n augKeys.splice(randIndex, 1);\n }\n\n ret.push(r);\n }\n\n return ret;\n}\n","import { Sleeve } from \"./Sleeve\";\n\nimport { IPlayer } from \"../IPlayer\";\n\nimport { Augmentation } from \"../../Augmentation/Augmentation\";\nimport { Augmentations } from \"../../Augmentation/Augmentations\";\nimport { AugmentationNames } from \"../../Augmentation/data/AugmentationNames\";\nimport { Faction } from \"../../Faction/Faction\";\nimport { Factions } from \"../../Faction/Factions\";\n\nexport function findSleevePurchasableAugs(sleeve: Sleeve, p: IPlayer): Augmentation[] {\n // You can only purchase Augmentations that are actually available from\n // your factions. I.e. you must be in a faction that has the Augmentation\n // and you must also have enough rep in that faction in order to purchase it.\n\n const ownedAugNames: string[] = sleeve.augmentations.map((e) => {\n return e.name;\n });\n const availableAugs: Augmentation[] = [];\n\n // Helper function that helps filter out augs that are already owned\n // and augs that aren't allowed for sleeves\n function isAvailableForSleeve(aug: Augmentation): boolean {\n if (aug.name === AugmentationNames.NeuroFluxGovernor) {\n return false;\n }\n if (ownedAugNames.includes(aug.name)) {\n return false;\n }\n if (availableAugs.includes(aug)) {\n return false;\n }\n if (aug.isSpecial) {\n return false;\n }\n\n return true;\n }\n\n // If player is in a gang, then we return all augs that the player\n // has enough reputation for (since that gang offers all augs)\n if (p.inGang()) {\n const fac = p.getGangFaction();\n\n for (const augName in Augmentations) {\n const aug = Augmentations[augName];\n if (!isAvailableForSleeve(aug)) {\n continue;\n }\n\n if (fac.playerReputation > aug.baseRepRequirement) {\n availableAugs.push(aug);\n }\n }\n\n return availableAugs;\n }\n\n for (const facName of p.factions) {\n if (facName === \"Bladeburners\") {\n continue;\n }\n if (facName === \"Netburners\") {\n continue;\n }\n const fac: Faction | null = Factions[facName];\n if (fac == null) {\n continue;\n }\n\n for (const augName of fac.augmentations) {\n const aug: Augmentation = Augmentations[augName];\n if (!isAvailableForSleeve(aug)) {\n continue;\n }\n\n if (fac.playerReputation > aug.baseRepRequirement) {\n availableAugs.push(aug);\n }\n }\n }\n\n return availableAugs;\n}\n","import { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { Hashes } from \"../../ui/React/Hashes\";\n\nexport function HashRate(hashes: number): JSX.Element {\n return Hashes(`${numeralWrapper.formatHashes(hashes)} / sec`);\n}\n","/**\n * React Subcomponent for displaying a location's UI, when that location is a Travel Agency\n *\n * TThis subcomponent renders all of the buttons for traveling to different cities\n */\nimport * as React from \"react\";\n\nimport { CityName } from \"../data/CityNames\";\nimport { TravelConfirmationPopup } from \"./TravelConfirmationPopup\";\n\nimport { CONSTANTS } from \"../../Constants\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { IRouter } from \"../../ui/Router\";\nimport { Settings } from \"../../Settings/Settings\";\n\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { Money } from \"../../ui/React/Money\";\nimport { WorldMap } from \"../../ui/React/WorldMap\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\n\ntype IProps = {\n p: IPlayer;\n router: IRouter;\n};\n\nfunction travel(p: IPlayer, router: IRouter, to: CityName): void {\n const cost = CONSTANTS.TravelCost;\n if (!p.canAfford(cost)) {\n dialogBoxCreate(`You cannot afford to travel to ${to}`);\n return;\n }\n\n p.loseMoney(cost);\n p.travel(to);\n dialogBoxCreate(You are now in {to}!);\n router.toCity();\n}\n\nfunction createTravelPopup(p: IPlayer, router: IRouter, city: CityName): void {\n if (Settings.SuppressTravelConfirmation) {\n travel(p, router, city);\n return;\n }\n const popupId = `travel-confirmation`;\n createPopup(popupId, TravelConfirmationPopup, {\n player: p,\n city: city,\n travel: () => travel(p, router, city),\n popupId: popupId,\n });\n}\n\nfunction ASCIIWorldMap(props: IProps): React.ReactElement {\n return (\n
\n

\n From here, you can travel to any other city! A ticket costs{\" \"}\n .\n

\n createTravelPopup(props.p, props.router, city)}\n />\n
\n );\n}\n\nfunction ListWorldMap(props: IProps): React.ReactElement {\n return (\n
\n

\n From here, you can travel to any other city! A ticket costs{\" \"}\n .\n

\n {Object.values(CityName)\n .filter((city: string) => city != props.p.city)\n .map((city: string) => {\n const match = Object.entries(CityName).find((entry) => entry[1] === city);\n if (match === undefined) throw new Error(`could not find key for city '${city}'`);\n return (\n createTravelPopup(props.p, props.router, city as CityName)}\n style={{ display: \"block\" }}\n text={`Travel to ${city}`}\n />\n );\n })}\n
\n );\n}\n\nexport function TravelAgencyRoot(props: IProps): React.ReactElement {\n return (\n <>\n

Travel Agency

\n {Settings.DisableASCIIArt ? (\n \n ) : (\n \n )}\n \n );\n}\n","import { FconfSettings } from \"./FconfSettings\";\n\nimport { parse, Node } from \"acorn\";\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\n\nvar FconfComments = {\n ENABLE_BASH_HOTKEYS:\n \"Improved Bash emulation mode. Setting this to 1 enables several\\n\" +\n \"new Terminal shortcuts and features that more closely resemble\\n\" +\n \"a real Bash-style shell. Note that when this mode is enabled,\\n\" +\n \"the default browser shortcuts are overriden by the new Bash\\n\" +\n \"shortcuts.\\n\\n\" +\n \"To see a full list of the Terminal shortcuts that this enables, see:\\n\" +\n \"http://bitburner.readthedocs.io/en/latest/shortcuts.html\",\n ENABLE_TIMESTAMPS:\n \"Terminal commands and log entries will be timestamped. The timestamp\\n\" + \"will have the format: M/D h:m\",\n MAIN_MENU_STYLE:\n \"Customize the main navigation menu on the left-hand side. Current options:\\n\\n\" + \"default, classic, compact\",\n THEME_BACKGROUND_COLOR:\n \"Sets the background color for not only the Terminal, but also for\\n\" +\n \"most of the game's UI.\\n\\n\" +\n \"The color must be specified as a pound sign (#) followed by a \\n\" +\n \"3-digit or 6-digit hex color code (e.g. #123456). Default color: #000000\",\n THEME_FONT_COLOR:\n \"Sets the font color for not only the Terminal, but also for\\n\" +\n \"most of the game's UI.\\n\\n\" +\n \"The color must be specified as a pound sign (#) followed by a \\n\" +\n \"3-digit or 6-digit hex color code (e.g. #123456). Default color: #66ff33\",\n THEME_HIGHLIGHT_COLOR:\n \"Sets the highlight color for not only the Terminal, but also for \\n\" +\n \"most of the game's UI.\\n\\n\" +\n \"The color must be specified as a pound sign (#) followed by a \\n\" +\n \"3-digit or 6-digit hex color code (e.g. #123456). Default color: #ffffff\",\n THEME_PROMPT_COLOR:\n \"Sets the prompt color in the Terminal\\n\\n\" +\n \"The color must be specified as a pound sign (#) followed by a \\n\" +\n \"3-digit or 6-digit hex color code (e.g. #123456). Default color: #f92672\",\n WRAP_INPUT:\n \"Wrap Terminal Input. If this is enabled, then when a Terminal command is\\n\" +\n \"too long and overflows, then it will wrap to the next line instead of\\n\" +\n \"side-scrolling\\n\\n\" +\n \"Note that after you enable/disable this, you'll have to run a command\\n\" +\n \"before its effect takes place.\",\n};\n\nconst MainMenuStyleOptions = [\"default\", \"classic\", \"compact\"];\n\n//Parse Fconf settings from the config text\n//Throws an exception if parsing fails\nfunction parseFconfSettings(config) {\n var ast = parse(config, { sourceType: \"module\" });\n var queue = [];\n queue.push(ast);\n while (queue.length != 0) {\n var exp = queue.shift();\n switch (exp.type) {\n case \"BlockStatement\":\n case \"Program\":\n for (var i = 0; i < exp.body.length; ++i) {\n if (exp.body[i] instanceof Node) {\n queue.push(exp.body[i]);\n }\n }\n break;\n case \"AssignmentExpression\":\n var setting, value;\n if (exp.left != null && exp.left.name != null) {\n setting = exp.left.name;\n } else {\n break;\n }\n if (exp.right != null && exp.right.raw != null) {\n value = exp.right.raw;\n } else {\n break;\n }\n parseFconfSetting(setting, value);\n break;\n default:\n break;\n }\n\n for (var prop in exp) {\n if (exp.hasOwnProperty(prop)) {\n if (exp[prop] instanceof Node) {\n queue.push(exp[prop]);\n }\n }\n }\n }\n\n setTheme();\n setMainMenuStyle();\n}\n\nfunction parseFconfSetting(setting, value) {\n setting = String(setting);\n value = String(value);\n if (setting == null || value == null || FconfSettings[setting] == null) {\n console.warn(`Invalid .fconf setting: ${setting}`);\n return;\n }\n\n function sanitizeString(value) {\n value = value.toLowerCase();\n if (value.startsWith('\"')) {\n value = value.slice(1);\n }\n if (value.endsWith('\"')) {\n value = value.slice(0, -1);\n }\n return value;\n }\n\n switch (setting) {\n case \"ENABLE_BASH_HOTKEYS\":\n case \"ENABLE_TIMESTAMPS\":\n case \"WRAP_INPUT\":\n // Need to convert entered value to boolean/strings accordingly\n var value = value.toLowerCase();\n if (value === \"1\" || value === \"true\" || value === \"y\") {\n value = true;\n } else {\n value = false;\n }\n FconfSettings[setting] = value;\n break;\n case \"MAIN_MENU_STYLE\":\n var value = sanitizeString(value);\n if (MainMenuStyleOptions.includes(value)) {\n FconfSettings[setting] = value;\n } else {\n dialogBoxCreate(`Invalid option specified for ${setting}. Options: ${MainMenuStyleOptions.toString()}`);\n }\n break;\n case \"THEME_BACKGROUND_COLOR\":\n case \"THEME_FONT_COLOR\":\n case \"THEME_HIGHLIGHT_COLOR\":\n case \"THEME_PROMPT_COLOR\":\n var value = sanitizeString(value);\n if (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(value)) {\n FconfSettings[setting] = value;\n } else {\n dialogBoxCreate(`Invalid color specified for ${setting}. Must be a hex color code preceded by a pound (#)`);\n }\n break;\n default:\n break;\n }\n}\n\n//Create the .fconf file text from the settings\nfunction createFconf() {\n var res = \"\";\n for (var setting in FconfSettings) {\n if (FconfSettings.hasOwnProperty(setting)) {\n //Setting comments (description)\n var comment = FconfComments[setting];\n if (comment == null) {\n continue;\n }\n var comment = comment.split(\"\\n\");\n for (var i = 0; i < comment.length; ++i) {\n res += \"//\" + comment[i] + \"\\n\";\n }\n\n var value = 0;\n if (FconfSettings[setting] === true) {\n value = \"1\";\n } else if (FconfSettings[setting] === false) {\n value = \"0\";\n } else {\n value = '\"' + String(FconfSettings[setting]) + '\"';\n }\n res += `${setting} = ${value}\\n\\n`;\n }\n }\n return res;\n}\n\nfunction loadFconf(saveString) {\n let tempFconfSettings = JSON.parse(saveString);\n for (var setting in tempFconfSettings) {\n if (tempFconfSettings.hasOwnProperty(setting)) {\n FconfSettings[setting] = tempFconfSettings[setting];\n }\n }\n\n // Initialize themes/styles after loading\n setTheme();\n setMainMenuStyle();\n}\n\nfunction setTheme() {\n if (\n FconfSettings.THEME_HIGHLIGHT_COLOR == null ||\n FconfSettings.THEME_FONT_COLOR == null ||\n FconfSettings.THEME_BACKGROUND_COLOR == null ||\n FconfSettings.THEME_PROMPT_COLOR == null\n ) {\n console.error(\"Cannot find Theme Settings\");\n return;\n }\n if (\n /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(FconfSettings.THEME_HIGHLIGHT_COLOR) &&\n /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(FconfSettings.THEME_FONT_COLOR) &&\n /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(FconfSettings.THEME_BACKGROUND_COLOR) &&\n /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(FconfSettings.THEME_PROMPT_COLOR)\n ) {\n // document.body.style.setProperty(\"--my-highlight-color\", FconfSettings.THEME_HIGHLIGHT_COLOR);\n // document.body.style.setProperty(\"--my-font-color\", FconfSettings.THEME_FONT_COLOR);\n // document.body.style.setProperty(\"--my-background-color\", FconfSettings.THEME_BACKGROUND_COLOR);\n // document.body.style.setProperty(\"--my-prompt-color\", FconfSettings.THEME_PROMPT_COLOR);\n }\n}\n\nfunction setMainMenuStyle() {\n const mainMenu = document.getElementById(\"mainmenu\");\n const hackingMenuHdr = document.getElementById(\"hacking-menu-header\");\n const characterMenuHdr = document.getElementById(\"character-menu-header\");\n const worldMenuHdr = document.getElementById(\"world-menu-header\");\n const helpMenuHdr = document.getElementById(\"help-menu-header\");\n\n function removeAllAccordionHeaderClasses() {\n hackingMenuHdr.classList.remove(\"mainmenu-accordion-header\", \"mainmenu-accordion-header-classic\");\n characterMenuHdr.classList.remove(\"mainmenu-accordion-header\", \"mainmenu-accordion-header-classic\");\n worldMenuHdr.classList.remove(\"mainmenu-accordion-header\", \"mainmenu-accordion-header-classic\");\n helpMenuHdr.classList.remove(\"mainmenu-accordion-header\", \"mainmenu-accordion-header-classic\");\n }\n\n function addClassToAllAccordionHeaders(clsName) {\n hackingMenuHdr.classList.add(clsName);\n characterMenuHdr.classList.add(clsName);\n worldMenuHdr.classList.add(clsName);\n helpMenuHdr.classList.add(clsName);\n }\n\n if (FconfSettings[\"MAIN_MENU_STYLE\"] === \"default\") {\n removeAllAccordionHeaderClasses();\n mainMenu.classList.remove(\"classic\");\n mainMenu.classList.remove(\"compact\");\n addClassToAllAccordionHeaders(\"mainmenu-accordion-header\");\n } else if (FconfSettings[\"MAIN_MENU_STYLE\"] === \"classic\") {\n removeAllAccordionHeaderClasses();\n mainMenu.classList.remove(\"compact\");\n mainMenu.classList.add(\"classic\");\n addClassToAllAccordionHeaders(\"mainmenu-accordion-header-classic\");\n } else if (FconfSettings[\"MAIN_MENU_STYLE\"] === \"compact\") {\n removeAllAccordionHeaderClasses();\n mainMenu.classList.remove(\"classic\");\n mainMenu.classList.add(\"compact\");\n addClassToAllAccordionHeaders(\"mainmenu-accordion-header-compact\");\n } else {\n return;\n }\n\n // Click each header twice to reset lol\n hackingMenuHdr.click();\n hackingMenuHdr.click();\n characterMenuHdr.click();\n characterMenuHdr.click();\n worldMenuHdr.click();\n worldMenuHdr.click();\n helpMenuHdr.click();\n helpMenuHdr.click();\n}\n\nexport { FconfSettings, createFconf, parseFconfSettings, loadFconf };\n","import * as acorn from \"acorn\";\n/**\n * @license\n * JavaScript Interpreter\n *\n * Copyright 2013 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @fileoverview Interpreting JavaScript in JavaScript.\n * @author fraser@google.com (Neil Fraser)\n */\n(\"use strict\");\n\n/**\n * Create a new interpreter.\n * @param {string|!Object} code Raw JavaScript text or AST.\n * @param {Function=} opt_initFunc Optional initialization function. Used to\n * define APIs. When called it is passed the interpreter object and the\n * global scope object.\n * @param {Number} Bitburner-specific number used for determining exception line numbers\n * @constructor\n */\nvar Interpreter = function (code, opt_initFunc, lineOffset = 0) {\n this.sourceCode = code;\n this.sourceCodeLineOffset = lineOffset;\n if (typeof code === \"string\") {\n code = acorn.parse(code, Interpreter.PARSE_OPTIONS);\n }\n this.ast = code;\n this.initFunc_ = opt_initFunc;\n this.paused_ = false;\n this.polyfills_ = [];\n // Unique identifier for native functions. Used in serialization.\n this.functionCounter_ = 0;\n // Map node types to our step function names; a property lookup is faster\n // than string concatenation with \"step\" prefix.\n this.stepFunctions_ = Object.create(null);\n var stepMatch = /^step([A-Z]\\w*)$/;\n var m;\n for (var methodName in this) {\n if (typeof this[methodName] === \"function\" && (m = methodName.match(stepMatch))) {\n this.stepFunctions_[m[1]] = this[methodName].bind(this);\n }\n }\n // Create and initialize the global scope.\n this.global = this.createScope(this.ast, null);\n // Run the polyfills.\n this.ast = acorn.parse(this.polyfills_.join(\"\\n\"), Interpreter.PARSE_OPTIONS);\n this.polyfills_ = undefined; // Allow polyfill strings to garbage collect.\n this.stripLocations_(this.ast, undefined, undefined);\n var state = new Interpreter.State(this.ast, this.global);\n state.done = false;\n this.stateStack = [state];\n this.run();\n this.value = undefined;\n // Point at the main program.\n this.ast = code;\n var state = new Interpreter.State(this.ast, this.global);\n state.done = false;\n this.stateStack.length = 0;\n this.stateStack[0] = state;\n // Get a handle on Acorn's node_t object. It's tricky to access.\n this.nodeConstructor = state.node.constructor;\n // Preserve publicly properties from being pruned/renamed by JS compilers.\n // Add others as needed.\n this[\"stateStack\"] = this.stateStack;\n};\n\n/**\n * @const {!Object} Configuration used for all Acorn parsing.\n */\nInterpreter.PARSE_OPTIONS = {\n ecmaVersion: 5,\n locations: true,\n};\n\n/**\n * Property descriptor of readonly properties.\n */\nInterpreter.READONLY_DESCRIPTOR = {\n configurable: true,\n enumerable: true,\n writable: false,\n};\n\n/**\n * Property descriptor of non-enumerable properties.\n */\nInterpreter.NONENUMERABLE_DESCRIPTOR = {\n configurable: true,\n enumerable: false,\n writable: true,\n};\n\n/**\n * Property descriptor of readonly, non-enumerable properties.\n */\nInterpreter.READONLY_NONENUMERABLE_DESCRIPTOR = {\n configurable: true,\n enumerable: false,\n writable: false,\n};\n\n/**\n * Property descriptor of variables.\n */\nInterpreter.VARIABLE_DESCRIPTOR = {\n configurable: false,\n enumerable: true,\n writable: true,\n};\n\n/**\n * Unique symbol for indicating that a step has encountered an error, has\n * added it to the stack, and will be thrown within the user's program.\n * When STEP_ERROR is thrown in the JS-Interpreter, the error can be ignored.\n */\nInterpreter.STEP_ERROR = {};\n\n/**\n * Unique symbol for indicating that a reference is a variable on the scope,\n * not an object property.\n */\nInterpreter.SCOPE_REFERENCE = {};\n\n/**\n * Unique symbol for indicating, when used as the value of the value\n * parameter in calls to setProperty and friends, that the value\n * should be taken from the property descriptor instead.\n */\nInterpreter.VALUE_IN_DESCRIPTOR = {};\n\n/**\n * For cycle detection in array to string and error conversion;\n * see spec bug github.com/tc39/ecma262/issues/289\n * Since this is for atomic actions only, it can be a class property.\n */\nInterpreter.toStringCycles_ = [];\n\n/**\n * Determine error/exception line number in Bitburner source code\n * @param {Object} AST Node that causes Error/Exception\n */\nInterpreter.prototype.getErrorLineNumber = function (node) {\n var code = this.sourceCode;\n if (node == null || node.start == null) {\n return NaN;\n }\n try {\n code = code.substring(0, node.start);\n return (code.match(/\\n/g) || []).length + 1 - this.sourceCodeLineOffset;\n } catch (e) {\n return NaN;\n }\n};\n\n/**\n * Generate the appropriate line number error message for Bitburner\n * @param {Number} lineNumber\n */\nInterpreter.prototype.getErrorLineNumberMessage = function (lineNumber) {\n if (isNaN(lineNumber)) {\n return \" (Unknown line number)\";\n } else if (lineNumber <= 0) {\n return \" (Error occurred in an imported function)\";\n } else {\n return (\n \" (Line Number \" +\n lineNumber +\n \". This line number is probably incorrect \" +\n \"if your script is importing any functions. This is being worked on)\"\n );\n }\n};\n\n/**\n * Add more code to the interpreter.\n * @param {string|!Object} code Raw JavaScript text or AST.\n */\nInterpreter.prototype.appendCode = function (code) {\n var state = this.stateStack[0];\n if (!state || state.node[\"type\"] !== \"Program\") {\n throw Error(\"Expecting original AST to start with a Program node.\");\n }\n if (typeof code === \"string\") {\n code = acorn.parse(code, Interpreter.PARSE_OPTIONS);\n }\n if (!code || code[\"type\"] !== \"Program\") {\n throw Error(\"Expecting new AST to start with a Program node.\");\n }\n this.populateScope_(code, state.scope);\n // Append the new program to the old one.\n for (var i = 0, node; (node = code[\"body\"][i]); i++) {\n state.node[\"body\"].push(node);\n }\n state.done = false;\n};\n\n/**\n * Execute one step of the interpreter.\n * @return {boolean} True if a step was executed, false if no more instructions.\n */\nInterpreter.prototype.step = function () {\n var stack = this.stateStack;\n var state = stack[stack.length - 1];\n if (!state) {\n return false;\n }\n var node = state.node,\n type = node[\"type\"];\n if (type === \"Program\" && state.done) {\n return false;\n } else if (this.paused_) {\n return true;\n }\n try {\n var nextState = this.stepFunctions_[type](stack, state, node);\n } catch (e) {\n // Eat any step errors. They have been thrown on the stack.\n if (e !== Interpreter.STEP_ERROR) {\n // Uh oh. This is a real error in the JS-Interpreter. Rethrow.\n throw e;\n }\n }\n if (nextState) {\n stack.push(nextState);\n }\n if (!node[\"end\"]) {\n // This is polyfill code. Keep executing until we arrive at user code.\n return this.step();\n }\n return true;\n};\n\n/**\n * Execute the interpreter to program completion. Vulnerable to infinite loops.\n * @return {boolean} True if a execution is asynchronously blocked,\n * false if no more instructions.\n */\nInterpreter.prototype.run = function () {\n while (!this.paused_ && this.step()) {}\n return this.paused_;\n};\n\n/**\n * Initialize the global scope with buitin properties and functions.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initGlobalScope = function (scope) {\n // Initialize uneditable global properties.\n this.setProperty(scope, \"NaN\", NaN, Interpreter.READONLY_DESCRIPTOR);\n this.setProperty(scope, \"Infinity\", Infinity, Interpreter.READONLY_DESCRIPTOR);\n this.setProperty(scope, \"undefined\", undefined, Interpreter.READONLY_DESCRIPTOR);\n this.setProperty(scope, \"window\", scope, Interpreter.READONLY_DESCRIPTOR);\n this.setProperty(scope, \"this\", scope, Interpreter.READONLY_DESCRIPTOR);\n this.setProperty(scope, \"self\", scope); // Editable.\n\n // Create the objects which will become Object.prototype and\n // Function.prototype, which are needed to bootstrap everything else.\n this.OBJECT_PROTO = new Interpreter.Object(null);\n this.FUNCTION_PROTO = new Interpreter.Object(this.OBJECT_PROTO);\n // Initialize global objects.\n this.initFunction(scope);\n this.initObject(scope);\n // Unable to set scope's parent prior (OBJECT did not exist).\n // Note that in a browser this would be 'Window', whereas in Node.js it would\n // be 'Object'. This interpreter is closer to Node in that it has no DOM.\n scope.proto = this.OBJECT_PROTO;\n this.setProperty(scope, \"constructor\", this.OBJECT, Interpreter.NONENUMERABLE_DESCRIPTOR);\n this.initArray(scope);\n this.initString(scope);\n this.initBoolean(scope);\n this.initNumber(scope);\n this.initDate(scope);\n this.initRegExp(scope);\n this.initError(scope);\n this.initMath(scope);\n this.initJSON(scope);\n\n // Initialize global functions.\n var thisInterpreter = this;\n var func = this.createNativeFunction(function (x) {\n throw EvalError(\"Can't happen\");\n }, false);\n func.eval = true;\n this.setProperty(scope, \"eval\", func);\n\n this.setProperty(scope, \"parseInt\", this.createNativeFunction(parseInt, false));\n this.setProperty(scope, \"parseFloat\", this.createNativeFunction(parseFloat, false));\n\n this.setProperty(scope, \"isNaN\", this.createNativeFunction(isNaN, false));\n\n this.setProperty(scope, \"isFinite\", this.createNativeFunction(isFinite, false));\n\n var strFunctions = [\n [escape, \"escape\"],\n [unescape, \"unescape\"],\n [decodeURI, \"decodeURI\"],\n [decodeURIComponent, \"decodeURIComponent\"],\n [encodeURI, \"encodeURI\"],\n [encodeURIComponent, \"encodeURIComponent\"],\n ];\n for (var i = 0; i < strFunctions.length; i++) {\n var wrapper = (function (nativeFunc) {\n return function (str) {\n try {\n return nativeFunc(str);\n } catch (e) {\n // decodeURI('%xy') will throw an error. Catch and rethrow.\n thisInterpreter.throwException(thisInterpreter.URI_ERROR, e.message);\n }\n };\n })(strFunctions[i][0]);\n this.setProperty(\n scope,\n strFunctions[i][1],\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n }\n // Preserve publicly properties from being pruned/renamed by JS compilers.\n // Add others as needed.\n this[\"OBJECT\"] = this.OBJECT;\n this[\"OBJECT_PROTO\"] = this.OBJECT_PROTO;\n this[\"FUNCTION\"] = this.FUNCTION;\n this[\"FUNCTION_PROTO\"] = this.FUNCTION_PROTO;\n this[\"ARRAY\"] = this.ARRAY;\n this[\"ARRAY_PROTO\"] = this.ARRAY_PROTO;\n this[\"REGEXP\"] = this.REGEXP;\n this[\"REGEXP_PROTO\"] = this.REGEXP_PROTO;\n this[\"DATE\"] = this.DATE;\n this[\"DATE_PROTO\"] = this.DATE_PROTO;\n // The following properties are obsolete. Do not use.\n this[\"UNDEFINED\"] = undefined;\n this[\"NULL\"] = null;\n this[\"NAN\"] = NaN;\n this[\"TRUE\"] = true;\n this[\"FALSE\"] = false;\n this[\"STRING_EMPTY\"] = \"\";\n this[\"NUMBER_ZERO\"] = 0;\n this[\"NUMBER_ONE\"] = 1;\n\n // Run any user-provided initialization.\n if (this.initFunc_) {\n this.initFunc_(this, scope);\n }\n};\n\n/**\n * Initialize the Function class.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initFunction = function (scope) {\n var thisInterpreter = this;\n var wrapper;\n var identifierRegexp = /^[A-Za-z_$][\\w$]*$/;\n // Function constructor.\n wrapper = function (var_args) {\n if (thisInterpreter.calledWithNew()) {\n // Called as new Function().\n var newFunc = this;\n } else {\n // Called as Function().\n var newFunc = thisInterpreter.createObjectProto(thisInterpreter.FUNCTION_PROTO);\n }\n if (arguments.length) {\n var code = String(arguments[arguments.length - 1]);\n } else {\n var code = \"\";\n }\n var argsStr = Array.prototype.slice.call(arguments, 0, -1).join(\",\").trim();\n if (argsStr) {\n var args = argsStr.split(/\\s*,\\s*/);\n for (var i = 0; i < args.length; i++) {\n var name = args[i];\n if (!identifierRegexp.test(name)) {\n thisInterpreter.throwException(thisInterpreter.SYNTAX_ERROR, \"Invalid function argument: \" + name);\n }\n }\n argsStr = args.join(\", \");\n }\n // Interestingly, the scope for constructed functions is the global scope,\n // even if they were constructed in some other scope.\n newFunc.parentScope = thisInterpreter.global;\n // Acorn needs to parse code in the context of a function or else 'return'\n // statements will be syntax errors.\n try {\n var ast = acorn.parse(\"(function(\" + argsStr + \") {\" + code + \"})\", Interpreter.PARSE_OPTIONS);\n } catch (e) {\n // Acorn threw a SyntaxError. Rethrow as a trappable error.\n thisInterpreter.throwException(thisInterpreter.SYNTAX_ERROR, \"Invalid code: \" + e.message);\n }\n if (ast[\"body\"].length !== 1) {\n // Function('a', 'return a + 6;}; {alert(1);');\n thisInterpreter.throwException(thisInterpreter.SYNTAX_ERROR, \"Invalid code in function body.\");\n }\n newFunc.node = ast[\"body\"][0][\"expression\"];\n thisInterpreter.setProperty(newFunc, \"length\", newFunc.node[\"length\"], Interpreter.READONLY_DESCRIPTOR);\n return newFunc;\n };\n wrapper.id = this.functionCounter_++;\n this.FUNCTION = this.createObjectProto(this.FUNCTION_PROTO);\n\n this.setProperty(scope, \"Function\", this.FUNCTION);\n // Manually setup type and prototype because createObj doesn't recognize\n // this object as a function (this.FUNCTION did not exist).\n this.setProperty(this.FUNCTION, \"prototype\", this.FUNCTION_PROTO);\n this.FUNCTION.nativeFunc = wrapper;\n\n // Configure Function.prototype.\n this.setProperty(this.FUNCTION_PROTO, \"constructor\", this.FUNCTION, Interpreter.NONENUMERABLE_DESCRIPTOR);\n this.FUNCTION_PROTO.nativeFunc = function () {};\n this.FUNCTION_PROTO.nativeFunc.id = this.functionCounter_++;\n this.setProperty(this.FUNCTION_PROTO, \"length\", 0, Interpreter.READONLY_DESCRIPTOR);\n\n var boxThis = function (value) {\n // In non-strict mode 'this' must be an object.\n if ((!value || !value.isObject) && !thisInterpreter.getScope().strict) {\n if (value === undefined || value === null) {\n // 'Undefined' and 'null' are changed to global object.\n value = thisInterpreter.global;\n } else {\n // Primitives must be boxed in non-strict mode.\n var box = thisInterpreter.createObjectProto(thisInterpreter.getPrototype(value));\n box.data = value;\n value = box;\n }\n }\n return value;\n };\n\n wrapper = function (thisArg, args) {\n var state = thisInterpreter.stateStack[thisInterpreter.stateStack.length - 1];\n // Rewrite the current 'CallExpression' to apply a different function.\n state.func_ = this;\n // Assign the 'this' object.\n state.funcThis_ = boxThis(thisArg);\n // Bind any provided arguments.\n state.arguments_ = [];\n if (args !== null && args !== undefined) {\n if (args.isObject) {\n state.arguments_ = thisInterpreter.arrayPseudoToNative(args);\n } else {\n thisInterpreter.throwException(thisInterpreter.TYPE_ERROR, \"CreateListFromArrayLike called on non-object\");\n }\n }\n state.doneExec_ = false;\n };\n this.setNativeFunctionPrototype(this.FUNCTION, \"apply\", wrapper);\n\n wrapper = function (thisArg /*, var_args */) {\n var state = thisInterpreter.stateStack[thisInterpreter.stateStack.length - 1];\n // Rewrite the current 'CallExpression' to call a different function.\n state.func_ = this;\n // Assign the 'this' object.\n state.funcThis_ = boxThis(thisArg);\n // Bind any provided arguments.\n state.arguments_ = [];\n for (var i = 1; i < arguments.length; i++) {\n state.arguments_.push(arguments[i]);\n }\n state.doneExec_ = false;\n };\n this.setNativeFunctionPrototype(this.FUNCTION, \"call\", wrapper);\n\n this.polyfills_.push(\n // Polyfill copied from:\n // developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind\n \"Object.defineProperty(Function.prototype, 'bind',\",\n \"{configurable: true, writable: true, value:\",\n \"function(oThis) {\",\n \"if (typeof this !== 'function') {\",\n \"throw TypeError('What is trying to be bound is not callable');\",\n \"}\",\n \"var aArgs = Array.prototype.slice.call(arguments, 1),\",\n \"fToBind = this,\",\n \"fNOP = function() {},\",\n \"fBound = function() {\",\n \"return fToBind.apply(this instanceof fNOP\",\n \"? this\",\n \": oThis,\",\n \"aArgs.concat(Array.prototype.slice.call(arguments)));\",\n \"};\",\n \"if (this.prototype) {\",\n \"fNOP.prototype = this.prototype;\",\n \"}\",\n \"fBound.prototype = new fNOP();\",\n \"return fBound;\",\n \"}\",\n \"});\",\n \"\",\n );\n\n // Function has no parent to inherit from, so it needs its own mandatory\n // toString and valueOf functions.\n wrapper = function () {\n return this.toString();\n };\n this.setNativeFunctionPrototype(this.FUNCTION, \"toString\", wrapper);\n this.setProperty(\n this.FUNCTION,\n \"toString\",\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n wrapper = function () {\n return this.valueOf();\n };\n this.setNativeFunctionPrototype(this.FUNCTION, \"valueOf\", wrapper);\n this.setProperty(\n this.FUNCTION,\n \"valueOf\",\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n};\n\n/**\n * Initialize the Object class.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initObject = function (scope) {\n var thisInterpreter = this;\n var wrapper;\n // Object constructor.\n wrapper = function (value) {\n if (value === undefined || value === null) {\n // Create a new object.\n if (thisInterpreter.calledWithNew()) {\n // Called as new Object().\n return this;\n } else {\n // Called as Object().\n return thisInterpreter.createObjectProto(thisInterpreter.OBJECT_PROTO);\n }\n }\n if (!value.isObject) {\n // Wrap the value as an object.\n var box = thisInterpreter.createObjectProto(thisInterpreter.getPrototype(value));\n box.data = value;\n return box;\n }\n // Return the provided object.\n return value;\n };\n this.OBJECT = this.createNativeFunction(wrapper, true);\n // Throw away the created prototype and use the root prototype.\n this.setProperty(this.OBJECT, \"prototype\", this.OBJECT_PROTO);\n this.setProperty(this.OBJECT_PROTO, \"constructor\", this.OBJECT, Interpreter.NONENUMERABLE_DESCRIPTOR);\n this.setProperty(scope, \"Object\", this.OBJECT);\n\n /**\n * Checks if the provided value is null or undefined.\n * If so, then throw an error in the call stack.\n * @param {Interpreter.Value} value Value to check.\n */\n var throwIfNullUndefined = function (value) {\n if (value === undefined || value === null) {\n thisInterpreter.throwException(thisInterpreter.TYPE_ERROR, \"Cannot convert '\" + value + \"' to object\");\n }\n };\n\n // Static methods on Object.\n wrapper = function (obj) {\n throwIfNullUndefined(obj);\n var props = obj.isObject ? obj.properties : obj;\n return thisInterpreter.arrayNativeToPseudo(Object.getOwnPropertyNames(props));\n };\n this.setProperty(\n this.OBJECT,\n \"getOwnPropertyNames\",\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n\n wrapper = function (obj) {\n throwIfNullUndefined(obj);\n if (obj.isObject) {\n obj = obj.properties;\n }\n return thisInterpreter.arrayNativeToPseudo(Object.keys(obj));\n };\n this.setProperty(\n this.OBJECT,\n \"keys\",\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n\n wrapper = function (proto) {\n // Support for the second argument is the responsibility of a polyfill.\n if (proto === null) {\n return thisInterpreter.createObjectProto(null);\n }\n if (proto === undefined || !proto.isObject) {\n thisInterpreter.throwException(thisInterpreter.TYPE_ERROR, \"Object prototype may only be an Object or null\");\n }\n return thisInterpreter.createObjectProto(proto);\n };\n this.setProperty(\n this.OBJECT,\n \"create\",\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n\n // Add a polyfill to handle create's second argument.\n this.polyfills_.push(\n \"(function() {\",\n \"var create_ = Object.create;\",\n \"Object.create = function(proto, props) {\",\n \"var obj = create_(proto);\",\n \"props && Object.defineProperties(obj, props);\",\n \"return obj;\",\n \"};\",\n \"})();\",\n \"\",\n );\n\n wrapper = function (obj, prop, descriptor) {\n prop = String(prop);\n if (!obj || !obj.isObject) {\n thisInterpreter.throwException(thisInterpreter.TYPE_ERROR, \"Object.defineProperty called on non-object\");\n }\n if (!descriptor || !descriptor.isObject) {\n thisInterpreter.throwException(thisInterpreter.TYPE_ERROR, \"Property description must be an object\");\n }\n if (!obj.properties[prop] && obj.preventExtensions) {\n thisInterpreter.throwException(\n thisInterpreter.TYPE_ERROR,\n \"Can't define property '\" + prop + \"', object is not extensible\",\n );\n }\n // The polyfill guarantees no inheritance and no getter functions.\n // Therefore the descriptor properties map is the native object needed.\n thisInterpreter.setProperty(obj, prop, Interpreter.VALUE_IN_DESCRIPTOR, descriptor.properties);\n return obj;\n };\n this.setProperty(\n this.OBJECT,\n \"defineProperty\",\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n\n this.polyfills_.push(\n // Flatten the descriptor to remove any inheritance or getter functions.\n \"(function() {\",\n \"var defineProperty_ = Object.defineProperty;\",\n \"Object.defineProperty = function(obj, prop, d1) {\",\n \"var d2 = {};\",\n \"if ('configurable' in d1) d2.configurable = d1.configurable;\",\n \"if ('enumerable' in d1) d2.enumerable = d1.enumerable;\",\n \"if ('writable' in d1) d2.writable = d1.writable;\",\n \"if ('value' in d1) d2.value = d1.value;\",\n \"if ('get' in d1) d2.get = d1.get;\",\n \"if ('set' in d1) d2.set = d1.set;\",\n \"return defineProperty_(obj, prop, d2);\",\n \"};\",\n \"})();\",\n\n \"Object.defineProperty(Object, 'defineProperties',\",\n \"{configurable: true, writable: true, value:\",\n \"function(obj, props) {\",\n \"var keys = Object.keys(props);\",\n \"for (var i = 0; i < keys.length; i++) {\",\n \"Object.defineProperty(obj, keys[i], props[keys[i]]);\",\n \"}\",\n \"return obj;\",\n \"}\",\n \"});\",\n \"\",\n );\n\n wrapper = function (obj, prop) {\n if (!obj || !obj.isObject) {\n thisInterpreter.throwException(\n thisInterpreter.TYPE_ERROR,\n \"Object.getOwnPropertyDescriptor called on non-object\",\n );\n }\n prop = String(prop);\n if (!(prop in obj.properties)) {\n return undefined;\n }\n var descriptor = Object.getOwnPropertyDescriptor(obj.properties, prop);\n var getter = obj.getter[prop];\n var setter = obj.setter[prop];\n\n if (getter || setter) {\n descriptor.get = getter;\n descriptor.set = setter;\n delete descriptor.value;\n delete descriptor.writable;\n }\n // Preserve value, but remove it for the nativeToPseudo call.\n var value = descriptor.value;\n var hasValue = \"value\" in descriptor;\n delete descriptor.value;\n var pseudoDescriptor = thisInterpreter.nativeToPseudo(descriptor);\n if (hasValue) {\n thisInterpreter.setProperty(pseudoDescriptor, \"value\", value);\n }\n return pseudoDescriptor;\n };\n this.setProperty(\n this.OBJECT,\n \"getOwnPropertyDescriptor\",\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n\n wrapper = function (obj) {\n throwIfNullUndefined(obj);\n return thisInterpreter.getPrototype(obj);\n };\n this.setProperty(\n this.OBJECT,\n \"getPrototypeOf\",\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n\n wrapper = function (obj) {\n return Boolean(obj) && !obj.preventExtensions;\n };\n this.setProperty(\n this.OBJECT,\n \"isExtensible\",\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n\n wrapper = function (obj) {\n if (obj && obj.isObject) {\n obj.preventExtensions = true;\n }\n return obj;\n };\n this.setProperty(\n this.OBJECT,\n \"preventExtensions\",\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n\n // Instance methods on Object.\n this.setNativeFunctionPrototype(this.OBJECT, \"toString\", Interpreter.Object.prototype.toString);\n this.setNativeFunctionPrototype(this.OBJECT, \"toLocaleString\", Interpreter.Object.prototype.toString);\n this.setNativeFunctionPrototype(this.OBJECT, \"valueOf\", Interpreter.Object.prototype.valueOf);\n\n wrapper = function (prop) {\n throwIfNullUndefined(this);\n if (!this.isObject) {\n return this.hasOwnProperty(prop);\n }\n return String(prop) in this.properties;\n };\n this.setNativeFunctionPrototype(this.OBJECT, \"hasOwnProperty\", wrapper);\n\n wrapper = function (prop) {\n throwIfNullUndefined(this);\n if (!this.isObject) {\n return this.propertyIsEnumerable(prop);\n }\n return Object.prototype.propertyIsEnumerable.call(this.properties, prop);\n };\n this.setNativeFunctionPrototype(this.OBJECT, \"propertyIsEnumerable\", wrapper);\n\n wrapper = function (obj) {\n while (true) {\n // Note, circular loops shouldn't be possible.\n obj = thisInterpreter.getPrototype(obj);\n if (!obj) {\n // No parent; reached the top.\n return false;\n }\n if (obj === this) {\n return true;\n }\n }\n };\n this.setNativeFunctionPrototype(this.OBJECT, \"isPrototypeOf\", wrapper);\n};\n\n/**\n * Initialize the Array class.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initArray = function (scope) {\n var thisInterpreter = this;\n var wrapper;\n // Array constructor.\n wrapper = function (var_args) {\n if (thisInterpreter.calledWithNew()) {\n // Called as new Array().\n var newArray = this;\n } else {\n // Called as Array().\n var newArray = thisInterpreter.createObjectProto(thisInterpreter.ARRAY_PROTO);\n }\n var first = arguments[0];\n if (arguments.length === 1 && typeof first === \"number\") {\n if (isNaN(Interpreter.legalArrayLength(first))) {\n thisInterpreter.throwException(thisInterpreter.RANGE_ERROR, \"Invalid array length\");\n }\n newArray.properties.length = first;\n } else {\n for (var i = 0; i < arguments.length; i++) {\n newArray.properties[i] = arguments[i];\n }\n newArray.properties.length = i;\n }\n return newArray;\n };\n this.ARRAY = this.createNativeFunction(wrapper, true);\n this.ARRAY_PROTO = this.ARRAY.properties[\"prototype\"];\n this.setProperty(scope, \"Array\", this.ARRAY);\n\n // Static methods on Array.\n wrapper = function (obj) {\n return obj && obj.class === \"Array\";\n };\n this.setProperty(\n this.ARRAY,\n \"isArray\",\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n\n // Instance methods on Array.\n wrapper = function () {\n return Array.prototype.pop.call(this.properties);\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"pop\", wrapper);\n\n wrapper = function (var_args) {\n return Array.prototype.push.apply(this.properties, arguments);\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"push\", wrapper);\n\n wrapper = function () {\n return Array.prototype.shift.call(this.properties);\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"shift\", wrapper);\n\n wrapper = function (var_args) {\n return Array.prototype.unshift.apply(this.properties, arguments);\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"unshift\", wrapper);\n\n wrapper = function () {\n Array.prototype.reverse.call(this.properties);\n return this;\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"reverse\", wrapper);\n\n wrapper = function (index, howmany /*, var_args*/) {\n var list = Array.prototype.splice.apply(this.properties, arguments);\n return thisInterpreter.arrayNativeToPseudo(list);\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"splice\", wrapper);\n\n wrapper = function (opt_begin, opt_end) {\n var list = Array.prototype.slice.call(this.properties, opt_begin, opt_end);\n return thisInterpreter.arrayNativeToPseudo(list);\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"slice\", wrapper);\n\n wrapper = function (opt_separator) {\n return Array.prototype.join.call(this.properties, opt_separator);\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"join\", wrapper);\n\n wrapper = function (var_args) {\n var list = [];\n var length = 0;\n // Start by copying the current array.\n var iLength = thisInterpreter.getProperty(this, \"length\");\n for (var i = 0; i < iLength; i++) {\n if (thisInterpreter.hasProperty(this, i)) {\n var element = thisInterpreter.getProperty(this, i);\n list[length] = element;\n }\n length++;\n }\n // Loop through all arguments and copy them in.\n for (var i = 0; i < arguments.length; i++) {\n var value = arguments[i];\n if (thisInterpreter.isa(value, thisInterpreter.ARRAY)) {\n var jLength = thisInterpreter.getProperty(value, \"length\");\n for (var j = 0; j < jLength; j++) {\n if (thisInterpreter.hasProperty(value, j)) {\n list[length] = thisInterpreter.getProperty(value, j);\n }\n length++;\n }\n } else {\n list[length] = value;\n }\n }\n return thisInterpreter.arrayNativeToPseudo(list);\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"concat\", wrapper);\n\n wrapper = function (searchElement, opt_fromIndex) {\n return Array.prototype.indexOf.apply(this.properties, arguments);\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"indexOf\", wrapper);\n\n wrapper = function (searchElement, opt_fromIndex) {\n return Array.prototype.lastIndexOf.apply(this.properties, arguments);\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"lastIndexOf\", wrapper);\n\n wrapper = function () {\n Array.prototype.sort.call(this.properties);\n return this;\n };\n this.setNativeFunctionPrototype(this.ARRAY, \"sort\", wrapper);\n\n this.polyfills_.push(\n // Polyfill copied from:\n // developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/every\n \"Object.defineProperty(Array.prototype, 'every',\",\n \"{configurable: true, writable: true, value:\",\n \"function(callbackfn, thisArg) {\",\n \"if (!this || typeof callbackfn !== 'function') throw TypeError();\",\n \"var T, k;\",\n \"var O = Object(this);\",\n \"var len = O.length >>> 0;\",\n \"if (arguments.length > 1) T = thisArg;\",\n \"k = 0;\",\n \"while (k < len) {\",\n \"if (k in O && !callbackfn.call(T, O[k], k, O)) return false;\",\n \"k++;\",\n \"}\",\n \"return true;\",\n \"}\",\n \"});\",\n\n // Polyfill copied from:\n // developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter\n \"Object.defineProperty(Array.prototype, 'filter',\",\n \"{configurable: true, writable: true, value:\",\n \"function(fun/*, thisArg*/) {\",\n \"if (this === void 0 || this === null || typeof fun !== 'function') throw TypeError();\",\n \"var t = Object(this);\",\n \"var len = t.length >>> 0;\",\n \"var res = [];\",\n \"var thisArg = arguments.length >= 2 ? arguments[1] : void 0;\",\n \"for (var i = 0; i < len; i++) {\",\n \"if (i in t) {\",\n \"var val = t[i];\",\n \"if (fun.call(thisArg, val, i, t)) res.push(val);\",\n \"}\",\n \"}\",\n \"return res;\",\n \"}\",\n \"});\",\n\n // Polyfill copied from:\n // https://tc39.github.io/ecma262/#sec-array.prototype.find\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find\n \"if (!Array.prototype.find) {\",\n \"Object.defineProperty(Array.prototype, 'find', {\",\n \"value: function(predicate) {\",\n \"if (this == null) {\",\n \"throw new TypeError('\\\"this\\\" is null or not defined');\",\n \"}\",\n \"var o = Object(this);\",\n \"var len = o.length >>> 0;\",\n \"if (typeof predicate !== 'function') {\",\n \"throw new TypeError('predicate must be a function');\",\n \"}\",\n \"var thisArg = arguments[1];\",\n \"var k = 0;\",\n \"while (k < len) {\",\n \"var kValue = o[k];\",\n \"if (predicate.call(thisArg, kValue, k, o)) {\",\n \"return kValue;\",\n \"}\",\n \"k++;\",\n \"}\",\n \"return undefined;\",\n \"},\",\n \"configurable: true,\",\n \"writable: true\",\n \"});\",\n \"}\",\n\n // Poly fill copied from:\n // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex\n \"if (!Array.prototype.findIndex) {\",\n \"Object.defineProperty(Array.prototype, 'findIndex', {\",\n \"value: function(predicate) {\",\n \"if (this == null) {\",\n \"throw new TypeError('\\\"this\\\" is null or not defined');\",\n \"}\",\n \"var o = Object(this);\",\n \"var len = o.length >>> 0;\",\n \"if (typeof predicate !== 'function') {\",\n \"throw new TypeError('predicate must be a function');\",\n \"}\",\n \"var thisArg = arguments[1];\",\n \"var k = 0;\",\n \"while (k < len) {\",\n \"var kValue = o[k];\",\n \"if (predicate.call(thisArg, kValue, k, o)) {\",\n \"return k;\",\n \"}\",\n \"k++;\",\n \"}\",\n \"return -1;\",\n \"},\",\n \"configurable: true,\",\n \"writable: true\",\n \"});\",\n \"}\",\n\n // Polyfill copied from:\n // developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach\n \"Object.defineProperty(Array.prototype, 'forEach',\",\n \"{configurable: true, writable: true, value:\",\n \"function(callback, thisArg) {\",\n \"if (!this || typeof callback !== 'function') throw TypeError();\",\n \"var T, k;\",\n \"var O = Object(this);\",\n \"var len = O.length >>> 0;\",\n \"if (arguments.length > 1) T = thisArg;\",\n \"k = 0;\",\n \"while (k < len) {\",\n \"if (k in O) callback.call(T, O[k], k, O);\",\n \"k++;\",\n \"}\",\n \"}\",\n \"});\",\n\n // Polyfill copied from:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes#Polyfill\n \"Object.defineProperty(Array.prototype, 'includes', {\",\n \"value: function(searchElement, fromIndex) {\",\n \"if (this == null) {\",\n \"throw new TypeError('\\\"this\\\" is null or not defined');\",\n \"}\",\n \"// 1. Let O be ? ToObject(this value).\",\n \"var o = Object(this);\",\n '// 2. Let len be ? ToLength(? Get(O, \"length\")).',\n \"var len = o.length >>> 0;\",\n \"// 3. If len is 0, return false.\",\n \"if (len === 0) {\",\n \"return false;\",\n \"}\",\n \"// 4. Let n be ? ToInteger(fromIndex).\",\n \"// (If fromIndex is undefined, this step produces the value 0.)\",\n \"var n = fromIndex | 0;\",\n \"// 5. If n ≥ 0, then\",\n \"// a. Let k be n.\",\n \"// 6. Else n < 0,\",\n \"// a. Let k be len + n.\",\n \"// b. If k < 0, let k be 0.\",\n \"var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);\",\n \"function sameValueZero(x, y) {\",\n \"return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));\",\n \"}\",\n \"// 7. Repeat, while k < len\",\n \"while (k < len) {\",\n \"// a. Let elementK be the result of ? Get(O, ! ToString(k)).\",\n \"// b. If SameValueZero(searchElement, elementK) is true, return true.\",\n \"if (sameValueZero(o[k], searchElement)) {\",\n \"return true;\",\n \"}\",\n \"// c. Increase k by 1. \",\n \"k++;\",\n \"}\",\n \"// 8. Return false\",\n \"return false;\",\n \"}\",\n \"});\",\n\n // Polyfill copied from:\n // developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map\n \"Object.defineProperty(Array.prototype, 'map',\",\n \"{configurable: true, writable: true, value:\",\n \"function(callback, thisArg) {\",\n \"if (!this || typeof callback !== 'function') new TypeError;\",\n \"var T, A, k;\",\n \"var O = Object(this);\",\n \"var len = O.length >>> 0;\",\n \"if (arguments.length > 1) T = thisArg;\",\n \"A = new Array(len);\",\n \"k = 0;\",\n \"while (k < len) {\",\n \"if (k in O) A[k] = callback.call(T, O[k], k, O);\",\n \"k++;\",\n \"}\",\n \"return A;\",\n \"}\",\n \"});\",\n\n // Polyfill copied from:\n // developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce\n \"Object.defineProperty(Array.prototype, 'reduce',\",\n \"{configurable: true, writable: true, value:\",\n \"function(callback /*, initialValue*/) {\",\n \"if (!this || typeof callback !== 'function') throw TypeError();\",\n \"var t = Object(this), len = t.length >>> 0, k = 0, value;\",\n \"if (arguments.length === 2) {\",\n \"value = arguments[1];\",\n \"} else {\",\n \"while (k < len && !(k in t)) k++;\",\n \"if (k >= len) {\",\n \"throw TypeError('Reduce of empty array with no initial value');\",\n \"}\",\n \"value = t[k++];\",\n \"}\",\n \"for (; k < len; k++) {\",\n \"if (k in t) value = callback(value, t[k], k, t);\",\n \"}\",\n \"return value;\",\n \"}\",\n \"});\",\n\n // Polyfill copied from:\n // developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/ReduceRight\n \"Object.defineProperty(Array.prototype, 'reduceRight',\",\n \"{configurable: true, writable: true, value:\",\n \"function(callback /*, initialValue*/) {\",\n \"if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw TypeError();\",\n \"var t = Object(this), len = t.length >>> 0, k = len - 1, value;\",\n \"if (arguments.length >= 2) {\",\n \"value = arguments[1];\",\n \"} else {\",\n \"while (k >= 0 && !(k in t)) k--;\",\n \"if (k < 0) {\",\n \"throw TypeError('Reduce of empty array with no initial value');\",\n \"}\",\n \"value = t[k--];\",\n \"}\",\n \"for (; k >= 0; k--) {\",\n \"if (k in t) value = callback(value, t[k], k, t);\",\n \"}\",\n \"return value;\",\n \"}\",\n \"});\",\n\n // Polyfill copied from:\n // developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/some\n \"Object.defineProperty(Array.prototype, 'some',\",\n \"{configurable: true, writable: true, value:\",\n \"function(fun/*, thisArg*/) {\",\n \"if (!this || typeof fun !== 'function') throw TypeError();\",\n \"var t = Object(this);\",\n \"var len = t.length >>> 0;\",\n \"var thisArg = arguments.length >= 2 ? arguments[1] : void 0;\",\n \"for (var i = 0; i < len; i++) {\",\n \"if (i in t && fun.call(thisArg, t[i], i, t)) {\",\n \"return true;\",\n \"}\",\n \"}\",\n \"return false;\",\n \"}\",\n \"});\",\n\n \"(function() {\",\n \"var sort_ = Array.prototype.sort;\",\n \"Array.prototype.sort = function(opt_comp) {\",\n // Fast native sort.\n \"if (typeof opt_comp !== 'function') {\",\n \"return sort_.call(this);\",\n \"}\",\n // Slow bubble sort.\n \"for (var i = 0; i < this.length; i++) {\",\n \"var changes = 0;\",\n \"for (var j = 0; j < this.length - i - 1; j++) {\",\n \"if (opt_comp(this[j], this[j + 1]) > 0) {\",\n \"var swap = this[j];\",\n \"this[j] = this[j + 1];\",\n \"this[j + 1] = swap;\",\n \"changes++;\",\n \"}\",\n \"}\",\n \"if (!changes) break;\",\n \"}\",\n \"return this;\",\n \"};\",\n \"})();\",\n\n \"Object.defineProperty(Array.prototype, 'toLocaleString',\",\n \"{configurable: true, writable: true, value:\",\n \"function() {\",\n \"var out = [];\",\n \"for (var i = 0; i < this.length; i++) {\",\n \"out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();\",\n \"}\",\n \"return out.join(',');\",\n \"}\",\n \"});\",\n \"\",\n );\n};\n\n/**\n * Initialize the String class.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initString = function (scope) {\n var thisInterpreter = this;\n var wrapper;\n // String constructor.\n wrapper = function (value) {\n value = String(value);\n if (thisInterpreter.calledWithNew()) {\n // Called as new String().\n this.data = value;\n return this;\n } else {\n // Called as String().\n return value;\n }\n };\n this.STRING = this.createNativeFunction(wrapper, true);\n this.setProperty(scope, \"String\", this.STRING);\n\n // Static methods on String.\n this.setProperty(\n this.STRING,\n \"fromCharCode\",\n this.createNativeFunction(String.fromCharCode, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n\n // Instance methods on String.\n // Methods with exclusively primitive arguments.\n var functions = [\n \"charAt\",\n \"charCodeAt\",\n \"concat\",\n \"indexOf\",\n \"lastIndexOf\",\n \"slice\",\n \"substr\",\n \"substring\",\n \"toLocaleLowerCase\",\n \"toLocaleUpperCase\",\n \"toLowerCase\",\n \"toUpperCase\",\n \"trim\",\n ];\n for (var i = 0; i < functions.length; i++) {\n this.setNativeFunctionPrototype(this.STRING, functions[i], String.prototype[functions[i]]);\n }\n\n wrapper = function (compareString, locales, options) {\n locales = locales ? thisInterpreter.pseudoToNative(locales) : undefined;\n options = options ? thisInterpreter.pseudoToNative(options) : undefined;\n return String(this).localeCompare(compareString, locales, options);\n };\n this.setNativeFunctionPrototype(this.STRING, \"localeCompare\", wrapper);\n\n wrapper = function (separator, limit) {\n if (thisInterpreter.isa(separator, thisInterpreter.REGEXP)) {\n separator = separator.data;\n }\n var jsList = String(this).split(separator, limit);\n return thisInterpreter.arrayNativeToPseudo(jsList);\n };\n this.setNativeFunctionPrototype(this.STRING, \"split\", wrapper);\n\n wrapper = function (regexp) {\n if (thisInterpreter.isa(regexp, thisInterpreter.REGEXP)) {\n regexp = regexp.data;\n }\n var m = String(this).match(regexp);\n return m && thisInterpreter.arrayNativeToPseudo(m);\n };\n this.setNativeFunctionPrototype(this.STRING, \"match\", wrapper);\n\n wrapper = function (regexp) {\n if (thisInterpreter.isa(regexp, thisInterpreter.REGEXP)) {\n regexp = regexp.data;\n }\n return String(this).search(regexp);\n };\n this.setNativeFunctionPrototype(this.STRING, \"search\", wrapper);\n\n wrapper = function (substr, newSubstr) {\n // Support for function replacements is the responsibility of a polyfill.\n if (thisInterpreter.isa(substr, thisInterpreter.REGEXP)) {\n substr = substr.data;\n }\n return String(this).replace(substr, newSubstr);\n };\n this.setNativeFunctionPrototype(this.STRING, \"replace\", wrapper);\n // Add a polyfill to handle replace's second argument being a function.\n this.polyfills_.push(\n \"(function() {\",\n \"var replace_ = String.prototype.replace;\",\n \"String.prototype.replace = function(substr, newSubstr) {\",\n \"if (typeof newSubstr !== 'function') {\",\n // string.replace(string|regexp, string)\n \"return replace_.call(this, substr, newSubstr);\",\n \"}\",\n \"var str = this;\",\n \"if (substr instanceof RegExp) {\", // string.replace(regexp, function)\n \"var subs = [];\",\n \"var m = substr.exec(str);\",\n \"while (m) {\",\n \"m.push(m.index, str);\",\n \"var inject = newSubstr.apply(null, m);\",\n \"subs.push([m.index, m[0].length, inject]);\",\n \"m = substr.global ? substr.exec(str) : null;\",\n \"}\",\n \"for (var i = subs.length - 1; i >= 0; i--) {\",\n \"str = str.substring(0, subs[i][0]) + subs[i][2] + \" + \"str.substring(subs[i][0] + subs[i][1]);\",\n \"}\",\n \"} else {\", // string.replace(string, function)\n \"var i = str.indexOf(substr);\",\n \"if (i !== -1) {\",\n \"var inject = newSubstr(str.substr(i, substr.length), i, str);\",\n \"str = str.substring(0, i) + inject + \" + \"str.substring(i + substr.length);\",\n \"}\",\n \"}\",\n \"return str;\",\n \"};\",\n \"})();\",\n\n // Polyfill copied from:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n \"if (!String.prototype.endsWith) {\",\n \"String.prototype.endsWith = function(search, this_len) {\",\n \"if (this_len === undefined || this_len > this.length) {\",\n \"this_len = this.length;\",\n \"}\",\n \"return this.substring(this_len - search.length, this_len) === search;\",\n \"};\",\n \"}\",\n\n //Polyfill copied from:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n \"if (!String.prototype.includes) {\",\n \"String.prototype.includes = function(search, start) {\",\n \"'use strict';\",\n \"if (typeof start !== 'number') {\",\n \"start = 0;\",\n \"}\",\n \" \",\n \"if (start + search.length > this.length) {\",\n \"return false;\",\n \"} else {\",\n \"return this.indexOf(search, start) !== -1;\",\n \"}\",\n \"};\",\n \"}\",\n\n // Polyfill copied from:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n \"if (!String.prototype.startsWith) {\",\n \"String.prototype.startsWith = function(search, pos) {\",\n \"return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\",\n \"};\",\n \"}\",\n\n \"\",\n );\n};\n\n/**\n * Initialize the Boolean class.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initBoolean = function (scope) {\n var thisInterpreter = this;\n var wrapper;\n // Boolean constructor.\n wrapper = function (value) {\n value = Boolean(value);\n if (thisInterpreter.calledWithNew()) {\n // Called as new Boolean().\n this.data = value;\n return this;\n } else {\n // Called as Boolean().\n return value;\n }\n };\n this.BOOLEAN = this.createNativeFunction(wrapper, true);\n this.setProperty(scope, \"Boolean\", this.BOOLEAN);\n};\n\n/**\n * Initialize the Number class.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initNumber = function (scope) {\n var thisInterpreter = this;\n var wrapper;\n // Number constructor.\n wrapper = function (value) {\n value = Number(value);\n if (thisInterpreter.calledWithNew()) {\n // Called as new Number().\n this.data = value;\n return this;\n } else {\n // Called as Number().\n return value;\n }\n };\n this.NUMBER = this.createNativeFunction(wrapper, true);\n this.setProperty(scope, \"Number\", this.NUMBER);\n\n var numConsts = [\"MAX_VALUE\", \"MIN_VALUE\", \"NaN\", \"NEGATIVE_INFINITY\", \"POSITIVE_INFINITY\"];\n for (var i = 0; i < numConsts.length; i++) {\n this.setProperty(this.NUMBER, numConsts[i], Number[numConsts[i]], Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);\n }\n\n // Instance methods on Number.\n wrapper = function (fractionDigits) {\n try {\n return Number(this).toExponential(fractionDigits);\n } catch (e) {\n // Throws if fractionDigits isn't within 0-20.\n thisInterpreter.throwException(thisInterpreter.ERROR, e.message);\n }\n };\n this.setNativeFunctionPrototype(this.NUMBER, \"toExponential\", wrapper);\n\n wrapper = function (digits) {\n try {\n return Number(this).toFixed(digits);\n } catch (e) {\n // Throws if digits isn't within 0-20.\n thisInterpreter.throwException(thisInterpreter.ERROR, e.message);\n }\n };\n this.setNativeFunctionPrototype(this.NUMBER, \"toFixed\", wrapper);\n\n wrapper = function (precision) {\n try {\n return Number(this).toPrecision(precision);\n } catch (e) {\n // Throws if precision isn't within range (depends on implementation).\n thisInterpreter.throwException(thisInterpreter.ERROR, e.message);\n }\n };\n this.setNativeFunctionPrototype(this.NUMBER, \"toPrecision\", wrapper);\n\n wrapper = function (radix) {\n try {\n return Number(this).toString(radix);\n } catch (e) {\n // Throws if radix isn't within 2-36.\n thisInterpreter.throwException(thisInterpreter.ERROR, e.message);\n }\n };\n this.setNativeFunctionPrototype(this.NUMBER, \"toString\", wrapper);\n\n wrapper = function (locales, options) {\n locales = locales ? thisInterpreter.pseudoToNative(locales) : undefined;\n options = options ? thisInterpreter.pseudoToNative(options) : undefined;\n return Number(this).toLocaleString(locales, options);\n };\n this.setNativeFunctionPrototype(this.NUMBER, \"toLocaleString\", wrapper);\n};\n\n/**\n * Initialize the Date class.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initDate = function (scope) {\n var thisInterpreter = this;\n var wrapper;\n // Date constructor.\n wrapper = function (value, var_args) {\n if (!thisInterpreter.calledWithNew()) {\n // Called as Date().\n // Calling Date() as a function returns a string, no arguments are heeded.\n return Date();\n }\n // Called as new Date().\n var args = [null].concat(Array.from(arguments));\n this.data = new (Function.prototype.bind.apply(Date, args))();\n return this;\n };\n this.DATE = this.createNativeFunction(wrapper, true);\n this.DATE_PROTO = this.DATE.properties[\"prototype\"];\n this.setProperty(scope, \"Date\", this.DATE);\n\n // Static methods on Date.\n this.setProperty(this.DATE, \"now\", this.createNativeFunction(Date.now, false), Interpreter.NONENUMERABLE_DESCRIPTOR);\n\n this.setProperty(\n this.DATE,\n \"parse\",\n this.createNativeFunction(Date.parse, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n\n this.setProperty(this.DATE, \"UTC\", this.createNativeFunction(Date.UTC, false), Interpreter.NONENUMERABLE_DESCRIPTOR);\n\n // Instance methods on Date.\n var functions = [\n \"getDate\",\n \"getDay\",\n \"getFullYear\",\n \"getHours\",\n \"getMilliseconds\",\n \"getMinutes\",\n \"getMonth\",\n \"getSeconds\",\n \"getTime\",\n \"getTimezoneOffset\",\n \"getUTCDate\",\n \"getUTCDay\",\n \"getUTCFullYear\",\n \"getUTCHours\",\n \"getUTCMilliseconds\",\n \"getUTCMinutes\",\n \"getUTCMonth\",\n \"getUTCSeconds\",\n \"getYear\",\n \"setDate\",\n \"setFullYear\",\n \"setHours\",\n \"setMilliseconds\",\n \"setMinutes\",\n \"setMonth\",\n \"setSeconds\",\n \"setTime\",\n \"setUTCDate\",\n \"setUTCFullYear\",\n \"setUTCHours\",\n \"setUTCMilliseconds\",\n \"setUTCMinutes\",\n \"setUTCMonth\",\n \"setUTCSeconds\",\n \"setYear\",\n \"toDateString\",\n \"toISOString\",\n \"toJSON\",\n \"toGMTString\",\n \"toLocaleDateString\",\n \"toLocaleString\",\n \"toLocaleTimeString\",\n \"toTimeString\",\n \"toUTCString\",\n ];\n for (var i = 0; i < functions.length; i++) {\n wrapper = (function (nativeFunc) {\n return function (var_args) {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args[i] = thisInterpreter.pseudoToNative(arguments[i]);\n }\n return this.data[nativeFunc].apply(this.data, args);\n };\n })(functions[i]);\n this.setNativeFunctionPrototype(this.DATE, functions[i], wrapper);\n }\n};\n\n/**\n * Initialize Regular Expression object.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initRegExp = function (scope) {\n var thisInterpreter = this;\n var wrapper;\n // RegExp constructor.\n wrapper = function (pattern, flags) {\n if (thisInterpreter.calledWithNew()) {\n // Called as new RegExp().\n var rgx = this;\n } else {\n // Called as RegExp().\n var rgx = thisInterpreter.createObjectProto(thisInterpreter.REGEXP_PROTO);\n }\n pattern = pattern ? pattern.toString() : \"\";\n flags = flags ? flags.toString() : \"\";\n thisInterpreter.populateRegExp(rgx, new RegExp(pattern, flags));\n return rgx;\n };\n this.REGEXP = this.createNativeFunction(wrapper, true);\n this.REGEXP_PROTO = this.REGEXP.properties[\"prototype\"];\n this.setProperty(scope, \"RegExp\", this.REGEXP);\n\n this.setProperty(\n this.REGEXP.properties[\"prototype\"],\n \"global\",\n undefined,\n Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR,\n );\n this.setProperty(\n this.REGEXP.properties[\"prototype\"],\n \"ignoreCase\",\n undefined,\n Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR,\n );\n this.setProperty(\n this.REGEXP.properties[\"prototype\"],\n \"multiline\",\n undefined,\n Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR,\n );\n this.setProperty(\n this.REGEXP.properties[\"prototype\"],\n \"source\",\n \"(?:)\",\n Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR,\n );\n\n wrapper = function (str) {\n return this.data.test(str);\n };\n this.setNativeFunctionPrototype(this.REGEXP, \"test\", wrapper);\n\n wrapper = function (str) {\n str = str.toString();\n // Get lastIndex from wrapped regex, since this is settable.\n this.data.lastIndex = Number(thisInterpreter.getProperty(this, \"lastIndex\"));\n var match = this.data.exec(str);\n thisInterpreter.setProperty(this, \"lastIndex\", this.data.lastIndex);\n\n if (match) {\n var result = thisInterpreter.createObjectProto(thisInterpreter.ARRAY_PROTO);\n for (var i = 0; i < match.length; i++) {\n thisInterpreter.setProperty(result, i, match[i]);\n }\n // match has additional properties.\n thisInterpreter.setProperty(result, \"index\", match.index);\n thisInterpreter.setProperty(result, \"input\", match.input);\n return result;\n }\n return null;\n };\n this.setNativeFunctionPrototype(this.REGEXP, \"exec\", wrapper);\n};\n\n/**\n * Initialize the Error class.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initError = function (scope) {\n var thisInterpreter = this;\n // Error constructor.\n this.ERROR = this.createNativeFunction(function (opt_message) {\n if (thisInterpreter.calledWithNew()) {\n // Called as new Error().\n var newError = this;\n } else {\n // Called as Error().\n var newError = thisInterpreter.createObject(thisInterpreter.ERROR);\n }\n if (opt_message) {\n thisInterpreter.setProperty(newError, \"message\", String(opt_message), Interpreter.NONENUMERABLE_DESCRIPTOR);\n }\n return newError;\n }, true);\n this.setProperty(scope, \"Error\", this.ERROR);\n this.setProperty(this.ERROR.properties[\"prototype\"], \"message\", \"\", Interpreter.NONENUMERABLE_DESCRIPTOR);\n this.setProperty(this.ERROR.properties[\"prototype\"], \"name\", \"Error\", Interpreter.NONENUMERABLE_DESCRIPTOR);\n\n var createErrorSubclass = function (name) {\n var constructor = thisInterpreter.createNativeFunction(function (opt_message) {\n if (thisInterpreter.calledWithNew()) {\n // Called as new XyzError().\n var newError = this;\n } else {\n // Called as XyzError().\n var newError = thisInterpreter.createObject(constructor);\n }\n if (opt_message) {\n thisInterpreter.setProperty(newError, \"message\", String(opt_message), Interpreter.NONENUMERABLE_DESCRIPTOR);\n }\n return newError;\n }, true);\n thisInterpreter.setProperty(constructor, \"prototype\", thisInterpreter.createObject(thisInterpreter.ERROR));\n thisInterpreter.setProperty(\n constructor.properties[\"prototype\"],\n \"name\",\n name,\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n thisInterpreter.setProperty(scope, name, constructor);\n\n return constructor;\n };\n\n this.EVAL_ERROR = createErrorSubclass(\"EvalError\");\n this.RANGE_ERROR = createErrorSubclass(\"RangeError\");\n this.REFERENCE_ERROR = createErrorSubclass(\"ReferenceError\");\n this.SYNTAX_ERROR = createErrorSubclass(\"SyntaxError\");\n this.TYPE_ERROR = createErrorSubclass(\"TypeError\");\n this.URI_ERROR = createErrorSubclass(\"URIError\");\n};\n\n/**\n * Initialize Math object.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initMath = function (scope) {\n var thisInterpreter = this;\n var myMath = this.createObjectProto(this.OBJECT_PROTO);\n this.setProperty(scope, \"Math\", myMath);\n var mathConsts = [\"E\", \"LN2\", \"LN10\", \"LOG2E\", \"LOG10E\", \"PI\", \"SQRT1_2\", \"SQRT2\"];\n for (var i = 0; i < mathConsts.length; i++) {\n this.setProperty(myMath, mathConsts[i], Math[mathConsts[i]], Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);\n }\n var numFunctions = [\n \"abs\",\n \"acos\",\n \"asin\",\n \"atan\",\n \"atan2\",\n \"ceil\",\n \"cos\",\n \"exp\",\n \"floor\",\n \"log\",\n \"max\",\n \"min\",\n \"pow\",\n \"random\",\n \"round\",\n \"sin\",\n \"sqrt\",\n \"tan\",\n ];\n for (var i = 0; i < numFunctions.length; i++) {\n this.setProperty(\n myMath,\n numFunctions[i],\n this.createNativeFunction(Math[numFunctions[i]], false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n }\n};\n\n/**\n * Initialize JSON object.\n * @param {!Interpreter.Object} scope Global scope.\n */\nInterpreter.prototype.initJSON = function (scope) {\n var thisInterpreter = this;\n var myJSON = thisInterpreter.createObjectProto(this.OBJECT_PROTO);\n this.setProperty(scope, \"JSON\", myJSON);\n\n var wrapper = function (text) {\n try {\n var nativeObj = JSON.parse(text.toString());\n } catch (e) {\n thisInterpreter.throwException(thisInterpreter.SYNTAX_ERROR, e.message);\n }\n return thisInterpreter.nativeToPseudo(nativeObj);\n };\n this.setProperty(myJSON, \"parse\", this.createNativeFunction(wrapper, false));\n\n wrapper = function (value) {\n var nativeObj = thisInterpreter.pseudoToNative(value);\n try {\n var str = JSON.stringify(nativeObj);\n } catch (e) {\n thisInterpreter.throwException(thisInterpreter.TYPE_ERROR, e.message);\n }\n return str;\n };\n this.setProperty(myJSON, \"stringify\", this.createNativeFunction(wrapper, false));\n};\n\n/**\n * Is an object of a certain class?\n * @param {Interpreter.Value} child Object to check.\n * @param {Interpreter.Object} constructor Constructor of object.\n * @return {boolean} True if object is the class or inherits from it.\n * False otherwise.\n */\nInterpreter.prototype.isa = function (child, constructor) {\n if (child === null || child === undefined || !constructor) {\n return false;\n }\n var proto = constructor.properties[\"prototype\"];\n if (child === proto) {\n return true;\n }\n // The first step up the prototype chain is harder since the child might be\n // a primitive value. Subsequent steps can just follow the .proto property.\n child = this.getPrototype(child);\n while (child) {\n if (child === proto) {\n return true;\n }\n child = child.proto;\n }\n return false;\n};\n\n/**\n * Is a value a legal integer for an array length?\n * @param {Interpreter.Value} x Value to check.\n * @return {number} Zero, or a positive integer if the value can be\n * converted to such. NaN otherwise.\n */\nInterpreter.legalArrayLength = function (x) {\n var n = x >>> 0;\n // Array length must be between 0 and 2^32-1 (inclusive).\n return n === Number(x) ? n : NaN;\n};\n\n/**\n * Is a value a legal integer for an array index?\n * @param {Interpreter.Value} x Value to check.\n * @return {number} Zero, or a positive integer if the value can be\n * converted to such. NaN otherwise.\n */\nInterpreter.legalArrayIndex = function (x) {\n var n = x >>> 0;\n // Array index cannot be 2^32-1, otherwise length would be 2^32.\n // 0xffffffff is 2^32-1.\n return String(n) === String(x) && n !== 0xffffffff ? n : NaN;\n};\n\n/**\n * Typedef for JS values.\n * @typedef {!Interpreter.Object|boolean|number|string|undefined|null}\n */\nInterpreter.Value;\n\n/**\n * Class for an object.\n * @param {Interpreter.Object} proto Prototype object or null.\n * @constructor\n */\nInterpreter.Object = function (proto) {\n this.getter = Object.create(null);\n this.setter = Object.create(null);\n this.properties = Object.create(null);\n this.proto = proto;\n};\n\n/** @type {Interpreter.Object} */\nInterpreter.Object.prototype.proto = null;\n\n/** @type {boolean} */\nInterpreter.Object.prototype.isObject = true;\n\n/** @type {string} */\nInterpreter.Object.prototype.class = \"Object\";\n\n/** @type {Date|RegExp|boolean|number|string|undefined|null} */\nInterpreter.Object.prototype.data = null;\n\n/**\n * Convert this object into a string.\n * @return {string} String value.\n * @override\n */\nInterpreter.Object.prototype.toString = function () {\n if (this.class === \"Array\") {\n // Array\n var cycles = Interpreter.toStringCycles_;\n cycles.push(this);\n try {\n var strs = [];\n for (var i = 0; i < this.properties.length; i++) {\n var value = this.properties[i];\n strs[i] = value && value.isObject && cycles.indexOf(value) !== -1 ? \"...\" : value;\n }\n } finally {\n cycles.pop();\n }\n return strs.join(\",\");\n }\n if (this.class === \"Error\") {\n var cycles = Interpreter.toStringCycles_;\n if (cycles.indexOf(this) !== -1) {\n return \"[object Error]\";\n }\n var name, message;\n // Bug: Does not support getters and setters for name or message.\n var obj = this;\n do {\n if (\"name\" in obj.properties) {\n name = obj.properties[\"name\"];\n break;\n }\n } while ((obj = obj.proto));\n var obj = this;\n do {\n if (\"message\" in obj.properties) {\n message = obj.properties[\"message\"];\n break;\n }\n } while ((obj = obj.proto));\n cycles.push(this);\n try {\n name = name && name.toString();\n message = message && message.toString();\n } finally {\n cycles.pop();\n }\n return message ? name + \": \" + message : String(name);\n }\n\n // RegExp, Date, and boxed primitives.\n if (this.data !== null) {\n return String(this.data);\n }\n\n return \"[object \" + this.class + \"]\";\n};\n\n/**\n * Return the object's value.\n * @return {Interpreter.Value} Value.\n * @override\n */\nInterpreter.Object.prototype.valueOf = function () {\n if (this.data === undefined || this.data === null || this.data instanceof RegExp) {\n return this; // An Object.\n }\n if (this.data instanceof Date) {\n return this.data.valueOf(); // Milliseconds.\n }\n return /** @type {(boolean|number|string)} */ (this.data); // Boxed primitive.\n};\n\n/**\n * Create a new data object based on a constructor's prototype.\n * @param {Interpreter.Object} constructor Parent constructor function,\n * or null if scope object.\n * @return {!Interpreter.Object} New data object.\n */\nInterpreter.prototype.createObject = function (constructor) {\n return this.createObjectProto(constructor && constructor.properties[\"prototype\"]);\n};\n\n/**\n * Create a new data object based on a prototype.\n * @param {Interpreter.Object} proto Prototype object.\n * @return {!Interpreter.Object} New data object.\n */\nInterpreter.prototype.createObjectProto = function (proto) {\n if (typeof proto !== \"object\") {\n throw Error(\"Non object prototype\");\n }\n var obj = new Interpreter.Object(proto);\n // Functions have prototype objects.\n if (this.isa(obj, this.FUNCTION)) {\n this.setProperty(obj, \"prototype\", this.createObjectProto(this.OBJECT_PROTO || null));\n obj.class = \"Function\";\n }\n // Arrays have length.\n if (this.isa(obj, this.ARRAY)) {\n this.setProperty(obj, \"length\", 0, {\n configurable: false,\n enumerable: false,\n writable: true,\n });\n obj.class = \"Array\";\n }\n if (this.isa(obj, this.ERROR)) {\n obj.class = \"Error\";\n }\n return obj;\n};\n\n/**\n * Initialize a pseudo regular expression object based on a native regular\n * expression object.\n * @param {!Interpreter.Object} pseudoRegexp The existing object to set.\n * @param {!RegExp} nativeRegexp The native regular expression.\n */\nInterpreter.prototype.populateRegExp = function (pseudoRegexp, nativeRegexp) {\n pseudoRegexp.data = nativeRegexp;\n // lastIndex is settable, all others are read-only attributes\n this.setProperty(pseudoRegexp, \"lastIndex\", nativeRegexp.lastIndex, Interpreter.NONENUMERABLE_DESCRIPTOR);\n this.setProperty(pseudoRegexp, \"source\", nativeRegexp.source, Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);\n this.setProperty(pseudoRegexp, \"global\", nativeRegexp.global, Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);\n this.setProperty(pseudoRegexp, \"ignoreCase\", nativeRegexp.ignoreCase, Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);\n this.setProperty(pseudoRegexp, \"multiline\", nativeRegexp.multiline, Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);\n};\n\n/**\n * Create a new function.\n * @param {!Object} node AST node defining the function.\n * @param {!Object} scope Parent scope.\n * @return {!Interpreter.Object} New function.\n */\nInterpreter.prototype.createFunction = function (node, scope) {\n var func = this.createObjectProto(this.FUNCTION_PROTO);\n func.parentScope = scope;\n func.node = node;\n this.setProperty(func, \"length\", func.node[\"params\"].length, Interpreter.READONLY_DESCRIPTOR);\n return func;\n};\n\n/**\n * Create a new native function.\n * @param {!Function} nativeFunc JavaScript function.\n * @param {boolean=} opt_constructor If true, the function's\n * prototype will have its constructor property set to the function.\n * If false, the function cannot be called as a constructor (e.g. escape).\n * Defaults to undefined.\n * @return {!Interpreter.Object} New function.\n */\nInterpreter.prototype.createNativeFunction = function (nativeFunc, opt_constructor) {\n var func = this.createObjectProto(this.FUNCTION_PROTO);\n func.nativeFunc = nativeFunc;\n nativeFunc.id = this.functionCounter_++;\n this.setProperty(func, \"length\", nativeFunc.length, Interpreter.READONLY_DESCRIPTOR);\n if (opt_constructor) {\n this.setProperty(func.properties[\"prototype\"], \"constructor\", func, Interpreter.NONENUMERABLE_DESCRIPTOR);\n } else if (opt_constructor === false) {\n func.illegalConstructor = true;\n this.setProperty(func, \"prototype\", undefined);\n }\n return func;\n};\n\n/**\n * Create a new native asynchronous function.\n * @param {!Function} asyncFunc JavaScript function.\n * @return {!Interpreter.Object} New function.\n */\nInterpreter.prototype.createAsyncFunction = function (asyncFunc) {\n var func = this.createObjectProto(this.FUNCTION_PROTO);\n func.asyncFunc = asyncFunc;\n asyncFunc.id = this.functionCounter_++;\n this.setProperty(func, \"length\", asyncFunc.length, Interpreter.READONLY_DESCRIPTOR);\n return func;\n};\n\n/**\n * Converts from a native JS object or value to a JS interpreter object.\n * Can handle JSON-style values, does NOT handle cycles.\n * @param {*} nativeObj The native JS object to be converted.\n * @return {Interpreter.Value} The equivalent JS interpreter object.\n */\nInterpreter.prototype.nativeToPseudo = function (nativeObj) {\n if ((typeof nativeObj !== \"object\" && typeof nativeObj !== \"function\") || nativeObj === null) {\n return nativeObj;\n }\n\n if (nativeObj instanceof RegExp) {\n var pseudoRegexp = this.createObjectProto(this.REGEXP_PROTO);\n this.populateRegExp(pseudoRegexp, nativeObj);\n return pseudoRegexp;\n }\n\n if (nativeObj instanceof Date) {\n var pseudoDate = this.createObjectProto(this.DATE_PROTO);\n pseudoDate.data = nativeObj;\n return pseudoDate;\n }\n\n if (nativeObj instanceof Function) {\n var interpreter = this;\n var wrapper = function () {\n return interpreter.nativeToPseudo(\n nativeObj.apply(\n interpreter,\n Array.prototype.slice.call(arguments).map(function (i) {\n return interpreter.pseudoToNative(i);\n }),\n ),\n );\n };\n return this.createNativeFunction(wrapper, undefined);\n }\n\n var pseudoObj;\n if (Array.isArray(nativeObj)) {\n // Array.\n pseudoObj = this.createObjectProto(this.ARRAY_PROTO);\n for (var i = 0; i < nativeObj.length; i++) {\n if (i in nativeObj) {\n this.setProperty(pseudoObj, i, this.nativeToPseudo(nativeObj[i]));\n }\n }\n } else {\n // Object.\n pseudoObj = this.createObjectProto(this.OBJECT_PROTO);\n for (var key in nativeObj) {\n this.setProperty(pseudoObj, key, this.nativeToPseudo(nativeObj[key]));\n }\n }\n return pseudoObj;\n};\n\n/**\n * Converts from a JS interpreter object to native JS object.\n * Can handle JSON-style values, plus cycles.\n * @param {Interpreter.Value} pseudoObj The JS interpreter object to be\n * converted.\n * @param {Object=} opt_cycles Cycle detection (used in recursive calls).\n * @return {*} The equivalent native JS object or value.\n */\nInterpreter.prototype.pseudoToNative = function (pseudoObj, opt_cycles) {\n if ((typeof pseudoObj !== \"object\" && typeof pseudoObj !== \"function\") || pseudoObj === null) {\n return pseudoObj;\n }\n\n if (this.isa(pseudoObj, this.REGEXP)) {\n // Regular expression.\n return pseudoObj.data;\n }\n\n if (this.isa(pseudoObj, this.DATE)) {\n // Date.\n return pseudoObj.data;\n }\n\n var cycles = opt_cycles || {\n pseudo: [],\n native: [],\n };\n var i = cycles.pseudo.indexOf(pseudoObj);\n if (i !== -1) {\n return cycles.native[i];\n }\n cycles.pseudo.push(pseudoObj);\n var nativeObj;\n if (this.isa(pseudoObj, this.ARRAY)) {\n // Array.\n nativeObj = [];\n cycles.native.push(nativeObj);\n var length = this.getProperty(pseudoObj, \"length\");\n for (var i = 0; i < length; i++) {\n if (this.hasProperty(pseudoObj, i)) {\n nativeObj[i] = this.pseudoToNative(this.getProperty(pseudoObj, i), cycles);\n }\n }\n } else {\n // Object.\n nativeObj = {};\n cycles.native.push(nativeObj);\n var val;\n for (var key in pseudoObj.properties) {\n val = pseudoObj.properties[key];\n nativeObj[key] = this.pseudoToNative(val, cycles);\n }\n }\n cycles.pseudo.pop();\n cycles.native.pop();\n return nativeObj;\n};\n\n/**\n * Converts from a native JS array to a JS interpreter array.\n * Does handle non-numeric properties (like str.match's index prop).\n * Does NOT recurse into the array's contents.\n * @param {!Array} nativeArray The JS array to be converted.\n * @return {!Interpreter.Object} The equivalent JS interpreter array.\n */\nInterpreter.prototype.arrayNativeToPseudo = function (nativeArray) {\n var pseudoArray = this.createObjectProto(this.ARRAY_PROTO);\n var props = Object.getOwnPropertyNames(nativeArray);\n for (var i = 0; i < props.length; i++) {\n this.setProperty(pseudoArray, props[i], nativeArray[props[i]]);\n }\n return pseudoArray;\n};\n\n/**\n * Converts from a JS interpreter array to native JS array.\n * Does handle non-numeric properties (like str.match's index prop).\n * Does NOT recurse into the array's contents.\n * @param {!Interpreter.Object} pseudoArray The JS interpreter array,\n * or JS interpreter object pretending to be an array.\n * @return {!Array} The equivalent native JS array.\n */\nInterpreter.prototype.arrayPseudoToNative = function (pseudoArray) {\n var nativeArray = [];\n for (var key in pseudoArray.properties) {\n nativeArray[key] = this.getProperty(pseudoArray, key);\n }\n // pseudoArray might be an object pretending to be an array. In this case\n // it's possible that length is non-existent, invalid, or smaller than the\n // largest defined numeric property. Set length explicitly here.\n nativeArray.length = Interpreter.legalArrayLength(this.getProperty(pseudoArray, \"length\")) || 0;\n return nativeArray;\n};\n\n/**\n * Look up the prototype for this value.\n * @param {Interpreter.Value} value Data object.\n * @return {Interpreter.Object} Prototype object, null if none.\n */\nInterpreter.prototype.getPrototype = function (value) {\n switch (typeof value) {\n case \"number\":\n return this.NUMBER.properties[\"prototype\"];\n case \"boolean\":\n return this.BOOLEAN.properties[\"prototype\"];\n case \"string\":\n return this.STRING.properties[\"prototype\"];\n }\n if (value) {\n return value.proto;\n }\n return null;\n};\n\n/**\n * Fetch a property value from a data object.\n * @param {Interpreter.Value} obj Data object.\n * @param {Interpreter.Value} name Name of property.\n * @param {Acorn AST Node} node Node that triggered this function. Used by Bitburner for getting error line numbers\n * @return {Interpreter.Value} Property value (may be undefined).\n */\nInterpreter.prototype.getProperty = function (obj, name, node) {\n name = String(name);\n if (obj === undefined || obj === null) {\n let lineNum;\n if (node != null && node.loc != null && node.loc.start != null) {\n lineNum = node.loc.start.line;\n }\n this.throwException(this.TYPE_ERROR, \"Cannot read property '\" + name + \"' of \" + obj, lineNum);\n }\n if (name === \"length\") {\n // Special cases for magic length property.\n if (this.isa(obj, this.STRING)) {\n return String(obj).length;\n }\n } else if (name.charCodeAt(0) < 0x40) {\n // Might have numbers in there?\n // Special cases for string array indexing\n if (this.isa(obj, this.STRING)) {\n var n = Interpreter.legalArrayIndex(name);\n if (!isNaN(n) && n < String(obj).length) {\n return String(obj)[n];\n }\n }\n }\n do {\n if (obj.properties && name in obj.properties) {\n var getter = obj.getter[name];\n if (getter) {\n // Flag this function as being a getter and thus needing immediate\n // execution (rather than being the value of the property).\n getter.isGetter = true;\n return getter;\n }\n return obj.properties[name];\n }\n } while ((obj = this.getPrototype(obj)));\n return undefined;\n};\n\n/**\n * Does the named property exist on a data object.\n * @param {Interpreter.Value} obj Data object.\n * @param {Interpreter.Value} name Name of property.\n * @return {boolean} True if property exists.\n */\nInterpreter.prototype.hasProperty = function (obj, name) {\n if (!obj.isObject) {\n throw TypeError(\"Primitive data type has no properties\");\n }\n name = String(name);\n if (name === \"length\" && this.isa(obj, this.STRING)) {\n return true;\n }\n if (this.isa(obj, this.STRING)) {\n var n = Interpreter.legalArrayIndex(name);\n if (!isNaN(n) && n < String(obj).length) {\n return true;\n }\n }\n do {\n if (obj.properties && name in obj.properties) {\n return true;\n }\n } while ((obj = this.getPrototype(obj)));\n return false;\n};\n\n/**\n * Set a property value on a data object.\n * @param {!Interpreter.Object} obj Data object.\n * @param {Interpreter.Value} name Name of property.\n * @param {Interpreter.Value} value New property value.\n * Use Interpreter.VALUE_IN_DESCRIPTOR if value is handled by\n * descriptor instead.\n * @param {Object=} opt_descriptor Optional descriptor object.\n * @return {!Interpreter.Object|undefined} Returns a setter function if one\n * needs to be called, otherwise undefined.\n */\nInterpreter.prototype.setProperty = function (obj, name, value, opt_descriptor) {\n name = String(name);\n if (obj === undefined || obj === null) {\n this.throwException(this.TYPE_ERROR, \"Cannot set property '\" + name + \"' of \" + obj);\n }\n if (\n opt_descriptor &&\n (\"get\" in opt_descriptor || \"set\" in opt_descriptor) &&\n (\"value\" in opt_descriptor || \"writable\" in opt_descriptor)\n ) {\n this.throwException(\n this.TYPE_ERROR,\n \"Invalid property descriptor. \" + \"Cannot both specify accessors and a value or writable attribute\",\n );\n }\n var strict = !this.stateStack || this.getScope().strict;\n if (!obj.isObject) {\n if (strict) {\n this.throwException(this.TYPE_ERROR, \"Can't create property '\" + name + \"' on '\" + obj + \"'\");\n }\n return;\n }\n if (this.isa(obj, this.STRING)) {\n var n = Interpreter.legalArrayIndex(name);\n if (name === \"length\" || (!isNaN(n) && n < String(obj).length)) {\n // Can't set length or letters on String objects.\n if (strict) {\n this.throwException(\n this.TYPE_ERROR,\n \"Cannot assign to read only \" + \"property '\" + name + \"' of String '\" + obj.data + \"'\",\n );\n }\n return;\n }\n }\n if (obj.class === \"Array\") {\n // Arrays have a magic length variable that is bound to the elements.\n var length = obj.properties.length;\n var i;\n if (name === \"length\") {\n // Delete elements if length is smaller.\n if (opt_descriptor) {\n if (!(\"value\" in opt_descriptor)) {\n return;\n }\n value = opt_descriptor.value;\n }\n value = Interpreter.legalArrayLength(value);\n if (isNaN(value)) {\n this.throwException(this.RANGE_ERROR, \"Invalid array length\");\n }\n if (value < length) {\n for (i in obj.properties) {\n i = Interpreter.legalArrayIndex(i);\n if (!isNaN(i) && value <= i) {\n delete obj.properties[i];\n }\n }\n }\n } else if (!isNaN((i = Interpreter.legalArrayIndex(name)))) {\n // Increase length if this index is larger.\n obj.properties.length = Math.max(length, i + 1);\n }\n }\n if (obj.preventExtensions && !(name in obj.properties)) {\n if (strict) {\n this.throwException(this.TYPE_ERROR, \"Can't add property '\" + name + \"', object is not extensible\");\n }\n return;\n }\n if (opt_descriptor) {\n // Define the property.\n if (\"get\" in opt_descriptor) {\n if (opt_descriptor.get) {\n obj.getter[name] = opt_descriptor.get;\n } else {\n delete obj.getter[name];\n }\n }\n if (\"set\" in opt_descriptor) {\n if (opt_descriptor.set) {\n obj.setter[name] = opt_descriptor.set;\n } else {\n delete obj.setter[name];\n }\n }\n var descriptor = {};\n if (\"configurable\" in opt_descriptor) {\n descriptor.configurable = opt_descriptor.configurable;\n }\n if (\"enumerable\" in opt_descriptor) {\n descriptor.enumerable = opt_descriptor.enumerable;\n }\n if (\"writable\" in opt_descriptor) {\n descriptor.writable = opt_descriptor.writable;\n delete obj.getter[name];\n delete obj.setter[name];\n }\n if (\"value\" in opt_descriptor) {\n descriptor.value = opt_descriptor.value;\n delete obj.getter[name];\n delete obj.setter[name];\n } else if (value !== Interpreter.VALUE_IN_DESCRIPTOR) {\n descriptor.value = value;\n delete obj.getter[name];\n delete obj.setter[name];\n }\n try {\n Object.defineProperty(obj.properties, name, descriptor);\n } catch (e) {\n this.throwException(this.TYPE_ERROR, \"Cannot redefine property: \" + name);\n }\n } else {\n // Set the property.\n if (value === Interpreter.VALUE_IN_DESCRIPTOR) {\n throw ReferenceError(\"Value not specified.\");\n }\n // Determine the parent (possibly self) where the property is defined.\n var defObj = obj;\n while (!(name in defObj.properties)) {\n defObj = this.getPrototype(defObj);\n if (!defObj) {\n // This is a new property.\n defObj = obj;\n break;\n }\n }\n if (defObj.setter && defObj.setter[name]) {\n return defObj.setter[name];\n }\n if (defObj.getter && defObj.getter[name]) {\n if (strict) {\n this.throwException(\n this.TYPE_ERROR,\n \"Cannot set property '\" + name + \"' of object '\" + obj + \"' which only has a getter\",\n );\n }\n } else {\n // No setter, simple assignment.\n try {\n obj.properties[name] = value;\n } catch (e) {\n if (strict) {\n this.throwException(\n this.TYPE_ERROR,\n \"Cannot assign to read only \" + \"property '\" + name + \"' of object '\" + obj + \"'\",\n );\n }\n }\n }\n }\n};\n\n/**\n * Convenience method for adding a native function as a non-enumerable property\n * onto an object's prototype.\n * @param {!Interpreter.Object} obj Data object.\n * @param {Interpreter.Value} name Name of property.\n * @param {!Function} wrapper Function object.\n */\nInterpreter.prototype.setNativeFunctionPrototype = function (obj, name, wrapper) {\n this.setProperty(\n obj.properties[\"prototype\"],\n name,\n this.createNativeFunction(wrapper, false),\n Interpreter.NONENUMERABLE_DESCRIPTOR,\n );\n};\n\n/**\n * Returns the current scope from the stateStack.\n * @return {!Interpreter.Object} Current scope dictionary.\n */\nInterpreter.prototype.getScope = function () {\n var scope = this.stateStack[this.stateStack.length - 1].scope;\n if (!scope) {\n throw Error(\"No scope found.\");\n }\n return scope;\n};\n\n/**\n * Create a new scope dictionary.\n * @param {!Object} node AST node defining the scope container\n * (e.g. a function).\n * @param {Interpreter.Object} parentScope Scope to link to.\n * @return {!Interpreter.Object} New scope.\n */\nInterpreter.prototype.createScope = function (node, parentScope) {\n var scope = this.createObjectProto(null);\n scope.parentScope = parentScope;\n if (!parentScope) {\n this.initGlobalScope(scope);\n }\n this.populateScope_(node, scope);\n\n // Determine if this scope starts with 'use strict'.\n scope.strict = false;\n if (parentScope && parentScope.strict) {\n scope.strict = true;\n } else {\n var firstNode = node[\"body\"] && node[\"body\"][0];\n if (\n firstNode &&\n firstNode.expression &&\n firstNode.expression[\"type\"] === \"Literal\" &&\n firstNode.expression.value === \"use strict\"\n ) {\n scope.strict = true;\n }\n }\n return scope;\n};\n\n/**\n * Create a new special scope dictionary. Similar to createScope(), but\n * doesn't assume that the scope is for a function body.\n * This is used for 'catch' clauses and 'with' statements.\n * @param {!Interpreter.Object} parentScope Scope to link to.\n * @param {Interpreter.Object=} opt_scope Optional object to transform into\n * scope.\n * @return {!Interpreter.Object} New scope.\n */\nInterpreter.prototype.createSpecialScope = function (parentScope, opt_scope) {\n if (!parentScope) {\n throw Error(\"parentScope required\");\n }\n var scope = opt_scope || this.createObjectProto(null);\n scope.parentScope = parentScope;\n scope.strict = parentScope.strict;\n return scope;\n};\n\n/**\n * Retrieves a value from the scope chain.\n * @param {string} name Name of variable.\n * @param {Acorn AST Node} node Node that triggered this function. Used by Bitburner for getting error line number\n * @return {Interpreter.Value} Any value.\n * May be flagged as being a getter and thus needing immediate execution\n * (rather than being the value of the property).\n */\nInterpreter.prototype.getValueFromScope = function (name, node) {\n var scope = this.getScope();\n while (scope && scope !== this.global) {\n if (name in scope.properties) {\n return scope.properties[name];\n }\n scope = scope.parentScope;\n }\n // The root scope is also an object which has inherited properties and\n // could also have getters.\n if (scope === this.global && this.hasProperty(scope, name)) {\n return this.getProperty(scope, name);\n }\n // Typeof operator is unique: it can safely look at non-defined variables.\n var prevNode = this.stateStack[this.stateStack.length - 1].node;\n if (prevNode[\"type\"] === \"UnaryExpression\" && prevNode[\"operator\"] === \"typeof\") {\n return undefined;\n }\n\n var lineNum;\n if (node != null && node.loc != null && node.loc.start != null) {\n lineNum = node.loc.start.line;\n }\n this.throwException(this.REFERENCE_ERROR, name + \" is not defined\", lineNum);\n};\n\n/**\n * Sets a value to the current scope.\n * @param {string} name Name of variable.\n * @param {Interpreter.Value} value Value.\n * @return {!Interpreter.Object|undefined} Returns a setter function if one\n * needs to be called, otherwise undefined.\n */\nInterpreter.prototype.setValueToScope = function (name, value) {\n var scope = this.getScope();\n var strict = scope.strict;\n while (scope && scope !== this.global) {\n if (name in scope.properties) {\n scope.properties[name] = value;\n return undefined;\n }\n scope = scope.parentScope;\n }\n // The root scope is also an object which has readonly properties and\n // could also have setters.\n if (scope === this.global && (!strict || this.hasProperty(scope, name))) {\n return this.setProperty(scope, name, value);\n }\n this.throwException(this.REFERENCE_ERROR, name + \" is not defined\");\n};\n\n/**\n * Create a new scope for the given node.\n * @param {!Object} node AST node (program or function).\n * @param {!Interpreter.Object} scope Scope dictionary to populate.\n * @private\n */\nInterpreter.prototype.populateScope_ = function (node, scope) {\n if (node[\"type\"] === \"VariableDeclaration\") {\n for (var i = 0; i < node[\"declarations\"].length; i++) {\n this.setProperty(scope, node[\"declarations\"][i][\"id\"][\"name\"], undefined, Interpreter.VARIABLE_DESCRIPTOR);\n }\n } else if (node[\"type\"] === \"FunctionDeclaration\") {\n this.setProperty(scope, node[\"id\"][\"name\"], this.createFunction(node, scope), Interpreter.VARIABLE_DESCRIPTOR);\n return; // Do not recurse into function.\n } else if (node[\"type\"] === \"FunctionExpression\") {\n return; // Do not recurse into function.\n } else if (node[\"type\"] === \"ExpressionStatement\") {\n return; // Expressions can't contain variable/function declarations.\n }\n var nodeClass = node[\"constructor\"];\n for (var name in node) {\n var prop = node[name];\n if (prop && typeof prop === \"object\") {\n if (Array.isArray(prop)) {\n for (var i = 0; i < prop.length; i++) {\n if (prop[i] && prop[i].constructor === nodeClass) {\n this.populateScope_(prop[i], scope);\n }\n }\n } else {\n if (prop.constructor === nodeClass) {\n this.populateScope_(prop, scope);\n }\n }\n }\n }\n};\n\n/**\n * Remove start and end values from AST, or set start and end values to a\n * constant value. Used to remove highlighting from polyfills and to set\n * highlighting in an eval to cover the entire eval expression.\n * @param {!Object} node AST node.\n * @param {number=} start Starting character of all nodes, or undefined.\n * @param {number=} end Ending character of all nodes, or undefined.\n * @private\n */\nInterpreter.prototype.stripLocations_ = function (node, start, end) {\n if (start) {\n node[\"start\"] = start;\n } else {\n delete node[\"start\"];\n }\n if (end) {\n node[\"end\"] = end;\n } else {\n delete node[\"end\"];\n }\n for (var name in node) {\n if (node.hasOwnProperty(name)) {\n var prop = node[name];\n if (prop && typeof prop === \"object\") {\n this.stripLocations_(prop, start, end);\n }\n }\n }\n};\n\n/**\n * Is the current state directly being called with as a construction with 'new'.\n * @return {boolean} True if 'new foo()', false if 'foo()'.\n */\nInterpreter.prototype.calledWithNew = function () {\n return this.stateStack[this.stateStack.length - 1].isConstructor;\n};\n\n/**\n * Gets a value from the scope chain or from an object property.\n * @param {!Array} ref Name of variable or object/propname tuple.\n * @param {Acorn AST Node} node Node that triggered this function. Used by Bitburner for getting error line number\n * @return {Interpreter.Value} Any value.\n * May be flagged as being a getter and thus needing immediate execution\n * (rather than being the value of the property).\n */\nInterpreter.prototype.getValue = function (ref, node) {\n if (ref[0] === Interpreter.SCOPE_REFERENCE) {\n // A null/varname variable lookup.\n return this.getValueFromScope(ref[1], node);\n } else {\n // An obj/prop components tuple (foo.bar).\n return this.getProperty(ref[0], ref[1], node);\n }\n};\n\n/**\n * Sets a value to the scope chain or to an object property.\n * @param {!Array} ref Name of variable or object/propname tuple.\n * @param {Interpreter.Value} value Value.\n * @return {!Interpreter.Object|undefined} Returns a setter function if one\n * needs to be called, otherwise undefined.\n */\nInterpreter.prototype.setValue = function (ref, value) {\n if (ref[0] === Interpreter.SCOPE_REFERENCE) {\n // A null/varname variable lookup.\n return this.setValueToScope(ref[1], value);\n } else {\n // An obj/prop components tuple (foo.bar).\n return this.setProperty(ref[0], ref[1], value);\n }\n};\n\n/**\n * Completion Value Types.\n * @enum {number}\n */\nInterpreter.Completion = {\n NORMAL: 0,\n BREAK: 1,\n CONTINUE: 2,\n RETURN: 3,\n THROW: 4,\n};\n\n/**\n * Throw an exception in the interpreter that can be handled by an\n * interpreter try/catch statement. If unhandled, a real exception will\n * be thrown. Can be called with either an error class and a message, or\n * with an actual object to be thrown.\n * @param {!Interpreter.Object} errorClass Type of error (if message is\n * provided) or the value to throw (if no message).\n * @param {string=} opt_message Message being thrown.\n */\nInterpreter.prototype.throwException = function (errorClass, opt_message, lineNumber) {\n if (opt_message === undefined) {\n var error = errorClass; // This is a value to throw, not an error class.\n } else {\n var error = this.createObject(errorClass);\n this.setProperty(error, \"message\", opt_message, Interpreter.NONENUMERABLE_DESCRIPTOR);\n }\n var lineNumErrorMsg;\n if (lineNumber != null) {\n lineNumErrorMsg = this.getErrorLineNumberMessage(lineNumber);\n }\n this.unwind(Interpreter.Completion.THROW, error, undefined, lineNumErrorMsg);\n // Abort anything related to the current step.\n throw Interpreter.STEP_ERROR;\n};\n\n/**\n * Unwind the stack to the innermost relevant enclosing TryStatement,\n * For/ForIn/WhileStatement or Call/NewExpression. If this results in\n * the stack being completely unwound the thread will be terminated\n * and the appropriate error being thrown.\n * @param {Interpreter.Completion} type Completion type.\n * @param {Interpreter.Value=} value Value computed, returned or thrown.\n * @param {string=} label Target label for break or return.\n */\nInterpreter.prototype.unwind = function (type, value, label, lineNumberMsg = \"\") {\n if (type === Interpreter.Completion.NORMAL) {\n throw TypeError(\"Should not unwind for NORMAL completions\");\n }\n\n for (var stack = this.stateStack; stack.length > 0; stack.pop()) {\n var state = stack[stack.length - 1];\n switch (state.node[\"type\"]) {\n case \"TryStatement\":\n state.cv = { type: type, value: value, label: label };\n return;\n case \"CallExpression\":\n case \"NewExpression\":\n if (type === Interpreter.Completion.RETURN) {\n state.value = value;\n return;\n } else if (type !== Interpreter.Completion.THROW) {\n throw Error(\"Unsynatctic break/continue not rejected by Acorn\");\n }\n }\n if (type === Interpreter.Completion.BREAK) {\n if (label ? state.labels && state.labels.indexOf(label) !== -1 : state.isLoop || state.isSwitch) {\n stack.pop();\n return;\n }\n } else if (type === Interpreter.Completion.CONTINUE) {\n if (label ? state.labels && state.labels.indexOf(label) !== -1 : state.isLoop) {\n return;\n }\n }\n }\n\n // Unhandled completion. Throw a real error.\n var realError;\n if (this.isa(value, this.ERROR)) {\n var errorTable = {\n EvalError: EvalError,\n RangeError: RangeError,\n ReferenceError: ReferenceError,\n SyntaxError: SyntaxError,\n TypeError: TypeError,\n URIError: URIError,\n };\n var name = this.getProperty(value, \"name\").toString();\n var message = this.getProperty(value, \"message\").valueOf();\n var type = errorTable[name] || Error;\n realError = type(message + lineNumberMsg);\n } else {\n realError = String(value) + lineNumberMsg;\n }\n throw realError;\n};\n\n/**\n * Create a call to a getter function.\n * @param {!Interpreter.Object} func Function to execute.\n * @param {!Interpreter.Object|!Array} left\n * Name of variable or object/propname tuple.\n * @private\n */\nInterpreter.prototype.createGetter_ = function (func, left) {\n // Normally 'this' will be specified as the object component (o.x).\n // Sometimes 'this' is explicitly provided (o).\n var funcThis = Array.isArray(left) ? left[0] : left;\n var node = new this.nodeConstructor();\n node[\"type\"] = \"CallExpression\";\n var state = new Interpreter.State(node, this.stateStack[this.stateStack.length - 1].scope);\n state.doneCallee_ = true;\n state.funcThis_ = funcThis;\n state.func_ = func;\n state.doneArgs_ = true;\n state.arguments_ = [];\n return state;\n};\n\n/**\n * Create a call to a setter function.\n * @param {!Interpreter.Object} func Function to execute.\n * @param {!Interpreter.Object|!Array} left\n * Name of variable or object/propname tuple.\n * @param {Interpreter.Value} value Value to set.\n * @private\n */\nInterpreter.prototype.createSetter_ = function (func, left, value) {\n // Normally 'this' will be specified as the object component (o.x).\n // Sometimes 'this' is implicitly the global object (x).\n var funcThis = Array.isArray(left) ? left[0] : this.global;\n var node = new this.nodeConstructor();\n node[\"type\"] = \"CallExpression\";\n var state = new Interpreter.State(node, this.stateStack[this.stateStack.length - 1].scope);\n state.doneCallee_ = true;\n state.funcThis_ = funcThis;\n state.func_ = func;\n state.doneArgs_ = true;\n state.arguments_ = [value];\n return state;\n};\n\n/**\n * Class for a state.\n * @param {!Object} node AST node for the state.\n * @param {!Interpreter.Object} scope Scope object for the state.\n * @constructor\n */\nInterpreter.State = function (node, scope) {\n this.node = node;\n this.scope = scope;\n};\n\n///////////////////////////////////////////////////////////////////////////////\n// Functions to handle each node type.\n///////////////////////////////////////////////////////////////////////////////\n\nInterpreter.prototype[\"stepArrayExpression\"] = function (stack, state, node) {\n var elements = node[\"elements\"];\n var n = state.n_ || 0;\n if (!state.array_) {\n state.array_ = this.createObjectProto(this.ARRAY_PROTO);\n state.array_.properties.length = elements.length;\n } else {\n this.setProperty(state.array_, n, state.value);\n n++;\n }\n while (n < elements.length) {\n // Skip missing elements - they're not defined, not undefined.\n if (elements[n]) {\n state.n_ = n;\n return new Interpreter.State(elements[n], state.scope);\n }\n n++;\n }\n stack.pop();\n stack[stack.length - 1].value = state.array_;\n};\n\nInterpreter.prototype[\"stepAssignmentExpression\"] = function (stack, state, node) {\n if (!state.doneLeft_) {\n state.doneLeft_ = true;\n var nextState = new Interpreter.State(node[\"left\"], state.scope);\n nextState.components = true;\n return nextState;\n }\n if (!state.doneRight_) {\n if (!state.leftReference_) {\n state.leftReference_ = state.value;\n }\n if (state.doneGetter_) {\n state.leftValue_ = state.value;\n }\n if (!state.doneGetter_ && node[\"operator\"] !== \"=\") {\n var leftValue = this.getValue(state.leftReference_, node);\n state.leftValue_ = leftValue;\n if (leftValue && typeof leftValue === \"object\" && leftValue.isGetter) {\n // Clear the getter flag and call the getter function.\n leftValue.isGetter = false;\n state.doneGetter_ = true;\n var func = /** @type {!Interpreter.Object} */ (leftValue);\n return this.createGetter_(func, state.leftReference_);\n }\n }\n state.doneRight_ = true;\n return new Interpreter.State(node[\"right\"], state.scope);\n }\n if (state.doneSetter_) {\n // Return if setter function.\n // Setter method on property has completed.\n // Ignore its return value, and use the original set value instead.\n stack.pop();\n stack[stack.length - 1].value = state.setterValue_;\n return;\n }\n var value = state.leftValue_;\n var rightValue = state.value;\n switch (node[\"operator\"]) {\n case \"=\":\n value = rightValue;\n break;\n case \"+=\":\n value += rightValue;\n break;\n case \"-=\":\n value -= rightValue;\n break;\n case \"*=\":\n value *= rightValue;\n break;\n case \"/=\":\n value /= rightValue;\n break;\n case \"%=\":\n value %= rightValue;\n break;\n case \"<<=\":\n value <<= rightValue;\n break;\n case \">>=\":\n value >>= rightValue;\n break;\n case \">>>=\":\n value >>>= rightValue;\n break;\n case \"&=\":\n value &= rightValue;\n break;\n case \"^=\":\n value ^= rightValue;\n break;\n case \"|=\":\n value |= rightValue;\n break;\n default:\n throw SyntaxError(\"Unknown assignment expression: \" + node[\"operator\"]);\n }\n var setter = this.setValue(state.leftReference_, value);\n if (setter) {\n state.doneSetter_ = true;\n state.setterValue_ = value;\n return this.createSetter_(setter, state.leftReference_, value);\n }\n // Return if no setter function.\n stack.pop();\n stack[stack.length - 1].value = value;\n};\n\nInterpreter.prototype[\"stepBinaryExpression\"] = function (stack, state, node) {\n if (!state.doneLeft_) {\n state.doneLeft_ = true;\n return new Interpreter.State(node[\"left\"], state.scope);\n }\n if (!state.doneRight_) {\n state.doneRight_ = true;\n state.leftValue_ = state.value;\n return new Interpreter.State(node[\"right\"], state.scope);\n }\n stack.pop();\n var leftValue = state.leftValue_;\n var rightValue = state.value;\n var value;\n switch (node[\"operator\"]) {\n case \"==\":\n value = leftValue == rightValue;\n break;\n case \"!=\":\n value = leftValue != rightValue;\n break;\n case \"===\":\n value = leftValue === rightValue;\n break;\n case \"!==\":\n value = leftValue !== rightValue;\n break;\n case \">\":\n value = leftValue > rightValue;\n break;\n case \">=\":\n value = leftValue >= rightValue;\n break;\n case \"<\":\n value = leftValue < rightValue;\n break;\n case \"<=\":\n value = leftValue <= rightValue;\n break;\n case \"+\":\n value = leftValue + rightValue;\n break;\n case \"-\":\n value = leftValue - rightValue;\n break;\n case \"*\":\n value = leftValue * rightValue;\n break;\n case \"/\":\n value = leftValue / rightValue;\n break;\n case \"%\":\n value = leftValue % rightValue;\n break;\n case \"&\":\n value = leftValue & rightValue;\n break;\n case \"|\":\n value = leftValue | rightValue;\n break;\n case \"^\":\n value = leftValue ^ rightValue;\n break;\n case \"<<\":\n value = leftValue << rightValue;\n break;\n case \">>\":\n value = leftValue >> rightValue;\n break;\n case \">>>\":\n value = leftValue >>> rightValue;\n break;\n case \"in\":\n if (!rightValue || !rightValue.isObject) {\n let lineNum = this.getErrorLineNumber(node);\n this.throwException(this.TYPE_ERROR, \"'in' expects an object, not '\" + rightValue + \"'\", lineNum);\n }\n value = this.hasProperty(rightValue, leftValue);\n break;\n case \"instanceof\":\n if (!this.isa(rightValue, this.FUNCTION)) {\n let lineNum = this.getErrorLineNumber(node);\n this.throwException(this.TYPE_ERROR, \"Right-hand side of instanceof is not an object\", lineNum);\n }\n value = leftValue.isObject ? this.isa(leftValue, rightValue) : false;\n break;\n default:\n throw SyntaxError(\"Unknown binary operator: \" + node[\"operator\"]);\n }\n stack[stack.length - 1].value = value;\n};\n\nInterpreter.prototype[\"stepBlockStatement\"] = function (stack, state, node) {\n var n = state.n_ || 0;\n var expression = node[\"body\"][n];\n if (expression) {\n state.n_ = n + 1;\n return new Interpreter.State(expression, state.scope);\n }\n stack.pop();\n};\n\nInterpreter.prototype[\"stepBreakStatement\"] = function (stack, state, node) {\n var label = node[\"label\"] && node[\"label\"][\"name\"];\n this.unwind(Interpreter.Completion.BREAK, undefined, label);\n};\n\nInterpreter.prototype[\"stepCallExpression\"] = function (stack, state, node) {\n if (!state.doneCallee_) {\n state.doneCallee_ = 1;\n // Components needed to determine value of 'this'.\n var nextState = new Interpreter.State(node[\"callee\"], state.scope);\n nextState.components = true;\n return nextState;\n }\n if (state.doneCallee_ === 1) {\n // Determine value of the function.\n state.doneCallee_ = 2;\n var func = state.value;\n if (Array.isArray(func)) {\n state.func_ = this.getValue(func, node);\n if (func[0] === Interpreter.SCOPE_REFERENCE) {\n // (Globally or locally) named function. Is it named 'eval'?\n state.directEval_ = func[1] === \"eval\";\n } else {\n // Method function, 'this' is object (ignored if invoked as 'new').\n state.funcThis_ = func[0];\n }\n func = state.func_;\n if (func && typeof func === \"object\" && func.isGetter) {\n // Clear the getter flag and call the getter function.\n func.isGetter = false;\n state.doneCallee_ = 1;\n return this.createGetter_(/** @type {!Interpreter.Object} */ (func), state.value);\n }\n } else {\n // Already evaluated function: (function(){...})();\n state.func_ = func;\n }\n state.arguments_ = [];\n state.n_ = 0;\n }\n var func = state.func_;\n if (!state.doneArgs_) {\n if (state.n_ !== 0) {\n state.arguments_.push(state.value);\n }\n if (node[\"arguments\"][state.n_]) {\n return new Interpreter.State(node[\"arguments\"][state.n_++], state.scope);\n }\n // Determine value of 'this' in function.\n if (node[\"type\"] === \"NewExpression\") {\n if (func.illegalConstructor) {\n // Illegal: new escape();\n let lineNum = this.getErrorLineNumber(node);\n this.throwException(this.TYPE_ERROR, func + \" is not a constructor\", lineNum);\n }\n // Constructor, 'this' is new object.\n var proto = func.properties[\"prototype\"];\n if (typeof proto !== \"object\" || proto === null) {\n // Non-object prototypes default to Object.prototype.\n proto = this.OBJECT_PROTO;\n }\n state.funcThis_ = this.createObjectProto(proto);\n state.isConstructor = true;\n } else if (state.funcThis_ === undefined) {\n // Global function, 'this' is global object (or 'undefined' if strict).\n state.funcThis_ = state.scope.strict ? undefined : this.global;\n }\n state.doneArgs_ = true;\n }\n if (!state.doneExec_) {\n state.doneExec_ = true;\n if (!func || !func.isObject) {\n let lineNum = this.getErrorLineNumber(node);\n this.throwException(this.TYPE_ERROR, func + \" is not a function\", lineNum);\n }\n var funcNode = func.node;\n if (funcNode) {\n var scope = this.createScope(funcNode[\"body\"], func.parentScope);\n // Add all arguments.\n for (var i = 0; i < funcNode[\"params\"].length; i++) {\n var paramName = funcNode[\"params\"][i][\"name\"];\n var paramValue = state.arguments_.length > i ? state.arguments_[i] : undefined;\n this.setProperty(scope, paramName, paramValue);\n }\n // Build arguments variable.\n var argsList = this.createObjectProto(this.ARRAY_PROTO);\n for (var i = 0; i < state.arguments_.length; i++) {\n this.setProperty(argsList, i, state.arguments_[i]);\n }\n this.setProperty(scope, \"arguments\", argsList);\n // Add the function's name (var x = function foo(){};)\n var name = funcNode[\"id\"] && funcNode[\"id\"][\"name\"];\n if (name) {\n this.setProperty(scope, name, func);\n }\n this.setProperty(scope, \"this\", state.funcThis_, Interpreter.READONLY_DESCRIPTOR);\n state.value = undefined; // Default value if no explicit return.\n return new Interpreter.State(funcNode[\"body\"], scope);\n } else if (func.eval) {\n var code = state.arguments_[0];\n if (typeof code !== \"string\") {\n // JS does not parse String objects:\n // eval(new String('1 + 1')) -> '1 + 1'\n state.value = code;\n } else {\n try {\n var ast = acorn.parse(code.toString(), Interpreter.PARSE_OPTIONS);\n } catch (e) {\n // Acorn threw a SyntaxError. Rethrow as a trappable error.\n let lineNum = this.getErrorLineNumber(node);\n this.throwException(this.SYNTAX_ERROR, \"Invalid code: \" + e.message, lineNum);\n }\n var evalNode = new this.nodeConstructor();\n evalNode[\"type\"] = \"EvalProgram_\";\n evalNode[\"body\"] = ast[\"body\"];\n this.stripLocations_(evalNode, node[\"start\"], node[\"end\"]);\n // Create new scope and update it with definitions in eval().\n var scope = state.directEval_ ? state.scope : this.global;\n if (scope.strict) {\n // Strict mode get its own scope in eval.\n scope = this.createScope(ast, scope);\n } else {\n // Non-strict mode pollutes the current scope.\n this.populateScope_(ast, scope);\n }\n this.value = undefined; // Default value if no code.\n return new Interpreter.State(evalNode, scope);\n }\n } else if (func.nativeFunc) {\n state.value = func.nativeFunc.apply(state.funcThis_, state.arguments_);\n } else if (func.asyncFunc) {\n var thisInterpreter = this;\n var callback = function (value) {\n state.value = value;\n thisInterpreter.paused_ = false;\n };\n var argsWithCallback = state.arguments_.concat(callback);\n this.paused_ = true;\n func.asyncFunc.apply(state.funcThis_, argsWithCallback);\n return;\n } else {\n /* A child of a function is a function but is not callable. For example:\n var F = function() {};\n F.prototype = escape;\n var f = new F();\n f();\n */\n let lineNum = this.getErrorLineNumber(node);\n this.throwException(this.TYPE_ERROR, func.class + \" is not a function\", lineNum);\n }\n } else {\n // Execution complete. Put the return value on the stack.\n stack.pop();\n if (state.isConstructor && typeof state.value !== \"object\") {\n stack[stack.length - 1].value = state.funcThis_;\n } else {\n stack[stack.length - 1].value = state.value;\n }\n }\n};\n\nInterpreter.prototype[\"stepCatchClause\"] = function (stack, state, node) {\n if (!state.done_) {\n state.done_ = true;\n // Create an empty scope.\n var scope = this.createSpecialScope(state.scope);\n // Add the argument.\n this.setProperty(scope, node[\"param\"][\"name\"], state.throwValue);\n // Execute catch clause.\n return new Interpreter.State(node[\"body\"], scope);\n } else {\n stack.pop();\n }\n};\n\nInterpreter.prototype[\"stepConditionalExpression\"] = function (stack, state, node) {\n var mode = state.mode_ || 0;\n if (mode === 0) {\n state.mode_ = 1;\n return new Interpreter.State(node[\"test\"], state.scope);\n }\n if (mode === 1) {\n state.mode_ = 2;\n var value = Boolean(state.value);\n if (value && node[\"consequent\"]) {\n // Execute 'if' block.\n return new Interpreter.State(node[\"consequent\"], state.scope);\n } else if (!value && node[\"alternate\"]) {\n // Execute 'else' block.\n return new Interpreter.State(node[\"alternate\"], state.scope);\n }\n // eval('1;if(false){2}') -> undefined\n this.value = undefined;\n }\n stack.pop();\n if (node[\"type\"] === \"ConditionalExpression\") {\n stack[stack.length - 1].value = state.value;\n }\n};\n\nInterpreter.prototype[\"stepContinueStatement\"] = function (stack, state, node) {\n var label = node[\"label\"] && node[\"label\"][\"name\"];\n this.unwind(Interpreter.Completion.CONTINUE, undefined, label);\n};\n\nInterpreter.prototype[\"stepDebuggerStatement\"] = function (stack, state, node) {\n // Do nothing. May be overridden by developers.\n stack.pop();\n};\n\nInterpreter.prototype[\"stepDoWhileStatement\"] = function (stack, state, node) {\n if (node[\"type\"] === \"DoWhileStatement\" && state.test_ === undefined) {\n // First iteration of do/while executes without checking test.\n state.value = true;\n state.test_ = true;\n }\n if (!state.test_) {\n state.test_ = true;\n return new Interpreter.State(node[\"test\"], state.scope);\n }\n if (!state.value) {\n // Done, exit loop.\n stack.pop();\n } else if (node[\"body\"]) {\n // Execute the body.\n state.test_ = false;\n state.isLoop = true;\n return new Interpreter.State(node[\"body\"], state.scope);\n }\n};\n\nInterpreter.prototype[\"stepEmptyStatement\"] = function (stack, state, node) {\n stack.pop();\n};\n\nInterpreter.prototype[\"stepEvalProgram_\"] = function (stack, state, node) {\n var n = state.n_ || 0;\n var expression = node[\"body\"][n];\n if (expression) {\n state.n_ = n + 1;\n return new Interpreter.State(expression, state.scope);\n }\n stack.pop();\n stack[stack.length - 1].value = this.value;\n};\n\nInterpreter.prototype[\"stepExpressionStatement\"] = function (stack, state, node) {\n if (!state.done_) {\n state.done_ = true;\n return new Interpreter.State(node[\"expression\"], state.scope);\n }\n stack.pop();\n // Save this value to interpreter.value for use as a return value if\n // this code is inside an eval function.\n this.value = state.value;\n};\n\nInterpreter.prototype[\"stepForInStatement\"] = function (stack, state, node) {\n // First, initialize a variable if exists. Only do so once, ever.\n if (!state.doneInit_) {\n state.doneInit_ = true;\n if (node[\"left\"][\"declarations\"] && node[\"left\"][\"declarations\"][0][\"init\"]) {\n if (state.scope.strict) {\n let lineNum = this.getErrorLineNumber(node);\n this.throwException(\n this.SYNTAX_ERROR,\n \"for-in loop variable declaration may not have an initializer.\",\n lineNum,\n );\n }\n // Variable initialization: for (var x = 4 in y)\n return new Interpreter.State(node[\"left\"], state.scope);\n }\n }\n // Second, look up the object. Only do so once, ever.\n if (!state.doneObject_) {\n state.doneObject_ = true;\n if (!state.variable_) {\n state.variable_ = state.value;\n }\n return new Interpreter.State(node[\"right\"], state.scope);\n }\n if (!state.isLoop) {\n // First iteration.\n state.isLoop = true;\n state.object_ = state.value;\n state.visited_ = Object.create(null);\n }\n // Third, find the property name for this iteration.\n if (state.name_ === undefined) {\n gotPropName: while (true) {\n if (state.object_ && state.object_.isObject) {\n if (!state.props_) {\n state.props_ = Object.getOwnPropertyNames(state.object_.properties);\n }\n while (true) {\n var prop = state.props_.shift();\n if (prop === undefined) {\n break; // Reached end of this object's properties.\n }\n if (!Object.prototype.hasOwnProperty.call(state.object_.properties, prop)) {\n continue; // Property has been deleted in the loop.\n }\n if (state.visited_[prop]) {\n continue; // Already seen this property on a child.\n }\n state.visited_[prop] = true;\n if (!Object.prototype.propertyIsEnumerable.call(state.object_.properties, prop)) {\n continue; // Skip non-enumerable property.\n }\n state.name_ = prop;\n break gotPropName;\n }\n } else if (state.object_ !== null && state.object_ !== undefined) {\n // Primitive value (other than null or undefined).\n if (!state.props_) {\n state.props_ = Object.getOwnPropertyNames(state.object_);\n }\n while (true) {\n var prop = state.props_.shift();\n if (prop === undefined) {\n break; // Reached end of this value's properties.\n }\n state.visited_[prop] = true;\n if (!Object.prototype.propertyIsEnumerable.call(state.object_, prop)) {\n continue; // Skip non-enumerable property.\n }\n state.name_ = prop;\n break gotPropName;\n }\n }\n state.object_ = this.getPrototype(state.object_);\n state.props_ = null;\n if (state.object_ === null) {\n // Done, exit loop.\n stack.pop();\n return;\n }\n }\n }\n // Fourth, find the variable\n if (!state.doneVariable_) {\n state.doneVariable_ = true;\n var left = node[\"left\"];\n if (left[\"type\"] === \"VariableDeclaration\") {\n // Inline variable declaration: for (var x in y)\n state.variable_ = [Interpreter.SCOPE_REFERENCE, left[\"declarations\"][0][\"id\"][\"name\"]];\n } else {\n // Arbitrary left side: for (foo().bar in y)\n state.variable_ = null;\n var nextState = new Interpreter.State(left, state.scope);\n nextState.components = true;\n return nextState;\n }\n }\n if (!state.variable_) {\n state.variable_ = state.value;\n }\n // Fifth, set the variable.\n if (!state.doneSetter_) {\n state.doneSetter_ = true;\n var value = state.name_;\n var setter = this.setValue(state.variable_, value);\n if (setter) {\n return this.createSetter_(setter, state.variable_, value);\n }\n }\n // Next step will be step three.\n state.name_ = undefined;\n // Reevaluate the variable since it could be a setter on the global object.\n state.doneVariable_ = false;\n state.doneSetter_ = false;\n // Sixth and finally, execute the body if there was one. this.\n if (node[\"body\"]) {\n return new Interpreter.State(node[\"body\"], state.scope);\n }\n};\n\nInterpreter.prototype[\"stepForStatement\"] = function (stack, state, node) {\n var mode = state.mode_ || 0;\n if (mode === 0) {\n state.mode_ = 1;\n if (node[\"init\"]) {\n return new Interpreter.State(node[\"init\"], state.scope);\n }\n } else if (mode === 1) {\n state.mode_ = 2;\n if (node[\"test\"]) {\n return new Interpreter.State(node[\"test\"], state.scope);\n }\n } else if (mode === 2) {\n state.mode_ = 3;\n if (node[\"test\"] && !state.value) {\n // Done, exit loop.\n stack.pop();\n } else {\n // Execute the body.\n state.isLoop = true;\n return new Interpreter.State(node[\"body\"], state.scope);\n }\n } else if (mode === 3) {\n state.mode_ = 1;\n if (node[\"update\"]) {\n return new Interpreter.State(node[\"update\"], state.scope);\n }\n }\n};\n\nInterpreter.prototype[\"stepFunctionDeclaration\"] = function (stack, state, node) {\n // This was found and handled when the scope was populated.\n stack.pop();\n};\n\nInterpreter.prototype[\"stepFunctionExpression\"] = function (stack, state, node) {\n stack.pop();\n stack[stack.length - 1].value = this.createFunction(node, state.scope);\n};\n\nInterpreter.prototype[\"stepIdentifier\"] = function (stack, state, node) {\n stack.pop();\n if (state.components) {\n stack[stack.length - 1].value = [Interpreter.SCOPE_REFERENCE, node[\"name\"]];\n return;\n }\n var value = this.getValueFromScope(node[\"name\"], node);\n // An identifier could be a getter if it's a property on the global object.\n if (value && typeof value === \"object\" && value.isGetter) {\n // Clear the getter flag and call the getter function.\n value.isGetter = false;\n var scope = state.scope;\n while (!this.hasProperty(scope, node[\"name\"])) {\n scope = scope.parentScope;\n }\n var func = /** @type {!Interpreter.Object} */ (value);\n return this.createGetter_(func, this.global);\n }\n stack[stack.length - 1].value = value;\n};\n\nInterpreter.prototype[\"stepIfStatement\"] = Interpreter.prototype[\"stepConditionalExpression\"];\n\nInterpreter.prototype[\"stepLabeledStatement\"] = function (stack, state, node) {\n // No need to hit this node again on the way back up the stack.\n stack.pop();\n // Note that a statement might have multiple labels.\n var labels = state.labels || [];\n labels.push(node[\"label\"][\"name\"]);\n var nextState = new Interpreter.State(node[\"body\"], state.scope);\n nextState.labels = labels;\n return nextState;\n};\n\nInterpreter.prototype[\"stepLiteral\"] = function (stack, state, node) {\n stack.pop();\n var value = node[\"value\"];\n if (value instanceof RegExp) {\n var pseudoRegexp = this.createObjectProto(this.REGEXP_PROTO);\n this.populateRegExp(pseudoRegexp, value);\n value = pseudoRegexp;\n }\n stack[stack.length - 1].value = value;\n};\n\nInterpreter.prototype[\"stepLogicalExpression\"] = function (stack, state, node) {\n if (node[\"operator\"] !== \"&&\" && node[\"operator\"] !== \"||\") {\n throw SyntaxError(\"Unknown logical operator: \" + node[\"operator\"]);\n }\n if (!state.doneLeft_) {\n state.doneLeft_ = true;\n return new Interpreter.State(node[\"left\"], state.scope);\n }\n if (!state.doneRight_) {\n if ((node[\"operator\"] === \"&&\" && !state.value) || (node[\"operator\"] === \"||\" && state.value)) {\n // Shortcut evaluation.\n stack.pop();\n stack[stack.length - 1].value = state.value;\n } else {\n state.doneRight_ = true;\n return new Interpreter.State(node[\"right\"], state.scope);\n }\n } else {\n stack.pop();\n stack[stack.length - 1].value = state.value;\n }\n};\n\nInterpreter.prototype[\"stepMemberExpression\"] = function (stack, state, node) {\n if (!state.doneObject_) {\n state.doneObject_ = true;\n return new Interpreter.State(node[\"object\"], state.scope);\n }\n var propName;\n if (!node[\"computed\"]) {\n state.object_ = state.value;\n // obj.foo -- Just access 'foo' directly.\n propName = node[\"property\"][\"name\"];\n } else if (!state.doneProperty_) {\n state.object_ = state.value;\n // obj[foo] -- Compute value of 'foo'.\n state.doneProperty_ = true;\n return new Interpreter.State(node[\"property\"], state.scope);\n } else {\n propName = state.value;\n }\n stack.pop();\n if (state.components) {\n stack[stack.length - 1].value = [state.object_, propName];\n } else {\n var value = this.getProperty(state.object_, propName);\n if (value && typeof value === \"object\" && value.isGetter) {\n // Clear the getter flag and call the getter function.\n value.isGetter = false;\n var func = /** @type {!Interpreter.Object} */ (value);\n return this.createGetter_(func, state.object_);\n }\n stack[stack.length - 1].value = value;\n }\n};\n\nInterpreter.prototype[\"stepNewExpression\"] = Interpreter.prototype[\"stepCallExpression\"];\n\nInterpreter.prototype[\"stepObjectExpression\"] = function (stack, state, node) {\n var n = state.n_ || 0;\n var property = node[\"properties\"][n];\n if (!state.object_) {\n // First execution.\n state.object_ = this.createObjectProto(this.OBJECT_PROTO);\n state.properties_ = Object.create(null);\n } else {\n // Determine property name.\n var key = property[\"key\"];\n if (key[\"type\"] === \"Identifier\") {\n var propName = key[\"name\"];\n } else if (key[\"type\"] === \"Literal\") {\n var propName = key[\"value\"];\n } else {\n throw SyntaxError(\"Unknown object structure: \" + key[\"type\"]);\n }\n // Set the property computed in the previous execution.\n if (!state.properties_[propName]) {\n // Create temp object to collect value, getter, and/or setter.\n state.properties_[propName] = {};\n }\n state.properties_[propName][property[\"kind\"]] = state.value;\n state.n_ = ++n;\n property = node[\"properties\"][n];\n }\n if (property) {\n return new Interpreter.State(property[\"value\"], state.scope);\n }\n for (var key in state.properties_) {\n var kinds = state.properties_[key];\n if (\"get\" in kinds || \"set\" in kinds) {\n // Set a property with a getter or setter.\n var descriptor = {\n configurable: true,\n enumerable: true,\n get: kinds[\"get\"],\n set: kinds[\"set\"],\n };\n this.setProperty(state.object_, key, null, descriptor);\n } else {\n // Set a normal property with a value.\n this.setProperty(state.object_, key, kinds[\"init\"]);\n }\n }\n stack.pop();\n stack[stack.length - 1].value = state.object_;\n};\n\nInterpreter.prototype[\"stepProgram\"] = function (stack, state, node) {\n var expression = node[\"body\"].shift();\n if (expression) {\n state.done = false;\n return new Interpreter.State(expression, state.scope);\n }\n state.done = true;\n // Don't pop the stateStack.\n // Leave the root scope on the tree in case the program is appended to.\n};\n\nInterpreter.prototype[\"stepReturnStatement\"] = function (stack, state, node) {\n if (node[\"argument\"] && !state.done_) {\n state.done_ = true;\n return new Interpreter.State(node[\"argument\"], state.scope);\n }\n this.unwind(Interpreter.Completion.RETURN, state.value, undefined);\n};\n\nInterpreter.prototype[\"stepSequenceExpression\"] = function (stack, state, node) {\n var n = state.n_ || 0;\n var expression = node[\"expressions\"][n];\n if (expression) {\n state.n_ = n + 1;\n return new Interpreter.State(expression, state.scope);\n }\n stack.pop();\n stack[stack.length - 1].value = state.value;\n};\n\nInterpreter.prototype[\"stepSwitchStatement\"] = function (stack, state, node) {\n if (!state.test_) {\n state.test_ = 1;\n return new Interpreter.State(node[\"discriminant\"], state.scope);\n }\n if (state.test_ === 1) {\n state.test_ = 2;\n // Preserve switch value between case tests.\n state.switchValue_ = state.value;\n state.defaultCase_ = -1;\n }\n\n while (true) {\n var index = state.index_ || 0;\n var switchCase = node[\"cases\"][index];\n if (!state.matched_ && switchCase && !switchCase[\"test\"]) {\n // Test on the default case is null.\n // Bypass (but store) the default case, and get back to it later.\n state.defaultCase_ = index;\n state.index_ = index + 1;\n continue;\n }\n if (!switchCase && !state.matched_ && state.defaultCase_ !== -1) {\n // Ran through all cases, no match. Jump to the default.\n state.matched_ = true;\n state.index_ = state.defaultCase_;\n continue;\n }\n if (switchCase) {\n if (!state.matched_ && !state.tested_ && switchCase[\"test\"]) {\n state.tested_ = true;\n return new Interpreter.State(switchCase[\"test\"], state.scope);\n }\n if (state.matched_ || state.value === state.switchValue_) {\n state.matched_ = true;\n var n = state.n_ || 0;\n if (switchCase[\"consequent\"][n]) {\n state.isSwitch = true;\n state.n_ = n + 1;\n return new Interpreter.State(switchCase[\"consequent\"][n], state.scope);\n }\n }\n // Move on to next case.\n state.tested_ = false;\n state.n_ = 0;\n state.index_ = index + 1;\n } else {\n stack.pop();\n return;\n }\n }\n};\n\nInterpreter.prototype[\"stepThisExpression\"] = function (stack, state, node) {\n stack.pop();\n stack[stack.length - 1].value = this.getValueFromScope(\"this\", node);\n};\n\nInterpreter.prototype[\"stepThrowStatement\"] = function (stack, state, node) {\n if (!state.done_) {\n state.done_ = true;\n return new Interpreter.State(node[\"argument\"], state.scope);\n } else {\n this.throwException(state.value);\n }\n};\n\nInterpreter.prototype[\"stepTryStatement\"] = function (stack, state, node) {\n if (!state.doneBlock_) {\n state.doneBlock_ = true;\n return new Interpreter.State(node[\"block\"], state.scope);\n }\n if (state.cv && state.cv.type === Interpreter.Completion.THROW && !state.doneHandler_ && node[\"handler\"]) {\n state.doneHandler_ = true;\n var nextState = new Interpreter.State(node[\"handler\"], state.scope);\n nextState.throwValue = state.cv.value;\n state.cv = undefined; // This error has been handled, don't rethrow.\n return nextState;\n }\n if (!state.doneFinalizer_ && node[\"finalizer\"]) {\n state.doneFinalizer_ = true;\n return new Interpreter.State(node[\"finalizer\"], state.scope);\n }\n stack.pop();\n if (state.cv) {\n // There was no catch handler, or the catch/finally threw an error.\n // Throw the error up to a higher try.\n this.unwind(state.cv.type, state.cv.value, state.cv.label);\n }\n};\n\nInterpreter.prototype[\"stepUnaryExpression\"] = function (stack, state, node) {\n if (!state.done_) {\n state.done_ = true;\n var nextState = new Interpreter.State(node[\"argument\"], state.scope);\n nextState.components = node[\"operator\"] === \"delete\";\n return nextState;\n }\n stack.pop();\n var value = state.value;\n if (node[\"operator\"] === \"-\") {\n value = -value;\n } else if (node[\"operator\"] === \"+\") {\n value = +value;\n } else if (node[\"operator\"] === \"!\") {\n value = !value;\n } else if (node[\"operator\"] === \"~\") {\n value = ~value;\n } else if (node[\"operator\"] === \"delete\") {\n var result = true;\n // If value is not an array, then it is a primitive, or some other value.\n // If so, skip the delete and return true.\n if (Array.isArray(value)) {\n var obj = value[0];\n if (obj === Interpreter.SCOPE_REFERENCE) {\n // 'delete foo;' is the same as 'delete window.foo'.\n obj = state.scope;\n }\n var name = String(value[1]);\n try {\n delete obj.properties[name];\n } catch (e) {\n if (state.scope.strict) {\n this.throwException(this.TYPE_ERROR, \"Cannot delete property '\" + name + \"' of '\" + obj + \"'\");\n } else {\n result = false;\n }\n }\n }\n value = result;\n } else if (node[\"operator\"] === \"typeof\") {\n value = value && value.class === \"Function\" ? \"function\" : typeof value;\n } else if (node[\"operator\"] === \"void\") {\n value = undefined;\n } else {\n throw SyntaxError(\"Unknown unary operator: \" + node[\"operator\"]);\n }\n stack[stack.length - 1].value = value;\n};\n\nInterpreter.prototype[\"stepUpdateExpression\"] = function (stack, state, node) {\n if (!state.doneLeft_) {\n state.doneLeft_ = true;\n var nextState = new Interpreter.State(node[\"argument\"], state.scope);\n nextState.components = true;\n return nextState;\n }\n if (!state.leftSide_) {\n state.leftSide_ = state.value;\n }\n if (state.doneGetter_) {\n state.leftValue_ = state.value;\n }\n if (!state.doneGetter_) {\n var leftValue = this.getValue(state.leftSide_, node);\n state.leftValue_ = leftValue;\n if (leftValue && typeof leftValue === \"object\" && leftValue.isGetter) {\n // Clear the getter flag and call the getter function.\n leftValue.isGetter = false;\n state.doneGetter_ = true;\n var func = /** @type {!Interpreter.Object} */ (leftValue);\n return this.createGetter_(func, state.leftSide_);\n }\n }\n if (state.doneSetter_) {\n // Return if setter function.\n // Setter method on property has completed.\n // Ignore its return value, and use the original set value instead.\n stack.pop();\n stack[stack.length - 1].value = state.setterValue_;\n return;\n }\n var leftValue = Number(state.leftValue_);\n var changeValue;\n if (node[\"operator\"] === \"++\") {\n changeValue = leftValue + 1;\n } else if (node[\"operator\"] === \"--\") {\n changeValue = leftValue - 1;\n } else {\n throw SyntaxError(\"Unknown update expression: \" + node[\"operator\"]);\n }\n var returnValue = node[\"prefix\"] ? changeValue : leftValue;\n var setter = this.setValue(state.leftSide_, changeValue);\n if (setter) {\n state.doneSetter_ = true;\n state.setterValue_ = returnValue;\n return this.createSetter_(setter, state.leftSide_, changeValue);\n }\n // Return if no setter function.\n stack.pop();\n stack[stack.length - 1].value = returnValue;\n};\n\nInterpreter.prototype[\"stepVariableDeclaration\"] = function (stack, state, node) {\n var declarations = node[\"declarations\"];\n var n = state.n_ || 0;\n var declarationNode = declarations[n];\n if (state.init_ && declarationNode) {\n // This setValue call never needs to deal with calling a setter function.\n // Note that this is setting the init value, not defining the variable.\n // Variable definition is done when scope is populated.\n this.setValueToScope(declarationNode[\"id\"][\"name\"], state.value);\n state.init_ = false;\n declarationNode = declarations[++n];\n }\n while (declarationNode) {\n // Skip any declarations that are not initialized. They have already\n // been defined as undefined in populateScope_.\n if (declarationNode[\"init\"]) {\n state.n_ = n;\n state.init_ = true;\n return new Interpreter.State(declarationNode[\"init\"], state.scope);\n }\n declarationNode = declarations[++n];\n }\n stack.pop();\n};\n\nInterpreter.prototype[\"stepWithStatement\"] = function (stack, state, node) {\n if (!state.doneObject_) {\n state.doneObject_ = true;\n return new Interpreter.State(node[\"object\"], state.scope);\n } else if (!state.doneBody_) {\n state.doneBody_ = true;\n var scope = this.createSpecialScope(state.scope, state.value);\n return new Interpreter.State(node[\"body\"], scope);\n } else {\n stack.pop();\n }\n};\n\nInterpreter.prototype[\"stepWhileStatement\"] = Interpreter.prototype[\"stepDoWhileStatement\"];\n\n// Preserve top-level API functions from being pruned/renamed by JS compilers.\n// Add others as needed.\n// The global object ('window' in a browser, 'global' in node.js) is 'this'.\n//this['Interpreter'] = Interpreter;\nInterpreter.prototype[\"step\"] = Interpreter.prototype.step;\nInterpreter.prototype[\"run\"] = Interpreter.prototype.run;\nInterpreter.prototype[\"appendCode\"] = Interpreter.prototype.appendCode;\nInterpreter.prototype[\"createObject\"] = Interpreter.prototype.createObject;\nInterpreter.prototype[\"createObjectProto\"] = Interpreter.prototype.createObjectProto;\nInterpreter.prototype[\"createAsyncFunction\"] = Interpreter.prototype.createAsyncFunction;\nInterpreter.prototype[\"createNativeFunction\"] = Interpreter.prototype.createNativeFunction;\nInterpreter.prototype[\"getProperty\"] = Interpreter.prototype.getProperty;\nInterpreter.prototype[\"setProperty\"] = Interpreter.prototype.setProperty;\nInterpreter.prototype[\"nativeToPseudo\"] = Interpreter.prototype.nativeToPseudo;\nInterpreter.prototype[\"pseudoToNative\"] = Interpreter.prototype.pseudoToNative;\n// Obsolete. Do not use.\nInterpreter.prototype[\"createPrimitive\"] = function (x) {\n return x;\n};\n\nexport { Interpreter };\n","import { AllServers } from \"../Server/AllServers\";\nimport { RunningScript } from \"./RunningScript\";\n\nexport function getRamUsageFromRunningScript(script: RunningScript): number {\n if (script.ramUsage != null && script.ramUsage > 0) {\n return script.ramUsage; // Use cached value\n }\n\n const server = AllServers[script.server];\n if (server == null) {\n return 0;\n }\n for (let i = 0; i < server.scripts.length; ++i) {\n if (server.scripts[i].filename === script.filename) {\n // Cache the ram usage for the next call\n script.ramUsage = server.scripts[i].ramUsage;\n return script.ramUsage;\n }\n }\n\n return 0;\n}\n","import * as React from \"react\";\nimport { useTheme } from \"@mui/material/styles\";\nimport Box from \"@mui/material/Box\";\nimport IconButton from \"@mui/material/IconButton\";\nimport FirstPageIcon from \"@mui/icons-material/FirstPage\";\nimport KeyboardArrowLeft from \"@mui/icons-material/KeyboardArrowLeft\";\nimport KeyboardArrowRight from \"@mui/icons-material/KeyboardArrowRight\";\nimport LastPageIcon from \"@mui/icons-material/LastPage\";\n\ninterface TablePaginationActionsProps {\n count: number;\n page: number;\n rowsPerPage: number;\n onPageChange: (event: React.MouseEvent, newPage: number) => void;\n}\n\nexport function TablePaginationActionsAll(props: TablePaginationActionsProps): React.ReactElement {\n const theme = useTheme();\n const { count, page, rowsPerPage, onPageChange } = props;\n\n const handleFirstPageButtonClick = (event: React.MouseEvent): void => {\n onPageChange(event, 0);\n };\n\n const handleBackButtonClick = (event: React.MouseEvent): void => {\n onPageChange(event, page - 1);\n };\n\n const handleNextButtonClick = (event: React.MouseEvent): void => {\n onPageChange(event, page + 1);\n };\n\n const handleLastPageButtonClick = (event: React.MouseEvent): void => {\n onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));\n };\n\n return (\n \n \n {theme.direction === \"rtl\" ? : }\n \n \n {theme.direction === \"rtl\" ? : }\n \n = Math.ceil(count / rowsPerPage) - 1}\n aria-label=\"next page\"\n >\n {theme.direction === \"rtl\" ? : }\n \n = Math.ceil(count / rowsPerPage) - 1}\n aria-label=\"last page\"\n >\n {theme.direction === \"rtl\" ? : }\n \n \n );\n}\n","// The initial formulas was sum 0 to f of 500*1.02^f.\n// These formulas were derived on wolfram alpha.\n\n// Wolfram Alpha: sum from 0 to n of 500*1.02^n\n// 500 * ((pow(51, f+1)) / pow(50,f) - 50)\n// Then we use https://herbie.uwplse.org/demo/ to simplify it and prevent\n// Infinity issues.\nexport function favorToRep(f: number): number {\n function fma(a: number, b: number, c: number): number {\n return a * b + c;\n }\n const ex = fma(f, Math.log(51.0) - Math.log(50.0), Math.log(51.0));\n return fma(500.0, Math.exp(ex), -25000.0);\n}\n\n// Wolfram Alpha: 500 (50^(-n) 51^(n + 1) - 50) solve for n\nexport function repToFavor(r: number): number {\n return -Math.log(25500 / (r + 25000)) / Math.log(51 / 50);\n}\n","import { IBladeburner } from \"./IBladeburner\";\nimport { Action, IActionParams } from \"./Action\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\nexport class Contract extends Action {\n constructor(params: IActionParams | null = null) {\n super(params);\n }\n\n getActionTypeSkillSuccessBonus(inst: IBladeburner): number {\n return inst.skillMultipliers.successChanceContract;\n }\n\n toJSON(): any {\n return Generic_toJSON(\"Contract\", this);\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Contract {\n return Generic_fromJSON(Contract, value.data);\n }\n}\n\nReviver.constructors.Contract = Contract;\n","export const ConsoleHelpText: {\n [key: string]: string[];\n helpList: string[];\n automate: string[];\n clear: string[];\n cls: string[];\n help: string[];\n log: string[];\n skill: string[];\n start: string[];\n stop: string[];\n} = {\n helpList: [\n \"Use 'help [command]' to get more information about a particular Bladeburner console command.\",\n \"\",\n \" automate [var] [val] [hi/low] Configure simple automation for Bladeburner tasks\",\n \" clear/cls Clear the console\",\n \" help [cmd] Display this help text, or help text for a specific command\",\n \" log [en/dis] [type] Enable or disable logging for events and actions\",\n \" skill [action] [name] Level or display info about your Bladeburner skills\",\n \" start [type] [name] Start a Bladeburner action/task\",\n \" stop Stops your current Bladeburner action/task\",\n ],\n automate: [\n \"automate [var] [val] [hi/low]\",\n \"\",\n \"A simple way to automate your Bladeburner actions. This console command can be used \" +\n \"to automatically start an action when your stamina rises above a certain threshold, and \" +\n \"automatically switch to another action when your stamina drops below another threshold.\",\n \" automate status - Check the current status of your automation and get a brief description of what it'll do\",\n \" automate en - Enable the automation feature\",\n \" automate dis - Disable the automation feature\",\n \"\",\n \"There are four properties that must be set for this automation to work properly. Here is how to set them:\",\n \"\",\n \" automate stamina 100 high\",\n \" automate contract Tracking high\",\n \" automate stamina 50 low\",\n \" automate general 'Field Analysis' low\",\n \"\",\n \"Using the four console commands above will set the automation to perform Tracking contracts \" +\n \"if your stamina is 100 or higher, and then switch to Field Analysis if your stamina drops below \" +\n \"50. Note that when setting the action, the name of the action is CASE-SENSITIVE. It must \" +\n \"exactly match whatever the name is in the UI.\",\n ],\n clear: [\"clear\", \"\", \"Clears the console\"],\n cls: [\"cls\", \"\", \"Clears the console\"],\n help: [\n \"help [command]\",\n \"\",\n \"Running 'help' with no arguments displays the general help text, which lists all console commands \" +\n \"and a brief description of what they do. A command can be specified to get more specific help text \" +\n \"about that particular command. For example:\",\n \"\",\n \" help automate\",\n \"\",\n \"will display specific information about using the automate console command\",\n ],\n log: [\n \"log [en/dis] [type]\",\n \"\",\n \"Enable or disable logging. By default, the results of completing actions such as contracts/operations are logged \" +\n \"in the console. There are also random events that are logged in the console as well. The five categories of \" +\n \"things that get logged are:\",\n \"\",\n \"[general, contracts, ops, blackops, events]\",\n \"\",\n \"The logging for these categories can be enabled or disabled like so:\",\n \"\",\n \" log dis contracts - Disables logging that occurs when contracts are completed\",\n \" log en contracts - Enables logging that occurs when contracts are completed\",\n \" log dis events - Disables logging for Bladeburner random events\",\n \"\",\n \"Logging can be universally enabled/disabled using the 'all' keyword:\",\n \"\",\n \" log dis all\",\n \" log en all\",\n ],\n skill: [\n \"skill [action] [name]\",\n \"\",\n \"Level or display information about your skills.\",\n \"\",\n \"To display information about all of your skills and your multipliers, use:\",\n \"\",\n \" skill list\",\n \"\",\n \"To display information about a specific skill, specify the name of the skill afterwards. \" +\n \"Note that the name of the skill is case-sensitive. Enter it exactly as seen in the UI. If \" +\n \"the name of the skill has whitespace, enclose the name of the skill in double quotation marks:\",\n \"\",\n \" skill list Reaper
\" + \" skill list 'Digital Observer'\",\n \"\",\n \"This console command can also be used to level up skills:\",\n \"\",\n \" skill level [skill name]\",\n ],\n start: [\n \"start [type] [name]\",\n \"\",\n \"Start an action. An action is specified by its type and its name. The \" +\n \"name is case-sensitive. It must appear exactly as it does in the UI. If \" +\n \"the name of the action has whitespace, enclose it in double quotation marks. \" +\n \"Valid action types include:\",\n \"\",\n \"[general, contract, op, blackop]\",\n \"\",\n \"Examples:\",\n \"\",\n \" start contract Tracking\",\n \" start op 'Undercover Operation'\",\n ],\n stop: [\"stop\", \"\", \"Stop your current action and go idle.\"],\n};\n","// Defines a \"Research Tree\"\n// Each Industry has a unique Research Tree\n// Each Node in the Research Trees only holds the name(s) of Research,\n// not an actual Research object. The name can be used to obtain a reference\n// to the corresponding Research object using the ResearchMap\nimport { Research } from \"./Research\";\nimport { ResearchMap } from \"./ResearchMap\";\n\nimport { IMap } from \"../types\";\n\nimport { numeralWrapper } from \"../ui/numeralFormat\";\n\ninterface IConstructorParams {\n children?: Node[];\n cost: number;\n text: string;\n parent?: Node | null;\n}\n\nexport class Node {\n // All child Nodes in the tree\n // The Research held in this Node is a prerequisite for all Research in\n // child Nodes\n children: Node[] = [];\n\n // How much Scientific Research is needed for this\n // Necessary to show it on the UI\n cost = 0;\n\n // Whether or not this Research has been unlocked\n researched = false;\n\n // Parent node in the tree\n // The parent node defines the prerequisite Research (there can only be one)\n // Set as null for no prerequisites\n parent: Node | null = null;\n\n // Name of the Research held in this Node\n text = \"\";\n\n constructor(p: IConstructorParams = { cost: 0, text: \"\" }) {\n if (ResearchMap[p.text] == null) {\n throw new Error(`Invalid Research name used when constructing ResearchTree Node: ${p.text}`);\n }\n\n this.text = p.text;\n this.cost = p.cost;\n\n if (p.children && p.children.length > 0) {\n this.children = p.children;\n }\n\n if (p.parent != null) {\n this.parent = p.parent;\n }\n }\n\n addChild(n: Node): void {\n this.children.push(n);\n n.parent = this;\n }\n\n // Return an object that describes a TreantJS-compatible markup/config for this Node\n // See: http://fperucic.github.io/treant-js/\n createTreantMarkup(): any {\n const childrenArray = [];\n for (let i = 0; i < this.children.length; ++i) {\n childrenArray.push(this.children[i].createTreantMarkup());\n }\n\n // Determine what css class this Node should have in the diagram\n let htmlClass = \"tooltip\";\n if (this.researched) {\n htmlClass += \" researched\";\n } else if (this.parent && this.parent.researched === false) {\n htmlClass += \" locked\";\n } else {\n htmlClass += \" unlocked\";\n }\n\n const research: Research | null = ResearchMap[this.text];\n const sanitizedName: string = this.text.replace(/\\s/g, \"\");\n return {\n children: childrenArray,\n HTMLclass: htmlClass,\n innerHTML:\n `
` +\n `${this.text}
${numeralWrapper.format(this.cost, \"0,0\")} Scientific Research` +\n `` +\n `${research.desc}` +\n `` +\n `
`,\n text: { name: this.text },\n };\n }\n\n // Recursive function for finding a Node with the specified text\n findNode(text: string): Node | null {\n // Is this the Node?\n if (this.text === text) {\n return this;\n }\n\n // Recursively search chilren\n let res = null;\n for (let i = 0; i < this.children.length; ++i) {\n res = this.children[i].findNode(text);\n if (res != null) {\n return res;\n }\n }\n\n return null;\n }\n\n setParent(n: Node): void {\n this.parent = n;\n }\n}\n\n// A ResearchTree defines all available Research in an Industry\n// The root node in a Research Tree must always be the \"Hi-Tech R&D Laboratory\"\nexport class ResearchTree {\n // Object containing names of all acquired Research by name\n researched: IMap = {};\n\n // Root Node\n root: Node | null = null;\n\n // Return an object that contains a Tree markup for TreantJS (using the JSON approach)\n // See: http://fperucic.github.io/treant-js/\n createTreantMarkup(): any {\n if (this.root == null) {\n return {};\n }\n\n const treeMarkup = this.root.createTreantMarkup();\n\n return {\n chart: {\n container: \"\",\n },\n nodeStructure: treeMarkup,\n };\n }\n\n // Gets an array with the 'text' values of ALL Nodes in the Research Tree\n getAllNodes(): string[] {\n const res: string[] = [];\n const queue: Node[] = [];\n\n if (this.root == null) {\n return res;\n }\n\n queue.push(this.root);\n while (queue.length !== 0) {\n const node: Node | undefined = queue.shift();\n if (node == null) {\n continue;\n }\n\n res.push(node.text);\n for (let i = 0; i < node.children.length; ++i) {\n queue.push(node.children[i]);\n }\n }\n\n return res;\n }\n\n // Get total multipliers from this Research Tree\n getAdvertisingMultiplier(): number {\n return this.getMultiplierHelper(\"advertisingMult\");\n }\n\n getEmployeeChaMultiplier(): number {\n return this.getMultiplierHelper(\"employeeChaMult\");\n }\n\n getEmployeeCreMultiplier(): number {\n return this.getMultiplierHelper(\"employeeCreMult\");\n }\n\n getEmployeeEffMultiplier(): number {\n return this.getMultiplierHelper(\"employeeEffMult\");\n }\n\n getEmployeeIntMultiplier(): number {\n return this.getMultiplierHelper(\"employeeIntMult\");\n }\n\n getProductionMultiplier(): number {\n return this.getMultiplierHelper(\"productionMult\");\n }\n\n getProductProductionMultiplier(): number {\n return this.getMultiplierHelper(\"productProductionMult\");\n }\n\n getSalesMultiplier(): number {\n return this.getMultiplierHelper(\"salesMult\");\n }\n\n getScientificResearchMultiplier(): number {\n return this.getMultiplierHelper(\"sciResearchMult\");\n }\n\n getStorageMultiplier(): number {\n return this.getMultiplierHelper(\"storageMult\");\n }\n\n // Helper function for all the multiplier getter fns\n getMultiplierHelper(propName: string): number {\n let res = 1;\n if (this.root == null) {\n return res;\n }\n\n const queue: Node[] = [];\n queue.push(this.root);\n while (queue.length !== 0) {\n const node: Node | undefined = queue.shift();\n\n // If the Node has not been researched, there's no need to\n // process it or its children\n if (node == null || !node.researched) {\n continue;\n }\n\n const research: Research | null = ResearchMap[node.text];\n\n // Safety checks\n if (research == null) {\n console.warn(`Invalid Research name in node: ${node.text}`);\n continue;\n }\n\n const mult: any = (research as any)[propName];\n if (mult == null) {\n console.warn(`Invalid propName specified in ResearchTree.getMultiplierHelper: ${propName}`);\n continue;\n }\n\n res *= mult;\n for (let i = 0; i < node.children.length; ++i) {\n queue.push(node.children[i]);\n }\n }\n\n return res;\n }\n\n // Search for a Node with the given name ('text' property on the Node)\n // Returns 'null' if it cannot be found\n findNode(name: string): Node | null {\n if (this.root == null) {\n return null;\n }\n return this.root.findNode(name);\n }\n\n // Marks a Node as researched\n research(name: string): void {\n if (this.root == null) {\n return;\n }\n\n const queue: Node[] = [];\n queue.push(this.root);\n while (queue.length !== 0) {\n const node: Node | undefined = queue.shift();\n if (node == null) {\n continue;\n }\n\n if (node.text === name) {\n node.researched = true;\n this.researched[name] = true;\n return;\n }\n\n for (let i = 0; i < node.children.length; ++i) {\n queue.push(node.children[i]);\n }\n }\n\n console.warn(`ResearchTree.research() did not find the specified Research node for: ${name}`);\n }\n\n // Set the tree's Root Node\n setRoot(root: Node): void {\n this.root = root;\n }\n}\n","/**\n * How many stock market 'ticks' before a 'cycle' is triggered.\n * A 'tick' is whenver stock prices update\n */\nexport const TicksPerCycle = 75;\n","import React from \"react\";\n\ninterface IProps {\n current: boolean;\n text: string;\n onClick: () => void;\n}\n\nexport function HeaderTab(props: IProps): React.ReactElement {\n let className = \"cmpy-mgmt-header-tab\";\n if (props.current) {\n className += \" current\";\n }\n\n return (\n \n );\n}\n","/**\n * Wrapper around material-ui's Button component that styles it with\n * Bitburner's UI theme\n */\n\nimport React from \"react\";\nimport { Button, ButtonProps } from \"@mui/material\";\nimport makeStyles from '@mui/styles/makeStyles';\nconst useStyles = makeStyles({\n // Tries to emulate StdButton in buttons.scss\n root: {\n backgroundColor: \"#555\",\n border: \"1px solid #333\",\n color: \"white\",\n margin: \"5px\",\n padding: \"3px 5px\",\n \"&:hover\": {\n backgroundColor: \"#666\",\n },\n\n borderRadius: 0,\n },\n textPrimary: {\n color: \"rgb( 144, 202, 249)\",\n },\n textSecondary: {\n color: \"rgb(244, 143, 177)\",\n },\n disabled: {\n backgroundColor: \"#333\",\n color: \"#fff\",\n cursor: \"default\",\n },\n});\n\nexport const MuiButton: React.FC = (props: ButtonProps) => {\n return (\n \n );\n};\n","// Function that returns the next Company Position in the \"ladder\"\n// i.e. the next position to get promoted to\nimport { CompanyPosition } from \"./CompanyPosition\";\nimport { CompanyPositions } from \"./CompanyPositions\";\n\nexport function getNextCompanyPositionHelper(currPos: CompanyPosition | null): CompanyPosition | null {\n if (currPos == null) {\n return null;\n }\n\n const nextPosName: string | null = currPos.nextPosition;\n if (nextPosName == null) {\n return null;\n }\n\n return CompanyPositions[nextPosName];\n}\n","import { getElementById } from \"./getElementById\";\n\n/**\n * Given an element by its ID, removes all event listeners from that element by cloning and\n * replacing. Then returns the new cloned element.\n * @param elemId The HTML ID to retrieve the element by.\n */\nexport function clearEventListeners(elemId: string | HTMLElement): HTMLElement | null {\n try {\n let elem: HTMLElement;\n if (typeof elemId === \"string\") {\n elem = getElementById(elemId);\n } else {\n elem = elemId;\n }\n\n const newElem: HTMLElement = elem.cloneNode(true) as HTMLElement;\n if (elem.parentNode !== null) {\n elem.parentNode.replaceChild(newElem, elem);\n }\n\n return newElem;\n } catch (e) {\n // tslint:disable-next-line:no-console\n console.error(e);\n\n return null;\n }\n}\n","import { Settings } from \"./Settings/Settings\";\n\ninterface IPort {}\n\nexport function NetscriptPort(): IPort {\n const data: any[] = [];\n\n return {\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n write: (value: any): any => {\n data.push(value);\n if (data.length > Settings.MaxPortCapacity) {\n return data.shift();\n }\n return null;\n },\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n tryWrite: (value: any): boolean => {\n if (data.length >= Settings.MaxPortCapacity) {\n return false;\n }\n data.push(value);\n return true;\n },\n\n read: (): any => {\n if (data.length === 0) {\n return \"NULL PORT DATA\";\n }\n return data.shift();\n },\n\n peek: (): any => {\n if (data.length === 0) {\n return \"NULL PORT DATA\";\n } else {\n const foo = data.slice();\n return foo[0];\n }\n },\n\n full: (): boolean => {\n return data.length == Settings.MaxPortCapacity;\n },\n\n empty: (): boolean => {\n return data.length === 0;\n },\n\n clear: (): void => {\n data.length = 0;\n },\n };\n}\n","import React, { useState, useEffect } from \"react\";\nimport CircularProgress from \"@mui/material/CircularProgress\";\nimport Typography from \"@mui/material/Typography\";\nimport Grid from \"@mui/material/Grid\";\n\nimport { Terminal } from \"../Terminal\";\nimport { load } from \"../db\";\nimport { Player } from \"../Player\";\nimport { Engine } from \"../engine\";\nimport { GameRoot } from \"./GameRoot\";\n\nimport { CONSTANTS } from \"../Constants\";\n\nexport function LoadingScreen(): React.ReactElement {\n const [show, setShow] = useState(false);\n const [loaded, setLoaded] = useState(false);\n\n useEffect(() => {\n const id = setTimeout(() => {\n if (!loaded) setShow(true);\n }, 2000);\n return () => clearTimeout(id);\n });\n\n useEffect(() => {\n async function doLoad() {\n await load()\n .then((saveString) => {\n Engine.load(saveString);\n setLoaded(true);\n })\n .catch((reason) => {\n console.error(reason);\n Engine.load(\"\");\n setLoaded(true);\n });\n }\n doLoad();\n }, []);\n\n if (loaded) {\n return ;\n }\n\n return (\n \n \n \n \n \n Loading Bitburner v{CONSTANTS.Version}\n \n {show && (\n \n \n If the game fails to load, consider killing all scripts\n \n \n )}\n \n );\n}\n","/**\n * Checks that a variable is a valid number. A valid number\n * must be a \"number\" type and cannot be NaN\n */\nexport function isValidNumber(n: number): boolean {\n return typeof n === \"number\" && !isNaN(n);\n}\n","import { getRandomInt } from \"../../../utils/helpers/getRandomInt\";\n\nexport const Growths: {\n [key: string]: (() => number) | undefined;\n [\"Tracking\"]: () => number;\n [\"Bounty Hunter\"]: () => number;\n [\"Retirement\"]: () => number;\n [\"Investigation\"]: () => number;\n [\"Undercover Operation\"]: () => number;\n [\"Sting Operation\"]: () => number;\n [\"Raid\"]: () => number;\n [\"Stealth Retirement Operation\"]: () => number;\n [\"Assassination\"]: () => number;\n} = {\n Tracking: () => getRandomInt(5, 75) / 10,\n \"Bounty Hunter\": () => getRandomInt(5, 75) / 10,\n Retirement: () => getRandomInt(5, 75) / 10,\n Investigation: () => getRandomInt(10, 40) / 10,\n \"Undercover Operation\": () => getRandomInt(10, 40) / 10,\n \"Sting Operation\": () => getRandomInt(3, 40) / 10,\n Raid: () => getRandomInt(2, 40) / 10,\n \"Stealth Retirement Operation\": () => getRandomInt(1, 20) / 10,\n Assassination: () => getRandomInt(1, 20) / 10,\n};\n","/**\n * Represents a Limit or Buy Order on the stock market. Does not represent\n * a Market Order since those are just executed immediately\n */\nimport { OrderTypes } from \"./data/OrderTypes\";\nimport { PositionTypes } from \"./data/PositionTypes\";\n\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\nexport class Order {\n readonly pos: PositionTypes;\n readonly price: number;\n shares: number;\n readonly stockSymbol: string;\n readonly type: OrderTypes;\n\n constructor(\n stockSymbol = \"\",\n shares = 0,\n price = 0,\n typ: OrderTypes = OrderTypes.LimitBuy,\n pos: PositionTypes = PositionTypes.Long,\n ) {\n // Validate arguments\n let invalidArgs = false;\n if (typeof shares !== \"number\" || typeof price !== \"number\") {\n invalidArgs = true;\n }\n if (isNaN(shares) || isNaN(price)) {\n invalidArgs = true;\n }\n if (typeof stockSymbol !== \"string\") {\n invalidArgs = true;\n }\n if (invalidArgs) {\n throw new Error(`Invalid constructor paramters for Order`);\n }\n\n this.stockSymbol = stockSymbol;\n this.shares = shares;\n this.price = price;\n this.type = typ;\n this.pos = pos;\n }\n\n /**\n * Serialize the Order to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"Order\", this);\n }\n\n /**\n * Initializes a Order from a JSON save state\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Order {\n return Generic_fromJSON(Order, value.data);\n }\n}\n\nReviver.constructors.Order = Order;\n","/**\n * Class representing a visitable location in the world\n */\nimport { CityName } from \"./data/CityNames\";\nimport { LocationName } from \"./data/LocationNames\";\nimport { LocationType } from \"./LocationTypeEnum\";\n\ninterface IInfiltrationMetadata {\n maxClearanceLevel: number;\n startingSecurityLevel: number;\n}\n\nexport interface IConstructorParams {\n city?: CityName | null;\n costMult?: number;\n expMult?: number;\n infiltrationData?: IInfiltrationMetadata;\n name?: LocationName;\n types?: LocationType[];\n techVendorMaxRam?: number;\n techVendorMinRam?: number;\n}\n\nexport class Location {\n /**\n * Name of city this location is in. If this property is null, it means this i\n * is a generic location that is available in all cities\n */\n city: CityName | null = null;\n\n /**\n * Cost multiplier that influences how expensive a gym/university is\n */\n costMult = 0;\n\n /**\n * Exp multiplier that influences how effective a gym/university is\n */\n expMult = 0;\n\n /**\n * Companies can be infiltrated. This contains the data required for that\n * infiltration event\n */\n infiltrationData?: IInfiltrationMetadata;\n\n /**\n * Identifier for location\n */\n name: LocationName = LocationName.Void;\n\n /**\n * List of what type(s) this location is. A location can be multiple types\n * (e.g. company and tech vendor)\n */\n types: LocationType[] = [];\n\n /**\n * Tech vendors allow you to purchase servers.\n * This property defines the max RAM server you can purchase from this vendor\n */\n techVendorMaxRam = 0;\n\n /**\n * Tech vendors allow you to purchase servers.\n * This property defines the max RAM server you can purchase from this vendor\n */\n techVendorMinRam = 0;\n\n constructor(p: IConstructorParams) {\n if (p.city) {\n this.city = p.city;\n }\n if (p.costMult) {\n this.costMult = p.costMult;\n }\n if (p.expMult) {\n this.expMult = p.expMult;\n }\n if (p.infiltrationData) {\n this.infiltrationData = p.infiltrationData;\n }\n if (p.name) {\n this.name = p.name;\n }\n if (p.types) {\n this.types = p.types;\n }\n if (p.techVendorMaxRam) {\n this.techVendorMaxRam = p.techVendorMaxRam;\n }\n if (p.techVendorMinRam) {\n this.techVendorMinRam = p.techVendorMinRam;\n }\n }\n}\n","import React from \"react\";\n\ninterface IProps {\n onClick: () => void;\n name: string;\n current: boolean;\n}\n\nexport function CityTab(props: IProps): React.ReactElement {\n let className = \"cmpy-mgmt-city-tab\";\n if (props.current) {\n className += \" current\";\n }\n\n return (\n \n );\n}\n","export function getSelectValue(selector: HTMLSelectElement | null): string {\n if (selector == null) {\n return \"\";\n }\n if (selector.options.length <= 0) {\n return \"\";\n }\n if (selector.selectedIndex < 0) {\n return \"\";\n }\n return selector.options[selector.selectedIndex].value;\n}\n\nexport function getSelectText(selector: HTMLSelectElement | null): string {\n if (selector == null) {\n return \"\";\n }\n if (selector.options.length <= 0) {\n return \"\";\n }\n if (selector.selectedIndex < 0) {\n return \"\";\n }\n return selector.options[selector.selectedIndex].text;\n}\n","/**\n * Creates a dropdown (select HTML element) with server hostnames as options\n *\n * Configurable to only contain certain types of servers\n */\nimport React from \"react\";\nimport { AllServers } from \"../../Server/AllServers\";\nimport { Server } from \"../../Server/Server\";\n\nimport { HacknetServer } from \"../../Hacknet/HacknetServer\";\n\n// TODO make this an enum when this gets converted to TypeScript\nexport const ServerType = {\n All: 0,\n Foreign: 1, // Hackable, non-owned servers\n Owned: 2, // Home Computer, Purchased Servers, and Hacknet Servers\n Purchased: 3, // Everything from Owned except home computer\n};\n\ninterface IProps {\n serverType: number;\n onChange: (event: React.ChangeEvent) => void;\n style: any;\n}\n\nexport function ServerDropdown(props: IProps): React.ReactElement {\n /**\n * Checks if the server should be shown in the dropdown menu, based on the\n * 'serverType' property\n */\n function isValidServer(s: Server | HacknetServer): boolean {\n const purchased = s instanceof Server && s.purchasedByPlayer;\n const type = props.serverType;\n switch (type) {\n case ServerType.All:\n return true;\n case ServerType.Foreign:\n return s.hostname !== \"home\" && !purchased;\n case ServerType.Owned:\n return purchased || s instanceof HacknetServer || s.hostname === \"home\";\n case ServerType.Purchased:\n return purchased || s instanceof HacknetServer;\n default:\n console.warn(`Invalid ServerType specified for ServerDropdown component: ${type}`);\n return false;\n }\n }\n\n const servers = [];\n for (const serverName in AllServers) {\n const server = AllServers[serverName];\n if (isValidServer(server)) {\n servers.push(\n ,\n );\n }\n }\n\n return (\n \n );\n}\n","/**\n * React Component for displaying a location's UI\n *\n * This is a \"router\" component of sorts, meaning it deduces the type of\n * location that is being rendered and then creates the proper component(s) for that.\n */\nimport * as React from \"react\";\n\nimport { CompanyLocation } from \"./CompanyLocation\";\nimport { GymLocation } from \"./GymLocation\";\nimport { HospitalLocation } from \"./HospitalLocation\";\nimport { SlumsLocation } from \"./SlumsLocation\";\nimport { SpecialLocation } from \"./SpecialLocation\";\nimport { TechVendorLocation } from \"./TechVendorLocation\";\nimport { TravelAgencyRoot } from \"./TravelAgencyRoot\";\nimport { UniversityLocation } from \"./UniversityLocation\";\nimport { CasinoLocation } from \"./CasinoLocation\";\n\nimport { Location } from \"../Location\";\nimport { LocationType } from \"../LocationTypeEnum\";\n\nimport { Settings } from \"../../Settings/Settings\";\n\nimport { SpecialServerIps } from \"../../Server/SpecialServerIps\";\nimport { getServer, isBackdoorInstalled } from \"../../Server/ServerHelpers\";\n\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { CorruptableText } from \"../../ui/React/CorruptableText\";\nimport { use } from \"../../ui/Context\";\n\ntype IProps = {\n loc: Location;\n};\n\nexport function GenericLocation({ loc }: IProps): React.ReactElement {\n const router = use.Router();\n const player = use.Player();\n /**\n * Determine what needs to be rendered for this location based on the locations\n * type. Returns an array of React components that should be rendered\n */\n function getLocationSpecificContent(): React.ReactNode[] {\n const content: React.ReactNode[] = [];\n\n if (loc.types.includes(LocationType.Company)) {\n content.push();\n }\n\n if (loc.types.includes(LocationType.Gym)) {\n content.push();\n }\n\n if (loc.types.includes(LocationType.Hospital)) {\n content.push();\n }\n\n if (loc.types.includes(LocationType.Slums)) {\n content.push();\n }\n\n if (loc.types.includes(LocationType.Special)) {\n content.push();\n }\n\n if (loc.types.includes(LocationType.TechVendor)) {\n content.push();\n }\n\n if (loc.types.includes(LocationType.TravelAgency)) {\n content.push();\n }\n\n if (loc.types.includes(LocationType.University)) {\n content.push();\n }\n\n if (loc.types.includes(LocationType.Casino)) {\n content.push();\n }\n\n return content;\n }\n\n const locContent: React.ReactNode[] = getLocationSpecificContent();\n const ip = SpecialServerIps.getIp(loc.name);\n const server = getServer(ip);\n const backdoorInstalled = server !== null && isBackdoorInstalled(server);\n\n return (\n
\n router.toCity()} style={{ display: \"block\" }} text={\"Return to World\"} />\n

\n {backdoorInstalled && !Settings.DisableTextEffects ? : loc.name}\n

\n {locContent}\n
\n );\n}\n","import React, { FC } from \"react\";\nimport { Card, Suit } from \"./Card\";\n\ntype Props = {\n card: Card;\n hidden?: boolean;\n};\n\nexport const ReactCard: FC = ({ card, hidden }) => {\n let suit: React.ReactNode;\n switch (card.suit) {\n case Suit.Clubs:\n suit = ;\n break;\n case Suit.Diamonds:\n suit = ;\n break;\n case Suit.Hearts:\n suit = ;\n break;\n case Suit.Spades:\n suit = ;\n break;\n default:\n throw new Error(`MissingCaseException: ${card.suit}`);\n }\n return (\n
\n <>\n
{hidden ? \" - \" : card.formatValue()}
\n
{hidden ? \" - \" : suit}
\n \n
\n );\n};\n","/**\n * Wrapper around material-ui's Button component that styles it with\n * Bitburner's UI theme\n */\n\nimport React from \"react\";\nimport { Paper, PaperProps } from \"@mui/material\";\n\nimport makeStyles from '@mui/styles/makeStyles';\n\nconst useStyles = makeStyles({\n root: {\n backgroundColor: \"rgb(30, 30, 30)\",\n border: \"2px solid #000\",\n borderRadius: \"10px\",\n display: \"inline-block\",\n flexWrap: \"wrap\",\n padding: \"10px\",\n },\n});\n\nexport const MuiPaper: React.FC = (props: PaperProps) => {\n return (\n \n );\n};\n","export type Position = {\n row: number;\n column: number;\n};\n\nclass PositionTracker {\n positions: Map;\n\n constructor() {\n this.positions = new Map();\n }\n\n saveCursor(filename: string, pos: Position): void {\n this.positions.set(filename, pos);\n }\n\n getCursor(filename: string): Position {\n const position = this.positions.get(filename);\n if (!position) {\n return {\n row: -1,\n column: -1,\n };\n }\n return position;\n }\n}\n\nexport const CursorPositions: PositionTracker = new PositionTracker();\n","export const libSource = `interface NS {\n args: string[];\n /**\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n * Example documentation for scan.\n */\n scan(ip: string, hostnames: boolean): string[];\n hack(ip: string, threads: number, stock: boolean): Promise;\n hackAnalyzeThreads(ip: string, hackAmount: number): number;\n hackAnalyzePercent(ip: string): number;\n hackChance(ip: string): number;\n sleep(time: number): Promise;\n grow(ip: string, threads: number, stock: boolean): Promise;\n growthAnalyze(ip: string, growth: number): number;\n weaken(ip: string, threads: boolean): Promise;\n print(...args: any[]): void;\n tprint(...args: any[]): void;\n clearLog(): void;\n disableLog(fn: string): void;\n enableLog(fn: string): void;\n isLogEnabled(fn: string): boolean;\n getScriptLogs(fn: string, ip: string, ...scriptArgs: any[]): string[];\n tail(fn: string, ip: string, ...scriptArgs: any[]): void;\n nuke(ip: string): boolean;\n brutessh(ip: string): boolean;\n ftpcrack(ip: string): boolean;\n relaysmtp(ip: string): boolean;\n httpworm(ip: string): boolean;\n sqlinject(ip: string): boolean;\n run(scriptname: string, threads: number): number;\n exec(scriptname: string, ip: string, threads: number): number;\n spawn(scriptname: string, threads: number): void;\n kill(filename: string, ip: string, ...scriptArgs: any[]): boolean;\n killall(ip: string): boolean;\n exit(): void;\n scp(scriptname: string, ip1: string, ip2: string): boolean;\n ls(ip: string, grep: string): string[];\n ps(ip: string): {filename: string, threads: number, args: string[], pid: number}[];\n hasRootAccess(ip: string): boolean;\n getIp(): string;\n getHostname(): string;\n getHackingLevel(): number;\n getHackingMultipliers(): number;\n getHacknetMultipliers(): number;\n getBitNodeMultipliers(): number;\n getServer(ip: string): any;\n getServerMoneyAvailable(ip: string): number;\n getServerSecurityLevel(ip: string): number;\n getServerBaseSecurityLevel(ip: string): number;\n getServerMinSecurityLevel(ip: string): number;\n getServerRequiredHackingLevel(ip: string): number;\n getServerMaxMoney(ip: string): number;\n getServerGrowth(ip: string): number;\n getServerNumPortsRequired(ip: string): number;\n getServerRam(ip: string): number[];\n getServerMaxRam(ip: string): number;\n getServerUsedRam(ip: string): number;\n serverExists(ip: string): boolean;\n fileExists(filename: string, ip: string): boolean;\n isRunning(fn: string, ip: string, ...scriptArgs: any[]): boolean;\n getStockSymbols(): string[];\n getStockPrice(symbol: string): number;\n getStockAskPrice(symbol: string): number;\n getStockBidPrice(symbol: string): number;\n getStockPosition(symbol: string): number;\n getStockMaxShares(symbol: string): number;\n getStockPurchaseCost(symbol: string, shares: number, posType: string): number;\n getStockSaleGain(symbol: string, shares: number, posType: string): number;\n buyStock(symbol: string, shares: number): number;\n sellStock(symbol: string, shares: number): number;\n shortStock(symbol: string, shares: number): number;\n sellShort(symbol: string, shares: number): number;\n placeOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean;\n cancelOrder(symbol: string, shares: number, price: number, type: string, pos: string): boolean;\n getOrders(): any;\n getStockVolatility(symbol: string): number;\n getStockForecast(symbol: string): number;\n getPurchasedServerLimit(): number;\n getPurchasedServerMaxRam(): number;\n getPurchasedServerCost(ram: number): number;\n purchaseServer(hostname: string, ram: number): string;\n deleteServer(hostname: string): boolean;\n getPurchasedServers(hostname: string): string[];\n write(port: number, data: string, mode: string): boolean;\n tryWrite(port: number, data: string): boolean;\n read(port: number): any;\n peek(port: number): any;\n clear(port: number): number;\n getPortHandle(port: number): any; // netscript port\n rm(fn: string, ip: string): boolean;\n scriptRunning(scriptname: string, ip: string): boolean;\n scriptKill(scriptname: string, ip: string): boolean;\n getScriptName(): string;\n getScriptRam(scriptname: string, ip: string): number;\n getRunningScript(fn: string, ip: string): any; // running script\n getHackTime(ip: string): number;\n getGrowTime(ip: string): number;\n getWeakenTime(ip: string): number;\n getScriptIncome(scriptname: string, ip: string): number;\n getScriptExpGain(scriptname: string, ip: string): number;\n nFormat(n: number, format: string): string;\n tFormat(milliseconds: number, milliPrecision: boolean): string;\n getTimeSinceLastAug(): number;\n prompt(txt: string): Promise;\n getFavorToDonate(): number;\n universityCourse(universityName: string, className: string): boolean;\n gymWorkout(gymName: string, stat: string): boolean;\n travelToCity(cityname: string): boolean;\n purchaseTor(): boolean;\n purchaseProgram(programName: string): boolean;\n getCurrentServer(): any; // server object\n connect(hostname: string): boolean;\n manualHack(): Promise;\n installBackdoor(): Promise;\n getStats(): any; // complex type\n getCharacterInformation(): any; // complex type\n getPlayer(): any; // complex type\n hospitalize(): number;\n isBusy(): boolean;\n stopAction(): boolean;\n upgradeHomeRam(): number;\n getUpgradeHomeRamCost(): number;\n workForCompany(companyName: string): boolean;\n applyToCompany(companyName: string, field: string): boolean;\n getCompanyRep(companyName: string): number;\n getCompanyFavor(companyName: string): number;\n getCompanyFavorGain(companyName: string): number;\n checkFactionInvitations(): string[];\n joinFaction(name: string): boolean;\n workForFaction(name: string, type: string): boolean;\n getFactionRep(name: string): number;\n getFactionFavor(name: string): number;\n getFactionFavorGain(name: string): number;\n donateToFaction(name: string, amt: number): boolean;\n createProgram(name: string): boolean;\n commitCrime(crimeRoughName: string): number;\n getCrimeChance(crimeRoughName: string): boolean;\n getCrimeStats(crimeRoughName: string): any; // complex type\n getOwnedAugmentations(purchased: boolean): string[];\n getOwnedSourceFiles(): any; // complex type\n getAugmentationsFromFaction(facname: string): string[];\n getAugmentationCost(name: string): number;\n getAugmentationPrereq(name: string): string[];\n getAugmentationPrice(name: string): number;\n getAugmentationRepReq(name: string): number;\n getAugmentationStats(name: string): any; // complex type\n purchaseAugmentation(faction: string, name: string): boolean;\n softReset(cbScript: string): void;\n installAugmentations(cbScript: string): void;\n exploit(): void;\n bypass(doc: any): void;\n flags(data: any): any;\n}`;\n","import { Milestone } from \"./Milestone\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { Factions } from \"../Faction/Factions\";\nimport { Faction } from \"../Faction/Faction\";\nimport { GetServerByHostname } from \"../Server/ServerHelpers\";\n\nfunction allFactionAugs(p: IPlayer, f: Faction): boolean {\n const factionAugs = f.augmentations.slice().filter((aug) => aug !== \"NeuroFlux Governor\");\n for (const factionAug of factionAugs) {\n if (\n !p.augmentations.some((aug) => {\n return aug.name == factionAug;\n })\n )\n return false;\n }\n return true;\n}\n\nexport const Milestones: Milestone[] = [\n {\n title: \"Gain root access on CSEC\",\n fulfilled: (): boolean => {\n const server = GetServerByHostname(\"CSEC\");\n if (!server || !server.hasOwnProperty(\"hasAdminRights\")) return false;\n return (server as any).hasAdminRights;\n },\n },\n {\n title: \"Install the backdoor on CSEC\",\n fulfilled: (): boolean => {\n const server = GetServerByHostname(\"CSEC\");\n if (!server || !server.hasOwnProperty(\"backdoorInstalled\")) return false;\n return (server as any).backdoorInstalled;\n },\n },\n {\n title: \"Join the faction hinted at in csec-test.msg\",\n fulfilled: (p: IPlayer): boolean => {\n return p.factions.includes(\"CyberSec\");\n },\n },\n {\n title: \"Install all the Augmentations from CyberSec\",\n fulfilled: (p: IPlayer): boolean => {\n return allFactionAugs(p, Factions[\"CyberSec\"]);\n },\n },\n {\n title: \"Join the faction hinted at in nitesec-test.msg\",\n fulfilled: (p: IPlayer): boolean => {\n return p.factions.includes(\"NiteSec\");\n },\n },\n {\n title: \"Install all the Augmentations from NiteSec\",\n fulfilled: (p: IPlayer): boolean => {\n return allFactionAugs(p, Factions[\"NiteSec\"]);\n },\n },\n {\n title: \"Join the faction hinted at in j3.msg\",\n fulfilled: (p: IPlayer): boolean => {\n return p.factions.includes(\"The Black Hand\");\n },\n },\n {\n title: \"Install all the Augmentations from The Black Hand\",\n fulfilled: (p: IPlayer): boolean => {\n return allFactionAugs(p, Factions[\"The Black Hand\"]);\n },\n },\n {\n title: \"Join the faction hinted at in 19dfj3l1nd.msg\",\n fulfilled: (p: IPlayer): boolean => {\n return p.factions.includes(\"BitRunners\");\n },\n },\n {\n title: \"Install all the Augmentations from BitRunners\",\n fulfilled: (p: IPlayer): boolean => {\n return allFactionAugs(p, Factions[\"BitRunners\"]);\n },\n },\n {\n title: \"Complete fl1ght.exe\",\n fulfilled: (p: IPlayer): boolean => {\n // technically wrong but whatever\n return p.factions.includes(\"Daedalus\");\n },\n },\n {\n title: \"Install the special Augmentation from Daedalus\",\n fulfilled: (p: IPlayer): boolean => {\n return p.augmentations.some((aug) => aug.name == \"The Red Pill\");\n },\n },\n {\n title: \"Install the final backdoor and free yourself.\",\n fulfilled: (): boolean => {\n return false;\n },\n },\n];\n","import { CONSTANTS } from \"../../Constants\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nexport function repFromDonation(amt: number, player: IPlayer): number {\n return (amt / CONSTANTS.DonateMoneyToRepDivisor) * player.faction_rep_mult;\n}\n","import { StockSymbols } from \"./StockSymbols\";\n\nexport const TickerHeaderFormatData = {\n longestName: 0,\n longestSymbol: 0,\n};\n\nfor (const key in StockSymbols) {\n TickerHeaderFormatData.longestName = Math.max(key.length, TickerHeaderFormatData.longestName);\n TickerHeaderFormatData.longestSymbol = Math.max(StockSymbols[key].length, TickerHeaderFormatData.longestSymbol);\n}\n","import { substituteAliases } from \"../Alias\";\n// Helper function that checks if an argument (which is a string) is a valid number\nfunction isNumber(str: string): boolean {\n if (typeof str != \"string\") {\n return false;\n } // Only process strings\n return !isNaN(str as unknown as number) && !isNaN(parseFloat(str));\n}\nexport function ParseCommands(commands: string): string[] {\n // Sanitize input\n commands = commands.trim();\n // Replace all extra whitespace in command with a single space\n commands = commands.replace(/\\s\\s+/g, \" \");\n\n const match = commands.match(/(?:'[^']*'|\"[^\"]*\"|[^;\"])*/g);\n if (!match) return [];\n // Split commands and execute sequentially\n const allCommands = match\n .map(substituteAliases)\n .map((c) => c.match(/(?:'[^']*'|\"[^\"]*\"|[^;\"])*/g))\n .flat();\n\n const out: string[] = [];\n for (const c of allCommands) {\n if (c === null) continue;\n if (c.match(/^\\s*$/)) {\n continue;\n } // Don't run commands that only have whitespace\n out.push(c.trim());\n }\n return out;\n}\n\nexport function ParseCommand(command: string): (string | number)[] {\n // This will be used to keep track of whether we're in a quote. This is for situations\n // like the alias command:\n // alias run=\"run NUKE.exe\"\n // We want the run=\"run NUKE.exe\" to be parsed as a single command, so this flag\n // will keep track of whether we have a quote in\n let inQuote = ``;\n\n // Returns an array with the command and its arguments in each index\n // Properly handles quotation marks (e.g. `run foo.script \"the sun\"` will return [run, foo.script, the sun])\n const args = [];\n let start = 0,\n i = 0;\n let prevChar = \"\"; // Previous character\n while (i < command.length) {\n let escaped = false; // Check for escaped quotation marks\n if (i >= 1) {\n prevChar = command.charAt(i - 1);\n if (prevChar === \"\\\\\") {\n escaped = true;\n }\n }\n\n const c = command.charAt(i);\n if (c === '\"') {\n // Double quotes\n if (!escaped && prevChar === \" \") {\n const endQuote = command.indexOf('\"', i + 1);\n if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === \" \")) {\n args.push(command.substr(i + 1, endQuote - i - 1));\n if (endQuote === command.length - 1) {\n start = i = endQuote + 1;\n } else {\n start = i = endQuote + 2; // Skip the space\n }\n continue;\n }\n } else {\n if (inQuote === ``) {\n inQuote = `\"`;\n } else if (inQuote === `\"`) {\n inQuote = ``;\n }\n }\n } else if (c === \"'\") {\n // Single quotes, same thing as above\n if (!escaped && prevChar === \" \") {\n const endQuote = command.indexOf(\"'\", i + 1);\n if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === \" \")) {\n args.push(command.substr(i + 1, endQuote - i - 1));\n if (endQuote === command.length - 1) {\n start = i = endQuote + 1;\n } else {\n start = i = endQuote + 2; // Skip the space\n }\n continue;\n }\n } else {\n if (inQuote === ``) {\n inQuote = `'`;\n } else if (inQuote === `'`) {\n inQuote = ``;\n }\n }\n } else if (c === \" \" && inQuote === ``) {\n const arg = command.substr(start, i - start);\n\n // If this is a number, convert it from a string to number\n if (isNumber(arg)) {\n args.push(parseFloat(arg));\n } else {\n args.push(arg);\n }\n\n start = i + 1;\n }\n ++i;\n }\n\n // Add the last argument\n if (start !== i) {\n const arg = command.substr(start, i - start);\n\n // If this is a number, convert it from string to number\n if (isNumber(arg)) {\n args.push(parseFloat(arg));\n } else {\n args.push(arg);\n }\n }\n\n return args;\n}\n","/* tslint:disable:max-line-length completed-docs variable-name*/\nimport { IMap } from \"../types\";\n\nexport const TerminalHelpText: string[] = [\n \"Type 'help name' to learn more about the command \",\n \"\",\n 'alias [-g] [name=\"value\"] Create or display Terminal aliases',\n \"analyze Get information about the current machine \",\n \"backdoor Install a backdoor on the current machine \",\n \"buy [-l/program] Purchase a program through the Dark Web\",\n \"cat [file] Display a .msg, .lit, or .txt file\",\n \"cd [dir] Change to a new directory\",\n \"check [script] [args...] Print a script's logs to Terminal\",\n \"clear Clear all text on the terminal \",\n \"cls See 'clear' command \",\n \"connect [ip/hostname] Connects to a remote server\",\n \"download [script/text file] Downloads scripts or text files to your computer\",\n \"expr [math expression] Evaluate a mathematical expression\",\n \"free Check the machine's memory (RAM) usage\",\n \"hack Hack the current machine\",\n \"help [command] Display this help text, or the help text for a command\",\n \"home Connect to home computer\",\n \"hostname Displays the hostname of the machine\",\n \"ifconfig Displays the IP address of the machine\",\n \"kill [script/pid] [args...] Stops the specified script on the current server \",\n \"killall Stops all running scripts on the current machine\",\n \"ls [dir] [| grep pattern] Displays all files on the machine\",\n \"lscpu Displays the number of CPU cores on the machine\",\n \"mem [script] [-t] [n] Displays the amount of RAM required to run the script\",\n \"mv [src] [dest] Move/rename a text or script file\",\n \"nano [file] Text editor - Open up and edit a script or text file\",\n \"ps Display all scripts that are currently running\",\n \"rm [file] Delete a file from the server\",\n \"run [name] [-t n] [--tail] [args...] Execute a program or script\",\n \"scan Prints all immediately-available network connections\",\n \"scan-analyze [d] [-a] Prints info for all servers up to d nodes away\",\n \"scp [file] [server] Copies a file to a destination server\",\n \"sudov Shows whether you have root access on this computer\",\n \"tail [script] [args...] Displays dynamic logs for the specified script\",\n \"top Displays all running scripts and their RAM usage\",\n \"unalias [alias name] Deletes the specified alias\",\n \"wget [url] [target file] Retrieves code/text from a web server\",\n];\n\nexport const HelpTexts: IMap = {\n alias: [\n 'alias [-g] [name=\"value\"] ',\n \" \",\n \"Create or display aliases. An alias enables a replacement of a word with another string. \",\n \"It can be used to abbreviate a commonly used command, or commonly used parts of a command. The NAME \",\n \"of an alias defines the word that will be replaced, while the VALUE defines what it will be replaced by. For example, \",\n \"you could create the alias 'nuke' for the Terminal command 'run NUKE.exe' using the following: \",\n \" \",\n 'alias nuke=\"run NUKE.exe\"',\n \" \",\n \"Then, to run the NUKE.exe program you would just have to enter 'nuke' in Terminal rather than the full command. \",\n \"It is important to note that 'default' aliases will only be substituted for the first word of a Terminal command. For \",\n \"example, if the following alias was set: \",\n \" \",\n 'alias worm=\"HTTPWorm.exe\"',\n \" \",\n \"and then you tried to run the following terminal command: \",\n \" \",\n \"run worm\",\n \" \",\n \"This would fail because the worm alias is not the first word of a Terminal command. To allow an alias to be substituted \",\n \"anywhere in a Terminal command, rather than just the first word, you must set it to be a global alias using the -g flag: \",\n \" \",\n 'alias -g worm=\"HTTPWorm.exe\"',\n \" \",\n \"Now, the 'worm' alias will be substituted anytime it shows up as an individual word in a Terminal command. \",\n \" \",\n \"Entering just the command 'alias' without any arguments prints the list of all defined aliases in the reusable form \",\n \"'alias NAME=VALUE' on the Terminal. \",\n \" \",\n \"The 'unalias' command can be used to remove aliases.\",\n \" \",\n ],\n analyze: [\n \"analze\",\n \" \",\n \"Prints details and statistics about the current server. The information that is printed includes basic \",\n \"server details such as the hostname, whether the player has root access, what ports are opened/closed, and also \",\n \"hacking-related information such as an estimated chance to successfully hack, an estimate of how much money is \",\n \"available on the server, etc.\",\n ],\n backdoor: [\n \"backdoor\",\n \" \",\n \"Install a backdoor on the current machine, grants a secret bonus depending on the machine.\",\n \" \",\n \"Requires root access to run.\",\n \" \",\n ],\n buy: [\n \"buy [-l / program]\",\n \" \",\n \"Purchase a program through the Dark Web. Requires a TOR router to use.\",\n \" \",\n \"If this command is ran with the '-l' flag, it will display a list of all programs that can be bought through the \",\n \"dark web to the Terminal, as well as their costs.\",\n \" \",\n \"Otherwise, the name of the program must be passed in as a parameter. This name is NOT case-sensitive.\",\n ],\n cat: [\n \"cat [file]\",\n \" \",\n \"Display message (.msg), literature (.lit), or text (.txt) files. Examples:\",\n \" \",\n \"cat j1.msg\",\n \" \",\n \"cat foo.lit\",\n \" \",\n \"cat servers.txt\",\n ],\n cd: [\n \"cd [dir]\",\n \" \",\n \"Change to the specified directory. Note that this works even for directories that don't exist. If you \",\n \"change to a directory that does not exist, it will not be 'created'. Examples:\",\n \" \",\n \"cd scripts/hacking\",\n \" \",\n \"cd /logs\",\n \" \",\n \"cd ../\",\n ],\n check: [\n \"check [script name] [args...]\",\n \" \",\n \"Print the logs of the script specified by the script name and arguments to the Terminal. Each argument must be separated by \",\n \"a space. Remember that a running script is uniquely \",\n \"identified both by its name and the arguments that are used to start it. So, if a script was ran with the following arguments: \",\n \" \",\n \"run foo.script 1 2 foodnstuff\",\n \" \",\n \"Then to run the 'check' command on this script you would have to pass the same arguments in: \",\n \" \",\n \"check foo.script 1 2 foodnstuff\",\n ],\n clear: [\n \"clear\",\n \" \",\n \"Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up \",\n \"and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'cls' command\",\n ],\n cls: [\n \"cls\",\n \" \",\n \"Clear the Terminal screen, deleting all of the text. Note that this does not delete the user's command history, so using the up \",\n \"and down arrow keys is still valid. Also note that this is permanent and there is no way to undo this. Synonymous with 'clear' command\",\n ],\n connect: [\n \"connect [hostname/ip]\",\n \" \",\n \"Connect to a remote server. The hostname or IP address of the remote server must be given as the argument \",\n \"to this command. Note that only servers that are immediately adjacent to the current server in the network can be connected to. To \",\n \"see which servers can be connected to, use the 'scan' command.\",\n ],\n download: [\n \"download [script/text file]\",\n \" \",\n \"Downloads a script or text file to your computer (like your real life computer).\",\n \" \",\n \"You can also download all of your scripts/text files as a zip file using the following Terminal commands:\",\n \" \",\n \"Download all scripts and text files: download *\",\n \" \",\n \"Download all scripts: download *.script\",\n \" \",\n \"Download all text files: download *.txt\",\n \" \",\n ],\n expr: [\n \"expr [mathematical expression]\",\n \" \",\n \"Evaluate a simple mathematical expression. Supports native JavaScript operators:\",\n \" \",\n \"+, -, /, *, **, %\",\n \" \",\n \"Example:\",\n \" \",\n \"expr 25 * 2 ** 10\",\n \" \",\n \"Note that letters (non-digits) are not allowed and will be removed from the input.\",\n ],\n free: [\n \"free\",\n \" \",\n \"Display's the memory usage on the current machine. Print the amount of RAM that is available on the current server as well as \",\n \"how much of it is being used.\",\n ],\n hack: [\n \"hack\",\n \" \",\n \"Attempt to hack the current server. Requires root access in order to be run. See the wiki page for hacking mechanics\",\n \" \",\n ],\n help: [\n \"help [command]\",\n \" \",\n \"Display Terminal help information. Without arguments, 'help' prints a list of all valid Terminal commands and a brief \",\n \"description of their functionality. You can also pass the name of a Terminal command as an argument to 'help' to print \",\n \"more detailed information about the Terminal command. Examples: \",\n \" \",\n \"help alias\",\n \" \",\n \"help scan-analyze\",\n ],\n home: [\n \"home\" + \"Connect to your home computer. This will work no matter what server you are currently connected to.\",\n ],\n hostname: [\"hostname\", \" \", \"Prints the hostname of the current server\"],\n ifconfig: [\"ipconfig\", \" \", \"Prints the IP address of the current server\"],\n kill: [\n \"kill [script name] [args...]\",\n \" \",\n \"kill [pid]\",\n \" \",\n \"Kill the script specified by the script name and arguments OR by its PID.\",\n \" \",\n \"If you are killing the script using its filename and arguments, then each \",\n \"argument must be separated by a space. Remember that a running script is \",\n \"uniquely identified by both its name and the arguments that are used to start \",\n \"it. So, if a script was ran with the following arguments:\",\n \" \",\n \"run foo.script 1 sigma-cosmetics\",\n \" \",\n \"Then to kill this script the same arguments would have to be used:\",\n \" \",\n \"kill foo.script 1 sigma-cosmetics\",\n \" \",\n \"If you are killing the script using its PID, then the PID argument must be numeric\",\n ],\n killall: [\n \"killall\",\n \" \",\n \"Kills all scripts on the current server. \",\n \"Note that after the 'kill' command is issued for a script, it may take a while for the script to actually stop running. \",\n \"This will happen if the script is in the middle of a command such as grow() or weaken() that takes time to execute. \",\n \"The script will not be stopped/killed until after that time has elapsed.\",\n ],\n ls: [\n \"ls [dir] [| grep pattern]\",\n \" \",\n \"The ls command, with no arguments, prints all files and directories on the current server's directory to the Terminal screen. \",\n \"The files will be displayed in alphabetical order. \",\n \" \",\n \"The 'dir' optional parameter can be used to display files/directories in another directory.\",\n \" \",\n \"The '| grep pattern' optional parameter can be used to only display files whose filenames match the specified pattern.\",\n \" \",\n \"Examples:\",\n \" \",\n \"List all files with the '.script' extension in the current directory:\",\n \" \",\n \"ls | grep .script\",\n \" \",\n \"List all files with the '.js' extension in the root directory:\",\n \" \",\n \"ls / | grep .js\",\n \" \",\n \"List all files with the word 'purchase' in the filename, in the 'scripts' directory:\",\n \" \",\n \"ls scripts | grep purchase\",\n ],\n lscpu: [\"lscpu\", \" \", \"Prints the number of CPU Cores the current server has\"],\n\n mem: [\n \"mem [script name] [-t num_threads]\",\n \" \",\n \"Displays the amount of RAM needed to run the specified script with a single thread. The command can also be used to print \",\n \"the amount of RAM needed to run a script with multiple threads using the '-t' flag. If the '-t' flag is specified, then \",\n \"an argument for the number of threads must be passed in afterwards. Examples:\",\n \" \",\n \"mem foo.script\",\n \" \",\n \"mem foo.script -t 50\",\n \" \",\n \"The first example above will print the amount of RAM needed to run 'foo.script' with a single thread. The second example \",\n \"above will print the amount of RAM needed to run 'foo.script' with 50 threads.\",\n ],\n mv: [\n \"mv [src] [dest]\",\n \" \",\n \"Move the source file to the specified destination. This can also be used to rename files. \",\n \"This command only works for scripts and text files (.txt). This command CANNOT be used to \",\n \"convert to different file types\",\n \" \",\n \"Note that, unlike the Linux 'mv' command, the destination argument must be the \",\n \"full filepath. \",\n \"Examples: \",\n \" \",\n \"mv hacking-controller.script scripts/hacking-controller.script\",\n \" \",\n \"mv myScript.js myOldScript.js\",\n ],\n nano: [\n \"nano [file name]\",\n \" \",\n \"Opens up the specified file in the Text Editor. Only scripts (.script) or text files (.txt) can be \",\n \"edited using the Text Editor. If the file does not already exist, then a new, empty one \",\n \"will be created\",\n ],\n ps: [\"ps\", \" \", \"Prints all scripts that are running on the current server\"],\n\n rm: [\n \"rm [file]\",\n \" \",\n \"Removes the specified file from the current server. A file can be a script, a program, or a message file. \",\n \" \",\n \"WARNING: This is permanent and cannot be undone\",\n ],\n run: [\n \"run [file name] [-t] [num threads] [args...]\",\n \" \",\n \"Execute a program or a script.\",\n \" \",\n \"The '[-t]', '[num threads]', and '[args...]' arguments are only valid when running a script. The '-t' flag is used \",\n \"to indicate that the script should be run with the specified number of threads. If the flag is omitted, \",\n \"then the script will be run with a single thread by default. \",\n \"If the '-t' flag is used, then it MUST come immediately \",\n \"after the script name, and the [num threads] argument MUST come immediately afterwards. \",\n \" \",\n \"[args...] represents a variable number of arguments that will be passed into the script. See the documentation \",\n \"about script arguments. Each specified argument must be separated by a space. \",\n \" \",\n ],\n scan: [\n \"scan\",\n \" \",\n \"Prints all immediately-available network connection. This will print a list of all servers that you can currently connect \",\n \"to using the 'connect' Terminal command.\",\n ],\n \"scan-analyze\": [\n \"scan-analyze [depth] [-a]\",\n \" \",\n \"Prints detailed information about all servers up to [depth] nodes away on the network. Calling \",\n \"'scan-analyze 1' will display information for the same servers that are shown by the 'scan' Terminal \",\n \"command. This command also shows the relative paths to reach each server.\",\n \" \",\n \"By default, the maximum depth that can be specified for 'scan-analyze' is 3. However, once you have \",\n \"the DeepscanV1.exe and DeepscanV2.exe programs, you can execute 'scan-analyze' with a depth up to \",\n \"5 and 10, respectively.\",\n \" \",\n \"The information 'scan-analyze' displays about each server includes whether or not you have root access to it, \",\n \"its required hacking level, the number of open ports required to run NUKE.exe on it, and how much RAM \",\n \"it has.\",\n \" \",\n \"By default, this command will not display servers that you have purchased. However, you can pass in the \",\n \"-a flag at the end of the command if you would like to enable that.\",\n ],\n scp: [\n \"scp [filename] [target server]\",\n \" \",\n \"Copies the specified file from the current server to the target server. \",\n \"This command only works for script files (.script extension), literature files (.lit extension), \",\n \"and text files (.txt extension). \",\n \"The second argument passed in must be the hostname or IP of the target server.\",\n ],\n sudov: [\"sudov\", \" \", \"Prints whether or not you have root access to the current machine\"],\n\n tail: [\n \"tail [script name] [args...]\",\n \" \",\n \"Displays dynamic logs for the script specified by the script name and arguments. Each argument must be separated \",\n \"by a space. Remember that a running script is uniquely identified by both its name and the arguments that were used \",\n \"to run it. So, if a script was ran with the following arguments: \",\n \" \",\n \"run foo.script 10 50000\",\n \" \",\n \"Then in order to check its logs with 'tail' the same arguments must be used: \",\n \" \",\n \"tail foo.script 10 50000\",\n ],\n top: [\n \"top\",\n \" \",\n \"Prints a list of all scripts running on the current server as well as their thread count and how much \",\n \"RAM they are using in total.\",\n ],\n unalias: [\n \"unalias [alias name]\",\n \" \",\n \"Deletes the specified alias. Note that the double quotation marks are required. \",\n \" \",\n \"As an example, if an alias was declared using:\",\n \" \",\n 'alias r=\"run\"',\n \" \",\n \"Then it could be removed using:\",\n \" \",\n \"unalias r\",\n \" \",\n \"It is not necessary to differentiate between global and non-global aliases when using 'unalias'\",\n ],\n wget: [\n \"wget [url] [target file]\",\n \" \",\n \"Retrieves data from a URL and downloads it to a file on the current server. The data can only \",\n \"be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists, \",\n \"it will be overwritten by this command.\",\n \" \",\n \"Note that it will not be possible to download data from many websites because they do not allow \",\n \"cross-origin resource sharing (CORS). Example:\",\n \" \",\n \"wget https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md game_readme.txt\",\n ],\n};\n","import { ITerminal, Output, Link, TTimer } from \"./ITerminal\";\nimport { IRouter } from \"../ui/Router\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { HacknetServer } from \"../Hacknet/HacknetServer\";\nimport { BaseServer } from \"../Server/BaseServer\";\nimport { Programs } from \"../Programs/Programs\";\nimport { CodingContractResult } from \"../CodingContracts\";\nimport { TerminalEvents, TerminalClearEvents } from \"./TerminalEvents\";\n\nimport { TextFile } from \"../TextFile\";\nimport { Script } from \"../Script/Script\";\nimport { isScriptFilename } from \"../Script/ScriptHelpersTS\";\nimport { CONSTANTS } from \"../Constants\";\nimport { AllServers } from \"../Server/AllServers\";\n\nimport { removeLeadingSlash, isInRootDirectory, evaluateFilePath } from \"./DirectoryHelpers\";\nimport { checkIfConnectedToDarkweb } from \"../DarkWeb/DarkWeb\";\nimport { iTutorialNextStep, iTutorialSteps, ITutorial } from \"../InteractiveTutorial\";\nimport { GetServerByHostname, getServer, getServerOnNetwork } from \"../Server/ServerHelpers\";\nimport { ParseCommand, ParseCommands } from \"./Parser\";\nimport { SpecialServerIps, SpecialServerNames } from \"../Server/SpecialServerIps\";\nimport { Settings } from \"../Settings/Settings\";\nimport { createProgressBarText } from \"../../utils/helpers/createProgressBarText\";\nimport {\n calculateHackingChance,\n calculateHackingExpGain,\n calculatePercentMoneyHacked,\n calculateHackingTime,\n} from \"../Hacking\";\nimport { numeralWrapper } from \"../ui/numeralFormat\";\nimport { convertTimeMsToTimeElapsedString } from \"../../utils/StringHelperFunctions\";\n\nimport { alias } from \"./commands/alias\";\nimport { analyze } from \"./commands/analyze\";\nimport { backdoor } from \"./commands/backdoor\";\nimport { buy } from \"./commands/buy\";\nimport { cat } from \"./commands/cat\";\nimport { cd } from \"./commands/cd\";\nimport { check } from \"./commands/check\";\nimport { connect } from \"./commands/connect\";\nimport { download } from \"./commands/download\";\nimport { expr } from \"./commands/expr\";\nimport { free } from \"./commands/free\";\nimport { hack } from \"./commands/hack\";\nimport { help } from \"./commands/help\";\nimport { home } from \"./commands/home\";\nimport { hostname } from \"./commands/hostname\";\nimport { ifconfig } from \"./commands/ifconfig\";\nimport { kill } from \"./commands/kill\";\nimport { killall } from \"./commands/killall\";\nimport { ls } from \"./commands/ls\";\nimport { lscpu } from \"./commands/lscpu\";\nimport { mem } from \"./commands/mem\";\nimport { mv } from \"./commands/mv\";\nimport { nano } from \"./commands/nano\";\nimport { ps } from \"./commands/ps\";\nimport { rm } from \"./commands/rm\";\nimport { run } from \"./commands/run\";\nimport { scan } from \"./commands/scan\";\nimport { scananalyze } from \"./commands/scananalyze\";\nimport { scp } from \"./commands/scp\";\nimport { sudov } from \"./commands/sudov\";\nimport { tail } from \"./commands/tail\";\nimport { top } from \"./commands/top\";\nimport { unalias } from \"./commands/unalias\";\nimport { wget } from \"./commands/wget\";\n\nexport class Terminal implements ITerminal {\n // Flags to determine whether the player is currently running a hack or an analyze\n action: TTimer | null = null;\n\n commandHistory: string[] = [];\n commandHistoryIndex = 0;\n\n outputHistory: (Output | Link)[] = [new Output(`Bitburner v${CONSTANTS.Version}`, \"primary\")];\n\n // True if a Coding Contract prompt is opened\n contractOpen = false;\n\n // Full Path of current directory\n // Excludes the trailing forward slash\n currDir = \"/\";\n\n process(router: IRouter, player: IPlayer, cycles: number): void {\n if (this.action === null) return;\n this.action.timeLeft -= (CONSTANTS._idleSpeed * cycles) / 1000;\n if (this.action.timeLeft < 0.01) this.finishAction(router, player, false);\n TerminalEvents.emit();\n }\n\n append(item: Output | Link): void {\n this.outputHistory.push(item);\n if (this.outputHistory.length > Settings.MaxTerminalCapacity) {\n this.outputHistory.slice(this.outputHistory.length - Settings.MaxTerminalCapacity);\n }\n TerminalEvents.emit();\n }\n\n print(s: string): void {\n this.append(new Output(s, \"primary\"));\n }\n\n error(s: string): void {\n this.append(new Output(s, \"error\"));\n }\n\n startHack(player: IPlayer): void {\n // Hacking through Terminal should be faster than hacking through a script\n this.startAction(calculateHackingTime(player.getCurrentServer(), player) / 4, \"h\");\n }\n\n startBackdoor(player: IPlayer): void {\n // Backdoor should take the same amount of time as hack\n this.startAction(calculateHackingTime(player.getCurrentServer(), player) / 4, \"b\");\n }\n\n startAnalyze(): void {\n this.print(\"Analyzing system...\");\n this.startAction(1, \"a\");\n }\n\n startAction(n: number, action: \"h\" | \"b\" | \"a\"): void {\n this.action = new TTimer(n, action);\n }\n\n // Complete the hack/analyze command\n finishHack(router: IRouter, player: IPlayer, cancelled = false): void {\n if (cancelled) return;\n const server = player.getCurrentServer();\n\n // Calculate whether hack was successful\n const hackChance = calculateHackingChance(server, player);\n const rand = Math.random();\n const expGainedOnSuccess = calculateHackingExpGain(server, player);\n const expGainedOnFailure = expGainedOnSuccess / 4;\n if (rand < hackChance) {\n // Success!\n if (\n SpecialServerIps[SpecialServerNames.WorldDaemon] &&\n SpecialServerIps[SpecialServerNames.WorldDaemon] == server.ip\n ) {\n if (player.bitNodeN == null) {\n player.bitNodeN = 1;\n }\n router.toBitVerse(false, false);\n return;\n }\n server.backdoorInstalled = true;\n let moneyGained = calculatePercentMoneyHacked(server, player);\n moneyGained = Math.floor(server.moneyAvailable * moneyGained);\n\n if (moneyGained <= 0) {\n moneyGained = 0;\n } // Safety check\n\n server.moneyAvailable -= moneyGained;\n player.gainMoney(moneyGained);\n player.recordMoneySource(moneyGained, \"hacking\");\n player.gainHackingExp(expGainedOnSuccess);\n player.gainIntelligenceExp(expGainedOnSuccess / CONSTANTS.IntelligenceTerminalHackBaseExpGain);\n\n server.fortify(CONSTANTS.ServerFortifyAmount);\n\n this.print(\n `Hack successful! Gained ${numeralWrapper.formatMoney(moneyGained)} and ${numeralWrapper.formatExp(\n expGainedOnSuccess,\n )} hacking exp`,\n );\n } else {\n // Failure\n // player only gains 25% exp for failure? TODO Can change this later to balance\n player.gainHackingExp(expGainedOnFailure);\n this.print(\n `Failed to hack ${server.hostname}. Gained ${numeralWrapper.formatExp(expGainedOnFailure)} hacking exp`,\n );\n }\n }\n\n finishBackdoor(router: IRouter, player: IPlayer, cancelled = false): void {\n if (!cancelled) {\n const server = player.getCurrentServer();\n if (\n SpecialServerIps[SpecialServerNames.WorldDaemon] &&\n SpecialServerIps[SpecialServerNames.WorldDaemon] == server.ip\n ) {\n if (player.bitNodeN == null) {\n player.bitNodeN = 1;\n }\n router.toBitVerse(false, false);\n return;\n }\n server.backdoorInstalled = true;\n this.print(\"Backdoor successful!\");\n }\n }\n\n finishAnalyze(player: IPlayer, cancelled = false): void {\n if (!cancelled) {\n const currServ = player.getCurrentServer();\n const isHacknet = currServ instanceof HacknetServer;\n this.print(currServ.hostname + \": \");\n const org = currServ.organizationName;\n this.print(\"Organization name: \" + (!isHacknet ? org : \"player\"));\n const hasAdminRights = (!isHacknet && currServ.hasAdminRights) || isHacknet;\n this.print(\"Root Access: \" + (hasAdminRights ? \"YES\" : \"NO\"));\n const hackingSkill = currServ.requiredHackingSkill;\n this.print(\"Required hacking skill: \" + (!isHacknet ? hackingSkill : \"N/A\"));\n const security = currServ.hackDifficulty;\n this.print(\"Server security level: \" + (!isHacknet ? numeralWrapper.formatServerSecurity(security) : \"N/A\"));\n const hackingChance = calculateHackingChance(currServ, player);\n this.print(\"Chance to hack: \" + (!isHacknet ? numeralWrapper.formatPercentage(hackingChance) : \"N/A\"));\n const hackingTime = calculateHackingTime(currServ, player) * 1000;\n this.print(\"Time to hack: \" + (!isHacknet ? convertTimeMsToTimeElapsedString(hackingTime, true) : \"N/A\"));\n this.print(\n `Total money available on server: ${!isHacknet ? numeralWrapper.formatMoney(currServ.moneyAvailable) : \"N/A\"}`,\n );\n const numPort = currServ.numOpenPortsRequired;\n this.print(\"Required number of open ports for NUKE: \" + (!isHacknet ? numPort : \"N/A\"));\n this.print(\"SSH port: \" + (currServ.sshPortOpen ? \"Open\" : \"Closed\"));\n this.print(\"FTP port: \" + (currServ.ftpPortOpen ? \"Open\" : \"Closed\"));\n this.print(\"SMTP port: \" + (currServ.smtpPortOpen ? \"Open\" : \"Closed\"));\n this.print(\"HTTP port: \" + (currServ.httpPortOpen ? \"Open\" : \"Closed\"));\n this.print(\"SQL port: \" + (currServ.sqlPortOpen ? \"Open\" : \"Closed\"));\n }\n }\n\n finishAction(router: IRouter, player: IPlayer, cancelled = false): void {\n if (this.action === null) {\n if (!cancelled) throw new Error(\"Finish action called when there was no action\");\n return;\n }\n this.print(this.getProgressText());\n if (this.action.action === \"h\") {\n this.finishHack(router, player, cancelled);\n } else if (this.action.action === \"b\") {\n this.finishBackdoor(router, player, cancelled);\n } else if (this.action.action === \"a\") {\n this.finishAnalyze(player, cancelled);\n }\n if (cancelled) {\n this.print(\"Cancelled\");\n }\n this.action = null;\n TerminalEvents.emit();\n }\n\n getFile(player: IPlayer, filename: string): Script | TextFile | string | null {\n if (isScriptFilename(filename)) {\n return this.getScript(player, filename);\n }\n\n if (filename.endsWith(\".lit\")) {\n return this.getLitFile(player, filename);\n }\n\n if (filename.endsWith(\".txt\")) {\n return this.getTextFile(player, filename);\n }\n\n return null;\n }\n\n getFilepath(filename: string): string {\n const path = evaluateFilePath(filename, this.cwd());\n if (path == null) {\n throw new Error(`Invalid file path specified: ${filename}`);\n }\n\n if (isInRootDirectory(path)) {\n return removeLeadingSlash(path);\n }\n\n return path;\n }\n\n getScript(player: IPlayer, filename: string): Script | null {\n const s = player.getCurrentServer();\n const filepath = this.getFilepath(filename);\n for (const script of s.scripts) {\n if (filepath === script.filename) {\n return script;\n }\n }\n\n return null;\n }\n\n getTextFile(player: IPlayer, filename: string): TextFile | null {\n const s = player.getCurrentServer();\n const filepath = this.getFilepath(filename);\n for (const txt of s.textFiles) {\n if (filepath === txt.fn) {\n return txt;\n }\n }\n\n return null;\n }\n\n getLitFile(player: IPlayer, filename: string): string | null {\n const s = player.getCurrentServer();\n const filepath = this.getFilepath(filename);\n for (const lit of s.messages) {\n if (typeof lit === \"string\" && filepath === lit) {\n return lit;\n }\n }\n\n return null;\n }\n\n cwd(): string {\n return this.currDir;\n }\n\n setcwd(dir: string): void {\n this.currDir = dir;\n TerminalEvents.emit();\n }\n\n async runContract(player: IPlayer, contractName: string): Promise {\n // There's already an opened contract\n if (this.contractOpen) {\n return this.error(\"There's already a Coding Contract in Progress\");\n }\n\n const serv = player.getCurrentServer();\n const contract = serv.getContract(contractName);\n if (contract == null) {\n return this.error(\"No such contract\");\n }\n\n this.contractOpen = true;\n const res = await contract.prompt();\n\n switch (res) {\n case CodingContractResult.Success:\n if (contract.reward !== null) {\n const reward = player.gainCodingContractReward(contract.reward, contract.getDifficulty());\n this.print(`Contract SUCCESS - ${reward}`);\n }\n serv.removeContract(contract);\n break;\n case CodingContractResult.Failure:\n ++contract.tries;\n if (contract.tries >= contract.getMaxNumTries()) {\n this.print(\"Contract FAILED - Contract is now self-destructing\");\n serv.removeContract(contract);\n } else {\n this.print(`Contract FAILED - ${contract.getMaxNumTries() - contract.tries} tries remaining`);\n }\n break;\n case CodingContractResult.Cancelled:\n default:\n this.print(\"Contract cancelled\");\n break;\n }\n this.contractOpen = false;\n }\n\n executeScanAnalyzeCommand(player: IPlayer, depth = 1, all = false): void {\n // TODO Using array as stack for now, can make more efficient\n this.print(\"~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~\");\n this.print(\" \");\n\n // Map of all servers to keep track of which have been visited\n const visited: {\n [key: string]: number | undefined;\n } = {};\n for (const ip in AllServers) {\n visited[ip] = 0;\n }\n\n const stack: BaseServer[] = [];\n const depthQueue: number[] = [0];\n const currServ = player.getCurrentServer();\n stack.push(currServ);\n while (stack.length != 0) {\n const s = stack.pop();\n if (!s) continue;\n const d = depthQueue.pop();\n if (d === undefined) continue;\n const isHacknet = s instanceof HacknetServer;\n if (!all && (s as any).purchasedByPlayer && s.hostname != \"home\") {\n continue; // Purchased server\n } else if (visited[s.ip] || d > depth) {\n continue; // Already visited or out-of-depth\n } else if (!all && isHacknet) {\n continue; // Hacknet Server\n } else {\n visited[s.ip] = 1;\n }\n for (let i = s.serversOnNetwork.length - 1; i >= 0; --i) {\n const newS = getServerOnNetwork(s, i);\n if (newS === null) continue;\n stack.push(newS);\n depthQueue.push(d + 1);\n }\n if (d == 0) {\n continue;\n } // Don't print current server\n const titleDashes = Array((d - 1) * 4 + 1).join(\"-\");\n if (player.hasProgram(Programs.AutoLink.name)) {\n this.append(new Link(titleDashes, s.hostname));\n } else {\n this.print(titleDashes+s.hostname);\n }\n\n const dashes = titleDashes + \"--\";\n let c = \"NO\";\n if (s.hasAdminRights) {\n c = \"YES\";\n }\n this.print(\n `${dashes}Root Access: ${c}${!isHacknet ? \", Required hacking skill: \" + (s as any).requiredHackingSkill : \"\"}`,\n );\n if (s.hasOwnProperty(\"numOpenPortsRequired\")) {\n this.print(dashes + \"Number of open ports required to NUKE: \" + (s as any).numOpenPortsRequired);\n }\n this.print(dashes + \"RAM: \" + numeralWrapper.formatRAM(s.maxRam));\n this.print(\" \");\n }\n }\n\n connectToServer(player: IPlayer, server: string): void {\n const serv = getServer(server);\n if (serv == null) {\n this.error(\"Invalid server. Connection failed.\");\n return;\n }\n player.getCurrentServer().isConnectedTo = false;\n player.currentServer = serv.ip;\n player.getCurrentServer().isConnectedTo = true;\n this.print(\"Connected to \" + serv.hostname);\n this.setcwd(\"/\");\n if (player.getCurrentServer().hostname == \"darkweb\") {\n checkIfConnectedToDarkweb(); // Posts a 'help' message if connecting to dark web\n }\n }\n\n executeCommands(router: IRouter, player: IPlayer, commands: string): void {\n // Sanitize input\n commands = commands.trim();\n commands = commands.replace(/\\s\\s+/g, \" \"); // Replace all extra whitespace in command with a single space\n\n // Handle Terminal History - multiple commands should be saved as one\n if (this.commandHistory[this.commandHistory.length - 1] != commands) {\n this.commandHistory.push(commands);\n if (this.commandHistory.length > 50) {\n this.commandHistory.splice(0, 1);\n }\n }\n this.commandHistoryIndex = this.commandHistory.length;\n const allCommands = ParseCommands(commands);\n\n for (let i = 0; i < allCommands.length; i++) {\n this.executeCommand(router, player, allCommands[i]);\n }\n }\n\n clear(): void {\n // TODO: remove this once we figure out the height issue.\n this.outputHistory = [new Output(`Bitburner v${CONSTANTS.Version}`, \"primary\")];\n TerminalEvents.emit();\n TerminalClearEvents.emit();\n }\n\n prestige(): void {\n this.action = null;\n this.clear();\n }\n\n executeCommand(router: IRouter, player: IPlayer, command: string): void {\n if (this.action !== null) {\n this.error(`Cannot execute command (${command}) while an action is in progress`);\n return;\n }\n // Allow usage of ./\n if (command.startsWith(\"./\")) {\n command = \"run \" + command.slice(2);\n }\n // Only split the first space\n const commandArray = ParseCommand(command);\n if (commandArray.length == 0) {\n return;\n }\n const s = player.getCurrentServer();\n /****************** Interactive Tutorial Terminal Commands ******************/\n if (ITutorial.isRunning) {\n const n00dlesServ = GetServerByHostname(\"n00dles\");\n if (n00dlesServ == null) {\n throw new Error(\"Could not get n00dles server\");\n return;\n }\n switch (ITutorial.currStep) {\n case iTutorialSteps.TerminalHelp:\n if (commandArray.length === 1 && commandArray[0] == \"help\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalLs:\n if (commandArray.length === 1 && commandArray[0] == \"ls\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalScan:\n if (commandArray.length === 1 && commandArray[0] == \"scan\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalScanAnalyze1:\n if (commandArray.length == 1 && commandArray[0] == \"scan-analyze\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalScanAnalyze2:\n if (commandArray.length == 2 && commandArray[0] == \"scan-analyze\" && commandArray[1] === 2) {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalConnect:\n if (commandArray.length == 2) {\n if (commandArray[0] == \"connect\" && (commandArray[1] == \"n00dles\" || commandArray[1] == n00dlesServ.ip)) {\n iTutorialNextStep();\n } else {\n this.print(\"Wrong command! Try again!\");\n return;\n }\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalAnalyze:\n if (commandArray.length === 1 && commandArray[0] === \"analyze\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalNuke:\n if (commandArray.length == 2 && commandArray[0] == \"run\" && commandArray[1] == \"NUKE.exe\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalManualHack:\n if (commandArray.length == 1 && commandArray[0] == \"hack\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalGoHome:\n if (commandArray.length == 1 && commandArray[0] == \"home\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalCreateScript:\n if (commandArray.length == 2 && commandArray[0] == \"nano\" && commandArray[1] == \"n00dles.script\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalFree:\n if (commandArray.length == 1 && commandArray[0] == \"free\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.TerminalRunScript:\n if (commandArray.length == 2 && commandArray[0] == \"run\" && commandArray[1] == \"n00dles.script\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n case iTutorialSteps.ActiveScriptsToTerminal:\n if (commandArray.length == 2 && commandArray[0] == \"tail\" && commandArray[1] == \"n00dles.script\") {\n iTutorialNextStep();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n return;\n }\n break;\n default:\n this.print(\"Please follow the tutorial, or click 'EXIT' if you'd like to skip it\");\n return;\n }\n }\n /****************** END INTERACTIVE TUTORIAL ******************/\n /* Command parser */\n const commandName = commandArray[0];\n if (typeof commandName === \"number\") {\n this.error(`Command ${commandArray[0]} not found`);\n return;\n }\n\n const commands: {\n [key: string]: (\n terminal: ITerminal,\n router: IRouter,\n player: IPlayer,\n server: BaseServer,\n args: (string | number)[],\n ) => void;\n } = {\n alias: alias,\n analyze: analyze,\n backdoor: backdoor,\n buy: buy,\n cat: cat,\n cd: cd,\n check: check,\n cls: () => this.clear(),\n clear: () => this.clear(),\n connect: connect,\n download: download,\n expr: expr,\n free: free,\n hack: hack,\n help: help,\n home: home,\n hostname: hostname,\n ifconfig: ifconfig,\n kill: kill,\n killall: killall,\n ls: ls,\n lscpu: lscpu,\n mem: mem,\n mv: mv,\n nano: nano,\n ps: ps,\n rm: rm,\n run: run,\n scan: scan,\n \"scan-analyze\": scananalyze,\n scp: scp,\n sudov: sudov,\n tail: tail,\n top: top,\n unalias: unalias,\n wget: wget,\n };\n\n const f = commands[commandName.toLowerCase()];\n if (!f) {\n this.error(`Command ${commandArray[0]} not found`);\n return;\n }\n\n f(this, router, player, s, commandArray.slice(1));\n }\n\n getProgressText(): string {\n if (this.action === null) throw new Error(\"trying to get the progress text when there's no action\");\n return createProgressBarText({\n progress: (this.action.time - this.action.timeLeft) / this.action.time,\n totalTicks: 50,\n });\n }\n}\n","import { getRandomInt } from \"../../utils/helpers/getRandomInt\";\n\n/* tslint:disable:completed-docs no-magic-numbers arrow-return-shorthand */\n\n/* Function that generates a valid 'data' for a contract type */\nexport type GeneratorFunc = () => any;\n\n/* Function that checks if the provided solution is the correct one */\nexport type SolverFunc = (data: any, answer: string) => boolean;\n\n/* Function that returns a string with the problem's description.\n Requires the 'data' of a Contract as input */\nexport type DescriptionFunc = (data: any) => string;\n\nexport interface ICodingContractTypeMetadata {\n desc: DescriptionFunc;\n difficulty: number;\n gen: GeneratorFunc;\n name: string;\n numTries: number;\n solver: SolverFunc;\n}\n\n/* Helper functions for Coding Contract implementations */\nfunction removeBracketsFromArrayString(str: string): string {\n let strCpy: string = str;\n if (strCpy.startsWith(\"[\")) {\n strCpy = strCpy.slice(1);\n }\n if (strCpy.endsWith(\"]\")) {\n strCpy = strCpy.slice(0, -1);\n }\n\n return strCpy;\n}\n\nfunction removeQuotesFromString(str: string): string {\n let strCpy: string = str;\n if (strCpy.startsWith('\"') || strCpy.startsWith(\"'\")) {\n strCpy = strCpy.slice(1);\n }\n if (strCpy.endsWith('\"') || strCpy.endsWith(\"'\")) {\n strCpy = strCpy.slice(0, -1);\n }\n\n return strCpy;\n}\n\nfunction convert2DArrayToString(arr: any[][]): string {\n const components: string[] = [];\n arr.forEach((e: any) => {\n let s: string = e.toString();\n s = [\"[\", s, \"]\"].join(\"\");\n components.push(s);\n });\n\n return components.join(\",\").replace(/\\s/g, \"\");\n}\n\nexport const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [\n {\n desc: (n: number): string => {\n return [\"A prime factor is a factor that is a prime number.\", `What is the largest prime factor of ${n}?`].join(\n \" \",\n );\n },\n difficulty: 1,\n gen: (): number => {\n return getRandomInt(500, 1e9);\n },\n name: \"Find Largest Prime Factor\",\n numTries: 10,\n solver: (data: number, ans: string): boolean => {\n let fac = 2;\n let n: number = data;\n while (n > (fac - 1) * (fac - 1)) {\n while (n % fac === 0) {\n n = Math.round(n / fac);\n }\n ++fac;\n }\n\n return (n === 1 ? fac - 1 : n) === parseInt(ans, 10);\n },\n },\n {\n desc: (n: number[]): string => {\n return [\n \"Given the following integer array, find the contiguous subarray\",\n \"(containing at least one number) which has the largest sum and return that sum.\",\n \"'Sum' refers to the sum of all the numbers in the subarray.\\n\",\n `${n.toString()}`,\n ].join(\" \");\n },\n difficulty: 1,\n gen: (): number[] => {\n const len: number = getRandomInt(5, 40);\n const arr: number[] = [];\n arr.length = len;\n for (let i = 0; i < len; ++i) {\n arr[i] = getRandomInt(-10, 10);\n }\n\n return arr;\n },\n name: \"Subarray with Maximum Sum\",\n numTries: 10,\n solver: (data: number[], ans: string): boolean => {\n const nums: number[] = data.slice();\n for (let i = 1; i < nums.length; i++) {\n nums[i] = Math.max(nums[i], nums[i] + nums[i - 1]);\n }\n\n return parseInt(ans, 10) === Math.max(...nums);\n },\n },\n {\n desc: (n: number): string => {\n return [\n \"It is possible write four as a sum in exactly four different ways:\\n\\n\",\n \"    3 + 1\\n\",\n \"    2 + 2\\n\",\n \"    2 + 1 + 1\\n\",\n \"    1 + 1 + 1 + 1\\n\\n\",\n `How many different ways can the number ${n} be written as a sum of at least`,\n \"two positive integers?\",\n ].join(\" \");\n },\n difficulty: 1.5,\n gen: (): number => {\n return getRandomInt(8, 100);\n },\n name: \"Total Ways to Sum\",\n numTries: 10,\n solver: (data: number, ans: string): boolean => {\n const ways: number[] = [1];\n ways.length = data + 1;\n ways.fill(0, 1);\n for (let i = 1; i < data; ++i) {\n for (let j: number = i; j <= data; ++j) {\n ways[j] += ways[j - i];\n }\n }\n\n return ways[data] === parseInt(ans, 10);\n },\n },\n {\n desc: (n: number[][]): string => {\n let d: string = [\n \"Given the following array of array of numbers representing a 2D matrix,\",\n \"return the elements of the matrix as an array in spiral order:\\n\\n\",\n ].join(\" \");\n // for (const line of n) {\n // d += `${line.toString()},\\n`;\n // }\n d += \"    [\\n\";\n d += n\n .map(\n (line: number[]) => \"        [\" +\n line.map((x: number) => `${x}`.padStart(2, \" \")).join(\",\") +\n \"]\",\n )\n .join(\"\\n\");\n d += \"\\n    ]\\n\";\n d += [\n \"\\nHere is an example of what spiral order should be:\\n\\n\",\n \"    [\\n\",\n \"        [1, 2, 3]\\n\",\n \"        [4, 5, 6]\\n\",\n \"        [7, 8, 9]\\n\",\n \"    ]\\n\\n\",\n \"Answer: [1, 2, 3, 6, 9, 8 ,7, 4, 5]\\n\\n\",\n \"Note that the matrix will not always be square:\\n\\n\",\n \"    [\\n\",\n \"        [1,  2,  3,  4]\\n\",\n \"        [5,  6,  7,  8]\\n\",\n \"        [9, 10, 11, 12]\\n\",\n \"    ]\\n\\n\",\n \"Answer: [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]\",\n ].join(\" \");\n\n return d;\n },\n difficulty: 2,\n gen: (): number[][] => {\n const m: number = getRandomInt(1, 15);\n const n: number = getRandomInt(1, 15);\n const matrix: number[][] = [];\n matrix.length = m;\n for (let i = 0; i < m; ++i) {\n matrix[i] = [];\n matrix[i].length = n;\n }\n\n for (let i = 0; i < m; ++i) {\n for (let j = 0; j < n; ++j) {\n matrix[i][j] = getRandomInt(1, 50);\n }\n }\n\n return matrix;\n },\n name: \"Spiralize Matrix\",\n numTries: 10,\n solver: (data: number[][], ans: string): boolean => {\n const spiral: number[] = [];\n const m: number = data.length;\n const n: number = data[0].length;\n let u = 0;\n let d: number = m - 1;\n let l = 0;\n let r: number = n - 1;\n let k = 0;\n while (true) {\n // Up\n for (let col: number = l; col <= r; col++) {\n spiral[k] = data[u][col];\n ++k;\n }\n if (++u > d) {\n break;\n }\n\n // Right\n for (let row: number = u; row <= d; row++) {\n spiral[k] = data[row][r];\n ++k;\n }\n if (--r < l) {\n break;\n }\n\n // Down\n for (let col: number = r; col >= l; col--) {\n spiral[k] = data[d][col];\n ++k;\n }\n if (--d < u) {\n break;\n }\n\n // Left\n for (let row: number = d; row >= u; row--) {\n spiral[k] = data[row][l];\n ++k;\n }\n if (++l > r) {\n break;\n }\n }\n\n const sanitizedPlayerAns: string = removeBracketsFromArrayString(ans).replace(/\\s/g, \"\");\n const playerAns: any[] = sanitizedPlayerAns.split(\",\");\n for (let i = 0; i < playerAns.length; ++i) {\n playerAns[i] = parseInt(playerAns[i], 10);\n }\n if (spiral.length !== playerAns.length) {\n return false;\n }\n for (let i = 0; i < spiral.length; ++i) {\n if (spiral[i] !== playerAns[i]) {\n return false;\n }\n }\n\n return true;\n },\n },\n {\n desc: (arr: number[]): string => {\n return [\n \"You are given the following array of integers:\\n\\n\",\n `${arr}\\n\\n`,\n \"Each element in the array represents your MAXIMUM jump length\",\n \"at that position. This means that if you are at position i and your\",\n \"maximum jump length is n, you can jump to any position from\",\n \"i to i+n.\",\n \"\\n\\nAssuming you are initially positioned\",\n \"at the start of the array, determine whether you are\",\n \"able to reach the last index exactly.\\n\\n\",\n \"Your answer should be submitted as 1 or 0, representing true and false respectively\",\n ].join(\" \");\n },\n difficulty: 2.5,\n gen: (): number[] => {\n const len: number = getRandomInt(3, 25);\n const arr: number[] = [];\n arr.length = len;\n for (let i = 0; i < arr.length; ++i) {\n if (Math.random() < 0.2) {\n arr[i] = 0; // 20% chance of being 0\n } else {\n arr[i] = getRandomInt(0, 10);\n }\n }\n\n return arr;\n },\n name: \"Array Jumping Game\",\n numTries: 1,\n solver: (data: number[], ans: string): boolean => {\n const n: number = data.length;\n let i = 0;\n for (let reach = 0; i < n && i <= reach; ++i) {\n reach = Math.max(i + data[i], reach);\n }\n const solution: boolean = i === n;\n\n if (ans === \"1\" && solution) {\n return true;\n }\n if (ans === \"0\" && !solution) {\n return true;\n }\n\n return false;\n },\n },\n {\n desc: (arr: number[][]): string => {\n return [\n \"Given the following array of array of numbers representing a list of\",\n \"intervals, merge all overlapping intervals.\\n\\n\",\n `[${convert2DArrayToString(arr)}]\\n\\n`,\n \"Example:\\n\\n\",\n \"[[1, 3], [8, 10], [2, 6], [10, 16]]\\n\\n\",\n \"would merge into [[1, 6], [8, 16]].\\n\\n\",\n \"The intervals must be returned in ASCENDING order.\",\n \"You can assume that in an interval, the first number will always be\",\n \"smaller than the second.\",\n ].join(\" \");\n },\n difficulty: 3,\n gen: (): number[][] => {\n const intervals: number[][] = [];\n const numIntervals: number = getRandomInt(3, 20);\n for (let i = 0; i < numIntervals; ++i) {\n const start: number = getRandomInt(1, 25);\n const end: number = start + getRandomInt(1, 10);\n intervals.push([start, end]);\n }\n\n return intervals;\n },\n name: \"Merge Overlapping Intervals\",\n numTries: 15,\n solver: (data: number[][], ans: string): boolean => {\n const intervals: number[][] = data.slice();\n intervals.sort((a: number[], b: number[]) => {\n return a[0] - b[0];\n });\n\n const result: number[][] = [];\n let start: number = intervals[0][0];\n let end: number = intervals[0][1];\n for (const interval of intervals) {\n if (interval[0] <= end) {\n end = Math.max(end, interval[1]);\n } else {\n result.push([start, end]);\n start = interval[0];\n end = interval[1];\n }\n }\n result.push([start, end]);\n\n const sanitizedResult: string = convert2DArrayToString(result);\n const sanitizedAns: string = ans.replace(/\\s/g, \"\");\n\n return sanitizedResult === sanitizedAns || sanitizedResult === removeBracketsFromArrayString(sanitizedAns);\n },\n },\n {\n desc: (data: string): string => {\n return [\n \"Given the following string containing only digits, return\",\n \"an array with all possible valid IP address combinations\",\n \"that can be created from the string:\\n\\n\",\n `${data}\\n\\n`,\n \"Note that an octet cannot begin with a '0' unless the number\",\n \"itself is actually 0. For example, '192.168.010.1' is not a valid IP.\\n\\n\",\n \"Examples:\\n\\n\",\n \"25525511135 -> [255.255.11.135, 255.255.111.35]\\n\",\n \"1938718066 -> [193.87.180.66]\",\n ].join(\" \");\n },\n difficulty: 3,\n gen: (): string => {\n let str = \"\";\n for (let i = 0; i < 4; ++i) {\n const num: number = getRandomInt(0, 255);\n const convNum: string = num.toString();\n str += convNum;\n }\n\n return str;\n },\n name: \"Generate IP Addresses\",\n numTries: 10,\n solver: (data: string, ans: string): boolean => {\n const ret: string[] = [];\n for (let a = 1; a <= 3; ++a) {\n for (let b = 1; b <= 3; ++b) {\n for (let c = 1; c <= 3; ++c) {\n for (let d = 1; d <= 3; ++d) {\n if (a + b + c + d === data.length) {\n const A: number = parseInt(data.substring(0, a), 10);\n const B: number = parseInt(data.substring(a, a + b), 10);\n const C: number = parseInt(data.substring(a + b, a + b + c), 10);\n const D: number = parseInt(data.substring(a + b + c, a + b + c + d), 10);\n if (A <= 255 && B <= 255 && C <= 255 && D <= 255) {\n const ip: string = [A.toString(), \".\", B.toString(), \".\", C.toString(), \".\", D.toString()].join(\"\");\n if (ip.length === data.length + 3) {\n ret.push(ip);\n }\n }\n }\n }\n }\n }\n }\n\n const sanitizedAns: string = removeBracketsFromArrayString(ans).replace(/\\s/g, \"\");\n const ansArr: string[] = sanitizedAns.split(\",\");\n if (ansArr.length !== ret.length) {\n return false;\n }\n for (const ipInAns of ansArr) {\n if (!ret.includes(ipInAns)) {\n return false;\n }\n }\n\n return true;\n },\n },\n {\n desc: (data: number[]): string => {\n return [\n \"You are given the following array of stock prices (which are numbers)\",\n \"where the i-th element represents the stock price on day i:\\n\\n\",\n `${data}\\n\\n`,\n \"Determine the maximum possible profit you can earn using at most\",\n \"one transaction (i.e. you can only buy and sell the stock once). If no profit can be made\",\n \"then the answer should be 0. Note\",\n \"that you have to buy the stock before you can sell it\",\n ].join(\" \");\n },\n difficulty: 1,\n gen: (): number[] => {\n const len: number = getRandomInt(3, 50);\n const arr: number[] = [];\n arr.length = len;\n for (let i = 0; i < len; ++i) {\n arr[i] = getRandomInt(1, 200);\n }\n\n return arr;\n },\n name: \"Algorithmic Stock Trader I\",\n numTries: 5,\n solver: (data: number[], ans: string): boolean => {\n let maxCur = 0;\n let maxSoFar = 0;\n for (let i = 1; i < data.length; ++i) {\n maxCur = Math.max(0, (maxCur += data[i] - data[i - 1]));\n maxSoFar = Math.max(maxCur, maxSoFar);\n }\n\n return maxSoFar.toString() === ans;\n },\n },\n {\n desc: (data: number[]): string => {\n return [\n \"You are given the following array of stock prices (which are numbers)\",\n \"where the i-th element represents the stock price on day i:\\n\\n\",\n `${data}\\n\\n`,\n \"Determine the maximum possible profit you can earn using as many\",\n \"transactions as you'd like. A transaction is defined as buying\",\n \"and then selling one share of the stock. Note that you cannot\",\n \"engage in multiple transactions at once. In other words, you\",\n \"must sell the stock before you buy it again.\\n\\n\",\n \"If no profit can be made, then the answer should be 0\",\n ].join(\" \");\n },\n difficulty: 2,\n gen: (): number[] => {\n const len: number = getRandomInt(3, 50);\n const arr: number[] = [];\n arr.length = len;\n for (let i = 0; i < len; ++i) {\n arr[i] = getRandomInt(1, 200);\n }\n\n return arr;\n },\n name: \"Algorithmic Stock Trader II\",\n numTries: 10,\n solver: (data: number[], ans: string): boolean => {\n let profit = 0;\n for (let p = 1; p < data.length; ++p) {\n profit += Math.max(data[p] - data[p - 1], 0);\n }\n\n return profit.toString() === ans;\n },\n },\n {\n desc: (data: number[]): string => {\n return [\n \"You are given the following array of stock prices (which are numbers)\",\n \"where the i-th element represents the stock price on day i:\\n\\n\",\n `${data}\\n\\n`,\n \"Determine the maximum possible profit you can earn using at most\",\n \"two transactions. A transaction is defined as buying\",\n \"and then selling one share of the stock. Note that you cannot\",\n \"engage in multiple transactions at once. In other words, you\",\n \"must sell the stock before you buy it again.\\n\\n\",\n \"If no profit can be made, then the answer should be 0\",\n ].join(\" \");\n },\n difficulty: 5,\n gen: (): number[] => {\n const len: number = getRandomInt(3, 50);\n const arr: number[] = [];\n arr.length = len;\n for (let i = 0; i < len; ++i) {\n arr[i] = getRandomInt(1, 200);\n }\n\n return arr;\n },\n name: \"Algorithmic Stock Trader III\",\n numTries: 10,\n solver: (data: number[], ans: string): boolean => {\n let hold1: number = Number.MIN_SAFE_INTEGER;\n let hold2: number = Number.MIN_SAFE_INTEGER;\n let release1 = 0;\n let release2 = 0;\n for (const price of data) {\n release2 = Math.max(release2, hold2 + price);\n hold2 = Math.max(hold2, release1 - price);\n release1 = Math.max(release1, hold1 + price);\n hold1 = Math.max(hold1, price * -1);\n }\n\n return release2.toString() === ans;\n },\n },\n {\n desc: (data: any[]): string => {\n const k: number = data[0];\n const prices: number[] = data[1];\n return [\n \"You are given the following array with two elements:\\n\\n\",\n `[${k}, [${prices}]]\\n\\n`,\n \"The first element is an integer k. The second element is an\",\n \"array of stock prices (which are numbers) where the i-th element\",\n \"represents the stock price on day i.\\n\\n\",\n \"Determine the maximum possible profit you can earn using at most\",\n \"k transactions. A transaction is defined as buying and then selling\",\n \"one share of the stock. Note that you cannot engage in multiple\",\n \"transactions at once. In other words, you must sell the stock before\",\n \"you can buy it again.\\n\\n\",\n \"If no profit can be made, then the answer should be 0.\",\n ].join(\" \");\n },\n difficulty: 8,\n gen: (): any[] => {\n const k: number = getRandomInt(2, 10);\n const len: number = getRandomInt(3, 50);\n const prices: number[] = [];\n prices.length = len;\n for (let i = 0; i < len; ++i) {\n prices[i] = getRandomInt(1, 200);\n }\n\n return [k, prices];\n },\n name: \"Algorithmic Stock Trader IV\",\n numTries: 10,\n solver: (data: any[], ans: string): boolean => {\n const k: number = data[0];\n const prices: number[] = data[1];\n\n const len = prices.length;\n if (len < 2) {\n return parseInt(ans) === 0;\n }\n if (k > len / 2) {\n let res = 0;\n for (let i = 1; i < len; ++i) {\n res += Math.max(prices[i] - prices[i - 1], 0);\n }\n\n return parseInt(ans) === res;\n }\n\n const hold: number[] = [];\n const rele: number[] = [];\n hold.length = k + 1;\n rele.length = k + 1;\n for (let i = 0; i <= k; ++i) {\n hold[i] = Number.MIN_SAFE_INTEGER;\n rele[i] = 0;\n }\n\n let cur: number;\n for (let i = 0; i < len; ++i) {\n cur = prices[i];\n for (let j = k; j > 0; --j) {\n rele[j] = Math.max(rele[j], hold[j] + cur);\n hold[j] = Math.max(hold[j], rele[j - 1] - cur);\n }\n }\n\n return parseInt(ans) === rele[k];\n },\n },\n {\n desc: (data: number[][]): string => {\n function createTriangleRecurse(data: number[][], level = 0): string {\n const numLevels: number = data.length;\n if (level >= numLevels) {\n return \"\";\n }\n const numSpaces = numLevels - level + 1;\n\n let str: string = [\" \".repeat(numSpaces), \"[\", data[level].toString(), \"]\"].join(\"\");\n if (level < numLevels - 1) {\n str += \",\";\n }\n\n return str + \"\\n\" + createTriangleRecurse(data, level + 1);\n }\n\n function createTriangle(data: number[][]): string {\n return [\"[\\n\", createTriangleRecurse(data), \"]\"].join(\"\");\n }\n\n const triangle = createTriangle(data);\n\n return [\n \"Given a triangle, find the minimum path sum from top to bottom. In each step\",\n \"of the path, you may only move to adjacent numbers in the row below.\",\n \"The triangle is represented as a 2D array of numbers:\\n\\n\",\n `${triangle}\\n\\n`,\n \"Example: If you are given the following triangle:\\n\\n\" + \"[\\n\",\n \"     [2],\\n\",\n \"    [3,4],\\n\",\n \"   [6,5,7],\\n\",\n \"  [4,1,8,3]\\n\",\n \"]\\n\\n\",\n \"The minimum path sum is 11 (2 -> 3 -> 5 -> 1).\",\n ].join(\" \");\n },\n difficulty: 5,\n gen: (): number[][] => {\n const triangle: number[][] = [];\n const levels: number = getRandomInt(3, 12);\n triangle.length = levels;\n\n for (let row = 0; row < levels; ++row) {\n triangle[row] = [];\n triangle[row].length = row + 1;\n for (let i = 0; i < triangle[row].length; ++i) {\n triangle[row][i] = getRandomInt(1, 9);\n }\n }\n\n return triangle;\n },\n name: \"Minimum Path Sum in a Triangle\",\n numTries: 10,\n solver: (data: number[][], ans: string): boolean => {\n const n: number = data.length;\n const dp: number[] = data[n - 1].slice();\n for (let i = n - 2; i > -1; --i) {\n for (let j = 0; j < data[i].length; ++j) {\n dp[j] = Math.min(dp[j], dp[j + 1]) + data[i][j];\n }\n }\n\n return dp[0] === parseInt(ans);\n },\n },\n {\n desc: (data: number[]): string => {\n const numRows = data[0];\n const numColumns = data[1];\n return [\n \"You are in a grid with\",\n `${numRows} rows and ${numColumns} columns, and you are`,\n \"positioned in the top-left corner of that grid. You are trying to\",\n \"reach the bottom-right corner of the grid, but you can only\",\n \"move down or right on each step. Determine how many\",\n \"unique paths there are from start to finish.\\n\\n\",\n \"NOTE: The data returned for this contract is an array\",\n \"with the number of rows and columns:\\n\\n\",\n `[${numRows}, ${numColumns}]`,\n ].join(\" \");\n },\n difficulty: 3,\n gen: (): number[] => {\n const numRows: number = getRandomInt(2, 14);\n const numColumns: number = getRandomInt(2, 14);\n\n return [numRows, numColumns];\n },\n name: \"Unique Paths in a Grid I\",\n numTries: 10,\n solver: (data: number[], ans: string): boolean => {\n const n: number = data[0]; // Number of rows\n const m: number = data[1]; // Number of columns\n const currentRow: number[] = [];\n currentRow.length = n;\n\n for (let i = 0; i < n; i++) {\n currentRow[i] = 1;\n }\n for (let row = 1; row < m; row++) {\n for (let i = 1; i < n; i++) {\n currentRow[i] += currentRow[i - 1];\n }\n }\n\n return parseInt(ans) === currentRow[n - 1];\n },\n },\n {\n desc: (data: number[][]): string => {\n let gridString = \"\";\n for (const line of data) {\n gridString += `${line.toString()},\\n`;\n }\n return [\n \"You are located in the top-left corner of the following grid:\\n\\n\",\n `${gridString}\\n`,\n \"You are trying reach the bottom-right corner of the grid, but you can only\",\n \"move down or right on each step. Furthermore, there are obstacles on the grid\",\n \"that you cannot move onto. These obstacles are denoted by '1', while empty\",\n \"spaces are denoted by 0.\\n\\n\",\n \"Determine how many unique paths there are from start to finish.\\n\\n\",\n \"NOTE: The data returned for this contract is an 2D array of numbers representing the grid.\",\n ].join(\" \");\n },\n difficulty: 5,\n gen: (): number[][] => {\n const numRows: number = getRandomInt(2, 12);\n const numColumns: number = getRandomInt(2, 12);\n\n const grid: number[][] = [];\n grid.length = numRows;\n for (let i = 0; i < numRows; ++i) {\n grid[i] = [];\n grid[i].length = numColumns;\n grid[i].fill(0);\n }\n\n for (let r = 0; r < numRows; ++r) {\n for (let c = 0; c < numColumns; ++c) {\n if (r === 0 && c === 0) {\n continue;\n }\n if (r === numRows - 1 && c === numColumns - 1) {\n continue;\n }\n\n // 15% chance of an element being an obstacle\n if (Math.random() < 0.15) {\n grid[r][c] = 1;\n }\n }\n }\n\n return grid;\n },\n name: \"Unique Paths in a Grid II\",\n numTries: 10,\n solver: (data: number[][], ans: string): boolean => {\n const obstacleGrid: number[][] = [];\n obstacleGrid.length = data.length;\n for (let i = 0; i < obstacleGrid.length; ++i) {\n obstacleGrid[i] = data[i].slice();\n }\n\n for (let i = 0; i < obstacleGrid.length; i++) {\n for (let j = 0; j < obstacleGrid[0].length; j++) {\n if (obstacleGrid[i][j] == 1) {\n obstacleGrid[i][j] = 0;\n } else if (i == 0 && j == 0) {\n obstacleGrid[0][0] = 1;\n } else {\n obstacleGrid[i][j] = (i > 0 ? obstacleGrid[i - 1][j] : 0) + (j > 0 ? obstacleGrid[i][j - 1] : 0);\n }\n }\n }\n\n return obstacleGrid[obstacleGrid.length - 1][obstacleGrid[0].length - 1] === parseInt(ans);\n },\n },\n {\n desc: (data: string): string => {\n return [\n \"Given the following string:\\n\\n\",\n `${data}\\n\\n`,\n \"remove the minimum number of invalid parentheses in order to validate\",\n \"the string. If there are multiple minimal ways to validate the string,\",\n \"provide all of the possible results. The answer should be provided\",\n \"as an array of strings. If it is impossible to validate the string\",\n \"the result should be an array with only an empty string.\\n\\n\",\n \"IMPORTANT: The string may contain letters, not just parentheses.\",\n `Examples:\\n`,\n `\"()())()\" -> [()()(), (())()]\\n`,\n `\"(a)())()\" -> [(a)()(), (a())()]\\n`,\n `\")( -> [\"\"]`,\n ].join(\" \");\n },\n difficulty: 10,\n gen: (): string => {\n const len: number = getRandomInt(6, 20);\n const chars: string[] = [];\n chars.length = len;\n\n // 80% chance of the first parenthesis being (\n Math.random() < 0.8 ? (chars[0] = \"(\") : (chars[0] = \")\");\n\n for (let i = 1; i < len; ++i) {\n const roll = Math.random();\n if (roll < 0.4) {\n chars[i] = \"(\";\n } else if (roll < 0.8) {\n chars[i] = \")\";\n } else {\n chars[i] = \"a\";\n }\n }\n\n return chars.join(\"\");\n },\n name: \"Sanitize Parentheses in Expression\",\n numTries: 10,\n solver: (data: string, ans: string): boolean => {\n let left = 0;\n let right = 0;\n const res: string[] = [];\n\n for (let i = 0; i < data.length; ++i) {\n if (data[i] === \"(\") {\n ++left;\n } else if (data[i] === \")\") {\n left > 0 ? --left : ++right;\n }\n }\n\n function dfs(\n pair: number,\n index: number,\n left: number,\n right: number,\n s: string,\n solution: string,\n res: string[],\n ): void {\n if (s.length === index) {\n if (left === 0 && right === 0 && pair === 0) {\n for (let i = 0; i < res.length; i++) {\n if (res[i] === solution) {\n return;\n }\n }\n res.push(solution);\n }\n return;\n }\n\n if (s[index] === \"(\") {\n if (left > 0) {\n dfs(pair, index + 1, left - 1, right, s, solution, res);\n }\n dfs(pair + 1, index + 1, left, right, s, solution + s[index], res);\n } else if (s[index] === \")\") {\n if (right > 0) dfs(pair, index + 1, left, right - 1, s, solution, res);\n if (pair > 0) dfs(pair - 1, index + 1, left, right, s, solution + s[index], res);\n } else {\n dfs(pair, index + 1, left, right, s, solution + s[index], res);\n }\n }\n\n dfs(0, 0, left, right, data, \"\", res);\n\n const sanitizedPlayerAns = removeBracketsFromArrayString(ans).replace(/\\s/g, \"\");\n\n const playerAnsArray: string[] = sanitizedPlayerAns.split(\",\");\n if (playerAnsArray.length !== res.length) {\n return false;\n }\n for (const resultInAnswer of res) {\n if (!playerAnsArray.includes(resultInAnswer)) {\n return false;\n }\n }\n\n return true;\n },\n },\n {\n desc: (data: any[]): string => {\n const digits: string = data[0];\n const target: number = data[1];\n\n return [\n \"You are given the following string which contains only digits between 0 and 9:\\n\\n\",\n `${digits}\\n\\n`,\n `You are also given a target number of ${target}. Return all possible ways`,\n \"you can add the +, -, and * operators to the string such that it evaluates\",\n \"to the target number.\\n\\n\",\n \"The provided answer should be an array of strings containing the valid expressions.\",\n \"The data provided by this problem is an array with two elements. The first element\",\n \"is the string of digits, while the second element is the target number:\\n\\n\",\n `[\"${digits}\", ${target}]\\n\\n`,\n \"NOTE: Numbers in the expression cannot have leading 0's. In other words,\",\n `\"1+01\" is not a valid expression`,\n \"Examples:\\n\\n\",\n `Input: digits = \"123\", target = 6\\n`,\n `Output: [1+2+3, 1*2*3]\\n\\n`,\n `Input: digits = \"105\", target = 5\\n`,\n `Output: [1*0+5, 10-5]`,\n ].join(\" \");\n },\n difficulty: 10,\n gen: (): any[] => {\n const numDigits = getRandomInt(4, 12);\n const digitsArray: string[] = [];\n digitsArray.length = numDigits;\n for (let i = 0; i < digitsArray.length; ++i) {\n if (i === 0) {\n digitsArray[i] = String(getRandomInt(1, 9));\n } else {\n digitsArray[i] = String(getRandomInt(0, 9));\n }\n }\n\n const target: number = getRandomInt(-100, 100);\n const digits: string = digitsArray.join(\"\");\n\n return [digits, target];\n },\n name: \"Find All Valid Math Expressions\",\n numTries: 10,\n solver: (data: any[], ans: string): boolean => {\n const num: string = data[0];\n const target: number = data[1];\n\n function helper(\n res: string[],\n path: string,\n num: string,\n target: number,\n pos: number,\n evaluated: number,\n multed: number,\n ): void {\n if (pos === num.length) {\n if (target === evaluated) {\n res.push(path);\n }\n return;\n }\n\n for (let i = pos; i < num.length; ++i) {\n if (i != pos && num[pos] == \"0\") {\n break;\n }\n const cur = parseInt(num.substring(pos, i + 1));\n\n if (pos === 0) {\n helper(res, path + cur, num, target, i + 1, cur, cur);\n } else {\n helper(res, path + \"+\" + cur, num, target, i + 1, evaluated + cur, cur);\n helper(res, path + \"-\" + cur, num, target, i + 1, evaluated - cur, -cur);\n helper(res, path + \"*\" + cur, num, target, i + 1, evaluated - multed + multed * cur, multed * cur);\n }\n }\n }\n\n const sanitizedPlayerAns: string = removeBracketsFromArrayString(ans);\n const sanitizedPlayerAnsArr: string[] = sanitizedPlayerAns.split(\",\");\n for (let i = 0; i < sanitizedPlayerAnsArr.length; ++i) {\n sanitizedPlayerAnsArr[i] = removeQuotesFromString(sanitizedPlayerAnsArr[i]).replace(/\\s/g, \"\");\n }\n\n if (num == null || num.length === 0) {\n if (sanitizedPlayerAnsArr.length === 0) {\n return true;\n }\n if (sanitizedPlayerAnsArr.length === 1 && sanitizedPlayerAnsArr[0] === \"\") {\n return true;\n }\n return false;\n }\n\n const result: string[] = [];\n helper(result, \"\", num, target, 0, 0, 0);\n\n for (const expr of result) {\n if (!sanitizedPlayerAnsArr.includes(expr)) {\n return false;\n }\n }\n\n return true;\n },\n },\n];\n","/**\n * React component for a popup content container\n *\n * Takes in a prop for rendering the content inside the popup\n */\nimport React, { useEffect } from \"react\";\n\ninterface IProps {\n content: (props: T) => React.ReactElement;\n id: string;\n props: T;\n removePopup: () => void;\n}\n\nexport function Popup(props: IProps): React.ReactElement {\n function keyDown(event: KeyboardEvent): void {\n if (event.key === \"Escape\") props.removePopup();\n }\n\n useEffect(() => {\n document.addEventListener(\"keydown\", keyDown);\n return () => {\n document.removeEventListener(\"keydown\", keyDown);\n };\n });\n\n return (\n
\n {React.createElement(props.content, props.props)}\n
\n );\n}\n","import React, { useState } from \"react\";\nimport { KEY } from \"../../../utils/helpers/keyCodes\";\n\nimport { CodingContract, CodingContractType, CodingContractTypes } from \"../../CodingContracts\";\nimport { ClickableTag, CopyableText } from \"./CopyableText\";\n\ntype IProps = {\n c: CodingContract;\n popupId: string;\n onClose: () => void;\n onAttempt: (answer: string) => void;\n};\n\nexport function CodingContractPopup(props: IProps): React.ReactElement {\n const [answer, setAnswer] = useState(\"\");\n\n function onChange(event: React.ChangeEvent): void {\n setAnswer(event.target.value);\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n // React just won't cooperate on this one.\n // \"React.KeyboardEvent\" seems like the right type but\n // whatever ...\n const value = (event.target as any).value;\n\n if (event.keyCode === KEY.ENTER && value !== \"\") {\n event.preventDefault();\n props.onAttempt(answer);\n }\n }\n\n const contractType: CodingContractType = CodingContractTypes[props.c.type];\n const description = [];\n for (const [i, value] of contractType.desc(props.c.data).split(\"\\n\").entries())\n description.push(\" }}>);\n return (\n
\n \n
\n
\n

\n You are attempting to solve a Coding Contract. You have {props.c.getMaxNumTries() - props.c.tries} tries\n remaining, after which the contract will self-destruct.\n

\n
\n

{description}

\n
\n \n \n
\n );\n}\n","import { BaseServer } from \"../Server/BaseServer\";\nimport { ITerminal } from \"../Terminal/ITerminal\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { IRouter } from \"../ui/Router\";\n\nexport interface IProgramCreate {\n level: number;\n req(p: IPlayer): boolean; // Function that indicates whether player meets requirements\n time: number;\n tooltip: string;\n}\n\nexport class Program {\n name = \"\";\n create: IProgramCreate | null;\n run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer, args: string[]) => void;\n\n constructor(\n name: string,\n create: IProgramCreate | null,\n run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer, args: string[]) => void,\n ) {\n this.name = name;\n this.create = create;\n this.run = run;\n }\n\n htmlID(): string {\n const name = this.name.endsWith(\".exe\") ? this.name.slice(0, -\".exe\".length) : this.name;\n return \"create-program-\" + name;\n }\n}\n","import { IProgramCreate } from \"../Program\";\nimport { CONSTANTS } from \"../../Constants\";\nimport { BaseServer } from \"../../Server/BaseServer\";\nimport { Server } from \"../../Server/Server\";\nimport { ITerminal } from \"../../Terminal/ITerminal\";\nimport { IRouter } from \"../../ui/Router\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { HacknetServer } from \"../../Hacknet/HacknetServer\";\nimport { convertTimeMsToTimeElapsedString } from \"../../../utils/StringHelperFunctions\";\nimport { getServer } from \"../../Server/ServerHelpers\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { BitNodeMultipliers } from \"../../BitNode/BitNodeMultipliers\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { BitFlumePopup } from \"../../BitNode/ui/BitFlumePopup\";\n\nimport { calculateHackingTime, calculateGrowTime, calculateWeakenTime } from \"../../Hacking\";\n\nfunction requireHackingLevel(lvl: number) {\n return function (p: IPlayer) {\n return p.hacking_skill >= lvl;\n };\n}\n\nfunction bitFlumeRequirements() {\n return function (p: IPlayer) {\n return p.sourceFiles.length > 0 && p.hacking_skill >= 1;\n };\n}\n\nexport interface IProgramCreationParams {\n key: string;\n name: string;\n create: IProgramCreate | null;\n run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer, args: string[]) => void;\n}\n\nexport const programsMetadata: IProgramCreationParams[] = [\n {\n key: \"NukeProgram\",\n name: \"NUKE.exe\",\n create: {\n level: 1,\n tooltip: \"This virus is used to gain root access to a machine if enough ports are opened.\",\n req: requireHackingLevel(1),\n time: CONSTANTS.MillisecondsPerFiveMinutes,\n },\n run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer): void => {\n if (!(server instanceof Server)) {\n terminal.error(\"Cannot nuke this kind of server.\");\n return;\n }\n if (server.hasAdminRights) {\n terminal.print(\"You already have root access to this computer. There is no reason to run NUKE.exe\");\n return;\n }\n\n if (server.openPortCount >= player.getCurrentServer().numOpenPortsRequired) {\n server.hasAdminRights = true;\n terminal.print(\"NUKE successful! Gained root access to \" + player.getCurrentServer().hostname);\n // TODO: Make this take time rather than be instant\n return;\n }\n\n terminal.print(\"NUKE unsuccessful. Not enough ports have been opened\");\n },\n },\n {\n key: \"BruteSSHProgram\",\n name: \"BruteSSH.exe\",\n create: {\n level: 50,\n tooltip: \"This program executes a brute force attack that opens SSH ports\",\n req: requireHackingLevel(50),\n time: CONSTANTS.MillisecondsPerFiveMinutes * 2,\n },\n run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer): void => {\n if (!(server instanceof Server)) {\n terminal.error(\"Cannot run BruteSSH.exe on this kind of server.\");\n return;\n }\n if (server.sshPortOpen) {\n terminal.print(\"SSH Port (22) is already open!\");\n return;\n }\n\n server.sshPortOpen = true;\n terminal.print(\"Opened SSH Port(22)!\");\n server.openPortCount++;\n },\n },\n {\n key: \"FTPCrackProgram\",\n name: \"FTPCrack.exe\",\n create: {\n level: 100,\n tooltip: \"This program cracks open FTP ports\",\n req: requireHackingLevel(100),\n time: CONSTANTS.MillisecondsPerHalfHour,\n },\n run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer): void => {\n if (!(server instanceof Server)) {\n terminal.error(\"Cannot run FTPCrack.exe on this kind of server.\");\n return;\n }\n if (server.ftpPortOpen) {\n terminal.print(\"FTP Port (21) is already open!\");\n return;\n }\n\n server.ftpPortOpen = true;\n terminal.print(\"Opened FTP Port (21)!\");\n server.openPortCount++;\n },\n },\n {\n key: \"RelaySMTPProgram\",\n name: \"relaySMTP.exe\",\n create: {\n level: 250,\n tooltip: \"This program opens SMTP ports by redirecting data\",\n req: requireHackingLevel(250),\n time: CONSTANTS.MillisecondsPer2Hours,\n },\n run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer): void => {\n if (!(server instanceof Server)) {\n terminal.error(\"Cannot run relaySMTP.exe on this kind of server.\");\n return;\n }\n if (server.smtpPortOpen) {\n terminal.print(\"SMTP Port (25) is already open!\");\n return;\n }\n\n server.smtpPortOpen = true;\n terminal.print(\"Opened SMTP Port (25)!\");\n server.openPortCount++;\n },\n },\n {\n key: \"HTTPWormProgram\",\n name: \"HTTPWorm.exe\",\n create: {\n level: 500,\n tooltip: \"This virus opens up HTTP ports\",\n req: requireHackingLevel(500),\n time: CONSTANTS.MillisecondsPer4Hours,\n },\n run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer): void => {\n if (!(server instanceof Server)) {\n terminal.error(\"Cannot run HTTPWorm.exe on this kind of server.\");\n return;\n }\n if (server.httpPortOpen) {\n terminal.print(\"HTTP Port (80) is already open!\");\n return;\n }\n\n server.httpPortOpen = true;\n terminal.print(\"Opened HTTP Port (80)!\");\n server.openPortCount++;\n },\n },\n {\n key: \"SQLInjectProgram\",\n name: \"SQLInject.exe\",\n create: {\n level: 750,\n tooltip: \"This virus opens SQL ports\",\n req: requireHackingLevel(750),\n time: CONSTANTS.MillisecondsPer8Hours,\n },\n run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer): void => {\n if (!(server instanceof Server)) {\n terminal.error(\"Cannot run SQLInject.exe on this kind of server.\");\n return;\n }\n if (server.sqlPortOpen) {\n terminal.print(\"SQL Port (1433) is already open!\");\n return;\n }\n\n server.sqlPortOpen = true;\n terminal.print(\"Opened SQL Port (1433)!\");\n server.openPortCount++;\n },\n },\n {\n key: \"DeepscanV1\",\n name: \"DeepscanV1.exe\",\n create: {\n level: 75,\n tooltip: \"This program allows you to use the scan-analyze command with a depth up to 5\",\n req: requireHackingLevel(75),\n time: CONSTANTS.MillisecondsPerQuarterHour,\n },\n run: (router: IRouter, terminal: ITerminal): void => {\n terminal.print(\"This executable cannot be run.\");\n terminal.print(\"DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5.\");\n },\n },\n {\n key: \"DeepscanV2\",\n name: \"DeepscanV2.exe\",\n create: {\n level: 400,\n tooltip: \"This program allows you to use the scan-analyze command with a depth up to 10\",\n req: requireHackingLevel(400),\n time: CONSTANTS.MillisecondsPer2Hours,\n },\n run: (router: IRouter, terminal: ITerminal): void => {\n terminal.print(\"This executable cannot be run.\");\n terminal.print(\"DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10.\");\n },\n },\n {\n key: \"ServerProfiler\",\n name: \"ServerProfiler.exe\",\n create: {\n level: 75,\n tooltip: \"This program is used to display hacking and Netscript-related information about servers\",\n req: requireHackingLevel(75),\n time: CONSTANTS.MillisecondsPerHalfHour,\n },\n run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer, args: string[]): void => {\n if (args.length !== 1) {\n terminal.print(\"Must pass a server hostname or IP as an argument for ServerProfiler.exe\");\n return;\n }\n\n const targetServer = getServer(args[0]);\n if (targetServer == null) {\n terminal.print(\"Invalid server IP/hostname\");\n return;\n }\n\n if (targetServer instanceof HacknetServer) {\n terminal.print(`ServerProfiler.exe cannot be run on a Hacknet Server.`);\n return;\n }\n\n terminal.print(targetServer.hostname + \":\");\n terminal.print(\"Server base security level: \" + targetServer.baseDifficulty);\n terminal.print(\"Server current security level: \" + targetServer.hackDifficulty);\n terminal.print(\"Server growth rate: \" + targetServer.serverGrowth);\n terminal.print(\n `Netscript hack() execution time: ${convertTimeMsToTimeElapsedString(\n calculateHackingTime(targetServer, player) * 1000,\n true,\n )}`,\n );\n terminal.print(\n `Netscript grow() execution time: ${convertTimeMsToTimeElapsedString(\n calculateGrowTime(targetServer, player) * 1000,\n true,\n )}`,\n );\n terminal.print(\n `Netscript weaken() execution time: ${convertTimeMsToTimeElapsedString(\n calculateWeakenTime(targetServer, player) * 1000,\n true,\n )}`,\n );\n },\n },\n {\n key: \"AutoLink\",\n name: \"AutoLink.exe\",\n create: {\n level: 25,\n tooltip: \"This program allows you to directly connect to other servers through the 'scan-analyze' command\",\n req: requireHackingLevel(25),\n time: CONSTANTS.MillisecondsPerQuarterHour,\n },\n run: (router: IRouter, terminal: ITerminal): void => {\n terminal.print(\"This executable cannot be run.\");\n terminal.print(\"AutoLink.exe lets you automatically connect to other servers when using 'scan-analyze'.\");\n terminal.print(\"When using scan-analyze, click on a server's hostname to connect to it.\");\n },\n },\n {\n key: \"BitFlume\",\n name: \"b1t_flum3.exe\",\n create: {\n level: 1,\n tooltip: \"This program creates a portal to the BitNode Nexus (allows you to restart and switch BitNodes)\",\n req: bitFlumeRequirements(),\n time: CONSTANTS.MillisecondsPerFiveMinutes / 20,\n },\n run: (router: IRouter, terminal: ITerminal, player: IPlayer): void => {\n const popupId = \"bitflume-popup\";\n createPopup(popupId, BitFlumePopup, {\n player: player,\n router: router,\n popupId: popupId,\n });\n },\n },\n {\n key: \"Flight\",\n name: \"fl1ght.exe\",\n create: null,\n run: (router: IRouter, terminal: ITerminal, player: IPlayer): void => {\n const numAugReq = Math.round(BitNodeMultipliers.DaedalusAugsRequirement * 30);\n const fulfilled =\n player.augmentations.length >= numAugReq && player.money.gt(1e11) && player.hacking_skill >= 2500;\n if (!fulfilled) {\n terminal.print(`Augmentations: ${player.augmentations.length} / ${numAugReq}`);\n terminal.print(`Money: ${numeralWrapper.formatMoney(player.money.toNumber())} / $100b`);\n terminal.print(`Hacking skill: ${player.hacking_skill} / 2500`);\n return;\n }\n\n terminal.print(\"We will contact you.\");\n terminal.print(\"-- Daedalus --\");\n },\n },\n];\n","// Function that generates a random gibberish string of length n\nconst chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\nexport function createRandomString(n: number): string {\n let str = \"\";\n\n for (let i = 0; i < n; ++i) {\n str += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n\n return str;\n}\n","// tslint:disable:max-file-line-count\n\n// This could actually be a JSON file as it should be constant metadata to be imported...\nimport { IMinMaxRange } from \"../../types\";\nimport { LocationName } from \"../../Locations/data/LocationNames\";\nimport { LiteratureNames } from \"../../Literature/data/LiteratureNames\";\n\n/**\n * The metadata describing the base state of servers on the network.\n * These values will be adjusted based on Bitnode multipliers when the Server objects are built out.\n */\ninterface IServerMetadata {\n /**\n * When populated, the base security level of the server.\n */\n hackDifficulty?: number | IMinMaxRange;\n\n /**\n * The DNS name of the server.\n */\n hostname: string;\n\n /**\n * When populated, the files will be added to the server when created.\n */\n literature?: string[];\n\n /**\n * When populated, the exponent of 2^x amount of RAM the server has.\n * This should be in the range of 1-20, to match the Player's max RAM.\n */\n maxRamExponent?: number | IMinMaxRange;\n\n /**\n * How much money the server starts out with.\n */\n moneyAvailable: number | IMinMaxRange;\n\n /**\n * The number of network layers away from the `home` server.\n * This value is between 1 and 15.\n * If this is not populated, @specialName should be.\n */\n networkLayer?: number | IMinMaxRange;\n\n /**\n * The number of ports that must be opened before the player can execute NUKE.\n */\n numOpenPortsRequired: number;\n\n /**\n * The organization that the server belongs to.\n */\n organizationName: string;\n\n /**\n * The minimum hacking level before the player can run NUKE.\n */\n requiredHackingSkill: number | IMinMaxRange;\n\n /**\n * The growth factor for the server.\n */\n serverGrowth?: number | IMinMaxRange;\n\n /**\n * A \"unique\" server that has special implications when the player manually hacks it.\n */\n specialName?: string;\n\n [key: string]: any;\n}\n\n/**\n * The metadata for building up the servers on the network.\n */\nexport const serverMetadata: IServerMetadata[] = [\n {\n hackDifficulty: 99,\n hostname: \"ecorp\",\n moneyAvailable: {\n max: 70e9,\n min: 30e9,\n },\n networkLayer: 15,\n numOpenPortsRequired: 5,\n organizationName: LocationName.AevumECorp,\n requiredHackingSkill: {\n max: 1400,\n min: 1050,\n },\n serverGrowth: 99,\n specialName: LocationName.AevumECorp,\n },\n {\n hackDifficulty: 99,\n hostname: \"megacorp\",\n moneyAvailable: {\n max: 60e9,\n min: 40e9,\n },\n networkLayer: 15,\n numOpenPortsRequired: 5,\n organizationName: LocationName.Sector12MegaCorp,\n requiredHackingSkill: {\n max: 1350,\n min: 1100,\n },\n serverGrowth: 99,\n specialName: LocationName.Sector12MegaCorp,\n },\n {\n hackDifficulty: {\n max: 88,\n min: 72,\n },\n hostname: \"b-and-a\",\n moneyAvailable: {\n max: 30e9,\n min: 15e9,\n },\n networkLayer: 14,\n numOpenPortsRequired: 5,\n organizationName: LocationName.AevumBachmanAndAssociates,\n requiredHackingSkill: {\n max: 1150,\n min: 900,\n },\n serverGrowth: {\n max: 80,\n min: 60,\n },\n specialName: LocationName.AevumBachmanAndAssociates,\n },\n {\n hackDifficulty: {\n max: 97,\n min: 88,\n },\n hostname: \"blade\",\n literature: [LiteratureNames.BeyondMan],\n maxRamExponent: {\n max: 9,\n min: 5,\n },\n moneyAvailable: {\n max: 40e9,\n min: 10e9,\n },\n networkLayer: 14,\n numOpenPortsRequired: 5,\n organizationName: LocationName.Sector12BladeIndustries,\n requiredHackingSkill: {\n max: 1200,\n min: 900,\n },\n serverGrowth: {\n max: 85,\n min: 55,\n },\n specialName: LocationName.Sector12BladeIndustries,\n },\n {\n hackDifficulty: 99,\n hostname: \"nwo\",\n literature: [LiteratureNames.TheHiddenWorld],\n moneyAvailable: {\n max: 40e9,\n min: 20e9,\n },\n networkLayer: 14,\n numOpenPortsRequired: 5,\n organizationName: LocationName.VolhavenNWO,\n requiredHackingSkill: {\n max: 1300,\n min: 950,\n },\n serverGrowth: {\n max: 95,\n min: 65,\n },\n specialName: LocationName.VolhavenNWO,\n },\n {\n hackDifficulty: {\n max: 65,\n min: 45,\n },\n hostname: \"clarkinc\",\n literature: [LiteratureNames.BeyondMan, LiteratureNames.CostOfImmortality],\n moneyAvailable: {\n max: 25e9,\n min: 15e9,\n },\n networkLayer: 14,\n numOpenPortsRequired: 5,\n organizationName: LocationName.AevumClarkeIncorporated,\n requiredHackingSkill: {\n max: 1250,\n min: 950,\n },\n serverGrowth: {\n max: 75,\n min: 45,\n },\n specialName: LocationName.AevumClarkeIncorporated,\n },\n {\n hackDifficulty: {\n max: 99,\n min: 90,\n },\n hostname: \"omnitek\",\n literature: [LiteratureNames.CodedIntelligence, LiteratureNames.HistoryOfSynthoids],\n maxRamExponent: {\n max: 9,\n min: 7,\n },\n moneyAvailable: {\n max: 22e9,\n min: 13e9,\n },\n networkLayer: 13,\n numOpenPortsRequired: 5,\n organizationName: LocationName.VolhavenOmniTekIncorporated,\n requiredHackingSkill: {\n max: 1100,\n min: 900,\n },\n serverGrowth: {\n max: 99,\n min: 95,\n },\n specialName: LocationName.VolhavenOmniTekIncorporated,\n },\n {\n hackDifficulty: {\n max: 75,\n min: 55,\n },\n hostname: \"4sigma\",\n moneyAvailable: {\n max: 25e9,\n min: 15e9,\n },\n networkLayer: 13,\n numOpenPortsRequired: 5,\n organizationName: LocationName.Sector12FourSigma,\n requiredHackingSkill: {\n max: 1250,\n min: 900,\n },\n serverGrowth: {\n max: 99,\n min: 75,\n },\n specialName: LocationName.Sector12FourSigma,\n },\n {\n hackDifficulty: {\n max: 99,\n min: 95,\n },\n hostname: \"kuai-gong\",\n moneyAvailable: {\n max: 30e9,\n min: 20e9,\n },\n networkLayer: 13,\n numOpenPortsRequired: 5,\n organizationName: LocationName.ChongqingKuaiGongInternational,\n requiredHackingSkill: {\n max: 1300,\n min: 950,\n },\n serverGrowth: {\n max: 99,\n min: 90,\n },\n specialName: LocationName.ChongqingKuaiGongInternational,\n },\n {\n hackDifficulty: {\n max: 97,\n min: 83,\n },\n hostname: \"fulcrumtech\",\n literature: [LiteratureNames.SimulatedReality],\n maxRamExponent: {\n max: 11,\n min: 7,\n },\n moneyAvailable: {\n max: 1800e6,\n min: 1400e6,\n },\n networkLayer: 12,\n numOpenPortsRequired: 5,\n organizationName: LocationName.AevumFulcrumTechnologies,\n requiredHackingSkill: {\n max: 1250,\n min: 950,\n },\n serverGrowth: {\n max: 99,\n min: 80,\n },\n specialName: LocationName.AevumFulcrumTechnologies,\n },\n {\n hackDifficulty: 99,\n hostname: \"fulcrumassets\",\n moneyAvailable: 1e6,\n networkLayer: 15,\n numOpenPortsRequired: 5,\n organizationName: LocationName.AevumFulcrumTechnologies,\n requiredHackingSkill: {\n max: 1600,\n min: 1100,\n },\n serverGrowth: 1,\n specialName: \"Fulcrum Secret Technologies Server\",\n },\n {\n hackDifficulty: {\n max: 92,\n min: 78,\n },\n hostname: \"stormtech\",\n moneyAvailable: {\n max: 1200e6,\n min: 1000e6,\n },\n networkLayer: 12,\n numOpenPortsRequired: 5,\n organizationName: LocationName.IshimaStormTechnologies,\n requiredHackingSkill: {\n max: 1075,\n min: 875,\n },\n serverGrowth: {\n max: 92,\n min: 68,\n },\n specialName: LocationName.IshimaStormTechnologies,\n },\n {\n hackDifficulty: {\n max: 96,\n min: 84,\n },\n hostname: \"defcomm\",\n moneyAvailable: {\n max: 950e6,\n min: 800e6,\n },\n networkLayer: 9,\n numOpenPortsRequired: 5,\n organizationName: LocationName.NewTokyoDefComm,\n requiredHackingSkill: {\n max: 1050,\n min: 850,\n },\n serverGrowth: {\n max: 73,\n min: 47,\n },\n specialName: LocationName.NewTokyoDefComm,\n },\n {\n hackDifficulty: {\n max: 90,\n min: 70,\n },\n hostname: \"infocomm\",\n moneyAvailable: {\n max: 900e6,\n min: 600e6,\n },\n networkLayer: 10,\n numOpenPortsRequired: 5,\n organizationName: \"InfoComm\",\n requiredHackingSkill: {\n max: 950,\n min: 875,\n },\n serverGrowth: {\n max: 75,\n min: 35,\n },\n },\n {\n hackDifficulty: {\n max: 95,\n min: 85,\n },\n hostname: \"helios\",\n literature: [LiteratureNames.BeyondMan],\n maxRamExponent: {\n max: 8,\n min: 5,\n },\n moneyAvailable: {\n max: 750e6,\n min: 550e6,\n },\n networkLayer: 12,\n numOpenPortsRequired: 5,\n organizationName: LocationName.VolhavenHeliosLabs,\n requiredHackingSkill: {\n max: 900,\n min: 800,\n },\n serverGrowth: {\n max: 80,\n min: 70,\n },\n specialName: LocationName.VolhavenHeliosLabs,\n },\n {\n hackDifficulty: {\n max: 90,\n min: 80,\n },\n hostname: \"vitalife\",\n literature: [LiteratureNames.AGreenTomorrow],\n maxRamExponent: {\n max: 7,\n min: 4,\n },\n moneyAvailable: {\n max: 800e6,\n min: 700e6,\n },\n networkLayer: 12,\n numOpenPortsRequired: 5,\n organizationName: LocationName.NewTokyoVitaLife,\n requiredHackingSkill: {\n max: 900,\n min: 775,\n },\n serverGrowth: {\n max: 80,\n min: 60,\n },\n specialName: LocationName.NewTokyoVitaLife,\n },\n {\n hackDifficulty: {\n max: 95,\n min: 85,\n },\n hostname: \"icarus\",\n moneyAvailable: {\n max: 1000e6,\n min: 900e6,\n },\n networkLayer: 9,\n numOpenPortsRequired: 5,\n organizationName: LocationName.Sector12IcarusMicrosystems,\n requiredHackingSkill: {\n max: 925,\n min: 850,\n },\n serverGrowth: {\n max: 95,\n min: 85,\n },\n specialName: LocationName.Sector12IcarusMicrosystems,\n },\n {\n hackDifficulty: {\n max: 90,\n min: 80,\n },\n hostname: \"univ-energy\",\n maxRamExponent: {\n max: 7,\n min: 4,\n },\n moneyAvailable: {\n max: 1200e6,\n min: 1100e6,\n },\n networkLayer: 9,\n numOpenPortsRequired: 4,\n organizationName: LocationName.Sector12UniversalEnergy,\n requiredHackingSkill: {\n max: 900,\n min: 800,\n },\n serverGrowth: {\n max: 90,\n min: 80,\n },\n specialName: LocationName.Sector12UniversalEnergy,\n },\n {\n hackDifficulty: {\n max: 80,\n min: 70,\n },\n hostname: \"titan-labs\",\n literature: [LiteratureNames.CodedIntelligence],\n maxRamExponent: {\n max: 7,\n min: 4,\n },\n moneyAvailable: {\n max: 900000000,\n min: 750000000,\n },\n networkLayer: 11,\n numOpenPortsRequired: 5,\n organizationName: \"Titan Laboratories\",\n requiredHackingSkill: {\n max: 875,\n min: 800,\n },\n serverGrowth: {\n max: 80,\n min: 60,\n },\n },\n {\n hackDifficulty: {\n max: 75,\n min: 65,\n },\n hostname: \"microdyne\",\n literature: [LiteratureNames.SyntheticMuscles],\n maxRamExponent: {\n max: 6,\n min: 4,\n },\n moneyAvailable: {\n max: 700000000,\n min: 500000000,\n },\n networkLayer: 11,\n numOpenPortsRequired: 5,\n organizationName: \"Microdyne Technologies\",\n requiredHackingSkill: {\n max: 875,\n min: 800,\n },\n serverGrowth: {\n max: 90,\n min: 70,\n },\n },\n {\n hackDifficulty: {\n max: 80,\n min: 70,\n },\n hostname: \"taiyang-digital\",\n literature: [LiteratureNames.AGreenTomorrow, LiteratureNames.BrighterThanTheSun],\n moneyAvailable: {\n max: 900000000,\n min: 800000000,\n },\n networkLayer: 10,\n numOpenPortsRequired: 5,\n organizationName: \"Taiyang Digital\",\n requiredHackingSkill: {\n max: 950,\n min: 850,\n },\n serverGrowth: {\n max: 80,\n min: 70,\n },\n },\n {\n hackDifficulty: {\n max: 65,\n min: 55,\n },\n hostname: \"galactic-cyber\",\n moneyAvailable: {\n max: 850000000,\n min: 750000000,\n },\n networkLayer: 7,\n numOpenPortsRequired: 5,\n organizationName: LocationName.AevumGalacticCybersystems,\n requiredHackingSkill: {\n max: 875,\n min: 825,\n },\n serverGrowth: {\n max: 90,\n min: 70,\n },\n specialName: LocationName.AevumGalacticCybersystems,\n },\n {\n hackDifficulty: {\n max: 90,\n min: 80,\n },\n hostname: \"aerocorp\",\n literature: [LiteratureNames.ManAndMachine],\n moneyAvailable: {\n max: 1200000000,\n min: 1000000000,\n },\n networkLayer: 7,\n numOpenPortsRequired: 5,\n organizationName: LocationName.AevumAeroCorp,\n requiredHackingSkill: {\n max: 925,\n min: 850,\n },\n serverGrowth: {\n max: 65,\n min: 55,\n },\n specialName: LocationName.AevumAeroCorp,\n },\n {\n hackDifficulty: {\n max: 95,\n min: 85,\n },\n hostname: \"omnia\",\n literature: [LiteratureNames.HistoryOfSynthoids],\n maxRamExponent: {\n max: 6,\n min: 4,\n },\n moneyAvailable: {\n max: 1000000000,\n min: 900000000,\n },\n networkLayer: 8,\n numOpenPortsRequired: 5,\n organizationName: LocationName.VolhavenOmniaCybersystems,\n requiredHackingSkill: {\n max: 950,\n min: 850,\n },\n serverGrowth: {\n max: 70,\n min: 60,\n },\n specialName: LocationName.VolhavenOmniaCybersystems,\n },\n {\n hackDifficulty: {\n max: 65,\n min: 55,\n },\n hostname: \"zb-def\",\n literature: [LiteratureNames.SyntheticMuscles],\n moneyAvailable: {\n max: 1100000000,\n min: 900000000,\n },\n networkLayer: 10,\n numOpenPortsRequired: 4,\n organizationName: \"ZB Defense Industries\",\n requiredHackingSkill: {\n max: 825,\n min: 775,\n },\n serverGrowth: {\n max: 75,\n min: 65,\n },\n },\n {\n hackDifficulty: {\n max: 80,\n min: 60,\n },\n hostname: \"applied-energetics\",\n moneyAvailable: {\n max: 1000000000,\n min: 700000000,\n },\n networkLayer: 11,\n numOpenPortsRequired: 4,\n organizationName: \"Applied Energetics\",\n requiredHackingSkill: {\n max: 850,\n min: 775,\n },\n serverGrowth: {\n max: 75,\n min: 70,\n },\n },\n {\n hackDifficulty: {\n max: 80,\n min: 70,\n },\n hostname: \"solaris\",\n literature: [LiteratureNames.AGreenTomorrow, LiteratureNames.TheFailedFrontier],\n maxRamExponent: {\n max: 7,\n min: 4,\n },\n moneyAvailable: {\n max: 900000000,\n min: 700000000,\n },\n networkLayer: 9,\n numOpenPortsRequired: 5,\n organizationName: LocationName.ChongqingSolarisSpaceSystems,\n requiredHackingSkill: {\n max: 850,\n min: 750,\n },\n serverGrowth: {\n max: 80,\n min: 70,\n },\n specialName: LocationName.ChongqingSolarisSpaceSystems,\n },\n {\n hackDifficulty: {\n max: 85,\n min: 75,\n },\n hostname: \"deltaone\",\n moneyAvailable: {\n max: 1700000000,\n min: 1300000000,\n },\n networkLayer: 8,\n numOpenPortsRequired: 5,\n organizationName: LocationName.Sector12DeltaOne,\n requiredHackingSkill: {\n max: 900,\n min: 800,\n },\n serverGrowth: {\n max: 70,\n min: 50,\n },\n specialName: LocationName.Sector12DeltaOne,\n },\n {\n hackDifficulty: {\n max: 85,\n min: 75,\n },\n hostname: \"global-pharm\",\n literature: [LiteratureNames.AGreenTomorrow],\n maxRamExponent: {\n max: 6,\n min: 3,\n },\n moneyAvailable: {\n max: 1750000000,\n min: 1500000000,\n },\n networkLayer: 7,\n numOpenPortsRequired: 4,\n organizationName: LocationName.NewTokyoGlobalPharmaceuticals,\n requiredHackingSkill: {\n max: 850,\n min: 750,\n },\n serverGrowth: {\n max: 90,\n min: 80,\n },\n specialName: LocationName.NewTokyoGlobalPharmaceuticals,\n },\n {\n hackDifficulty: {\n max: 80,\n min: 60,\n },\n hostname: \"nova-med\",\n moneyAvailable: {\n max: 1250000000,\n min: 1100000000,\n },\n networkLayer: 10,\n numOpenPortsRequired: 4,\n organizationName: LocationName.IshimaNovaMedical,\n requiredHackingSkill: {\n max: 850,\n min: 775,\n },\n serverGrowth: {\n max: 85,\n min: 65,\n },\n specialName: LocationName.IshimaNovaMedical,\n },\n {\n hackDifficulty: {\n max: 90,\n min: 70,\n },\n hostname: \"zeus-med\",\n moneyAvailable: {\n max: 1500000000,\n min: 1300000000,\n },\n networkLayer: 9,\n numOpenPortsRequired: 5,\n organizationName: \"Zeus Medical\",\n requiredHackingSkill: {\n max: 850,\n min: 800,\n },\n serverGrowth: {\n max: 80,\n min: 70,\n },\n },\n {\n hackDifficulty: {\n max: 80,\n min: 70,\n },\n hostname: \"unitalife\",\n maxRamExponent: {\n max: 6,\n min: 4,\n },\n moneyAvailable: {\n max: 1100000000,\n min: 1000000000,\n },\n networkLayer: 8,\n numOpenPortsRequired: 4,\n organizationName: \"UnitaLife Group\",\n requiredHackingSkill: {\n max: 825,\n min: 775,\n },\n serverGrowth: {\n max: 80,\n min: 70,\n },\n },\n {\n hackDifficulty: {\n max: 80,\n min: 60,\n },\n hostname: \"lexo-corp\",\n maxRamExponent: {\n max: 7,\n min: 4,\n },\n moneyAvailable: {\n max: 800000000,\n min: 700000000,\n },\n networkLayer: 6,\n numOpenPortsRequired: 4,\n organizationName: LocationName.VolhavenLexoCorp,\n requiredHackingSkill: {\n max: 750,\n min: 650,\n },\n serverGrowth: {\n max: 65,\n min: 55,\n },\n specialName: LocationName.VolhavenLexoCorp,\n },\n {\n hackDifficulty: {\n max: 60,\n min: 40,\n },\n hostname: \"rho-construction\",\n maxRamExponent: {\n max: 6,\n min: 4,\n },\n moneyAvailable: {\n max: 700000000,\n min: 500000000,\n },\n networkLayer: 6,\n numOpenPortsRequired: 3,\n organizationName: LocationName.AevumRhoConstruction,\n requiredHackingSkill: {\n max: 525,\n min: 475,\n },\n serverGrowth: {\n max: 60,\n min: 40,\n },\n specialName: LocationName.AevumRhoConstruction,\n },\n {\n hackDifficulty: {\n max: 70,\n min: 50,\n },\n hostname: \"alpha-ent\",\n literature: [LiteratureNames.Sector12Crime],\n maxRamExponent: {\n max: 7,\n min: 4,\n },\n moneyAvailable: {\n max: 750000000,\n min: 600000000,\n },\n networkLayer: 6,\n numOpenPortsRequired: 4,\n organizationName: LocationName.Sector12AlphaEnterprises,\n requiredHackingSkill: {\n max: 600,\n min: 500,\n },\n serverGrowth: {\n max: 60,\n min: 50,\n },\n specialName: LocationName.Sector12AlphaEnterprises,\n },\n {\n hackDifficulty: {\n max: 80,\n min: 70,\n },\n hostname: \"aevum-police\",\n maxRamExponent: {\n max: 6,\n min: 4,\n },\n moneyAvailable: {\n max: 400000000,\n min: 200000000,\n },\n networkLayer: 6,\n numOpenPortsRequired: 4,\n organizationName: LocationName.AevumPolice,\n requiredHackingSkill: {\n max: 450,\n min: 400,\n },\n serverGrowth: {\n max: 50,\n min: 30,\n },\n specialName: LocationName.AevumPolice,\n },\n {\n hackDifficulty: {\n max: 55,\n min: 45,\n },\n hostname: \"rothman-uni\",\n literature: [\n LiteratureNames.SecretSocieties,\n LiteratureNames.TheFailedFrontier,\n LiteratureNames.TensionsInTechRace,\n ],\n maxRamExponent: {\n max: 7,\n min: 4,\n },\n moneyAvailable: {\n max: 250000000,\n min: 175000000,\n },\n networkLayer: 5,\n numOpenPortsRequired: 3,\n organizationName: LocationName.Sector12RothmanUniversity,\n requiredHackingSkill: {\n max: 430,\n min: 370,\n },\n serverGrowth: {\n max: 45,\n min: 35,\n },\n specialName: LocationName.Sector12RothmanUniversity,\n },\n {\n hackDifficulty: {\n max: 85,\n min: 65,\n },\n hostname: \"zb-institute\",\n maxRamExponent: {\n max: 7,\n min: 4,\n },\n moneyAvailable: {\n max: 1100000000,\n min: 800000000,\n },\n networkLayer: 5,\n numOpenPortsRequired: 5,\n organizationName: LocationName.VolhavenZBInstituteOfTechnology,\n requiredHackingSkill: {\n max: 775,\n min: 725,\n },\n serverGrowth: {\n max: 85,\n min: 75,\n },\n specialName: LocationName.VolhavenZBInstituteOfTechnology,\n },\n {\n hackDifficulty: {\n max: 65,\n min: 45,\n },\n hostname: \"summit-uni\",\n literature: [LiteratureNames.SecretSocieties, LiteratureNames.TheFailedFrontier, LiteratureNames.SyntheticMuscles],\n maxRamExponent: {\n max: 6,\n min: 4,\n },\n moneyAvailable: {\n max: 350000000,\n min: 200000000,\n },\n networkLayer: 5,\n numOpenPortsRequired: 3,\n organizationName: LocationName.AevumSummitUniversity,\n requiredHackingSkill: {\n max: 475,\n min: 425,\n },\n serverGrowth: {\n max: 60,\n min: 40,\n },\n specialName: LocationName.AevumSummitUniversity,\n },\n {\n hackDifficulty: {\n max: 80,\n min: 60,\n },\n hostname: \"syscore\",\n moneyAvailable: {\n max: 600000000,\n min: 400000000,\n },\n networkLayer: 5,\n numOpenPortsRequired: 4,\n organizationName: LocationName.VolhavenSysCoreSecurities,\n requiredHackingSkill: {\n max: 650,\n min: 550,\n },\n serverGrowth: {\n max: 70,\n min: 60,\n },\n specialName: LocationName.VolhavenSysCoreSecurities,\n },\n {\n hackDifficulty: {\n max: 70,\n min: 60,\n },\n hostname: \"catalyst\",\n literature: [LiteratureNames.TensionsInTechRace],\n maxRamExponent: {\n max: 7,\n min: 4,\n },\n moneyAvailable: {\n max: 550000000,\n min: 300000000,\n },\n networkLayer: 5,\n numOpenPortsRequired: 3,\n organizationName: \"Catalyst Ventures\",\n requiredHackingSkill: {\n max: 450,\n min: 400,\n },\n serverGrowth: {\n max: 55,\n min: 25,\n },\n },\n {\n hackDifficulty: {\n max: 45,\n min: 35,\n },\n hostname: \"the-hub\",\n maxRamExponent: {\n max: 6,\n min: 3,\n },\n moneyAvailable: {\n max: 200000000,\n min: 150000000,\n },\n networkLayer: 4,\n numOpenPortsRequired: 2,\n organizationName: \"The Hub\",\n requiredHackingSkill: {\n max: 325,\n min: 275,\n },\n serverGrowth: {\n max: 55,\n min: 45,\n },\n },\n {\n hackDifficulty: {\n max: 65,\n min: 55,\n },\n hostname: \"comptek\",\n literature: [LiteratureNames.ManAndMachine],\n moneyAvailable: {\n max: 250000000,\n min: 220000000,\n },\n networkLayer: 4,\n numOpenPortsRequired: 3,\n organizationName: LocationName.VolhavenCompuTek,\n requiredHackingSkill: {\n max: 400,\n min: 300,\n },\n serverGrowth: {\n max: 65,\n min: 45,\n },\n specialName: LocationName.VolhavenCompuTek,\n },\n {\n hackDifficulty: {\n max: 80,\n min: 60,\n },\n hostname: \"netlink\",\n literature: [LiteratureNames.SimulatedReality],\n maxRamExponent: {\n max: 7,\n min: 4,\n },\n moneyAvailable: 275000000,\n networkLayer: 4,\n numOpenPortsRequired: 3,\n organizationName: LocationName.AevumNetLinkTechnologies,\n requiredHackingSkill: {\n max: 425,\n min: 375,\n },\n serverGrowth: {\n max: 75,\n min: 45,\n },\n specialName: LocationName.AevumNetLinkTechnologies,\n },\n {\n hackDifficulty: {\n max: 65,\n min: 35,\n },\n hostname: \"johnson-ortho\",\n moneyAvailable: {\n max: 85000000,\n min: 70000000,\n },\n networkLayer: 4,\n numOpenPortsRequired: 2,\n organizationName: \"Johnson Orthopedics\",\n requiredHackingSkill: {\n max: 300,\n min: 250,\n },\n serverGrowth: {\n max: 65,\n min: 35,\n },\n },\n {\n hackDifficulty: 1,\n hostname: \"n00dles\",\n literature: [],\n maxRamExponent: 2,\n moneyAvailable: 70000,\n networkLayer: 1,\n numOpenPortsRequired: 0,\n organizationName: LocationName.NewTokyoNoodleBar,\n requiredHackingSkill: 1,\n serverGrowth: 3000,\n specialName: LocationName.NewTokyoNoodleBar,\n },\n {\n hackDifficulty: 10,\n hostname: \"foodnstuff\",\n literature: [LiteratureNames.Sector12Crime],\n maxRamExponent: 4,\n moneyAvailable: 2000000,\n networkLayer: 1,\n numOpenPortsRequired: 0,\n organizationName: LocationName.Sector12FoodNStuff,\n requiredHackingSkill: 1,\n serverGrowth: 5,\n specialName: LocationName.Sector12FoodNStuff,\n },\n {\n hackDifficulty: 10,\n hostname: \"sigma-cosmetics\",\n maxRamExponent: 4,\n moneyAvailable: 2300000,\n networkLayer: 1,\n numOpenPortsRequired: 0,\n organizationName: \"Sigma Cosmetics\",\n requiredHackingSkill: 5,\n serverGrowth: 10,\n },\n {\n hackDifficulty: 15,\n hostname: \"joesguns\",\n maxRamExponent: 4,\n moneyAvailable: 2500000,\n networkLayer: 1,\n numOpenPortsRequired: 0,\n organizationName: LocationName.Sector12JoesGuns,\n requiredHackingSkill: 10,\n serverGrowth: 20,\n specialName: LocationName.Sector12JoesGuns,\n },\n {\n hackDifficulty: 25,\n hostname: \"zer0\",\n maxRamExponent: 5,\n moneyAvailable: 7500000,\n networkLayer: 2,\n numOpenPortsRequired: 1,\n organizationName: \"ZER0 Nightclub\",\n requiredHackingSkill: 75,\n serverGrowth: 40,\n },\n {\n hackDifficulty: 20,\n hostname: \"nectar-net\",\n maxRamExponent: 4,\n moneyAvailable: 2750000,\n networkLayer: 2,\n numOpenPortsRequired: 0,\n organizationName: \"Nectar Nightclub Network\",\n requiredHackingSkill: 20,\n serverGrowth: 25,\n },\n {\n hackDifficulty: 25,\n hostname: \"neo-net\",\n literature: [LiteratureNames.TheHiddenWorld],\n maxRamExponent: 5,\n moneyAvailable: 5000000,\n networkLayer: 3,\n numOpenPortsRequired: 1,\n organizationName: \"Neo Nightclub Network\",\n requiredHackingSkill: 50,\n serverGrowth: 25,\n },\n {\n hackDifficulty: 30,\n hostname: \"silver-helix\",\n literature: [LiteratureNames.NewTriads],\n maxRamExponent: 6,\n moneyAvailable: 45000000,\n networkLayer: 3,\n numOpenPortsRequired: 2,\n organizationName: \"Silver Helix\",\n requiredHackingSkill: 150,\n serverGrowth: 30,\n },\n {\n hackDifficulty: 15,\n hostname: \"hong-fang-tea\",\n literature: [LiteratureNames.BrighterThanTheSun],\n maxRamExponent: 4,\n moneyAvailable: 3000000,\n networkLayer: 1,\n numOpenPortsRequired: 0,\n organizationName: \"HongFang Teahouse\",\n requiredHackingSkill: 30,\n serverGrowth: 20,\n },\n {\n hackDifficulty: 15,\n hostname: \"harakiri-sushi\",\n maxRamExponent: 4,\n moneyAvailable: 4000000,\n networkLayer: 1,\n numOpenPortsRequired: 0,\n organizationName: \"HaraKiri Sushi Bar Network\",\n requiredHackingSkill: 40,\n serverGrowth: 40,\n },\n {\n hackDifficulty: 20,\n hostname: \"phantasy\",\n maxRamExponent: 5,\n moneyAvailable: 24000000,\n networkLayer: 3,\n numOpenPortsRequired: 2,\n organizationName: \"Phantasy Club\",\n requiredHackingSkill: 100,\n serverGrowth: 35,\n },\n {\n hackDifficulty: 15,\n hostname: \"max-hardware\",\n maxRamExponent: 5,\n moneyAvailable: 10000000,\n networkLayer: 2,\n numOpenPortsRequired: 1,\n organizationName: \"Max Hardware Store\",\n requiredHackingSkill: 80,\n serverGrowth: 30,\n },\n {\n hackDifficulty: {\n max: 35,\n min: 25,\n },\n hostname: \"omega-net\",\n literature: [LiteratureNames.TheNewGod],\n maxRamExponent: 5,\n moneyAvailable: {\n max: 70000000,\n min: 60000000,\n },\n networkLayer: 3,\n numOpenPortsRequired: 2,\n organizationName: LocationName.IshimaOmegaSoftware,\n requiredHackingSkill: {\n max: 220,\n min: 180,\n },\n serverGrowth: {\n max: 40,\n min: 30,\n },\n specialName: LocationName.IshimaOmegaSoftware,\n },\n {\n hackDifficulty: {\n max: 45,\n min: 35,\n },\n hostname: \"crush-fitness\",\n moneyAvailable: {\n max: 60000000,\n min: 40000000,\n },\n networkLayer: 4,\n numOpenPortsRequired: 2,\n organizationName: \"Crush Fitness\",\n requiredHackingSkill: {\n max: 275,\n min: 225,\n },\n serverGrowth: {\n max: 33,\n min: 27,\n },\n specialName: LocationName.AevumCrushFitnessGym,\n },\n {\n hackDifficulty: 30,\n hostname: \"iron-gym\",\n maxRamExponent: 5,\n moneyAvailable: 20000000,\n networkLayer: 1,\n numOpenPortsRequired: 1,\n organizationName: \"Iron Gym Network\",\n requiredHackingSkill: 100,\n serverGrowth: 20,\n specialName: LocationName.Sector12IronGym,\n },\n {\n hackDifficulty: {\n max: 55,\n min: 45,\n },\n hostname: \"millenium-fitness\",\n maxRamExponent: {\n max: 8,\n min: 4,\n },\n moneyAvailable: 250000000,\n networkLayer: 6,\n numOpenPortsRequired: 3,\n organizationName: \"Millenium Fitness Network\",\n requiredHackingSkill: {\n max: 525,\n min: 475,\n },\n serverGrowth: {\n max: 45,\n min: 25,\n },\n specialName: LocationName.VolhavenMilleniumFitnessGym,\n },\n {\n hackDifficulty: {\n max: 65,\n min: 55,\n },\n hostname: \"powerhouse-fitness\",\n maxRamExponent: {\n max: 6,\n min: 4,\n },\n moneyAvailable: 900000000,\n networkLayer: 14,\n numOpenPortsRequired: 5,\n organizationName: \"Powerhouse Fitness\",\n requiredHackingSkill: {\n max: 1100,\n min: 950,\n },\n serverGrowth: {\n max: 60,\n min: 50,\n },\n specialName: LocationName.Sector12PowerhouseGym,\n },\n {\n hackDifficulty: {\n max: 60,\n min: 40,\n },\n hostname: \"snap-fitness\",\n moneyAvailable: 450000000,\n networkLayer: 7,\n numOpenPortsRequired: 4,\n organizationName: \"Snap Fitness\",\n requiredHackingSkill: {\n max: 800,\n min: 675,\n },\n serverGrowth: {\n max: 60,\n min: 40,\n },\n specialName: LocationName.AevumSnapFitnessGym,\n },\n {\n hackDifficulty: 0,\n hostname: \"run4theh111z\",\n literature: [LiteratureNames.SimulatedReality, LiteratureNames.TheNewGod],\n maxRamExponent: {\n max: 9,\n min: 5,\n },\n moneyAvailable: 0,\n networkLayer: 11,\n numOpenPortsRequired: 4,\n organizationName: \"The Runners\",\n requiredHackingSkill: {\n max: 550,\n min: 505,\n },\n serverGrowth: 0,\n specialName: \"BitRunners Server\",\n },\n {\n hackDifficulty: 0,\n hostname: \"I.I.I.I\",\n literature: [LiteratureNames.DemocracyIsDead],\n maxRamExponent: {\n max: 8,\n min: 4,\n },\n moneyAvailable: 0,\n networkLayer: 5,\n numOpenPortsRequired: 3,\n organizationName: \"I.I.I.I\",\n requiredHackingSkill: {\n max: 365,\n min: 340,\n },\n serverGrowth: 0,\n specialName: \"The Black Hand Server\",\n },\n {\n hackDifficulty: 0,\n hostname: \"avmnite-02h\",\n literature: [LiteratureNames.DemocracyIsDead],\n maxRamExponent: {\n max: 7,\n min: 4,\n },\n moneyAvailable: 0,\n networkLayer: 4,\n numOpenPortsRequired: 2,\n organizationName: \"NiteSec\",\n requiredHackingSkill: {\n max: 220,\n min: 202,\n },\n serverGrowth: 0,\n specialName: \"NiteSec Server\",\n },\n {\n hackDifficulty: 0,\n hostname: \".\",\n maxRamExponent: 4,\n moneyAvailable: 0,\n networkLayer: 13,\n numOpenPortsRequired: 4,\n organizationName: \".\",\n requiredHackingSkill: {\n max: 550,\n min: 505,\n },\n serverGrowth: 0,\n specialName: \"The Dark Army Server\",\n },\n {\n hackDifficulty: 0,\n hostname: \"CSEC\",\n literature: [LiteratureNames.DemocracyIsDead],\n maxRamExponent: 3,\n moneyAvailable: 0,\n networkLayer: 2,\n numOpenPortsRequired: 1,\n organizationName: \"CyberSec\",\n requiredHackingSkill: {\n max: 60,\n min: 51,\n },\n serverGrowth: 0,\n specialName: \"CyberSec Server\",\n },\n {\n hackDifficulty: 0,\n hostname: \"The-Cave\",\n literature: [LiteratureNames.AlphaOmega],\n moneyAvailable: 0,\n networkLayer: 15,\n numOpenPortsRequired: 5,\n organizationName: \"Helios\",\n requiredHackingSkill: 925,\n serverGrowth: 0,\n specialName: \"Daedalus Server\",\n },\n {\n hackDifficulty: 0,\n hostname: \"w0r1d_d43m0n\",\n moneyAvailable: 0,\n numOpenPortsRequired: 5,\n organizationName: \"w0r1d_d43m0n\",\n requiredHackingSkill: 3000,\n serverGrowth: 0,\n specialName: \"w0r1d_d43m0n\",\n },\n];\n","import React from \"react\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { IRouter } from \"../../ui/Router\";\nimport { removePopup } from \"../../ui/React/createPopup\";\n\ninterface IProps {\n player: IPlayer;\n router: IRouter;\n popupId: string;\n}\n\nexport function BitFlumePopup(props: IProps): React.ReactElement {\n function flume(): void {\n props.router.toBitVerse(true, false);\n removePopup(props.popupId);\n }\n return (\n <>\n WARNING: USING THIS PROGRAM WILL CAUSE YOU TO LOSE ALL OF YOUR PROGRESS ON THE CURRENT BITNODE.\n
\n
\n Do you want to travel to the BitNode Nexus? This allows you to reset the current BitNode and select a new one.\n
\n
\n \n \n );\n}\n","import { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\n// Array of all valid states\nconst AllCorporationStates: string[] = [\"START\", \"PURCHASE\", \"PRODUCTION\", \"SALE\", \"EXPORT\"];\n\nexport class CorporationState {\n // Number representing what state the Corporation is in. The number\n // is an index for the array that holds all Corporation States\n state = 0;\n\n // Get the name of the current state\n // NOTE: This does NOT return the number stored in the 'state' property,\n // which is just an index for the array of all possible Corporation States.\n getState(): string {\n return AllCorporationStates[this.state];\n }\n\n // Transition to the next state\n nextState(): void {\n if (this.state < 0 || this.state >= AllCorporationStates.length) {\n this.state = 0;\n }\n\n ++this.state;\n if (this.state >= AllCorporationStates.length) {\n this.state = 0;\n }\n }\n\n // Serialize the current object to a JSON save state.\n toJSON(): any {\n return Generic_toJSON(\"CorporationState\", this);\n }\n\n // Initiatizes a CorporationState object from a JSON save state.\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): CorporationState {\n return Generic_fromJSON(CorporationState, value.data);\n }\n}\n\nReviver.constructors.CorporationState = CorporationState;\n","import { Literature } from \"./Literature\";\nimport { LiteratureNames } from \"./data/LiteratureNames\";\nimport { IMap } from \"../types\";\n\nexport const Literatures: IMap = {};\n\n(function () {\n let title, fn, txt;\n title = \"The Beginner's Guide to Hacking\";\n fn = LiteratureNames.HackersStartingHandbook;\n txt =\n \"Some resources:

\" +\n \"Learn to Program

\" +\n \"For Experienced JavaScript Developers: NetscriptJS

\" +\n \"Netscript Documentation

\" +\n \"When starting out, hacking is the most profitable way to earn money and progress. This \" +\n \"is a brief collection of tips/pointers on how to make the most out of your hacking scripts.

\" +\n \"-hack() and grow() both work by percentages. hack() steals a certain percentage of the \" +\n \"money on a server, and grow() increases the amount of money on a server by some percentage (multiplicatively)

\" +\n \"-Because hack() and grow() work by percentages, they are more effective if the target server has a high amount of money. \" +\n \"Therefore, you should try to increase the amount of money on a server (using grow()) to a certain amount before hacking it. Two \" +\n \"import Netscript functions for this are getServerMoneyAvailable() and getServerMaxMoney()

\" +\n \"-Keep security level low. Security level affects everything when hacking. Two important Netscript functions \" +\n \"for this are getServerSecurityLevel() and getServerMinSecurityLevel()

\" +\n \"-Purchase additional servers by visiting 'Alpha Enterprises' in the city. They are relatively cheap \" +\n \"and give you valuable RAM to run more scripts early in the game

\" +\n \"-Prioritize upgrading the RAM on your home computer. This can also be done at 'Alpha Enterprises'

\" +\n \"-Many low level servers have free RAM. You can use this RAM to run your scripts. Use the scp Terminal or \" +\n \"Netscript command to copy your scripts onto these servers and then run them.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"The Complete Handbook for Creating a Successful Corporation\";\n fn = LiteratureNames.CorporationManagementHandbook;\n txt =\n \"Getting Started with Corporations
\" +\n \"To get started, visit the City Hall in Sector-12 in order to create a Corporation. This requires \" +\n \"$150b of your own money, but this $150b will get put into your Corporation's funds. \" +\n \"After creating your Corporation, you will see it listed as one of the locations in the city. Click on \" +\n \"your Corporation in order to manage it.

\" +\n \"Your Corporation can have many different divisions, each in a different Industry. There are many different \" +\n \"types of Industries, each with different properties. To create your first division, click the \" +\n \"'Expand into new Industry' button at the top of the management UI. The Agriculture \" +\n \"and Software industries are recommended for your first division.

\" +\n \"The first thing you'll need to do is hire some employees. Employees can be assigned to five different positions. \" +\n \"Each position has a different effect on various aspects of your Corporation. It is recommended to have at least \" +\n \"one employee at each position.

\" +\n \"Each industry uses some combination of Materials in order to produce other Materials and/or create Products. \" +\n \"Specific information about this is displayed in each of your divisions' UI.

\" +\n \"Products are special, industry-specific objects. They are different than Materials because you \" +\n \"must manually choose to develop them, and you can choose to develop any number of Products. Developing \" +\n \"a Product takes time, but a Product typically generates significantly more revenue than any Material. \" +\n \"Not all industries allow you to create Products. To create a Product, look for a button \" +\n \"in the top-left panel of the division UI (e.g. For the Software Industry, the button says 'Develop Software').

\" +\n \"To get your supply chain system started, \" +\n \"purchase the Materials that your industry needs to produce other Materials/Products. This can be done \" +\n \"by clicking the 'Buy' button next to the corresponding Material(s). After you have the required Materials, \" +\n \"you will immediately start production. The amount of Materials/Products you produce is based on a variety of factors, \" +\n \"one of which is your employees and their productivity.

\" +\n \"Once you start producing Materials/Products, you can sell them in order to start earning revenue. This can be done \" +\n \"by clicking the 'Sell' button next to the corresponding Material or Product. The amount of Material/Product you sell is dependent \" +\n \"on a wide variety of different factors.

\" +\n \"These are the basics of getting your Corporation up and running! Now, you can start purchasing upgrades to improve \" +\n \"your bottom line. If you need money, consider looking for seed investors, who will give you money in exchange for stock shares. \" +\n \"Otherwise, once you feel you are ready, take your Corporation public! Once your Corporation goes public, you can no longer \" +\n \"find investors. Instead, your Corporation will be publicly traded and its stock price will change based on how well \" +\n \"it's performing financially. You can then sell your stock shares in order to make money.

\" +\n \"Tips/Pointers
\" +\n \"-The 'Smart Supply' upgrade is extremely useful. Consider purchasing it as soon as possible.

\" +\n \"-Purchasing Hardware, Robots, AI Cores, and Real Estate can potentially increase your production. \" +\n \"The effects of these depend on what industry you are in.

\" +\n \"-In order to optimize your production, you will need a good balance of Operators, Managers, and Engineers

\" +\n \"-Different employees excel in different jobs. For example, the highly intelligent employees will probably do best \" +\n \"if they are assigned to do Engineering work or Research & Development.

\" +\n \"-If your employees have low morale, energy, or happiness, their production will greatly suffer.

\" +\n \"-Tech is important, but don't neglect sales! Having several Businessmen can boost your sales and your bottom line.

\" +\n \"-Don't forget to advertise your company. You won't have any business if nobody knows you.

\" +\n \"-Having company awareness is great, but what's really important is your company's popularity. Try to keep \" +\n \"your popularity as high as possible to see the biggest benefit for your sales

\" +\n \"-Remember, you need to spend money to make money!

\" +\n \"-Corporations do not reset when installing Augmentations, but they do reset when destroying a BitNode\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"A Brief History of Synthoids\";\n fn = LiteratureNames.HistoryOfSynthoids;\n txt =\n \"Synthetic androids, or Synthoids for short, are genetically engineered robots and, short of Augmentations, \" +\n \"are composed entirely of organic substances. For this reason, Synthoids are virtually identical to \" +\n \"humans in form, composition, and appearance.

\" +\n \"Synthoids were first designed and manufactured by OmniTek Incorporated sometime around the middle of the century. \" +\n \"Their original purpose was to be used for manual labor and as emergency responders for disasters. As such, they \" +\n \"were initially programmed only for their specific tasks. Each iteration that followed improved upon the \" +\n \"intelligence and capabilities of the Synthoids. By the 6th iteration, called MK-VI, the Synthoids were \" +\n \"so smart and capable enough of making their own decisions that many argued OmniTek had created the first \" +\n \"sentient AI. These MK-VI Synthoids were produced in mass quantities (estimates up to 50 billion) with the hopes of increasing society's \" +\n \"productivity and bolstering the global economy. Stemming from humanity's desire for technological advancement, optimism \" +\n \"and excitement about the future had never been higher.

\" +\n \"All of that excitement and optimism quickly turned to fear, panic, and dread in 2070, when a terrorist group \" +\n \"called Ascendis Totalis hacked into OmniTek and uploaded a rogue AI into severeal of their Synthoid manufacturing facilities. \" +\n \"This hack went undetected and for months OmniTek unknowingly churned out legions of Synthoids embedded with this \" +\n \"rogue AI. Then, on December 24th, 2070, Omnica activated dormant protocols in the rogue AI, causing all of the \" +\n \"infected Synthoids to immediately launch a military campaign to seek and destroy all of humanity.

\" +\n \"What ensued was the deadlist conflict in human history. This crisis, now commonly known as the Synthoid Uprising, \" +\n \"resulted in almost ten billion deaths over the course of a year. Despite the nations of the world banding together \" +\n \"to combat the threat, the MK-VI Synthoids were simply stronger, faster, more intelligent, and more adaptable than humans, \" +\n \"outsmarting them at every turn.

\" +\n \"It wasn't until the sacrifice of an elite international military taskforce, called the Bladeburners, that humanity \" +\n \"was finally able to defeat the Synthoids. The Bladeburners' final act was a suicide bombing mission that \" +\n \"destroyed a large portion of the MK-VI Synthoids, including many of its leaders. In the following \" +\n \"weeks militaries from around the world were able to round up and shut down the remaining rogue MK-VI Synthoids, ending \" +\n \"the Synthoid Uprising.

\" +\n \"In the aftermath of the bloodshed, the Synthoid Accords were drawn up. These Accords banned OmniTek Incorporated \" +\n \"from manufacturing any Synthoids beyond the MK-III series. They also banned any other corporation \" +\n \"from constructing androids with advanced, near-sentient AI. MK-VI Synthoids that did not have the rogue Ascendis Totalis \" +\n \"AI were allowed to continue their existence, but they were stripped of all rights and protections as they \" +\n \"were not considered humans. They were also banned from doing anything that may pose a global security threat, such \" +\n \"as working for any military/defense organization or conducting any bioengineering, computing, or robotics related research.

\" +\n \"Unfortunately, many believe that not all of the rogue MK-VI Synthoids from the Uprising were found and destroyed, \" +\n \"and that many of them are blending in as normal humans in society today. In response, many nations have created \" +\n \"Bladeburner divisions, special military branches that are tasked with investigating and dealing with any Synthoid threads.

\" +\n \"To this day, tensions still exist between the remaining Synthoids and humans as a result of the Uprising.

\" +\n \"Nobody knows what happened to the terrorist group Ascendis Totalis.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"A Green Tomorrow\";\n fn = LiteratureNames.AGreenTomorrow;\n txt =\n \"Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to \" +\n \"combat global warming and climate change. The shift towards renewable energy was a big success, or so it seemed. In 2045 \" +\n \"a staggering 80% of the world's energy came from non-renewable fossil fuels. Now, about three decades later, that \" +\n \"number is down to only 15%. Most of the world's energy now comes from nuclear power and renewable sources such as \" +\n \"solar and geothermal energy. Unfortunately, these efforts were not the huge success that they seem to be.

\" +\n \"Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and \" +\n \"the rise of increasingly advanced (and power-hungry) technology that has become ubiquitous in our lives. So, \" +\n \"despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, \" +\n \"the total amount of energy we are producing from fossil fuels has actually increased.

\" +\n \"The grim effects of our species' irresponsible use of energy and neglect of our mother world have become increasingly apparent. \" +\n \"Last year a temperature of 190F was recorded in the Death Valley desert, which is over 50% higher than the highest \" +\n \"recorded temperature at the beginning of the century. In the last two decades numerous major cities such as Manhattan, Boston, and \" +\n \"Los Angeles have been partially or fully submerged by rising sea levels. In the present day, over 75% of the world's agriculture is \" +\n \"done in climate-controlled vertical farms, as most traditional farmland has become unusable due to severe climate conditions.

\" +\n \"Despite all of this, the greedy and corrupt corporations that rule the world have done nothing to address these problems that \" +\n \"threaten our species. And so it's up to us, the common people. Each and every one of us can make a difference by doing what \" +\n \"these corporations won't: taking responsibility. If we don't, pretty soon there won't be an Earth left to save. We are \" +\n \"the last hope for a green tomorrow.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Alpha and Omega\";\n fn = LiteratureNames.AlphaOmega;\n txt =\n \"Then we saw a new Heaven and a new Earth, for our first Heaven and Earth had gone away, and our sea was no more. \" +\n \"And we saw a new holy city, new Aeria, coming down out of this new Heaven, prepared as a bride adorned for her husband. \" +\n \"And we heard a loud voice saying, 'Behold, the new dwelling place of the Gods. We will dwell with them, and they \" +\n \"will be our people, and we will be with them as their Gods. We will wipe away every tear from their eyes, and death \" +\n \"shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things \" +\n \"have passed away.'

\" +\n \"And once we were seated on the throne we said 'Behold, I am making all things new.' \" +\n \"Also we said, 'Write this down, for these words are trustworthy and true.' And we said to you, \" +\n \"'It is done! I am the Alpha and the Omega, the beginning and the end. To the thirsty I will give from the spring \" +\n \"of the water of life without payment. The one who conquers will have this heritage, and we will be his God and \" +\n \"he will be our son. But as for the cowardly, the faithless, the detestable, as for murderers, \" +\n \"the sexually immoral, sorcerers, idolaters, and all liars, their portion will be in the lake that \" +\n \"burns with fire and sulfur, for it is the second true death.'\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Are We Living in a Computer Simulation?\";\n fn = LiteratureNames.SimulatedReality;\n txt =\n \"The idea that we are living in a virtual world is not new. It's a trope that has \" +\n \"been explored constantly in literature and pop culture. However, it is also a legitimate \" +\n \"scientific hypothesis that many notable physicists and philosophers have debated for years.

\" +\n \"Proponents for this simulated reality theory often point to how advanced our technology has become, \" +\n \"as well as the incredibly fast pace at which it has advanced over the past decades. The amount of computing \" +\n \"power available to us has increased over 100-fold since 2060 due to the development of nanoprocessors and \" +\n \"quantum computers. Artifical Intelligence has advanced to the point where our entire lives are controlled \" +\n \"by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. \" +\n \"If we consider the pace at which this technology has advanced and assume that these developments continue, it's \" +\n \"reasonable to assume that at some point in the future our technology would be advanced enough that \" +\n \"we could create simulations that are indistinguishable from reality. However, if continued technological advancement \" +\n \"is a reasonable outcome, then it is very likely that such a scenario has already happened.

\" +\n \"Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species \" +\n \"that already has such technology. Who's to say that they haven't already created such a virtual reality: our own?\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Beyond Man\";\n fn = LiteratureNames.BeyondMan;\n txt =\n \"Humanity entered a 'transhuman' era a long time ago. And despite the protests and criticisms of many who cried out against \" +\n \"human augmentation at the time, the transhuman movement continued and prospered. Proponents of the movement ignored the critics, \" +\n \"arguing that it was in our inherent nature to better ourselves. To improve. To be more than we were. They claimed that \" +\n \"not doing so would be to go against every living organism's biological purpose: evolution and survival of the fittest.

\" +\n \"And here we are today, with technology that is advanced enough to augment humans to a state that \" +\n \"can only be described as posthuman. But what do we have to show for it when this augmentation \" +\n \"technology is only available to the so-called 'elite'? Are we really better off than before when only 5% of the \" +\n \"world's population has access to this technology? When the powerful corporations and organizations of the world \" +\n \"keep it all to themselves, have we really evolved?

\" +\n \"Augmentation technology has only further increased the divide between the rich and the poor, between the powerful and \" +\n \"the oppressed. We have not become 'more than human'. We have not evolved from nature's original design. We are still the greedy, \" +\n \"corrupted, and evil men that we always were.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Brighter than the Sun\";\n fn = LiteratureNames.BrighterThanTheSun;\n txt =\n \"When people think about the corporations that dominate the East, they typically think of KuaiGong International, which \" +\n \"holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest \" +\n \"drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company \" +\n \"that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.

\" +\n \"TaiYang Digital is a Chinese internet-technology corporation that provides services such as \" +\n \"online advertising, search engines, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word \" +\n \"for 'sun'. In Chinese culture, the sun is a 'yang' symbol \" +\n \"associated with life, heat, masculinity, and heaven.

\" +\n \"The company was founded \" +\n \"less than 5 years ago and is already the third highest valued company in all of Asia. In 2076 it generated a total revenue of \" +\n \"over 10 trillion yuan. It's services are used daily by over a billion people worldwide.

\" +\n \"TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is \" +\n \"something you'd commonly see in the first half of the century, especially for tech companies. However in \" +\n \"the last two decades the number of corporations has significantly declined as the largest entities \" +\n \"quickly took over the economy. Corporations such as ECorp, MegaCorp, and KuaiGong have established \" +\n \"such strong monopolies in their market sectors that they have effectively killed off all \" +\n \"of the smaller and new corporations that have tried to start up over the years. This is what makes \" +\n \"the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have \" +\n \"a bright future ahead of them.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Democracy is Dead: The Fall of an Empire\";\n fn = LiteratureNames.DemocracyIsDead;\n txt =\n \"They rose from the shadows in the street.
From the places where the oppressed meet.
\" +\n \"Their cries echoed loudly through the air.
As they once did in Tiananmen Square.
\" +\n \"Loudness in the silence, Darkness in the light.
They came forth with power and might.
\" +\n \"Once the beacon of democracy, America was first.
Its pillars of society destroyed and dispersed.
\" +\n \"Soon the cries rose everywhere, with revolt and riot.
Until one day, finally, all was quiet.
\" +\n \"From the ashes rose a new order, corporatocracy was its name.
\" +\n \"Rome, Mongol, Byzantine, all of history is just the same.
\" +\n \"For man will never change in a fundamental way.
\" +\n \"And now democracy is dead, in the USA.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Figures Show Rising Crime Rates in Sector-12\";\n fn = LiteratureNames.Sector12Crime;\n txt =\n \"A recent study by analytics company Wilson Inc. shows a significant rise \" +\n \"in criminal activity in Sector-12. Perhaps the most alarming part of the statistic \" +\n \"is that most of the rise is in violent crime such as homicide and assault. According \" +\n \"to the study, the city saw a total of 21,406 reported homicides in 2076, which is over \" +\n \"a 20% increase compared to 2075.

\" +\n \"CIA director David Glarow says its too early to know \" +\n \"whether these figures indicate the beginning of a sustained increase in crime rates, or whether \" +\n \"the year was just an unfortunate outlier. He states that many intelligence and law enforcement \" +\n \"agents have noticed an increase in organized crime activites, and believes that these figures may \" +\n \"be the result of an uprising from criminal organizations such as The Syndicate or the Slum Snakes.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Man and the Machine\";\n fn = LiteratureNames.ManAndMachine;\n txt =\n \"In 2005 Ray Kurzweil popularized his theory of the Singularity. He predicted that the rate \" +\n \"of technological advancement would continue to accelerate faster and faster until one day \" +\n \"machines would be become infinitely more intelligent than humans. This point, called the \" +\n \"Singularity, would result in a drastic transformation of the world as we know it. He predicted \" +\n \"that the Singularity would arrive by 2045. \" +\n \"And yet here we are, more than three decades later, where most would agree that we have not \" +\n \"yet reached a point where computers and machines are vastly more intelligent than we are. So what gives?

\" +\n \"The answer is that we have reached the Singularity, just not in the way we expected. The artifical superintelligence \" +\n \"that was predicted by Kurzweil and others exists in the world today - in the form of Augmentations. \" +\n \"Yes, those Augmentations that the rich and powerful keep to themselves enable humans \" +\n \"to become superintelligent beings. The Singularity did not lead to a world where \" +\n \"our machines are infinitely more intelligent than us, it led to a world \" +\n \"where man and machine can merge to become something greater. Most of the world just doesn't \" +\n \"know it yet.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Secret Societies\";\n fn = LiteratureNames.SecretSocieties;\n txt =\n \"The idea of secret societies has long intrigued the general public by inspiring curiosity, fascination, and \" +\n \"distrust. People have long wondered about who these secret society members are and what they do, with the \" +\n \"most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world \" +\n \"may never know for sure, it is likely that many secret societies do actually exist, even today.

\" +\n \"However, the secret societies of the modern world are nothing like those that (supposedly) existed \" +\n \"decades and centuries ago. The Freemasons, Knights Templar, and Illuminati, while they may have been around \" +\n \"at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in \" +\n \"our everyday lives and the fact that so much of the world is now digital has given rise to a new breed \" +\n \"of secret societies: Internet-based ones.

\" +\n \"Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's \" +\n \"world. Some of these, such as The Black Hand, are black hat groups that claim they are trying to \" +\n \"help the oppressed by attacking the elite and powerful. Others, such as NiteSec, are hacktivist groups \" +\n \"that try to push political and social agendas. Perhaps the most intriguing hacker group \" +\n \"is the mysterious Bitrunners, whose purpose still remains unknown.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Space: The Failed Frontier\";\n fn = LiteratureNames.TheFailedFrontier;\n txt =\n \"Humans have long dreamed about spaceflight. With enduring interest, we were driven to explore \" +\n \"the unknown and discover new worlds. We dreamed about conquering the stars. And in our quest, \" +\n \"we pushed the boundaries of our scientific limits, and then pushed further. Space exploration \" +\n \"lead to the development of many important technologies and new industries.

\" +\n \"But sometime in the middle of the 21st century, all of that changed. Humanity lost its ambitions and \" +\n \"aspirations of exploring the cosmos. The once-large funding for agencies like NASA and the European \" +\n \"Space Agency gradually whittled away until their eventual disbanding in the 2060's. Not even \" +\n \"militaries are fielding flights into space nowadays. The only remnants of the once great mission for cosmic \" +\n \"conquest are the countless satellites in near-earth orbit, used for communications, espionage, \" +\n \"and other corporate interests.

\" +\n \"And as we continue to look at the state of space technology, it becomes more and \" +\n \"more apparent that we will never return to that golden age of space exploration, that \" +\n \"age where everyone dreamed of going beyond earth for the sake of discovery.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Coded Intelligence: Myth or Reality?\";\n fn = LiteratureNames.CodedIntelligence;\n txt =\n \"Tremendous progress has been made in the field of Artificial Intelligence over the past few decades. \" +\n \"Our autonomous vehicles and transporation systems. The electronic personal assistants that control our everyday lives. \" +\n \"Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has \" +\n \"improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create \" +\n \"human intelligence.

\" +\n \"We've certainly come close to artificial intelligence that is similar to humans. For example OmniTek Incorporated's \" +\n \"CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like \" +\n \"in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as \" +\n \"that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.

\" +\n \"Many neuroscientists believe that we won't ever reach the point of creating artificial human intelligence. 'At the end of the \" +\n \"the day, AI comes down to 1's and 0's, while the human brain does not. We'll never see AI that is identical to that of \" +\n \"humans.'\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Synthetic Muscles\";\n fn = LiteratureNames.SyntheticMuscles;\n txt =\n \"Initial versions of synthetic muscles weren't made of anything organic but were actually \" +\n \"crude devices made to mimic human muscle function. Some of the early iterations were actually made of \" +\n \"common materials such as fishing lines and sewing threads due to their high strength for \" +\n \"a cheap cost.

\" +\n \"As technology progressed, however, advances in biomedical engineering paved the way for a new method of \" +\n \"creating synthetic muscles. Instead of creating something that closely imitated the functionality \" +\n \"of human muscle, scientists discovered a way of forcing the human body itself to augment its own \" +\n \"muscle tissue using both synthetic and organic materials. This is typically done using gene therapy \" +\n \"or chemical injections.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"Tensions rise in global tech race\";\n fn = LiteratureNames.TensionsInTechRace;\n txt =\n \"Have we entered a new Cold War? Is WWIII just beyond the horizon?

\" +\n \"After rumors came out that OmniTek Incorporated had begun developing advanced robotic supersoldiers, \" +\n \"geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. \" +\n \"In a rare show of cooperation between corporations, MegaCorp and ECorp have \" +\n \"reportedly launched hundreds of new surveillance and espionage satellites. \" +\n \"Defense contractors such as \" +\n \"DeltaOne and AeroCorp have been working with the CIA and NSA to prepare \" +\n \"for conflict. Meanwhile, the rest of the world sits in earnest \" +\n \"hoping that it never reaches full-scale war. With today's technology \" +\n \"and firepower, a World War would assuredly mean the end of human civilization.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"The Cost of Immortality\";\n fn = LiteratureNames.CostOfImmortality;\n txt =\n \"Evolution and advances in medical and augmentation technology has lead to drastic improvements \" +\n \"in human mortality rates. Recent figures show that the life expectancy for humans \" +\n \"that live in a first-world country is about 130 years of age, almost double of what it was \" +\n \"at the turn of the century. However, this increase in average lifespan has had some \" +\n \"significant effects on society and culture.

\" +\n \"Due to longer lifespans and a better quality of life, many adults are holding \" +\n \"off on having kids until much later. As a result, the percentage of youth in \" +\n \"first-world countries has been decreasing, while the number \" +\n \"of senior citizens is significantly increasing.

\" +\n \"Perhaps the most alarming result of all of this is the rapidly shrinking workforce. \" +\n \"Despite the increase in life expectancy, the typical retirement age for \" +\n \"workers in America has remained about the same, meaning a larger and larger \" +\n \"percentage of people in America are retirees. Furthermore, many \" +\n \"young adults are holding off on joining the workforce because they feel that \" +\n \"they have plenty of time left in their lives for employment, and want to \" +\n \"'enjoy life while they're young.' For most industries, this shrinking workforce \" +\n \"is not a major issue as most things are handled by robots anyways. However, \" +\n \"there are still several key industries such as engineering and education \" +\n \"that have not been automated, and these remain in danger to this cultural \" +\n \"phenomenon.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"The Hidden World\";\n fn = LiteratureNames.TheHiddenWorld;\n txt =\n \"WAKE UP SHEEPLE

\" +\n \"THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY

\" +\n \"THE ILLUMINATI ARE THE SECRET RULERS OF THE WORLD!

\" +\n \"Yes, the Illuminati of legends. The ancient secret society that controls the entire \" +\n \"world from the shadows with their invisible hand. The group of the rich and wealthy \" +\n \"that have penetrated every major government, financial agency, and corporation in the last \" +\n \"three hundred years.

\" +\n \"OPEN YOUR EYES

\" +\n \"It was the Illuminati that brought an end to democracy in the world. They are the driving force \" +\n \"behind everything that happens.

\" +\n \"THEY ARE ALL AROUND YOU

\" +\n \"After destabilizing the world's governments, they are now entering the final stage of their master plan. \" +\n \"They will secretly initiate global crises. Terrorism. Pandemics. World War. And out of the chaos \" +\n \"that ensues they will build their New World Order.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"The New God\";\n fn = LiteratureNames.TheNewGod;\n txt =\n \"Everyone has a moment in their life when they wonder about the bigger questions.

\" +\n \"What's the point of all this? What is my purpose?

\" +\n \"Some people dare to think even bigger.

\" +\n \"What will the fate of the human race be?

\" +\n \"We live in an era vastly different from that of 15 or even 20 years ago. We have gone \" +\n \"beyond the limits of humanity. We have stripped ourselves of the tyranny of flesh.

\" +\n \"The Singularity is here. The merging of man and machine. This is where humanity evolves into \";\n \"something greater. This is our future.

\" + \"Embrace it, and you will obey a new god. The God in the Machine.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"The New Triads\";\n fn = LiteratureNames.NewTriads;\n txt =\n \"The Triads were an ancient transnational crime syndicate based in China, Hong Kong, and other Asian \" +\n \"territories. They were often considered one of the first and biggest criminal secret societies. \" +\n \"While most of the branches of the Triads have been destroyed over the past few decades, the \" +\n \"crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. \" +\n \"The most notable of these is the Tetrads.

\" +\n \"It is widely believed that the Tetrads are a rogue group that splintered off from the Triads sometime in the \" +\n \"mid 21st century. The founders of the Tetrads, all of whom were ex-Triad members, believed that the \" +\n \"Triads were losing their purpose and direction. The Tetrads started off as a small group that mainly engaged \" +\n \"in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal \" +\n \"drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the \" +\n \"continent.

\" +\n \"Not much else is known about the Tetrads, or about the efforts the Asian governments and corporations are making \" +\n \"to take down this large new crime organization. Many believe that the Tetrads have infiltrated the governments \" +\n \"and powerful corporations in Asia, which has helped faciliate their recent rapid rise.\";\n Literatures[fn] = new Literature(title, fn, txt);\n\n title = \"The Secret War\";\n fn = LiteratureNames.TheSecretWar;\n txt = \"\";\n Literatures[fn] = new Literature(title, fn, txt);\n})();\n","import * as augmentationMethods from \"./PlayerObjectAugmentationMethods\";\nimport * as bladeburnerMethods from \"./PlayerObjectBladeburnerMethods\";\nimport * as corporationMethods from \"./PlayerObjectCorporationMethods\";\nimport * as gangMethods from \"./PlayerObjectGangMethods\";\nimport * as generalMethods from \"./PlayerObjectGeneralMethods\";\nimport * as serverMethods from \"./PlayerObjectServerMethods\";\n\nimport { HashManager } from \"../../Hacknet/HashManager\";\nimport { CityName } from \"../../Locations/data/CityNames\";\n\nimport { MoneySourceTracker } from \"../../utils/MoneySourceTracker\";\nimport { Reviver, Generic_toJSON, Generic_fromJSON } from \"../../../utils/JSONReviver\";\n\nimport Decimal from \"decimal.js\";\n\nexport function PlayerObject() {\n //Skills and stats\n this.hacking_skill = 1;\n\n //Combat stats\n this.hp = 10;\n this.max_hp = 10;\n this.strength = 1;\n this.defense = 1;\n this.dexterity = 1;\n this.agility = 1;\n\n //Labor stats\n this.charisma = 1;\n\n //Special stats\n this.intelligence = 0;\n\n //Hacking multipliers\n this.hacking_chance_mult = 1;\n this.hacking_speed_mult = 1;\n this.hacking_money_mult = 1;\n this.hacking_grow_mult = 1;\n\n //Experience and multipliers\n this.hacking_exp = 0;\n this.strength_exp = 0;\n this.defense_exp = 0;\n this.dexterity_exp = 0;\n this.agility_exp = 0;\n this.charisma_exp = 0;\n this.intelligence_exp = 0;\n\n this.hacking_mult = 1;\n this.strength_mult = 1;\n this.defense_mult = 1;\n this.dexterity_mult = 1;\n this.agility_mult = 1;\n this.charisma_mult = 1;\n\n this.hacking_exp_mult = 1;\n this.strength_exp_mult = 1;\n this.defense_exp_mult = 1;\n this.dexterity_exp_mult = 1;\n this.agility_exp_mult = 1;\n this.charisma_exp_mult = 1;\n\n this.company_rep_mult = 1;\n this.faction_rep_mult = 1;\n\n //Money\n this.money = new Decimal(1000);\n\n //IP Address of Starting (home) computer\n this.homeComputer = \"\";\n\n //Location information\n this.city = CityName.Sector12;\n this.location = \"\";\n\n // Jobs that the player holds\n // Map of company name (key) -> name of company position (value. Just the name, not the CompanyPosition object)\n // The CompanyPosition name must match a key value in CompanyPositions\n this.jobs = {};\n\n // Company at which player is CURRENTLY working (only valid when the player is actively working)\n this.companyName = \"\"; // Name of Company. Must match a key value in Companies map\n\n // Servers\n this.currentServer = \"\"; //IP address of Server currently being accessed through terminal\n this.purchasedServers = []; //IP Addresses of purchased servers\n\n // Hacknet Nodes/Servers\n this.hacknetNodes = []; // Note: For Hacknet Servers, this array holds the IP addresses of the servers\n this.hashManager = new HashManager();\n\n //Factions\n this.factions = []; //Names of all factions player has joined\n this.factionInvitations = []; //Outstanding faction invitations\n\n //Augmentations\n this.queuedAugmentations = [];\n this.augmentations = [];\n\n this.sourceFiles = [];\n\n //Crime statistics\n this.numPeopleKilled = 0;\n this.karma = 0;\n\n this.crime_money_mult = 1;\n this.crime_success_mult = 1;\n\n //Flags/variables for working (Company, Faction, Creating Program, Taking Class)\n this.isWorking = false;\n this.focus = false;\n this.workType = \"\";\n\n this.currentWorkFactionName = \"\";\n this.currentWorkFactionDescription = \"\";\n\n this.workHackExpGainRate = 0;\n this.workStrExpGainRate = 0;\n this.workDefExpGainRate = 0;\n this.workDexExpGainRate = 0;\n this.workAgiExpGainRate = 0;\n this.workChaExpGainRate = 0;\n this.workRepGainRate = 0;\n this.workMoneyGainRate = 0;\n this.workMoneyLossRate = 0;\n\n this.workHackExpGained = 0;\n this.workStrExpGained = 0;\n this.workDefExpGained = 0;\n this.workDexExpGained = 0;\n this.workAgiExpGained = 0;\n this.workChaExpGained = 0;\n this.workRepGained = 0;\n this.workMoneyGained = 0;\n\n this.createProgramName = \"\";\n this.createProgramReqLvl = 0;\n\n this.className = \"\";\n\n this.crimeType = \"\";\n\n this.timeWorked = 0; //in ms\n this.timeWorkedCreateProgram = 0;\n this.timeNeededToCompleteWork = 0;\n\n this.work_money_mult = 1;\n\n //Hacknet Node multipliers\n this.hacknet_node_money_mult = 1;\n this.hacknet_node_purchase_cost_mult = 1;\n this.hacknet_node_ram_cost_mult = 1;\n this.hacknet_node_core_cost_mult = 1;\n this.hacknet_node_level_cost_mult = 1;\n\n //Stock Market\n this.hasWseAccount = false;\n this.hasTixApiAccess = false;\n this.has4SData = false;\n this.has4SDataTixApi = false;\n\n //Gang\n this.gang = null;\n\n //Corporation\n this.corporation = null;\n\n //Bladeburner\n this.bladeburner = null;\n this.bladeburner_max_stamina_mult = 1;\n this.bladeburner_stamina_gain_mult = 1;\n this.bladeburner_analysis_mult = 1; //Field Analysis Only\n this.bladeburner_success_chance_mult = 1;\n\n // Sleeves & Re-sleeving\n this.sleeves = [];\n this.resleeves = [];\n this.sleevesFromCovenant = 0; // # of Duplicate sleeves purchased from the covenant\n\n //bitnode\n this.bitNodeN = 1;\n\n //Flags for determining whether certain \"thresholds\" have been achieved\n this.firstFacInvRecvd = false;\n this.firstAugPurchased = false;\n this.firstTimeTraveled = false;\n this.firstProgramAvailable = false;\n\n //Used to store the last update time.\n this.lastUpdate = 0;\n this.totalPlaytime = 0;\n this.playtimeSinceLastAug = 0;\n this.playtimeSinceLastBitnode = 0;\n\n // Keep track of where money comes from\n this.moneySourceA = new MoneySourceTracker(); // Where money comes from since last-installed Augmentation\n this.moneySourceB = new MoneySourceTracker(); // Where money comes from for this entire BitNode run\n\n // Production since last Augmentation installation\n this.scriptProdSinceLastAug = 0;\n\n this.exploits = [];\n}\n\n// Apply player methods to the prototype using Object.assign()\nObject.assign(\n PlayerObject.prototype,\n generalMethods,\n serverMethods,\n bladeburnerMethods,\n corporationMethods,\n gangMethods,\n augmentationMethods,\n);\n\nPlayerObject.prototype.toJSON = function () {\n return Generic_toJSON(\"PlayerObject\", this);\n};\n\nPlayerObject.fromJSON = function (value) {\n return Generic_fromJSON(PlayerObject, value.data);\n};\n\nReviver.constructors.PlayerObject = PlayerObject;\n","/**\n * Augmentation-related methods for the Player class (PlayerObject)\n */\nimport { IPlayer } from \"../IPlayer\";\n\nimport { Augmentation } from \"../../Augmentation/Augmentation\";\n\nexport function hasAugmentation(this: IPlayer, aug: string | Augmentation): boolean {\n const augName: string = aug instanceof Augmentation ? aug.name : aug;\n\n for (const owned of this.augmentations) {\n if (owned.name === augName) {\n return true;\n }\n }\n\n for (const owned of this.queuedAugmentations) {\n if (owned.name === augName) {\n return true;\n }\n }\n\n return false;\n}\n","import { Bladeburner } from \"../../Bladeburner/Bladeburner\";\nimport { SourceFileFlags } from \"../../SourceFile/SourceFileFlags\";\n\nexport function canAccessBladeburner() {\n if (this.bitNodeN === 8) {\n return false;\n }\n\n return this.bitNodeN === 6 || this.bitNodeN === 7 || SourceFileFlags[6] > 0 || SourceFileFlags[7] > 0;\n}\n\nexport function inBladeburner() {\n if (this.bladeburner == null) {\n return false;\n }\n return this.bladeburner instanceof Bladeburner;\n}\n\nexport function startBladeburner() {\n this.bladeburner = new Bladeburner(this);\n}\n","/**\n * Clears defined properties from an object.\n * Does not delete up the prototype chain.\n * @deprecated Look into using `Map` or `Set` rather than manipulating properties on an Object.\n * @param obj the object to clear all properties\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function clearObject(obj: any): void {\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n // tslint:disable-next-line:no-dynamic-delete\n delete obj[key];\n }\n }\n}\n","import * as posNames from \"./companypositionnames\";\nimport { IConstructorParams } from \"../Company\";\n\nimport { IMap } from \"../../types\";\nimport { LocationName } from \"../../Locations/data/LocationNames\";\n\n// Create Objects containing Company Positions by category\n// Will help in metadata construction later\nconst AllSoftwarePositions: IMap = {};\nconst AllITPositions: IMap = {};\nconst AllNetworkEngineerPositions: IMap = {};\nconst SecurityEngineerPositions: IMap = {};\nconst AllTechnologyPositions: IMap = {};\nconst AllBusinessPositions: IMap = {};\nconst AllAgentPositions: IMap = {};\nconst AllSecurityPositions: IMap = {};\nconst AllSoftwareConsultantPositions: IMap = {};\nconst AllBusinessConsultantPositions: IMap = {};\nconst SoftwarePositionsUpToHeadOfEngineering: IMap = {};\nconst SoftwarePositionsUpToLeadDeveloper: IMap = {};\nconst BusinessPositionsUpToOperationsManager: IMap = {};\nconst WaiterOnly: IMap = {};\nconst EmployeeOnly: IMap = {};\nconst PartTimeWaiterOnly: IMap = {};\nconst PartTimeEmployeeOnly: IMap = {};\nconst OperationsManagerOnly: IMap = {};\nconst CEOOnly: IMap = {};\n\nposNames.SoftwareCompanyPositions.forEach((e) => {\n AllSoftwarePositions[e] = true;\n AllTechnologyPositions[e] = true;\n});\n\nposNames.ITCompanyPositions.forEach((e) => {\n AllITPositions[e] = true;\n AllTechnologyPositions[e] = true;\n});\n\nposNames.NetworkEngineerCompanyPositions.forEach((e) => {\n AllNetworkEngineerPositions[e] = true;\n AllTechnologyPositions[e] = true;\n});\n\nAllTechnologyPositions[posNames.SecurityEngineerCompanyPositions[0]] = true;\nSecurityEngineerPositions[posNames.SecurityEngineerCompanyPositions[0]] = true;\n\nposNames.BusinessCompanyPositions.forEach((e) => {\n AllBusinessPositions[e] = true;\n});\n\nposNames.SecurityCompanyPositions.forEach((e) => {\n AllSecurityPositions[e] = true;\n});\n\nposNames.AgentCompanyPositions.forEach((e) => {\n AllAgentPositions[e] = true;\n});\n\nposNames.SoftwareConsultantCompanyPositions.forEach((e) => {\n AllSoftwareConsultantPositions[e] = true;\n});\n\nposNames.BusinessConsultantCompanyPositions.forEach((e) => {\n AllBusinessConsultantPositions[e] = true;\n});\n\nfor (let i = 0; i < posNames.SoftwareCompanyPositions.length; ++i) {\n const e = posNames.SoftwareCompanyPositions[i];\n if (i <= 5) {\n SoftwarePositionsUpToHeadOfEngineering[e] = true;\n }\n if (i <= 3) {\n SoftwarePositionsUpToLeadDeveloper[e] = true;\n }\n}\nfor (let i = 0; i < posNames.BusinessCompanyPositions.length; ++i) {\n const e = posNames.BusinessCompanyPositions[i];\n if (i <= 3) {\n BusinessPositionsUpToOperationsManager[e] = true;\n }\n}\n\nWaiterOnly[posNames.MiscCompanyPositions[0]] = true;\nEmployeeOnly[posNames.MiscCompanyPositions[1]] = true;\nPartTimeWaiterOnly[posNames.PartTimeCompanyPositions[0]] = true;\nPartTimeEmployeeOnly[posNames.PartTimeCompanyPositions[1]] = true;\nOperationsManagerOnly[posNames.BusinessCompanyPositions[3]] = true;\nCEOOnly[posNames.BusinessCompanyPositions[5]] = true;\n\n// Metadata\nexport const companiesMetadata: IConstructorParams[] = [\n {\n name: LocationName.AevumECorp,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSecurityPositions),\n expMultiplier: 3,\n salaryMultiplier: 3,\n jobStatReqOffset: 249,\n },\n {\n name: LocationName.Sector12MegaCorp,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSecurityPositions),\n expMultiplier: 3,\n salaryMultiplier: 3,\n jobStatReqOffset: 249,\n },\n {\n name: LocationName.AevumBachmanAndAssociates,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSecurityPositions),\n expMultiplier: 2.6,\n salaryMultiplier: 2.6,\n jobStatReqOffset: 224,\n },\n {\n name: LocationName.Sector12BladeIndustries,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSecurityPositions),\n expMultiplier: 2.75,\n salaryMultiplier: 2.75,\n jobStatReqOffset: 224,\n },\n {\n name: LocationName.VolhavenNWO,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSecurityPositions),\n expMultiplier: 2.75,\n salaryMultiplier: 2.75,\n jobStatReqOffset: 249,\n },\n {\n name: LocationName.AevumClarkeIncorporated,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSecurityPositions),\n expMultiplier: 2.25,\n salaryMultiplier: 2.25,\n jobStatReqOffset: 224,\n },\n {\n name: LocationName.VolhavenOmniTekIncorporated,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSecurityPositions),\n expMultiplier: 2.25,\n salaryMultiplier: 2.25,\n jobStatReqOffset: 224,\n },\n {\n name: LocationName.Sector12FourSigma,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSecurityPositions),\n expMultiplier: 2.5,\n salaryMultiplier: 2.5,\n jobStatReqOffset: 224,\n },\n {\n name: LocationName.ChongqingKuaiGongInternational,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSecurityPositions),\n expMultiplier: 2.2,\n salaryMultiplier: 2.2,\n jobStatReqOffset: 224,\n },\n {\n name: LocationName.AevumFulcrumTechnologies,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions),\n expMultiplier: 2,\n salaryMultiplier: 2,\n jobStatReqOffset: 224,\n },\n {\n name: LocationName.IshimaStormTechnologies,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllSoftwareConsultantPositions, AllBusinessPositions),\n expMultiplier: 1.8,\n salaryMultiplier: 1.8,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.NewTokyoDefComm,\n info: \"\",\n companyPositions: Object.assign({}, CEOOnly, AllTechnologyPositions, AllSoftwareConsultantPositions),\n expMultiplier: 1.75,\n salaryMultiplier: 1.75,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.VolhavenHeliosLabs,\n info: \"\",\n companyPositions: Object.assign({}, CEOOnly, AllTechnologyPositions, AllSoftwareConsultantPositions),\n expMultiplier: 1.8,\n salaryMultiplier: 1.8,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.NewTokyoVitaLife,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSoftwareConsultantPositions),\n expMultiplier: 1.8,\n salaryMultiplier: 1.8,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.Sector12IcarusMicrosystems,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSoftwareConsultantPositions),\n expMultiplier: 1.9,\n salaryMultiplier: 1.9,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.Sector12UniversalEnergy,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSoftwareConsultantPositions),\n expMultiplier: 2,\n salaryMultiplier: 2,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.AevumGalacticCybersystems,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions, AllBusinessPositions, AllSoftwareConsultantPositions),\n expMultiplier: 1.9,\n salaryMultiplier: 1.9,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.AevumAeroCorp,\n info: \"\",\n companyPositions: Object.assign({}, CEOOnly, OperationsManagerOnly, AllTechnologyPositions, AllSecurityPositions),\n expMultiplier: 1.7,\n salaryMultiplier: 1.7,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.VolhavenOmniaCybersystems,\n info: \"\",\n companyPositions: Object.assign({}, CEOOnly, OperationsManagerOnly, AllTechnologyPositions, AllSecurityPositions),\n expMultiplier: 1.7,\n salaryMultiplier: 1.7,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.ChongqingSolarisSpaceSystems,\n info: \"\",\n companyPositions: Object.assign({}, CEOOnly, OperationsManagerOnly, AllTechnologyPositions, AllSecurityPositions),\n expMultiplier: 1.7,\n salaryMultiplier: 1.7,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.Sector12DeltaOne,\n info: \"\",\n companyPositions: Object.assign({}, CEOOnly, OperationsManagerOnly, AllTechnologyPositions, AllSecurityPositions),\n expMultiplier: 1.6,\n salaryMultiplier: 1.6,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.NewTokyoGlobalPharmaceuticals,\n info: \"\",\n companyPositions: Object.assign(\n {},\n AllTechnologyPositions,\n AllBusinessPositions,\n AllSoftwareConsultantPositions,\n AllSecurityPositions,\n ),\n expMultiplier: 1.8,\n salaryMultiplier: 1.8,\n jobStatReqOffset: 224,\n },\n {\n name: LocationName.IshimaNovaMedical,\n info: \"\",\n companyPositions: Object.assign(\n {},\n AllTechnologyPositions,\n AllBusinessPositions,\n AllSoftwareConsultantPositions,\n AllSecurityPositions,\n ),\n expMultiplier: 1.75,\n salaryMultiplier: 1.75,\n jobStatReqOffset: 199,\n },\n {\n name: LocationName.Sector12CIA,\n info: \"\",\n companyPositions: Object.assign(\n {},\n SoftwarePositionsUpToHeadOfEngineering,\n AllNetworkEngineerPositions,\n SecurityEngineerPositions,\n AllITPositions,\n AllSecurityPositions,\n AllAgentPositions,\n ),\n expMultiplier: 2,\n salaryMultiplier: 2,\n jobStatReqOffset: 149,\n },\n {\n name: LocationName.Sector12NSA,\n info: \"\",\n companyPositions: Object.assign(\n {},\n SoftwarePositionsUpToHeadOfEngineering,\n AllNetworkEngineerPositions,\n SecurityEngineerPositions,\n AllITPositions,\n AllSecurityPositions,\n AllAgentPositions,\n ),\n expMultiplier: 2,\n salaryMultiplier: 2,\n jobStatReqOffset: 149,\n },\n {\n name: LocationName.AevumWatchdogSecurity,\n info: \"\",\n companyPositions: Object.assign(\n {},\n SoftwarePositionsUpToHeadOfEngineering,\n AllNetworkEngineerPositions,\n AllITPositions,\n AllSecurityPositions,\n AllAgentPositions,\n AllSoftwareConsultantPositions,\n ),\n expMultiplier: 1.5,\n salaryMultiplier: 1.5,\n jobStatReqOffset: 124,\n },\n {\n name: LocationName.VolhavenLexoCorp,\n info: \"\",\n companyPositions: Object.assign(\n {},\n AllTechnologyPositions,\n AllSoftwareConsultantPositions,\n AllBusinessPositions,\n AllSecurityPositions,\n ),\n expMultiplier: 1.4,\n salaryMultiplier: 1.4,\n jobStatReqOffset: 99,\n },\n {\n name: LocationName.AevumRhoConstruction,\n info: \"\",\n companyPositions: Object.assign({}, SoftwarePositionsUpToLeadDeveloper, BusinessPositionsUpToOperationsManager),\n expMultiplier: 1.3,\n salaryMultiplier: 1.3,\n jobStatReqOffset: 49,\n },\n {\n name: LocationName.Sector12AlphaEnterprises,\n info: \"\",\n companyPositions: Object.assign(\n {},\n SoftwarePositionsUpToLeadDeveloper,\n BusinessPositionsUpToOperationsManager,\n AllSoftwareConsultantPositions,\n ),\n expMultiplier: 1.5,\n salaryMultiplier: 1.5,\n jobStatReqOffset: 99,\n },\n {\n name: LocationName.AevumPolice,\n info: \"\",\n companyPositions: Object.assign({}, AllSecurityPositions, SoftwarePositionsUpToLeadDeveloper),\n expMultiplier: 1.3,\n salaryMultiplier: 1.3,\n jobStatReqOffset: 99,\n },\n {\n name: LocationName.VolhavenSysCoreSecurities,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions),\n expMultiplier: 1.3,\n salaryMultiplier: 1.3,\n jobStatReqOffset: 124,\n },\n {\n name: LocationName.VolhavenCompuTek,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions),\n expMultiplier: 1.2,\n salaryMultiplier: 1.2,\n jobStatReqOffset: 74,\n },\n {\n name: LocationName.AevumNetLinkTechnologies,\n info: \"\",\n companyPositions: Object.assign({}, AllTechnologyPositions),\n expMultiplier: 1.2,\n salaryMultiplier: 1.2,\n jobStatReqOffset: 99,\n },\n {\n name: LocationName.Sector12CarmichaelSecurity,\n info: \"\",\n companyPositions: Object.assign(\n {},\n AllTechnologyPositions,\n AllSoftwareConsultantPositions,\n AllAgentPositions,\n AllSecurityPositions,\n ),\n expMultiplier: 1.2,\n salaryMultiplier: 1.2,\n jobStatReqOffset: 74,\n },\n {\n name: LocationName.Sector12FoodNStuff,\n info: \"\",\n companyPositions: Object.assign({}, EmployeeOnly, PartTimeEmployeeOnly),\n expMultiplier: 1,\n salaryMultiplier: 1,\n jobStatReqOffset: 0,\n },\n {\n name: LocationName.Sector12JoesGuns,\n info: \"\",\n companyPositions: Object.assign({}, EmployeeOnly, PartTimeEmployeeOnly),\n expMultiplier: 1,\n salaryMultiplier: 1,\n jobStatReqOffset: 0,\n },\n {\n name: LocationName.IshimaOmegaSoftware,\n info: \"\",\n companyPositions: Object.assign({}, AllSoftwarePositions, AllSoftwareConsultantPositions, AllITPositions),\n expMultiplier: 1.1,\n salaryMultiplier: 1.1,\n jobStatReqOffset: 49,\n },\n {\n name: LocationName.NewTokyoNoodleBar,\n info: \"\",\n companyPositions: Object.assign({}, WaiterOnly, PartTimeWaiterOnly),\n expMultiplier: 1,\n salaryMultiplier: 1,\n jobStatReqOffset: 0,\n },\n];\n","export interface IConstructorParams {\n name: string;\n cost: number;\n desc: string;\n advertisingMult?: number;\n employeeChaMult?: number;\n employeeCreMult?: number;\n employeeEffMult?: number;\n employeeIntMult?: number;\n productionMult?: number;\n productProductionMult?: number;\n salesMult?: number;\n sciResearchMult?: number;\n storageMult?: number;\n}\n\nexport class Research {\n // Name of research. This will be used to identify researches in the Research Tree\n name = \"\";\n\n // How much scientific research it costs to unlock this\n cost = 0;\n\n // Description of what the Research does\n desc = \"\";\n\n // All possible generic upgrades for the company, in the form of multipliers\n advertisingMult = 1;\n employeeChaMult = 1;\n employeeCreMult = 1;\n employeeEffMult = 1;\n employeeIntMult = 1;\n productionMult = 1;\n productProductionMult = 1;\n salesMult = 1;\n sciResearchMult = 1;\n storageMult = 1;\n\n constructor(p: IConstructorParams = { name: \"\", cost: 0, desc: \"\" }) {\n this.name = p.name;\n this.cost = p.cost;\n this.desc = p.desc;\n if (p.advertisingMult) {\n this.advertisingMult = p.advertisingMult;\n }\n if (p.employeeChaMult) {\n this.employeeChaMult = p.employeeChaMult;\n }\n if (p.employeeCreMult) {\n this.employeeCreMult = p.employeeCreMult;\n }\n if (p.employeeEffMult) {\n this.employeeEffMult = p.employeeEffMult;\n }\n if (p.employeeIntMult) {\n this.employeeIntMult = p.employeeIntMult;\n }\n if (p.productionMult) {\n this.productionMult = p.productionMult;\n }\n if (p.productProductionMult) {\n this.productProductionMult = p.productProductionMult;\n }\n if (p.salesMult) {\n this.salesMult = p.salesMult;\n }\n if (p.sciResearchMult) {\n this.sciResearchMult = p.sciResearchMult;\n }\n if (p.storageMult) {\n this.storageMult = p.storageMult;\n }\n }\n}\n","import { IConstructorParams } from \"../Research\";\n\nexport const researchMetadata: IConstructorParams[] = [\n {\n name: \"AutoBrew\",\n cost: 12e3,\n desc:\n \"Automatically keep your employees fully caffeinated with \" +\n \"coffee injections. This research will keep the energy of all \" +\n \"employees at its maximum possible value, for no cost. \" +\n \"This will also disable the Coffee upgrade.\",\n },\n {\n name: \"AutoPartyManager\",\n cost: 15e3,\n desc:\n \"Automatically analyzes your employees' happiness and morale \" +\n \"and boosts them whenever it detects a decrease. This research will \" +\n \"keep the morale and happiness of all employees at their maximum possible \" +\n \"values, for no cost. \" +\n \"This will also disable the 'Throw Party' feature.\",\n },\n {\n name: \"Automatic Drug Administration\",\n cost: 10e3,\n desc:\n \"Research how to automatically administer performance-enhacing drugs to all of \" +\n \"your employees. This unlocks Drug-related Research.\",\n },\n {\n name: \"Bulk Purchasing\",\n cost: 5e3,\n desc:\n \"Research the art of buying materials in bulk. This allows you to purchase \" +\n \"any amount of a material instantly.\",\n },\n {\n name: \"CPH4 Injections\",\n cost: 25e3,\n desc:\n \"Develop an advanced and harmless synthetic drug that is administered to \" +\n \"employees to increase all of their stats, except experience, by 10%.\",\n employeeCreMult: 1.1,\n employeeChaMult: 1.1,\n employeeEffMult: 1.1,\n employeeIntMult: 1.1,\n },\n {\n name: \"Drones\",\n cost: 5e3,\n desc:\n \"Acquire the knowledge needed to create advanced drones. This research does nothing \" +\n \"by itself, but unlocks other Drone-related research.\",\n },\n {\n name: \"Drones - Assembly\",\n cost: 25e3,\n desc:\n \"Manufacture and use Assembly Drones to improve the efficiency of \" +\n \"your production lines. This increases all production by 20%.\",\n productionMult: 1.2,\n },\n {\n name: \"Drones - Transport\",\n cost: 30e3,\n desc:\n \"Manufacture and use intelligent Transport Drones to optimize \" +\n \"your warehouses. This increases the storage space of all warehouses \" +\n \"by 50%.\",\n storageMult: 1.5,\n },\n {\n name: \"Go-Juice\",\n cost: 25e3,\n desc:\n \"Provide employees with Go-Juice, a coffee-derivative that further enhances \" +\n \"the brain's dopamine production. This increases the maximum energy of all \" +\n \"employees by 10.\",\n },\n {\n name: \"Hi-Tech R&D Laboratory\",\n cost: 5e3,\n desc:\n \"Construct a cutting edge facility dedicated to advanced research and \" +\n \"and development. This allows you to spend Scientific Research \" +\n \"on powerful upgrades. It also globally increases Scientific Research \" +\n \"production by 10%.\",\n sciResearchMult: 1.1,\n },\n {\n name: \"HRBuddy-Recruitment\",\n cost: 15e3,\n desc:\n \"Use automated software to handle the hiring of employees. With this \" +\n \"research, each office will automatically hire one employee per \" +\n \"market cycle if there is available space.\",\n },\n {\n name: \"HRBuddy-Training\",\n cost: 20e3,\n desc:\n \"Use automated software to handle the training of employees. With this \" +\n \"research, each employee hired with HRBuddy-Recruitment will automatically \" +\n \"be assigned to 'Training', rather than being unassigned.\",\n },\n {\n name: \"JoyWire\",\n cost: 20e3,\n desc: \"A brain implant which is installed in employees, increasing their \" + \"maximum happiness by 10.\",\n },\n {\n name: \"Market-TA.I\",\n cost: 20e3,\n desc:\n \"Develop advanced AI software that uses technical analysis to \" +\n \"help you understand and exploit the market. This research \" +\n \"allows you to know what price to sell your Materials/Products \" +\n \"at in order to avoid losing sales due to having too high of a mark-up. \" +\n \"It also lets you automatically use that sale price.\",\n },\n {\n name: \"Market-TA.II\",\n cost: 50e3,\n desc:\n \"Develop double-advanced AI software that uses technical analysis to \" +\n \"help you understand and exploit the market. This research \" +\n \"allows you to know how many sales of a Material/Product you lose or gain \" +\n \"from having too high or too low or a sale price. It also lets you automatically \" +\n \"set the sale price of your Materials/Products at the optimal price such that \" +\n \"the amount sold matches the amount produced.\",\n },\n {\n name: \"Overclock\",\n cost: 15e3,\n desc:\n \"Equip employees with a headset that uses transcranial direct current \" +\n \"stimulation (tDCS) to increase the speed of their neurotransmitters. \" +\n \"This research increases the intelligence and efficiency of all \" +\n \"employees by 25%.\",\n employeeEffMult: 1.25,\n employeeIntMult: 1.25,\n },\n {\n name: \"Self-Correcting Assemblers\",\n cost: 25e3,\n desc:\n \"Create assemblers that can be used for universal production. \" +\n \"These assemblers use deep learning to improve their efficiency \" +\n \"at their tasks. This research increases all production by 10%\",\n productionMult: 1.1,\n },\n {\n name: \"Sti.mu\",\n cost: 30e3,\n desc:\n \"Upgrade the tDCS headset to stimulate regions of the brain that \" +\n \"control confidence and enthusiasm. This research increases the max \" +\n \"morale of all employees by 10.\",\n },\n {\n name: \"sudo.Assist\",\n cost: 15e3,\n desc: \"Develop a virtual assistant AI to handle and manage administrative \" + \"issues for your corporation.\",\n },\n {\n name: \"uPgrade: Capacity.I\",\n cost: 20e3,\n desc:\n \"Expand the industry's capacity for designing and manufacturing its \" +\n \"various products. This increases the industry's maximum number of products \" +\n \"by 1 (from 3 to 4).\",\n },\n {\n name: \"uPgrade: Capacity.II\",\n cost: 30e3,\n desc:\n \"Expand the industry's capacity for designing and manufacturing its \" +\n \"various products. This increases the industry's maximum number of products \" +\n \"by 1 (from 4 to 5).\",\n },\n {\n name: \"uPgrade: Dashboard\",\n cost: 5e3,\n desc:\n \"Improve the software used to manage the industry's production line \" +\n \"for its various products. This allows you to manage the production and \" +\n \"sale of a product before it's finished being designed.\",\n },\n {\n name: \"uPgrade: Fulcrum\",\n cost: 10e3,\n desc:\n \"Streamline the manufacturing of this industry's various products. \" +\n \"This research increases the production of your products by 5%\",\n productProductionMult: 1.05,\n },\n];\n","/**\n * Initialization metadata for all Stocks. This is used to generate the\n * stock parameter values upon a reset\n *\n * Some notes:\n * - Megacorporations have better otlkMags\n * - Higher volatility -> Bigger spread\n * - Lower price -> Bigger spread\n * - Share tx required for movement used for balancing\n */\nimport { StockSymbols } from \"./StockSymbols\";\nimport { IConstructorParams } from \"../Stock\";\nimport { LocationName } from \"../../Locations/data/LocationNames\";\n\nexport const InitStockMetadata: IConstructorParams[] = [\n {\n b: true,\n initPrice: {\n max: 28e3,\n min: 17e3,\n },\n marketCap: 2.4e12,\n mv: {\n divisor: 100,\n max: 50,\n min: 40,\n },\n name: LocationName.AevumECorp,\n otlkMag: 19,\n spreadPerc: {\n divisor: 10,\n max: 5,\n min: 1,\n },\n shareTxForMovement: {\n max: 90e3,\n min: 30e3,\n },\n symbol: StockSymbols[LocationName.AevumECorp],\n },\n\n {\n b: true,\n initPrice: {\n max: 34e3,\n min: 24e3,\n },\n marketCap: 2.4e12,\n mv: {\n divisor: 100,\n max: 50,\n min: 40,\n },\n name: LocationName.Sector12MegaCorp,\n otlkMag: 19,\n spreadPerc: {\n divisor: 10,\n max: 5,\n min: 1,\n },\n shareTxForMovement: {\n max: 90e3,\n min: 30e3,\n },\n symbol: StockSymbols[LocationName.Sector12MegaCorp],\n },\n\n {\n b: true,\n initPrice: {\n max: 25e3,\n min: 12e3,\n },\n marketCap: 1.6e12,\n mv: {\n divisor: 100,\n max: 80,\n min: 70,\n },\n name: LocationName.Sector12BladeIndustries,\n otlkMag: 13,\n spreadPerc: {\n divisor: 10,\n max: 6,\n min: 1,\n },\n shareTxForMovement: {\n max: 90e3,\n min: 30e3,\n },\n symbol: StockSymbols[LocationName.Sector12BladeIndustries],\n },\n\n {\n b: true,\n initPrice: {\n max: 25e3,\n min: 10e3,\n },\n marketCap: 1.5e12,\n mv: {\n divisor: 100,\n max: 75,\n min: 65,\n },\n name: LocationName.AevumClarkeIncorporated,\n otlkMag: 12,\n spreadPerc: {\n divisor: 10,\n max: 5,\n min: 1,\n },\n shareTxForMovement: {\n max: 90e3,\n min: 30e3,\n },\n symbol: StockSymbols[LocationName.AevumClarkeIncorporated],\n },\n\n {\n b: true,\n initPrice: {\n max: 43e3,\n min: 32e3,\n },\n marketCap: 1.8e12,\n mv: {\n divisor: 100,\n max: 70,\n min: 60,\n },\n name: LocationName.VolhavenOmniTekIncorporated,\n otlkMag: 12,\n spreadPerc: {\n divisor: 10,\n max: 6,\n min: 1,\n },\n shareTxForMovement: {\n max: 90e3,\n min: 30e3,\n },\n symbol: StockSymbols[LocationName.VolhavenOmniTekIncorporated],\n },\n\n {\n b: true,\n initPrice: {\n max: 80e3,\n min: 50e3,\n },\n marketCap: 2e12,\n mv: {\n divisor: 100,\n max: 110,\n min: 100,\n },\n name: LocationName.Sector12FourSigma,\n otlkMag: 17,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 1,\n },\n shareTxForMovement: {\n max: 90e3,\n min: 30e3,\n },\n symbol: StockSymbols[LocationName.Sector12FourSigma],\n },\n\n {\n b: true,\n initPrice: {\n max: 28e3,\n min: 16e3,\n },\n marketCap: 1.9e12,\n mv: {\n divisor: 100,\n max: 85,\n min: 75,\n },\n name: LocationName.ChongqingKuaiGongInternational,\n otlkMag: 10,\n spreadPerc: {\n divisor: 10,\n max: 7,\n min: 1,\n },\n shareTxForMovement: {\n max: 90e3,\n min: 30e3,\n },\n symbol: StockSymbols[LocationName.ChongqingKuaiGongInternational],\n },\n\n {\n b: true,\n initPrice: {\n max: 36e3,\n min: 29e3,\n },\n marketCap: 2e12,\n mv: {\n divisor: 100,\n max: 130,\n min: 120,\n },\n name: LocationName.AevumFulcrumTechnologies,\n otlkMag: 16,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 1,\n },\n shareTxForMovement: {\n max: 90e3,\n min: 30e3,\n },\n symbol: StockSymbols[LocationName.AevumFulcrumTechnologies],\n },\n\n {\n b: true,\n initPrice: {\n max: 25e3,\n min: 20e3,\n },\n marketCap: 1.2e12,\n mv: {\n divisor: 100,\n max: 90,\n min: 80,\n },\n name: LocationName.IshimaStormTechnologies,\n otlkMag: 7,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 2,\n },\n shareTxForMovement: {\n max: 108e3,\n min: 36e3,\n },\n symbol: StockSymbols[LocationName.IshimaStormTechnologies],\n },\n\n {\n b: true,\n initPrice: {\n max: 19e3,\n min: 6e3,\n },\n marketCap: 900e9,\n mv: {\n divisor: 100,\n max: 70,\n min: 60,\n },\n name: LocationName.NewTokyoDefComm,\n otlkMag: 10,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 2,\n },\n shareTxForMovement: {\n max: 108e3,\n min: 36e3,\n },\n symbol: StockSymbols[LocationName.NewTokyoDefComm],\n },\n\n {\n b: true,\n initPrice: {\n max: 18e3,\n min: 10e3,\n },\n marketCap: 825e9,\n mv: {\n divisor: 100,\n max: 65,\n min: 55,\n },\n name: LocationName.VolhavenHeliosLabs,\n otlkMag: 9,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 2,\n },\n shareTxForMovement: {\n max: 108e3,\n min: 36e3,\n },\n symbol: StockSymbols[LocationName.VolhavenHeliosLabs],\n },\n\n {\n b: true,\n initPrice: {\n max: 14e3,\n min: 8e3,\n },\n marketCap: 1e12,\n mv: {\n divisor: 100,\n max: 80,\n min: 70,\n },\n name: LocationName.NewTokyoVitaLife,\n otlkMag: 7,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 2,\n },\n shareTxForMovement: {\n max: 108e3,\n min: 36e3,\n },\n symbol: StockSymbols[LocationName.NewTokyoVitaLife],\n },\n\n {\n b: true,\n initPrice: {\n max: 24e3,\n min: 12e3,\n },\n marketCap: 800e9,\n mv: {\n divisor: 100,\n max: 70,\n min: 60,\n },\n name: LocationName.Sector12IcarusMicrosystems,\n otlkMag: 7.5,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 3,\n },\n shareTxForMovement: {\n max: 108e3,\n min: 36e3,\n },\n symbol: StockSymbols[LocationName.Sector12IcarusMicrosystems],\n },\n\n {\n b: true,\n initPrice: {\n max: 29e3,\n min: 16e3,\n },\n marketCap: 900e9,\n mv: {\n divisor: 100,\n max: 60,\n min: 50,\n },\n name: LocationName.Sector12UniversalEnergy,\n otlkMag: 10,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 2,\n },\n shareTxForMovement: {\n max: 108e3,\n min: 36e3,\n },\n symbol: StockSymbols[LocationName.Sector12UniversalEnergy],\n },\n\n {\n b: true,\n initPrice: {\n max: 17e3,\n min: 8e3,\n },\n marketCap: 640e9,\n mv: {\n divisor: 100,\n max: 65,\n min: 55,\n },\n name: LocationName.AevumAeroCorp,\n otlkMag: 6,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 3,\n },\n shareTxForMovement: {\n max: 126e3,\n min: 42e3,\n },\n symbol: StockSymbols[LocationName.AevumAeroCorp],\n },\n\n {\n b: true,\n initPrice: {\n max: 15e3,\n min: 6e3,\n },\n marketCap: 600e9,\n mv: {\n divisor: 100,\n max: 75,\n min: 65,\n },\n name: LocationName.VolhavenOmniaCybersystems,\n otlkMag: 4.5,\n spreadPerc: {\n divisor: 10,\n max: 11,\n min: 4,\n },\n shareTxForMovement: {\n max: 126e3,\n min: 42e3,\n },\n symbol: StockSymbols[LocationName.VolhavenOmniaCybersystems],\n },\n\n {\n b: true,\n initPrice: {\n max: 28e3,\n min: 14e3,\n },\n marketCap: 705e9,\n mv: {\n divisor: 100,\n max: 80,\n min: 70,\n },\n name: LocationName.ChongqingSolarisSpaceSystems,\n otlkMag: 8.5,\n spreadPerc: {\n divisor: 10,\n max: 12,\n min: 4,\n },\n shareTxForMovement: {\n max: 126e3,\n min: 42e3,\n },\n symbol: StockSymbols[LocationName.ChongqingSolarisSpaceSystems],\n },\n\n {\n b: true,\n initPrice: {\n max: 30e3,\n min: 12e3,\n },\n marketCap: 695e9,\n mv: {\n divisor: 100,\n max: 65,\n min: 55,\n },\n name: LocationName.NewTokyoGlobalPharmaceuticals,\n otlkMag: 10.5,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 4,\n },\n shareTxForMovement: {\n max: 126e3,\n min: 42e3,\n },\n symbol: StockSymbols[LocationName.NewTokyoGlobalPharmaceuticals],\n },\n\n {\n b: true,\n initPrice: {\n max: 27e3,\n min: 15e3,\n },\n marketCap: 600e9,\n mv: {\n divisor: 100,\n max: 80,\n min: 70,\n },\n name: LocationName.IshimaNovaMedical,\n otlkMag: 5,\n spreadPerc: {\n divisor: 10,\n max: 11,\n min: 4,\n },\n shareTxForMovement: {\n max: 126e3,\n min: 42e3,\n },\n symbol: StockSymbols[LocationName.IshimaNovaMedical],\n },\n\n {\n b: true,\n initPrice: {\n max: 8.5e3,\n min: 4e3,\n },\n marketCap: 450e9,\n mv: {\n divisor: 100,\n max: 260,\n min: 240,\n },\n name: LocationName.AevumWatchdogSecurity,\n otlkMag: 1.5,\n spreadPerc: {\n divisor: 10,\n max: 12,\n min: 5,\n },\n shareTxForMovement: {\n max: 54e3,\n min: 12e3,\n },\n symbol: StockSymbols[LocationName.AevumWatchdogSecurity],\n },\n\n {\n b: true,\n initPrice: {\n max: 8e3,\n min: 4.5e3,\n },\n marketCap: 300e9,\n mv: {\n divisor: 100,\n max: 135,\n min: 115,\n },\n name: LocationName.VolhavenLexoCorp,\n otlkMag: 6,\n spreadPerc: {\n divisor: 10,\n max: 12,\n min: 5,\n },\n shareTxForMovement: {\n max: 108e3,\n min: 36e3,\n },\n symbol: StockSymbols[LocationName.VolhavenLexoCorp],\n },\n\n {\n b: true,\n initPrice: {\n max: 7e3,\n min: 2e3,\n },\n marketCap: 180e9,\n mv: {\n divisor: 100,\n max: 70,\n min: 50,\n },\n name: LocationName.AevumRhoConstruction,\n otlkMag: 1,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 3,\n },\n shareTxForMovement: {\n max: 126e3,\n min: 60e3,\n },\n symbol: StockSymbols[LocationName.AevumRhoConstruction],\n },\n\n {\n b: true,\n initPrice: {\n max: 8.5e3,\n min: 4e3,\n },\n marketCap: 240e9,\n mv: {\n divisor: 100,\n max: 205,\n min: 175,\n },\n name: LocationName.Sector12AlphaEnterprises,\n otlkMag: 10,\n spreadPerc: {\n divisor: 10,\n max: 16,\n min: 5,\n },\n shareTxForMovement: {\n max: 90e3,\n min: 30e3,\n },\n symbol: StockSymbols[LocationName.Sector12AlphaEnterprises],\n },\n\n {\n b: true,\n initPrice: {\n max: 8e3,\n min: 3e3,\n },\n marketCap: 200e9,\n mv: {\n divisor: 100,\n max: 170,\n min: 150,\n },\n name: LocationName.VolhavenSysCoreSecurities,\n otlkMag: 3,\n spreadPerc: {\n divisor: 10,\n max: 12,\n min: 5,\n },\n shareTxForMovement: {\n max: 90e3,\n min: 15e3,\n },\n symbol: StockSymbols[LocationName.VolhavenSysCoreSecurities],\n },\n\n {\n b: true,\n initPrice: {\n max: 6e3,\n min: 1e3,\n },\n marketCap: 185e9,\n mv: {\n divisor: 100,\n max: 100,\n min: 80,\n },\n name: LocationName.VolhavenCompuTek,\n otlkMag: 4,\n spreadPerc: {\n divisor: 10,\n max: 12,\n min: 4,\n },\n shareTxForMovement: {\n max: 126e3,\n min: 60e3,\n },\n symbol: StockSymbols[LocationName.VolhavenCompuTek],\n },\n\n {\n b: true,\n initPrice: {\n max: 5e3,\n min: 1e3,\n },\n marketCap: 58e9,\n mv: {\n divisor: 100,\n max: 400,\n min: 200,\n },\n name: LocationName.AevumNetLinkTechnologies,\n otlkMag: 1,\n spreadPerc: {\n divisor: 10,\n max: 20,\n min: 5,\n },\n shareTxForMovement: {\n max: 54e3,\n min: 18e3,\n },\n symbol: StockSymbols[LocationName.AevumNetLinkTechnologies],\n },\n\n {\n b: true,\n initPrice: {\n max: 8e3,\n min: 1e3,\n },\n marketCap: 60e9,\n mv: {\n divisor: 100,\n max: 110,\n min: 90,\n },\n name: LocationName.IshimaOmegaSoftware,\n otlkMag: 0.5,\n spreadPerc: {\n divisor: 10,\n max: 13,\n min: 4,\n },\n shareTxForMovement: {\n max: 90e3,\n min: 30e3,\n },\n symbol: StockSymbols[LocationName.IshimaOmegaSoftware],\n },\n\n {\n b: false,\n initPrice: {\n max: 4.5e3,\n min: 500,\n },\n marketCap: 45e9,\n mv: {\n divisor: 100,\n max: 80,\n min: 70,\n },\n name: LocationName.Sector12FoodNStuff,\n otlkMag: 1,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 6,\n },\n shareTxForMovement: {\n max: 180e3,\n min: 60e3,\n },\n symbol: StockSymbols[LocationName.Sector12FoodNStuff],\n },\n\n {\n b: true,\n initPrice: {\n max: 3.5e3,\n min: 1.5e3,\n },\n marketCap: 30e9,\n mv: {\n divisor: 100,\n max: 275,\n min: 100,\n },\n name: \"Sigma Cosmetics\",\n otlkMag: 0,\n spreadPerc: {\n divisor: 10,\n max: 14,\n min: 6,\n },\n shareTxForMovement: {\n max: 70e3,\n min: 20e3,\n },\n symbol: StockSymbols[\"Sigma Cosmetics\"],\n },\n\n {\n b: true,\n initPrice: {\n max: 1.5e3,\n min: 250,\n },\n marketCap: 42e9,\n mv: {\n divisor: 100,\n max: 350,\n min: 200,\n },\n name: \"Joes Guns\",\n otlkMag: 1,\n spreadPerc: {\n divisor: 10,\n max: 14,\n min: 6,\n },\n shareTxForMovement: {\n max: 52e3,\n min: 15e3,\n },\n symbol: StockSymbols[\"Joes Guns\"],\n },\n\n {\n b: true,\n initPrice: {\n max: 1.5e3,\n min: 250,\n },\n marketCap: 100e9,\n mv: {\n divisor: 100,\n max: 175,\n min: 120,\n },\n name: \"Catalyst Ventures\",\n otlkMag: 13.5,\n spreadPerc: {\n divisor: 10,\n max: 14,\n min: 5,\n },\n shareTxForMovement: {\n max: 72e3,\n min: 24e3,\n },\n symbol: StockSymbols[\"Catalyst Ventures\"],\n },\n\n {\n b: true,\n initPrice: {\n max: 30e3,\n min: 15e3,\n },\n marketCap: 360e9,\n mv: {\n divisor: 100,\n max: 80,\n min: 70,\n },\n name: \"Microdyne Technologies\",\n otlkMag: 8,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 3,\n },\n shareTxForMovement: {\n max: 216e3,\n min: 90e3,\n },\n symbol: StockSymbols[\"Microdyne Technologies\"],\n },\n\n {\n b: true,\n initPrice: {\n max: 24e3,\n min: 12e3,\n },\n marketCap: 420e9,\n mv: {\n divisor: 100,\n max: 70,\n min: 50,\n },\n name: \"Titan Laboratories\",\n otlkMag: 11,\n spreadPerc: {\n divisor: 10,\n max: 10,\n min: 2,\n },\n shareTxForMovement: {\n max: 216e3,\n min: 90e3,\n },\n symbol: StockSymbols[\"Titan Laboratories\"],\n },\n];\n","import { setTimeoutRef } from \"../utils/SetTimeoutRef\";\nimport { getElementById } from \"../../utils/uiHelpers/getElementById\";\nimport { Action } from \"../types\";\n\nconst threeSeconds = 3000;\nlet x: number | undefined;\n\n/**\n * Displays a status message to the player for approximately 3 seconds.\n * @param text The status text to display\n */\nexport function createStatusText(text: string): void {\n const statusElement: HTMLElement = getElementById(\"status-text\");\n const handler: Action = () => {\n statusElement.innerText = \"\";\n statusElement.style.display = \"none\";\n statusElement.classList.remove(\"status-text\");\n };\n \n if (x !== undefined) {\n clearTimeout(x);\n // Likely not needed due to clearTimeout, but just in case...\n x = undefined;\n // reset the element's animation\n statusElement.style.animation = 'none';\n setTimeout(function() {\n statusElement.style.animation = '';\n }, 10);\n }\n\n statusElement.style.display = \"block\";\n statusElement.classList.add(\"status-text\");\n statusElement.innerText = text;\n\n x = setTimeoutRef(handler, threeSeconds);\n}\n","/**\n * Metadata for constructing Location objects for all Locations\n * in the game\n */\nimport { CityName } from \"./CityNames\";\nimport { LocationName } from \"./LocationNames\";\nimport { IConstructorParams } from \"../Location\";\nimport { LocationType } from \"../LocationTypeEnum\";\n\nexport const LocationsMetadata: IConstructorParams[] = [\n {\n city: CityName.Aevum,\n infiltrationData: {\n maxClearanceLevel: 12,\n startingSecurityLevel: 8.18,\n },\n name: LocationName.AevumAeroCorp,\n types: [LocationType.Company],\n },\n {\n city: CityName.Aevum,\n infiltrationData: {\n maxClearanceLevel: 15,\n startingSecurityLevel: 8.19,\n },\n name: LocationName.AevumBachmanAndAssociates,\n types: [LocationType.Company],\n },\n {\n city: CityName.Aevum,\n infiltrationData: {\n maxClearanceLevel: 18,\n startingSecurityLevel: 9.55,\n },\n name: LocationName.AevumClarkeIncorporated,\n types: [LocationType.Company],\n },\n {\n city: CityName.Aevum,\n costMult: 3,\n expMult: 2,\n name: LocationName.AevumCrushFitnessGym,\n types: [LocationType.Gym],\n },\n {\n city: CityName.Aevum,\n infiltrationData: {\n maxClearanceLevel: 37,\n startingSecurityLevel: 17.02,\n },\n name: LocationName.AevumECorp,\n types: [LocationType.Company, LocationType.TechVendor],\n techVendorMaxRam: 512,\n techVendorMinRam: 128,\n },\n {\n city: CityName.Aevum,\n infiltrationData: {\n maxClearanceLevel: 25,\n startingSecurityLevel: 15.54,\n },\n name: LocationName.AevumFulcrumTechnologies,\n types: [LocationType.Company, LocationType.TechVendor],\n techVendorMaxRam: 1024,\n techVendorMinRam: 256,\n },\n {\n city: CityName.Aevum,\n infiltrationData: {\n maxClearanceLevel: 12,\n startingSecurityLevel: 7.89,\n },\n name: LocationName.AevumGalacticCybersystems,\n types: [LocationType.Company],\n },\n {\n city: CityName.Aevum,\n infiltrationData: {\n maxClearanceLevel: 6,\n startingSecurityLevel: 3.29,\n },\n name: LocationName.AevumNetLinkTechnologies,\n types: [LocationType.Company, LocationType.TechVendor],\n techVendorMaxRam: 64,\n techVendorMinRam: 8,\n },\n {\n city: CityName.Aevum,\n infiltrationData: {\n maxClearanceLevel: 6,\n startingSecurityLevel: 5.35,\n },\n name: LocationName.AevumPolice,\n types: [LocationType.Company],\n },\n {\n city: CityName.Aevum,\n infiltrationData: {\n maxClearanceLevel: 5,\n startingSecurityLevel: 5.02,\n },\n name: LocationName.AevumRhoConstruction,\n types: [LocationType.Company],\n },\n {\n city: CityName.Aevum,\n costMult: 10,\n expMult: 5,\n name: LocationName.AevumSnapFitnessGym,\n types: [LocationType.Gym],\n },\n {\n city: CityName.Aevum,\n costMult: 4,\n expMult: 3,\n name: LocationName.AevumSummitUniversity,\n types: [LocationType.University],\n },\n {\n city: CityName.Aevum,\n infiltrationData: {\n maxClearanceLevel: 7,\n startingSecurityLevel: 5.85,\n },\n name: LocationName.AevumWatchdogSecurity,\n types: [LocationType.Company],\n },\n {\n city: CityName.Aevum,\n name: LocationName.AevumCasino,\n types: [LocationType.Casino],\n },\n {\n city: CityName.Chongqing,\n infiltrationData: {\n maxClearanceLevel: 25,\n startingSecurityLevel: 16.25,\n },\n name: LocationName.ChongqingKuaiGongInternational,\n types: [LocationType.Company],\n },\n {\n city: CityName.Chongqing,\n infiltrationData: {\n maxClearanceLevel: 18,\n startingSecurityLevel: 12.59,\n },\n name: LocationName.ChongqingSolarisSpaceSystems,\n types: [LocationType.Company],\n },\n {\n city: CityName.Ishima,\n infiltrationData: {\n maxClearanceLevel: 12,\n startingSecurityLevel: 5.02,\n },\n name: LocationName.IshimaNovaMedical,\n types: [LocationType.Company],\n },\n {\n city: CityName.Ishima,\n infiltrationData: {\n maxClearanceLevel: 10,\n startingSecurityLevel: 3.2,\n },\n name: LocationName.IshimaOmegaSoftware,\n types: [LocationType.Company, LocationType.TechVendor],\n techVendorMaxRam: 128,\n techVendorMinRam: 4,\n },\n {\n city: CityName.Ishima,\n infiltrationData: {\n maxClearanceLevel: 25,\n startingSecurityLevel: 5.38,\n },\n name: LocationName.IshimaStormTechnologies,\n types: [LocationType.Company, LocationType.TechVendor],\n techVendorMaxRam: 512,\n techVendorMinRam: 32,\n },\n {\n city: CityName.NewTokyo,\n infiltrationData: {\n maxClearanceLevel: 17,\n startingSecurityLevel: 7.18,\n },\n name: LocationName.NewTokyoDefComm,\n types: [LocationType.Company],\n },\n {\n city: CityName.NewTokyo,\n infiltrationData: {\n maxClearanceLevel: 20,\n startingSecurityLevel: 5.9,\n },\n name: LocationName.NewTokyoGlobalPharmaceuticals,\n types: [LocationType.Company],\n },\n {\n city: CityName.NewTokyo,\n infiltrationData: {\n maxClearanceLevel: 5,\n startingSecurityLevel: 2.5,\n },\n name: LocationName.NewTokyoNoodleBar,\n types: [LocationType.Company, LocationType.Special],\n },\n {\n city: CityName.NewTokyo,\n infiltrationData: {\n maxClearanceLevel: 25,\n startingSecurityLevel: 5.52,\n },\n name: LocationName.NewTokyoVitaLife,\n types: [LocationType.Company, LocationType.Special],\n },\n {\n city: CityName.Sector12,\n infiltrationData: {\n maxClearanceLevel: 10,\n startingSecurityLevel: 3.62,\n },\n name: LocationName.Sector12AlphaEnterprises,\n types: [LocationType.Company, LocationType.TechVendor],\n techVendorMaxRam: 8,\n techVendorMinRam: 2,\n },\n {\n city: CityName.Sector12,\n infiltrationData: {\n maxClearanceLevel: 25,\n startingSecurityLevel: 10.59,\n },\n name: LocationName.Sector12BladeIndustries,\n types: [LocationType.Company],\n },\n {\n city: CityName.Sector12,\n name: LocationName.Sector12CIA,\n types: [LocationType.Company],\n },\n {\n city: CityName.Sector12,\n infiltrationData: {\n maxClearanceLevel: 15,\n startingSecurityLevel: 4.66,\n },\n name: LocationName.Sector12CarmichaelSecurity,\n types: [LocationType.Company],\n },\n {\n city: CityName.Sector12,\n name: LocationName.Sector12CityHall,\n types: [LocationType.Special],\n },\n {\n city: CityName.Sector12,\n infiltrationData: {\n maxClearanceLevel: 12,\n startingSecurityLevel: 5.9,\n },\n name: LocationName.Sector12DeltaOne,\n types: [LocationType.Company],\n },\n {\n city: CityName.Sector12,\n name: LocationName.Sector12FoodNStuff,\n types: [LocationType.Company],\n },\n {\n city: CityName.Sector12,\n infiltrationData: {\n maxClearanceLevel: 25,\n startingSecurityLevel: 8.18,\n },\n name: LocationName.Sector12FourSigma,\n types: [LocationType.Company],\n },\n {\n city: CityName.Sector12,\n infiltrationData: {\n maxClearanceLevel: 17,\n startingSecurityLevel: 6.02,\n },\n name: LocationName.Sector12IcarusMicrosystems,\n types: [LocationType.Company],\n },\n {\n city: CityName.Sector12,\n expMult: 1,\n costMult: 1,\n name: LocationName.Sector12IronGym,\n types: [LocationType.Gym],\n },\n {\n city: CityName.Sector12,\n infiltrationData: {\n maxClearanceLevel: 5,\n startingSecurityLevel: 3.13,\n },\n name: LocationName.Sector12JoesGuns,\n types: [LocationType.Company],\n },\n {\n city: CityName.Sector12,\n infiltrationData: {\n maxClearanceLevel: 31,\n startingSecurityLevel: 16.36,\n },\n name: LocationName.Sector12MegaCorp,\n types: [LocationType.Company],\n },\n {\n city: CityName.Sector12,\n name: LocationName.Sector12NSA,\n types: [LocationType.Company, LocationType.Special],\n },\n {\n city: CityName.Sector12,\n costMult: 20,\n expMult: 10,\n name: LocationName.Sector12PowerhouseGym,\n types: [LocationType.Gym],\n },\n {\n city: CityName.Sector12,\n costMult: 3,\n expMult: 2,\n name: LocationName.Sector12RothmanUniversity,\n types: [LocationType.University],\n },\n {\n city: CityName.Sector12,\n infiltrationData: {\n maxClearanceLevel: 12,\n startingSecurityLevel: 5.9,\n },\n name: LocationName.Sector12UniversalEnergy,\n types: [LocationType.Company],\n },\n {\n city: CityName.Volhaven,\n infiltrationData: {\n maxClearanceLevel: 15,\n startingSecurityLevel: 3.59,\n },\n name: LocationName.VolhavenCompuTek,\n types: [LocationType.Company, LocationType.TechVendor],\n techVendorMaxRam: 256,\n techVendorMinRam: 8,\n },\n {\n city: CityName.Volhaven,\n infiltrationData: {\n maxClearanceLevel: 18,\n startingSecurityLevel: 7.28,\n },\n name: LocationName.VolhavenHeliosLabs,\n types: [LocationType.Company],\n },\n {\n city: CityName.Volhaven,\n infiltrationData: {\n maxClearanceLevel: 15,\n startingSecurityLevel: 4.35,\n },\n name: LocationName.VolhavenLexoCorp,\n types: [LocationType.Company],\n },\n {\n city: CityName.Volhaven,\n costMult: 7,\n expMult: 4,\n name: LocationName.VolhavenMilleniumFitnessGym,\n types: [LocationType.Gym],\n },\n {\n city: CityName.Volhaven,\n infiltrationData: {\n maxClearanceLevel: 50,\n startingSecurityLevel: 8.53,\n },\n name: LocationName.VolhavenNWO,\n types: [LocationType.Company],\n },\n {\n city: CityName.Volhaven,\n infiltrationData: {\n maxClearanceLevel: 25,\n startingSecurityLevel: 7.74,\n },\n name: LocationName.VolhavenOmniTekIncorporated,\n types: [LocationType.Company, LocationType.TechVendor],\n techVendorMaxRam: 1024,\n techVendorMinRam: 128,\n },\n {\n city: CityName.Volhaven,\n infiltrationData: {\n maxClearanceLevel: 22,\n startingSecurityLevel: 6,\n },\n name: LocationName.VolhavenOmniaCybersystems,\n types: [LocationType.Company],\n },\n {\n city: CityName.Volhaven,\n infiltrationData: {\n maxClearanceLevel: 18,\n startingSecurityLevel: 4.77,\n },\n name: LocationName.VolhavenSysCoreSecurities,\n types: [LocationType.Company],\n },\n {\n city: CityName.Volhaven,\n costMult: 5,\n expMult: 4,\n name: LocationName.VolhavenZBInstituteOfTechnology,\n types: [LocationType.University],\n },\n {\n city: null,\n name: LocationName.Hospital,\n types: [LocationType.Hospital],\n },\n {\n city: null,\n name: LocationName.Slums,\n types: [LocationType.Slums],\n },\n {\n city: null,\n name: LocationName.TravelAgency,\n types: [LocationType.TravelAgency],\n },\n {\n city: null,\n name: LocationName.WorldStockExchange,\n types: [LocationType.StockMarket],\n },\n];\n","import React, { useState, useEffect } from \"react\";\n\nimport Paper from \"@mui/material/Paper\";\nimport Typography from \"@mui/material/Typography\";\nimport IconButton from \"@mui/material/IconButton\";\nimport Button from \"@mui/material/Button\";\nimport ArrowForwardIos from \"@mui/icons-material/ArrowForwardIos\";\nimport ArrowBackIos from \"@mui/icons-material/ArrowBackIos\";\nimport { ITutorialEvents } from \"./ITutorialEvents\";\nimport { CopyableText } from \"../React/CopyableText\";\n\nimport ListItem from \"@mui/material/ListItem\";\nimport EqualizerIcon from \"@mui/icons-material/Equalizer\";\nimport LastPageIcon from \"@mui/icons-material/LastPage\";\nimport HelpIcon from \"@mui/icons-material/Help\";\nimport AccountTreeIcon from \"@mui/icons-material/AccountTree\";\nimport StorageIcon from \"@mui/icons-material/Storage\";\nimport LocationCityIcon from \"@mui/icons-material/LocationCity\";\nimport { Theme } from \"@mui/material/styles\";\nimport makeStyles from \"@mui/styles/makeStyles\";\nimport createStyles from \"@mui/styles/createStyles\";\n\nimport {\n iTutorialPrevStep,\n iTutorialNextStep,\n ITutorial,\n iTutorialSteps,\n iTutorialEnd,\n} from \"../../InteractiveTutorial\";\n\ninterface IContent {\n content: React.ReactElement;\n canNext: boolean;\n}\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n textfield: {\n borderBottom: \"1px solid \" + theme.palette.primary.main,\n },\n code: {\n whiteSpace: \"pre\",\n backgroundColor: theme.palette.background.paper,\n },\n }),\n);\n\nexport function InteractiveTutorialRoot(): React.ReactElement {\n const classes = useStyles();\n\n const contents: { [number: string]: IContent | undefined } = {\n [iTutorialSteps.Start as number]: {\n content: (\n <>\n \n Welcome to Bitburner, a cyberpunk-themed incremental RPG! The game takes place in a dark, dystopian\n future... The year is 2077...\n
\n
\n This tutorial will show you the basics of the game. You may skip the tutorial at any time.\n
\n \n ),\n canNext: true,\n },\n [iTutorialSteps.GoToCharacterPage as number]: {\n content: (\n <>\n Let's start by heading to the Stats page. Click\n \n \n Stats\n \n\n on the main navigation menu (left-hand side of the screen)\n \n ),\n canNext: false,\n },\n [iTutorialSteps.CharacterPage as number]: {\n content: (\n <>\n \n \n Stats\n \n \n shows a lot of important information about your progress, such as your skills, money, and bonuses.\n \n \n ),\n canNext: true,\n },\n [iTutorialSteps.CharacterGoToTerminalPage as number]: {\n content: (\n <>\n Let's head to your computer's terminal by clicking\n \n \n Terminal\n \n on the main navigation menu.\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalIntro as number]: {\n content: (\n <>\n \n \n Terminal\n \n \n is used to interface with your home computer as well as all of the other machines around the world.\n \n \n ),\n canNext: true,\n },\n [iTutorialSteps.TerminalHelp as number]: {\n content: (\n <>\n Let's try it out. Start by entering\n {\"[home ~/]> help\"}\n (Don't forget to press Enter after typing the command)\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalLs as number]: {\n content: (\n <>\n {\"[home ~/]> help\"}\n \n displays a list of all available Terminal commands, how to use them, and a description of what they do.{\" \"}\n
\n
\n Let's try another command. Enter\n
\n\n {\"[home ~/]> ls\"}\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalScan as number]: {\n content: (\n <>\n {\"[home ~/]> ls\"}\n \n {\" \"}\n is a basic command that shows files on the computer. Right now, it shows that you have a program called{\" \"}\n NUKE.exe on your computer. We'll get to what this does later.
\n
\n Using your home computer's terminal, you can connect to other machines throughout the world. Let's do that\n now by first entering\n
\n {\"[home ~/]> scan\"}\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalScanAnalyze1 as number]: {\n content: (\n <>\n {\"[home ~/]> scan\"}\n \n shows all available network connections. In other words, it displays a list of all servers that can be\n connected to from your current machine. A server is identified by its hostname.
\n
\n That's great and all, but there's so many servers. Which one should you go to?{\" \"}\n
\n\n {\"[home ~/]> scan-analyze\"}\n gives some more detailed information about servers on the network. Try it now!\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalScanAnalyze2 as number]: {\n content: (\n <>\n {\"[home ~/]> scan-analyze\"}\n \n shows more detailed information about each server that you can connect to (servers that are a distance of\n one node away).
\n
It is also possible to run scan-analyze with a higher depth. Let's try a depth of two with the\n following command:{\" \"}\n
\n\n {\"[home ~/]> scan-analyze 2\"}\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalConnect as number]: {\n content: (\n <>\n \n Now you can see information about all servers that are up to two nodes away, as well as figure out how to\n navigate to those servers through the network. You can only connect to a server that is one node away. To\n connect to a machine, use\n \n {\"[home ~/]> connect hostname\"}\n\n From the results of \n {\"[home ~/]> scan-analyze 2\"}\n\n \n {\" \"}\n we can see that the n00dles server is only one node away. Let's connect so it now using:\n \n\n {\"[home ~/]> connect n00dles\"}\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalAnalyze as number]: {\n content: (\n <>\n \n You are now connected to another machine! What can you do now? You can hack it!\n
\n
In the year 2077, currency has become digital and decentralized. People and corporations store their\n money on servers and computers. Using your hacking abilities, you can hack servers to steal money and gain\n experience.
\n
\n Before you try to hack a server, you should run diagnostics using{\" \"}\n
\n {\"[n00dles ~/]> analyze\"}\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalNuke as number]: {\n content: (\n <>\n When \n {\"[n00dles ~/]> analyze\"}\n\n \n finishes running it will show useful information about hacking the server.
\n
For this server, the required hacking skill is only 1, which means you can hack it right now.\n However, in order to hack a server you must first gain root access. The NUKE.exe program that we saw earlier\n on your home computer is a virus that will grant you root access to a machine if there are enough open\n ports.\n
\n {\"[n00dles ~/]> analyze\"}\n\n \n {\" \"}\n shows that there do not need to be any open ports on this machine for the NUKE virus to work, so go ahead\n and run the virus using{\" \"}\n \n {\"[n00dles ~/]> run NUKE.exe\"}\n\n \n \n ),\n canNext: true,\n },\n [iTutorialSteps.TerminalManualHack as number]: {\n content: (\n <>\n You now have root access! You can hack the server using \n {\"[home ~/]> hack\"}\n\n Try doing that now.\n \n ),\n canNext: true,\n },\n [iTutorialSteps.TerminalHackingMechanics as number]: {\n content: (\n \n You are now attempting to hack the server. Performing a hack takes time and only has a certain percentage\n chance of success. This time and success chance is determined by a variety of factors, including your hacking\n skill and the server's security level.\n
\n
\n If your attempt to hack the server is successful, you will steal a certain percentage of the server's total\n money. This percentage is affected by your hacking skill and the server's security level.\n
\n
\n The amount of money on a server is not limitless. So, if you constantly hack a server and deplete its money,\n then you will encounter diminishing returns in your hacking.\n
\n ),\n canNext: true,\n },\n [iTutorialSteps.TerminalGoHome as number]: {\n content: (\n <>\n From any server you can get back home using\n {\"[home ~/]> home\"}\n\n Let's head home before creating our first script!\n \n ),\n canNext: true,\n },\n [iTutorialSteps.TerminalCreateScript as number]: {\n content: (\n <>\n \n Hacking is the core mechanic of the game and is necessary for progressing. However, you don't want to be\n hacking manually the entire time. You can automate your hacking by writing scripts!\n
\n
\n To create a new script or edit an existing one, you can use{\" \"}\n
\n {\"[home ~/]> nano\"}\n\n Scripts must end with the .script extension. Let's make a script now by entering \n {\"[home ~/]> nano n00dles.script\"}\n\n \n after the hack command finishes running (Sidenote: Pressing ctrl + c will end a command like hack early)\n \n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalTypeScript as number]: {\n content: (\n <>\n \n This is the script editor. You can use it to program your scripts. Scripts are written in a simplified\n version of javascript. Copy and paste the following code into the script editor:
\n
\n\n \n \n \n \n For anyone with basic programming experience, this code should be straightforward. This script will\n continuously hack the n00dles server.\n
\n
\n To save and close the script editor, press the button in the bottom left, or press ctrl + b.\n
\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalFree as number]: {\n content: (\n <>\n \n Now we'll run the script. Scripts require a certain amount of RAM to run, and can be run on any machine\n which you have root access to. Different servers have different amounts of RAM. You can also purchase more\n RAM for your home server.\n
\n
\n To check how much RAM is available on this machine, enter\n
\n {\"[home ~/]> free\"}\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalRunScript as number]: {\n content: (\n <>\n \n We have 8GB of free RAM on this machine, which is enough to run our script. Let's run our script using\n \n {\"[home ~/]> run n00dles.script\"}\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalGoToActiveScriptsPage as number]: {\n content: (\n <>\n \n Your script is now running! It will continuously run in the background and will automatically stop if the\n code ever completes (the n00dles.script will never complete because it runs an infinite loop).
\n
\n These scripts can passively earn you income and hacking experience. Your scripts will also earn money and\n experience while you are offline, although at a slightly slower rate.
\n
\n Let's check out some statistics for our running scripts by clicking{\" \"}\n
\n \n \n Active Scripts\n \n \n ),\n canNext: false,\n },\n [iTutorialSteps.ActiveScriptsPage as number]: {\n content: (\n <>\n \n This page displays information about all of your scripts that are running across every server. You can use\n this to gauge how well your scripts are doing. Let's go back to\n \n \n \n Terminal\n \n \n ),\n canNext: false,\n },\n [iTutorialSteps.ActiveScriptsToTerminal as number]: {\n content: (\n <>\n \n One last thing about scripts, each active script contains logs that detail what it's doing. We can check\n these logs using the tail command. Do that now for the script we just ran by typing{\" \"}\n \n {\"[home ~/]> tail n00dles.script\"}\n \n ),\n canNext: false,\n },\n [iTutorialSteps.TerminalTailScript as number]: {\n content: (\n <>\n \n The log for this script won't show much right now (it might show nothing at all) because it just started\n running...but check back again in a few minutes!
\n
\n This covers the basics of hacking. To learn more about writing scripts, select\n
\n \n \n Tutorial\n \n \n in the main navigation menu to look at the documentation. If you are an experienced JavaScript developer, I\n would highly suggest you check out the section on NetscriptJS/Netscript 2.0, it's faster and more powerful.\n
\n
\n For now, let's move on to something else!\n
\n \n ),\n canNext: true,\n },\n [iTutorialSteps.GoToHacknetNodesPage as number]: {\n content: (\n <>\n \n Hacking is not the only way to earn money. One other way to passively earn money is by purchasing and\n upgrading Hacknet Nodes. Let's go to\n \n \n \n Hacknet\n \n through the main navigation menu now.\n \n ),\n canNext: true,\n },\n [iTutorialSteps.HacknetNodesIntroduction as number]: {\n content: (\n \n here you can purchase new Hacknet Nodes and upgrade your existing ones. Let's purchase a new one now.\n \n ),\n canNext: true,\n },\n [iTutorialSteps.HacknetNodesGoToWorldPage as number]: {\n content: (\n <>\n \n You just purchased a Hacknet Node! This Hacknet Node will passively earn you money over time, both online\n and offline. When you get enough money, you can upgrade your newly-purchased Hacknet Node below.\n
\n
\n Let's go to\n
\n \n \n City\n \n \n ),\n canNext: true,\n },\n [iTutorialSteps.WorldDescription as number]: {\n content: (\n <>\n \n This page lists all of the different locations you can currently travel to. Each location has something that\n you can do. There's a lot of content out in the world, make sure you explore and discover!\n
\n
\n Lastly, click on\n
\n \n \n Tutorial\n \n \n ),\n canNext: true,\n },\n [iTutorialSteps.TutorialPageInfo as number]: {\n content: (\n \n This page contains a lot of different documentation about the game's content and mechanics. I know it's a lot,\n but I highly suggest you read (or at least skim) through this before you start playing . That's the end of the\n tutorial. Hope you enjoy the game!\n \n ),\n canNext: true,\n },\n [iTutorialSteps.End as number]: {\n content: ,\n canNext: true,\n },\n };\n\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => {\n return ITutorialEvents.subscribe(rerender);\n }, []);\n const step = ITutorial.currStep;\n const content = contents[step];\n if (content === undefined) throw new Error(\"error in the tutorial\");\n return (\n \n {content.content}\n {step !== iTutorialSteps.TutorialPageInfo && (\n <>\n \n \n \n {content.canNext && (\n \n \n \n )}\n \n )}\n
\n
\n \n
\n );\n}\n","import React, { useState } from \"react\";\n\nimport makeStyles from \"@mui/styles/makeStyles\";\nimport Box from \"@mui/material/Box\";\nimport Collapse from \"@mui/material/Collapse\";\nimport Fab from \"@mui/material/Fab\";\nimport VisibilityOffIcon from \"@mui/icons-material/VisibilityOff\";\nimport VisibilityIcon from \"@mui/icons-material/Visibility\";\nimport { use } from \"../Context\";\nimport { Page } from \"../Router\";\n\nconst useStyles = makeStyles({\n nobackground: {\n backgroundColor: \"#0000\",\n },\n});\n\ninterface IProps {\n children: JSX.Element[] | JSX.Element | React.ReactElement[] | React.ReactElement;\n}\n\nexport function Overview({ children }: IProps): React.ReactElement {\n const [open, setOpen] = useState(true);\n const classes = useStyles();\n const router = use.Router();\n if (router.page() === Page.BitVerse || router.page() === Page.HackingMission || router.page() === Page.Loading)\n return <>;\n let icon;\n if (open){\n icon = ;\n } else {\n icon = ;\n }\n return (\n
\n \n {children}\n \n setOpen((old) => !old)}>\n {icon}\n \n \n \n
\n );\n}\n","import React, { useState, useEffect } from \"react\";\nimport clsx from \"clsx\";\nimport { styled, Theme, CSSObject } from \"@mui/material/styles\";\nimport createStyles from \"@mui/styles/createStyles\";\nimport makeStyles from \"@mui/styles/makeStyles\";\nimport MuiDrawer from \"@mui/material/Drawer\";\nimport List from \"@mui/material/List\";\nimport Divider from \"@mui/material/Divider\";\nimport ChevronLeftIcon from \"@mui/icons-material/ChevronLeft\";\nimport ChevronRightIcon from \"@mui/icons-material/ChevronRight\";\nimport ListItem from \"@mui/material/ListItem\";\nimport ListItemIcon from \"@mui/material/ListItemIcon\";\nimport ListItemText from \"@mui/material/ListItemText\";\nimport Typography from \"@mui/material/Typography\";\nimport Collapse from \"@mui/material/Collapse\";\nimport Badge from \"@mui/material/Badge\";\n\nimport ComputerIcon from \"@mui/icons-material/Computer\";\nimport LastPageIcon from \"@mui/icons-material/LastPage\"; // Terminal\nimport CreateIcon from \"@mui/icons-material/Create\"; // Create Script\nimport StorageIcon from \"@mui/icons-material/Storage\"; // Active Scripts\nimport BugReportIcon from \"@mui/icons-material/BugReport\"; // Create Program\nimport EqualizerIcon from \"@mui/icons-material/Equalizer\"; // Stats\nimport ContactsIcon from \"@mui/icons-material/Contacts\"; // Factions\nimport DoubleArrowIcon from \"@mui/icons-material/DoubleArrow\"; // Augmentations\nimport AccountTreeIcon from \"@mui/icons-material/AccountTree\"; // Hacknet\nimport PeopleAltIcon from \"@mui/icons-material/PeopleAlt\"; // Sleeves\nimport LocationCityIcon from \"@mui/icons-material/LocationCity\"; // City\nimport AirplanemodeActiveIcon from \"@mui/icons-material/AirplanemodeActive\"; // Travel\nimport WorkIcon from \"@mui/icons-material/Work\"; // Job\nimport TrendingUpIcon from \"@mui/icons-material/TrendingUp\"; // Stock Market\nimport FormatBoldIcon from \"@mui/icons-material/FormatBold\"; // Bladeburner\nimport BusinessIcon from \"@mui/icons-material/Business\"; // Corp\nimport SportsMmaIcon from \"@mui/icons-material/SportsMma\"; // Gang\nimport CheckIcon from \"@mui/icons-material/Check\"; // Milestones\nimport HelpIcon from \"@mui/icons-material/Help\"; // Tutorial\nimport SettingsIcon from \"@mui/icons-material/Settings\"; // options\nimport DeveloperBoardIcon from \"@mui/icons-material/DeveloperBoard\"; // Dev\nimport AccountBoxIcon from \"@mui/icons-material/AccountBox\";\nimport PublicIcon from \"@mui/icons-material/Public\";\nimport LiveHelpIcon from \"@mui/icons-material/LiveHelp\";\nimport ExpandLessIcon from \"@mui/icons-material/ExpandLess\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport { IRouter, Page } from \"../../ui/Router\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { CONSTANTS } from \"../../Constants\";\nimport { iTutorialSteps, iTutorialNextStep, ITutorial } from \"../../InteractiveTutorial\";\nimport { getAvailableCreatePrograms } from \"../../Programs/ProgramHelpers\";\nimport { Settings } from \"../../Settings/Settings\";\nimport { redPillFlag } from \"../../RedPill\";\n\nimport { inMission } from \"../../Missions\";\nimport { KEY } from \"../../../utils/helpers/keyCodes\";\n\nconst openedMixin = (theme: Theme): CSSObject => ({\n width: theme.spacing(31),\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n overflowX: \"hidden\",\n});\n\nconst closedMixin = (theme: Theme): CSSObject => ({\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n overflowX: \"hidden\",\n width: `calc(${theme.spacing(2)} + 1px)`,\n [theme.breakpoints.up(\"sm\")]: {\n width: `calc(${theme.spacing(7)} + 1px)`,\n },\n});\n\nconst Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !== \"open\" })(({ theme, open }) => ({\n width: theme.spacing(31),\n whiteSpace: \"nowrap\",\n boxSizing: \"border-box\",\n ...(open && {\n ...openedMixin(theme),\n \"& .MuiDrawer-paper\": openedMixin(theme),\n }),\n ...(!open && {\n ...closedMixin(theme),\n \"& .MuiDrawer-paper\": closedMixin(theme),\n }),\n}));\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n active: {\n borderLeft: \"3px solid \" + theme.palette.primary.main,\n },\n listitem: {},\n }),\n);\n\ninterface IProps {\n player: IPlayer;\n router: IRouter;\n page: Page;\n}\n\nexport function SidebarRoot(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => {\n const id = setInterval(rerender, 200);\n return () => clearInterval(id);\n }, []);\n\n const [hackingOpen, setHackingOpen] = useState(true);\n const [characterOpen, setCharacterOpen] = useState(true);\n const [worldOpen, setWorldOpen] = useState(true);\n const [helpOpen, setHelpOpen] = useState(true);\n\n const flashTerminal =\n ITutorial.currStep === iTutorialSteps.CharacterGoToTerminalPage ||\n ITutorial.currStep === iTutorialSteps.ActiveScriptsPage;\n\n const flashStats = ITutorial.currStep === iTutorialSteps.GoToCharacterPage;\n\n const flashActiveScripts = ITutorial.currStep === iTutorialSteps.TerminalGoToActiveScriptsPage;\n\n const flashHacknet = ITutorial.currStep === iTutorialSteps.GoToHacknetNodesPage;\n\n const flashCity = ITutorial.currStep === iTutorialSteps.HacknetNodesGoToWorldPage;\n\n const flashTutorial = ITutorial.currStep === iTutorialSteps.WorldDescription;\n\n const augmentationCount = props.player.queuedAugmentations.length;\n const invitationsCount = props.player.factionInvitations.length;\n const programCount = getAvailableCreatePrograms(props.player).length;\n const canCreateProgram =\n programCount > 0 ||\n props.player.augmentations.length > 0 ||\n props.player.queuedAugmentations.length > 0 ||\n props.player.sourceFiles.length > 0;\n\n const canOpenFactions =\n props.player.factionInvitations.length > 0 ||\n props.player.factions.length > 0 ||\n props.player.augmentations.length > 0 ||\n props.player.queuedAugmentations.length > 0 ||\n props.player.sourceFiles.length > 0;\n\n const canOpenAugmentations =\n props.player.augmentations.length > 0 ||\n props.player.queuedAugmentations.length > 0 ||\n props.player.sourceFiles.length > 0;\n\n const canOpenSleeves = props.player.sleeves.length > 0;\n\n // TODO(hydroflame): these should not as any but right now the def is that it\n // can only be defined;\n const canCorporation = !!(props.player.corporation as any);\n const canGang = !!(props.player.gang as any);\n const canJob = props.player.companyName !== \"\";\n const canStockMarket = props.player.hasWseAccount;\n const canBladeburner = !!(props.player.bladeburner as any);\n\n function clickTerminal(): void {\n props.router.toTerminal();\n if (flashTerminal) iTutorialNextStep();\n }\n\n function clickCreateScripts(): void {\n props.router.toScriptEditor();\n }\n\n function clickStats(): void {\n props.router.toStats();\n if (flashStats) iTutorialNextStep();\n }\n\n function clickActiveScripts(): void {\n props.router.toActiveScripts();\n if (flashActiveScripts) iTutorialNextStep();\n }\n\n function clickCreateProgram(): void {\n props.router.toCreateProgram();\n }\n\n function clickFactions(): void {\n props.router.toFactions();\n }\n\n function clickAugmentations(): void {\n props.router.toAugmentations();\n }\n\n function clickSleeves(): void {\n props.router.toSleeves();\n }\n\n function clickHacknet(): void {\n props.router.toHacknetNodes();\n if (flashHacknet) iTutorialNextStep();\n }\n\n function clickCity(): void {\n props.router.toCity();\n if (flashCity) iTutorialNextStep();\n }\n\n function clickTravel(): void {\n props.router.toTravel();\n }\n\n function clickJob(): void {\n props.router.toJob();\n }\n\n function clickStockMarket(): void {\n props.router.toStockMarket();\n }\n\n function clickBladeburner(): void {\n props.router.toBladeburner();\n }\n\n function clickCorp(): void {\n props.router.toCorporation();\n }\n\n function clickGang(): void {\n props.router.toGang();\n }\n\n function clickTutorial(): void {\n props.router.toTutorial();\n if (flashTutorial) iTutorialNextStep();\n }\n\n function clickMilestones(): void {\n props.router.toMilestones();\n }\n function clickOptions(): void {\n props.router.toGameOptions();\n }\n\n function clickDev(): void {\n props.router.toDevMenu();\n }\n\n useEffect(() => {\n // Shortcuts to navigate through the game\n // Alt-t - Terminal\n // Alt-c - Character\n // Alt-e - Script editor\n // Alt-s - Active scripts\n // Alt-h - Hacknet Nodes\n // Alt-w - City\n // Alt-j - Job\n // Alt-r - Travel Agency of current city\n // Alt-p - Create program\n // Alt-f - Factions\n // Alt-a - Augmentations\n // Alt-u - Tutorial\n // Alt-o - Options\n function handleShortcuts(this: Document, event: KeyboardEvent): any {\n if (Settings.DisableHotkeys) return;\n if (props.player.isWorking || redPillFlag || inMission) return;\n if (event.keyCode == KEY.T && event.altKey) {\n event.preventDefault();\n clickTerminal();\n } else if (event.keyCode === KEY.C && event.altKey) {\n event.preventDefault();\n clickStats();\n } else if (event.keyCode === KEY.E && event.altKey) {\n event.preventDefault();\n clickCreateScripts();\n } else if (event.keyCode === KEY.S && event.altKey) {\n event.preventDefault();\n clickActiveScripts();\n } else if (event.keyCode === KEY.H && event.altKey) {\n event.preventDefault();\n clickHacknet();\n } else if (event.keyCode === KEY.W && event.altKey) {\n event.preventDefault();\n clickCity();\n } else if (event.keyCode === KEY.J && event.altKey) {\n event.preventDefault();\n clickJob();\n } else if (event.keyCode === KEY.R && event.altKey) {\n event.preventDefault();\n clickTravel();\n } else if (event.keyCode === KEY.P && event.altKey) {\n event.preventDefault();\n clickCreateProgram();\n } else if (event.keyCode === KEY.F && event.altKey) {\n // Overriden by Fconf\n if (props.page == Page.Terminal && Settings.EnableBashHotkeys) {\n return;\n }\n event.preventDefault();\n clickFactions();\n } else if (event.keyCode === KEY.A && event.altKey) {\n event.preventDefault();\n clickAugmentations();\n } else if (event.keyCode === KEY.U && event.altKey) {\n event.preventDefault();\n clickTutorial();\n } else if (event.keyCode === KEY.B && event.altKey) {\n event.preventDefault();\n clickBladeburner();\n } else if (event.keyCode === KEY.G && event.altKey) {\n event.preventDefault();\n clickGang();\n }\n // if (event.keyCode === KEY.O && event.altKey) {\n // event.preventDefault();\n // gameOptionsBoxOpen();\n // }\n }\n\n document.addEventListener(\"keypress\", handleShortcuts);\n return () => document.removeEventListener(\"keypress\", handleShortcuts);\n }, []);\n\n const classes = useStyles();\n const [open, setOpen] = useState(true);\n const toggleDrawer = (): void => setOpen((old) => !old);\n return (\n \n \n \n {!open ? : }\n \n Bitburner v{CONSTANTS.Version}} />\n \n \n \n setHackingOpen((old) => !old)}>\n \n \n \n Hacking} />\n {hackingOpen ? : }\n \n \n \n \n \n \n \n \n \n Terminal\n \n \n \n \n \n \n \n \n \n Create Script\n \n \n \n \n \n \n \n \n \n Active Scripts\n \n \n \n {canCreateProgram && (\n \n \n 0 ? programCount : undefined} color=\"error\">\n \n \n \n \n \n Create Program\n \n \n \n )}\n \n \n\n \n setCharacterOpen((old) => !old)}>\n \n \n \n Character} />\n {characterOpen ? : }\n \n \n \n \n \n \n \n \n Stats\n \n \n \n {canOpenFactions && (\n \n \n \n \n \n \n \n \n Factions\n \n \n \n )}\n {canOpenAugmentations && (\n \n \n \n \n \n \n \n \n Augmentations\n \n \n \n )}\n \n \n \n \n \n \n Hacknet\n \n \n \n {canOpenSleeves && (\n \n \n \n \n \n Sleeves\n \n \n )}\n \n\n \n setWorldOpen((old) => !old)}>\n \n \n \n World} />\n {worldOpen ? : }\n \n \n \n \n \n \n \n \n City\n \n \n \n \n \n \n \n \n Travel\n \n \n {canJob && (\n \n \n \n \n \n Job\n \n \n )}\n {canStockMarket && (\n \n \n \n \n \n Stock Market\n \n \n )}\n {canBladeburner && (\n \n \n \n \n \n Bladeburner\n \n \n )}\n {canCorporation && (\n \n \n \n \n \n Corp\n \n \n )}\n {canGang && (\n \n \n \n \n \n Gang\n \n \n )}\n \n\n \n setHelpOpen((old) => !old)}>\n \n \n \n Help} />\n {helpOpen ? : }\n \n \n \n \n \n \n \n Milestones\n \n \n \n \n \n \n \n \n Tutorial\n \n \n \n \n \n \n \n \n Options\n \n \n {process.env.NODE_ENV === \"development\" && (\n \n \n \n \n \n Dev\n \n \n )}\n \n \n \n );\n}\n","/**\n * Root React component for the Augmentations UI page that display all of your\n * owned and purchased Augmentations and Source-Files.\n */\nimport * as React from \"react\";\n\nimport { InstalledAugmentationsAndSourceFiles } from \"./InstalledAugmentationsAndSourceFiles\";\nimport { PlayerMultipliers } from \"./PlayerMultipliers\";\nimport { PurchasedAugmentations } from \"./PurchasedAugmentations\";\n\nimport { Player } from \"../../Player\";\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { canGetBonus } from \"../../ExportBonus\";\n\ntype IProps = {\n exportGameFn: () => void;\n installAugmentationsFn: () => void;\n};\n\ntype IState = {\n rerender: boolean;\n};\n\nexport class AugmentationsRoot extends React.Component {\n constructor(props: IProps) {\n super(props);\n this.state = {\n rerender: false,\n };\n this.export = this.export.bind(this);\n }\n\n export(): void {\n this.props.exportGameFn();\n this.setState({\n rerender: !this.state.rerender,\n });\n }\n\n render(): React.ReactNode {\n function exportBonusStr(): string {\n if (canGetBonus()) return \"(+1 favor to all factions)\";\n return \"\";\n }\n\n return (\n <>\n
\n

Purchased Augmentations

\n

\n Below is a list of all Augmentations you have purchased but not yet installed. Click the button below to\n install them.\n

\n

WARNING: Installing your Augmentations resets most of your progress, including:

\n
\n

- Stats/Skill levels and Experience

\n

- Money

\n

- Scripts on every computer but your home computer

\n

- Purchased servers

\n

- Hacknet Nodes

\n

- Faction/Company reputation

\n

- Stocks

\n
\n

\n Installing Augmentations lets you start over with the perks and benefits granted by all of the Augmentations\n you have ever installed. Also, you will keep any scripts and RAM/Core upgrades on your home computer (but\n you will lose all programs besides NUKE.exe)\n

\n \n \n \n

Installed Augmentations

\n

\n {`List of all Augmentations ${Player.sourceFiles.length > 0 ? \"and Source Files \" : \"\"} ` +\n `that have been installed. You have gained the effects of these.`}\n

\n \n

\n \n
\n \n );\n }\n}\n","/**\n * React Component for displaying all of the player's installed Augmentations and\n * Source-Files.\n *\n * It also contains 'configuration' buttons that allow you to change how the\n * Augs/SF's are displayed\n */\nimport * as React from \"react\";\n\nimport { InstalledAugmentations } from \"./InstalledAugmentations\";\nimport { ListConfiguration } from \"./ListConfiguration\";\nimport { OwnedSourceFiles } from \"./OwnedSourceFiles\";\nimport { SourceFileMinus1 } from \"./SourceFileMinus1\";\n\nimport { Settings } from \"../../Settings/Settings\";\nimport { OwnedAugmentationsOrderSetting } from \"../../Settings/SettingEnums\";\n\ntype IProps = {\n // nothing special.\n};\n\ntype IState = {\n rerenderFlag: boolean;\n};\n\nexport class InstalledAugmentationsAndSourceFiles extends React.Component {\n listRef: React.RefObject;\n\n constructor(props: IProps) {\n super(props);\n\n this.state = {\n rerenderFlag: false,\n };\n\n this.collapseAllHeaders = this.collapseAllHeaders.bind(this);\n this.expandAllHeaders = this.expandAllHeaders.bind(this);\n this.sortByAcquirementTime = this.sortByAcquirementTime.bind(this);\n this.sortInOrder = this.sortInOrder.bind(this);\n\n this.listRef = React.createRef();\n }\n\n collapseAllHeaders(): void {\n const ul = this.listRef.current;\n if (ul == null) {\n return;\n }\n const tickers = ul.getElementsByClassName(\"accordion-header\");\n for (let i = 0; i < tickers.length; ++i) {\n const ticker = tickers[i];\n if (!(ticker instanceof HTMLButtonElement)) {\n continue;\n }\n\n if (ticker.classList.contains(\"active\")) {\n ticker.click();\n }\n }\n }\n\n expandAllHeaders(): void {\n const ul = this.listRef.current;\n if (ul == null) {\n return;\n }\n const tickers = ul.getElementsByClassName(\"accordion-header\");\n for (let i = 0; i < tickers.length; ++i) {\n const ticker = tickers[i];\n if (!(ticker instanceof HTMLButtonElement)) {\n continue;\n }\n\n if (!ticker.classList.contains(\"active\")) {\n ticker.click();\n }\n }\n }\n\n rerender(): void {\n this.setState((prevState) => {\n return {\n rerenderFlag: !prevState.rerenderFlag,\n };\n });\n }\n\n sortByAcquirementTime(): void {\n Settings.OwnedAugmentationsOrder = OwnedAugmentationsOrderSetting.AcquirementTime;\n this.rerender();\n }\n\n sortInOrder(): void {\n Settings.OwnedAugmentationsOrder = OwnedAugmentationsOrderSetting.Alphabetically;\n this.rerender();\n }\n\n render(): React.ReactNode {\n return (\n <>\n \n
    \n \n \n \n
\n \n );\n }\n}\n","/**\n * React Component for displaying a list of the player's installed Augmentations\n * on the Augmentations UI\n */\nimport * as React from \"react\";\n\nimport { Player } from \"../../Player\";\nimport { Augmentations } from \"../../Augmentation/Augmentations\";\nimport { AugmentationNames } from \"../../Augmentation/data/AugmentationNames\";\nimport { Settings } from \"../../Settings/Settings\";\nimport { OwnedAugmentationsOrderSetting } from \"../../Settings/SettingEnums\";\n\nimport { AugmentationAccordion } from \"../../ui/React/AugmentationAccordion\";\n\nexport function InstalledAugmentations(): React.ReactElement {\n const sourceAugs = Player.augmentations.slice();\n\n if (Settings.OwnedAugmentationsOrder === OwnedAugmentationsOrderSetting.Alphabetically) {\n sourceAugs.sort((aug1, aug2) => {\n return aug1.name <= aug2.name ? -1 : 1;\n });\n }\n\n const augs = sourceAugs.map((e) => {\n const aug = Augmentations[e.name];\n\n let level = null;\n if (e.name === AugmentationNames.NeuroFluxGovernor) {\n level = e.level;\n }\n\n return (\n
  • \n \n
  • \n );\n });\n\n return <>{augs};\n}\n","/**\n * React Component for configuring the way installed augmentations and\n * Source-Files are displayed in the Augmentations UI\n */\nimport * as React from \"react\";\n\nimport { StdButton } from \"../../ui/React/StdButton\";\n\ntype IProps = {\n collapseAllButtonsFn: () => void;\n expandAllButtonsFn: () => void;\n sortByAcquirementTimeFn: () => void;\n sortInOrderFn: () => void;\n};\n\nexport function ListConfiguration(props: IProps): React.ReactElement {\n return (\n <>\n \n \n \n \n \n );\n}\n","/**\n * React Component for displaying a list of the player's Source-Files\n * on the Augmentations UI\n */\nimport * as React from \"react\";\n\nimport { Player } from \"../../Player\";\nimport { Settings } from \"../../Settings/Settings\";\nimport { OwnedAugmentationsOrderSetting } from \"../../Settings/SettingEnums\";\nimport { SourceFiles } from \"../../SourceFile/SourceFiles\";\n\nimport { SourceFileAccordion } from \"../../ui/React/SourceFileAccordion\";\n\nexport function OwnedSourceFiles(): React.ReactElement {\n const sourceSfs = Player.sourceFiles.slice();\n\n if (Settings.OwnedAugmentationsOrder === OwnedAugmentationsOrderSetting.Alphabetically) {\n sourceSfs.sort((sf1, sf2) => {\n return sf1.n - sf2.n;\n });\n }\n\n const sfs = sourceSfs.map((e) => {\n const srcFileKey = \"SourceFile\" + e.n;\n const sfObj = SourceFiles[srcFileKey];\n if (sfObj == null) {\n console.error(`Invalid source file number: ${e.n}`);\n return null;\n }\n\n return (\n
  • \n \n
  • \n );\n });\n\n return <>{sfs};\n}\n","/**\n * React Component for displaying a single Source-File as an accordion.\n *\n * The header of the accordion contains the Source-Files's name and level,\n * and the accordion's panel contains the Source-File's description.\n */\nimport * as React from \"react\";\n\nimport { BBAccordion } from \"./BBAccordion\";\n\nimport { SourceFile } from \"../../SourceFile/SourceFile\";\n\ntype IProps = {\n level: number;\n sf: SourceFile;\n};\n\nexport function SourceFileAccordion(props: IProps): React.ReactElement {\n const maxLevel = props.sf.n === 12 ? \"∞\" : \"3\";\n\n return (\n \n {props.sf.name}\n
    \n {`Level ${props.level} / ${maxLevel}`}\n \n }\n panelContent={

    }\n />\n );\n}\n","/**\n * React Component for displaying a list of the player's Source-Files\n * on the Augmentations UI\n */\nimport * as React from \"react\";\n\nimport { Player } from \"../../Player\";\nimport { Exploit, ExploitName } from \"../../Exploits/Exploit\";\n\nimport { BBAccordion } from \"../../ui/React/BBAccordion\";\n\nexport function SourceFileMinus1(): React.ReactElement {\n const exploits = Player.exploits;\n\n if (exploits.length === 0) {\n return <>;\n }\n\n return (\n
  • \n \n Source-File -1: Exploits in the BitNodes\n
    \n Level {exploits.length} / ?\n \n }\n panelContent={\n <>\n

    \n This Source-File can only be acquired with obscure knowledge of the game, javascript, and the web\n ecosystem.\n

    \n

    It increases all of the player's multipliers by 0.1%

    \n
    \n\n

    You have found the following exploits:

    \n
      \n {exploits.map((c: Exploit) => (\n
    • * {ExploitName(c)}
    • \n ))}\n
    \n \n }\n />\n
  • \n );\n}\n","/**\n * React component for displaying the player's multipliers on the Augmentation UI page\n */\nimport * as React from \"react\";\n\nimport { Player } from \"../../Player\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { Augmentations } from \"../Augmentations\";\n\nfunction calculateAugmentedStats(): any {\n const augP: any = {};\n for (const aug of Player.queuedAugmentations) {\n const augObj = Augmentations[aug.name];\n for (const mult in augObj.mults) {\n const v = augP[mult] ? augP[mult] : 1;\n augP[mult] = v * augObj.mults[mult];\n }\n }\n return augP;\n}\n\nexport function PlayerMultipliers(): React.ReactElement {\n const mults = calculateAugmentedStats();\n function MultiplierTable(rows: any[]): React.ReactElement {\n function improvements(r: number): JSX.Element[] {\n let elems: JSX.Element[] = [];\n if (r) {\n elems = [ {\"=>\"} , {numeralWrapper.formatPercentage(r)}];\n }\n return elems;\n }\n\n return (\n \n \n {rows.map((r: any) => (\n \n \n \n {improvements(r[2])}\n \n ))}\n \n
    \n {r[0]} multiplier: \n \n {numeralWrapper.formatPercentage(r[1])}\n
    \n );\n }\n\n function BladeburnerMults(): React.ReactElement {\n if (!Player.canAccessBladeburner()) return <>;\n return (\n <>\n {MultiplierTable([\n [\n \"Bladeburner Success Chance\",\n Player.bladeburner_success_chance_mult,\n Player.bladeburner_success_chance_mult * mults.bladeburner_success_chance_mult,\n ],\n [\n \"Bladeburner Max Stamina\",\n Player.bladeburner_max_stamina_mult,\n Player.bladeburner_max_stamina_mult * mults.bladeburner_max_stamina_mult,\n ],\n [\n \"Bladeburner Stamina Gain\",\n Player.bladeburner_stamina_gain_mult,\n Player.bladeburner_stamina_gain_mult * mults.bladeburner_stamina_gain_mult,\n ],\n [\n \"Bladeburner Field Analysis\",\n Player.bladeburner_analysis_mult,\n Player.bladeburner_analysis_mult * mults.bladeburner_analysis_mult,\n ],\n ])}\n
    \n \n );\n }\n\n return (\n <>\n

    \n \n Multipliers:\n \n

    \n
    \n {MultiplierTable([\n [\"Hacking Chance \", Player.hacking_chance_mult, Player.hacking_chance_mult * mults.hacking_chance_mult],\n [\"Hacking Speed \", Player.hacking_speed_mult, Player.hacking_speed_mult * mults.hacking_speed_mult],\n [\"Hacking Money \", Player.hacking_money_mult, Player.hacking_money_mult * mults.hacking_money_mult],\n [\"Hacking Growth \", Player.hacking_grow_mult, Player.hacking_grow_mult * mults.hacking_grow_mult],\n ])}\n
    \n\n {MultiplierTable([\n [\"Hacking Level \", Player.hacking_mult, Player.hacking_mult * mults.hacking_mult],\n [\"Hacking Experience \", Player.hacking_exp_mult, Player.hacking_exp_mult * mults.hacking_exp_mult],\n ])}\n
    \n\n {MultiplierTable([\n [\"Strength Level \", Player.strength_mult, Player.strength_mult * mults.strength_mult],\n [\"Strength Experience \", Player.strength_exp_mult, Player.strength_exp_mult * mults.strength_exp_mult],\n ])}\n
    \n\n {MultiplierTable([\n [\"Defense Level \", Player.defense_mult, Player.defense_mult * mults.defense_mult],\n [\"Defense Experience \", Player.defense_exp_mult, Player.defense_exp_mult * mults.defense_exp_mult],\n ])}\n
    \n\n {MultiplierTable([\n [\"Dexterity Level \", Player.dexterity_mult, Player.dexterity_mult * mults.dexterity_mult],\n [\"Dexterity Experience \", Player.dexterity_exp_mult, Player.dexterity_exp_mult * mults.dexterity_exp_mult],\n ])}\n
    \n\n {MultiplierTable([\n [\"Agility Level \", Player.agility_mult, Player.agility_mult * mults.agility_mult],\n [\"Agility Experience \", Player.agility_exp_mult, Player.agility_exp_mult * mults.agility_exp_mult],\n ])}\n
    \n\n {MultiplierTable([\n [\"Charisma Level \", Player.charisma_mult, Player.charisma_mult * mults.charisma_mult],\n [\"Charisma Experience \", Player.charisma_exp_mult, Player.charisma_exp_mult * mults.charisma_exp_mult],\n ])}\n
    \n\n {MultiplierTable([\n [\n \"Hacknet Node production \",\n Player.hacknet_node_money_mult,\n Player.hacknet_node_money_mult * mults.hacknet_node_money_mult,\n ],\n [\n \"Hacknet Node purchase cost \",\n Player.hacknet_node_purchase_cost_mult,\n Player.hacknet_node_purchase_cost_mult * mults.hacknet_node_purchase_cost_mult,\n ],\n [\n \"Hacknet Node RAM upgrade cost \",\n Player.hacknet_node_ram_cost_mult,\n Player.hacknet_node_ram_cost_mult * mults.hacknet_node_ram_cost_mult,\n ],\n [\n \"Hacknet Node Core purchase cost \",\n Player.hacknet_node_core_cost_mult,\n Player.hacknet_node_core_cost_mult * mults.hacknet_node_core_cost_mult,\n ],\n [\n \"Hacknet Node level upgrade cost \",\n Player.hacknet_node_level_cost_mult,\n Player.hacknet_node_level_cost_mult * mults.hacknet_node_level_cost_mult,\n ],\n ])}\n
    \n\n {MultiplierTable([\n [\"Company reputation gain \", Player.company_rep_mult, Player.company_rep_mult * mults.company_rep_mult],\n [\"Faction reputation gain \", Player.faction_rep_mult, Player.faction_rep_mult * mults.faction_rep_mult],\n [\"Salary \", Player.work_money_mult, Player.work_money_mult * mults.work_money_mult],\n ])}\n
    \n\n {MultiplierTable([\n [\"Crime success \", Player.crime_success_mult, Player.crime_success_mult * mults.crime_success_mult],\n [\"Crime money \", Player.crime_money_mult, Player.crime_money_mult * mults.crime_money_mult],\n ])}\n
    \n\n \n \n );\n}\n","/**\n * React component for displaying all of the player's purchased (but not installed)\n * Augmentations on the Augmentations UI.\n */\nimport * as React from \"react\";\n\nimport { Augmentations } from \"../../Augmentation/Augmentations\";\nimport { AugmentationNames } from \"../../Augmentation/data/AugmentationNames\";\nimport { Player } from \"../../Player\";\n\nimport { AugmentationAccordion } from \"../../ui/React/AugmentationAccordion\";\n\nexport function PurchasedAugmentations(): React.ReactElement {\n const augs: React.ReactElement[] = [];\n // Only render the last NeuroFlux (there are no findLastIndex btw)\n let nfgIndex = -1;\n for (let i = Player.queuedAugmentations.length - 1; i >= 0; i--) {\n if (Player.queuedAugmentations[i].name === AugmentationNames.NeuroFluxGovernor) {\n nfgIndex = i;\n break;\n }\n }\n for (let i = 0; i < Player.queuedAugmentations.length; i++) {\n const ownedAug = Player.queuedAugmentations[i];\n if (ownedAug.name === AugmentationNames.NeuroFluxGovernor && i !== nfgIndex) continue;\n const aug = Augmentations[ownedAug.name];\n let level = null;\n if (ownedAug.name === AugmentationNames.NeuroFluxGovernor) {\n level = ownedAug.level;\n }\n\n augs.push(\n
  • \n \n
  • ,\n );\n }\n\n return
      {augs}
    ;\n}\n","import { IPlayer } from \"./PersonObjects/IPlayer\";\nimport { Bladeburner } from \"./Bladeburner/Bladeburner\";\nimport { IEngine } from \"./IEngine\";\nimport { IRouter } from \"./ui/Router\";\n\nimport React from \"react\";\n\nimport { General } from \"./DevMenu/ui/General\";\nimport { Stats } from \"./DevMenu/ui/Stats\";\nimport { Factions } from \"./DevMenu/ui/Factions\";\nimport { Augmentations } from \"./DevMenu/ui/Augmentations\";\nimport { SourceFiles } from \"./DevMenu/ui/SourceFiles\";\nimport { Programs } from \"./DevMenu/ui/Programs\";\nimport { Servers } from \"./DevMenu/ui/Servers\";\nimport { Companies } from \"./DevMenu/ui/Companies\";\nimport { Bladeburner as BladeburnerElem } from \"./DevMenu/ui/Bladeburner\";\nimport { Gang } from \"./DevMenu/ui/Gang\";\nimport { Corporation } from \"./DevMenu/ui/Corporation\";\nimport { CodingContracts } from \"./DevMenu/ui/CodingContracts\";\nimport { StockMarket } from \"./DevMenu/ui/StockMarket\";\nimport { Sleeves } from \"./DevMenu/ui/Sleeves\";\nimport { TimeSkip } from \"./DevMenu/ui/TimeSkip\";\n\ninterface IProps {\n player: IPlayer;\n engine: IEngine;\n router: IRouter;\n}\n\nexport function DevMenuRoot(props: IProps): React.ReactElement {\n return (\n <>\n

    Development Menu - Only meant to be used for testing/debugging

    \n \n \n \n \n \n \n \n \n\n {props.player.bladeburner instanceof Bladeburner && }\n\n {props.player.inGang() && }\n\n {props.player.hasCorporation() && }\n\n \n\n {props.player.hasWseAccount && }\n\n {props.player.sleeves.length > 0 && }\n\n \n \n );\n}\n","import React from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport { Money } from \"../../ui/React/Money\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { IRouter } from \"../../ui/Router\";\n\ninterface IProps {\n player: IPlayer;\n router: IRouter;\n}\n\nexport function General(props: IProps): React.ReactElement {\n function addMoney(n: number) {\n return function () {\n props.player.gainMoney(n);\n };\n }\n\n function upgradeRam(): void {\n props.player.getHomeComputer().maxRam *= 2;\n }\n\n function quickB1tFlum3(): void {\n props.router.toBitVerse(true, true);\n }\n\n function b1tflum3(): void {\n props.router.toBitVerse(true, false);\n }\n\n function quickHackW0r1dD43m0n(): void {\n props.router.toBitVerse(false, true);\n }\n\n function hackW0r1dD43m0n(): void {\n props.router.toBitVerse(false, false);\n }\n\n return (\n \n }>\n

    General

    \n
    \n \n
    \n \n \n \n \n \n \n
    \n
    \n \n \n \n \n
    \n
    \n
    \n );\n}\n","import React from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport { Adjuster } from \"./Adjuster\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nconst bigNumber = 1e27;\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function Stats(props: IProps): React.ReactElement {\n function modifyExp(stat: string, modifier: number) {\n return function (exp: number) {\n switch (stat) {\n case \"hacking\":\n if (exp) {\n props.player.gainHackingExp(exp * modifier);\n }\n break;\n case \"strength\":\n if (exp) {\n props.player.gainStrengthExp(exp * modifier);\n }\n break;\n case \"defense\":\n if (exp) {\n props.player.gainDefenseExp(exp * modifier);\n }\n break;\n case \"dexterity\":\n if (exp) {\n props.player.gainDexterityExp(exp * modifier);\n }\n break;\n case \"agility\":\n if (exp) {\n props.player.gainAgilityExp(exp * modifier);\n }\n break;\n case \"charisma\":\n if (exp) {\n props.player.gainCharismaExp(exp * modifier);\n }\n break;\n case \"intelligence\":\n if (exp) {\n props.player.gainIntelligenceExp(exp * modifier);\n }\n break;\n }\n props.player.updateSkillLevels();\n };\n }\n\n function modifyKarma(modifier: number) {\n return function (amt: number) {\n props.player.karma += amt * modifier;\n };\n }\n\n function tonsOfExp(): void {\n props.player.gainHackingExp(bigNumber);\n props.player.gainStrengthExp(bigNumber);\n props.player.gainDefenseExp(bigNumber);\n props.player.gainDexterityExp(bigNumber);\n props.player.gainAgilityExp(bigNumber);\n props.player.gainCharismaExp(bigNumber);\n props.player.gainIntelligenceExp(bigNumber);\n props.player.updateSkillLevels();\n }\n\n function resetAllExp(): void {\n props.player.hacking_exp = 0;\n props.player.strength_exp = 0;\n props.player.defense_exp = 0;\n props.player.dexterity_exp = 0;\n props.player.agility_exp = 0;\n props.player.charisma_exp = 0;\n props.player.intelligence_exp = 0;\n props.player.updateSkillLevels();\n }\n\n function resetExperience(stat: string): () => void {\n return function () {\n switch (stat) {\n case \"hacking\":\n props.player.hacking_exp = 0;\n break;\n case \"strength\":\n props.player.strength_exp = 0;\n break;\n case \"defense\":\n props.player.defense_exp = 0;\n break;\n case \"dexterity\":\n props.player.dexterity_exp = 0;\n break;\n case \"agility\":\n props.player.agility_exp = 0;\n break;\n case \"charisma\":\n props.player.charisma_exp = 0;\n break;\n case \"intelligence\":\n props.player.intelligence_exp = 0;\n break;\n }\n props.player.updateSkillLevels();\n };\n }\n\n function resetKarma(): () => void {\n return function () {\n props.player.karma = 0;\n };\n }\n\n function enableIntelligence(): void {\n if (props.player.intelligence === 0) {\n props.player.intelligence = 1;\n props.player.updateSkillLevels();\n }\n }\n\n function disableIntelligence(): void {\n props.player.intelligence_exp = 0;\n props.player.intelligence = 0;\n props.player.updateSkillLevels();\n }\n\n return (\n \n }>\n

    Experience / Stats

    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n All:\n \n \n \n
    \n Hacking:\n \n modifyExp(\"hacking\", 1)(bigNumber)}\n add={modifyExp(\"hacking\", 1)}\n subtract={modifyExp(\"hacking\", -1)}\n reset={resetExperience(\"hacking\")}\n />\n
    \n Strength:\n \n modifyExp(\"strength\", 1)(bigNumber)}\n add={modifyExp(\"strength\", 1)}\n subtract={modifyExp(\"strength\", -1)}\n reset={resetExperience(\"strength\")}\n />\n
    \n Defense:\n \n modifyExp(\"defense\", 1)(bigNumber)}\n add={modifyExp(\"defense\", 1)}\n subtract={modifyExp(\"defense\", -1)}\n reset={resetExperience(\"defense\")}\n />\n
    \n Dexterity:\n \n modifyExp(\"dexterity\", 1)(bigNumber)}\n add={modifyExp(\"dexterity\", 1)}\n subtract={modifyExp(\"dexterity\", -1)}\n reset={resetExperience(\"dexterity\")}\n />\n
    \n Agility:\n \n modifyExp(\"agility\", 1)(bigNumber)}\n add={modifyExp(\"agility\", 1)}\n subtract={modifyExp(\"agility\", -1)}\n reset={resetExperience(\"agility\")}\n />\n
    \n Charisma:\n \n modifyExp(\"charisma\", 1)(bigNumber)}\n add={modifyExp(\"charisma\", 1)}\n subtract={modifyExp(\"charisma\", -1)}\n reset={resetExperience(\"charisma\")}\n />\n
    \n Intelligence:\n \n modifyExp(\"intelligence\", 1)(bigNumber)}\n add={modifyExp(\"intelligence\", 1)}\n subtract={modifyExp(\"intelligence\", -1)}\n reset={resetExperience(\"intelligence\")}\n />\n \n \n \n \n
    \n Karma:\n \n modifyExp(\"intelligence\", 1)(100000)}\n add={modifyKarma(1)}\n subtract={modifyKarma(-1)}\n reset={resetKarma()}\n />\n
    \n
    \n
    \n );\n}\n","import React, { useState } from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport Select, { SelectChangeEvent } from \"@mui/material/Select\";\nimport { Adjuster } from \"./Adjuster\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { Factions as AllFaction } from \"../../Faction/Factions\";\nimport FormControl from \"@mui/material/FormControl\";\nimport MenuItem from \"@mui/material/MenuItem\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ReplyAllIcon from \"@mui/icons-material/ReplyAll\";\nimport ReplyIcon from \"@mui/icons-material/Reply\";\nimport InputLabel from \"@mui/material/InputLabel\";\n\nconst bigNumber = 1e12;\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function Factions(props: IProps): React.ReactElement {\n const [faction, setFaction] = useState(\"Illuminati\");\n\n function setFactionDropdown(event: SelectChangeEvent): void {\n setFaction(event.target.value as string);\n }\n\n function receiveInvite(): void {\n props.player.receiveInvite(faction);\n }\n\n function receiveAllInvites(): void {\n for (const i in AllFaction) {\n props.player.receiveInvite(AllFaction[i].name);\n }\n }\n\n function modifyFactionRep(modifier: number): (x: number) => void {\n return function (reputation: number): void {\n const fac = AllFaction[faction];\n if (fac != null && !isNaN(reputation)) {\n fac.playerReputation += reputation * modifier;\n }\n };\n }\n\n function resetFactionRep(): void {\n const fac = AllFaction[faction];\n if (fac != null) {\n fac.playerReputation = 0;\n }\n }\n\n function modifyFactionFavor(modifier: number): (x: number) => void {\n return function (favor: number): void {\n const fac = AllFaction[faction];\n if (fac != null && !isNaN(favor)) {\n fac.favor += favor * modifier;\n }\n };\n }\n\n function resetFactionFavor(): void {\n const fac = AllFaction[faction];\n if (fac != null) {\n fac.favor = 0;\n }\n }\n\n function tonsOfRep(): void {\n for (const i in AllFaction) {\n AllFaction[i].playerReputation = bigNumber;\n }\n }\n\n function resetAllRep(): void {\n for (const i in AllFaction) {\n AllFaction[i].playerReputation = 0;\n }\n }\n\n function tonsOfFactionFavor(): void {\n for (const i in AllFaction) {\n AllFaction[i].favor = bigNumber;\n }\n }\n\n function resetAllFactionFavor(): void {\n for (const i in AllFaction) {\n AllFaction[i].favor = 0;\n }\n }\n\n return (\n \n }>\n

    Factions

    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n Faction:\n \n \n Faction\n \n \n \n \n \n \n \n \n }\n >\n {Object.values(AllFaction).map((faction) => (\n \n {faction.name}\n \n ))}\n \n \n
    \n Reputation:\n \n modifyFactionRep(1)(bigNumber)}\n add={modifyFactionRep(1)}\n subtract={modifyFactionRep(-1)}\n reset={resetFactionRep}\n />\n
    \n Favor:\n \n modifyFactionFavor(1)(2000)}\n add={modifyFactionFavor(1)}\n subtract={modifyFactionFavor(-1)}\n reset={resetFactionFavor}\n />\n
    \n All Reputation:\n \n \n \n
    \n All Favor:\n \n \n \n
    \n
    \n
    \n );\n}\n","import React, { useState } from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Select, { SelectChangeEvent } from \"@mui/material/Select\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { AugmentationNames } from \"../../Augmentation/data/AugmentationNames\";\nimport MenuItem from \"@mui/material/MenuItem\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ReplyAllIcon from \"@mui/icons-material/ReplyAll\";\nimport ReplyIcon from \"@mui/icons-material/Reply\";\nimport ClearIcon from \"@mui/icons-material/Clear\";\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function Augmentations(props: IProps): React.ReactElement {\n const [augmentation, setAugmentation] = useState(\"Augmented Targeting I\");\n\n function setAugmentationDropdown(event: SelectChangeEvent): void {\n setAugmentation(event.target.value as string);\n }\n function queueAug(): void {\n props.player.queueAugmentation(augmentation);\n }\n\n function queueAllAugs(): void {\n for (const i in AugmentationNames) {\n const augName = AugmentationNames[i];\n props.player.queueAugmentation(augName);\n }\n }\n\n function clearAugs(): void {\n props.player.augmentations = [];\n }\n\n return (\n \n }>\n

    Augmentations

    \n
    \n \n \n \n \n \n \n \n \n
    \n Aug:\n \n \n \n \n \n \n \n \n \n }\n endAdornment={\n <>\n \n \n \n \n }\n >\n {Object.values(AugmentationNames).map((aug) => (\n \n {aug}\n \n ))}\n \n
    \n
    \n
    \n );\n}\n","import React from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport { PlayerOwnedSourceFile } from \"../../SourceFile/PlayerOwnedSourceFile\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport ButtonGroup from \"@mui/material/ButtonGroup\";\n\n// Update as additional BitNodes get implemented\nconst validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function SourceFiles(props: IProps): React.ReactElement {\n function setSF(sfN: number, sfLvl: number) {\n return function () {\n if (sfLvl === 0) {\n props.player.sourceFiles = props.player.sourceFiles.filter((sf) => sf.n !== sfN);\n return;\n }\n\n if (!props.player.sourceFiles.some((sf) => sf.n === sfN)) {\n props.player.sourceFiles.push(new PlayerOwnedSourceFile(sfN, sfLvl));\n return;\n }\n\n for (let i = 0; i < props.player.sourceFiles.length; i++) {\n if (props.player.sourceFiles[i].n === sfN) {\n props.player.sourceFiles[i].lvl = sfLvl;\n }\n }\n };\n }\n\n function setAllSF(sfLvl: number) {\n return () => {\n for (let i = 0; i < validSFN.length; i++) {\n setSF(validSFN[i], sfLvl)();\n }\n };\n }\n\n function clearExploits(): void {\n props.player.exploits = [];\n }\n\n return (\n \n }>\n

    Source-Files

    \n
    \n \n \n \n \n \n \n \n \n \n \n \n {validSFN.map((i) => (\n \n \n \n \n ))}\n \n
    \n Exploits:\n \n \n
    \n All:\n \n \n \n \n \n \n \n
    \n SF-{i}:\n \n \n \n \n \n \n \n
    \n
    \n
    \n );\n}\n","import React, { useState } from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport Select, { SelectChangeEvent } from \"@mui/material/Select\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { Programs as AllPrograms } from \"../../Programs/Programs\";\nimport MenuItem from \"@mui/material/MenuItem\";\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function Programs(props: IProps): React.ReactElement {\n const [program, setProgram] = useState(\"NUKE.exe\");\n function setProgramDropdown(event: SelectChangeEvent): void {\n setProgram(event.target.value as string);\n }\n function addProgram(): void {\n if (!props.player.hasProgram(program)) {\n props.player.getHomeComputer().programs.push(program);\n }\n }\n\n function addAllPrograms(): void {\n for (const i in AllPrograms) {\n if (!props.player.hasProgram(AllPrograms[i].name)) {\n props.player.getHomeComputer().programs.push(AllPrograms[i].name);\n }\n }\n }\n\n return (\n \n }>\n

    Programs

    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n Program:\n \n \n
    \n Add:\n \n \n \n
    \n
    \n
    \n );\n}\n","import React, { useState } from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport Select, { SelectChangeEvent } from \"@mui/material/Select\";\nimport { AllServers } from \"../../Server/AllServers\";\nimport { HacknetServer } from \"../../Hacknet/HacknetServer\";\nimport { GetServerByHostname } from \"../../Server/ServerHelpers\";\nimport MenuItem from \"@mui/material/MenuItem\";\n\nexport function Servers(): React.ReactElement {\n const [server, setServer] = useState(\"home\");\n function setServerDropdown(event: SelectChangeEvent): void {\n setServer(event.target.value as string);\n }\n function rootServer(): void {\n const s = GetServerByHostname(server);\n if (s === null) return;\n if (s instanceof HacknetServer) return;\n s.hasAdminRights = true;\n s.sshPortOpen = true;\n s.ftpPortOpen = true;\n s.smtpPortOpen = true;\n s.httpPortOpen = true;\n s.sqlPortOpen = true;\n s.openPortCount = 5;\n }\n\n function rootAllServers(): void {\n for (const i in AllServers) {\n const s = AllServers[i];\n if (s instanceof HacknetServer) return;\n s.hasAdminRights = true;\n s.sshPortOpen = true;\n s.ftpPortOpen = true;\n s.smtpPortOpen = true;\n s.httpPortOpen = true;\n s.sqlPortOpen = true;\n s.openPortCount = 5;\n }\n }\n\n function minSecurity(): void {\n const s = GetServerByHostname(server);\n if (s === null) return;\n if (s instanceof HacknetServer) return;\n s.hackDifficulty = s.minDifficulty;\n }\n\n function minAllSecurity(): void {\n for (const i in AllServers) {\n const server = AllServers[i];\n if (server instanceof HacknetServer) continue;\n server.hackDifficulty = server.minDifficulty;\n }\n }\n\n function maxMoney(): void {\n const s = GetServerByHostname(server);\n if (s === null) return;\n if (s instanceof HacknetServer) return;\n s.moneyAvailable = s.moneyMax;\n }\n\n function maxAllMoney(): void {\n for (const i in AllServers) {\n const server = AllServers[i];\n if (server instanceof HacknetServer) continue;\n server.moneyAvailable = server.moneyMax;\n }\n }\n\n return (\n \n }>\n

    Servers

    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n Server:\n \n \n
    \n Root:\n \n \n \n \n
    \n Security:\n \n \n \n \n
    \n Money:\n \n \n \n \n
    \n
    \n
    \n );\n}\n","import React, { useState } from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport Select, { SelectChangeEvent } from \"@mui/material/Select\";\nimport { Companies as AllCompanies } from \"../../Company/Companies\";\nimport MenuItem from \"@mui/material/MenuItem\";\nimport { Adjuster } from \"./Adjuster\";\n\nconst bigNumber = 1e12;\n\nexport function Companies(): React.ReactElement {\n const [company, setCompany] = useState(\"ECorp\");\n function setCompanyDropdown(event: SelectChangeEvent): void {\n setCompany(event.target.value as string);\n }\n function resetCompanyRep(): void {\n AllCompanies[company].playerReputation = 0;\n }\n\n function modifyCompanyRep(modifier: number): (x: number) => void {\n return function (reputation: number): void {\n const c = AllCompanies[company];\n if (c != null && !isNaN(reputation)) {\n c.playerReputation += reputation * modifier;\n }\n };\n }\n\n function modifyCompanyFavor(modifier: number): (x: number) => void {\n return function (favor: number): void {\n const c = AllCompanies[company];\n if (c != null && !isNaN(favor)) {\n c.favor += favor * modifier;\n }\n };\n }\n\n function resetCompanyFavor(): void {\n AllCompanies[company].favor = 0;\n }\n\n function tonsOfRepCompanies(): void {\n for (const c in AllCompanies) {\n AllCompanies[c].playerReputation = bigNumber;\n }\n }\n\n function resetAllRepCompanies(): void {\n for (const c in AllCompanies) {\n AllCompanies[c].playerReputation = 0;\n }\n }\n\n function tonsOfFavorCompanies(): void {\n for (const c in AllCompanies) {\n AllCompanies[c].favor = bigNumber;\n }\n }\n\n function resetAllFavorCompanies(): void {\n for (const c in AllCompanies) {\n AllCompanies[c].favor = 0;\n }\n }\n\n return (\n \n }>\n

    Companies

    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n Company:\n \n \n
    \n Reputation:\n \n modifyCompanyRep(1)(bigNumber)}\n add={modifyCompanyRep(1)}\n subtract={modifyCompanyRep(-1)}\n reset={resetCompanyRep}\n />\n
    \n Favor:\n \n modifyCompanyFavor(1)(2000)}\n add={modifyCompanyFavor(1)}\n subtract={modifyCompanyFavor(-1)}\n reset={resetCompanyFavor}\n />\n
    \n All Reputation:\n \n \n \n
    \n All Favor:\n \n \n \n
    \n
    \n
    \n );\n}\n","import React from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport { Adjuster } from \"./Adjuster\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nconst bigNumber = 1e27;\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function Bladeburner(props: IProps): React.ReactElement {\n function modifyBladeburnerRank(modify: number): (x: number) => void {\n return function (rank: number): void {\n if (props.player.bladeburner) {\n props.player.bladeburner.changeRank(props.player, rank * modify);\n }\n };\n }\n\n function resetBladeburnerRank(): void {\n props.player.bladeburner.rank = 0;\n props.player.bladeburner.maxRank = 0;\n }\n\n function addTonsBladeburnerRank(): void {\n if (props.player.bladeburner) {\n props.player.bladeburner.changeRank(props.player, bigNumber);\n }\n }\n\n function modifyBladeburnerCycles(modify: number): (x: number) => void {\n return function (cycles: number): void {\n if (props.player.bladeburner) {\n props.player.bladeburner.storedCycles += cycles * modify;\n }\n };\n }\n\n function resetBladeburnerCycles(): void {\n if (props.player.bladeburner) {\n props.player.bladeburner.storedCycles = 0;\n }\n }\n\n function addTonsBladeburnerCycles(): void {\n if (props.player.bladeburner) {\n props.player.bladeburner.storedCycles += bigNumber;\n }\n }\n\n return (\n \n }>\n

    Bladeburner

    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n Rank:\n \n \n
    \n Cycles:\n \n \n
    \n
    \n
    \n );\n}\n","import React from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport { Adjuster } from \"./Adjuster\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nconst bigNumber = 1e27;\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function Gang(props: IProps): React.ReactElement {\n function addTonsGangCycles(): void {\n if (props.player.gang) {\n props.player.gang.storedCycles = bigNumber;\n }\n }\n\n function modifyGangCycles(modify: number): (x: number) => void {\n return function (cycles: number): void {\n if (props.player.gang) {\n props.player.gang.storedCycles += cycles * modify;\n }\n };\n }\n\n function resetGangCycles(): void {\n if (props.player.gang) {\n props.player.gang.storedCycles = 0;\n }\n }\n\n return (\n \n }>\n

    Gang

    \n
    \n \n \n \n \n \n \n \n \n
    \n Cycles:\n \n \n
    \n
    \n
    \n );\n}\n","import React from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport { Adjuster } from \"./Adjuster\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nconst bigNumber = 1e27;\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function Corporation(props: IProps): React.ReactElement {\n function addTonsCorporationFunds(): void {\n if (props.player.corporation) {\n props.player.corporation.funds = props.player.corporation.funds.plus(1e99);\n }\n }\n\n function resetCorporationFunds(): void {\n if (props.player.corporation) {\n props.player.corporation.funds = props.player.corporation.funds.minus(props.player.corporation.funds);\n }\n }\n\n function addTonsCorporationCycles(): void {\n if (props.player.corporation) {\n props.player.corporation.storedCycles = bigNumber;\n }\n }\n\n function modifyCorporationCycles(modify: number): (x: number) => void {\n return function (cycles: number): void {\n if (props.player.corporation) {\n props.player.corporation.storedCycles += cycles * modify;\n }\n };\n }\n\n function resetCorporationCycles(): void {\n if (props.player.corporation) {\n props.player.corporation.storedCycles = 0;\n }\n }\n\n function finishCorporationProducts(): void {\n if (!props.player.corporation) return;\n props.player.corporation.divisions.forEach((div) => {\n Object.keys(div.products).forEach((prod) => {\n const product = div.products[prod];\n if (product === undefined) throw new Error(\"Impossible product undefined\");\n product.prog = 99.9;\n });\n });\n }\n\n function addCorporationResearch(): void {\n if (!props.player.corporation) return;\n props.player.corporation.divisions.forEach((div) => {\n div.sciResearch.qty += 1e10;\n });\n }\n\n return (\n \n }>\n

    Corporation

    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n \n \n
    \n Cycles:\n \n \n
    \n \n
    \n \n
    \n
    \n
    \n );\n}\n","import React, { useState } from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport Select, { SelectChangeEvent } from \"@mui/material/Select\";\nimport MenuItem from \"@mui/material/MenuItem\";\nimport { generateContract, generateRandomContract, generateRandomContractOnHome } from \"../../CodingContractGenerator\";\nimport { CodingContractTypes } from \"../../CodingContracts\";\n\nexport function CodingContracts(): React.ReactElement {\n const [codingcontract, setCodingcontract] = useState(\"Find Largest Prime Factor\");\n function setCodingcontractDropdown(event: SelectChangeEvent): void {\n setCodingcontract(event.target.value as string);\n }\n\n function specificContract(): void {\n generateContract({\n problemType: codingcontract,\n server: \"home\",\n });\n }\n\n return (\n \n }>\n

    Coding Contracts

    \n
    \n \n \n \n \n \n \n \n \n \n \n
    \n \n \n
    \n \n \n
    \n
    \n
    \n );\n}\n","import React, { useState } from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport TextField from \"@mui/material/TextField\";\nimport { Money } from \"../../ui/React/Money\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { StockMarket as SM } from \"../../StockMarket/StockMarket\";\nimport { Stock } from \"../../StockMarket/Stock\";\n\nexport function StockMarket(): React.ReactElement {\n const [stockPrice, setStockPrice] = useState(0);\n const [stockSymbol, setStockSymbol] = useState(\"\");\n\n function setStockPriceField(event: React.ChangeEvent): void {\n setStockPrice(parseFloat(event.target.value));\n }\n\n function setStockSymbolField(event: React.ChangeEvent): void {\n setStockSymbol(event.target.value);\n }\n\n function processStocks(sub: (arg0: Stock) => void): void {\n const inputSymbols = stockSymbol.replace(/\\s/g, \"\");\n\n let match: (symbol: string) => boolean = (): boolean => {\n return true;\n };\n\n if (inputSymbols !== \"\" && inputSymbols !== \"all\") {\n match = function (symbol: string): boolean {\n return inputSymbols.split(\",\").includes(symbol);\n };\n }\n\n for (const name in SM) {\n if (SM.hasOwnProperty(name)) {\n const stock = SM[name];\n if (stock instanceof Stock && match(stock.symbol)) {\n sub(stock);\n }\n }\n }\n }\n\n function doSetStockPrice(): void {\n if (!isNaN(stockPrice)) {\n processStocks((stock: Stock) => {\n stock.price = stockPrice;\n });\n }\n }\n\n function viewStockCaps(): void {\n const stocks: JSX.Element[] = [];\n processStocks((stock: Stock) => {\n stocks.push(\n \n {stock.symbol}\n \n \n \n ,\n );\n });\n dialogBoxCreate(\n \n \n \n \n \n \n {stocks}\n \n
    StockPrice cap
    ,\n );\n }\n return (\n \n }>\n

    Stock Market

    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n Symbol:\n \n \n
    \n Price:\n \n \n \n
    \n Caps:\n \n \n
    \n
    \n
    \n );\n}\n","import React from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function Sleeves(props: IProps): React.ReactElement {\n function sleeveMaxAllShock(): void {\n for (let i = 0; i < props.player.sleeves.length; ++i) {\n props.player.sleeves[i].shock = 0;\n }\n }\n\n function sleeveClearAllShock(): void {\n for (let i = 0; i < props.player.sleeves.length; ++i) {\n props.player.sleeves[i].shock = 100;\n }\n }\n\n function sleeveSyncMaxAll(): void {\n for (let i = 0; i < props.player.sleeves.length; ++i) {\n props.player.sleeves[i].sync = 100;\n }\n }\n\n function sleeveSyncClearAll(): void {\n for (let i = 0; i < props.player.sleeves.length; ++i) {\n props.player.sleeves[i].sync = 0;\n }\n }\n\n return (\n \n }>\n

    Sleeves

    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n Shock:\n \n \n \n \n
    \n Sync:\n \n \n \n \n
    \n
    \n
    \n );\n}\n","import React from \"react\";\n\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\nimport Button from \"@mui/material/Button\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { saveObject } from \"../../SaveObject\";\nimport { IEngine } from \"../../IEngine\";\n\n// Update as additional BitNodes get implemented\n\ninterface IProps {\n player: IPlayer;\n engine: IEngine;\n}\n\nexport function TimeSkip(props: IProps): React.ReactElement {\n function timeskip(time: number) {\n return () => {\n props.player.lastUpdate -= time;\n props.engine._lastUpdate -= time;\n saveObject.saveGame();\n setTimeout(() => location.reload(), 1000);\n };\n }\n\n return (\n \n }>\n

    Time skip

    \n
    \n \n \n \n \n \n
    \n );\n}\n","import React from \"react\";\nimport { Stats } from \"./Stats\";\nimport { Console } from \"./Console\";\nimport { AllPages } from \"./AllPages\";\n\nimport { use } from \"../../ui/Context\";\nimport { IBladeburner } from \"../IBladeburner\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n}\n\nexport function BladeburnerRoot(props: IProps): React.ReactElement {\n const player = use.Player();\n const router = use.Router();\n return (\n
    \n
    \n \n \n
    \n \n
    \n \n \n
    \n \n );\n}\n","import React, { useState, useEffect } from \"react\";\nimport { formatNumber, convertTimeMsToTimeElapsedString } from \"../../../utils/StringHelperFunctions\";\nimport { BladeburnerConstants } from \"../data/Constants\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { Money } from \"../../ui/React/Money\";\nimport { StatsTable } from \"../../ui/React/StatsTable\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { Factions } from \"../../Faction/Factions\";\nimport { IRouter } from \"../../ui/Router\";\nimport { joinFaction } from \"../../Faction/FactionHelpers\";\nimport { IBladeburner } from \"../IBladeburner\";\n\nimport { TravelPopup } from \"./TravelPopup\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n router: IRouter;\n player: IPlayer;\n}\n\nexport function Stats(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n\n useEffect(() => {\n const id = setInterval(() => setRerender((old) => !old), 1000);\n return () => clearInterval(id);\n }, []);\n\n function openStaminaHelp(): void {\n dialogBoxCreate(\n \"Performing actions will use up your stamina.

    \" +\n \"Your max stamina is determined primarily by your agility stat.

    \" +\n \"Your stamina gain rate is determined by both your agility and your \" +\n \"max stamina. Higher max stamina leads to a higher gain rate.

    \" +\n \"Once your \" +\n \"stamina falls below 50% of its max value, it begins to negatively \" +\n \"affect the success rate of your contracts/operations. This penalty \" +\n \"is shown in the overview panel. If the penalty is 15%, then this means \" +\n \"your success rate would be multipled by 85% (100 - 15).

    \" +\n \"Your max stamina and stamina gain rate can also be increased by \" +\n \"training, or through skills and Augmentation upgrades.\",\n );\n }\n\n function openPopulationHelp(): void {\n dialogBoxCreate(\n \"The success rate of your contracts/operations depends on \" +\n \"the population of Synthoids in your current city. \" +\n \"The success rate that is shown to you is only an estimate, \" +\n \"and it is based on your Synthoid population estimate.

    \" +\n \"Therefore, it is important that this Synthoid population estimate \" +\n \"is accurate so that you have a better idea of your \" +\n \"success rate for contracts/operations. Certain \" +\n \"actions will increase the accuracy of your population \" +\n \"estimate.

    \" +\n \"The Synthoid populations of cities can change due to your \" +\n \"actions or random events. If random events occur, they will \" +\n \"be logged in the Bladeburner Console.\",\n );\n }\n\n function openTravel(): void {\n const popupId = \"bladeburner-travel-popup\";\n createPopup(popupId, TravelPopup, {\n bladeburner: props.bladeburner,\n popupId: popupId,\n });\n }\n\n function openFaction(): void {\n const faction = Factions[\"Bladeburners\"];\n if (faction.isMember) {\n props.router.toFaction(faction);\n } else {\n if (props.bladeburner.rank >= BladeburnerConstants.RankNeededForFaction) {\n joinFaction(faction);\n dialogBoxCreate(\"Congratulations! You were accepted into the Bladeburners faction\");\n } else {\n dialogBoxCreate(\"You need a rank of 25 to join the Bladeburners Faction!\");\n }\n }\n }\n\n return (\n <>\n

    \n Rank: {formatNumber(props.bladeburner.rank, 2)}\n Your rank within the Bladeburner division.\n

    \n
    \n

    \n Stamina: {formatNumber(props.bladeburner.stamina, 3)} / {formatNumber(props.bladeburner.maxStamina, 3)}\n

    \n
    \n ?\n
    \n
    \n

    Stamina Penalty: {formatNumber((1 - props.bladeburner.calculateStaminaPenalty()) * 100, 1)}%

    \n
    \n

    Team Size: {formatNumber(props.bladeburner.teamSize, 0)}

    \n

    Team Members Lost: {formatNumber(props.bladeburner.teamLost, 0)}

    \n
    \n

    Num Times Hospitalized: {props.bladeburner.numHosp}

    \n

    \n Money Lost From Hospitalizations: \n

    \n
    \n

    Current City: {props.bladeburner.city}

    \n

    \n Est. Synthoid Population: {numeralWrapper.formatPopulation(props.bladeburner.getCurrentCity().popEst)}\n \n This is your Bladeburner division's estimate of how many Synthoids exist in your current city.\n \n

    \n
    \n ?\n
    \n
    \n

    \n Est. Synthoid Communities: {formatNumber(props.bladeburner.getCurrentCity().comms, 0)}\n \n This is your Bladeburner divison's estimate of how many Synthoid communities exist in your current city.\n \n

    \n
    \n

    \n City Chaos: {formatNumber(props.bladeburner.getCurrentCity().chaos)}\n \n The city's chaos level due to tensions and conflicts between humans and Synthoids. Having too high of a chaos\n level can make contracts and operations harder.\n \n

    \n
    \n
    \n

    \n Bonus time:{\" \"}\n {convertTimeMsToTimeElapsedString(\n (props.bladeburner.storedCycles / BladeburnerConstants.CyclesPerSecond) * 1000,\n )}\n
    \n \n You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by browser).\n Bonus time makes the Bladeburner mechanic progress faster, up to 5x the normal speed.\n \n

    \n

    Skill Points: {formatNumber(props.bladeburner.skillPoints, 0)}

    \n
    \n \n
    \n \n Travel\n \n \n \n Apply to the Bladeburner Faction, or go to the faction page if you are already a member\n \n Faction\n \n
    \n
    \n \n );\n}\n","import React from \"react\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { WorldMap } from \"../../ui/React/WorldMap\";\nimport { CityName } from \"../../Locations/data/CityNames\";\nimport { Settings } from \"../../Settings/Settings\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n popupId: string;\n}\n\nexport function TravelPopup(props: IProps): React.ReactElement {\n function travel(city: string): void {\n props.bladeburner.city = city;\n removePopup(props.popupId);\n }\n\n return (\n <>\n

    \n Travel to a different city for your Bladeburner activities. This does not cost any money. The city you are in\n for your Bladeburner duties does not affect your location in the game otherwise.\n

    \n {Settings.DisableASCIIArt ? (\n Object.values(CityName).map((city: CityName) => (\n \n ))\n ) : (\n travel(city)} />\n )}\n \n );\n}\n","import React, { useState, useRef, useEffect } from \"react\";\nimport { IBladeburner } from \"../IBladeburner\";\n\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface ILineProps {\n content: any;\n}\n\nfunction Line(props: ILineProps): React.ReactElement {\n return (\n \n \n {props.content}\n \n \n );\n}\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n}\n\nexport function Console(props: IProps): React.ReactElement {\n const lastRef = useRef(null);\n const setRerender = useState(false)[1];\n\n const [consoleHistoryIndex, setConsoleHistoryIndex] = useState(props.bladeburner.consoleHistory.length);\n\n // TODO: Figure out how to actually make the scrolling work correctly.\n function scrollToBottom(): void {\n if (!lastRef.current) return;\n lastRef.current.scrollTop = lastRef.current.scrollHeight;\n }\n\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => {\n const id = setInterval(rerender, 1000);\n const id2 = setInterval(scrollToBottom, 100);\n return () => {\n clearInterval(id);\n clearInterval(id2);\n };\n }, []);\n\n function handleKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) {\n event.preventDefault();\n const command = event.currentTarget.value;\n event.currentTarget.value = \"\";\n if (command.length > 0) {\n props.bladeburner.postToConsole(\"> \" + command);\n props.bladeburner.executeConsoleCommands(props.player, command);\n setConsoleHistoryIndex(props.bladeburner.consoleHistory.length);\n rerender();\n }\n }\n\n const consoleHistory = props.bladeburner.consoleHistory;\n\n if (event.keyCode === 38) {\n // up\n let i = consoleHistoryIndex;\n const len = consoleHistory.length;\n if (len === 0) {\n return;\n }\n if (i < 0 || i > len) {\n setConsoleHistoryIndex(len);\n }\n\n if (i !== 0) {\n i = i - 1;\n }\n setConsoleHistoryIndex(i);\n const prevCommand = consoleHistory[i];\n event.currentTarget.value = prevCommand;\n }\n\n if (event.keyCode === 40) {\n const i = consoleHistoryIndex;\n const len = consoleHistory.length;\n\n if (len == 0) {\n return;\n }\n if (i < 0 || i > len) {\n setConsoleHistoryIndex(len);\n }\n\n // Latest command, put nothing\n if (i == len || i == len - 1) {\n setConsoleHistoryIndex(len);\n event.currentTarget.value = \"\";\n } else {\n setConsoleHistoryIndex(consoleHistoryIndex + 1);\n const prevCommand = consoleHistory[consoleHistoryIndex + 1];\n event.currentTarget.value = prevCommand;\n }\n }\n }\n\n return (\n
    \n \n \n {/*\n TODO: optimize this.\n using `i` as a key here isn't great because it'll re-render everything\n everytime the console reaches max length.\n */}\n {props.bladeburner.consoleLogs.map((log: any, i: number) => (\n \n ))}\n \n \n \n \n
    \n
    {\"> \"}
    \n \n
    \n
    \n );\n}\n","import React, { useState, useEffect } from \"react\";\nimport { GeneralActionPage } from \"./GeneralActionPage\";\nimport { ContractPage } from \"./ContractPage\";\nimport { OperationPage } from \"./OperationPage\";\nimport { BlackOpPage } from \"./BlackOpPage\";\nimport { SkillPage } from \"./SkillPage\";\nimport { stealthIcon, killIcon } from \"../data/Icons\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n}\n\nexport function AllPages(props: IProps): React.ReactElement {\n const [page, setPage] = useState(\"General\");\n const setRerender = useState(false)[1];\n\n useEffect(() => {\n const id = setInterval(() => setRerender((old) => !old), 1000);\n return () => clearInterval(id);\n }, []);\n\n function Header(props: { name: string }): React.ReactElement {\n return (\n setPage(props.name)}\n className={page !== props.name ? \"bladeburner-nav-button noselect\" : \"bladeburner-nav-button-inactive noselect\"}\n >\n {props.name}\n \n );\n }\n return (\n <>\n
    \n
    \n
    \n
    \n
    \n
    \n {page === \"General\" && }\n {page === \"Contracts\" && }\n {page === \"Operations\" && }\n {page === \"BlackOps\" && }\n {page === \"Skills\" && }\n
    \n \n {stealthIcon} = This action requires stealth, {killIcon} = This action involves retirement\n \n \n );\n}\n","import * as React from \"react\";\nimport { GeneralActionList } from \"./GeneralActionList\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n}\n\nexport function GeneralActionPage(props: IProps): React.ReactElement {\n return (\n <>\n

    \n These are generic actions that will assist you in your Bladeburner duties. They will not affect your Bladeburner\n rank in any way.\n

    \n \n \n );\n}\n","import React from \"react\";\nimport { GeneralActionElem } from \"./GeneralActionElem\";\nimport { Action } from \"../Action\";\nimport { GeneralActions } from \"../GeneralActions\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n}\n\nexport function GeneralActionList(props: IProps): React.ReactElement {\n const actions: Action[] = [];\n for (const name in GeneralActions) {\n if (GeneralActions.hasOwnProperty(name)) {\n actions.push(GeneralActions[name]);\n }\n }\n return (\n <>\n {actions.map((action: Action) => (\n
  • \n \n
  • \n ))}\n \n );\n}\n","import React, { useState } from \"react\";\nimport { ActionTypes } from \"../data/ActionTypes\";\nimport { createProgressBarText } from \"../../../utils/helpers/createProgressBarText\";\nimport { formatNumber, convertTimeMsToTimeElapsedString } from \"../../../utils/StringHelperFunctions\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { CopyableText } from \"../../ui/React/CopyableText\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n action: any;\n}\n\nexport function GeneralActionElem(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n const isActive = props.action.name === props.bladeburner.action.name;\n const computedActionTimeCurrent = Math.min(\n props.bladeburner.actionTimeCurrent + props.bladeburner.actionTimeOverflow,\n props.bladeburner.actionTimeToComplete,\n );\n const actionTime = (function (): number {\n switch (props.action.name) {\n case \"Training\":\n case \"Field Analysis\":\n return 30;\n case \"Diplomacy\":\n case \"Hyperbolic Regeneration Chamber\":\n return 60;\n case \"Recruitment\":\n return props.bladeburner.getRecruitmentTime(props.player);\n }\n return -1; // dead code\n })();\n const successChance =\n props.action.name === \"Recruitment\"\n ? Math.max(0, Math.min(props.bladeburner.getRecruitmentSuccessChance(props.player), 1))\n : -1;\n\n function onStart(): void {\n props.bladeburner.action.type = ActionTypes[props.action.name as string];\n props.bladeburner.action.name = props.action.name;\n props.bladeburner.startAction(props.player, props.bladeburner.action);\n setRerender((old) => !old);\n }\n\n return (\n <>\n

    \n {isActive ? (\n <>\n (IN PROGRESS - {formatNumber(computedActionTimeCurrent, 0)} /{\" \"}\n {formatNumber(props.bladeburner.actionTimeToComplete, 0)})\n \n ) : (\n \n )}\n

    \n {isActive ? (\n

    \n {createProgressBarText({\n progress: computedActionTimeCurrent / props.bladeburner.actionTimeToComplete,\n })}\n

    \n ) : (\n <>\n \n Start\n \n \n )}\n
    \n
    \n
    \n      
    \n
    \n
    \n        Time Required: {convertTimeMsToTimeElapsedString(actionTime * 1000)}\n        {successChance !== -1 && (\n          <>\n            
    \n Estimated success chance: {formatNumber(successChance * 100, 1)}%\n \n )}\n
    \n \n );\n}\n","import * as React from \"react\";\nimport { ContractList } from \"./ContractList\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n}\n\nexport function ContractPage(props: IProps): React.ReactElement {\n return (\n <>\n

    \n Complete contracts in order to increase your Bladeburner rank and earn money. Failing a contract will cause you\n to lose HP, which can lead to hospitalization.\n
    \n
    \n You can unlock higher-level contracts by successfully completing them. Higher-level contracts are more\n difficult, but grant more rank, experience, and money.\n

    \n \n \n );\n}\n","import React from \"react\";\nimport { ContractElem } from \"./ContractElem\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n}\n\nexport function ContractList(props: IProps): React.ReactElement {\n const names = Object.keys(props.bladeburner.contracts);\n const contracts = props.bladeburner.contracts;\n return (\n <>\n {names.map((name: string) => (\n
  • \n \n
  • \n ))}\n \n );\n}\n","import React, { useState } from \"react\";\nimport { ActionTypes } from \"../data/ActionTypes\";\nimport { createProgressBarText } from \"../../../utils/helpers/createProgressBarText\";\nimport { formatNumber, convertTimeMsToTimeElapsedString } from \"../../../utils/StringHelperFunctions\";\nimport { stealthIcon, killIcon } from \"../data/Icons\";\nimport { BladeburnerConstants } from \"../data/Constants\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { SuccessChance } from \"./SuccessChance\";\nimport { CopyableText } from \"../../ui/React/CopyableText\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n action: any;\n}\n\nexport function ContractElem(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n const isActive =\n props.bladeburner.action.type === ActionTypes[\"Contract\"] && props.action.name === props.bladeburner.action.name;\n const estimatedSuccessChance = props.action.getEstSuccessChance(props.bladeburner);\n const computedActionTimeCurrent = Math.min(\n props.bladeburner.actionTimeCurrent + props.bladeburner.actionTimeOverflow,\n props.bladeburner.actionTimeToComplete,\n );\n const maxLevel = props.action.level >= props.action.maxLevel;\n const actionTime = props.action.getActionTime(props.bladeburner);\n const autolevelCheckboxId = `bladeburner-${props.action.name}-autolevel-checkbox`;\n\n function onStart(): void {\n props.bladeburner.action.type = ActionTypes.Contract;\n props.bladeburner.action.name = props.action.name;\n props.bladeburner.startAction(props.player, props.bladeburner.action);\n setRerender((old) => !old);\n }\n\n function increaseLevel(): void {\n ++props.action.level;\n if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);\n setRerender((old) => !old);\n }\n\n function decreaseLevel(): void {\n --props.action.level;\n if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);\n setRerender((old) => !old);\n }\n\n function onAutolevel(event: React.ChangeEvent): void {\n props.action.autoLevel = event.target.checked;\n setRerender((old) => !old);\n }\n\n return (\n <>\n

    \n {isActive ? (\n <>\n (IN PROGRESS - {formatNumber(computedActionTimeCurrent, 0)} /{\" \"}\n {formatNumber(props.bladeburner.actionTimeToComplete, 0)})\n \n ) : (\n \n )}\n

    \n {isActive ? (\n

    \n {createProgressBarText({\n progress: computedActionTimeCurrent / props.bladeburner.actionTimeToComplete,\n })}\n

    \n ) : (\n <>\n \n Start\n \n \n )}\n
    \n
    \n
    \n        \n          {props.action.getSuccessesNeededForNextLevel(BladeburnerConstants.ContractSuccessesPerLevel)} successes needed\n          for next level\n        \n        Level: {props.action.level} / {props.action.maxLevel}\n      
    \n \n {isActive && WARNING: changing the level will restart the Operation}↑\n \n \n {isActive && WARNING: changing the level will restart the Operation}↓\n \n
    \n
    \n
    \n        \n        
    \n
    \n Estimated success chance: {\" \"}\n {props.action.isStealth ? stealthIcon : <>}\n {props.action.isKill ? killIcon : <>}\n
    \n Time Required: {convertTimeMsToTimeElapsedString(actionTime * 1000)}\n
    \n Contracts remaining: {Math.floor(props.action.count)}\n
    \n Successes: {props.action.successes}\n
    \n Failures: {props.action.failures}\n
    \n
    \n \n \n \n );\n}\n","import * as React from \"react\";\nimport { OperationList } from \"./OperationList\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n}\n\nexport function OperationPage(props: IProps): React.ReactElement {\n return (\n <>\n

    \n Carry out operations for the Bladeburner division. Failing an operation will reduce your Bladeburner rank. It\n will also cause you to lose HP, which can lead to hospitalization. In general, operations are harder and more\n punishing than contracts, but are also more rewarding.\n
    \n
    \n Operations can affect the chaos level and Synthoid population of your current city. The exact effects vary\n between different Operations.\n
    \n
    \n For operations, you can use a team. You must first recruit team members. Having a larger team will improves your\n chances of success.\n
    \n
    \n You can unlock higher-level operations by successfully completing them. Higher-level operations are more\n difficult, but grant more rank and experience.\n

    \n \n \n );\n}\n","import React from \"react\";\nimport { OperationElem } from \"./OperationElem\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n}\n\nexport function OperationList(props: IProps): React.ReactElement {\n const names = Object.keys(props.bladeburner.operations);\n const operations = props.bladeburner.operations;\n return (\n <>\n {names.map((name: string) => (\n
  • \n \n
  • \n ))}\n \n );\n}\n","import React, { useState } from \"react\";\nimport { ActionTypes } from \"../data/ActionTypes\";\nimport { createProgressBarText } from \"../../../utils/helpers/createProgressBarText\";\nimport { formatNumber, convertTimeMsToTimeElapsedString } from \"../../../utils/StringHelperFunctions\";\nimport { stealthIcon, killIcon } from \"../data/Icons\";\nimport { BladeburnerConstants } from \"../data/Constants\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { TeamSizePopup } from \"./TeamSizePopup\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { SuccessChance } from \"./SuccessChance\";\nimport { CopyableText } from \"../../ui/React/CopyableText\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n action: any;\n}\n\nexport function OperationElem(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n const isActive =\n props.bladeburner.action.type === ActionTypes[\"Operation\"] && props.action.name === props.bladeburner.action.name;\n const estimatedSuccessChance = props.action.getEstSuccessChance(props.bladeburner);\n const computedActionTimeCurrent = Math.min(\n props.bladeburner.actionTimeCurrent + props.bladeburner.actionTimeOverflow,\n props.bladeburner.actionTimeToComplete,\n );\n const maxLevel = props.action.level >= props.action.maxLevel;\n const actionTime = props.action.getActionTime(props.bladeburner);\n const autolevelCheckboxId = `bladeburner-${props.action.name}-autolevel-checkbox`;\n\n function onStart(): void {\n props.bladeburner.action.type = ActionTypes.Operation;\n props.bladeburner.action.name = props.action.name;\n props.bladeburner.startAction(props.player, props.bladeburner.action);\n setRerender((old) => !old);\n }\n\n function onTeam(): void {\n const popupId = \"bladeburner-operation-set-team-size-popup\";\n createPopup(popupId, TeamSizePopup, {\n bladeburner: props.bladeburner,\n action: props.action,\n popupId: popupId,\n });\n }\n\n function increaseLevel(): void {\n ++props.action.level;\n if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);\n setRerender((old) => !old);\n }\n\n function decreaseLevel(): void {\n --props.action.level;\n if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);\n setRerender((old) => !old);\n }\n\n function onAutolevel(event: React.ChangeEvent): void {\n props.action.autoLevel = event.target.checked;\n setRerender((old) => !old);\n }\n\n return (\n <>\n

    \n {isActive ? (\n <>\n (IN PROGRESS - {formatNumber(computedActionTimeCurrent, 0)} /{\" \"}\n {formatNumber(props.bladeburner.actionTimeToComplete, 0)})\n \n ) : (\n \n )}\n

    \n {isActive ? (\n

    \n {createProgressBarText({\n progress: computedActionTimeCurrent / props.bladeburner.actionTimeToComplete,\n })}\n

    \n ) : (\n <>\n \n Start\n \n \n Set Team Size (Curr Size: {formatNumber(props.action.teamCount, 0)})\n \n \n )}\n
    \n
    \n
    \n        \n          {props.action.getSuccessesNeededForNextLevel(BladeburnerConstants.OperationSuccessesPerLevel)} successes\n          needed for next level\n        \n        Level: {props.action.level} / {props.action.maxLevel}\n      
    \n \n {isActive && WARNING: changing the level will restart the Operation}↑\n \n \n {isActive && WARNING: changing the level will restart the Operation}↓\n \n
    \n
    \n
    \n        \n        
    \n
    \n Estimated success chance: {\" \"}\n {props.action.isStealth ? stealthIcon : <>}\n {props.action.isKill ? killIcon : <>}\n
    \n Time Required: {convertTimeMsToTimeElapsedString(actionTime * 1000)}\n
    \n Operations remaining: {Math.floor(props.action.count)}\n
    \n Successes: {props.action.successes}\n
    \n Failures: {props.action.failures}\n
    \n
    \n \n \n \n );\n}\n","import * as React from \"react\";\nimport { BlackOpList } from \"./BlackOpList\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n}\n\nexport function BlackOpPage(props: IProps): React.ReactElement {\n return (\n <>\n

    \n Black Operations (Black Ops) are special, one-time covert operations. Each Black Op must be unlocked\n successively by completing the one before it.\n
    \n
    \n Your ultimate goal to climb through the ranks of Bladeburners is to complete all of the Black Ops.\n
    \n
    \n Like normal operations, you may use a team for Black Ops. Failing a black op will incur heavy HP and rank\n losses.\n

    \n \n \n );\n}\n","import React from \"react\";\nimport { BlackOperations } from \"../BlackOperations\";\nimport { BlackOperation } from \"../BlackOperation\";\nimport { BlackOpElem } from \"./BlackOpElem\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n}\n\nexport function BlackOpList(props: IProps): React.ReactElement {\n let blackops: BlackOperation[] = [];\n for (const blackopName in BlackOperations) {\n if (BlackOperations.hasOwnProperty(blackopName)) {\n blackops.push(BlackOperations[blackopName]);\n }\n }\n blackops.sort(function (a, b) {\n return a.reqdRank - b.reqdRank;\n });\n\n blackops = blackops.filter(\n (blackop: BlackOperation, i: number) => !(\n props.bladeburner.blackops[blackops[i].name] == null &&\n i !== 0 &&\n props.bladeburner.blackops[blackops[i - 1].name] == null\n ),\n );\n\n blackops = blackops.reverse();\n\n return (\n <>\n {blackops.map((blackop: BlackOperation) => (\n
  • \n \n
  • \n ))}\n \n );\n}\n","import React, { useState } from \"react\";\nimport { formatNumber, convertTimeMsToTimeElapsedString } from \"../../../utils/StringHelperFunctions\";\nimport { ActionTypes } from \"../data/ActionTypes\";\nimport { createProgressBarText } from \"../../../utils/helpers/createProgressBarText\";\nimport { stealthIcon, killIcon } from \"../data/Icons\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { TeamSizePopup } from \"./TeamSizePopup\";\nimport { IBladeburner } from \"../IBladeburner\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { SuccessChance } from \"./SuccessChance\";\nimport { CopyableText } from \"../../ui/React/CopyableText\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n player: IPlayer;\n action: any;\n}\n\nexport function BlackOpElem(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n const isCompleted = props.bladeburner.blackops[props.action.name] != null;\n if (isCompleted) {\n return

    {props.action.name} (COMPLETED)

    ;\n }\n\n const isActive =\n props.bladeburner.action.type === ActionTypes[\"BlackOperation\"] &&\n props.action.name === props.bladeburner.action.name;\n const estimatedSuccessChance = props.action.getEstSuccessChance(props.bladeburner);\n const actionTime = props.action.getActionTime(props.bladeburner);\n const hasReqdRank = props.bladeburner.rank >= props.action.reqdRank;\n const computedActionTimeCurrent = Math.min(\n props.bladeburner.actionTimeCurrent + props.bladeburner.actionTimeOverflow,\n props.bladeburner.actionTimeToComplete,\n );\n\n function onStart(): void {\n props.bladeburner.action.type = ActionTypes.BlackOperation;\n props.bladeburner.action.name = props.action.name;\n props.bladeburner.startAction(props.player, props.bladeburner.action);\n setRerender((old) => !old);\n }\n\n function onTeam(): void {\n const popupId = \"bladeburner-operation-set-team-size-popup\";\n createPopup(popupId, TeamSizePopup, {\n bladeburner: props.bladeburner,\n action: props.action,\n popupId: popupId,\n });\n }\n\n return (\n <>\n

    \n {isActive ? (\n <>\n (IN PROGRESS - {formatNumber(computedActionTimeCurrent, 0)} /{\" \"}\n {formatNumber(props.bladeburner.actionTimeToComplete, 0)})\n \n ) : (\n \n )}\n

    \n {isActive ? (\n

    \n {createProgressBarText({\n progress: computedActionTimeCurrent / props.bladeburner.actionTimeToComplete,\n })}\n

    \n ) : (\n <>\n \n Start\n \n \n Set Team Size (Curr Size: {formatNumber(props.action.teamCount, 0)})\n \n \n )}\n
    \n
    \n

    \n
    \n
    \n

    \n Required Rank: {formatNumber(props.action.reqdRank, 0)}\n

    \n
    \n
    \n        Estimated Success Chance: {\" \"}\n        {props.action.isStealth ? stealthIcon : <>}\n        {props.action.isKill ? killIcon : <>}\n        
    \n Time Required: {convertTimeMsToTimeElapsedString(actionTime * 1000)}\n
    \n \n );\n}\n","import React, { useState } from \"react\";\nimport { SkillList } from \"./SkillList\";\nimport { BladeburnerConstants } from \"../data/Constants\";\nimport { formatNumber } from \"../../../utils/StringHelperFunctions\";\nimport { IBladeburner } from \"../IBladeburner\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n}\n\nexport function SkillPage(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n const mults = props.bladeburner.skillMultipliers;\n\n function valid(mult: any): boolean {\n return mult && mult !== 1;\n }\n\n return (\n <>\n

    \n Skill Points: {formatNumber(props.bladeburner.skillPoints, 0)}\n

    \n

    \n You will gain one skill point every {BladeburnerConstants.RanksPerSkillPoint} ranks.\n
    \n
    \n Note that when upgrading a skill, the benefit for that skill is additive. However, the effects of different\n skills with each other is multiplicative.\n
    \n

    \n
    \n {valid(mults[\"successChanceAll\"]) &&

    Total Success Chance: x{formatNumber(mults[\"successChanceAll\"], 3)}

    }\n {valid(mults[\"successChanceStealth\"]) && (\n

    Stealth Success Chance: x{formatNumber(mults[\"successChanceStealth\"], 3)}

    \n )}\n {valid(mults[\"successChanceKill\"]) && (\n

    Retirement Success Chance: x{formatNumber(mults[\"successChanceKill\"], 3)}

    \n )}\n {valid(mults[\"successChanceContract\"]) && (\n

    Contract Success Chance: x{formatNumber(mults[\"successChanceContract\"], 3)}

    \n )}\n {valid(mults[\"successChanceOperation\"]) && (\n

    Operation Success Chance: x{formatNumber(mults[\"successChanceOperation\"], 3)}

    \n )}\n {valid(mults[\"successChanceEstimate\"]) && (\n

    Synthoid Data Estimate: x{formatNumber(mults[\"successChanceEstimate\"], 3)}

    \n )}\n {valid(mults[\"actionTime\"]) &&

    Action Time: x{formatNumber(mults[\"actionTime\"], 3)}

    }\n {valid(mults[\"effHack\"]) &&

    Hacking Skill: x{formatNumber(mults[\"effHack\"], 3)}

    }\n {valid(mults[\"effStr\"]) &&

    Strength: x{formatNumber(mults[\"effStr\"], 3)}

    }\n {valid(mults[\"effDef\"]) &&

    Defense: x{formatNumber(mults[\"effDef\"], 3)}

    }\n {valid(mults[\"effDex\"]) &&

    Dexterity: x{formatNumber(mults[\"effDex\"], 3)}

    }\n {valid(mults[\"effAgi\"]) &&

    Agility: x{formatNumber(mults[\"effAgi\"], 3)}

    }\n {valid(mults[\"effCha\"]) &&

    Charisma: x{formatNumber(mults[\"effCha\"], 3)}

    }\n {valid(mults[\"effInt\"]) &&

    Intelligence: x{formatNumber(mults[\"effInt\"], 3)}

    }\n {valid(mults[\"stamina\"]) &&

    Stamina: x{formatNumber(mults[\"stamina\"], 3)}

    }\n {valid(mults[\"money\"]) &&

    Contract Money: x{formatNumber(mults[\"money\"], 3)}

    }\n {valid(mults[\"expGain\"]) &&

    Exp Gain: x{formatNumber(mults[\"expGain\"], 3)}

    }\n
    \n setRerender((old) => !old)} />\n \n );\n}\n\n/*\n\n\n\n\nvar multKeys = Object.keys(this.skillMultipliers);\nfor (var i = 0; i < multKeys.length; ++i) {\n var mult = this.skillMultipliers[multKeys[i]];\n if (mult && mult !== 1) {\n mult = formatNumber(mult, 3);\n switch(multKeys[i]) {\n \n }\n }\n}\n*/\n","import * as React from \"react\";\nimport { SkillElem } from \"./SkillElem\";\nimport { Skills } from \"../Skills\";\nimport { IBladeburner } from \"../IBladeburner\";\n\ninterface IProps {\n bladeburner: IBladeburner;\n onUpgrade: () => void;\n}\n\nexport function SkillList(props: IProps): React.ReactElement {\n return (\n <>\n {Object.keys(Skills).map((skill: string) => (\n
  • \n \n
  • \n ))}\n \n );\n}\n","import React from \"react\";\nimport { CopyableText } from \"../../ui/React/CopyableText\";\nimport { formatNumber } from \"../../../utils/StringHelperFunctions\";\nimport { IBladeburner } from \"../IBladeburner\";\n\ninterface IProps {\n skill: any;\n bladeburner: IBladeburner;\n onUpgrade: () => void;\n}\n\nexport function SkillElem(props: IProps): React.ReactElement {\n const skillName = props.skill.name;\n let currentLevel = 0;\n if (props.bladeburner.skills[skillName] && !isNaN(props.bladeburner.skills[skillName])) {\n currentLevel = props.bladeburner.skills[skillName];\n }\n const pointCost = props.skill.calculateCost(currentLevel);\n\n const canLevel = props.bladeburner.skillPoints >= pointCost;\n const maxLvl = props.skill.maxLvl ? currentLevel >= props.skill.maxLvl : false;\n\n function onClick(): void {\n if (props.bladeburner.skillPoints < pointCost) return;\n props.bladeburner.skillPoints -= pointCost;\n props.bladeburner.upgradeSkill(props.skill);\n props.onUpgrade();\n }\n\n return (\n <>\n

    \n \n

    \n \n Level\n \n
    \n
    \n

    Level: {currentLevel}

    \n {maxLvl ? (\n

    MAX LEVEL

    \n ) : (\n

    Skill Points required: {formatNumber(pointCost, 0)}

    \n )}\n

    \n \n );\n}\n","/**\n * React Component for all the gang stuff.\n */\nimport React, { useState, useEffect } from \"react\";\nimport { ManagementSubpage } from \"./ManagementSubpage\";\nimport { TerritorySubpage } from \"./TerritorySubpage\";\nimport { use } from \"../../ui/Context\";\nimport { Factions } from \"../../Faction/Factions\";\nimport { Gang } from \"../Gang\";\n\ninterface IProps {\n gang: Gang;\n}\n\nexport function GangRoot(props: IProps): React.ReactElement {\n const player = use.Player();\n const router = use.Router();\n const [management, setManagement] = useState(true);\n const setRerender = useState(false)[1];\n\n useEffect(() => {\n const id = setInterval(() => setRerender((old) => !old), 1000);\n return () => clearInterval(id);\n }, []);\n\n function back(): void {\n router.toFaction(Factions[props.gang.facName]);\n }\n\n return (\n

    \n \n Back\n \n setManagement(true)}\n >\n Gang Management\n \n setManagement(false)}\n >\n Gang Territory\n \n {management ? : }\n
    \n );\n}\n","/**\n * React Component for the subpage that manages gang members, the main page.\n */\nimport React from \"react\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { GangStats } from \"./GangStats\";\nimport { Gang } from \"../Gang\";\nimport { GangMemberList } from \"./GangMemberList\";\n\ninterface IProps {\n gang: Gang;\n player: IPlayer;\n}\n\nexport function ManagementSubpage(props: IProps): React.ReactElement {\n return (\n
    \n

    \n This page is used to manage your gang members and get an overview of your gang's stats.\n
    \n
    \n If a gang member is not earning much money or respect, the task that you have assigned to that member might be\n too difficult. Consider training that member's stats or choosing an easier task. The tasks closer to the top of\n the dropdown list are generally easier. Alternatively, the gang member's low production might be due to the fact\n that your wanted level is too high. Consider assigning a few members to the '\n {props.gang.isHackingGang ? \"Ethical Hacking\" : \"Vigilante Justice\"}' task to lower your wanted level.\n
    \n
    \n Installing Augmentations does NOT reset your progress with your Gang. Furthermore, after installing\n Augmentations, you will automatically be a member of whatever Faction you created your gang with.\n
    \n
    \n You can also manage your gang programmatically through Netscript using the Gang API\n

    \n
    \n \n
    \n \n
    \n );\n}\n","/**\n * React Component for the stats related to the gang, like total respect and\n * money per second.\n */\nimport React from \"react\";\nimport { Factions } from \"../../Faction/Factions\";\nimport { Gang } from \"../Gang\";\n\nimport { formatNumber } from \"../../../utils/StringHelperFunctions\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { MoneyRate } from \"../../ui/React/MoneyRate\";\nimport { Reputation } from \"../../ui/React/Reputation\";\nimport { AllGangs } from \"../AllGangs\";\nimport { BonusTime } from \"./BonusTime\";\n\ninterface IProps {\n gang: Gang;\n}\n\nexport function GangStats(props: IProps): React.ReactElement {\n const territoryMult = AllGangs[props.gang.facName].territory * 100;\n let territoryStr;\n if (territoryMult <= 0) {\n territoryStr = formatNumber(0, 2);\n } else if (territoryMult >= 100) {\n territoryStr = formatNumber(100, 2);\n } else {\n territoryStr = formatNumber(territoryMult, 2);\n }\n\n return (\n <>\n

    \n Respect: {numeralWrapper.formatRespect(props.gang.respect)} (\n {numeralWrapper.formatRespect(5 * props.gang.respectGainRate)} / sec)\n \n Represents the amount of respect your gang has from other gangs and criminal organizations. Your respect\n affects the amount of money your gang members will earn, and also determines how much reputation you are\n earning with your gang's corresponding Faction.\n \n

    \n
    \n

    \n Wanted Level: {numeralWrapper.formatWanted(props.gang.wanted)} (\n {numeralWrapper.formatWanted(5 * props.gang.wantedGainRate)} / sec)\n \n Represents how much the gang is wanted by law enforcement. The higher your gang's wanted level, the harder it\n will be for your gang members to make money and earn respect. Note that the minimum wanted level is 1.\n \n

    \n
    \n

    \n Wanted Level Penalty: -{formatNumber((1 - props.gang.getWantedPenalty()) * 100, 2)}%\n Penalty for respect and money gain rates due to Wanted Level\n

    \n
    \n
    \n

    \n Money gain rate: \n

    \n
    \n
    \n

    \n Territory: {territoryStr}%\n The percentage of total territory your Gang controls\n

    \n
    \n

    \n Faction reputation: {Reputation(Factions[props.gang.facName].playerReputation)}\n

    \n
    \n \n \n );\n}\n","/**\n * React Component for displaying the bonus time remaining.\n */\nimport * as React from \"react\";\nimport { Gang } from \"../Gang\";\nimport { CONSTANTS } from \"../../Constants\";\nimport { convertTimeMsToTimeElapsedString } from \"../../../utils/StringHelperFunctions\";\n\ninterface IProps {\n gang: Gang;\n}\n\nexport function BonusTime(props: IProps): React.ReactElement {\n const CyclerPerSecond = 1000 / CONSTANTS._idleSpeed;\n if ((props.gang.storedCycles / CyclerPerSecond) * 1000 <= 5000) return <>;\n const bonusMillis = (props.gang.storedCycles / CyclerPerSecond) * 1000;\n return (\n <>\n

    \n Bonus time: {convertTimeMsToTimeElapsedString(bonusMillis)}\n \n You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by the\n browser). Bonus time makes the Gang mechanic progress faster, up to 5x the normal speed.\n \n

    \n
    \n \n );\n}\n","/**\n * React Component for the list of gang members on the management subpage.\n */\nimport React, { useState } from \"react\";\nimport { GangMemberUpgradePopup } from \"./GangMemberUpgradePopup\";\nimport { GangMemberAccordion } from \"./GangMemberAccordion\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { Gang } from \"../Gang\";\nimport { GangMember } from \"../GangMember\";\nimport { RecruitButton } from \"./RecruitButton\";\n\ninterface IProps {\n gang: Gang;\n player: IPlayer;\n}\n\nexport function GangMemberList(props: IProps): React.ReactElement {\n const [filter, setFilter] = useState(\"\");\n const setRerender = useState(false)[1];\n\n function openUpgradePopup(): void {\n const popupId = `gang-upgrade-popup`;\n createPopup(popupId, GangMemberUpgradePopup, {\n gang: props.gang,\n player: props.player,\n popupId: popupId,\n });\n }\n\n function onFilterChange(event: React.ChangeEvent): void {\n setFilter(event.target.value);\n }\n\n const members = props.gang.members.filter(\n (member: GangMember) => member.name.indexOf(filter) > -1 || member.task.indexOf(filter) > -1,\n );\n\n return (\n <>\n setRerender((old) => !old)} gang={props.gang} />\n
    \n \n \n Manage Equipment\n \n
      \n {members.map((member: GangMember) => (\n
    • \n \n
    • \n ))}\n
    \n \n );\n}\n","/**\n * React Component for the popup that manages gang members upgrades\n */\nimport React, { useState, useEffect } from \"react\";\nimport { formatNumber } from \"../../../utils/StringHelperFunctions\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { GangMemberUpgrades } from \"../GangMemberUpgrades\";\nimport { GangMemberUpgrade } from \"../GangMemberUpgrade\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { Money } from \"../../ui/React/Money\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { GangMember } from \"../GangMember\";\nimport { Gang } from \"../Gang\";\nimport { UpgradeType } from \"../data/upgrades\";\n\ninterface INextRevealProps {\n gang: Gang;\n upgrades: string[];\n type: UpgradeType;\n player: IPlayer;\n}\n\nfunction NextReveal(props: INextRevealProps): React.ReactElement {\n const upgrades = Object.keys(GangMemberUpgrades)\n .filter((upgName: string) => {\n const upg = GangMemberUpgrades[upgName];\n if (props.player.money.gt(props.gang.getUpgradeCost(upg))) return false;\n if (upg.type !== props.type) return false;\n if (props.upgrades.includes(upgName)) return false;\n return true;\n })\n .map((upgName: string) => GangMemberUpgrades[upgName]);\n\n if (upgrades.length === 0) return <>;\n return (\n

    \n Next at \n

    \n );\n}\n\ninterface IPanelProps {\n member: GangMember;\n gang: Gang;\n player: IPlayer;\n}\n\nfunction GangMemberUpgradePanel(props: IPanelProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function filterUpgrades(list: string[], type: UpgradeType): GangMemberUpgrade[] {\n return Object.keys(GangMemberUpgrades)\n .filter((upgName: string) => {\n const upg = GangMemberUpgrades[upgName];\n if (props.player.money.lt(props.gang.getUpgradeCost(upg))) return false;\n if (upg.type !== type) return false;\n if (list.includes(upgName)) return false;\n return true;\n })\n .map((upgName: string) => GangMemberUpgrades[upgName]);\n }\n const weaponUpgrades = filterUpgrades(props.member.upgrades, UpgradeType.Weapon);\n const armorUpgrades = filterUpgrades(props.member.upgrades, UpgradeType.Armor);\n const vehicleUpgrades = filterUpgrades(props.member.upgrades, UpgradeType.Vehicle);\n const rootkitUpgrades = filterUpgrades(props.member.upgrades, UpgradeType.Rootkit);\n const augUpgrades = filterUpgrades(props.member.augmentations, UpgradeType.Augmentation);\n\n function purchasedUpgrade(upgName: string): React.ReactElement {\n const upg = GangMemberUpgrades[upgName];\n return (\n
    \n {upg.name}\n \n
    \n );\n }\n\n function upgradeButton(upg: GangMemberUpgrade, left = false): React.ReactElement {\n function onClick(): void {\n props.member.buyUpgrade(upg, props.player, props.gang);\n setRerender((old) => !old);\n }\n return (\n \n {upg.name} - \n \n \n );\n }\n\n const asc = {\n hack: props.member.calculateAscensionMult(props.member.hack_asc_points),\n str: props.member.calculateAscensionMult(props.member.str_asc_points),\n def: props.member.calculateAscensionMult(props.member.def_asc_points),\n dex: props.member.calculateAscensionMult(props.member.dex_asc_points),\n agi: props.member.calculateAscensionMult(props.member.agi_asc_points),\n cha: props.member.calculateAscensionMult(props.member.cha_asc_points),\n };\n return (\n
    \n

    \n {props.member.name}({props.member.task})\n

    \n
    \n        Hack: {props.member.hack} (x\n        {formatNumber(props.member.hack_mult * asc.hack, 2)})
    \n Str: {props.member.str} (x\n {formatNumber(props.member.str_mult * asc.str, 2)})
    \n Def: {props.member.def} (x\n {formatNumber(props.member.def_mult * asc.def, 2)})
    \n Dex: {props.member.dex} (x\n {formatNumber(props.member.dex_mult * asc.dex, 2)})
    \n Agi: {props.member.agi} (x\n {formatNumber(props.member.agi_mult * asc.agi, 2)})
    \n Cha: {props.member.cha} (x\n {formatNumber(props.member.cha_mult * asc.cha, 2)})\n
    \n
    \n Purchased Upgrades: {props.member.upgrades.map((upg: string) => purchasedUpgrade(upg))}\n {props.member.augmentations.map((upg: string) => purchasedUpgrade(upg))}\n
    \n
    \n

    Weapons

    \n {weaponUpgrades.map((upg) => upgradeButton(upg))}\n \n
    \n
    \n

    Armor

    \n {armorUpgrades.map((upg) => upgradeButton(upg))}\n \n
    \n
    \n

    Vehicles

    \n {vehicleUpgrades.map((upg) => upgradeButton(upg))}\n \n
    \n
    \n

    Rootkits

    \n {rootkitUpgrades.map((upg) => upgradeButton(upg, true))}\n \n
    \n
    \n

    Augmentations

    \n {augUpgrades.map((upg) => upgradeButton(upg, true))}\n \n
    \n
    \n );\n}\n\ninterface IProps {\n gang: Gang;\n player: IPlayer;\n popupId: string;\n}\n\nexport function GangMemberUpgradePopup(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n const [filter, setFilter] = useState(\"\");\n\n function closePopup(this: Window, ev: KeyboardEvent): void {\n if (ev.keyCode !== 27) return;\n removePopup(props.popupId);\n }\n\n useEffect(() => {\n window.addEventListener<\"keydown\">(\"keydown\", closePopup);\n const id = setInterval(() => setRerender((old) => !old), 1000);\n return () => {\n clearInterval(id);\n window.removeEventListener<\"keydown\">(\"keydown\", closePopup);\n };\n }, []);\n\n return (\n <>\n setFilter(event.target.value)}\n />\n

    \n Discount: -{numeralWrapper.formatPercentage(1 - 1 / props.gang.getDiscount())}\n \n You get a discount on equipment and upgrades based on your gang's respect and power. More respect and power\n leads to more discounts.\n \n

    \n {props.gang.members.map((member: GangMember) => (\n \n ))}\n \n );\n}\n","import { IMults, UpgradeType } from \"./data/upgrades\";\nimport { numeralWrapper } from \"../ui/numeralFormat\";\n\nexport class GangMemberUpgrade {\n name: string;\n cost: number;\n type: UpgradeType;\n desc: string;\n mults: IMults;\n\n constructor(name = \"\", cost = 0, type: UpgradeType = UpgradeType.Weapon, mults: IMults = {}) {\n this.name = name;\n this.cost = cost;\n this.type = type;\n this.mults = mults;\n\n this.desc = this.createDescription();\n }\n\n createDescription(): string {\n const lines = [\"Effects:\"];\n if (this.mults.str != null) {\n lines.push(`+${numeralWrapper.formatPercentage(this.mults.str - 1, 0)} strength skill`);\n lines.push(`+${numeralWrapper.formatPercentage((this.mults.str - 1) / 4, 2)} strength exp`);\n }\n if (this.mults.def != null) {\n lines.push(`+${numeralWrapper.formatPercentage(this.mults.def - 1, 0)} defense skill`);\n lines.push(`+${numeralWrapper.formatPercentage((this.mults.def - 1) / 4, 2)} defense exp`);\n }\n if (this.mults.dex != null) {\n lines.push(`+${numeralWrapper.formatPercentage(this.mults.dex - 1, 0)} dexterity skill`);\n lines.push(`+${numeralWrapper.formatPercentage((this.mults.dex - 1) / 4, 2)} dexterity exp`);\n }\n if (this.mults.agi != null) {\n lines.push(`+${numeralWrapper.formatPercentage(this.mults.agi - 1, 0)} agility skill`);\n lines.push(`+${numeralWrapper.formatPercentage((this.mults.agi - 1) / 4, 2)} agility exp`);\n }\n if (this.mults.cha != null) {\n lines.push(`+${numeralWrapper.formatPercentage(this.mults.cha - 1, 0)} charisma skill`);\n lines.push(`+${numeralWrapper.formatPercentage((this.mults.cha - 1) / 4, 2)} charisma exp`);\n }\n if (this.mults.hack != null) {\n lines.push(`+${numeralWrapper.formatPercentage(this.mults.hack - 1, 0)} hacking skill`);\n lines.push(`+${numeralWrapper.formatPercentage((this.mults.hack - 1) / 4, 2)} hacking exp`);\n }\n return lines.join(\"
    \");\n }\n\n // User friendly version of type.\n getType(): string {\n switch (this.type) {\n case UpgradeType.Weapon:\n return \"Weapon\";\n case UpgradeType.Armor:\n return \"Armor\";\n case UpgradeType.Vehicle:\n return \"Vehicle\";\n case UpgradeType.Rootkit:\n return \"Rootkit\";\n case UpgradeType.Augmentation:\n return \"Augmentation\";\n default:\n return \"\";\n }\n }\n}\n","/**\n * React Component for a gang member on the management subpage.\n */\nimport React from \"react\";\nimport { Gang } from \"../Gang\";\nimport { GangMember } from \"../GangMember\";\nimport { BBAccordion } from \"../../ui/React/BBAccordion\";\nimport { GangMemberAccordionContent } from \"./GangMemberAccordionContent\";\n\ninterface IProps {\n gang: Gang;\n member: GangMember;\n}\n\nexport function GangMemberAccordion(props: IProps): React.ReactElement {\n return (\n {props.member.name}}\n panelContent={}\n />\n );\n}\n","/**\n * React Component for the content of the accordion of gang members on the\n * management subpage.\n */\nimport React, { useState } from \"react\";\nimport { GangMemberStats } from \"./GangMemberStats\";\nimport { TaskSelector } from \"./TaskSelector\";\nimport { TaskDescription } from \"./TaskDescription\";\nimport { Gang } from \"../Gang\";\nimport { GangMember } from \"../GangMember\";\n\ninterface IProps {\n gang: Gang;\n member: GangMember;\n}\n\nexport function GangMemberAccordionContent(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n return (\n <>\n
    \n setRerender((old) => !old)} gang={props.gang} member={props.member} />\n
    \n
    \n setRerender((old) => !old)} gang={props.gang} member={props.member} />\n
    \n
    \n \n
    \n \n );\n}\n","/**\n * React Component for the first part of a gang member details.\n * Contains skills and exp.\n */\nimport React from \"react\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { formatNumber } from \"../../../utils/StringHelperFunctions\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { Gang } from \"../Gang\";\nimport { GangMember } from \"../GangMember\";\nimport { AscensionPopup } from \"./AscensionPopup\";\n\ninterface IProps {\n member: GangMember;\n gang: Gang;\n onAscend: () => void;\n}\n\nexport function GangMemberStats(props: IProps): React.ReactElement {\n function ascend(): void {\n const popupId = `gang-management-ascend-member ${props.member.name}`;\n createPopup(popupId, AscensionPopup, {\n member: props.member,\n gang: props.gang,\n popupId: popupId,\n onAscend: props.onAscend,\n });\n }\n\n function openAscensionHelp(): void {\n dialogBoxCreate(\n <>\n Ascending a Gang Member resets the member's progress and stats in exchange for a permanent boost to their stat\n multipliers.\n
    \n
    \n The additional stat multiplier that the Gang Member gains upon ascension is based on the amount of exp they\n have.\n
    \n
    \n Upon ascension, the member will lose all of its non-Augmentation Equipment and your gang will lose respect equal\n to the total respect earned by the member.\n ,\n );\n }\n\n const asc = {\n hack: props.member.calculateAscensionMult(props.member.hack_asc_points),\n str: props.member.calculateAscensionMult(props.member.str_asc_points),\n def: props.member.calculateAscensionMult(props.member.def_asc_points),\n dex: props.member.calculateAscensionMult(props.member.dex_asc_points),\n agi: props.member.calculateAscensionMult(props.member.agi_asc_points),\n cha: props.member.calculateAscensionMult(props.member.cha_asc_points),\n };\n\n return (\n <>\n \n Hk: x{numeralWrapper.formatMultiplier(props.member.hack_mult * asc.hack)}(x\n {numeralWrapper.formatMultiplier(props.member.hack_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.hack)} Asc)\n
    \n St: x{numeralWrapper.formatMultiplier(props.member.str_mult * asc.str)}\n (x{numeralWrapper.formatMultiplier(props.member.str_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.str)} Asc)\n
    \n Df: x{numeralWrapper.formatMultiplier(props.member.def_mult * asc.def)}\n (x{numeralWrapper.formatMultiplier(props.member.def_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.def)} Asc)\n
    \n Dx: x{numeralWrapper.formatMultiplier(props.member.dex_mult * asc.dex)}\n (x{numeralWrapper.formatMultiplier(props.member.dex_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.dex)} Asc)\n
    \n Ag: x{numeralWrapper.formatMultiplier(props.member.agi_mult * asc.agi)}\n (x{numeralWrapper.formatMultiplier(props.member.agi_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.agi)} Asc)\n
    \n Ch: x{numeralWrapper.formatMultiplier(props.member.cha_mult * asc.cha)}\n (x{numeralWrapper.formatMultiplier(props.member.cha_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.cha)} Asc)\n
    \n
    \n        Hacking: {formatNumber(props.member.hack, 0)} ({numeralWrapper.formatExp(props.member.hack_exp)} exp)\n        
    \n Strength: {formatNumber(props.member.str, 0)} ({numeralWrapper.formatExp(props.member.str_exp)} exp)\n
    \n Defense: {formatNumber(props.member.def, 0)} ({numeralWrapper.formatExp(props.member.def_exp)} exp)\n
    \n Dexterity: {formatNumber(props.member.dex, 0)} ({numeralWrapper.formatExp(props.member.dex_exp)} exp)\n
    \n Agility: {formatNumber(props.member.agi, 0)} ({numeralWrapper.formatExp(props.member.agi_exp)} exp)\n
    \n Charisma: {formatNumber(props.member.cha, 0)} ({numeralWrapper.formatExp(props.member.cha_exp)} exp)\n
    \n
    \n
    \n {props.member.canAscend() && (\n <>\n \n
    \n ?\n
    \n \n )}\n \n );\n}\n","/**\n * React Component for the content of the popup before the player confirms the\n * ascension of a gang member.\n */\nimport React, { useState, useEffect } from \"react\";\nimport { Gang } from \"../Gang\";\nimport { GangMember } from \"../GangMember\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\n\ninterface IProps {\n member: GangMember;\n gang: Gang;\n popupId: string;\n onAscend: () => void;\n}\n\nexport function AscensionPopup(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n\n useEffect(() => {\n const id = setInterval(() => setRerender((old) => !old), 1000);\n return () => clearInterval(id);\n }, []);\n\n function confirm(): void {\n props.onAscend();\n const res = props.gang.ascendMember(props.member);\n dialogBoxCreate(\n

    \n You ascended {props.member.name}!
    \n
    \n Your gang lost {numeralWrapper.formatRespect(res.respect)} respect.\n
    \n
    \n {props.member.name} gained the following stat multipliers for ascending:\n
    \n Hacking: x{numeralWrapper.format(res.hack, \"0.000\")}\n
    \n Strength: x{numeralWrapper.format(res.str, \"0.000\")}\n
    \n Defense: x{numeralWrapper.format(res.def, \"0.000\")}\n
    \n Dexterity: x{numeralWrapper.format(res.dex, \"0.000\")}\n
    \n Agility: x{numeralWrapper.format(res.agi, \"0.000\")}\n
    \n Charisma: x{numeralWrapper.format(res.cha, \"0.000\")}\n
    \n

    ,\n );\n removePopup(props.popupId);\n }\n\n function cancel(): void {\n removePopup(props.popupId);\n }\n\n // const ascendBenefits = props.member.getAscensionResults();\n const preAscend = props.member.getCurrentAscensionMults();\n const postAscend = props.member.getAscensionMultsAfterAscend();\n\n return (\n <>\n
    \n        Are you sure you want to ascend this member? They will lose all of\n        
    \n their non-Augmentation upgrades and their stats will reset back to 1.\n
    \n
    \n Furthermore, your gang will lose {numeralWrapper.formatRespect(props.member.earnedRespect)} respect\n
    \n
    \n In return, they will gain the following permanent boost to stat multipliers:\n
    \n Hacking: x{numeralWrapper.format(preAscend.hack, \"0.000\")} => x{numeralWrapper.format(postAscend.hack, \"0.000\")}\n
    \n Strength: x{numeralWrapper.format(preAscend.str, \"0.000\")} => x{numeralWrapper.format(postAscend.str, \"0.000\")}\n
    \n Defense: x{numeralWrapper.format(preAscend.def, \"0.000\")} => x{numeralWrapper.format(postAscend.def, \"0.000\")}\n
    \n Dexterity: x{numeralWrapper.format(preAscend.dex, \"0.000\")} => x{numeralWrapper.format(postAscend.dex, \"0.000\")}\n
    \n Agility: x{numeralWrapper.format(preAscend.agi, \"0.000\")} => x{numeralWrapper.format(postAscend.agi, \"0.000\")}\n
    \n Charisma: x{numeralWrapper.format(preAscend.cha, \"0.000\")} => x{numeralWrapper.format(postAscend.cha, \"0.000\")}\n
    \n
    \n \n \n \n );\n}\n","/**\n * React Component for the middle part of the gang member accordion. Contains\n * the task selector as well as some stats.\n */\nimport React, { useState } from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { StatsTable } from \"../../ui/React/StatsTable\";\nimport { MoneyRate } from \"../../ui/React/MoneyRate\";\nimport { Gang } from \"../Gang\";\nimport { GangMember } from \"../GangMember\";\n\ninterface IProps {\n member: GangMember;\n gang: Gang;\n onTaskChange: () => void;\n}\n\nexport function TaskSelector(props: IProps): React.ReactElement {\n const [currentTask, setCurrentTask] = useState(props.member.task);\n\n function onChange(event: React.ChangeEvent): void {\n const task = event.target.value;\n props.member.assignToTask(task);\n setCurrentTask(task);\n props.onTaskChange();\n }\n\n const tasks = props.gang.getAllTaskNames();\n\n const data = [\n [`Money:`, ],\n [`Respect:`, `${numeralWrapper.formatRespect(5 * props.member.calculateRespectGain(props.gang))} / sec`],\n [`Wanted Level:`, `${numeralWrapper.formatWanted(5 * props.member.calculateWantedLevelGain(props.gang))} / sec`],\n [`Total Respect:`, `${numeralWrapper.formatRespect(props.member.earnedRespect)}`],\n ];\n\n return (\n <>\n \n
    \n \n
    \n \n );\n}\n","/**\n * React Component for left side of the gang member accordion, contains the\n * description of the task that member is currently doing.\n */\nimport React from \"react\";\nimport { GangMemberTasks } from \"../GangMemberTasks\";\nimport { GangMember } from \"../GangMember\";\n\ninterface IProps {\n member: GangMember;\n}\n\nexport function TaskDescription(props: IProps): React.ReactElement {\n const task = GangMemberTasks[props.member.task];\n const desc = task ? task.desc : GangMemberTasks[\"Unassigned\"].desc;\n\n return

    ;\n}\n","import { ITaskParams } from \"../ITaskParams\";\n/* tslint:disable:max-line-length */\n\n/**\n * Defines the parameters that can be used to initialize and describe a GangMemberTask\n * (defined in Gang.js)\n */\nexport interface IGangMemberTaskMetadata {\n /**\n * Description of the task\n */\n desc: string;\n\n /**\n * Whether or not this task is meant for Combat-type gangs\n */\n isCombat: boolean;\n\n /**\n * Whether or not this task is for Hacking-type gangs\n */\n isHacking: boolean;\n\n /**\n * Name of the task\n */\n name: string;\n\n /**\n * An object containing weighting parameters for the task. These parameters are used for\n * various calculations (respect gain, wanted gain, etc.)\n */\n params: ITaskParams;\n}\n\n/**\n * Array of metadata for all Gang Member tasks. Used to construct the global GangMemberTask\n * objects in Gang.js\n */\nexport const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [\n {\n desc: \"This gang member is currently idle\",\n isCombat: true,\n isHacking: true,\n name: \"Unassigned\",\n params: { hackWeight: 100 }, // This is just to get by the weight check in the GangMemberTask constructor\n },\n {\n desc: \"Assign this gang member to create and distribute ransomware

    Earns money - Slightly increases respect - Slightly increases wanted level\",\n isCombat: false,\n isHacking: true,\n name: \"Ransomware\",\n params: {\n baseRespect: 0.00005,\n baseWanted: 0.0001,\n baseMoney: 1,\n hackWeight: 100,\n difficulty: 1,\n },\n },\n {\n desc: \"Assign this gang member to attempt phishing scams and attacks

    Earns money - Slightly increases respect - Slightly increases wanted level\",\n isCombat: false,\n isHacking: true,\n name: \"Phishing\",\n params: {\n baseRespect: 0.00008,\n baseWanted: 0.003,\n baseMoney: 2.5,\n hackWeight: 85,\n chaWeight: 15,\n difficulty: 3.5,\n },\n },\n {\n desc: \"Assign this gang member to attempt identity theft

    Earns money - Increases respect - Increases wanted level\",\n isCombat: false,\n isHacking: true,\n name: \"Identity Theft\",\n params: {\n baseRespect: 0.0001,\n baseWanted: 0.075,\n baseMoney: 6,\n hackWeight: 80,\n chaWeight: 20,\n difficulty: 5,\n },\n },\n {\n desc: \"Assign this gang member to carry out DDoS attacks

    Increases respect - Increases wanted level\",\n isCombat: false,\n isHacking: true,\n name: \"DDoS Attacks\",\n params: {\n baseRespect: 0.0004,\n baseWanted: 0.2,\n hackWeight: 100,\n difficulty: 8,\n },\n },\n {\n desc: \"Assign this gang member to create and distribute malicious viruses

    Increases respect - Increases wanted level\",\n isCombat: false,\n isHacking: true,\n name: \"Plant Virus\",\n params: {\n baseRespect: 0.0006,\n baseWanted: 0.4,\n hackWeight: 100,\n difficulty: 12,\n },\n },\n {\n desc: \"Assign this gang member to commit financial fraud and digital counterfeiting

    Earns money - Slightly increases respect - Slightly increases wanted level\",\n isCombat: false,\n isHacking: true,\n name: \"Fraud & Counterfeiting\",\n params: {\n baseRespect: 0.0004,\n baseWanted: 0.3,\n baseMoney: 15,\n hackWeight: 80,\n chaWeight: 20,\n difficulty: 20,\n },\n },\n {\n desc: \"Assign this gang member to launder money

    Earns money - Increases respect - Increases wanted level\",\n isCombat: false,\n isHacking: true,\n name: \"Money Laundering\",\n params: {\n baseRespect: 0.001,\n baseWanted: 1.25,\n baseMoney: 120,\n hackWeight: 75,\n chaWeight: 25,\n difficulty: 25,\n },\n },\n {\n desc: \"Assign this gang member to commit acts of cyberterrorism

    Greatly increases respect - Greatly increases wanted level\",\n isCombat: false,\n isHacking: true,\n name: \"Cyberterrorism\",\n params: {\n baseRespect: 0.01,\n baseWanted: 6,\n hackWeight: 80,\n chaWeight: 20,\n difficulty: 36,\n },\n },\n {\n desc: \"Assign this gang member to be an ethical hacker for corporations

    Earns money - Lowers wanted level\",\n isCombat: false,\n isHacking: true,\n name: \"Ethical Hacking\",\n params: {\n baseWanted: -0.001,\n baseMoney: 1,\n hackWeight: 90,\n chaWeight: 10,\n difficulty: 1,\n },\n },\n {\n desc: \"Assign this gang member to mug random people on the streets

    Earns money - Slightly increases respect - Very slightly increases wanted level\",\n isCombat: true,\n isHacking: false,\n name: \"Mug People\",\n params: {\n baseRespect: 0.00005,\n baseWanted: 0.00005,\n baseMoney: 1.2,\n strWeight: 25,\n defWeight: 25,\n dexWeight: 25,\n agiWeight: 10,\n chaWeight: 15,\n difficulty: 1,\n },\n },\n {\n desc: \"Assign this gang member to sell drugs

    Earns money - Slightly increases respect - Slightly increases wanted level - Scales slightly with territory\",\n isCombat: true,\n isHacking: false,\n name: \"Deal Drugs\",\n params: {\n baseRespect: 0.00006,\n baseWanted: 0.002,\n baseMoney: 5,\n agiWeight: 20,\n dexWeight: 20,\n chaWeight: 60,\n difficulty: 3.5,\n territory: {\n money: 1.2,\n respect: 1,\n wanted: 1.15,\n },\n },\n },\n {\n desc: \"Assign this gang member to extort civilians in your territory

    Earns money - Slightly increases respect - Increases wanted - Scales heavily with territory\",\n isCombat: true,\n isHacking: false,\n name: \"Strongarm Civilians\",\n params: {\n baseRespect: 0.00004,\n baseWanted: 0.02,\n baseMoney: 2.5,\n hackWeight: 10,\n strWeight: 25,\n defWeight: 25,\n dexWeight: 20,\n agiWeight: 10,\n chaWeight: 10,\n difficulty: 5,\n territory: {\n money: 1.6,\n respect: 1.1,\n wanted: 1.5,\n },\n },\n },\n {\n desc: \"Assign this gang member to run cons

    Earns money - Increases respect - Increases wanted level\",\n isCombat: true,\n isHacking: false,\n name: \"Run a Con\",\n params: {\n baseRespect: 0.00012,\n baseWanted: 0.05,\n baseMoney: 15,\n strWeight: 5,\n defWeight: 5,\n agiWeight: 25,\n dexWeight: 25,\n chaWeight: 40,\n difficulty: 14,\n },\n },\n {\n desc: \"Assign this gang member to commit armed robbery on stores, banks and armored cars

    Earns money - Increases respect - Increases wanted level\",\n isCombat: true,\n isHacking: false,\n name: \"Armed Robbery\",\n params: {\n baseRespect: 0.00014,\n baseWanted: 0.1,\n baseMoney: 38,\n hackWeight: 20,\n strWeight: 15,\n defWeight: 15,\n agiWeight: 10,\n dexWeight: 20,\n chaWeight: 20,\n difficulty: 20,\n },\n },\n {\n desc: \"Assign this gang member to traffick illegal arms

    Earns money - Increases respect - Increases wanted level - Scales heavily with territory\",\n isCombat: true,\n isHacking: false,\n name: \"Traffick Illegal Arms\",\n params: {\n baseRespect: 0.0002,\n baseWanted: 0.24,\n baseMoney: 58,\n hackWeight: 15,\n strWeight: 20,\n defWeight: 20,\n dexWeight: 20,\n chaWeight: 25,\n difficulty: 32,\n territory: {\n money: 1.4,\n respect: 1.3,\n wanted: 1.25,\n },\n },\n },\n {\n desc: \"Assign this gang member to threaten and black mail high-profile targets

    Earns money - Slightly increases respect - Slightly increases wanted level\",\n isCombat: true,\n isHacking: false,\n name: \"Threaten & Blackmail\",\n params: {\n baseRespect: 0.0002,\n baseWanted: 0.125,\n baseMoney: 24,\n hackWeight: 25,\n strWeight: 25,\n dexWeight: 25,\n chaWeight: 25,\n difficulty: 28,\n },\n },\n {\n desc: \"Assign this gang member to engage in human trafficking operations

    Earns money - Increases respect - Increases wanted level - Scales heavily with territory\",\n isCombat: true,\n isHacking: false,\n name: \"Human Trafficking\",\n params: {\n baseRespect: 0.004,\n baseWanted: 1.25,\n baseMoney: 120,\n hackWeight: 30,\n strWeight: 5,\n defWeight: 5,\n dexWeight: 30,\n chaWeight: 30,\n difficulty: 36,\n territory: {\n money: 1.5,\n respect: 1.5,\n wanted: 1.6,\n },\n },\n },\n {\n desc: \"Assign this gang member to commit acts of terrorism

    Greatly increases respect - Greatly increases wanted level - Scales heavily with territory\",\n isCombat: true,\n isHacking: false,\n name: \"Terrorism\",\n params: {\n baseRespect: 0.01,\n baseWanted: 6,\n hackWeight: 20,\n strWeight: 20,\n defWeight: 20,\n dexWeight: 20,\n chaWeight: 20,\n difficulty: 36,\n territory: {\n money: 1,\n respect: 2,\n wanted: 2,\n },\n },\n },\n {\n desc: \"Assign this gang member to be a vigilante and protect the city from criminals

    Decreases wanted level\",\n isCombat: true,\n isHacking: true,\n name: \"Vigilante Justice\",\n params: {\n baseWanted: -0.001,\n hackWeight: 20,\n strWeight: 20,\n defWeight: 20,\n dexWeight: 20,\n agiWeight: 20,\n difficulty: 1,\n territory: {\n money: 1,\n respect: 1,\n wanted: 0.9, // Gets harder with more territory\n },\n },\n },\n {\n desc: \"Assign this gang member to increase their combat stats (str, def, dex, agi)\",\n isCombat: true,\n isHacking: true,\n name: \"Train Combat\",\n params: {\n strWeight: 25,\n defWeight: 25,\n dexWeight: 25,\n agiWeight: 25,\n difficulty: 100,\n },\n },\n {\n desc: \"Assign this gang member to train their hacking skills\",\n isCombat: true,\n isHacking: true,\n name: \"Train Hacking\",\n params: { hackWeight: 100, difficulty: 45 },\n },\n {\n desc: \"Assign this gang member to train their charisma\",\n isCombat: true,\n isHacking: true,\n name: \"Train Charisma\",\n params: { chaWeight: 100, difficulty: 8 },\n },\n {\n desc: \"Assign this gang member to engage in territorial warfare with other gangs. Members assigned to this task will help increase your gang's territory and will defend your territory from being taken.\",\n isCombat: true,\n isHacking: true,\n name: \"Territory Warfare\",\n params: {\n hackWeight: 15,\n strWeight: 20,\n defWeight: 20,\n dexWeight: 20,\n agiWeight: 20,\n chaWeight: 5,\n difficulty: 5,\n },\n },\n];\n","/**\n * React Component for the recruitment button and text on the gang main page.\n */\nimport React from \"react\";\nimport { Gang } from \"../Gang\";\nimport { RecruitPopup } from \"./RecruitPopup\";\nimport { GangConstants } from \"../data/Constants\";\nimport { formatNumber } from \"../../../utils/StringHelperFunctions\";\nimport { createPopup } from \"../../ui/React/createPopup\";\n\ninterface IProps {\n gang: Gang;\n onRecruit: () => void;\n}\n\nexport function RecruitButton(props: IProps): React.ReactElement {\n if (props.gang.members.length >= GangConstants.MaximumGangMembers) {\n return <>;\n }\n\n if (!props.gang.canRecruitMember()) {\n const respect = props.gang.getRespectNeededToRecruitMember();\n return (\n <>\n \n Recruit Gang Member\n \n

    \n {formatNumber(respect, 2)} respect needed to recruit next member\n

    \n \n );\n }\n\n function onClick(): void {\n const popupId = \"recruit-gang-member-popup\";\n createPopup(popupId, RecruitPopup, {\n gang: props.gang,\n popupId: popupId,\n onRecruit: props.onRecruit,\n });\n }\n\n return (\n <>\n \n Recruit Gang Member\n \n \n );\n}\n","/**\n * React Component for the popup used to recruit new gang members.\n */\nimport React, { useState } from \"react\";\nimport { Gang } from \"../Gang\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\n\ninterface IRecruitPopupProps {\n gang: Gang;\n popupId: string;\n onRecruit: () => void;\n}\n\nexport function RecruitPopup(props: IRecruitPopupProps): React.ReactElement {\n const [name, setName] = useState(\"\");\n\n function recruit(): void {\n if (name === \"\") {\n dialogBoxCreate(\"You must enter a name for your Gang member!\");\n return;\n }\n if (!props.gang.canRecruitMember()) {\n dialogBoxCreate(\"You cannot recruit another Gang member!\");\n return;\n }\n\n // At this point, the only way this can fail is if you already\n // have a gang member with the same name\n if (!props.gang.recruitMember(name)) {\n dialogBoxCreate(\"You already have a gang member with this name!\");\n return;\n }\n\n props.onRecruit();\n removePopup(props.popupId);\n }\n\n function onKeyUp(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) recruit();\n }\n\n function onChange(event: React.ChangeEvent): void {\n setName(event.target.value);\n }\n\n return (\n <>\n

    Enter a name for your new Gang member:

    \n
    \n \n \n Recruit Gang Member\n \n \n );\n}\n","/**\n * React Component for the territory subpage.\n */\nimport React from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { formatNumber } from \"../../../utils/StringHelperFunctions\";\nimport { AllGangs } from \"../AllGangs\";\nimport { Gang } from \"../Gang\";\n\ninterface IProps {\n gang: Gang;\n}\n\nexport function TerritorySubpage(props: IProps): React.ReactElement {\n function openWarfareHelp(): void {\n dialogBoxCreate(\n \"This percentage represents the chance you have of \" +\n \"'clashing' with with another gang. If you do not \" +\n \"wish to gain/lose territory, then keep this \" +\n \"percentage at 0% by not engaging in territory warfare.\",\n );\n }\n\n function formatTerritory(n: number): string {\n const v = n * 100;\n if (v <= 0) {\n return formatNumber(0, 2);\n } else if (v >= 100) {\n return formatNumber(100, 2);\n } else {\n return formatNumber(v, 2);\n }\n }\n\n const playerPower = AllGangs[props.gang.facName].power;\n function otherGangTerritory(name: string): React.ReactElement {\n const power = AllGangs[name].power;\n const clashVictoryChance = playerPower / (power + playerPower);\n return (\n \n {name}\n
    \n Power: {formatNumber(power, 6)}\n
    \n Territory: {formatTerritory(AllGangs[name].territory)}%
    \n Chance to win clash with this gang: {numeralWrapper.formatPercentage(clashVictoryChance, 3)}\n
    \n
    \n
    \n );\n }\n\n const gangNames = Object.keys(AllGangs).filter((g) => g != props.gang.facName);\n\n return (\n
    \n

    \n This page shows how much territory your Gang controls. This statistic is listed as a percentage, which\n represents how much of the total territory you control.\n
    \n
    \n Every ~20 seconds, your gang has a chance to 'clash' with other gangs. Your chance to win a clash depends on\n your gang's power, which is listed in the display below. Your gang's power slowly accumulates over time. The\n accumulation rate is determined by the stats of all Gang members you have assigned to the 'Territory Warfare'\n task. Gang members that are not assigned to this task do not contribute to your gang's power. Your gang also\n loses a small amount of power whenever you lose a clash.\n
    \n
    \n NOTE: Gang members assigned to 'Territory Warfare' can be killed during clashes. This can happen regardless of\n whether you win or lose the clash. A gang member being killed results in both respect and power loss for your\n gang.\n
    \n
    \n The amount of territory you have affects all aspects of your Gang members' production, including money, respect,\n and wanted level. It is very beneficial to have high territory control.\n
    \n
    \n

    \n (props.gang.territoryWarfareEngaged = event.target.checked)}\n />\n \n
    \n

    \n Territory Clash Chance: {numeralWrapper.formatPercentage(props.gang.territoryClashChance, 3)}\n

    \n
    \n ?\n
    \n
    \n\n (props.gang.notifyMemberDeath = event.target.checked)}\n />\n \n
    \n
    \n

    \n \n {props.gang.facName}\n \n
    \n Power: {formatNumber(AllGangs[props.gang.facName].power, 6)}\n
    \n Territory: {formatTerritory(AllGangs[props.gang.facName].territory)}%\n
    \n
    \n {gangNames.map((name) => otherGangTerritory(name))}\n

    \n
    \n
    \n );\n}\n","// React Components for the Corporation UI's navigation tabs\n// These are the tabs at the top of the UI that let you switch to different\n// divisions, see an overview of your corporation, or create a new industry\nimport React, { useState, useEffect } from \"react\";\nimport { HeaderTab } from \"./HeaderTab\";\nimport { IIndustry } from \"../IIndustry\";\nimport { NewIndustryPopup } from \"./NewIndustryPopup\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { MainPanel } from \"./MainPanel\";\nimport { Industries } from \"../IndustryData\";\n\ninterface IExpandButtonProps {\n corp: ICorporation;\n setDivisionName: (name: string) => void;\n}\n\nfunction ExpandButton(props: IExpandButtonProps): React.ReactElement {\n const allIndustries = Object.keys(Industries).sort();\n const possibleIndustries = allIndustries\n .filter(\n (industryType: string) => props.corp.divisions.find((division: IIndustry) => division.type === industryType) === undefined,\n )\n .sort();\n if (possibleIndustries.length === 0) return <>;\n\n function openNewIndustryPopup(): void {\n const popupId = \"cmpy-mgmt-expand-industry-popup\";\n createPopup(popupId, NewIndustryPopup, {\n corp: props.corp,\n setDivisionName: props.setDivisionName,\n popupId: popupId,\n });\n }\n\n return ;\n}\n\ninterface IProps {\n corp: ICorporation;\n player: IPlayer;\n}\n\nexport function CorporationRoot(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n const [divisionName, setDivisionName] = useState(\"Overview\");\n\n useEffect(() => {\n const id = setInterval(rerender, 1000);\n return () => clearInterval(id);\n }, []);\n\n return (\n
    \n
    \n setDivisionName(\"Overview\")}\n text={props.corp.name}\n />\n {props.corp.divisions.map((division: IIndustry) => (\n setDivisionName(division.name)}\n text={division.name}\n />\n ))}\n \n
    \n \n
    \n );\n}\n","import React, { useState } from \"react\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { Industries, IndustryDescriptions } from \"../IndustryData\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IIndustry } from \"../IIndustry\";\nimport { NewIndustry } from \"../Actions\";\n\ninterface IProps {\n corp: ICorporation;\n popupId: string;\n setDivisionName: (name: string) => void;\n}\n// Create a popup that lets the player create a new industry.\n// This is created when the player clicks the \"Expand into new Industry\" header tab\nexport function NewIndustryPopup(props: IProps): React.ReactElement {\n const allIndustries = Object.keys(Industries).sort();\n const possibleIndustries = allIndustries\n .filter(\n (industryType: string) => props.corp.divisions.find((division: IIndustry) => division.type === industryType) === undefined,\n )\n .sort();\n const [industry, setIndustry] = useState(possibleIndustries.length > 0 ? possibleIndustries[0] : \"\");\n const [name, setName] = useState(\"\");\n\n function newIndustry(): void {\n try {\n NewIndustry(props.corp, industry, name);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n return;\n }\n\n // Set routing to the new division so that the UI automatically switches to it\n props.setDivisionName(name);\n\n removePopup(props.popupId);\n }\n\n function onNameChange(event: React.ChangeEvent): void {\n setName(event.target.value);\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) newIndustry();\n }\n\n function onIndustryChange(event: React.ChangeEvent): void {\n setIndustry(event.target.value);\n }\n\n const desc = IndustryDescriptions[industry];\n if (desc === undefined) throw new Error(`Trying to create an industry that doesn't exists: '${industry}'`);\n\n return (\n <>\n

    Create a new division to expand into a new industry:

    \n \n

    {desc(props.corp)}

    \n
    \n
    \n\n

    Division name:

    \n \n \n Create Division\n \n \n );\n}\n","import { Reviver, Generic_toJSON, Generic_fromJSON } from \"../../utils/JSONReviver\";\nimport { CityName } from \"../Locations/data/CityNames\";\nimport Decimal from \"decimal.js\";\nimport { Industries, IndustryStartingCosts, IndustryResearchTrees } from \"./IndustryData\";\nimport { CorporationConstants } from \"./data/Constants\";\nimport { EmployeePositions } from \"./EmployeePositions\";\nimport { Material } from \"./Material\";\nimport { getRandomInt } from \"../../utils/helpers/getRandomInt\";\nimport { calculateEffectWithFactors } from \"../utils/calculateEffectWithFactors\";\nimport { OfficeSpace } from \"./OfficeSpace\";\nimport { Product } from \"./Product\";\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\nimport { isString } from \"../../utils/helpers/isString\";\nimport { MaterialSizes } from \"./MaterialSizes\";\nimport { Warehouse } from \"./Warehouse\";\nimport { ICorporation } from \"./ICorporation\";\nimport { IIndustry } from \"./IIndustry\";\nimport { IndustryUpgrade, IndustryUpgrades } from \"./IndustryUpgrades\";\nimport { formatNumber } from \"../../utils/StringHelperFunctions\";\n\ninterface IParams {\n name?: string;\n corp?: ICorporation;\n type?: string;\n}\n\nexport class Industry implements IIndustry {\n name = \"\";\n type = Industries.Agriculture;\n sciResearch = new Material({ name: \"Scientific Research\" });\n researched: { [key: string]: boolean | undefined } = {};\n reqMats: { [key: string]: number | undefined } = {};\n\n //An array of the name of materials being produced\n prodMats: string[] = [];\n\n products: { [key: string]: Product | undefined } = {};\n makesProducts = false;\n\n awareness = 0;\n popularity = 0; //Should always be less than awareness\n startingCost = 0;\n\n /* The following are factors for how much production/other things are increased by\n different factors. The production increase always has diminishing returns,\n and they are all reprsented by exponentials of < 1 (e.g x ^ 0.5, x ^ 0.8)\n The number for these represent the exponential. A lower number means more\n diminishing returns */\n reFac = 0; //Real estate Factor\n sciFac = 0; //Scientific Research Factor, affects quality\n hwFac = 0; //Hardware factor\n robFac = 0; //Robotics Factor\n aiFac = 0; //AI Cores factor;\n advFac = 0; //Advertising factor, affects sales\n\n prodMult = 0; //Production multiplier\n\n //Financials\n lastCycleRevenue: any;\n lastCycleExpenses: any;\n thisCycleRevenue: any;\n thisCycleExpenses: any;\n\n //Upgrades\n upgrades: number[] = Array(Object.keys(IndustryUpgrades).length).fill(0);\n\n state = \"START\";\n newInd = true;\n\n //Maps locations to warehouses. 0 if no warehouse at that location\n warehouses: { [key: string]: Warehouse | 0 };\n\n //Maps locations to offices. 0 if no office at that location\n offices: { [key: string]: OfficeSpace | 0 } = {\n [CityName.Aevum]: 0,\n [CityName.Chongqing]: 0,\n [CityName.Sector12]: new OfficeSpace({\n loc: CityName.Sector12,\n size: CorporationConstants.OfficeInitialSize,\n }),\n [CityName.NewTokyo]: 0,\n [CityName.Ishima]: 0,\n [CityName.Volhaven]: 0,\n };\n\n constructor(params: IParams = {}) {\n this.name = params.name ? params.name : \"\";\n this.type = params.type ? params.type : Industries.Agriculture;\n\n //Financials\n this.lastCycleRevenue = new Decimal(0);\n this.lastCycleExpenses = new Decimal(0);\n this.thisCycleRevenue = new Decimal(0);\n this.thisCycleExpenses = new Decimal(0);\n\n this.warehouses = {\n [CityName.Aevum]: 0,\n [CityName.Chongqing]: 0,\n [CityName.Sector12]: new Warehouse({\n corp: params.corp,\n industry: this,\n loc: CityName.Sector12,\n size: CorporationConstants.WarehouseInitialSize,\n }),\n [CityName.NewTokyo]: 0,\n [CityName.Ishima]: 0,\n [CityName.Volhaven]: 0,\n };\n\n this.init();\n }\n\n init(): void {\n //Set the unique properties of an industry (how much its affected by real estate/scientific research, etc.)\n const startingCost = IndustryStartingCosts[this.type];\n if (startingCost === undefined) throw new Error(`Invalid industry: \"${this.type}\"`);\n this.startingCost = startingCost;\n switch (this.type) {\n case Industries.Energy:\n this.reFac = 0.65;\n this.sciFac = 0.7;\n this.robFac = 0.05;\n this.aiFac = 0.3;\n this.advFac = 0.08;\n this.reqMats = {\n Hardware: 0.1,\n Metal: 0.2,\n };\n this.prodMats = [\"Energy\"];\n break;\n case Industries.Utilities:\n case \"Utilities\":\n this.reFac = 0.5;\n this.sciFac = 0.6;\n this.robFac = 0.4;\n this.aiFac = 0.4;\n this.advFac = 0.08;\n this.reqMats = {\n Hardware: 0.1,\n Metal: 0.1,\n };\n this.prodMats = [\"Water\"];\n break;\n case Industries.Agriculture:\n this.reFac = 0.72;\n this.sciFac = 0.5;\n this.hwFac = 0.2;\n this.robFac = 0.3;\n this.aiFac = 0.3;\n this.advFac = 0.04;\n this.reqMats = {\n Water: 0.5,\n Energy: 0.5,\n };\n this.prodMats = [\"Plants\", \"Food\"];\n break;\n case Industries.Fishing:\n this.reFac = 0.15;\n this.sciFac = 0.35;\n this.hwFac = 0.35;\n this.robFac = 0.5;\n this.aiFac = 0.2;\n this.advFac = 0.08;\n this.reqMats = {\n Energy: 0.5,\n };\n this.prodMats = [\"Food\"];\n break;\n case Industries.Mining:\n this.reFac = 0.3;\n this.sciFac = 0.26;\n this.hwFac = 0.4;\n this.robFac = 0.45;\n this.aiFac = 0.45;\n this.advFac = 0.06;\n this.reqMats = {\n Energy: 0.8,\n };\n this.prodMats = [\"Metal\"];\n break;\n case Industries.Food:\n //reFac is unique for this bc it diminishes greatly per city. Handle this separately in code?\n this.sciFac = 0.12;\n this.hwFac = 0.15;\n this.robFac = 0.3;\n this.aiFac = 0.25;\n this.advFac = 0.25;\n this.reFac = 0.05;\n this.reqMats = {\n Food: 0.5,\n Water: 0.5,\n Energy: 0.2,\n };\n this.makesProducts = true;\n break;\n case Industries.Tobacco:\n this.reFac = 0.15;\n this.sciFac = 0.75;\n this.hwFac = 0.15;\n this.robFac = 0.2;\n this.aiFac = 0.15;\n this.advFac = 0.2;\n this.reqMats = {\n Plants: 1,\n Water: 0.2,\n };\n this.makesProducts = true;\n break;\n case Industries.Chemical:\n this.reFac = 0.25;\n this.sciFac = 0.75;\n this.hwFac = 0.2;\n this.robFac = 0.25;\n this.aiFac = 0.2;\n this.advFac = 0.07;\n this.reqMats = {\n Plants: 1,\n Energy: 0.5,\n Water: 0.5,\n };\n this.prodMats = [\"Chemicals\"];\n break;\n case Industries.Pharmaceutical:\n this.reFac = 0.05;\n this.sciFac = 0.8;\n this.hwFac = 0.15;\n this.robFac = 0.25;\n this.aiFac = 0.2;\n this.advFac = 0.16;\n this.reqMats = {\n Chemicals: 2,\n Energy: 1,\n Water: 0.5,\n };\n this.prodMats = [\"Drugs\"];\n this.makesProducts = true;\n break;\n case Industries.Computer:\n case \"Computer\":\n this.reFac = 0.2;\n this.sciFac = 0.62;\n this.robFac = 0.36;\n this.aiFac = 0.19;\n this.advFac = 0.17;\n this.reqMats = {\n Metal: 2,\n Energy: 1,\n };\n this.prodMats = [\"Hardware\"];\n this.makesProducts = true;\n break;\n case Industries.Robotics:\n this.reFac = 0.32;\n this.sciFac = 0.65;\n this.aiFac = 0.36;\n this.advFac = 0.18;\n this.hwFac = 0.19;\n this.reqMats = {\n Hardware: 5,\n Energy: 3,\n };\n this.prodMats = [\"Robots\"];\n this.makesProducts = true;\n break;\n case Industries.Software:\n this.sciFac = 0.62;\n this.advFac = 0.16;\n this.hwFac = 0.25;\n this.reFac = 0.15;\n this.aiFac = 0.18;\n this.robFac = 0.05;\n this.reqMats = {\n Hardware: 0.5,\n Energy: 0.5,\n };\n this.prodMats = [\"AICores\"];\n this.makesProducts = true;\n break;\n case Industries.Healthcare:\n this.reFac = 0.1;\n this.sciFac = 0.75;\n this.advFac = 0.11;\n this.hwFac = 0.1;\n this.robFac = 0.1;\n this.aiFac = 0.1;\n this.reqMats = {\n Robots: 10,\n AICores: 5,\n Energy: 5,\n Water: 5,\n };\n this.makesProducts = true;\n break;\n case Industries.RealEstate:\n this.robFac = 0.6;\n this.aiFac = 0.6;\n this.advFac = 0.25;\n this.sciFac = 0.05;\n this.hwFac = 0.05;\n this.reqMats = {\n Metal: 5,\n Energy: 5,\n Water: 2,\n Hardware: 4,\n };\n this.prodMats = [\"RealEstate\"];\n this.makesProducts = true;\n break;\n default:\n console.error(`Invalid Industry Type passed into Industry.init(): ${this.type}`);\n return;\n }\n }\n\n getProductDescriptionText(): string {\n if (!this.makesProducts) return \"\";\n switch (this.type) {\n case Industries.Food:\n return \"create and manage restaurants\";\n case Industries.Tobacco:\n return \"create tobacco and tobacco-related products\";\n case Industries.Pharmaceutical:\n return \"develop new pharmaceutical drugs\";\n case Industries.Computer:\n case \"Computer\":\n return \"create new computer hardware and networking infrastructures\";\n case Industries.Robotics:\n return \"build specialized robots and robot-related products\";\n case Industries.Software:\n return \"develop computer software\";\n case Industries.Healthcare:\n return \"build and manage hospitals\";\n case Industries.RealEstate:\n return \"develop and manage real estate properties\";\n default:\n console.error(\"Invalid industry type in Industry.getProductDescriptionText\");\n return \"\";\n }\n }\n\n getMaximumNumberProducts(): number {\n if (!this.makesProducts) return 0;\n\n // Calculate additional number of allowed Products from Research/Upgrades\n let additional = 0;\n if (this.hasResearch(\"uPgrade: Capacity.I\")) ++additional;\n if (this.hasResearch(\"uPgrade: Capacity.II\")) ++additional;\n\n return CorporationConstants.BaseMaxProducts + additional;\n }\n\n hasMaximumNumberProducts(): boolean {\n return Object.keys(this.products).length >= this.getMaximumNumberProducts();\n }\n\n //Calculates the values that factor into the production and properties of\n //materials/products (such as quality, etc.)\n calculateProductionFactors(): void {\n let multSum = 0;\n for (let i = 0; i < CorporationConstants.Cities.length; ++i) {\n const city = CorporationConstants.Cities[i];\n const warehouse = this.warehouses[city];\n if (!(warehouse instanceof Warehouse)) {\n continue;\n }\n\n const materials = warehouse.materials;\n\n const cityMult =\n Math.pow(0.002 * materials.RealEstate.qty + 1, this.reFac) *\n Math.pow(0.002 * materials.Hardware.qty + 1, this.hwFac) *\n Math.pow(0.002 * materials.Robots.qty + 1, this.robFac) *\n Math.pow(0.002 * materials.AICores.qty + 1, this.aiFac);\n multSum += Math.pow(cityMult, 0.73);\n }\n\n multSum < 1 ? (this.prodMult = 1) : (this.prodMult = multSum);\n }\n\n updateWarehouseSizeUsed(warehouse: Warehouse): void {\n warehouse.updateMaterialSizeUsed();\n\n for (const prodName in this.products) {\n if (this.products.hasOwnProperty(prodName)) {\n const prod = this.products[prodName];\n if (prod === undefined) continue;\n warehouse.sizeUsed += prod.data[warehouse.loc][0] * prod.siz;\n if (prod.data[warehouse.loc][0] > 0) {\n warehouse.breakdown += prodName + \": \" + formatNumber(prod.data[warehouse.loc][0] * prod.siz, 0) + \"
    \";\n }\n }\n }\n }\n\n process(marketCycles = 1, state: string, corporation: ICorporation): void {\n this.state = state;\n\n //At the start of a cycle, store and reset revenue/expenses\n //Then calculate salaries and processs the markets\n if (state === \"START\") {\n if (isNaN(this.thisCycleRevenue) || isNaN(this.thisCycleExpenses)) {\n console.error(\"NaN in Corporation's computed revenue/expenses\");\n dialogBoxCreate(\n \"Something went wrong when compting Corporation's revenue/expenses. This is a bug. Please report to game developer\",\n );\n this.thisCycleRevenue = new Decimal(0);\n this.thisCycleExpenses = new Decimal(0);\n }\n this.lastCycleRevenue = this.thisCycleRevenue.dividedBy(marketCycles * CorporationConstants.SecsPerMarketCycle);\n this.lastCycleExpenses = this.thisCycleExpenses.dividedBy(marketCycles * CorporationConstants.SecsPerMarketCycle);\n this.thisCycleRevenue = new Decimal(0);\n this.thisCycleExpenses = new Decimal(0);\n\n // Once you start making revenue, the player should no longer be\n // considered new, and therefore no longer needs the 'tutorial' UI elements\n if (this.lastCycleRevenue.gt(0)) {\n this.newInd = false;\n }\n\n // Process offices (and the employees in them)\n let employeeSalary = 0;\n for (const officeLoc in this.offices) {\n const office = this.offices[officeLoc];\n if (office === 0) continue;\n if (office instanceof OfficeSpace) {\n employeeSalary += office.process(marketCycles, corporation, this);\n }\n }\n this.thisCycleExpenses = this.thisCycleExpenses.plus(employeeSalary);\n\n // Process change in demand/competition of materials/products\n this.processMaterialMarket();\n this.processProductMarket(marketCycles);\n\n // Process loss of popularity\n this.popularity -= marketCycles * 0.0001;\n this.popularity = Math.max(0, this.popularity);\n\n // Process Dreamsense gains\n const popularityGain = corporation.getDreamSenseGain(),\n awarenessGain = popularityGain * 4;\n if (popularityGain > 0) {\n this.popularity += popularityGain * marketCycles;\n this.awareness += awarenessGain * marketCycles;\n }\n\n return;\n }\n\n // Process production, purchase, and import/export of materials\n let res = this.processMaterials(marketCycles, corporation);\n if (Array.isArray(res)) {\n this.thisCycleRevenue = this.thisCycleRevenue.plus(res[0]);\n this.thisCycleExpenses = this.thisCycleExpenses.plus(res[1]);\n }\n\n // Process creation, production & sale of products\n res = this.processProducts(marketCycles, corporation);\n if (Array.isArray(res)) {\n this.thisCycleRevenue = this.thisCycleRevenue.plus(res[0]);\n this.thisCycleExpenses = this.thisCycleExpenses.plus(res[1]);\n }\n }\n\n // Process change in demand and competition for this industry's materials\n processMaterialMarket(): void {\n //References to prodMats and reqMats\n const reqMats = this.reqMats,\n prodMats = this.prodMats;\n\n //Only 'process the market' for materials that this industry deals with\n for (let i = 0; i < CorporationConstants.Cities.length; ++i) {\n //If this industry has a warehouse in this city, process the market\n //for every material this industry requires or produces\n if (this.warehouses[CorporationConstants.Cities[i]] instanceof Warehouse) {\n const wh = this.warehouses[CorporationConstants.Cities[i]];\n if (wh === 0) continue;\n for (const name in reqMats) {\n if (reqMats.hasOwnProperty(name)) {\n wh.materials[name].processMarket();\n }\n }\n\n //Produced materials are stored in an array\n for (let foo = 0; foo < prodMats.length; ++foo) {\n wh.materials[prodMats[foo]].processMarket();\n }\n\n //Process these twice because these boost production\n wh.materials[\"Hardware\"].processMarket();\n wh.materials[\"Robots\"].processMarket();\n wh.materials[\"AICores\"].processMarket();\n wh.materials[\"RealEstate\"].processMarket();\n }\n }\n }\n\n // Process change in demand and competition for this industry's products\n processProductMarket(marketCycles = 1): void {\n // Demand gradually decreases, and competition gradually increases\n for (const name in this.products) {\n if (this.products.hasOwnProperty(name)) {\n const product = this.products[name];\n if (product === undefined) continue;\n let change = getRandomInt(0, 3) * 0.0004;\n if (change === 0) continue;\n\n if (\n this.type === Industries.Pharmaceutical ||\n this.type === Industries.Software ||\n this.type === Industries.Robotics\n ) {\n change *= 3;\n }\n change *= marketCycles;\n product.dmd -= change;\n product.cmp += change;\n product.cmp = Math.min(product.cmp, 99.99);\n product.dmd = Math.max(product.dmd, 0.001);\n }\n }\n }\n\n //Process production, purchase, and import/export of materials\n processMaterials(marketCycles = 1, corporation: ICorporation): [number, number] {\n let revenue = 0,\n expenses = 0;\n this.calculateProductionFactors();\n\n //At the start of the export state, set the imports of everything to 0\n if (this.state === \"EXPORT\") {\n for (let i = 0; i < CorporationConstants.Cities.length; ++i) {\n const city = CorporationConstants.Cities[i];\n if (!(this.warehouses[city] instanceof Warehouse)) {\n continue;\n }\n const warehouse = this.warehouses[city];\n if (warehouse === 0) continue;\n for (const matName in warehouse.materials) {\n if (warehouse.materials.hasOwnProperty(matName)) {\n const mat = warehouse.materials[matName];\n mat.imp = 0;\n }\n }\n }\n }\n\n for (let i = 0; i < CorporationConstants.Cities.length; ++i) {\n const city = CorporationConstants.Cities[i];\n const office = this.offices[city];\n if (office === 0) continue;\n\n if (this.warehouses[city] instanceof Warehouse) {\n const warehouse = this.warehouses[city];\n if (warehouse === 0) continue;\n\n switch (this.state) {\n case \"PURCHASE\": {\n /* Process purchase of materials */\n for (const matName in warehouse.materials) {\n if (!warehouse.materials.hasOwnProperty(matName)) continue;\n const mat = warehouse.materials[matName];\n let buyAmt = 0;\n let maxAmt = 0;\n if (warehouse.smartSupplyEnabled && Object.keys(this.reqMats).includes(matName)) {\n continue;\n }\n buyAmt = mat.buy * CorporationConstants.SecsPerMarketCycle * marketCycles;\n\n if (matName == \"RealEstate\") {\n maxAmt = buyAmt;\n } else {\n maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / MaterialSizes[matName]);\n }\n buyAmt = Math.min(buyAmt, maxAmt);\n if (buyAmt > 0) {\n mat.qty += buyAmt;\n expenses += buyAmt * mat.bCost;\n }\n this.updateWarehouseSizeUsed(warehouse);\n } //End process purchase of materials\n\n // smart supply\n const smartBuy: { [key: string]: number | undefined } = {};\n for (const matName in warehouse.materials) {\n if (!warehouse.materials.hasOwnProperty(matName)) continue;\n if (!warehouse.smartSupplyEnabled || !Object.keys(this.reqMats).includes(matName)) continue;\n const mat = warehouse.materials[matName];\n\n //Smart supply tracker is stored as per second rate\n const reqMat = this.reqMats[matName];\n if (reqMat === undefined) throw new Error(`reqMat \"${matName}\" is undefined`);\n mat.buy = reqMat * warehouse.smartSupplyStore;\n let buyAmt = mat.buy * CorporationConstants.SecsPerMarketCycle * marketCycles;\n const maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / MaterialSizes[matName]);\n buyAmt = Math.min(buyAmt, maxAmt);\n if (buyAmt > 0) smartBuy[matName] = buyAmt;\n }\n\n // Find which material were trying to create the least amount of product with.\n let worseAmt = 1e99;\n for (const matName in smartBuy) {\n const buyAmt = smartBuy[matName];\n if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);\n const reqMat = this.reqMats[matName];\n if (reqMat === undefined) throw new Error(`reqMat \"${matName}\" is undefined`);\n const amt = buyAmt / reqMat;\n if (amt < worseAmt) worseAmt = amt;\n }\n\n // Align all the materials to the smallest amount.\n for (const matName in smartBuy) {\n const reqMat = this.reqMats[matName];\n if (reqMat === undefined) throw new Error(`reqMat \"${matName}\" is undefined`);\n smartBuy[matName] = worseAmt * reqMat;\n }\n\n // Calculate the total size of all things were trying to buy\n let totalSize = 0;\n for (const matName in smartBuy) {\n const buyAmt = smartBuy[matName];\n if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);\n totalSize += buyAmt * MaterialSizes[matName];\n }\n\n // Shrink to the size of available space.\n const freeSpace = warehouse.size - warehouse.sizeUsed;\n if (totalSize > freeSpace) {\n for (const matName in smartBuy) {\n const buyAmt = smartBuy[matName];\n if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);\n smartBuy[matName] = Math.floor((buyAmt * freeSpace) / totalSize);\n }\n }\n\n // Use the materials already in the warehouse if the option is on.\n for (const matName in smartBuy) {\n if (!warehouse.smartSupplyUseLeftovers[matName]) continue;\n const mat = warehouse.materials[matName];\n const buyAmt = smartBuy[matName];\n if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);\n smartBuy[matName] = Math.max(0, buyAmt - mat.qty);\n }\n\n // buy them\n for (const matName in smartBuy) {\n const mat = warehouse.materials[matName];\n const buyAmt = smartBuy[matName];\n if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);\n mat.qty += buyAmt;\n expenses += buyAmt * mat.bCost;\n }\n break;\n }\n case \"PRODUCTION\":\n warehouse.smartSupplyStore = 0; //Reset smart supply amount\n\n /* Process production of materials */\n if (this.prodMats.length > 0) {\n const mat = warehouse.materials[this.prodMats[0]];\n //Calculate the maximum production of this material based\n //on the office's productivity\n const maxProd =\n this.getOfficeProductivity(office) *\n this.prodMult * // Multiplier from materials\n corporation.getProductionMultiplier() *\n this.getProductionMultiplier(); // Multiplier from Research\n let prod;\n\n if (mat.prdman[0]) {\n //Production is manually limited\n prod = Math.min(maxProd, mat.prdman[1]);\n } else {\n prod = maxProd;\n }\n prod *= CorporationConstants.SecsPerMarketCycle * marketCycles; //Convert production from per second to per market cycle\n\n // Calculate net change in warehouse storage making the produced materials will cost\n let totalMatSize = 0;\n for (let tmp = 0; tmp < this.prodMats.length; ++tmp) {\n totalMatSize += MaterialSizes[this.prodMats[tmp]];\n }\n for (const reqMatName in this.reqMats) {\n const normQty = this.reqMats[reqMatName];\n if (normQty === undefined) continue;\n totalMatSize -= MaterialSizes[reqMatName] * normQty;\n }\n // If not enough space in warehouse, limit the amount of produced materials\n if (totalMatSize > 0) {\n const maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / totalMatSize);\n prod = Math.min(maxAmt, prod);\n }\n\n if (prod < 0) {\n prod = 0;\n }\n\n // Keep track of production for smart supply (/s)\n warehouse.smartSupplyStore += prod / (CorporationConstants.SecsPerMarketCycle * marketCycles);\n\n // Make sure we have enough resource to make our materials\n let producableFrac = 1;\n for (const reqMatName in this.reqMats) {\n if (this.reqMats.hasOwnProperty(reqMatName)) {\n const reqMat = this.reqMats[reqMatName];\n if (reqMat === undefined) continue;\n const req = reqMat * prod;\n if (warehouse.materials[reqMatName].qty < req) {\n producableFrac = Math.min(producableFrac, warehouse.materials[reqMatName].qty / req);\n }\n }\n }\n if (producableFrac <= 0) {\n producableFrac = 0;\n prod = 0;\n }\n\n // Make our materials if they are producable\n if (producableFrac > 0 && prod > 0) {\n for (const reqMatName in this.reqMats) {\n const reqMat = this.reqMats[reqMatName];\n if (reqMat === undefined) continue;\n const reqMatQtyNeeded = reqMat * prod * producableFrac;\n warehouse.materials[reqMatName].qty -= reqMatQtyNeeded;\n warehouse.materials[reqMatName].prd = 0;\n warehouse.materials[reqMatName].prd -=\n reqMatQtyNeeded / (CorporationConstants.SecsPerMarketCycle * marketCycles);\n }\n for (let j = 0; j < this.prodMats.length; ++j) {\n warehouse.materials[this.prodMats[j]].qty += prod * producableFrac;\n warehouse.materials[this.prodMats[j]].qlt =\n office.employeeProd[EmployeePositions.Engineer] / 90 +\n Math.pow(this.sciResearch.qty, this.sciFac) +\n Math.pow(warehouse.materials[\"AICores\"].qty, this.aiFac) / 10e3;\n }\n } else {\n for (const reqMatName in this.reqMats) {\n if (this.reqMats.hasOwnProperty(reqMatName)) {\n warehouse.materials[reqMatName].prd = 0;\n }\n }\n }\n\n //Per second\n const fooProd = (prod * producableFrac) / (CorporationConstants.SecsPerMarketCycle * marketCycles);\n for (let fooI = 0; fooI < this.prodMats.length; ++fooI) {\n warehouse.materials[this.prodMats[fooI]].prd = fooProd;\n }\n } else {\n //If this doesn't produce any materials, then it only creates\n //Products. Creating products will consume materials. The\n //Production of all consumed materials must be set to 0\n for (const reqMatName in this.reqMats) {\n warehouse.materials[reqMatName].prd = 0;\n }\n }\n break;\n\n case \"SALE\":\n /* Process sale of materials */\n for (const matName in warehouse.materials) {\n if (warehouse.materials.hasOwnProperty(matName)) {\n const mat = warehouse.materials[matName];\n if (mat.sCost < 0 || mat.sllman[0] === false) {\n mat.sll = 0;\n continue;\n }\n\n // Sale multipliers\n const businessFactor = this.getBusinessFactor(office); //Business employee productivity\n const advertisingFactor = this.getAdvertisingFactors()[0]; //Awareness + popularity\n const marketFactor = this.getMarketFactor(mat); //Competition + demand\n\n // Determine the cost that the material will be sold at\n const markupLimit = mat.getMarkupLimit();\n let sCost;\n if (mat.marketTa2) {\n const prod = mat.prd;\n\n // Reverse engineer the 'maxSell' formula\n // 1. Set 'maxSell' = prod\n // 2. Substitute formula for 'markup'\n // 3. Solve for 'sCost'\n const numerator = markupLimit;\n const sqrtNumerator = prod;\n const sqrtDenominator =\n (mat.qlt + 0.001) *\n marketFactor *\n businessFactor *\n corporation.getSalesMultiplier() *\n advertisingFactor *\n this.getSalesMultiplier();\n const denominator = Math.sqrt(sqrtNumerator / sqrtDenominator);\n let optimalPrice;\n if (sqrtDenominator === 0 || denominator === 0) {\n if (sqrtNumerator === 0) {\n optimalPrice = 0; // No production\n } else {\n optimalPrice = mat.bCost + markupLimit;\n console.warn(`In Corporation, found illegal 0s when trying to calculate MarketTA2 sale cost`);\n }\n } else {\n optimalPrice = numerator / denominator + mat.bCost;\n }\n\n // We'll store this \"Optimal Price\" in a property so that we don't have\n // to re-calculate it for the UI\n mat.marketTa2Price = optimalPrice;\n\n sCost = optimalPrice;\n } else if (mat.marketTa1) {\n sCost = mat.bCost + markupLimit;\n } else if (isString(mat.sCost)) {\n sCost = (mat.sCost as string).replace(/MP/g, mat.bCost + \"\");\n sCost = eval(sCost);\n } else {\n sCost = mat.sCost;\n }\n\n // Calculate how much of the material sells (per second)\n let markup = 1;\n if (sCost > mat.bCost) {\n //Penalty if difference between sCost and bCost is greater than markup limit\n if (sCost - mat.bCost > markupLimit) {\n markup = Math.pow(markupLimit / (sCost - mat.bCost), 2);\n }\n } else if (sCost < mat.bCost) {\n if (sCost <= 0) {\n markup = 1e12; //Sell everything, essentially discard\n } else {\n //Lower prices than market increases sales\n markup = mat.bCost / sCost;\n }\n }\n\n const maxSell =\n (mat.qlt + 0.001) *\n marketFactor *\n markup *\n businessFactor *\n corporation.getSalesMultiplier() *\n advertisingFactor *\n this.getSalesMultiplier();\n let sellAmt;\n if (isString(mat.sllman[1])) {\n //Dynamically evaluated\n let tmp = (mat.sllman[1] as string).replace(/MAX/g, maxSell + \"\");\n tmp = tmp.replace(/PROD/g, mat.prd + \"\");\n try {\n sellAmt = eval(tmp);\n } catch (e) {\n dialogBoxCreate(\n \"Error evaluating your sell amount for material \" +\n mat.name +\n \" in \" +\n this.name +\n \"'s \" +\n city +\n \" office. The sell amount \" +\n \"is being set to zero\",\n );\n sellAmt = 0;\n }\n sellAmt = Math.min(maxSell, sellAmt);\n } else if (mat.sllman[1] === -1) {\n //Backwards compatibility, -1 = MAX\n sellAmt = maxSell;\n } else {\n //Player's input value is just a number\n sellAmt = Math.min(maxSell, mat.sllman[1] as number);\n }\n\n sellAmt = sellAmt * CorporationConstants.SecsPerMarketCycle * marketCycles;\n sellAmt = Math.min(mat.qty, sellAmt);\n if (sellAmt < 0) {\n console.warn(`sellAmt calculated to be negative for ${matName} in ${city}`);\n mat.sll = 0;\n continue;\n }\n if (sellAmt && sCost >= 0) {\n mat.qty -= sellAmt;\n revenue += sellAmt * sCost;\n mat.sll = sellAmt / (CorporationConstants.SecsPerMarketCycle * marketCycles);\n } else {\n mat.sll = 0;\n }\n }\n } //End processing of sale of materials\n break;\n\n case \"EXPORT\":\n for (const matName in warehouse.materials) {\n if (warehouse.materials.hasOwnProperty(matName)) {\n const mat = warehouse.materials[matName];\n mat.totalExp = 0; //Reset export\n for (let expI = 0; expI < mat.exp.length; ++expI) {\n const exp = mat.exp[expI];\n const amtStr = exp.amt.replace(\n /MAX/g,\n mat.qty / (CorporationConstants.SecsPerMarketCycle * marketCycles) + \"\",\n );\n let amt = 0;\n try {\n amt = eval(amtStr);\n } catch (e) {\n dialogBoxCreate(\n \"Calculating export for \" +\n mat.name +\n \" in \" +\n this.name +\n \"'s \" +\n city +\n \" division failed with \" +\n \"error: \" +\n e,\n );\n continue;\n }\n if (isNaN(amt)) {\n dialogBoxCreate(\n \"Error calculating export amount for \" +\n mat.name +\n \" in \" +\n this.name +\n \"'s \" +\n city +\n \" division.\",\n );\n continue;\n }\n amt = amt * CorporationConstants.SecsPerMarketCycle * marketCycles;\n\n if (mat.qty < amt) {\n amt = mat.qty;\n }\n if (amt === 0) {\n break; //None left\n }\n for (let foo = 0; foo < corporation.divisions.length; ++foo) {\n if (corporation.divisions[foo].name === exp.ind) {\n const expIndustry = corporation.divisions[foo];\n const expWarehouse = expIndustry.warehouses[exp.city];\n if (!(expWarehouse instanceof Warehouse)) {\n console.error(`Invalid export! ${expIndustry.name} ${exp.city}`);\n break;\n }\n\n // Make sure theres enough space in warehouse\n if (expWarehouse.sizeUsed >= expWarehouse.size) {\n // Warehouse at capacity. Exporting doesnt\n // affect revenue so just return 0's\n return [0, 0];\n } else {\n const maxAmt = Math.floor((expWarehouse.size - expWarehouse.sizeUsed) / MaterialSizes[matName]);\n amt = Math.min(maxAmt, amt);\n }\n expWarehouse.materials[matName].imp +=\n amt / (CorporationConstants.SecsPerMarketCycle * marketCycles);\n expWarehouse.materials[matName].qty += amt;\n expWarehouse.materials[matName].qlt = mat.qlt;\n mat.qty -= amt;\n mat.totalExp += amt;\n expIndustry.updateWarehouseSizeUsed(expWarehouse);\n break;\n }\n }\n }\n //totalExp should be per second\n mat.totalExp /= CorporationConstants.SecsPerMarketCycle * marketCycles;\n }\n }\n\n break;\n\n case \"START\":\n break;\n default:\n console.error(`Invalid state: ${this.state}`);\n break;\n } //End switch(this.state)\n this.updateWarehouseSizeUsed(warehouse);\n } // End warehouse\n\n //Produce Scientific Research based on R&D employees\n //Scientific Research can be produced without a warehouse\n if (office instanceof OfficeSpace) {\n this.sciResearch.qty +=\n 0.004 *\n Math.pow(office.employeeProd[EmployeePositions.RandD], 0.5) *\n corporation.getScientificResearchMultiplier() *\n this.getScientificResearchMultiplier();\n }\n }\n return [revenue, expenses];\n }\n\n //Process production & sale of this industry's FINISHED products (including all of their stats)\n processProducts(marketCycles = 1, corporation: ICorporation): [number, number] {\n let revenue = 0;\n const expenses = 0;\n\n //Create products\n if (this.state === \"PRODUCTION\") {\n for (const prodName in this.products) {\n const prod = this.products[prodName];\n if (prod === undefined) continue;\n if (!prod.fin) {\n const city = prod.createCity;\n const office = this.offices[city];\n if (office === 0) continue;\n\n // Designing/Creating a Product is based mostly off Engineers\n const engrProd = office.employeeProd[EmployeePositions.Engineer];\n const mgmtProd = office.employeeProd[EmployeePositions.Management];\n const opProd = office.employeeProd[EmployeePositions.Operations];\n const total = engrProd + mgmtProd + opProd;\n if (total <= 0) {\n break;\n }\n\n // Management is a multiplier for the production from Engineers\n const mgmtFactor = 1 + mgmtProd / (1.2 * total);\n\n const progress = (Math.pow(engrProd, 0.34) + Math.pow(opProd, 0.2)) * mgmtFactor;\n\n prod.createProduct(marketCycles, progress);\n if (prod.prog >= 100) {\n prod.finishProduct(office.employeeProd, this);\n }\n break;\n }\n }\n }\n\n //Produce Products\n for (const prodName in this.products) {\n if (this.products.hasOwnProperty(prodName)) {\n const prod = this.products[prodName];\n if (prod instanceof Product && prod.fin) {\n revenue += this.processProduct(marketCycles, prod, corporation);\n }\n }\n }\n return [revenue, expenses];\n }\n\n //Processes FINISHED products\n processProduct(marketCycles = 1, product: Product, corporation: ICorporation): number {\n let totalProfit = 0;\n for (let i = 0; i < CorporationConstants.Cities.length; ++i) {\n const city = CorporationConstants.Cities[i];\n const office = this.offices[city];\n if (office === 0) continue;\n const warehouse = this.warehouses[city];\n if (warehouse instanceof Warehouse) {\n switch (this.state) {\n case \"PRODUCTION\": {\n //Calculate the maximum production of this material based\n //on the office's productivity\n const maxProd =\n this.getOfficeProductivity(office, { forProduct: true }) *\n corporation.getProductionMultiplier() *\n this.prodMult * // Multiplier from materials\n this.getProductionMultiplier() * // Multiplier from research\n this.getProductProductionMultiplier(); // Multiplier from research\n let prod;\n\n //Account for whether production is manually limited\n if (product.prdman[city][0]) {\n prod = Math.min(maxProd, product.prdman[city][1]);\n } else {\n prod = maxProd;\n }\n prod *= CorporationConstants.SecsPerMarketCycle * marketCycles;\n\n //Calculate net change in warehouse storage making the Products will cost\n let netStorageSize = product.siz;\n for (const reqMatName in product.reqMats) {\n if (product.reqMats.hasOwnProperty(reqMatName)) {\n const normQty = product.reqMats[reqMatName];\n netStorageSize -= MaterialSizes[reqMatName] * normQty;\n }\n }\n\n //If there's not enough space in warehouse, limit the amount of Product\n if (netStorageSize > 0) {\n const maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / netStorageSize);\n prod = Math.min(maxAmt, prod);\n }\n\n warehouse.smartSupplyStore += prod / (CorporationConstants.SecsPerMarketCycle * marketCycles);\n\n //Make sure we have enough resources to make our Products\n let producableFrac = 1;\n for (const reqMatName in product.reqMats) {\n if (product.reqMats.hasOwnProperty(reqMatName)) {\n const req = product.reqMats[reqMatName] * prod;\n if (warehouse.materials[reqMatName].qty < req) {\n producableFrac = Math.min(producableFrac, warehouse.materials[reqMatName].qty / req);\n }\n }\n }\n\n //Make our Products if they are producable\n if (producableFrac > 0 && prod > 0) {\n for (const reqMatName in product.reqMats) {\n if (product.reqMats.hasOwnProperty(reqMatName)) {\n const reqMatQtyNeeded = product.reqMats[reqMatName] * prod * producableFrac;\n warehouse.materials[reqMatName].qty -= reqMatQtyNeeded;\n warehouse.materials[reqMatName].prd -=\n reqMatQtyNeeded / (CorporationConstants.SecsPerMarketCycle * marketCycles);\n }\n }\n //Quantity\n product.data[city][0] += prod * producableFrac;\n }\n\n //Keep track of production Per second\n product.data[city][1] = (prod * producableFrac) / (CorporationConstants.SecsPerMarketCycle * marketCycles);\n break;\n }\n case \"SALE\": {\n //Process sale of Products\n product.pCost = 0; //Estimated production cost\n for (const reqMatName in product.reqMats) {\n if (product.reqMats.hasOwnProperty(reqMatName)) {\n product.pCost += product.reqMats[reqMatName] * warehouse.materials[reqMatName].bCost;\n }\n }\n\n // Since its a product, its production cost is increased for labor\n product.pCost *= CorporationConstants.ProductProductionCostRatio;\n\n // Sale multipliers\n const businessFactor = this.getBusinessFactor(office); //Business employee productivity\n const advertisingFactor = this.getAdvertisingFactors()[0]; //Awareness + popularity\n const marketFactor = this.getMarketFactor(product); //Competition + demand\n\n // Calculate Sale Cost (sCost), which could be dynamically evaluated\n const markupLimit = product.rat / product.mku;\n let sCost;\n if (product.marketTa2) {\n const prod = product.data[city][1];\n\n // Reverse engineer the 'maxSell' formula\n // 1. Set 'maxSell' = prod\n // 2. Substitute formula for 'markup'\n // 3. Solve for 'sCost'roduct.pCost = sCost\n const numerator = markupLimit;\n const sqrtNumerator = prod;\n const sqrtDenominator =\n 0.5 *\n Math.pow(product.rat, 0.65) *\n marketFactor *\n corporation.getSalesMultiplier() *\n businessFactor *\n advertisingFactor *\n this.getSalesMultiplier();\n const denominator = Math.sqrt(sqrtNumerator / sqrtDenominator);\n let optimalPrice;\n if (sqrtDenominator === 0 || denominator === 0) {\n if (sqrtNumerator === 0) {\n optimalPrice = 0; // No production\n } else {\n optimalPrice = product.pCost + markupLimit;\n console.warn(`In Corporation, found illegal 0s when trying to calculate MarketTA2 sale cost`);\n }\n } else {\n optimalPrice = numerator / denominator + product.pCost;\n }\n\n // Store this \"optimal Price\" in a property so we don't have to re-calculate for UI\n product.marketTa2Price[city] = optimalPrice;\n sCost = optimalPrice;\n } else if (product.marketTa1) {\n sCost = product.pCost + markupLimit;\n } else if (isString(product.sCost)) {\n const sCostString = product.sCost as string;\n if (product.mku === 0) {\n console.error(`mku is zero, reverting to 1 to avoid Infinity`);\n product.mku = 1;\n }\n sCost = sCostString.replace(/MP/g, product.pCost + product.rat / product.mku + \"\");\n sCost = eval(sCost);\n } else {\n sCost = product.sCost;\n }\n\n let markup = 1;\n if (sCost > product.pCost) {\n if (sCost - product.pCost > markupLimit) {\n markup = markupLimit / (sCost - product.pCost);\n }\n }\n\n const maxSell =\n 0.5 *\n Math.pow(product.rat, 0.65) *\n marketFactor *\n corporation.getSalesMultiplier() *\n Math.pow(markup, 2) *\n businessFactor *\n advertisingFactor *\n this.getSalesMultiplier();\n let sellAmt;\n if (product.sllman[city][0] && isString(product.sllman[city][1])) {\n //Sell amount is dynamically evaluated\n let tmp = product.sllman[city][1].replace(/MAX/g, maxSell);\n tmp = tmp.replace(/PROD/g, product.data[city][1]);\n try {\n tmp = eval(tmp);\n } catch (e) {\n dialogBoxCreate(\n \"Error evaluating your sell price expression for \" +\n product.name +\n \" in \" +\n this.name +\n \"'s \" +\n city +\n \" office. Sell price is being set to MAX\",\n );\n tmp = maxSell;\n }\n sellAmt = Math.min(maxSell, tmp);\n } else if (product.sllman[city][0] && product.sllman[city][1] > 0) {\n //Sell amount is manually limited\n sellAmt = Math.min(maxSell, product.sllman[city][1]);\n } else if (product.sllman[city][0] === false) {\n sellAmt = 0;\n } else {\n sellAmt = maxSell;\n }\n if (sellAmt < 0) {\n sellAmt = 0;\n }\n sellAmt = sellAmt * CorporationConstants.SecsPerMarketCycle * marketCycles;\n sellAmt = Math.min(product.data[city][0], sellAmt); //data[0] is qty\n if (sellAmt && sCost) {\n product.data[city][0] -= sellAmt; //data[0] is qty\n totalProfit += sellAmt * sCost;\n product.data[city][2] = sellAmt / (CorporationConstants.SecsPerMarketCycle * marketCycles); //data[2] is sell property\n } else {\n product.data[city][2] = 0; //data[2] is sell property\n }\n break;\n }\n case \"START\":\n case \"PURCHASE\":\n case \"EXPORT\":\n break;\n default:\n console.error(`Invalid State: ${this.state}`);\n break;\n } //End switch(this.state)\n }\n }\n return totalProfit;\n }\n\n discontinueProduct(product: Product): void {\n for (const productName in this.products) {\n if (this.products.hasOwnProperty(productName)) {\n if (product === this.products[productName]) {\n delete this.products[productName];\n }\n }\n }\n }\n\n upgrade(upgrade: IndustryUpgrade, refs: { corporation: ICorporation; office: OfficeSpace }): void {\n const corporation = refs.corporation;\n const office = refs.office;\n const upgN = upgrade[0];\n while (this.upgrades.length <= upgN) {\n this.upgrades.push(0);\n }\n ++this.upgrades[upgN];\n\n switch (upgN) {\n case 0: {\n //Coffee, 5% energy per employee\n for (let i = 0; i < office.employees.length; ++i) {\n office.employees[i].ene = Math.min(office.employees[i].ene * 1.05, office.maxEne);\n }\n break;\n }\n case 1: {\n //AdVert.Inc,\n const advMult = corporation.getAdvertisingMultiplier() * this.getAdvertisingMultiplier();\n this.awareness += 3 * advMult;\n this.popularity += 1 * advMult;\n this.awareness *= 1.01 * advMult;\n this.popularity *= (1 + getRandomInt(1, 3) / 100) * advMult;\n break;\n }\n default: {\n console.error(`Un-implemented function index: ${upgN}`);\n break;\n }\n }\n }\n\n // Returns how much of a material can be produced based of office productivity (employee stats)\n getOfficeProductivity(office: OfficeSpace, params: { forProduct?: boolean } = {}): number {\n const opProd = office.employeeProd[EmployeePositions.Operations];\n const engrProd = office.employeeProd[EmployeePositions.Engineer];\n const mgmtProd = office.employeeProd[EmployeePositions.Management];\n const total = opProd + engrProd + mgmtProd;\n\n if (total <= 0) return 0;\n\n // Management is a multiplier for the production from Operations and Engineers\n const mgmtFactor = 1 + mgmtProd / (1.2 * total);\n\n // For production, Operations is slightly more important than engineering\n // Both Engineering and Operations have diminishing returns\n const prod = (Math.pow(opProd, 0.4) + Math.pow(engrProd, 0.3)) * mgmtFactor;\n\n // Generic multiplier for the production. Used for game-balancing purposes\n const balancingMult = 0.05;\n\n if (params && params.forProduct) {\n // Products are harder to create and therefore have less production\n return 0.5 * balancingMult * prod;\n } else {\n return balancingMult * prod;\n }\n }\n\n // Returns a multiplier based on the office' 'Business' employees that affects sales\n getBusinessFactor(office: OfficeSpace): number {\n const businessProd = 1 + office.employeeProd[EmployeePositions.Business];\n\n return calculateEffectWithFactors(businessProd, 0.26, 10e3);\n }\n\n //Returns a set of multipliers based on the Industry's awareness, popularity, and advFac. This\n //multiplier affects sales. The result is:\n // [Total sales mult, total awareness mult, total pop mult, awareness/pop ratio mult]\n getAdvertisingFactors(): [number, number, number, number] {\n const awarenessFac = Math.pow(this.awareness + 1, this.advFac);\n const popularityFac = Math.pow(this.popularity + 1, this.advFac);\n const ratioFac = this.awareness === 0 ? 0.01 : Math.max((this.popularity + 0.001) / this.awareness, 0.01);\n const totalFac = Math.pow(awarenessFac * popularityFac * ratioFac, 0.85);\n return [totalFac, awarenessFac, popularityFac, ratioFac];\n }\n\n //Returns a multiplier based on a materials demand and competition that affects sales\n getMarketFactor(mat: { dmd: number; cmp: number }): number {\n return Math.max(0.1, (mat.dmd * (100 - mat.cmp)) / 100);\n }\n\n // Returns a boolean indicating whether this Industry has the specified Research\n hasResearch(name: string): boolean {\n return this.researched[name] === true;\n }\n\n updateResearchTree(): void {\n const researchTree = IndustryResearchTrees[this.type];\n if (researchTree === undefined) throw new Error(`Invalid industry \"${this.type}\"`);\n\n // Since ResearchTree data isnt saved, we'll update the Research Tree data\n // based on the stored 'researched' property in the Industry object\n if (Object.keys(researchTree.researched).length !== Object.keys(this.researched).length) {\n for (const research in this.researched) {\n researchTree.research(research);\n }\n }\n }\n\n // Get multipliers from Research\n getAdvertisingMultiplier(): number {\n const researchTree = IndustryResearchTrees[this.type];\n if (researchTree === undefined) throw new Error(`Invalid industry: \"${this.type}\"`);\n this.updateResearchTree();\n return researchTree.getAdvertisingMultiplier();\n }\n\n getEmployeeChaMultiplier(): number {\n const researchTree = IndustryResearchTrees[this.type];\n if (researchTree === undefined) throw new Error(`Invalid industry: \"${this.type}\"`);\n this.updateResearchTree();\n return researchTree.getEmployeeChaMultiplier();\n }\n\n getEmployeeCreMultiplier(): number {\n const researchTree = IndustryResearchTrees[this.type];\n if (researchTree === undefined) throw new Error(`Invalid industry: \"${this.type}\"`);\n this.updateResearchTree();\n return researchTree.getEmployeeCreMultiplier();\n }\n\n getEmployeeEffMultiplier(): number {\n const researchTree = IndustryResearchTrees[this.type];\n if (researchTree === undefined) throw new Error(`Invalid industry: \"${this.type}\"`);\n this.updateResearchTree();\n return researchTree.getEmployeeEffMultiplier();\n }\n\n getEmployeeIntMultiplier(): number {\n const researchTree = IndustryResearchTrees[this.type];\n if (researchTree === undefined) throw new Error(`Invalid industry: \"${this.type}\"`);\n this.updateResearchTree();\n return researchTree.getEmployeeIntMultiplier();\n }\n\n getProductionMultiplier(): number {\n const researchTree = IndustryResearchTrees[this.type];\n if (researchTree === undefined) throw new Error(`Invalid industry: \"${this.type}\"`);\n this.updateResearchTree();\n return researchTree.getProductionMultiplier();\n }\n\n getProductProductionMultiplier(): number {\n const researchTree = IndustryResearchTrees[this.type];\n if (researchTree === undefined) throw new Error(`Invalid industry: \"${this.type}\"`);\n this.updateResearchTree();\n return researchTree.getProductProductionMultiplier();\n }\n\n getSalesMultiplier(): number {\n const researchTree = IndustryResearchTrees[this.type];\n if (researchTree === undefined) throw new Error(`Invalid industry: \"${this.type}\"`);\n this.updateResearchTree();\n return researchTree.getSalesMultiplier();\n }\n\n getScientificResearchMultiplier(): number {\n const researchTree = IndustryResearchTrees[this.type];\n if (researchTree === undefined) throw new Error(`Invalid industry: \"${this.type}\"`);\n this.updateResearchTree();\n return researchTree.getScientificResearchMultiplier();\n }\n\n getStorageMultiplier(): number {\n const researchTree = IndustryResearchTrees[this.type];\n if (researchTree === undefined) throw new Error(`Invalid industry: \"${this.type}\"`);\n this.updateResearchTree();\n return researchTree.getStorageMultiplier();\n }\n\n copy(): Industry {\n // products: { [key: string]: Product | undefined } = {};\n\n // //Maps locations to warehouses. 0 if no warehouse at that location\n // warehouses: { [key: string]: Warehouse | 0 };\n\n // //Maps locations to offices. 0 if no office at that location\n // offices: { [key: string]: OfficeSpace | 0 } = {\n // [CityName.Aevum]: 0,\n // [CityName.Chongqing]: 0,\n // [CityName.Sector12]: new OfficeSpace({\n // loc: CityName.Sector12,\n // size: CorporationConstants.OfficeInitialSize,\n // }),\n // [CityName.NewTokyo]: 0,\n // [CityName.Ishima]: 0,\n // [CityName.Volhaven]: 0,\n // };\n\n const division = new Industry();\n division.sciResearch = this.sciResearch.copy();\n division.researched = {};\n for (const x of Object.keys(this.researched)) {\n division.researched[x] = this.researched[x];\n }\n division.reqMats = {};\n for (const x of Object.keys(this.reqMats)) {\n division.reqMats[x] = this.reqMats[x];\n }\n division.name = this.name;\n division.type = this.type;\n division.makesProducts = this.makesProducts;\n division.awareness = this.awareness;\n division.popularity = this.popularity;\n division.startingCost = this.startingCost;\n division.reFac = this.reFac;\n division.sciFac = this.sciFac;\n division.hwFac = this.hwFac;\n division.robFac = this.robFac;\n division.aiFac = this.aiFac;\n division.advFac = this.advFac;\n division.prodMult = this.prodMult;\n division.state = this.state;\n division.newInd = this.newInd;\n division.lastCycleRevenue = this.lastCycleRevenue.plus(0);\n division.lastCycleExpenses = this.lastCycleExpenses.plus(0);\n division.thisCycleRevenue = this.thisCycleRevenue.plus(0);\n division.thisCycleExpenses = this.thisCycleExpenses.plus(0);\n division.upgrades = this.upgrades.slice();\n division.prodMats = this.prodMats.slice();\n return division;\n }\n\n /**\n * Serialize the current object to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"Industry\", this);\n }\n\n /**\n * Initiatizes a Industry object from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Industry {\n return Generic_fromJSON(Industry, value.data);\n }\n}\n\nReviver.constructors.Industry = Industry;\n","/**\n * This is a component that implements a mathematical formula used commonly throughout the\n * game. This formula is (typically) used to calculate the effect that various statistics\n * have on a game mechanic. It looks something like:\n *\n * (stat ^ exponential factor) + (stat / linear factor)\n *\n * where the exponential factor is a number between 0 and 1 and the linear factor\n * is typically a relatively larger number.\n *\n * This formula ensures that the effects of the statistic that is being processed\n * has diminishing returns, but never loses its effectiveness as you continue\n * to raise it.\n */\nexport function calculateEffectWithFactors(n: number, expFac: number, linearFac: number): number {\n if (expFac <= 0 || expFac >= 1) {\n console.warn(`Exponential factor is ${expFac}. This is not an intended value for it`);\n }\n if (linearFac < 1) {\n console.warn(`Linear factor is ${linearFac}. This is not an intended value for it`);\n }\n\n return Math.pow(n, expFac) + n / linearFac;\n}\n","import { Industries } from \"./IndustryData\";\nimport { IMap } from \"../types\";\n\nexport interface IProductRatingWeight {\n Aesthetics?: number;\n Durability?: number;\n Features?: number;\n Quality?: number;\n Performance?: number;\n Reliability?: number;\n}\n\nexport const ProductRatingWeights: IMap = {\n [Industries.Food]: {\n Quality: 0.7,\n Durability: 0.1,\n Aesthetics: 0.2,\n },\n [Industries.Tobacco]: {\n Quality: 0.4,\n Durability: 0.2,\n Reliability: 0.2,\n Aesthetics: 0.2,\n },\n [Industries.Pharmaceutical]: {\n Quality: 0.2,\n Performance: 0.2,\n Durability: 0.1,\n Reliability: 0.3,\n Features: 0.2,\n },\n [Industries.Computer]: {\n Quality: 0.15,\n Performance: 0.25,\n Durability: 0.25,\n Reliability: 0.2,\n Aesthetics: 0.05,\n Features: 0.1,\n },\n Computer: {\n //Repeat\n Quality: 0.15,\n Performance: 0.25,\n Durability: 0.25,\n Reliability: 0.2,\n Aesthetics: 0.05,\n Features: 0.1,\n },\n [Industries.Robotics]: {\n Quality: 0.1,\n Performance: 0.2,\n Durability: 0.2,\n Reliability: 0.2,\n Aesthetics: 0.1,\n Features: 0.2,\n },\n [Industries.Software]: {\n Quality: 0.2,\n Performance: 0.2,\n Reliability: 0.2,\n Durability: 0.2,\n Features: 0.2,\n },\n [Industries.Healthcare]: {\n Quality: 0.4,\n Performance: 0.1,\n Durability: 0.1,\n Reliability: 0.3,\n Features: 0.1,\n },\n [Industries.RealEstate]: {\n Quality: 0.2,\n Durability: 0.25,\n Reliability: 0.1,\n Aesthetics: 0.35,\n Features: 0.1,\n },\n};\n","// React Component for the element that contains the actual info/data\n// for the Corporation UI. This panel lies below the header tabs and will\n// be filled with whatever is needed based on the routing/navigation\nimport React from \"react\";\n\nimport { CityTabs } from \"./CityTabs\";\nimport { IIndustry } from \"../IIndustry\";\nimport { Overview } from \"./Overview\";\n\nimport { CityName } from \"../../Locations/data/CityNames\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { ICorporation } from \"../ICorporation\";\n\ninterface IProps {\n corp: ICorporation;\n player: IPlayer;\n divisionName: string;\n rerender: () => void;\n}\n\nexport function MainPanel(props: IProps): React.ReactElement {\n const division =\n props.divisionName !== \"Overview\"\n ? props.corp.divisions.find((division: IIndustry) => division.name === props.divisionName)\n : undefined; // use undefined because find returns undefined\n\n if (division === undefined) {\n return (\n
    \n \n
    \n );\n } else {\n return (\n
    \n \n
    \n );\n }\n}\n","// React Components for the Corporation UI's City navigation tabs\n// These allow player to navigate between different cities for each industry\nimport React, { useState } from \"react\";\nimport { CityTab } from \"./CityTab\";\nimport { ExpandNewCityPopup } from \"./ExpandNewCityPopup\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IIndustry } from \"../IIndustry\";\nimport { OfficeSpace } from \"../OfficeSpace\";\nimport { Industry } from \"./Industry\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IExpandButtonProps {\n corp: ICorporation;\n division: IIndustry;\n setCity: (name: string) => void;\n}\n\nfunction ExpandButton(props: IExpandButtonProps): React.ReactElement {\n function openExpandNewCityModal(): void {\n const popupId = \"cmpy-mgmt-expand-city-popup\";\n createPopup(popupId, ExpandNewCityPopup, {\n popupId: popupId,\n corp: props.corp,\n division: props.division,\n cityStateSetter: props.setCity,\n });\n }\n\n const possibleCities = Object.keys(props.division.offices).filter(\n (cityName: string) => props.division.offices[cityName] === 0,\n );\n if (possibleCities.length === 0) return <>;\n\n return (\n \n );\n}\n\ninterface IProps {\n city: string;\n division: IIndustry;\n corp: ICorporation;\n player: IPlayer;\n rerender: () => void;\n}\n\nexport function CityTabs(props: IProps): React.ReactElement {\n const [city, setCity] = useState(props.city);\n\n const office = props.division.offices[city];\n if (office === 0) {\n setCity(\"Sector-12\");\n return <>;\n }\n\n return (\n <>\n {Object.values(props.division.offices).map(\n (office: OfficeSpace | 0) => office !== 0 && (\n setCity(office.loc)}\n />\n ),\n )}\n \n \n \n );\n}\n","import React, { useRef } from \"react\";\nimport { IIndustry } from \"../IIndustry\";\nimport { CorporationConstants } from \"../data/Constants\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { ICorporation } from \"../ICorporation\";\nimport { NewCity } from \"../Actions\";\nimport { MoneyCost } from \"./MoneyCost\";\n\ninterface IProps {\n popupId: string;\n corp: ICorporation;\n division: IIndustry;\n cityStateSetter: (city: string) => void;\n}\n\nexport function ExpandNewCityPopup(props: IProps): React.ReactElement {\n const dropdown = useRef(null);\n\n function expand(): void {\n if (dropdown.current === null) return;\n try {\n NewCity(props.corp, props.division, dropdown.current.value);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n return;\n }\n\n dialogBoxCreate(`Opened a new office in ${dropdown.current.value}!`);\n\n props.cityStateSetter(dropdown.current.value);\n removePopup(props.popupId);\n }\n return (\n <>\n

    \n Would you like to expand into a new city by opening an office? This would cost{\" \"}\n \n

    \n \n \n Confirm\n \n \n );\n}\n","// React Component for managing the Corporation's Industry UI\n// This Industry component does NOT include the city tabs at the top\nimport React from \"react\";\n\nimport { IndustryOffice } from \"./IndustryOffice\";\nimport { IndustryOverview } from \"./IndustryOverview\";\nimport { IndustryWarehouse } from \"./IndustryWarehouse\";\nimport { Warehouse } from \"../Warehouse\";\nimport { ICorporation } from \"../ICorporation\";\nimport { OfficeSpace } from \"../OfficeSpace\";\nimport { IIndustry } from \"../IIndustry\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n corp: ICorporation;\n division: IIndustry;\n city: string;\n warehouse: Warehouse | 0;\n office: OfficeSpace;\n player: IPlayer;\n rerender: () => void;\n}\n\nexport function Industry(props: IProps): React.ReactElement {\n return (\n
    \n
    \n \n \n
    \n
    \n \n
    \n
    \n );\n}\n","// React Component for displaying an Industry's OfficeSpace information\n// (bottom-left panel in the Industry UI)\nimport React, { useState } from \"react\";\n\nimport { OfficeSpace } from \"../OfficeSpace\";\nimport { IIndustry } from \"../IIndustry\";\nimport { Employee } from \"../Employee\";\nimport { EmployeePositions } from \"../EmployeePositions\";\n\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\n\nimport { getSelectText } from \"../../../utils/uiHelpers/getSelectData\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { UpgradeOfficeSizePopup } from \"./UpgradeOfficeSizePopup\";\nimport { HireEmployeePopup } from \"./HireEmployeePopup\";\nimport { ThrowPartyPopup } from \"./ThrowPartyPopup\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { Money } from \"../../ui/React/Money\";\n\ninterface IProps {\n corp: ICorporation;\n division: IIndustry;\n office: OfficeSpace;\n player: IPlayer;\n rerender: () => void;\n}\n\nfunction countEmployee(employees: Employee[], job: string): number {\n let n = 0;\n for (let i = 0; i < employees.length; ++i) {\n if (employees[i].pos === job) n++;\n }\n return n;\n}\n\ninterface ISwitchProps {\n manualMode: boolean;\n switchMode: (f: (b: boolean) => boolean) => void;\n}\n\nfunction SwitchButton(props: ISwitchProps): React.ReactElement {\n if (props.manualMode) {\n return (\n \n );\n } else {\n return (\n \n );\n }\n}\n\nfunction ManualManagement(props: IProps): React.ReactElement {\n const [employee, setEmployee] = useState(\n props.office.employees.length > 0 ? props.office.employees[0] : null,\n );\n\n const employeeInfoDivStyle = {\n color: \"white\",\n margin: \"4px\",\n padding: \"4px\",\n };\n\n // Employee Selector\n const employees = [];\n for (let i = 0; i < props.office.employees.length; ++i) {\n employees.push();\n }\n\n function employeeSelectorOnChange(e: React.ChangeEvent): void {\n const name = getSelectText(e.target);\n for (let i = 0; i < props.office.employees.length; ++i) {\n if (name === props.office.employees[i].name) {\n setEmployee(props.office.employees[i]);\n break;\n }\n }\n\n props.rerender();\n }\n\n // Employee Positions Selector\n const emp = employee;\n let employeePositionSelectorInitialValue = \"\";\n const employeePositions = [];\n const positionNames = Object.values(EmployeePositions);\n for (let i = 0; i < positionNames.length; ++i) {\n employeePositions.push(\n ,\n );\n if (emp != null && emp.pos === positionNames[i]) {\n employeePositionSelectorInitialValue = positionNames[i];\n }\n }\n\n function employeePositionSelectorOnChange(e: React.ChangeEvent): void {\n if (employee === null) return;\n const pos = getSelectText(e.target);\n employee.pos = pos;\n props.rerender();\n }\n\n // Numeraljs formatter\n const nf = \"0.000\";\n\n // Employee stats (after applying multipliers)\n const effCre = emp ? emp.cre * props.corp.getEmployeeCreMultiplier() * props.division.getEmployeeCreMultiplier() : 0;\n const effCha = emp ? emp.cha * props.corp.getEmployeeChaMultiplier() * props.division.getEmployeeChaMultiplier() : 0;\n const effInt = emp ? emp.int * props.corp.getEmployeeIntMultiplier() * props.division.getEmployeeIntMultiplier() : 0;\n const effEff = emp ? emp.eff * props.corp.getEmployeeEffMultiplier() * props.division.getEmployeeEffMultiplier() : 0;\n\n return (\n
    \n \n {employee != null && (\n

    \n Morale: {numeralWrapper.format(employee.mor, nf)}\n
    \n Happiness: {numeralWrapper.format(employee.hap, nf)}\n
    \n Energy: {numeralWrapper.format(employee.ene, nf)}\n
    \n Intelligence: {numeralWrapper.format(effInt, nf)}\n
    \n Charisma: {numeralWrapper.format(effCha, nf)}\n
    \n Experience: {numeralWrapper.format(employee.exp, nf)}\n
    \n Creativity: {numeralWrapper.format(effCre, nf)}\n
    \n Efficiency: {numeralWrapper.format(effEff, nf)}\n
    \n Salary: \n

    \n )}\n {employee != null && (\n \n {employeePositions}\n \n )}\n
    \n );\n}\n\ninterface IAutoAssignProps {\n office: OfficeSpace;\n corp: ICorporation;\n division: IIndustry;\n player: IPlayer;\n job: string;\n desc: string;\n rerender: () => void;\n}\n\nfunction AutoAssignJob(props: IAutoAssignProps): React.ReactElement {\n const numJob = countEmployee(props.office.employees, props.job);\n const numUnassigned = countEmployee(props.office.employees, EmployeePositions.Unassigned);\n function assignEmployee(): void {\n if (numUnassigned <= 0) {\n console.warn(\"Cannot assign employee. No unassigned employees available\");\n return;\n }\n\n props.office.assignEmployeeToJob(props.job);\n props.office.calculateEmployeeProductivity(props.corp, props.division);\n props.rerender();\n }\n\n function unassignEmployee(): void {\n props.office.unassignEmployeeFromJob(props.job);\n props.office.calculateEmployeeProductivity(props.corp, props.division);\n props.rerender();\n }\n const positionHeaderStyle = {\n fontSize: \"15px\",\n margin: \"5px 0px 5px 0px\",\n width: \"50%\",\n };\n return (\n <>\n

    \n {props.job} ({numJob}){props.desc}\n

    \n \n \n
    \n \n );\n}\n\nfunction AutoManagement(props: IProps): React.ReactElement {\n const numUnassigned = countEmployee(props.office.employees, EmployeePositions.Unassigned);\n const vechain = props.corp.unlockUpgrades[4] === 1; // Has Vechain upgrade\n\n // Calculate average morale, happiness, and energy. Also salary\n // TODO is this efficient?\n let totalMorale = 0,\n totalHappiness = 0,\n totalEnergy = 0,\n totalSalary = 0;\n for (let i = 0; i < props.office.employees.length; ++i) {\n totalMorale += props.office.employees[i].mor;\n totalHappiness += props.office.employees[i].hap;\n totalEnergy += props.office.employees[i].ene;\n totalSalary += props.office.employees[i].sal;\n }\n\n let avgMorale = 0,\n avgHappiness = 0,\n avgEnergy = 0;\n if (props.office.employees.length > 0) {\n avgMorale = totalMorale / props.office.employees.length;\n avgHappiness = totalHappiness / props.office.employees.length;\n avgEnergy = totalEnergy / props.office.employees.length;\n }\n\n return (\n <>\n

    \n Unassigned Employees: {numUnassigned}\n

    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n {vechain && (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n )}\n \n
    \n

    Avg Employee Morale:

    \n
    \n

    {numeralWrapper.format(avgMorale, \"0.000\")}

    \n
    \n

    Avg Employee Happiness:

    \n
    \n

    {numeralWrapper.format(avgHappiness, \"0.000\")}

    \n
    \n

    Avg Employee Energy:

    \n
    \n

    {numeralWrapper.format(avgEnergy, \"0.000\")}

    \n
    \n

    Total Employee Salary:

    \n
    \n

    \n \n

    \n
    \n

    \n Material Production:\n \n The base amount of material this office can produce. Does not include production multipliers from\n upgrades and materials. This value is based off the productivity of your Operations, Engineering,\n and Management employees\n \n

    \n
    \n

    {numeralWrapper.format(props.division.getOfficeProductivity(props.office), \"0.000\")}

    \n
    \n

    \n Product Production:\n \n The base amount of any given Product this office can produce. Does not include production\n multipliers from upgrades and materials. This value is based off the productivity of your\n Operations, Engineering, and Management employees\n \n

    \n
    \n

    \n {numeralWrapper.format(\n props.division.getOfficeProductivity(props.office, {\n forProduct: true,\n }),\n \"0.000\",\n )}\n

    \n
    \n

    \n Business Multiplier:\n \n The effect this office's 'Business' employees has on boosting sales\n \n

    \n
    \n

    x{numeralWrapper.format(props.division.getBusinessFactor(props.office), \"0.000\")}

    \n
    \n \n\n \n\n \n\n \n\n \n\n \n \n );\n}\n\nexport function IndustryOffice(props: IProps): React.ReactElement {\n const [employeeManualAssignMode, setEmployeeManualAssignMode] = useState(false);\n\n const buttonStyle = {\n fontSize: \"13px\",\n };\n\n // Hire Employee button\n let hireEmployeeButtonClass = \"tooltip\";\n if (props.office.atCapacity()) {\n hireEmployeeButtonClass += \" a-link-button-inactive\";\n } else {\n hireEmployeeButtonClass += \" std-button\";\n if (props.office.employees.length === 0) {\n hireEmployeeButtonClass += \" flashing-button\";\n }\n }\n\n function openHireEmployeePopup(): void {\n const popupId = \"cmpy-mgmt-hire-employee-popup\";\n createPopup(popupId, HireEmployeePopup, {\n rerender: props.rerender,\n office: props.office,\n corp: props.corp,\n popupId: popupId,\n player: props.player,\n });\n }\n\n // Autohire employee button\n let autohireEmployeeButtonClass = \"tooltip\";\n if (props.office.atCapacity()) {\n autohireEmployeeButtonClass += \" a-link-button-inactive\";\n } else {\n autohireEmployeeButtonClass += \" std-button\";\n }\n function autohireEmployeeButtonOnClick(): void {\n if (props.office.atCapacity()) return;\n props.office.hireRandomEmployee();\n props.rerender();\n }\n\n function openUpgradeOfficeSizePopup(): void {\n const popupId = \"cmpy-mgmt-upgrade-office-size-popup\";\n createPopup(popupId, UpgradeOfficeSizePopup, {\n rerender: props.rerender,\n office: props.office,\n corp: props.corp,\n popupId: popupId,\n player: props.player,\n });\n }\n\n function openThrowPartyPopup(): void {\n const popupId = \"cmpy-mgmt-throw-office-party-popup\";\n createPopup(popupId, ThrowPartyPopup, {\n office: props.office,\n corp: props.corp,\n popupId: popupId,\n });\n }\n\n return (\n
    \n

    Office Space

    \n

    \n Size: {props.office.employees.length} / {props.office.size} employees\n

    \n \n \n
    \n \n Upgrade size\n Upgrade the office's size so that it can hold more employees!\n \n {!props.division.hasResearch(\"AutoPartyManager\") && (\n \n Throw Party\n \n \"Throw an office party to increase your employee's morale and happiness\"\n \n \n )}\n
    \n\n
    \n \n
    \n {employeeManualAssignMode ? (\n \n ) : (\n \n )}\n
    \n );\n}\n","import React from \"react\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { CorporationConstants } from \"../data/Constants\";\nimport { OfficeSpace } from \"../OfficeSpace\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { UpgradeOfficeSize } from \"../Actions\";\n\ninterface IProps {\n office: OfficeSpace;\n corp: ICorporation;\n popupId: string;\n player: IPlayer;\n rerender: () => void;\n}\n\nexport function UpgradeOfficeSizePopup(props: IProps): React.ReactElement {\n const initialPriceMult = Math.round(props.office.size / CorporationConstants.OfficeInitialSize);\n const costMultiplier = 1.09;\n const upgradeCost = CorporationConstants.OfficeInitialCost * Math.pow(costMultiplier, initialPriceMult);\n\n // Calculate cost to upgrade size by 15 employees\n let mult = 0;\n for (let i = 0; i < 5; ++i) {\n mult += Math.pow(costMultiplier, initialPriceMult + i);\n }\n const upgradeCost15 = CorporationConstants.OfficeInitialCost * mult;\n\n //Calculate max upgrade size and cost\n const maxMult = props.corp.funds.dividedBy(CorporationConstants.OfficeInitialCost).toNumber();\n let maxNum = 1;\n mult = Math.pow(costMultiplier, initialPriceMult);\n while (maxNum < 50) {\n //Hard cap of 50x (extra 150 employees)\n if (mult >= maxMult) break;\n const multIncrease = Math.pow(costMultiplier, initialPriceMult + maxNum);\n if (mult + multIncrease > maxMult) {\n break;\n } else {\n mult += multIncrease;\n }\n ++maxNum;\n }\n const upgradeCostMax = CorporationConstants.OfficeInitialCost * mult;\n\n function upgradeSize(cost: number, size: number): void {\n if (props.corp.funds.lt(cost)) {\n dialogBoxCreate(\"You don't have enough company funds to purchase this upgrade!\");\n } else {\n UpgradeOfficeSize(props.corp, props.office, size);\n dialogBoxCreate(\"Office space increased! It can now hold \" + props.office.size + \" employees\");\n props.rerender();\n }\n removePopup(props.popupId);\n }\n\n interface IUpgradeButton {\n cost: number;\n size: number;\n corp: ICorporation;\n }\n\n function UpgradeSizeButton(props: IUpgradeButton): React.ReactElement {\n return (\n upgradeSize(props.cost, props.size)}\n >\n by {props.size}\n {numeralWrapper.formatMoney(props.cost)}\n \n );\n }\n\n return (\n <>\n

    Increase the size of your office space to fit additional employees!

    \n

    Upgrade size:

    \n \n \n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { createPopup, removePopup } from \"../../ui/React/createPopup\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { CorporationConstants } from \"../data/Constants\";\nimport { ICorporation } from \"../ICorporation\";\nimport { OfficeSpace } from \"../OfficeSpace\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { getRandomInt } from \"../../../utils/helpers/getRandomInt\";\nimport { formatNumber } from \"../../../utils/StringHelperFunctions\";\nimport { Employee } from \"../Employee\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\n\ninterface INameEmployeeProps {\n office: OfficeSpace;\n corp: ICorporation;\n popupId: string;\n employee: Employee;\n player: IPlayer;\n rerender: () => void;\n}\n\nfunction NameEmployeePopup(props: INameEmployeeProps): React.ReactElement {\n const [name, setName] = useState(\"\");\n function nameEmployee(): void {\n for (let i = 0; i < props.office.employees.length; ++i) {\n if (props.office.employees[i].name === name) {\n dialogBoxCreate(\"You already have an employee with this nickname!\");\n return;\n }\n }\n props.employee.name = name;\n props.office.employees.push(props.employee);\n props.rerender();\n removePopup(props.popupId);\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) nameEmployee();\n }\n\n function onChange(event: React.ChangeEvent): void {\n setName(event.target.value);\n }\n\n return (\n <>\n

    Give your employee a nickname!

    \n \n \n \n );\n}\n\ninterface IHireEmployeeProps {\n employee: Employee;\n office: OfficeSpace;\n popupId: string;\n player: IPlayer;\n corp: ICorporation;\n rerender: () => void;\n}\n\nfunction HireEmployeeButton(props: IHireEmployeeProps): React.ReactElement {\n function hire(): void {\n const popupId = \"cmpy-mgmt-name-employee-popup\";\n createPopup(popupId, NameEmployeePopup, {\n rerender: props.rerender,\n office: props.office,\n corp: props.corp,\n popupId: popupId,\n player: props.player,\n employee: props.employee,\n });\n removePopup(props.popupId);\n }\n\n return (\n
    \n Intelligence: {formatNumber(props.employee.int, 1)}\n
    \n Charisma: {formatNumber(props.employee.cha, 1)}\n
    \n Experience: {formatNumber(props.employee.exp, 1)}\n
    \n Creativity: {formatNumber(props.employee.cre, 1)}\n
    \n Efficiency: {formatNumber(props.employee.eff, 1)}\n
    \n Salary: {numeralWrapper.formatMoney(props.employee.sal)} \\ s
    \n
    \n );\n}\n\ninterface IProps {\n office: OfficeSpace;\n corp: ICorporation;\n popupId: string;\n player: IPlayer;\n rerender: () => void;\n}\n\n// Create a popup that lets the player manage exports\nexport function HireEmployeePopup(props: IProps): React.ReactElement {\n if (props.office.atCapacity()) return <>;\n\n //Generate three random employees (meh, decent, amazing)\n const mult1 = getRandomInt(25, 50) / 100;\n const mult2 = getRandomInt(51, 75) / 100;\n const mult3 = getRandomInt(76, 100) / 100;\n const int = getRandomInt(50, 100);\n const cha = getRandomInt(50, 100);\n const exp = getRandomInt(50, 100);\n const cre = getRandomInt(50, 100);\n const eff = getRandomInt(50, 100);\n const sal = CorporationConstants.EmployeeSalaryMultiplier * (int + cha + exp + cre + eff);\n\n const emp1 = new Employee({\n intelligence: int * mult1,\n charisma: cha * mult1,\n experience: exp * mult1,\n creativity: cre * mult1,\n efficiency: eff * mult1,\n salary: sal * mult1,\n });\n\n const emp2 = new Employee({\n intelligence: int * mult2,\n charisma: cha * mult2,\n experience: exp * mult2,\n creativity: cre * mult2,\n efficiency: eff * mult2,\n salary: sal * mult2,\n });\n\n const emp3 = new Employee({\n intelligence: int * mult3,\n charisma: cha * mult3,\n experience: exp * mult3,\n creativity: cre * mult3,\n efficiency: eff * mult3,\n salary: sal * mult3,\n });\n\n return (\n <>\n

    Select one of the following candidates for hire:

    \n \n \n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { OfficeSpace } from \"../OfficeSpace\";\nimport { ICorporation } from \"../ICorporation\";\nimport { ThrowParty } from \"../Actions\";\n\ninterface IProps {\n office: OfficeSpace;\n corp: ICorporation;\n popupId: string;\n}\n\nexport function ThrowPartyPopup(props: IProps): React.ReactElement {\n const [cost, setCost] = useState(null);\n\n function changeCost(event: React.ChangeEvent): void {\n setCost(parseFloat(event.target.value));\n }\n\n function throwParty(): void {\n if (cost === null || isNaN(cost) || cost < 0) {\n dialogBoxCreate(\"Invalid value entered\");\n } else {\n const totalCost = cost * props.office.employees.length;\n if (props.corp.funds.lt(totalCost)) {\n dialogBoxCreate(\"You don't have enough company funds to throw a party!\");\n } else {\n const mult = ThrowParty(props.corp, props.office, cost);\n dialogBoxCreate(\n \"You threw a party for the office! The morale and happiness \" +\n \"of each employee increased by \" +\n numeralWrapper.formatPercentage(mult - 1),\n );\n removePopup(props.popupId);\n }\n }\n }\n\n function EffectText(props: { cost: number | null; office: OfficeSpace }): React.ReactElement {\n let cost = props.cost;\n if (cost !== null && (isNaN(cost) || cost < 0)) return

    Invalid value entered!

    ;\n if (cost === null) cost = 0;\n return (\n

    Throwing this party will cost a total of {numeralWrapper.formatMoney(cost * props.office.employees.length)}

    \n );\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) throwParty();\n }\n\n return (\n <>\n

    Enter the amount of money you would like to spend PER EMPLOYEE on this office party

    \n \n \n \n \n );\n}\n","// React Component for displaying an Industry's overview information\n// (top-left panel in the Industry UI)\nimport React from \"react\";\n\nimport { OfficeSpace } from \"../OfficeSpace\";\nimport { Industries } from \"../IndustryData\";\nimport { IndustryUpgrades } from \"../IndustryUpgrades\";\nimport { IIndustry } from \"../IIndustry\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { createProgressBarText } from \"../../../utils/helpers/createProgressBarText\";\nimport { MakeProductPopup } from \"./MakeProductPopup\";\nimport { ResearchPopup } from \"./ResearchPopup\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { Money } from \"../../ui/React/Money\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { MoneyCost } from \"./MoneyCost\";\n\ninterface IProps {\n corp: ICorporation;\n currentCity: string;\n division: IIndustry;\n office: OfficeSpace;\n player: IPlayer;\n rerender: () => void;\n}\n\nexport function IndustryOverview(props: IProps): React.ReactElement {\n function renderMakeProductButton(): React.ReactElement {\n let createProductButtonText = \"\";\n let createProductPopupText = \"\";\n switch (props.division.type) {\n case Industries.Food:\n createProductButtonText = \"Build Restaurant\";\n createProductPopupText = \"Build and manage a new restaurant!\";\n break;\n case Industries.Tobacco:\n createProductButtonText = \"Create Product\";\n createProductPopupText = \"Create a new tobacco product!\";\n break;\n case Industries.Pharmaceutical:\n createProductButtonText = \"Create Drug\";\n createProductPopupText = \"Design and develop a new pharmaceutical drug!\";\n break;\n case Industries.Computer:\n case \"Computer\":\n createProductButtonText = \"Create Product\";\n createProductPopupText = \"Design and manufacture a new computer hardware product!\";\n break;\n case Industries.Robotics:\n createProductButtonText = \"Design Robot\";\n createProductPopupText = \"Design and create a new robot or robotic system!\";\n break;\n case Industries.Software:\n createProductButtonText = \"Develop Software\";\n createProductPopupText = \"Develop a new piece of software!\";\n break;\n case Industries.Healthcare:\n createProductButtonText = \"Build Hospital\";\n createProductPopupText = \"Build and manage a new hospital!\";\n break;\n case Industries.RealEstate:\n createProductButtonText = \"Develop Property\";\n createProductPopupText = \"Develop a new piece of real estate property!\";\n break;\n default:\n createProductButtonText = \"Create Product\";\n createProductPopupText = \"Create a new product!\";\n return <>;\n }\n createProductPopupText +=\n \"

    To begin developing a product, \" +\n \"first choose the city in which it will be designed. The stats of your employees \" +\n \"in the selected city affect the properties of the finished product, such as its \" +\n \"quality, performance, and durability.

    \" +\n \"You can also choose to invest money in the design and marketing of \" +\n \"the product. Investing money in its design will result in a superior product. \" +\n \"Investing money in marketing the product will help the product's sales.\";\n\n const hasMaxProducts = props.division.hasMaximumNumberProducts();\n\n const className = hasMaxProducts ? \"a-link-button-inactive tooltip\" : \"std-button\";\n const buttonStyle = {\n margin: \"6px\",\n display: \"inline-block\",\n };\n\n function openMakeProductPopup(): void {\n const popupId = \"cmpy-mgmt-create-product-popup\";\n createPopup(popupId, MakeProductPopup, {\n popupText: createProductPopupText,\n division: props.division,\n corp: props.corp,\n popupId: popupId,\n });\n }\n\n function shouldFlash(): boolean {\n return Object.keys(props.division.products).length === 0;\n }\n\n return (\n \n {createProductButtonText}\n {hasMaxProducts && (\n \n You have reached the maximum number of products: {props.division.getMaximumNumberProducts()}\n \n )}\n \n );\n }\n\n function renderText(): React.ReactElement {\n const vechain = props.corp.unlockUpgrades[4] === 1;\n const profit = props.division.lastCycleRevenue.minus(props.division.lastCycleExpenses).toNumber();\n\n let advertisingInfo = false;\n const advertisingFactors = props.division.getAdvertisingFactors();\n const awarenessFac = advertisingFactors[1];\n const popularityFac = advertisingFactors[2];\n const ratioFac = advertisingFactors[3];\n const totalAdvertisingFac = advertisingFactors[0];\n if (vechain) {\n advertisingInfo = true;\n }\n\n function productionMultHelpTipOnClick(): void {\n // Wrapper for createProgressBarText()\n // Converts the industry's \"effectiveness factors\"\n // into a graphic (string) depicting how high that effectiveness is\n function convertEffectFacToGraphic(fac: number): string {\n return createProgressBarText({\n progress: fac,\n totalTicks: 20,\n });\n }\n\n dialogBoxCreate(\n \"Owning Hardware, Robots, AI Cores, and Real Estate \" +\n \"can boost your Industry's production. The effect these \" +\n \"materials have on your production varies between Industries. \" +\n \"For example, Real Estate may be very effective for some Industries, \" +\n \"but ineffective for others.

    \" +\n \"This division's production multiplier is calculated by summing \" +\n \"the individual production multiplier of each of its office locations. \" +\n \"This production multiplier is applied to each office. Therefore, it is \" +\n \"beneficial to expand into new cities as this can greatly increase the \" +\n \"production multiplier of your entire Division.

    \" +\n \"Below are approximations for how effective each material is at boosting \" +\n \"this industry's production multiplier (Bigger bars = more effective):

    \" +\n `Hardware:    ${convertEffectFacToGraphic(props.division.hwFac)}
    ` +\n `Robots:      ${convertEffectFacToGraphic(props.division.robFac)}
    ` +\n `AI Cores:    ${convertEffectFacToGraphic(props.division.aiFac)}
    ` +\n `Real Estate: ${convertEffectFacToGraphic(props.division.reFac)}`,\n );\n }\n\n function openResearchPopup(): void {\n const popupId = \"corporation-research-popup-box\";\n createPopup(popupId, ResearchPopup, {\n industry: props.division,\n popupId: popupId,\n });\n }\n\n return (\n
    \n Industry: {props.division.type} (Corp Funds: )\n

    \n Awareness: {numeralWrapper.format(props.division.awareness, \"0.000\")}
    \n Popularity: {numeralWrapper.format(props.division.popularity, \"0.000\")}
    \n {advertisingInfo !== false && (\n

    \n Advertising Multiplier: x{numeralWrapper.format(totalAdvertisingFac, \"0.000\")}\n \n Total multiplier for this industrys sales due to its awareness and popularity\n
    \n Awareness Bonus: x{numeralWrapper.format(Math.pow(awarenessFac, 0.85), \"0.000\")}\n
    \n Popularity Bonus: x{numeralWrapper.format(Math.pow(popularityFac, 0.85), \"0.000\")}\n
    \n Ratio Multiplier: x{numeralWrapper.format(Math.pow(ratioFac, 0.85), \"0.000\")}\n
    \n

    \n )}\n {advertisingInfo}\n
    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n

    Revenue:

    \n
    \n

    \n / s\n

    \n
    \n

    Expenses:

    \n
    \n

    \n / s\n

    \n
    \n

    Profit:

    \n
    \n

    \n / s\n

    \n
    \n
    \n

    \n Production Multiplier: {numeralWrapper.format(props.division.prodMult, \"0.00\")}\n \n Production gain from owning production-boosting materials such as hardware, Robots, AI Cores, and Real\n Estate\n \n

    \n
    \n ?\n
    \n

    \n

    \n Scientific Research: {numeralWrapper.format(props.division.sciResearch.qty, \"0.000a\")}\n \n Scientific Research increases the quality of the materials and products that you produce.\n \n

    \n \n
    \n );\n }\n\n function renderUpgrades(): React.ReactElement[] {\n const upgrades = [];\n for (const index in IndustryUpgrades) {\n const upgrade = IndustryUpgrades[index];\n\n // AutoBrew research disables the Coffee upgrade\n if (props.division.hasResearch(\"AutoBrew\") && upgrade[4] === \"Coffee\") {\n continue;\n }\n\n const i = upgrade[0];\n const baseCost = upgrade[1];\n const priceMult = upgrade[2];\n let cost = 0;\n switch (i) {\n case 0: //Coffee, cost is static per employee\n cost = props.office.employees.length * baseCost;\n break;\n default:\n cost = baseCost * Math.pow(priceMult, props.division.upgrades[i]);\n break;\n }\n\n function onClick(): void {\n if (props.corp.funds.lt(cost)) return;\n props.corp.funds = props.corp.funds.minus(cost);\n props.division.upgrade(upgrade, {\n corporation: props.corp,\n office: props.office,\n });\n props.rerender();\n }\n\n upgrades.push(\n renderUpgrade({\n key: index,\n onClick: onClick,\n text: (\n <>\n {upgrade[4]} - \n \n ),\n tooltip: upgrade[5],\n }),\n );\n }\n\n return upgrades;\n }\n\n interface IRenderUpgradeProps {\n key: string;\n onClick: () => void;\n text: JSX.Element;\n tooltip: string;\n }\n\n function renderUpgrade(props: IRenderUpgradeProps): React.ReactElement {\n return (\n
    \n {props.text}\n {props.tooltip != null && {props.tooltip}}\n
    \n );\n }\n\n const makeProductButton = renderMakeProductButton();\n\n return (\n
    \n {renderText()}\n
    \n Purchases & Upgrades\n
    \n {renderUpgrades()}
    \n {props.division.makesProducts && makeProductButton}\n
    \n );\n}\n","import React, { useState } from \"react\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { Industries } from \"../IndustryData\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IIndustry } from \"../IIndustry\";\nimport { MakeProduct } from \"../Actions\";\n\ninterface IProps {\n popupText: string;\n division: IIndustry;\n corp: ICorporation;\n popupId: string;\n}\n\nfunction productPlaceholder(tpe: string): string {\n if (tpe === Industries.Food) {\n return \"Restaurant Name\";\n } else if (tpe === Industries.Healthcare) {\n return \"Hospital Name\";\n } else if (tpe === Industries.RealEstate) {\n return \"Property Name\";\n }\n return \"Product Name\";\n}\n\n// Create a popup that lets the player create a product for their current industry\nexport function MakeProductPopup(props: IProps): React.ReactElement {\n const allCities = Object.keys(props.division.offices).filter(\n (cityName: string) => props.division.offices[cityName] !== 0,\n );\n const [city, setCity] = useState(allCities.length > 0 ? allCities[0] : \"\");\n const [name, setName] = useState(\"\");\n const [design, setDesign] = useState(null);\n const [marketing, setMarketing] = useState(null);\n if (props.division.hasMaximumNumberProducts()) return <>;\n\n function makeProduct(): void {\n if (design === null || marketing === null) return;\n try {\n MakeProduct(props.corp, props.division, city, name, design, marketing);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n }\n removePopup(props.popupId);\n }\n\n function onCityChange(event: React.ChangeEvent): void {\n setCity(event.target.value);\n }\n\n function onProductNameChange(event: React.ChangeEvent): void {\n setName(event.target.value);\n }\n\n function onDesignChange(event: React.ChangeEvent): void {\n if (event.target.value === \"\") setDesign(null);\n else setDesign(parseFloat(event.target.value));\n }\n\n function onMarketingChange(event: React.ChangeEvent): void {\n if (event.target.value === \"\") setMarketing(null);\n else setMarketing(parseFloat(event.target.value));\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) makeProduct();\n }\n\n return (\n <>\n

    \n \n \n
    \n \n \n \n \n );\n}\n","import React, { useEffect } from \"react\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { IndustryResearchTrees } from \"../IndustryData\";\nimport { CorporationConstants } from \"../data/Constants\";\nimport { Treant } from \"treant-js\";\nimport { IIndustry } from \"../IIndustry\";\nimport { Research } from \"../Actions\";\n\ninterface IProps {\n industry: IIndustry;\n popupId: string;\n}\n\n// Create the Research Tree UI for this Industry\nexport function ResearchPopup(props: IProps): React.ReactElement {\n const researchTree = IndustryResearchTrees[props.industry.type];\n if (researchTree === undefined) return <>;\n useEffect(() => {\n {\n const boxContent = document.getElementById(`${props.popupId}-content`);\n if (boxContent != null) {\n boxContent.style.minHeight = \"80vh\";\n }\n }\n\n // Get the tree's markup (i.e. config) for Treant\n const markup = researchTree.createTreantMarkup();\n markup.chart.container = \"#\" + props.popupId + \"-content\";\n markup.chart.nodeAlign = \"BOTTOM\";\n markup.chart.rootOrientation = \"WEST\";\n markup.chart.siblingSeparation = 40;\n markup.chart.connectors = {\n type: \"step\",\n style: {\n \"arrow-end\": \"block-wide-long\",\n stroke: \"white\",\n \"stroke-width\": 2,\n },\n };\n\n Treant(markup);\n\n // Add Event Listeners for all Nodes\n const allResearch = researchTree.getAllNodes();\n for (let i = 0; i < allResearch.length; ++i) {\n // If this is already Researched, skip it\n if (props.industry.researched[allResearch[i]] === true) {\n continue;\n }\n\n // Get the DOM Element to add a click listener to it\n const sanitizedName = allResearch[i].replace(/\\s/g, \"\");\n const div = document.getElementById(sanitizedName + \"-corp-research-click-listener\");\n if (div == null) {\n console.warn(`Could not find Research Tree div for ${sanitizedName}`);\n continue;\n }\n\n div.addEventListener(\"click\", () => {\n try {\n Research(props.industry, allResearch[i]);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n return;\n }\n\n dialogBoxCreate(\n `Researched ${allResearch[i]}. It may take a market cycle ` +\n `(~${CorporationConstants.SecsPerMarketCycle} seconds) before the effects of ` +\n `the Research apply.`,\n );\n removePopup(props.popupId);\n });\n }\n });\n\n return (\n

    \n
    \n Research points: {props.industry.sciResearch.qty}\n
    \n Multipliers from research:\n
    * Advertising Multiplier: x{researchTree.getAdvertisingMultiplier()}\n
    * Employee Charisma Multiplier: x{researchTree.getEmployeeChaMultiplier()}\n
    * Employee Creativity Multiplier: x{researchTree.getEmployeeCreMultiplier()}\n
    * Employee Efficiency Multiplier: x{researchTree.getEmployeeEffMultiplier()}\n
    * Employee Intelligence Multiplier: x{researchTree.getEmployeeIntMultiplier()}\n
    * Production Multiplier: x{researchTree.getProductionMultiplier()}\n
    * Sales Multiplier: x{researchTree.getSalesMultiplier()}\n
    * Scientific Research Multiplier: x{researchTree.getScientificResearchMultiplier()}\n
    * Storage Multiplier: x{researchTree.getStorageMultiplier()}\n
    \n
    \n );\n}\n","// React Component for displaying an Industry's warehouse information\n// (right-side panel in the Industry UI)\nimport React from \"react\";\n\nimport { CorporationConstants } from \"../data/Constants\";\nimport { OfficeSpace } from \"../OfficeSpace\";\nimport { Material } from \"../Material\";\nimport { Product } from \"../Product\";\nimport { Warehouse } from \"../Warehouse\";\nimport { DiscontinueProductPopup } from \"./DiscontinueProductPopup\";\nimport { ExportPopup } from \"./ExportPopup\";\nimport { LimitProductProductionPopup } from \"./LimitProductProductionPopup\";\nimport { MaterialMarketTaPopup } from \"./MaterialMarketTaPopup\";\nimport { SellMaterialPopup } from \"./SellMaterialPopup\";\nimport { SellProductPopup } from \"./SellProductPopup\";\nimport { PurchaseMaterialPopup } from \"./PurchaseMaterialPopup\";\nimport { ProductMarketTaPopup } from \"./ProductMarketTaPopup\";\nimport { SmartSupplyPopup } from \"./SmartSupplyPopup\";\n\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { createPopup } from \"../../ui/React/createPopup\";\n\nimport { isString } from \"../../../utils/helpers/isString\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IIndustry } from \"../IIndustry\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { Money } from \"../../ui/React/Money\";\nimport { MoneyCost } from \"./MoneyCost\";\nimport { isRelevantMaterial } from \"./Helpers\";\nimport { IndustryProductEquation } from \"./IndustryProductEquation\";\nimport { PurchaseWarehouse } from \"../Actions\";\n\ninterface IProductProps {\n corp: ICorporation;\n division: IIndustry;\n city: string;\n product: Product;\n player: IPlayer;\n rerender: () => void;\n}\n\n// Creates the UI for a single Product type\nfunction ProductComponent(props: IProductProps): React.ReactElement {\n const corp = props.corp;\n const division = props.division;\n const city = props.city;\n const product = props.product;\n\n // Numeraljs formatters\n const nf = \"0.000\";\n const nfB = \"0.000a\"; // For numbers that might be big\n\n const hasUpgradeDashboard = division.hasResearch(\"uPgrade: Dashboard\");\n\n // Total product gain = production - sale\n const totalGain = product.data[city][1] - product.data[city][2];\n\n // Sell button\n let sellButtonText: JSX.Element;\n if (product.sllman[city][0]) {\n if (isString(product.sllman[city][1])) {\n sellButtonText = (\n <>\n Sell ({numeralWrapper.format(product.data[city][2], nfB)}/{product.sllman[city][1]})\n \n );\n } else {\n sellButtonText = (\n <>\n Sell ({numeralWrapper.format(product.data[city][2], nfB)}/\n {numeralWrapper.format(product.sllman[city][1], nfB)})\n \n );\n }\n } else {\n sellButtonText = <>Sell (0.000/0.000);\n }\n\n if (product.marketTa2) {\n sellButtonText = (\n <>\n {sellButtonText} @ \n \n );\n } else if (product.marketTa1) {\n const markupLimit = product.rat / product.mku;\n sellButtonText = (\n <>\n {sellButtonText} @ \n \n );\n } else if (product.sCost) {\n if (isString(product.sCost)) {\n const sCost = (product.sCost as string).replace(/MP/g, product.pCost + \"\");\n sellButtonText = (\n <>\n {sellButtonText} @ \n \n );\n } else {\n sellButtonText = (\n <>\n {sellButtonText} @ \n \n );\n }\n }\n\n function openSellProductPopup(): void {\n const popupId = \"cmpy-mgmt-limit-product-production-popup\";\n createPopup(popupId, SellProductPopup, {\n product: product,\n city: city,\n popupId: popupId,\n });\n }\n\n // Limit Production button\n let limitProductionButtonText = \"Limit Production\";\n if (product.prdman[city][0]) {\n limitProductionButtonText += \" (\" + numeralWrapper.format(product.prdman[city][1], nf) + \")\";\n }\n\n function openLimitProductProdutionPopup(): void {\n const popupId = \"cmpy-mgmt-limit-product-production-popup\";\n createPopup(popupId, LimitProductProductionPopup, {\n product: product,\n city: city,\n popupId: popupId,\n });\n }\n\n function openDiscontinueProductPopup(): void {\n const popupId = \"cmpy-mgmt-discontinue-product-popup\";\n createPopup(popupId, DiscontinueProductPopup, {\n rerender: props.rerender,\n product: product,\n industry: division,\n corp: props.corp,\n popupId: popupId,\n player: props.player,\n });\n }\n\n function openProductMarketTaPopup(): void {\n const popupId = \"cmpy-mgmt-marketta-popup\";\n createPopup(popupId, ProductMarketTaPopup, {\n product: product,\n industry: division,\n popupId: popupId,\n });\n }\n\n // Unfinished Product\n if (!product.fin) {\n return (\n
    \n

    \n Designing {product.name} (req. Operations/Engineers in {product.createCity})...\n

    \n
    \n

    {numeralWrapper.format(product.prog, \"0.00\")}% complete

    \n
    \n\n {hasUpgradeDashboard && (\n
    \n \n
    \n \n \n {division.hasResearch(\"Market-TA.I\") && (\n \n )}\n
    \n )}\n
    \n );\n }\n\n return (\n
    \n

    \n {product.name}: {numeralWrapper.format(product.data[city][0], nfB)} ({numeralWrapper.format(totalGain, nfB)}/s)\n \n Prod: {numeralWrapper.format(product.data[city][1], nfB)}/s\n
    \n Sell: {numeralWrapper.format(product.data[city][2], nfB)} /s\n
    \n

    \n
    \n

    \n Rating: {numeralWrapper.format(product.rat, nf)}\n \n Quality: {numeralWrapper.format(product.qlt, nf)}
    \n Performance: {numeralWrapper.format(product.per, nf)}
    \n Durability: {numeralWrapper.format(product.dur, nf)}
    \n Reliability: {numeralWrapper.format(product.rel, nf)}
    \n Aesthetics: {numeralWrapper.format(product.aes, nf)}
    \n Features: {numeralWrapper.format(product.fea, nf)}\n {corp.unlockUpgrades[2] === 1 &&
    }\n {corp.unlockUpgrades[2] === 1 && \"Demand: \" + numeralWrapper.format(product.dmd, nf)}\n {corp.unlockUpgrades[3] === 1 &&
    }\n {corp.unlockUpgrades[3] === 1 && \"Competition: \" + numeralWrapper.format(product.cmp, nf)}\n
    \n

    \n
    \n

    \n Est. Production Cost:{\" \"}\n {numeralWrapper.formatMoney(product.pCost / CorporationConstants.ProductProductionCostRatio)}\n An estimate of the material cost it takes to create this Product.\n

    \n
    \n

    \n Est. Market Price: {numeralWrapper.formatMoney(product.pCost)}\n \n An estimate of how much consumers are willing to pay for this product. Setting the sale price above this may\n result in less sales. Setting the sale price below this may result in more sales.\n \n

    \n\n
    \n \n
    \n \n \n {division.hasResearch(\"Market-TA.I\") && (\n \n )}\n
    \n
    \n );\n}\n\ninterface IMaterialProps {\n corp: ICorporation;\n division: IIndustry;\n warehouse: Warehouse;\n city: string;\n mat: Material;\n rerender: () => void;\n}\n\n// Creates the UI for a single Material type\nfunction MaterialComponent(props: IMaterialProps): React.ReactElement {\n const corp = props.corp;\n const division = props.division;\n const warehouse = props.warehouse;\n const city = props.city;\n const mat = props.mat;\n const markupLimit = mat.getMarkupLimit();\n const office = division.offices[city];\n if (!(office instanceof OfficeSpace)) {\n throw new Error(`Could not get OfficeSpace object for this city (${city})`);\n }\n\n // Numeraljs formatter\n const nf = \"0.000\";\n const nfB = \"0.000a\"; // For numbers that might be biger\n\n // Total gain or loss of this material (per second)\n const totalGain = mat.buy + mat.prd + mat.imp - mat.sll - mat.totalExp;\n\n // Flag that determines whether this industry is \"new\" and the current material should be\n // marked with flashing-red lights\n const tutorial =\n division.newInd && Object.keys(division.reqMats).includes(mat.name) && mat.buy === 0 && mat.imp === 0;\n\n // Purchase material button\n const purchaseButtonText = `Buy (${numeralWrapper.format(mat.buy, nfB)})`;\n const purchaseButtonClass = tutorial ? \"std-button flashing-button tooltip\" : \"std-button\";\n\n function openPurchaseMaterialPopup(): void {\n const popupId = \"cmpy-mgmt-material-purchase-popup\";\n createPopup(popupId, PurchaseMaterialPopup, {\n mat: mat,\n industry: division,\n warehouse: warehouse,\n corp: props.corp,\n popupId: popupId,\n });\n }\n\n function openExportPopup(): void {\n const popupId = \"cmpy-mgmt-export-popup\";\n createPopup(popupId, ExportPopup, {\n mat: mat,\n corp: props.corp,\n popupId: popupId,\n });\n }\n\n // Sell material button\n let sellButtonText: JSX.Element;\n if (mat.sllman[0]) {\n if (isString(mat.sllman[1])) {\n sellButtonText = (\n <>\n Sell ({numeralWrapper.format(mat.sll, nfB)}/{mat.sllman[1]})\n \n );\n } else {\n sellButtonText = (\n <>\n Sell ({numeralWrapper.format(mat.sll, nfB)}/{numeralWrapper.format(mat.sllman[1] as number, nfB)})\n \n );\n }\n\n if (mat.marketTa2) {\n sellButtonText = (\n <>\n {sellButtonText} @ \n \n );\n } else if (mat.marketTa1) {\n sellButtonText = (\n <>\n {sellButtonText} @ \n \n );\n } else if (mat.sCost) {\n if (isString(mat.sCost)) {\n const sCost = (mat.sCost as string).replace(/MP/g, mat.bCost + \"\");\n sellButtonText = (\n <>\n {sellButtonText} @ \n \n );\n } else {\n sellButtonText = (\n <>\n {sellButtonText} @ \n \n );\n }\n }\n } else {\n sellButtonText = <>Sell (0.000/0.000);\n }\n\n function openSellMaterialPopup(): void {\n const popupId = \"cmpy-mgmt-material-sell-popup\";\n createPopup(popupId, SellMaterialPopup, {\n mat: mat,\n corp: props.corp,\n popupId: popupId,\n });\n }\n\n function openMaterialMarketTaPopup(): void {\n const popupId = \"cmpy-mgmt-export-popup\";\n createPopup(popupId, MaterialMarketTaPopup, {\n mat: mat,\n industry: division,\n corp: props.corp,\n popupId: popupId,\n });\n }\n\n function shouldFlash(): boolean {\n return props.division.prodMats.includes(props.mat.name) && !mat.sllman[0];\n }\n\n return (\n
    \n
    \n

    \n {mat.name}: {numeralWrapper.format(mat.qty, nfB)} ({numeralWrapper.format(totalGain, nfB)}/s)\n \n Buy: {numeralWrapper.format(mat.buy, nfB)}
    \n Prod: {numeralWrapper.format(mat.prd, nfB)}
    \n Sell: {numeralWrapper.format(mat.sll, nfB)}
    \n Export: {numeralWrapper.format(mat.totalExp, nfB)}
    \n Import: {numeralWrapper.format(mat.imp, nfB)}\n {corp.unlockUpgrades[2] === 1 &&
    }\n {corp.unlockUpgrades[2] === 1 && \"Demand: \" + numeralWrapper.format(mat.dmd, nf)}\n {corp.unlockUpgrades[3] === 1 &&
    }\n {corp.unlockUpgrades[3] === 1 && \"Competition: \" + numeralWrapper.format(mat.cmp, nf)}\n
    \n

    \n
    \n

    \n MP: {numeralWrapper.formatMoney(mat.bCost)}\n \n Market Price: The price you would pay if you were to buy this material on the market\n \n

    {\" \"}\n
    \n

    \n Quality: {numeralWrapper.format(mat.qlt, \"0.00a\")}\n The quality of your material. Higher quality will lead to more sales\n

    \n
    \n\n
    \n \n {purchaseButtonText}\n {tutorial && (\n Purchase your required materials to get production started!\n )}\n \n\n {corp.unlockUpgrades[0] === 1 && (\n \n )}\n
    \n\n \n\n {division.hasResearch(\"Market-TA.I\") && (\n \n )}\n
    \n
    \n );\n}\n\ninterface IProps {\n corp: ICorporation;\n division: IIndustry;\n warehouse: Warehouse | 0;\n currentCity: string;\n player: IPlayer;\n rerender: () => void;\n}\n\nexport function IndustryWarehouse(props: IProps): React.ReactElement {\n function renderWarehouseUI(): React.ReactElement {\n if (props.warehouse === 0) return <>;\n // General Storage information at the top\n const sizeUsageStyle = {\n color: props.warehouse.sizeUsed >= props.warehouse.size ? \"red\" : \"white\",\n margin: \"5px\",\n };\n\n // Upgrade Warehouse size button\n const sizeUpgradeCost = CorporationConstants.WarehouseUpgradeBaseCost * Math.pow(1.07, props.warehouse.level + 1);\n const canAffordUpgrade = props.corp.funds.gt(sizeUpgradeCost);\n const upgradeWarehouseClass = canAffordUpgrade ? \"std-button\" : \"a-link-button-inactive\";\n function upgradeWarehouseOnClick(): void {\n if (props.division === null) return;\n if (props.warehouse === 0) return;\n ++props.warehouse.level;\n props.warehouse.updateSize(props.corp, props.division);\n props.corp.funds = props.corp.funds.minus(sizeUpgradeCost);\n props.rerender();\n }\n\n function openSmartSupplyPopup(): void {\n if (props.warehouse === 0) return;\n const popupId = \"cmpy-mgmt-smart-supply-popup\";\n createPopup(popupId, SmartSupplyPopup, {\n division: props.division,\n warehouse: props.warehouse,\n corp: props.corp,\n player: props.player,\n popupId: popupId,\n });\n }\n\n const ratioLines = [];\n for (const matName in props.division.reqMats) {\n if (props.division.reqMats.hasOwnProperty(matName)) {\n const text = [\" *\", props.division.reqMats[matName], matName].join(\" \");\n ratioLines.push(\n
    \n

    {text}

    \n
    ,\n );\n }\n }\n\n // Current State:\n let stateText;\n switch (props.division.state) {\n case \"START\":\n stateText = \"Current state: Preparing...\";\n break;\n case \"PURCHASE\":\n stateText = \"Current state: Purchasing materials...\";\n break;\n case \"PRODUCTION\":\n stateText = \"Current state: Producing materials and/or products...\";\n break;\n case \"SALE\":\n stateText = \"Current state: Selling materials and/or products...\";\n break;\n case \"EXPORT\":\n stateText = \"Current state: Exporting materials and/or products...\";\n break;\n default:\n console.error(`Invalid state: ${props.division.state}`);\n break;\n }\n\n // Create React components for materials\n const mats = [];\n for (const matName in props.warehouse.materials) {\n if (props.warehouse.materials[matName] instanceof Material) {\n // Only create UI for materials that are relevant for the industry\n if (isRelevantMaterial(matName, props.division)) {\n mats.push(\n ,\n );\n }\n }\n }\n\n // Create React components for products\n const products = [];\n if (props.division.makesProducts && Object.keys(props.division.products).length > 0) {\n for (const productName in props.division.products) {\n const product = props.division.products[productName];\n if (product instanceof Product) {\n products.push(\n ,\n );\n }\n }\n }\n\n return (\n
    \n

    \n Storage: {numeralWrapper.formatBigNumber(props.warehouse.sizeUsed)} /{\" \"}\n {numeralWrapper.formatBigNumber(props.warehouse.size)}\n \n

    \n\n \n\n

    This industry uses the following equation for it's production:

    \n
    \n
    \n \n
    \n
    \n

    \n To get started with production, purchase your required materials or import them from another of your company's\n divisions.\n

    \n
    \n\n

    {stateText}

    \n\n {props.corp.unlockUpgrades[1] && (\n <>\n \n \n )}\n\n {mats}\n\n {products}\n
    \n );\n }\n\n function purchaseWarehouse(division: IIndustry, city: string): void {\n PurchaseWarehouse(props.corp, division, city);\n props.rerender();\n }\n\n if (props.warehouse instanceof Warehouse) {\n return renderWarehouseUI();\n } else {\n return (\n
    \n purchaseWarehouse(props.division, props.currentCity)}\n disabled={props.corp.funds.lt(CorporationConstants.WarehouseInitialCost)}\n >\n Purchase Warehouse (\n )\n \n
    \n );\n }\n}\n","import React from \"react\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { ICorporation } from \"../ICorporation\";\nimport { Product } from \"../Product\";\nimport { IIndustry } from \"../IIndustry\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n product: Product;\n industry: IIndustry;\n corp: ICorporation;\n popupId: string;\n player: IPlayer;\n rerender: () => void;\n}\n\n// Create a popup that lets the player discontinue a product\nexport function DiscontinueProductPopup(props: IProps): React.ReactElement {\n function discontinue(): void {\n props.industry.discontinueProduct(props.product);\n removePopup(props.popupId);\n props.rerender();\n }\n\n return (\n <>\n

    \n Are you sure you want to do this? Discontinuing a product removes it completely and permanently. You will no\n longer produce this product and all of its existing stock will be removed and left unsold\n

    \n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { ICorporation } from \"../ICorporation\";\nimport { Material } from \"../Material\";\nimport { Export } from \"../Export\";\nimport { IIndustry } from \"../IIndustry\";\nimport { ExportMaterial } from \"../Actions\";\n\ninterface IProps {\n mat: Material;\n corp: ICorporation;\n popupId: string;\n}\n\n// Create a popup that lets the player manage exports\nexport function ExportPopup(props: IProps): React.ReactElement {\n if (props.corp.divisions.length === 0) throw new Error(\"Export popup created with no divisions.\");\n if (Object.keys(props.corp.divisions[0].warehouses).length === 0)\n throw new Error(\"Export popup created in a division with no warehouses.\");\n const [industry, setIndustry] = useState(props.corp.divisions[0].name);\n const [city, setCity] = useState(Object.keys(props.corp.divisions[0].warehouses)[0]);\n const [amt, setAmt] = useState(\"\");\n const setRerender = useState(false)[1];\n\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n function onCityChange(event: React.ChangeEvent): void {\n setCity(event.target.value);\n }\n\n function onIndustryChange(event: React.ChangeEvent): void {\n setIndustry(event.target.value);\n }\n\n function onAmtChange(event: React.ChangeEvent): void {\n setAmt(event.target.value);\n }\n\n function exportMaterial(): void {\n try {\n ExportMaterial(industry, city, props.mat, amt);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n }\n removePopup(props.popupId);\n }\n\n function removeExport(exp: Export): void {\n for (let i = 0; i < props.mat.exp.length; ++i) {\n if (props.mat.exp[i].ind !== exp.ind || props.mat.exp[i].city !== exp.city || props.mat.exp[i].amt !== exp.amt)\n continue;\n props.mat.exp.splice(i, 1);\n break;\n }\n rerender();\n }\n\n const currentDivision = props.corp.divisions.find((division: IIndustry) => division.name === industry);\n if (currentDivision === undefined)\n throw new Error(`Export popup somehow ended up with undefined division '${currentDivision}'`);\n const possibleCities = Object.keys(currentDivision.warehouses).filter(\n (city) => currentDivision.warehouses[city] !== 0,\n );\n if (possibleCities.length > 0 && !possibleCities.includes(city)) {\n setCity(possibleCities[0]);\n }\n\n return (\n <>\n

    \n Select the industry and city to export this material to, as well as how much of this material to export per\n second. You can set the export amount to 'MAX' to export all of the materials in this warehouse.\n

    \n \n \n \n \n

    \n Below is a list of all current exports of this material from this warehouse. Clicking on one of the exports\n below will REMOVE that export.\n

    \n {props.mat.exp.map((exp: Export, index: number) => (\n
    removeExport(exp)}>\n Industry: {exp.ind}\n
    \n City: {exp.city}\n
    \n Amount/s: {exp.amt}\n
    \n ))}\n \n );\n}\n","import React, { useState } from \"react\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { Product } from \"../Product\";\nimport { LimitProductProduction } from \"../Actions\";\n\ninterface IProps {\n product: Product;\n city: string;\n popupId: string;\n}\n\n// Create a popup that lets the player limit the production of a product\nexport function LimitProductProductionPopup(props: IProps): React.ReactElement {\n const [limit, setLimit] = useState(null);\n\n function limitProductProduction(): void {\n let qty = limit;\n if (qty === null) qty = -1;\n LimitProductProduction(props.product, props.city, qty);\n removePopup(props.popupId);\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) limitProductProduction();\n }\n\n function onChange(event: React.ChangeEvent): void {\n if (event.target.value === \"\") setLimit(null);\n else setLimit(parseFloat(event.target.value));\n }\n\n return (\n <>\n

    \n Enter a limit to the amount of this product you would like to product per second. Leave the box empty to set no\n limit.\n

    \n \n \n Limit production\n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { IIndustry } from \"../IIndustry\";\nimport { ICorporation } from \"../ICorporation\";\nimport { Material } from \"../Material\";\n\ninterface IMarketTA2Props {\n industry: IIndustry;\n mat: Material;\n}\n\nfunction MarketTA2(props: IMarketTA2Props): React.ReactElement {\n if (!props.industry.hasResearch(\"Market-TA.II\")) return <>;\n\n const [newCost, setNewCost] = useState(props.mat.bCost);\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n const markupLimit = props.mat.getMarkupLimit();\n\n function onChange(event: React.ChangeEvent): void {\n if (event.target.value === \"\") setNewCost(0);\n else setNewCost(parseFloat(event.target.value));\n }\n\n const sCost = newCost;\n let markup = 1;\n if (sCost > props.mat.bCost) {\n //Penalty if difference between sCost and bCost is greater than markup limit\n if (sCost - props.mat.bCost > markupLimit) {\n markup = Math.pow(markupLimit / (sCost - props.mat.bCost), 2);\n }\n } else if (sCost < props.mat.bCost) {\n if (sCost <= 0) {\n markup = 1e12; //Sell everything, essentially discard\n } else {\n //Lower prices than market increases sales\n markup = props.mat.bCost / sCost;\n }\n }\n\n function onMarketTA2(event: React.ChangeEvent): void {\n props.mat.marketTa2 = event.target.checked;\n rerender();\n }\n\n return (\n <>\n

    \n
    \n \n Market-TA.II\n \n
    \n If you sell at {numeralWrapper.formatMoney(sCost)}, then you will sell{\" \"}\n {numeralWrapper.format(markup, \"0.00000\")}x as much compared to if you sold at market price.\n

    \n \n
    \n \n \n
    \n

    \n Note that Market-TA.II overrides Market-TA.I. This means that if both are enabled, then Market-TA.II will take\n effect, not Market-TA.I\n

    \n \n );\n}\n\ninterface IProps {\n mat: Material;\n industry: IIndustry;\n corp: ICorporation;\n popupId: string;\n}\n\n// Create a popup that lets the player use the Market TA research for Materials\nexport function MaterialMarketTaPopup(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n const markupLimit = props.mat.getMarkupLimit();\n\n function onMarketTA1(event: React.ChangeEvent): void {\n props.mat.marketTa1 = event.target.checked;\n rerender();\n }\n\n return (\n <>\n

    \n \n Market-TA.I\n \n
    \n The maximum sale price you can mark this up to is {numeralWrapper.formatMoney(props.mat.bCost + markupLimit)}.\n This means that if you set the sale price higher than this, you will begin to experience a loss in number of\n sales\n

    \n
    \n \n \n
    \n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { ICorporation } from \"../ICorporation\";\nimport { Material } from \"../Material\";\nimport { SellMaterial } from \"../Actions\";\n\nfunction initialPrice(mat: Material): string {\n let val = mat.sCost ? mat.sCost + \"\" : \"\";\n if (mat.marketTa2) {\n val += \" (Market-TA.II)\";\n } else if (mat.marketTa1) {\n val += \" (Market-TA.I)\";\n }\n return val;\n}\n\ninterface IProps {\n mat: Material;\n corp: ICorporation;\n popupId: string;\n}\n\n// Create a popup that let the player manage sales of a material\nexport function SellMaterialPopup(props: IProps): React.ReactElement {\n const [amt, setAmt] = useState(props.mat.sllman[1] ? props.mat.sllman[1] + \"\" : \"\");\n const [price, setPrice] = useState(initialPrice(props.mat));\n\n function sellMaterial(): void {\n try {\n SellMaterial(props.mat, amt, price);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n }\n\n removePopup(props.popupId);\n }\n\n function onAmtChange(event: React.ChangeEvent): void {\n setAmt(event.target.value);\n }\n\n function onPriceChange(event: React.ChangeEvent): void {\n setPrice(event.target.value);\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) sellMaterial();\n }\n\n return (\n <>\n

    \n Enter the maximum amount of {props.mat.name} you would like to sell per second, as well as the price at which\n you would like to sell at.\n
    \n
    \n If the sell amount is set to 0, then the material will not be sold. If the sell price if set to 0, then the\n material will be discarded\n
    \n
    \n Setting the sell amount to 'MAX' will result in you always selling the maximum possible amount of the material.\n
    \n
    \n When setting the sell amount, you can use the 'PROD' variable to designate a dynamically changing amount that\n depends on your production. For example, if you set the sell amount to 'PROD-5' then you will always sell 5 less\n of the material than you produce.\n
    \n
    \n When setting the sell price, you can use the 'MP' variable to designate a dynamically changing price that\n depends on the market price. For example, if you set the sell price to 'MP+10' then it will always be sold at\n $10 above the market price.\n

    \n
    \n \n \n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { Product } from \"../Product\";\nimport { SellProduct } from \"../Actions\";\n\nfunction initialPrice(product: Product): string {\n let val = product.sCost ? product.sCost + \"\" : \"\";\n if (product.marketTa2) {\n val += \" (Market-TA.II)\";\n } else if (product.marketTa1) {\n val += \" (Market-TA.I)\";\n }\n return val;\n}\n\ninterface IProps {\n product: Product;\n city: string;\n popupId: string;\n}\n\n// Create a popup that let the player manage sales of a material\nexport function SellProductPopup(props: IProps): React.ReactElement {\n const [checked, setChecked] = useState(true);\n const [iQty, setQty] = useState(\n props.product.sllman[props.city][1] ? props.product.sllman[props.city][1] : \"\",\n );\n const [px, setPx] = useState(initialPrice(props.product));\n\n function onCheckedChange(event: React.ChangeEvent): void {\n setChecked(event.target.checked);\n }\n\n function sellProduct(): void {\n try {\n SellProduct(props.product, props.city, iQty, px, checked);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n }\n\n removePopup(props.popupId);\n }\n\n function onAmtChange(event: React.ChangeEvent): void {\n setQty(event.target.value);\n }\n\n function onPriceChange(event: React.ChangeEvent): void {\n setPx(event.target.value);\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) sellProduct();\n }\n\n return (\n <>\n

    \n Enter the maximum amount of {props.product.name} you would like to sell per second, as well as the price at\n which you would like to sell it at.\n
    \n
    \n If the sell amount is set to 0, then the product will not be sold. If the sell price is set to 0, then the\n product will be discarded.\n
    \n
    \n Setting the sell amount to 'MAX' will result in you always selling the maximum possible amount of the material.\n
    \n
    \n When setting the sell amount, you can use the 'PROD' variable to designate a dynamically changing amount that\n depends on your production. For example, if you set the sell amount to 'PROD-1' then you will always sell 1 less\n of the material than you produce.\n
    \n
    \n When setting the sell price, you can use the 'MP' variable to set a dynamically changing price that depends on\n the Product's estimated market price. For example, if you set it to 'MP*5' then it will always be sold at five\n times the estimated market price.\n

    \n
    \n \n \n \n
    \n \n \n
    \n \n );\n}\n","import React, { useState } from \"react\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { MaterialSizes } from \"../MaterialSizes\";\nimport { Warehouse } from \"../Warehouse\";\nimport { Material } from \"../Material\";\nimport { IIndustry } from \"../IIndustry\";\nimport { ICorporation } from \"../ICorporation\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { BuyMaterial } from \"../Actions\";\n\ninterface IBulkPurchaseTextProps {\n warehouse: Warehouse;\n mat: Material;\n amount: string;\n}\n\nfunction BulkPurchaseText(props: IBulkPurchaseTextProps): React.ReactElement {\n const parsedAmt = parseFloat(props.amount);\n const cost = parsedAmt * props.mat.bCost;\n\n const matSize = MaterialSizes[props.mat.name];\n const maxAmount = (props.warehouse.size - props.warehouse.sizeUsed) / matSize;\n\n if (parsedAmt * matSize > maxAmount) {\n return <>Not enough warehouse space to purchase this amount;\n } else if (isNaN(cost)) {\n return <>Invalid put for Bulk Purchase amount;\n } else {\n return (\n <>\n Purchasing {numeralWrapper.format(parsedAmt, \"0,0.00\")} of {props.mat.name} will cost{\" \"}\n {numeralWrapper.formatMoney(cost)}\n \n );\n }\n}\n\ninterface IProps {\n mat: Material;\n industry: IIndustry;\n warehouse: Warehouse;\n corp: ICorporation;\n popupId: string;\n}\n\nfunction BulkPurchase(props: IProps): React.ReactElement {\n const [buyAmt, setBuyAmt] = useState(\"\");\n\n function bulkPurchase(): void {\n const amount = parseFloat(buyAmt);\n\n const matSize = MaterialSizes[props.mat.name];\n const maxAmount = (props.warehouse.size - props.warehouse.sizeUsed) / matSize;\n if (amount * matSize > maxAmount) {\n dialogBoxCreate(`You do not have enough warehouse size to fit this purchase`);\n return;\n }\n\n if (isNaN(amount)) {\n dialogBoxCreate(\"Invalid input amount\");\n } else {\n const cost = amount * props.mat.bCost;\n if (props.corp.funds.gt(cost)) {\n props.corp.funds = props.corp.funds.minus(cost);\n props.mat.qty += amount;\n } else {\n dialogBoxCreate(`You cannot afford this purchase.`);\n return;\n }\n\n removePopup(props.popupId);\n }\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) bulkPurchase();\n }\n\n function onChange(event: React.ChangeEvent): void {\n setBuyAmt(event.target.value);\n }\n\n return (\n <>\n

    \n Enter the amount of {props.mat.name} you would like to bulk purchase. This purchases the specified amount\n instantly (all at once).\n

    \n \n \n \n \n );\n}\n\n// Create a popup that lets the player purchase a Material\nexport function PurchaseMaterialPopup(props: IProps): React.ReactElement {\n const [buyAmt, setBuyAmt] = useState(props.mat.buy ? props.mat.buy : null);\n\n function purchaseMaterial(): void {\n if (buyAmt === null) return;\n try {\n BuyMaterial(props.mat, buyAmt);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n }\n\n removePopup(props.popupId);\n }\n\n function clearPurchase(): void {\n props.mat.buy = 0;\n removePopup(props.popupId);\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) purchaseMaterial();\n }\n\n function onChange(event: React.ChangeEvent): void {\n setBuyAmt(parseFloat(event.target.value));\n }\n\n return (\n <>\n

    \n Enter the amount of {props.mat.name} you would like to purchase per second. This material's cost changes\n constantly.\n

    \n \n \n \n {props.industry.hasResearch(\"Bulk Purchasing\") && (\n \n )}\n \n );\n}\n","import React, { useState } from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { IIndustry } from \"../IIndustry\";\nimport { Product } from \"../Product\";\n\ninterface IProps {\n product: Product;\n industry: IIndustry;\n popupId: string;\n}\n\nfunction MarketTA2(props: IProps): React.ReactElement {\n const markupLimit = props.product.rat / props.product.mku;\n const [value, setValue] = useState(props.product.pCost);\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n function onChange(event: React.ChangeEvent): void {\n setValue(parseFloat(event.target.value));\n }\n\n function onCheckedChange(event: React.ChangeEvent): void {\n props.product.marketTa2 = event.target.checked;\n rerender();\n }\n\n const sCost = value;\n let markup = 1;\n if (sCost > props.product.pCost) {\n if (sCost - props.product.pCost > markupLimit) {\n markup = markupLimit / (sCost - props.product.pCost);\n }\n }\n\n return (\n <>\n

    \n
    \n \n Market-TA.II\n \n
    \n If you sell at {numeralWrapper.formatMoney(sCost)}, then you will sell{\" \"}\n {numeralWrapper.format(markup, \"0.00000\")}x as much compared to if you sold at market price.\n

    \n \n
    \n \n \n
    \n

    \n Note that Market-TA.II overrides Market-TA.I. This means that if both are enabled, then Market-TA.II will take\n effect, not Market-TA.I\n

    \n \n );\n}\n\n// Create a popup that lets the player use the Market TA research for Products\nexport function ProductMarketTaPopup(props: IProps): React.ReactElement {\n const markupLimit = props.product.rat / props.product.mku;\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n function onChange(event: React.ChangeEvent): void {\n props.product.marketTa1 = event.target.checked;\n rerender();\n }\n\n return (\n <>\n

    \n \n Market-TA.I\n \n
    \n The maximum sale price you can mark this up to is{\" \"}\n {numeralWrapper.formatMoney(props.product.pCost + markupLimit)}. This means that if you set the sale price\n higher than this, you will begin to experience a loss in number of sales.\n

    \n
    \n \n \n
    \n {props.industry.hasResearch(\"Market-TA.II\") && (\n \n )}\n \n );\n}\n","import React, { useState } from \"react\";\n\nimport { Warehouse } from \"../Warehouse\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IIndustry } from \"../IIndustry\";\nimport { SetSmartSupply, SetSmartSupplyUseLeftovers } from \"../Actions\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { Material } from \"../Material\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\n\ninterface ILeftoverProps {\n matName: string;\n warehouse: Warehouse;\n}\n\nfunction Leftover(props: ILeftoverProps): React.ReactElement {\n const [checked, setChecked] = useState(!!props.warehouse.smartSupplyUseLeftovers[props.matName]);\n\n function onChange(event: React.ChangeEvent): void {\n try {\n const material = props.warehouse.materials[props.matName];\n SetSmartSupplyUseLeftovers(props.warehouse, material, event.target.checked);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n }\n setChecked(event.target.checked);\n }\n\n const matNameId = `${props.matName}-use-leftovers`;\n return (\n
    \n \n \n
    \n
    \n );\n}\n\ninterface IProps {\n division: IIndustry;\n warehouse: Warehouse;\n corp: ICorporation;\n player: IPlayer;\n popupId: string;\n}\n\nexport function SmartSupplyPopup(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n // Smart Supply Checkbox\n const smartSupplyCheckboxId = \"cmpy-mgmt-smart-supply-checkbox\";\n function smartSupplyOnChange(e: React.ChangeEvent): void {\n SetSmartSupply(props.warehouse, e.target.checked);\n rerender();\n }\n\n // Create React components for materials\n const mats = [];\n for (const matName in props.warehouse.materials) {\n if (!(props.warehouse.materials[matName] instanceof Material)) continue;\n if (!Object.keys(props.division.reqMats).includes(matName)) continue;\n mats.push();\n }\n\n return (\n <>\n \n \n
    \n

    Use materials already in the warehouse instead of buying new ones, if available:

    \n {mats}\n \n );\n}\n","import { IIndustry } from \"../IIndustry\";\n\n// Returns a boolean indicating whether the given material is relevant for the\n// current industry.\nexport function isRelevantMaterial(matName: string, division: IIndustry): boolean {\n // Materials that affect Production multiplier\n const prodMultiplierMats = [\"Hardware\", \"Robots\", \"AICores\", \"RealEstate\"];\n\n if (Object.keys(division.reqMats).includes(matName)) {\n return true;\n }\n if (division.prodMats.includes(matName)) {\n return true;\n }\n if (prodMultiplierMats.includes(matName)) {\n return true;\n }\n\n return false;\n}\n","import React from \"react\";\nimport { IIndustry } from \"../IIndustry\";\nimport { MathComponent } from \"mathjax-react\";\n\ninterface IProps {\n division: IIndustry;\n}\n\nexport function IndustryProductEquation(props: IProps): React.ReactElement {\n const reqs = [];\n for (const reqMat of Object.keys(props.division.reqMats)) {\n const reqAmt = props.division.reqMats[reqMat];\n if (reqAmt === undefined) continue;\n reqs.push(String.raw`${reqAmt}\\text{ }${reqMat}`);\n }\n const prod = props.division.prodMats.slice();\n if (props.division.makesProducts) {\n prod.push(props.division.type);\n }\n\n return (\n \n String.raw`1\\text{ }${p}`).join(\"+\")}\n />\n \n );\n}\n","// React Component for displaying Corporation Overview info\nimport React from \"react\";\nimport { LevelableUpgrade } from \"./LevelableUpgrade\";\nimport { UnlockUpgrade } from \"./UnlockUpgrade\";\nimport { BribeFactionPopup } from \"./BribeFactionPopup\";\nimport { SellSharesPopup } from \"./SellSharesPopup\";\nimport { BuybackSharesPopup } from \"./BuybackSharesPopup\";\nimport { IssueDividendsPopup } from \"./IssueDividendsPopup\";\nimport { IssueNewSharesPopup } from \"./IssueNewSharesPopup\";\nimport { FindInvestorsPopup } from \"./FindInvestorsPopup\";\nimport { GoPublicPopup } from \"./GoPublicPopup\";\n\nimport { CorporationConstants } from \"../data/Constants\";\nimport { CorporationUnlockUpgrade, CorporationUnlockUpgrades } from \"../data/CorporationUnlockUpgrades\";\nimport { CorporationUpgrade, CorporationUpgrades } from \"../data/CorporationUpgrades\";\n\nimport { CONSTANTS } from \"../../Constants\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { convertTimeMsToTimeElapsedString } from \"../../../utils/StringHelperFunctions\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { Money } from \"../../ui/React/Money\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { ICorporation } from \"../ICorporation\";\n\ninterface IProps {\n corp: ICorporation;\n player: IPlayer;\n rerender: () => void;\n}\nexport function Overview({ corp, player, rerender }: IProps): React.ReactElement {\n const profit: number = corp.revenue.minus(corp.expenses).toNumber();\n\n return (\n
    \n

    \n Total Funds: \n
    \n Total Revenue: / s
    \n Total Expenses: / s\n
    \n Total Profits: / s
    \n \n Publicly Traded: {corp.public ? \"Yes\" : \"No\"}\n
    \n Owned Stock Shares: {numeralWrapper.format(corp.numShares, \"0.000a\")}\n
    \n Stock Price: {corp.public ? : \"N/A\"}\n
    \n

    \n

    \n Total Stock Shares: {numeralWrapper.format(corp.totalShares, \"0.000a\")}\n \n Outstanding Shares: {numeralWrapper.format(corp.issuedShares, \"0.000a\")}\n
    \n Private Shares: {numeralWrapper.format(corp.totalShares - corp.issuedShares - corp.numShares, \"0.000a\")}\n
    \n

    \n
    \n
    \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n corp.getStarterGuide(player)}\n text=\"Getting Started Guide\"\n tooltip={\n \"Get a copy of and read 'The Complete Handbook for Creating a Successful Corporation.' \" +\n \"This is a .lit file that guides you through the beginning of setting up a Corporation and \" +\n \"provides some tips/pointers for helping you get started with managing it.\"\n }\n />\n {corp.public ? (\n \n ) : (\n \n )}\n \n
    \n
    \n \n
    \n );\n}\n\ninterface IPrivateButtonsProps {\n corp: ICorporation;\n player: IPlayer;\n rerender: () => void;\n}\n// Render the buttons for when your Corporation is still private\nfunction PrivateButtons({ corp, player, rerender }: IPrivateButtonsProps): React.ReactElement {\n function openFindInvestorsPopup(): void {\n const popupId = \"cmpy-mgmt-find-investors-popup\";\n createPopup(popupId, FindInvestorsPopup, {\n rerender,\n player,\n popupId,\n corp: corp,\n });\n }\n\n function openGoPublicPopup(): void {\n const popupId = \"cmpy-mgmt-go-public-popup\";\n createPopup(popupId, GoPublicPopup, {\n rerender,\n player,\n popupId,\n corp: corp,\n });\n }\n\n const fundingAvailable = corp.fundingRound < 4;\n const findInvestorsClassName = fundingAvailable ? \"std-button\" : \"a-link-button-inactive\";\n const findInvestorsTooltip = fundingAvailable\n ? \"Search for private investors who will give you startup funding in exchangefor equity (stock shares) in your company\"\n : undefined;\n\n return (\n <>\n \n \n
    \n \n );\n}\n\ninterface IUpgradeProps {\n corp: ICorporation;\n player: IPlayer;\n rerender: () => void;\n}\n// Render the UI for Corporation upgrades\nfunction Upgrades({ corp, player, rerender }: IUpgradeProps): React.ReactElement {\n // Don't show upgrades\n if (corp.divisions.length <= 0) {\n return

    Upgrades are unlocked once you create an industry.

    ;\n }\n\n return (\n
    \n

    Unlocks

    \n {Object.values(CorporationUnlockUpgrades)\n .filter((upgrade: CorporationUnlockUpgrade) => corp.unlockUpgrades[upgrade[0]] === 0)\n .map((upgrade: CorporationUnlockUpgrade) => (\n \n ))}\n\n

    Upgrades

    \n {corp.upgrades\n .map((level: number, i: number) => CorporationUpgrades[i])\n .map((upgrade: CorporationUpgrade) => (\n \n ))}\n
    \n );\n}\n\ninterface IPublicButtonsProps {\n corp: ICorporation;\n player: IPlayer;\n rerender: () => void;\n}\n\n// Render the buttons for when your Corporation has gone public\nfunction PublicButtons({ corp, player, rerender }: IPublicButtonsProps): React.ReactElement {\n const sellSharesOnCd = corp.shareSaleCooldown > 0;\n const sellSharesClass = sellSharesOnCd ? \"a-link-button-inactive\" : \"std-button\";\n const sellSharesTooltip = sellSharesOnCd\n ? \"Cannot sell shares for \" + corp.convertCooldownToString(corp.shareSaleCooldown)\n : \"Sell your shares in the company. The money earned from selling your \" +\n \"shares goes into your personal account, not the Corporation's. \" +\n \"This is one of the only ways to profit from your business venture.\";\n\n const issueNewSharesOnCd = corp.issueNewSharesCooldown > 0;\n const issueNewSharesClass = issueNewSharesOnCd ? \"a-link-button-inactive\" : \"std-button\";\n const issueNewSharesTooltip = issueNewSharesOnCd\n ? \"Cannot issue new shares for \" + corp.convertCooldownToString(corp.issueNewSharesCooldown)\n : \"Issue new equity shares to raise capital.\";\n\n function openSellSharesPopup(): void {\n const popupId = \"cmpy-mgmt-sell-shares-popup\";\n createPopup(popupId, SellSharesPopup, {\n corp: corp,\n player,\n popupId,\n rerender,\n });\n }\n\n function openBuybackSharesPopup(): void {\n const popupId = \"corp-buyback-shares-popup\";\n createPopup(popupId, BuybackSharesPopup, {\n rerender,\n player,\n popupId,\n corp: corp,\n });\n }\n\n function openIssueNewSharesPopup(): void {\n const popupId = \"cmpy-mgmt-issue-new-shares-popup\";\n createPopup(popupId, IssueNewSharesPopup, {\n popupId,\n corp: corp,\n });\n }\n\n function openIssueDividendsPopup(): void {\n const popupId = \"cmpy-mgmt-issue-dividends-popup\";\n createPopup(popupId, IssueDividendsPopup, {\n popupId,\n corp: corp,\n });\n }\n\n return (\n <>\n \n \n
    \n \n \n
    \n \n );\n}\n\n// Generic Function for Creating a button\ninterface ICreateButtonProps {\n text: string;\n className?: string;\n display?: string;\n tooltip?: string;\n onClick?: (event: React.MouseEvent) => void;\n}\n\nfunction Button({ className = \"std-button\", text, display, tooltip, onClick }: ICreateButtonProps): React.ReactElement {\n const hasTooltip = tooltip != null;\n if (hasTooltip) className += \" tooltip\";\n return (\n \n );\n}\n\ninterface IBribeButtonProps {\n player: IPlayer;\n corp: ICorporation;\n}\nfunction BribeButton({ player, corp }: IBribeButtonProps): React.ReactElement {\n function openBribeFactionPopup(): void {\n const popupId = \"corp-bribe-popup\";\n createPopup(popupId, BribeFactionPopup, {\n player,\n popupId,\n corp: corp,\n });\n }\n\n const canBribe = corp.determineValuation() >= CorporationConstants.BribeThreshold || true;\n const bribeFactionsClass = canBribe ? \"a-link-button\" : \"a-link-button-inactive\";\n return (\n \n );\n}\n\ninterface IDividendsStatsProps {\n corp: ICorporation;\n profit: number;\n}\nfunction DividendsStats({ corp, profit }: IDividendsStatsProps): React.ReactElement {\n if (corp.dividendPercentage <= 0 || profit <= 0) return <>;\n const totalDividends = (corp.dividendPercentage / 100) * profit;\n const retainedEarnings = profit - totalDividends;\n const dividendsPerShare = totalDividends / corp.totalShares;\n const playerEarnings = corp.numShares * dividendsPerShare;\n return (\n <>\n Retained Profits (after dividends): / s\n
    \n
    \n Dividend Percentage: {numeralWrapper.format(corp.dividendPercentage / 100, \"0%\")}\n
    \n Dividends per share: / s
    \n Your earnings as a shareholder (Pre-Tax): / s
    \n Dividend Tax Rate: {corp.dividendTaxPercentage}%
    \n Your earnings as a shareholder (Post-Tax):{\" \"}\n / s
    \n
    \n \n );\n}\n\ninterface IMultProps {\n name: string;\n mult: number;\n}\nfunction Mult({ name, mult }: IMultProps): React.ReactElement {\n if (mult <= 1) return <>;\n return (\n

    \n {name}\n {numeralWrapper.format(mult, \"0.000\")}\n
    \n

    \n );\n}\n\ninterface IBonusTimeProps {\n corp: ICorporation;\n}\n// Returns a string with general information about Corporation\nfunction BonusTime({ corp }: IBonusTimeProps): React.ReactElement {\n const storedTime = corp.storedCycles * CONSTANTS.MilliPerCycle;\n if (storedTime <= 15000) return <>;\n return (\n

    \n Bonus time: {convertTimeMsToTimeElapsedString(storedTime)}\n
    \n
    \n

    \n );\n}\n","// React components for the levelable upgrade buttons on the overview panel\nimport React from \"react\";\n\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { CorporationUpgrade } from \"../data/CorporationUpgrades\";\nimport { LevelUpgrade } from \"../Actions\";\nimport { MoneyCost } from \"./MoneyCost\";\n\ninterface IProps {\n upgrade: CorporationUpgrade;\n corp: ICorporation;\n player: IPlayer;\n rerender: () => void;\n}\n\nexport function LevelableUpgrade(props: IProps): React.ReactElement {\n const data = props.upgrade;\n const level = props.corp.upgrades[data[0]];\n\n const baseCost = data[1];\n const priceMult = data[2];\n const cost = baseCost * Math.pow(priceMult, level);\n\n const text = (\n <>\n {data[4]} - \n \n );\n const tooltip = data[5];\n function onClick(): void {\n if (props.corp.funds.lt(cost)) return;\n try {\n LevelUpgrade(props.corp, props.upgrade);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n }\n props.rerender();\n }\n\n return (\n \n );\n}\n","// React Components for the Unlock upgrade buttons on the overview page\nimport React from \"react\";\n\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { CorporationUnlockUpgrade } from \"../data/CorporationUnlockUpgrades\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { UnlockUpgrade as UU } from \"../Actions\";\nimport { MoneyCost } from \"./MoneyCost\";\n\ninterface IProps {\n upgradeData: CorporationUnlockUpgrade;\n corp: ICorporation;\n player: IPlayer;\n rerender: () => void;\n}\n\nexport function UnlockUpgrade(props: IProps): React.ReactElement {\n const data = props.upgradeData;\n const text = (\n <>\n {data[2]} - \n \n );\n const tooltip = data[3];\n function onClick(): void {\n if (props.corp.funds.lt(data[1])) return;\n try {\n UU(props.corp, props.upgradeData);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n }\n props.rerender();\n }\n\n return (\n \n );\n}\n","import React, { useState } from \"react\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { Factions } from \"../../Faction/Factions\";\nimport { CorporationConstants } from \"../data/Constants\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { ICorporation } from \"../ICorporation\";\n\ninterface IProps {\n popupId: string;\n corp: ICorporation;\n player: IPlayer;\n}\n\nexport function BribeFactionPopup(props: IProps): React.ReactElement {\n const [money, setMoney] = useState(0);\n const [stock, setStock] = useState(0);\n const [selectedFaction, setSelectedFaction] = useState(\n props.player.factions.length > 0 ? props.player.factions[0] : \"\",\n );\n\n function onMoneyChange(event: React.ChangeEvent): void {\n setMoney(parseFloat(event.target.value));\n }\n\n function onStockChange(event: React.ChangeEvent): void {\n setStock(parseFloat(event.target.value));\n }\n\n function changeFaction(event: React.ChangeEvent): void {\n setSelectedFaction(event.target.value);\n }\n\n function repGain(money: number, stock: number): number {\n return (money + stock * props.corp.sharePrice) / CorporationConstants.BribeToRepRatio;\n }\n\n function getRepText(money: number, stock: number): string {\n if (money === 0 && stock === 0) return \"\";\n if (isNaN(money) || isNaN(stock) || money < 0 || stock < 0) {\n return \"ERROR: Invalid value(s) entered\";\n } else if (props.corp.funds.lt(money)) {\n return \"ERROR: You do not have this much money to bribe with\";\n } else if (stock > props.corp.numShares) {\n return \"ERROR: You do not have this many shares to bribe with\";\n } else {\n return (\n \"You will gain \" +\n numeralWrapper.formatReputation(repGain(money, stock)) +\n \" reputation with \" +\n selectedFaction +\n \" with this bribe\"\n );\n }\n }\n\n function bribe(money: number, stock: number): void {\n const fac = Factions[selectedFaction];\n if (fac == null) {\n dialogBoxCreate(\"ERROR: You must select a faction to bribe\");\n }\n if (isNaN(money) || isNaN(stock) || money < 0 || stock < 0) {\n } else if (props.corp.funds.lt(money)) {\n } else if (stock > props.corp.numShares) {\n } else {\n const rep = repGain(money, stock);\n dialogBoxCreate(\n \"You gained \" + numeralWrapper.formatReputation(rep) + \" reputation with \" + fac.name + \" by bribing them.\",\n );\n fac.playerReputation += rep;\n props.corp.funds = props.corp.funds.minus(money);\n props.corp.numShares -= stock;\n removePopup(props.popupId);\n }\n }\n\n return (\n <>\n

    You can use Corporation funds or stock shares to bribe Faction Leaders in exchange for faction reputation.

    \n \n

    {getRepText(money ? money : 0, stock ? stock : 0)}

    \n \n \n bribe(money ? money : 0, stock ? stock : 0)}\n style={{ display: \"inline-block\" }}\n >\n Bribe\n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { CorporationConstants } from \"../data/Constants\";\nimport { ICorporation } from \"../ICorporation\";\n\ninterface IProps {\n corp: ICorporation;\n player: IPlayer;\n popupId: string;\n rerender: () => void;\n}\n\n// Create a popup that lets the player sell Corporation shares\n// This is created when the player clicks the \"Sell Shares\" button in the overview panel\nexport function SellSharesPopup(props: IProps): React.ReactElement {\n const [shares, setShares] = useState(null);\n\n function changeShares(event: React.ChangeEvent): void {\n if (event.target.value === \"\") setShares(null);\n else setShares(Math.round(parseFloat(event.target.value)));\n }\n\n function ProfitIndicator(props: { shares: number | null; corp: ICorporation }): React.ReactElement {\n if (props.shares === null) return <>;\n if (isNaN(props.shares) || props.shares <= 0) {\n return <>ERROR: Invalid value entered for number of shares to sell;\n } else if (props.shares > props.corp.numShares) {\n return <>You don't have this many shares to sell!;\n } else {\n const stockSaleResults = props.corp.calculateShareSale(props.shares);\n const profit = stockSaleResults[0];\n return (\n <>\n Sell {props.shares} shares for a total of {numeralWrapper.formatMoney(profit)}\n \n );\n }\n }\n\n function sell(): void {\n if (shares === null) return;\n if (isNaN(shares) || shares <= 0) {\n dialogBoxCreate(\"ERROR: Invalid value for number of shares\");\n } else if (shares > props.corp.numShares) {\n dialogBoxCreate(\"ERROR: You don't have this many shares to sell\");\n } else {\n const stockSaleResults = props.corp.calculateShareSale(shares);\n const profit = stockSaleResults[0];\n const newSharePrice = stockSaleResults[1];\n const newSharesUntilUpdate = stockSaleResults[2];\n\n props.corp.numShares -= shares;\n if (isNaN(props.corp.issuedShares)) {\n console.error(`Corporation issuedShares is NaN: ${props.corp.issuedShares}`);\n const res = props.corp.issuedShares;\n if (isNaN(res)) {\n props.corp.issuedShares = 0;\n } else {\n props.corp.issuedShares = res;\n }\n }\n props.corp.issuedShares += shares;\n props.corp.sharePrice = newSharePrice;\n props.corp.shareSalesUntilPriceUpdate = newSharesUntilUpdate;\n props.corp.shareSaleCooldown = CorporationConstants.SellSharesCooldown;\n props.player.gainMoney(profit);\n props.player.recordMoneySource(profit, \"corporation\");\n removePopup(props.popupId);\n dialogBoxCreate(\n `Sold ${numeralWrapper.formatMoney(shares)} shares for ` +\n `${numeralWrapper.formatMoney(profit)}. ` +\n `The corporation's stock price fell to ${numeralWrapper.formatMoney(props.corp.sharePrice)} ` +\n `as a result of dilution.`,\n );\n\n props.rerender();\n }\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) sell();\n }\n\n return (\n <>\n

    \n Enter the number of shares you would like to sell. The money from selling your shares will go directly to you\n (NOT your Corporation).\n
    \n
    \n Selling your shares will cause your corporation's stock price to fall due to dilution. Furthermore, selling a\n large number of shares all at once will have an immediate effect in reducing your stock price.\n
    \n
    \n The current price of your company's stock is {numeralWrapper.formatMoney(props.corp.sharePrice)}\n

    \n \n
    \n \n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { ICorporation } from \"../ICorporation\";\n\ninterface IProps {\n player: IPlayer;\n popupId: string;\n corp: ICorporation;\n rerender: () => void;\n}\n\n// Create a popup that lets the player buyback shares\n// This is created when the player clicks the \"Buyback Shares\" button in the overview panel\nexport function BuybackSharesPopup(props: IProps): React.ReactElement {\n const [shares, setShares] = useState(null);\n\n function changeShares(event: React.ChangeEvent): void {\n if (event.target.value === \"\") setShares(null);\n else setShares(Math.round(parseFloat(event.target.value)));\n }\n\n const currentStockPrice = props.corp.sharePrice;\n const buybackPrice = currentStockPrice * 1.1;\n\n function buy(): void {\n if (shares === null) return;\n const tempStockPrice = props.corp.sharePrice;\n const buybackPrice = tempStockPrice * 1.1;\n if (isNaN(shares) || shares <= 0) {\n dialogBoxCreate(\"ERROR: Invalid value for number of shares\");\n } else if (shares > props.corp.issuedShares) {\n dialogBoxCreate(\"ERROR: There are not this many oustanding shares to buy back\");\n } else if (shares * buybackPrice > props.player.money) {\n dialogBoxCreate(\n \"ERROR: You do not have enough money to purchase this many shares (you need \" +\n numeralWrapper.format(shares * buybackPrice, \"$0.000a\") +\n \")\",\n );\n } else {\n props.corp.numShares += shares;\n if (isNaN(props.corp.issuedShares)) {\n console.warn(\"Corporation issuedShares is NaN: \" + props.corp.issuedShares);\n console.warn(\"Converting to number now\");\n const res = props.corp.issuedShares;\n if (isNaN(res)) {\n props.corp.issuedShares = 0;\n } else {\n props.corp.issuedShares = res;\n }\n }\n props.corp.issuedShares -= shares;\n props.player.loseMoney(shares * buybackPrice);\n removePopup(props.popupId);\n props.rerender();\n }\n }\n\n function CostIndicator(): React.ReactElement {\n if (shares === null) return <>;\n if (isNaN(shares) || shares <= 0) {\n return <>ERROR: Invalid value entered for number of shares to buyback;\n } else if (shares > props.corp.issuedShares) {\n return (\n <>\n There are not this many shares available to buy back. There are only{\" \"}\n {numeralWrapper.formatBigNumber(props.corp.issuedShares)} outstanding shares.\n \n );\n } else {\n return (\n <>\n Purchase {shares} shares for a total of {numeralWrapper.formatMoney(shares * buybackPrice)}\n \n );\n }\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) buy();\n }\n\n return (\n <>\n

    \n Enter the number of outstanding shares you would like to buy back. These shares must be bought at a 10% premium.\n However, repurchasing shares from the market tends to lead to an increase in stock price.\n
    \n
    \n To purchase these shares, you must use your own money (NOT your Corporation's funds).\n
    \n
    \n The current buyback price of your company's stock is {numeralWrapper.formatMoney(buybackPrice)}. Your company\n currently has {numeralWrapper.formatBigNumber(props.corp.issuedShares)} outstanding stock shares.\n

    \n \n
    \n \n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { CorporationConstants } from \"../data/Constants\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IssueDividends } from \"../Actions\";\n\ninterface IProps {\n popupId: string;\n corp: ICorporation;\n}\n\n// Create a popup that lets the player issue & manage dividends\n// This is created when the player clicks the \"Issue Dividends\" button in the overview panel\nexport function IssueDividendsPopup(props: IProps): React.ReactElement {\n const [percent, setPercent] = useState(null);\n\n function issueDividends(): void {\n if (percent === null) return;\n try {\n IssueDividends(props.corp, percent / 100);\n } catch (err) {\n dialogBoxCreate(err + \"\");\n }\n\n removePopup(props.popupId);\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) issueDividends();\n }\n\n function onChange(event: React.ChangeEvent): void {\n if (event.target.value === \"\") setPercent(null);\n else setPercent(parseFloat(event.target.value));\n }\n\n return (\n <>\n

    \n Dividends are a distribution of a portion of the corporation's profits to the shareholders. This includes\n yourself, as well.\n
    \n
    \n In order to issue dividends, simply allocate some percentage of your corporation's profits to dividends. This\n percentage must be an integer between 0 and {CorporationConstants.DividendMaxPercentage}. (A percentage of 0\n means no dividends will be issued\n
    \n
    \n Two important things to note:\n
    \n * Issuing dividends will negatively affect your corporation's stock price\n
    \n * Dividends are taxed. Taxes start at 50%, but can be decreased\n
    \n
    \n Example: Assume your corporation makes $100m / sec in profit and you allocate 40% of that towards dividends.\n That means your corporation will gain $60m / sec in funds and the remaining $40m / sec will be paid as\n dividends. Since your corporation starts with 1 billion shares, every shareholder will be paid $0.04 per share\n per second before taxes.\n

    \n \n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { getRandomInt } from \"../../../utils/helpers/getRandomInt\";\nimport { CorporationConstants } from \"../data/Constants\";\nimport { ICorporation } from \"../ICorporation\";\n\ninterface IEffectTextProps {\n corp: ICorporation;\n shares: number | null;\n}\n\nfunction EffectText(props: IEffectTextProps): React.ReactElement {\n if (props.shares === null) return <>;\n const newSharePrice = Math.round(props.corp.sharePrice * 0.9);\n const maxNewSharesUnrounded = Math.round(props.corp.totalShares * 0.2);\n const maxNewShares = maxNewSharesUnrounded - (maxNewSharesUnrounded % 1e6);\n let newShares = props.shares;\n if (isNaN(newShares)) {\n return

    Invalid input

    ;\n }\n\n // Round to nearest ten-millionth\n newShares /= 10e6;\n newShares = Math.round(newShares) * 10e6;\n\n if (newShares < 10e6) {\n return

    Must issue at least 10 million new shares

    ;\n }\n\n if (newShares > maxNewShares) {\n return

    You cannot issue that many shares

    ;\n }\n\n return (\n

    \n Issue ${numeralWrapper.format(newShares, \"0.000a\")} new shares for{\" \"}\n {numeralWrapper.formatMoney(newShares * newSharePrice)}?\n

    \n );\n}\n\ninterface IProps {\n corp: ICorporation;\n popupId: string;\n}\n\n// Create a popup that lets the player issue new shares\n// This is created when the player clicks the \"Issue New Shares\" buttons in the overview panel\nexport function IssueNewSharesPopup(props: IProps): React.ReactElement {\n const [shares, setShares] = useState(null);\n const maxNewSharesUnrounded = Math.round(props.corp.totalShares * 0.2);\n const maxNewShares = maxNewSharesUnrounded - (maxNewSharesUnrounded % 1e6);\n\n function issueNewShares(): void {\n if (shares === null) return;\n const newSharePrice = Math.round(props.corp.sharePrice * 0.9);\n let newShares = shares;\n if (isNaN(newShares)) {\n dialogBoxCreate(\"Invalid input for number of new shares\");\n return;\n }\n\n // Round to nearest ten-millionth\n newShares = Math.round(newShares / 10e6) * 10e6;\n\n if (newShares < 10e6 || newShares > maxNewShares) {\n dialogBoxCreate(\"Invalid input for number of new shares\");\n return;\n }\n\n const profit = newShares * newSharePrice;\n props.corp.issueNewSharesCooldown = CorporationConstants.IssueNewSharesCooldown;\n props.corp.totalShares += newShares;\n\n // Determine how many are bought by private investors\n // Private investors get up to 50% at most\n // Round # of private shares to the nearest millionth\n let privateShares = getRandomInt(0, Math.round(newShares / 2));\n privateShares = Math.round(privateShares / 1e6) * 1e6;\n\n props.corp.issuedShares += newShares - privateShares;\n props.corp.funds = props.corp.funds.plus(profit);\n props.corp.immediatelyUpdateSharePrice();\n\n removePopup(props.popupId);\n dialogBoxCreate(\n `Issued ${numeralWrapper.format(newShares, \"0.000a\")} and raised ` +\n `${numeralWrapper.formatMoney(profit)}. ${numeralWrapper.format(privateShares, \"0.000a\")} ` +\n `of these shares were bought by private investors.

    ` +\n `Stock price decreased to ${numeralWrapper.formatMoney(props.corp.sharePrice)}`,\n );\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) issueNewShares();\n }\n\n function onChange(event: React.ChangeEvent): void {\n if (event.target.value === \"\") setShares(null);\n else setShares(parseFloat(event.target.value));\n }\n\n return (\n <>\n

    \n You can issue new equity shares (i.e. stocks) in order to raise capital for your corporation.\n
    \n
    \n  * You can issue at most {numeralWrapper.formatMoney(maxNewShares)} new shares\n
    \n  * New shares are sold at a 10% discount\n
    \n  * You can only issue new shares once every 12 hours\n
    \n  * Issuing new shares causes dilution, resulting in a decrease in stock price and lower dividends per share\n
    \n  * Number of new shares issued must be a multiple of 10 million\n
    \n
    \n When you choose to issue new equity, private shareholders have first priority for up to 50% of the new shares.\n If they choose to exercise this option, these newly issued shares become private, restricted shares, which means\n you cannot buy them back.\n

    \n \n \n \n \n );\n}\n","import React from \"react\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { CorporationConstants } from \"../data/Constants\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n corp: ICorporation;\n popupId: string;\n player: IPlayer;\n rerender: () => void;\n}\n\n// Create a popup that lets the player manage exports\nexport function FindInvestorsPopup(props: IProps): React.ReactElement {\n const val = props.corp.determineValuation();\n let percShares = 0;\n let roundMultiplier = 4;\n switch (props.corp.fundingRound) {\n case 0: //Seed\n percShares = 0.1;\n roundMultiplier = 4;\n break;\n case 1: //Series A\n percShares = 0.35;\n roundMultiplier = 3;\n break;\n case 2: //Series B\n percShares = 0.25;\n roundMultiplier = 3;\n break;\n case 3: //Series C\n percShares = 0.2;\n roundMultiplier = 2.5;\n break;\n default:\n return <>;\n }\n const funding = val * percShares * roundMultiplier;\n const investShares = Math.floor(CorporationConstants.INITIALSHARES * percShares);\n\n function findInvestors(): void {\n props.corp.fundingRound++;\n props.corp.addFunds(funding);\n props.corp.numShares -= investShares;\n props.rerender();\n removePopup(props.popupId);\n }\n return (\n <>\n

    \n An investment firm has offered you {numeralWrapper.formatMoney(funding)} in funding in exchange for a{\" \"}\n {numeralWrapper.format(percShares * 100, \"0.000a\")}% stake in the company (\n {numeralWrapper.format(investShares, \"0.000a\")} shares).\n
    \n
    \n Do you accept or reject this offer?\n
    \n
    \n Hint: Investment firms will offer more money if your corporation is turning a profit\n

    \n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { ICorporation } from \"../ICorporation\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\ninterface IProps {\n corp: ICorporation;\n popupId: string;\n player: IPlayer;\n rerender: () => void;\n}\n\n// Create a popup that lets the player manage exports\nexport function GoPublicPopup(props: IProps): React.ReactElement {\n const [shares, setShares] = useState(\"\");\n const initialSharePrice = props.corp.determineValuation() / props.corp.totalShares;\n\n function goPublic(): void {\n const numShares = parseFloat(shares);\n const initialSharePrice = props.corp.determineValuation() / props.corp.totalShares;\n if (isNaN(numShares)) {\n dialogBoxCreate(\"Invalid value for number of issued shares\");\n return;\n }\n if (numShares > props.corp.numShares) {\n dialogBoxCreate(\"Error: You don't have that many shares to issue!\");\n return;\n }\n props.corp.public = true;\n props.corp.sharePrice = initialSharePrice;\n props.corp.issuedShares = numShares;\n props.corp.numShares -= numShares;\n props.corp.addFunds(numShares * initialSharePrice);\n props.rerender();\n dialogBoxCreate(\n `You took your ${props.corp.name} public and earned ` +\n `${numeralWrapper.formatMoney(numShares * initialSharePrice)} in your IPO`,\n );\n removePopup(props.popupId);\n }\n\n function onKeyDown(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) goPublic();\n }\n\n function onChange(event: React.ChangeEvent): void {\n setShares(event.target.value);\n }\n\n return (\n <>\n

    \n Enter the number of shares you would like to issue for your IPO. These shares will be publicly sold and you will\n no longer own them. Your Corporation will receive {numeralWrapper.formatMoney(initialSharePrice)} per share (the\n IPO money will be deposited directly into your Corporation's funds).\n
    \n
    \n You have a total of {numeralWrapper.format(props.corp.numShares, \"0.000a\")} of shares that you can issue.\n

    \n \n \n \n );\n}\n","import { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport React, { useState } from \"react\";\nimport { Intro } from \"./Intro\";\nimport { Game } from \"./Game\";\nimport { Location } from \"../../Locations/Location\";\nimport { use } from \"../../ui/Context\";\n\ninterface IProps {\n location: Location;\n}\nfunction calcDifficulty(player: IPlayer, startingDifficulty: number): number {\n const totalStats = player.strength + player.defense + player.dexterity + player.agility + player.charisma;\n const difficulty = startingDifficulty - Math.pow(totalStats, 0.9) / 250 - player.intelligence / 1600;\n if (difficulty < 0) return 0;\n if (difficulty > 3) return 3;\n return difficulty;\n}\n\nexport function InfiltrationRoot(props: IProps): React.ReactElement {\n const player = use.Player();\n const router = use.Router();\n const [start, setStart] = useState(false);\n\n if (props.location.infiltrationData === undefined) throw new Error(\"Trying to do infiltration on invalid location.\");\n const startingDifficulty = props.location.infiltrationData.startingSecurityLevel;\n const difficulty = calcDifficulty(player, startingDifficulty);\n\n function cancel(): void {\n router.toCity();\n }\n\n if (!start) {\n return (\n setStart(true)}\n cancel={cancel}\n />\n );\n }\n\n return (\n \n );\n}\n","import React from \"react\";\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { Location } from \"../../Locations/Location\";\nimport Grid from \"@mui/material/Grid\";\n\ninterface IProps {\n Location: Location;\n Difficulty: number;\n MaxLevel: number;\n start: () => void;\n cancel: () => void;\n}\n\nfunction arrowPart(color: string, length: number): JSX.Element {\n let arrow = \"\";\n if (length <= 0) length = 0;\n else if (length > 13) length = 13;\n else {\n length--;\n arrow = \">\";\n }\n return (\n \n {\"=\".repeat(length)}\n {arrow}\n {\" \".repeat(13 - arrow.length - length)}\n \n );\n}\n\nfunction coloredArrow(difficulty: number): JSX.Element {\n if (difficulty === 0) {\n return (\n \n {\">\"}\n {\" \".repeat(38)}\n \n );\n } else {\n return (\n <>\n {arrowPart(\"white\", difficulty * 13)}\n {arrowPart(\"orange\", (difficulty - 1) * 13)}\n {arrowPart(\"red\", (difficulty - 2) * 13)}\n \n );\n }\n}\n\nexport function Intro(props: IProps): React.ReactElement {\n return (\n <>\n \n \n

    Infiltrating {props.Location.name}

    \n
    \n \n

    Maximum level: {props.MaxLevel}

    \n
    \n \n
    [{coloredArrow(props.Difficulty)}]
    \n
    {` ^            ^            ^           ^`}
    \n
    {` Trivial    Normal        Hard    Impossible`}
    \n
    \n \n

    \n Infiltration is a series of short minigames that get progressively harder. You take damage for failing them.\n Reaching the maximum level rewards you with intel you can trade for money or reputation.\n

    \n
    \n

    The minigames you play are randomly selected. It might take you few tries to get used to them.

    \n
    \n

    No game require use of the mouse.

    \n
    \n

    Spacebar is the default action/confirm button.

    \n
    \n

    Everything that uses arrow can also use WASD

    \n
    \n

    Sometimes the rest of the keyboard is used.

    \n
    \n \n \n \n \n \n \n
    \n \n );\n}\n","import { use } from \"../../ui/Context\";\nimport React, { useState } from \"react\";\nimport Grid from \"@mui/material/Grid\";\nimport { Countdown } from \"./Countdown\";\nimport { BracketGame } from \"./BracketGame\";\nimport { SlashGame } from \"./SlashGame\";\nimport { BackwardGame } from \"./BackwardGame\";\nimport { BribeGame } from \"./BribeGame\";\nimport { CheatCodeGame } from \"./CheatCodeGame\";\nimport { Cyberpunk2077Game } from \"./Cyberpunk2077Game\";\nimport { MinesweeperGame } from \"./MinesweeperGame\";\nimport { WireCuttingGame } from \"./WireCuttingGame\";\nimport { Victory } from \"./Victory\";\n\ninterface IProps {\n StartingDifficulty: number;\n Difficulty: number;\n MaxLevel: number;\n}\n\nenum Stage {\n Countdown = 0,\n Minigame,\n Result,\n Sell,\n}\n\nconst minigames = [\n SlashGame,\n BracketGame,\n BackwardGame,\n BribeGame,\n CheatCodeGame,\n Cyberpunk2077Game,\n MinesweeperGame,\n WireCuttingGame,\n];\n\nexport function Game(props: IProps): React.ReactElement {\n const player = use.Player();\n const router = use.Router();\n const [level, setLevel] = useState(1);\n const [stage, setStage] = useState(Stage.Countdown);\n const [results, setResults] = useState(\"\");\n const [gameIds, setGameIds] = useState({\n lastGames: [-1, -1],\n id: Math.floor(Math.random() * minigames.length),\n });\n\n function nextGameId(): number {\n let id = gameIds.lastGames[0];\n const ids = [gameIds.lastGames[0], gameIds.lastGames[1], gameIds.id];\n while (ids.includes(id)) {\n id = Math.floor(Math.random() * minigames.length);\n }\n return id;\n }\n\n function setupNextGame(): void {\n setGameIds({\n lastGames: [gameIds.lastGames[1], gameIds.id],\n id: nextGameId(),\n });\n }\n\n function success(): void {\n pushResult(true);\n if (level === props.MaxLevel) {\n setStage(Stage.Sell);\n } else {\n setStage(Stage.Countdown);\n setLevel(level + 1);\n }\n setupNextGame();\n }\n\n function pushResult(win: boolean): void {\n setResults((old) => {\n let next = old;\n next += win ? \"✓\" : \"✗\";\n if (next.length > 15) next = next.slice(1);\n return next;\n });\n }\n\n function failure(options?: { automated: boolean }): void {\n setStage(Stage.Countdown);\n pushResult(false);\n // Kill the player immediately if they use automation, so\n // it's clear they're not meant to\n const damage = options?.automated ? player.hp : props.StartingDifficulty * 3;\n if (player.takeDamage(damage)) {\n router.toCity();\n return;\n }\n setupNextGame();\n }\n\n let stageComponent: React.ReactNode;\n switch (stage) {\n case Stage.Countdown:\n stageComponent = setStage(Stage.Minigame)} />;\n break;\n case Stage.Minigame: {\n const MiniGame = minigames[gameIds.id];\n stageComponent = ;\n break;\n }\n case Stage.Sell:\n stageComponent = (\n \n );\n break;\n }\n\n function Progress(): React.ReactElement {\n return (\n

    \n {results.slice(0, results.length - 1)}\n {results[results.length - 1]}\n

    \n );\n }\n\n return (\n <>\n \n \n

    \n Level: {level} / {props.MaxLevel}\n

    \n \n
    \n\n \n {stageComponent}\n \n
    \n \n );\n}\n","import React, { useState, useEffect } from \"react\";\nimport Grid from \"@mui/material/Grid\";\n\ninterface IProps {\n onFinish: () => void;\n}\n\nexport function Countdown(props: IProps): React.ReactElement {\n const [x, setX] = useState(3);\n useEffect(() => {\n if (x === 0) {\n props.onFinish();\n return;\n }\n setTimeout(() => setX(x - 1), 200);\n });\n\n return (\n <>\n \n \n

    Get Ready!

    \n

    {x}

    \n
    \n
    \n \n );\n}\n","import React, { useState } from \"react\";\nimport Grid from \"@mui/material/Grid\";\nimport { IMinigameProps } from \"./IMinigameProps\";\nimport { KeyHandler } from \"./KeyHandler\";\nimport { GameTimer } from \"./GameTimer\";\nimport { random } from \"../utils\";\nimport { interpolate } from \"./Difficulty\";\nimport { BlinkingCursor } from \"./BlinkingCursor\";\n\ninterface Difficulty {\n [key: string]: number;\n timer: number;\n min: number;\n max: number;\n}\n\nconst difficulties: {\n Trivial: Difficulty;\n Normal: Difficulty;\n Hard: Difficulty;\n Impossible: Difficulty;\n} = {\n Trivial: { timer: 8000, min: 2, max: 3 },\n Normal: { timer: 6000, min: 4, max: 5 },\n Hard: { timer: 4000, min: 4, max: 6 },\n Impossible: { timer: 2500, min: 7, max: 7 },\n};\n\nfunction generateLeftSide(difficulty: Difficulty): string {\n let str = \"\";\n const length = random(difficulty.min, difficulty.max);\n for (let i = 0; i < length; i++) {\n str += [\"[\", \"<\", \"(\", \"{\"][Math.floor(Math.random() * 4)];\n }\n\n return str;\n}\n\nfunction getChar(event: React.KeyboardEvent): string {\n if (event.keyCode == 48 && event.shiftKey) return \")\";\n if (event.keyCode == 221 && !event.shiftKey) return \"]\";\n if (event.keyCode == 221 && event.shiftKey) return \"}\";\n if (event.keyCode == 190 && event.shiftKey) return \">\";\n return \"\";\n}\n\nfunction match(left: string, right: string): boolean {\n return (\n (left === \"[\" && right === \"]\") ||\n (left === \"<\" && right === \">\") ||\n (left === \"(\" && right === \")\") ||\n (left === \"{\" && right === \"}\")\n );\n}\n\nexport function BracketGame(props: IMinigameProps): React.ReactElement {\n const difficulty: Difficulty = { timer: 0, min: 0, max: 0 };\n interpolate(difficulties, props.difficulty, difficulty);\n const timer = difficulty.timer;\n const [right, setRight] = useState(\"\");\n const [left] = useState(generateLeftSide(difficulty));\n\n function press(event: React.KeyboardEvent): void {\n event.preventDefault();\n const char = getChar(event);\n if (!char) return;\n if (!match(left[left.length - right.length - 1], char)) {\n props.onFailure();\n return;\n }\n if (left.length === right.length + 1) {\n props.onSuccess();\n return;\n }\n setRight(right + char);\n }\n\n return (\n \n \n \n

    Close the brackets

    \n

    \n {`${left}${right}`}\n \n

    \n \n
    \n
    \n );\n}\n","import React, { useState, useEffect } from \"react\";\nimport Grid from \"@mui/material/Grid\";\nimport { IMinigameProps } from \"./IMinigameProps\";\nimport { KeyHandler } from \"./KeyHandler\";\nimport { GameTimer } from \"./GameTimer\";\nimport { interpolate } from \"./Difficulty\";\n\ninterface Difficulty {\n [key: string]: number;\n window: number;\n}\n\nconst difficulties: {\n Trivial: Difficulty;\n Normal: Difficulty;\n Hard: Difficulty;\n Impossible: Difficulty;\n} = {\n Trivial: { window: 600 },\n Normal: { window: 325 },\n Hard: { window: 250 },\n Impossible: { window: 150 },\n};\n\nexport function SlashGame(props: IMinigameProps): React.ReactElement {\n const difficulty: Difficulty = { window: 0 };\n interpolate(difficulties, props.difficulty, difficulty);\n const [guarding, setGuarding] = useState(true);\n\n function press(event: React.KeyboardEvent): void {\n event.preventDefault();\n if (event.keyCode !== 32) return;\n if (guarding) {\n props.onFailure();\n } else {\n props.onSuccess();\n }\n }\n\n useEffect(() => {\n let id2 = -1;\n const id = window.setTimeout(() => {\n setGuarding(false);\n id2 = window.setTimeout(() => setGuarding(true), difficulty.window);\n }, Math.random() * 3250 + 1500);\n return () => {\n clearInterval(id);\n if (id2 !== -1) clearInterval(id2);\n };\n }, []);\n\n return (\n \n \n \n

    Slash when his guard is down!

    \n

    {guarding ? \"!Guarding!\" : \"!ATTACKING!\"}

    \n \n
    \n
    \n );\n}\n","import React, { useState } from \"react\";\nimport Grid from \"@mui/material/Grid\";\nimport { IMinigameProps } from \"./IMinigameProps\";\nimport { KeyHandler } from \"./KeyHandler\";\nimport { GameTimer } from \"./GameTimer\";\nimport { random } from \"../utils\";\nimport { interpolate } from \"./Difficulty\";\nimport { BlinkingCursor } from \"./BlinkingCursor\";\n\ninterface Difficulty {\n [key: string]: number;\n timer: number;\n min: number;\n max: number;\n}\n\nconst difficulties: {\n Trivial: Difficulty;\n Normal: Difficulty;\n Hard: Difficulty;\n Impossible: Difficulty;\n} = {\n Trivial: { timer: 16000, min: 3, max: 4 },\n Normal: { timer: 12500, min: 2, max: 3 },\n Hard: { timer: 15000, min: 3, max: 4 },\n Impossible: { timer: 8000, min: 4, max: 4 },\n};\n\nexport function BackwardGame(props: IMinigameProps): React.ReactElement {\n const difficulty: Difficulty = { timer: 0, min: 0, max: 0 };\n interpolate(difficulties, props.difficulty, difficulty);\n const timer = difficulty.timer;\n const [answer] = useState(makeAnswer(difficulty));\n const [guess, setGuess] = useState(\"\");\n\n function press(event: React.KeyboardEvent): void {\n event.preventDefault();\n if (event.keyCode === 16) return;\n const nextGuess = guess + event.key.toUpperCase();\n if (!answer.startsWith(nextGuess)) props.onFailure();\n else if (answer === nextGuess) props.onSuccess();\n else setGuess(nextGuess);\n }\n\n return (\n \n \n \n

    Type it backward

    \n \n
    \n \n

    {answer}

    \n
    \n \n

    \n {guess}\n \n

    \n
    \n
    \n );\n}\n\nfunction makeAnswer(difficulty: Difficulty): string {\n const length = random(difficulty.min, difficulty.max);\n let answer = \"\";\n for (let i = 0; i < length; i++) {\n if (i > 0) answer += \" \";\n answer += words[Math.floor(Math.random() * words.length)];\n }\n\n return answer;\n}\n\nconst words = [\n \"ALGORITHM\",\n \"ANALOG\",\n \"APP\",\n \"APPLICATION\",\n \"ARRAY\",\n \"BACKUP\",\n \"BANDWIDTH\",\n \"BINARY\",\n \"BIT\",\n \"BITE\",\n \"BITMAP\",\n \"BLOG\",\n \"BLOGGER\",\n \"BOOKMARK\",\n \"BOOT\",\n \"BROADBAND\",\n \"BROWSER\",\n \"BUFFER\",\n \"BUG\",\n \"BUS\",\n \"BYTE\",\n \"CACHE\",\n \"CAPS LOCK\",\n \"CAPTCHA\",\n \"CD\",\n \"CD-ROM\",\n \"CLIENT\",\n \"CLIPBOARD\",\n \"CLOUD\",\n \"COMPUTING\",\n \"COMMAND\",\n \"COMPILE\",\n \"COMPRESS\",\n \"COMPUTER\",\n \"CONFIGURE\",\n \"COOKIE\",\n \"COPY\",\n \"CPU\",\n \"CYBERCRIME\",\n \"CYBERSPACE\",\n \"DASHBOARD\",\n \"DATA\",\n \"MINING\",\n \"DATABASE\",\n \"DEBUG\",\n \"DECOMPRESS\",\n \"DELETE\",\n \"DESKTOP\",\n \"DEVELOPMENT\",\n \"DIGITAL\",\n \"DISK\",\n \"DNS\",\n \"DOCUMENT\",\n \"DOMAIN\",\n \"DOMAIN NAME\",\n \"DOT\",\n \"DOT MATRIX\",\n \"DOWNLOAD\",\n \"DRAG\",\n \"DVD\",\n \"DYNAMIC\",\n \"EMAIL\",\n \"EMOTICON\",\n \"ENCRYPT\",\n \"ENCRYPTION\",\n \"ENTER\",\n \"EXABYTE\",\n \"FAQ\",\n \"FILE\",\n \"FINDER\",\n \"FIREWALL\",\n \"FIRMWARE\",\n \"FLAMING\",\n \"FLASH\",\n \"FLASH DRIVE\",\n \"FLOPPY DISK\",\n \"FLOWCHART\",\n \"FOLDER\",\n \"FONT\",\n \"FORMAT\",\n \"FRAME\",\n \"FREEWARE\",\n \"GIGABYTE\",\n \"GRAPHICS\",\n \"HACK\",\n \"HACKER\",\n \"HARDWARE\",\n \"HOME PAGE\",\n \"HOST\",\n \"HTML\",\n \"HYPERLINK\",\n \"HYPERTEXT\",\n \"ICON\",\n \"INBOX\",\n \"INTEGER\",\n \"INTERFACE\",\n \"INTERNET\",\n \"IP ADDRESS\",\n \"ITERATION\",\n \"JAVA\",\n \"JOYSTICK\",\n \"JUNKMAIL\",\n \"KERNEL\",\n \"KEY\",\n \"KEYBOARD\",\n \"KEYWORD\",\n \"LAPTOP\",\n \"LASER PRINTER\",\n \"LINK\",\n \"LINUX\",\n \"LOG OUT\",\n \"LOGIC\",\n \"LOGIN\",\n \"LURKING\",\n \"MACINTOSH\",\n \"MACRO\",\n \"MAINFRAME\",\n \"MALWARE\",\n \"MEDIA\",\n \"MEMORY\",\n \"MIRROR\",\n \"MODEM\",\n \"MONITOR\",\n \"MOTHERBOARD\",\n \"MOUSE\",\n \"MULTIMEDIA\",\n \"NET\",\n \"NETWORK\",\n \"NODE\",\n \"NOTEBOOK\",\n \"COMPUTER\",\n \"OFFLINE\",\n \"ONLINE\",\n \"OPENSOURCE\",\n \"OPERATING\",\n \"SYSTEM\",\n \"OPTION\",\n \"OUTPUT\",\n \"PAGE\",\n \"PASSWORD\",\n \"PASTE\",\n \"PATH\",\n \"PHISHING\",\n \"PIRACY\",\n \"PIRATE\",\n \"PLATFORM\",\n \"PLUGIN\",\n \"PODCAST\",\n \"POPUP\",\n \"PORTAL\",\n \"PRINT\",\n \"PRINTER\",\n \"PRIVACY\",\n \"PROCESS\",\n \"PROGRAM\",\n \"PROGRAMMER\",\n \"PROTOCOL\",\n \"QUEUE\",\n \"QWERTY\",\n \"RAM\",\n \"REALTIME\",\n \"REBOOT\",\n \"RESOLUTION\",\n \"RESTORE\",\n \"ROM\",\n \"ROOT\",\n \"ROUTER\",\n \"RUNTIME\",\n \"SAVE\",\n \"SCAN\",\n \"SCANNER\",\n \"SCREEN\",\n \"SCREENSHOT\",\n \"SCRIPT\",\n \"SCROLL\",\n \"SCROLL\",\n \"SEARCH\",\n \"ENGINE\",\n \"SECURITY\",\n \"SERVER\",\n \"SHAREWARE\",\n \"SHELL\",\n \"SHIFT\",\n \"SHIFT KEY\",\n \"SNAPSHOT\",\n \"SOCIAL NETWORKING\",\n \"SOFTWARE\",\n \"SPAM\",\n \"SPAMMER\",\n \"SPREADSHEET\",\n \"SPYWARE\",\n \"STATUS\",\n \"STORAGE\",\n \"SUPERCOMPUTER\",\n \"SURF\",\n \"SYNTAX\",\n \"TABLE\",\n \"TAG\",\n \"TERMINAL\",\n \"TEMPLATE\",\n \"TERABYTE\",\n \"TEXT EDITOR\",\n \"THREAD\",\n \"TOOLBAR\",\n \"TRASH\",\n \"TROJAN HORSE\",\n \"TYPEFACE\",\n \"UNDO\",\n \"UNIX\",\n \"UPLOAD\",\n \"URL\",\n \"USER\",\n \"USER INTERFACE\",\n \"USERNAME\",\n \"UTILITY\",\n \"VERSION\",\n \"VIRTUAL\",\n \"VIRTUAL MEMORY\",\n \"VIRUS\",\n \"WEB\",\n \"WEBMASTER\",\n \"WEBSITE\",\n \"WIDGET\",\n \"WIKI\",\n \"WINDOW\",\n \"WINDOWS\",\n \"WIRELESS\",\n \"PROCESSOR\",\n \"WORKSTATION\",\n \"WEB\",\n \"WORM\",\n \"WWW\",\n \"XML\",\n \"ZIP\",\n];\n","import React, { useState } from \"react\";\nimport Grid from \"@mui/material/Grid\";\nimport { IMinigameProps } from \"./IMinigameProps\";\nimport { KeyHandler } from \"./KeyHandler\";\nimport { GameTimer } from \"./GameTimer\";\nimport { interpolate } from \"./Difficulty\";\n\ninterface Difficulty {\n [key: string]: number;\n timer: number;\n size: number;\n}\n\nconst difficulties: {\n Trivial: Difficulty;\n Normal: Difficulty;\n Hard: Difficulty;\n Impossible: Difficulty;\n} = {\n Trivial: { timer: 12000, size: 6 },\n Normal: { timer: 9000, size: 8 },\n Hard: { timer: 5000, size: 9 },\n Impossible: { timer: 2500, size: 12 },\n};\n\nexport function BribeGame(props: IMinigameProps): React.ReactElement {\n const difficulty: Difficulty = { timer: 0, size: 0 };\n interpolate(difficulties, props.difficulty, difficulty);\n const timer = difficulty.timer;\n const [choices] = useState(makeChoices(difficulty));\n const [index, setIndex] = useState(0);\n\n function press(event: React.KeyboardEvent): void {\n event.preventDefault();\n const k = event.keyCode;\n if (k === 32) {\n if (positive.includes(choices[index])) props.onSuccess();\n else props.onFailure();\n return;\n }\n\n let newIndex = index;\n if ([38, 87, 68, 39].includes(k)) newIndex++;\n if ([65, 37, 83, 40].includes(k)) newIndex--;\n while (newIndex < 0) newIndex += choices.length;\n while (newIndex > choices.length - 1) newIndex -= choices.length;\n setIndex(newIndex);\n }\n\n return (\n \n \n \n

    Say something nice about the guard.

    \n \n
    \n \n

    \n

    {choices[index]}

    \n

    \n
    \n
    \n );\n}\n\nfunction shuffleArray(array: string[]): void {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}\n\nfunction makeChoices(difficulty: Difficulty): string[] {\n const choices = [];\n choices.push(positive[Math.floor(Math.random() * positive.length)]);\n for (let i = 0; i < difficulty.size; i++) {\n const option = negative[Math.floor(Math.random() * negative.length)];\n if (choices.includes(option)) {\n i--;\n continue;\n }\n choices.push(option);\n }\n shuffleArray(choices);\n return choices;\n}\n\nconst positive = [\n \"affectionate\",\n \"agreeable\",\n \"bright\",\n \"charming\",\n \"creative\",\n \"determined\",\n \"energetic\",\n \"friendly\",\n \"funny\",\n \"generous\",\n \"polite\",\n \"likable\",\n \"diplomatic\",\n \"helpful\",\n \"giving\",\n \"kind\",\n \"hardworking\",\n \"patient\",\n \"dynamic\",\n \"loyal\",\n];\n\nconst negative = [\n \"aggressive\",\n \"aloof\",\n \"arrogant\",\n \"big-headed\",\n \"boastful\",\n \"boring\",\n \"bossy\",\n \"careless\",\n \"clingy\",\n \"couch potato\",\n \"cruel\",\n \"cynical\",\n \"grumpy\",\n \"hot air\",\n \"know it all\",\n \"obnoxious\",\n \"pain in the neck\",\n \"picky\",\n \"tactless\",\n \"thoughtless\",\n];\n","import React, { useState } from \"react\";\nimport Grid from \"@mui/material/Grid\";\nimport { IMinigameProps } from \"./IMinigameProps\";\nimport { KeyHandler } from \"./KeyHandler\";\nimport { GameTimer } from \"./GameTimer\";\nimport { random, getArrow } from \"../utils\";\nimport { interpolate } from \"./Difficulty\";\n\ninterface Difficulty {\n [key: string]: number;\n timer: number;\n min: number;\n max: number;\n}\n\nconst difficulties: {\n Trivial: Difficulty;\n Normal: Difficulty;\n Hard: Difficulty;\n Impossible: Difficulty;\n} = {\n Trivial: { timer: 13000, min: 6, max: 8 },\n Normal: { timer: 7000, min: 7, max: 8 },\n Hard: { timer: 5000, min: 8, max: 9 },\n Impossible: { timer: 3000, min: 9, max: 10 },\n};\n\nexport function CheatCodeGame(props: IMinigameProps): React.ReactElement {\n const difficulty: Difficulty = { timer: 0, min: 0, max: 0 };\n interpolate(difficulties, props.difficulty, difficulty);\n const timer = difficulty.timer;\n const [code] = useState(generateCode(difficulty));\n const [index, setIndex] = useState(0);\n\n function press(event: React.KeyboardEvent): void {\n event.preventDefault();\n if (code[index] !== getArrow(event)) {\n props.onFailure();\n return;\n }\n setIndex(index + 1);\n if (index + 1 >= code.length) props.onSuccess();\n }\n\n return (\n \n \n \n

    Enter the Code!

    \n

    {code[index]}

    \n \n
    \n
    \n );\n}\n\nfunction generateCode(difficulty: Difficulty): string {\n const arrows = [\"←\", \"→\", \"↑\", \"↓\"];\n let code = \"\";\n for (let i = 0; i < random(difficulty.min, difficulty.max); i++) {\n let arrow = arrows[Math.floor(4 * Math.random())];\n while (arrow === code[code.length - 1]) arrow = arrows[Math.floor(4 * Math.random())];\n code += arrow;\n }\n\n return code;\n}\n","import React, { useState } from \"react\";\nimport Grid from \"@mui/material/Grid\";\nimport { IMinigameProps } from \"./IMinigameProps\";\nimport { KeyHandler } from \"./KeyHandler\";\nimport { GameTimer } from \"./GameTimer\";\nimport { interpolate } from \"./Difficulty\";\nimport { getArrow } from \"../utils\";\n\ninterface Difficulty {\n [key: string]: number;\n timer: number;\n width: number;\n height: number;\n symbols: number;\n}\n\nconst difficulties: {\n Trivial: Difficulty;\n Normal: Difficulty;\n Hard: Difficulty;\n Impossible: Difficulty;\n} = {\n Trivial: { timer: 12500, width: 3, height: 3, symbols: 6 },\n Normal: { timer: 15000, width: 4, height: 4, symbols: 7 },\n Hard: { timer: 12500, width: 5, height: 5, symbols: 8 },\n Impossible: { timer: 10000, width: 6, height: 6, symbols: 9 },\n};\n\nexport function Cyberpunk2077Game(props: IMinigameProps): React.ReactElement {\n const difficulty: Difficulty = { timer: 0, width: 0, height: 0, symbols: 0 };\n interpolate(difficulties, props.difficulty, difficulty);\n const timer = difficulty.timer;\n const [grid] = useState(generatePuzzle(difficulty));\n const [answer] = useState(generateAnswer(grid, difficulty));\n const [index, setIndex] = useState(0);\n const [pos, setPos] = useState([0, 0]);\n\n function press(event: React.KeyboardEvent): void {\n event.preventDefault();\n const move = [0, 0];\n const arrow = getArrow(event);\n switch (arrow) {\n case \"↑\":\n move[1]--;\n break;\n case \"←\":\n move[0]--;\n break;\n case \"↓\":\n move[1]++;\n break;\n case \"→\":\n move[0]++;\n break;\n }\n const next = [pos[0] + move[0], pos[1] + move[1]];\n next[0] = (next[0] + grid[0].length) % grid[0].length;\n next[1] = (next[1] + grid.length) % grid.length;\n setPos(next);\n\n if (event.keyCode == 32) {\n const selected = grid[pos[1]][pos[0]];\n const expected = answer[index];\n if (selected !== expected) {\n props.onFailure();\n return;\n }\n setIndex(index + 1);\n if (answer.length === index + 1) props.onSuccess();\n }\n }\n\n const fontSize = \"2em\";\n return (\n \n \n \n

    Match the symbols!

    \n

    \n Targets:{\" \"}\n {answer.map((a, i) => {\n if (i == index)\n return (\n \n {a} \n \n );\n return (\n \n {a} \n \n );\n })}\n

    \n
    \n {grid.map((line, y) => (\n
    \n
    \n              {line.map((cell, x) => {\n                if (x == pos[0] && y == pos[1])\n                  return (\n                    \n                      {cell} \n                    \n                  );\n                return (\n                  \n                    {cell} \n                  \n                );\n              })}\n            
    \n
    \n
    \n ))}\n \n
    \n
    \n );\n}\n\nfunction generateAnswer(grid: string[][], difficulty: Difficulty): string[] {\n const answer = [];\n for (let i = 0; i < Math.round(difficulty.symbols); i++) {\n answer.push(grid[Math.floor(Math.random() * grid.length)][Math.floor(Math.random() * grid[0].length)]);\n }\n return answer;\n}\n\nfunction randChar(): string {\n return \"ABCDEF0123456789\"[Math.floor(Math.random() * 16)];\n}\n\nfunction generatePuzzle(difficulty: Difficulty): string[][] {\n const puzzle = [];\n for (let i = 0; i < Math.round(difficulty.height); i++) {\n const line = [];\n for (let j = 0; j < Math.round(difficulty.width); j++) {\n line.push(randChar() + randChar());\n }\n puzzle.push(line);\n }\n return puzzle;\n}\n","import React, { useState, useEffect } from \"react\";\nimport Grid from \"@mui/material/Grid\";\nimport { IMinigameProps } from \"./IMinigameProps\";\nimport { KeyHandler } from \"./KeyHandler\";\nimport { GameTimer } from \"./GameTimer\";\nimport { interpolate } from \"./Difficulty\";\nimport { getArrow } from \"../utils\";\n\ninterface Difficulty {\n [key: string]: number;\n timer: number;\n width: number;\n height: number;\n mines: number;\n}\n\nconst difficulties: {\n Trivial: Difficulty;\n Normal: Difficulty;\n Hard: Difficulty;\n Impossible: Difficulty;\n} = {\n Trivial: { timer: 15000, width: 3, height: 3, mines: 4 },\n Normal: { timer: 15000, width: 4, height: 4, mines: 7 },\n Hard: { timer: 15000, width: 5, height: 5, mines: 11 },\n Impossible: { timer: 15000, width: 6, height: 6, mines: 15 },\n};\n\nexport function MinesweeperGame(props: IMinigameProps): React.ReactElement {\n const difficulty: Difficulty = { timer: 0, width: 0, height: 0, mines: 0 };\n interpolate(difficulties, props.difficulty, difficulty);\n const timer = difficulty.timer;\n const [minefield] = useState(generateMinefield(difficulty));\n const [answer, setAnswer] = useState(generateEmptyField(difficulty));\n const [pos, setPos] = useState([0, 0]);\n const [memoryPhase, setMemoryPhase] = useState(true);\n\n function press(event: React.KeyboardEvent): void {\n event.preventDefault();\n if (memoryPhase) return;\n const move = [0, 0];\n const arrow = getArrow(event);\n switch (arrow) {\n case \"↑\":\n move[1]--;\n break;\n case \"←\":\n move[0]--;\n break;\n case \"↓\":\n move[1]++;\n break;\n case \"→\":\n move[0]++;\n break;\n }\n const next = [pos[0] + move[0], pos[1] + move[1]];\n next[0] = (next[0] + minefield[0].length) % minefield[0].length;\n next[1] = (next[1] + minefield.length) % minefield.length;\n setPos(next);\n\n if (event.keyCode == 32) {\n if (!minefield[pos[1]][pos[0]]) {\n props.onFailure();\n return;\n }\n setAnswer((old) => {\n old[pos[1]][pos[0]] = true;\n if (fieldEquals(minefield, old)) props.onSuccess();\n return old;\n });\n }\n }\n\n useEffect(() => {\n const id = setTimeout(() => setMemoryPhase(false), 2000);\n return () => clearInterval(id);\n }, []);\n\n return (\n \n \n \n

    {memoryPhase ? \"Remember all the mines!\" : \"Mark all the mines!\"}

    \n {minefield.map((line, y) => (\n
    \n
    \n              {line.map((cell, x) => {\n                if (memoryPhase) {\n                  if (minefield[y][x]) return [?] ;\n                  return [ ] ;\n                } else {\n                  if (x == pos[0] && y == pos[1]) return [X] ;\n                  if (answer[y][x]) return [.] ;\n                  return [ ] ;\n                }\n              })}\n            
    \n
    \n
    \n ))}\n \n
    \n
    \n );\n}\n\nfunction fieldEquals(a: boolean[][], b: boolean[][]): boolean {\n function count(field: boolean[][]): number {\n return field.flat().reduce((a, b) => a + (b ? 1 : 0), 0);\n }\n return count(a) === count(b);\n}\n\nfunction generateEmptyField(difficulty: Difficulty): boolean[][] {\n const field = [];\n for (let i = 0; i < difficulty.height; i++) {\n field.push(new Array(Math.round(difficulty.width)).fill(false));\n }\n return field;\n}\n\nfunction generateMinefield(difficulty: Difficulty): boolean[][] {\n const field = generateEmptyField(difficulty);\n for (let i = 0; i < difficulty.mines; i++) {\n const x = Math.floor(Math.random() * field.length);\n const y = Math.floor(Math.random() * field[0].length);\n if (field[x][y]) {\n i--;\n continue;\n }\n field[x][y] = true;\n }\n return field;\n}\n","import React, { useState } from \"react\";\nimport Grid from \"@mui/material/Grid\";\nimport { IMinigameProps } from \"./IMinigameProps\";\nimport { KeyHandler } from \"./KeyHandler\";\nimport { GameTimer } from \"./GameTimer\";\nimport { random } from \"../utils\";\nimport { interpolate } from \"./Difficulty\";\n\ninterface Difficulty {\n [key: string]: number;\n timer: number;\n wiresmin: number;\n wiresmax: number;\n rules: number;\n}\n\nconst difficulties: {\n Trivial: Difficulty;\n Normal: Difficulty;\n Hard: Difficulty;\n Impossible: Difficulty;\n} = {\n Trivial: { timer: 9000, wiresmin: 4, wiresmax: 4, rules: 2 },\n Normal: { timer: 7000, wiresmin: 6, wiresmax: 6, rules: 2 },\n Hard: { timer: 5000, wiresmin: 8, wiresmax: 8, rules: 3 },\n Impossible: { timer: 4000, wiresmin: 9, wiresmax: 9, rules: 4 },\n};\n\nconst types = [\"|\", \".\", \"/\", \"-\", \"█\", \"#\"];\n\nconst colors = [\"red\", \"#FFC107\", \"blue\", \"white\"];\n\nconst colorNames: any = {\n red: \"red\",\n \"#FFC107\": \"yellow\",\n blue: \"blue\",\n white: \"white\",\n};\n\ninterface Wire {\n tpe: string;\n colors: string[];\n}\n\ninterface Question {\n toString: () => string;\n shouldCut: (wire: Wire, index: number) => boolean;\n}\n\nexport function WireCuttingGame(props: IMinigameProps): React.ReactElement {\n const difficulty: Difficulty = {\n timer: 0,\n wiresmin: 0,\n wiresmax: 0,\n rules: 0,\n };\n interpolate(difficulties, props.difficulty, difficulty);\n const timer = difficulty.timer;\n const [wires] = useState(generateWires(difficulty));\n const [cutWires, setCutWires] = useState(new Array(wires.length).fill(false));\n const [questions] = useState(generateQuestion(wires, difficulty));\n\n function press(event: React.KeyboardEvent): void {\n event.preventDefault();\n const wireNum = parseInt(event.key);\n\n if (wireNum < 1 || wireNum > wires.length || isNaN(wireNum)) return;\n setCutWires((old) => {\n const next = [...old];\n next[wireNum - 1] = true;\n if (!questions.some((q) => q.shouldCut(wires[wireNum - 1], wireNum - 1))) {\n props.onFailure();\n }\n\n // check if we won\n const wiresToBeCut = [];\n for (let j = 0; j < wires.length; j++) {\n let shouldBeCut = false;\n for (let i = 0; i < questions.length; i++) {\n shouldBeCut = shouldBeCut || questions[i].shouldCut(wires[j], j);\n }\n wiresToBeCut.push(shouldBeCut);\n }\n if (wiresToBeCut.every((b, i) => b === next[i])) {\n props.onSuccess();\n }\n\n return next;\n });\n }\n\n return (\n \n \n \n

    Cut the wires with the following properties! (keyboard 1 to 9)

    \n {questions.map((question, i) => (\n

    {question.toString()}

    \n ))}\n
    \n          {new Array(wires.length).fill(0).map((_, i) => (\n             {i + 1}    \n          ))}\n        
    \n {new Array(8).fill(0).map((_, i) => (\n
    \n
    \n              {wires.map((wire, j) => {\n                if ((i === 3 || i === 4) && cutWires[j])\n                  return       ;\n                return (\n                  \n                    |{wire.tpe}|   \n                  \n                );\n              })}\n            
    \n
    \n ))}\n \n
    \n
    \n );\n}\n\nfunction randomPositionQuestion(wires: Wire[]): Question {\n const index = Math.floor(Math.random() * wires.length);\n return {\n toString: (): string => {\n return `Cut wires number ${index + 1}.`;\n },\n shouldCut: (wire: Wire, i: number): boolean => {\n return index === i;\n },\n };\n}\n\nfunction randomColorQuestion(wires: Wire[]): Question {\n const index = Math.floor(Math.random() * wires.length);\n const cutColor = wires[index].colors[0];\n return {\n toString: (): string => {\n return `Cut all wires colored ${colorNames[cutColor]}.`;\n },\n shouldCut: (wire: Wire): boolean => {\n return wire.colors.includes(cutColor);\n },\n };\n}\n\nfunction generateQuestion(wires: Wire[], difficulty: Difficulty): Question[] {\n const numQuestions = difficulty.rules;\n const questionGenerators = [randomPositionQuestion, randomColorQuestion];\n const questions = [];\n for (let i = 0; i < numQuestions; i++) {\n questions.push(questionGenerators[i % 2](wires));\n }\n return questions;\n}\n\nfunction generateWires(difficulty: Difficulty): Wire[] {\n const wires = [];\n const numWires = random(difficulty.wiresmin, difficulty.wiresmax);\n for (let i = 0; i < numWires; i++) {\n const wireColors = [colors[Math.floor(Math.random() * colors.length)]];\n if (Math.random() < 0.15) {\n wireColors.push(colors[Math.floor(Math.random() * colors.length)]);\n }\n wires.push({\n tpe: types[Math.floor(Math.random() * types.length)],\n colors: wireColors,\n });\n }\n return wires;\n}\n","import { Factions } from \"../../Faction/Factions\";\nimport React, { useState } from \"react\";\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport Grid from \"@mui/material/Grid\";\nimport { Money } from \"../../ui/React/Money\";\nimport { Reputation } from \"../../ui/React/Reputation\";\nimport { BitNodeMultipliers } from \"../../BitNode/BitNodeMultipliers\";\nimport { use } from \"../../ui/Context\";\n\ninterface IProps {\n StartingDifficulty: number;\n Difficulty: number;\n MaxLevel: number;\n}\n\nexport function Victory(props: IProps): React.ReactElement {\n const player = use.Player();\n const router = use.Router();\n const [faction, setFaction] = useState(\"none\");\n\n function quitInfiltration(): void {\n router.toCity();\n }\n\n const levelBonus = props.MaxLevel * Math.pow(1.01, props.MaxLevel);\n\n const repGain =\n Math.pow(props.Difficulty + 1, 1.1) *\n Math.pow(props.StartingDifficulty, 1.2) *\n 30 *\n levelBonus *\n BitNodeMultipliers.InfiltrationRep;\n\n const moneyGain =\n Math.pow(props.Difficulty + 1, 2) *\n Math.pow(props.StartingDifficulty, 3) *\n 3e3 *\n levelBonus *\n BitNodeMultipliers.InfiltrationMoney;\n\n function sell(): void {\n player.gainMoney(moneyGain);\n player.recordMoneySource(moneyGain, \"infiltration\");\n quitInfiltration();\n }\n\n function trade(): void {\n if (faction === \"none\") return;\n Factions[faction].playerReputation += repGain;\n quitInfiltration();\n }\n\n function changeDropdown(event: React.ChangeEvent): void {\n setFaction(event.target.value);\n }\n\n return (\n <>\n \n \n

    Infiltration successful!

    \n
    \n \n

    You can trade the confidential information you found for money or reputation.

    \n \n \n {\"Trade for \"}\n {Reputation(repGain)}\n {\" reputation\"}\n \n }\n />\n
    \n \n \n {\"Sell for \"}\n \n \n }\n />\n \n \n \n \n
    \n \n );\n}\n","import React, { useState } from \"react\";\n\nimport { IPlayer } from \"../../IPlayer\";\nimport { generateResleeves } from \"../Resleeving\";\nimport { Resleeve } from \"../Resleeve\";\nimport { ResleeveElem } from \"./ResleeveElem\";\n\nconst SortOption: {\n [key: string]: string | undefined;\n Cost: string;\n Hacking: string;\n Strength: string;\n Defense: string;\n Dexterity: string;\n Agility: string;\n Charisma: string;\n AverageCombatStats: string;\n AverageAllStats: string;\n TotalNumAugmentations: string;\n} = {\n Cost: \"Cost\",\n Hacking: \"Hacking Level\",\n Strength: \"Strength Level\",\n Defense: \"Defense Level\",\n Dexterity: \"Dexterity Level\",\n Agility: \"Agility Level\",\n Charisma: \"Charisma Level\",\n AverageCombatStats: \"Average Combat Stats\",\n AverageAllStats: \"Average Stats\",\n TotalNumAugmentations: \"Number of Augmentations\",\n};\n\n// Helper function for averaging\nfunction getAverage(...values: number[]): number {\n let sum = 0;\n for (let i = 0; i < values.length; ++i) {\n sum += values[i];\n }\n\n return sum / values.length;\n}\n\nconst SortFunctions: {\n [key: string]: ((a: Resleeve, b: Resleeve) => number) | undefined;\n Cost: (a: Resleeve, b: Resleeve) => number;\n Hacking: (a: Resleeve, b: Resleeve) => number;\n Strength: (a: Resleeve, b: Resleeve) => number;\n Defense: (a: Resleeve, b: Resleeve) => number;\n Dexterity: (a: Resleeve, b: Resleeve) => number;\n Agility: (a: Resleeve, b: Resleeve) => number;\n Charisma: (a: Resleeve, b: Resleeve) => number;\n AverageCombatStats: (a: Resleeve, b: Resleeve) => number;\n AverageAllStats: (a: Resleeve, b: Resleeve) => number;\n TotalNumAugmentations: (a: Resleeve, b: Resleeve) => number;\n} = {\n Cost: (a: Resleeve, b: Resleeve): number => a.getCost() - b.getCost(),\n Hacking: (a: Resleeve, b: Resleeve): number => a.hacking_skill - b.hacking_skill,\n Strength: (a: Resleeve, b: Resleeve): number => a.strength - b.strength,\n Defense: (a: Resleeve, b: Resleeve): number => a.defense - b.defense,\n Dexterity: (a: Resleeve, b: Resleeve): number => a.dexterity - b.dexterity,\n Agility: (a: Resleeve, b: Resleeve): number => a.agility - b.agility,\n Charisma: (a: Resleeve, b: Resleeve): number => a.charisma - b.charisma,\n AverageCombatStats: (a: Resleeve, b: Resleeve): number => getAverage(a.strength, a.defense, a.dexterity, a.agility) -\n getAverage(b.strength, b.defense, b.dexterity, b.agility),\n AverageAllStats: (a: Resleeve, b: Resleeve): number => getAverage(a.hacking_skill, a.strength, a.defense, a.dexterity, a.agility, a.charisma) -\n getAverage(b.hacking_skill, b.strength, b.defense, b.dexterity, b.agility, b.charisma),\n TotalNumAugmentations: (a: Resleeve, b: Resleeve): number => a.augmentations.length - b.augmentations.length,\n};\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function ResleeveRoot(props: IProps): React.ReactElement {\n const [sort, setSort] = useState(SortOption.Cost);\n // Randomly create all Resleeves if they dont already exist\n if (props.player.resleeves.length === 0) {\n props.player.resleeves = generateResleeves();\n }\n\n function onSortChange(event: React.ChangeEvent): void {\n setSort(event.target.value);\n }\n\n const sortFunction = SortFunctions[sort];\n if (sortFunction === undefined) throw new Error(`sort function '${sort}' is undefined`);\n props.player.resleeves.sort(sortFunction);\n\n return (\n <>\n

    \n Re-sleeving is the process of digitizing and transferring your consciousness into a new human body, or 'sleeve'.\n Here at VitaLife, you can purchase new specially-engineered bodies for the re-sleeve process. Many of these\n bodies even come with genetic and cybernetic Augmentations!\n
    \n
    \n Re-sleeving will change your experience for every stat. It will also REMOVE all of your currently-installed\n Augmentations, and replace them with the ones provided by the purchased sleeve. However, Augmentations that you\n have purchased but not installed will NOT be removed. If you have purchased an Augmentation and then re-sleeve\n into a body which already has that Augmentation, it will be removed (since you cannot have duplicate\n Augmentations).\n
    \n
    \n NOTE: The stats and multipliers displayed on this page do NOT include your bonuses from Source-File.\n

    \n

    Sort By:

    \n \n {props.player.resleeves.map((resleeve, i) => (\n \n ))}\n \n );\n}\n","/**\n * Implements the Resleeve class, which defines a new body\n * that the player can \"re-sleeve\" into.\n */\nimport { Person } from \"../Person\";\n\nimport { Augmentation } from \"../../Augmentation/Augmentation\";\nimport { Augmentations } from \"../../Augmentation/Augmentations\";\n\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../../utils/JSONReviver\";\n\nexport class Resleeve extends Person {\n constructor() {\n super();\n }\n\n getCost(): number {\n // Each experience point adds this to the cost\n const CostPerExp = 25e3;\n\n // Final cost is multiplied by this constant ^ # Augs\n const NumAugsExponent = 1.2;\n\n // Get total exp in this re-sleeve\n const totalExp: number =\n this.hacking_exp +\n this.strength_exp +\n this.defense_exp +\n this.dexterity_exp +\n this.agility_exp +\n this.charisma_exp;\n\n // Get total base Augmentation cost for this re-sleeve\n let totalAugmentationCost = 0;\n for (let i = 0; i < this.augmentations.length; ++i) {\n const aug: Augmentation | null = Augmentations[this.augmentations[i].name];\n if (aug == null) {\n console.error(`Could not find Augmentation ${this.augmentations[i].name}`);\n continue;\n }\n totalAugmentationCost += aug.startingCost;\n }\n\n return totalExp * CostPerExp + totalAugmentationCost * Math.pow(NumAugsExponent, this.augmentations.length);\n }\n\n /**\n * Serialize the current object to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"Resleeve\", this);\n }\n\n /**\n * Initiatizes a Resleeve object from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): Resleeve {\n return Generic_fromJSON(Resleeve, value.data);\n }\n}\n\nReviver.constructors.Resleeve = Resleeve;\n","import React, { useState } from \"react\";\nimport { IPlayer } from \"../../IPlayer\";\nimport { Resleeve } from \"../Resleeve\";\nimport { Augmentations } from \"../../../Augmentation/Augmentations\";\nimport { purchaseResleeve } from \"../Resleeving\";\nimport { Money } from \"../../../ui/React/Money\";\n\nimport { numeralWrapper } from \"../../../ui/numeralFormat\";\nimport { dialogBoxCreate } from \"../../../../utils/DialogBox\";\n\ninterface IProps {\n resleeve: Resleeve;\n player: IPlayer;\n}\n\nexport function ResleeveElem(props: IProps): React.ReactElement {\n const [aug, setAug] = useState(props.resleeve.augmentations[0].name);\n\n function openStats(): void {\n dialogBoxCreate(\n <>\n

    \n Total Multipliers:\n

    \n Hacking Level multiplier: {numeralWrapper.formatPercentage(props.resleeve.hacking_mult)}\n
    \n Hacking Experience multiplier: {numeralWrapper.formatPercentage(props.resleeve.hacking_exp_mult)}\n
    \n Strength Level multiplier: {numeralWrapper.formatPercentage(props.resleeve.strength_mult)}\n
    \n Strength Experience multiplier: {numeralWrapper.formatPercentage(props.resleeve.strength_exp_mult)}\n
    \n Defense Level multiplier: {numeralWrapper.formatPercentage(props.resleeve.defense_mult)}\n
    \n Defense Experience multiplier: {numeralWrapper.formatPercentage(props.resleeve.defense_exp_mult)}\n
    \n Dexterity Level multiplier: {numeralWrapper.formatPercentage(props.resleeve.dexterity_mult)}\n
    \n Dexterity Experience multiplier: {numeralWrapper.formatPercentage(props.resleeve.dexterity_exp_mult)}\n
    \n Agility Level multiplier: {numeralWrapper.formatPercentage(props.resleeve.agility_mult)}\n
    \n Agility Experience multiplier: {numeralWrapper.formatPercentage(props.resleeve.agility_exp_mult)}\n
    \n Charisma Level multiplier: {numeralWrapper.formatPercentage(props.resleeve.charisma_mult)}\n
    \n Charisma Experience multiplier: {numeralWrapper.formatPercentage(props.resleeve.charisma_exp_mult)}\n
    \n Hacking Chance multiplier: {numeralWrapper.formatPercentage(props.resleeve.hacking_chance_mult)}\n
    \n Hacking Speed multiplier: {numeralWrapper.formatPercentage(props.resleeve.hacking_speed_mult)}\n
    \n Hacking Money multiplier: {numeralWrapper.formatPercentage(props.resleeve.hacking_money_mult)}\n
    \n Hacking Growth multiplier: {numeralWrapper.formatPercentage(props.resleeve.hacking_grow_mult)}\n
    \n Salary multiplier: {numeralWrapper.formatPercentage(props.resleeve.work_money_mult)}\n
    \n Company Reputation Gain multiplier: {numeralWrapper.formatPercentage(props.resleeve.company_rep_mult)}\n
    \n Faction Reputation Gain multiplier: {numeralWrapper.formatPercentage(props.resleeve.faction_rep_mult)}\n
    \n Crime Money multiplier: {numeralWrapper.formatPercentage(props.resleeve.crime_money_mult)}\n
    \n Crime Success multiplier: {numeralWrapper.formatPercentage(props.resleeve.crime_success_mult)}\n
    \n Hacknet Income multiplier: {numeralWrapper.formatPercentage(props.resleeve.hacknet_node_money_mult)}\n
    \n Hacknet Purchase Cost multiplier:\n {numeralWrapper.formatPercentage(props.resleeve.hacknet_node_purchase_cost_mult)}\n
    \n Hacknet Level Upgrade Cost multiplier:\n {numeralWrapper.formatPercentage(props.resleeve.hacknet_node_level_cost_mult)}\n
    \n Hacknet Ram Upgrade Cost multiplier:\n {numeralWrapper.formatPercentage(props.resleeve.hacknet_node_ram_cost_mult)}\n
    \n Hacknet Core Upgrade Cost multiplier:\n {numeralWrapper.formatPercentage(props.resleeve.hacknet_node_core_cost_mult)}\n
    \n Bladeburner Max Stamina multiplier:\n {numeralWrapper.formatPercentage(props.resleeve.bladeburner_max_stamina_mult)}\n
    \n Bladeburner Stamina Gain multiplier:\n {numeralWrapper.formatPercentage(props.resleeve.bladeburner_stamina_gain_mult)}\n
    \n Bladeburner Field Analysis multiplier:\n {numeralWrapper.formatPercentage(props.resleeve.bladeburner_analysis_mult)}\n
    \n Bladeburner Success Chance multiplier:\n {numeralWrapper.formatPercentage(props.resleeve.bladeburner_success_chance_mult)}\n ,\n );\n }\n\n function onAugChange(event: React.ChangeEvent): void {\n setAug(event.target.value);\n }\n\n const currentAug = Augmentations[aug];\n const cost = props.resleeve.getCost();\n\n function purchase(): void {\n if (!purchaseResleeve(props.resleeve, props.player)) return;\n dialogBoxCreate(\n <>\n You re-sleeved for !\n ,\n );\n }\n\n return (\n
    \n
    \n

    \n Hacking: {numeralWrapper.formatSkill(props.resleeve.hacking_skill)} (\n {numeralWrapper.formatExp(props.resleeve.hacking_exp)} exp)\n
    \n Strength: {numeralWrapper.formatSkill(props.resleeve.strength)} (\n {numeralWrapper.formatExp(props.resleeve.strength_exp)} exp)\n
    \n Defense: {numeralWrapper.formatSkill(props.resleeve.defense)} (\n {numeralWrapper.formatExp(props.resleeve.defense_exp)} exp)\n
    \n Dexterity: {numeralWrapper.formatSkill(props.resleeve.dexterity)} (\n {numeralWrapper.formatExp(props.resleeve.dexterity_exp)} exp)\n
    \n Agility: {numeralWrapper.formatSkill(props.resleeve.agility)} (\n {numeralWrapper.formatExp(props.resleeve.agility_exp)} exp)\n
    \n Charisma: {numeralWrapper.formatSkill(props.resleeve.charisma)} (\n {numeralWrapper.formatExp(props.resleeve.charisma_exp)} exp)\n
    # Augmentations: {props.resleeve.augmentations.length}\n

    \n \n
    \n
    \n \n

    {currentAug !== undefined && currentAug.info}

    \n
    \n
    \n

    \n It costs to purchase this Sleeve.\n

    \n \n
    \n
    \n );\n}\n","import React, { useState, useEffect } from \"react\";\nimport { use } from \"./Context\";\nimport { CONSTANTS } from \"../Constants\";\nimport { numeralWrapper } from \"./numeralFormat\";\nimport { Reputation } from \"./React/Reputation\";\nimport { ReputationRate } from \"./React/ReputationRate\";\nimport { MoneyRate } from \"./React/MoneyRate\";\nimport { Money } from \"./React/Money\";\nimport { convertTimeMsToTimeElapsedString } from \"../../utils/StringHelperFunctions\";\nimport { Factions } from \"../Faction/Factions\";\nimport { Company } from \"../Company/Company\";\nimport { Companies } from \"../Company/Companies\";\nimport { Locations } from \"../Locations/Locations\";\nimport { LocationName } from \"../Locations/data/LocationNames\";\n\nimport Typography from \"@mui/material/Typography\";\nimport Grid from \"@mui/material/Grid\";\nimport Button from \"@mui/material/Button\";\n\nimport { createProgressBarText } from \"../../utils/helpers/createProgressBarText\";\n\nconst CYCLES_PER_SEC = 1000 / CONSTANTS.MilliPerCycle;\n\nexport function WorkInProgressRoot(): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => {\n const id = setInterval(rerender, CONSTANTS.MilliPerCycle);\n return () => clearInterval(id);\n }, []);\n const player = use.Player();\n const router = use.Router();\n const faction = Factions[player.currentWorkFactionName];\n if (player.workType == CONSTANTS.WorkTypeFaction) {\n function cancel(): void {\n router.toFaction(faction);\n player.finishFactionWork(true);\n }\n function unfocus(): void {\n router.toFaction(faction);\n player.stopFocusing();\n }\n return (\n \n \n \n You are currently {player.currentWorkFactionDescription} for your faction {faction.name}\n
    \n (Current Faction Reputation: {Reputation(faction.playerReputation)}).
    \n You have been doing this for {convertTimeMsToTimeElapsedString(player.timeWorked)}\n
    \n
    \n You have earned:
    \n
    \n (){\" \"}\n
    \n
    \n {Reputation(player.workRepGained)} ({ReputationRate(player.workRepGainRate * CYCLES_PER_SEC)}) reputation\n for this faction
    \n
    \n {numeralWrapper.formatExp(player.workHackExpGained)} (\n {numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec) hacking exp
    \n
    \n {numeralWrapper.formatExp(player.workStrExpGained)} (\n {numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec) strength exp
    \n {numeralWrapper.formatExp(player.workDefExpGained)} (\n {numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec) defense exp
    \n {numeralWrapper.formatExp(player.workDexExpGained)} (\n {numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec) dexterity exp
    \n {numeralWrapper.formatExp(player.workAgiExpGained)} (\n {numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec) agility exp
    \n
    \n {numeralWrapper.formatExp(player.workChaExpGained)} (\n {numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec) charisma exp
    \n
    \n You will automatically finish after working for 20 hours. You can cancel earlier if you wish.\n
    \n There is no penalty for cancelling earlier.\n
    \n
    \n \n \n \n \n
    \n );\n }\n\n const className = player.className;\n if (player.className !== \"\") {\n function cancel(): void {\n player.finishClass(true);\n router.toCity();\n }\n function unfocus(): void {\n player.stopFocusing();\n router.toCity();\n }\n\n let stopText = \"\";\n if (\n className == CONSTANTS.ClassGymStrength ||\n className == CONSTANTS.ClassGymDefense ||\n className == CONSTANTS.ClassGymDexterity ||\n className == CONSTANTS.ClassGymAgility\n ) {\n stopText = \"Stop training at gym\";\n } else {\n stopText = \"Stop taking course\";\n }\n\n return (\n \n \n \n You have been {className} for {convertTimeMsToTimeElapsedString(player.timeWorked)}\n
    \n
    \n This has cost you:
    \n (){\" \"}\n
    \n
    \n You have gained:
    \n {numeralWrapper.formatExp(player.workHackExpGained)} (\n {numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec) hacking exp
    \n {numeralWrapper.formatExp(player.workStrExpGained)} (\n {numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec) strength exp
    \n {numeralWrapper.formatExp(player.workDefExpGained)} (\n {numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec) defense exp
    \n {numeralWrapper.formatExp(player.workDexExpGained)} (\n {numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec) dexterity exp
    \n {numeralWrapper.formatExp(player.workAgiExpGained)} (\n {numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec) agility exp
    \n {numeralWrapper.formatExp(player.workChaExpGained)} (\n {numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec) charisma exp
    \n You may cancel at any time\n
    \n
    \n \n \n \n
    \n );\n }\n\n if (player.workType == CONSTANTS.WorkTypeCompany) {\n const comp = Companies[player.companyName];\n let companyRep = 0;\n if (comp == null || !(comp instanceof Company)) {\n throw new Error(`Could not find Company: ${player.companyName}`);\n }\n companyRep = comp.playerReputation;\n\n function cancel(): void {\n player.finishWork(true);\n router.toJob();\n }\n function unfocus(): void {\n player.stopFocusing();\n router.toJob();\n }\n\n const position = player.jobs[player.companyName];\n\n const penalty = player.cancelationPenalty();\n\n const penaltyString = penalty === 0.5 ? \"half\" : \"three-quarters\";\n return (\n \n \n \n You are currently working as a {position} at {player.companyName} (Current Company Reputation:{\" \"}\n {Reputation(companyRep)})
    \n
    \n You have been working for {convertTimeMsToTimeElapsedString(player.timeWorked)}\n
    \n
    \n You have earned:
    \n
    \n (){\" \"}\n
    \n
    \n {Reputation(player.workRepGained)} ({ReputationRate(player.workRepGainRate * CYCLES_PER_SEC)}) reputation\n for this company
    \n
    \n {numeralWrapper.formatExp(player.workHackExpGained)} (\n {`${numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) hacking exp
    \n
    \n {numeralWrapper.formatExp(player.workStrExpGained)} (\n {`${numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) strength exp
    \n {numeralWrapper.formatExp(player.workDefExpGained)} (\n {`${numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) defense exp
    \n {numeralWrapper.formatExp(player.workDexExpGained)} (\n {`${numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) dexterity exp
    \n {numeralWrapper.formatExp(player.workAgiExpGained)} (\n {`${numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) agility exp
    \n
    \n {numeralWrapper.formatExp(player.workChaExpGained)} (\n {`${numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) charisma exp
    \n
    \n You will automatically finish after working for 8 hours. You can cancel earlier if you wish, but you will\n only gain {penaltyString} of the reputation you've earned so far.\n
    \n
    \n \n \n \n \n
    \n );\n }\n\n if (player.workType == CONSTANTS.WorkTypeCompanyPartTime) {\n function cancel(): void {\n player.finishWork(true);\n router.toJob();\n }\n function unfocus(): void {\n player.stopFocusing();\n router.toJob();\n }\n const comp = Companies[player.companyName];\n let companyRep = 0;\n if (comp == null || !(comp instanceof Company)) {\n throw new Error(`Could not find Company: ${player.companyName}`);\n }\n companyRep = comp.playerReputation;\n\n const position = player.jobs[player.companyName];\n return (\n \n \n \n You are currently working as a {position} at {player.companyName} (Current Company Reputation:{\" \"}\n {Reputation(companyRep)})
    \n
    \n You have been working for {convertTimeMsToTimeElapsedString(player.timeWorked)}\n
    \n
    \n You have earned:
    \n
    \n (){\" \"}\n
    \n
    \n {Reputation(player.workRepGained)} (\n {Reputation(`${numeralWrapper.formatExp(player.workRepGainRate * CYCLES_PER_SEC)} / sec`)}\n ) reputation for this company
    \n
    \n {numeralWrapper.formatExp(player.workHackExpGained)} (\n {`${numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) hacking exp
    \n
    \n {numeralWrapper.formatExp(player.workStrExpGained)} (\n {`${numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) strength exp
    \n {numeralWrapper.formatExp(player.workDefExpGained)} (\n {`${numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) defense exp
    \n {numeralWrapper.formatExp(player.workDexExpGained)} (\n {`${numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) dexterity exp
    \n {numeralWrapper.formatExp(player.workAgiExpGained)} (\n {`${numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) agility exp
    \n
    \n {numeralWrapper.formatExp(player.workChaExpGained)} (\n {`${numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec`}\n ) charisma exp
    \n
    \n You will automatically finish after working for 8 hours. You can cancel earlier if you wish, and there will\n be no penalty because this is a part-time job.\n
    \n
    \n \n \n \n \n
    \n );\n }\n\n if (player.crimeType !== \"\") {\n const percent = Math.round((player.timeWorked / player.timeNeededToCompleteWork) * 100);\n let numBars = Math.round(percent / 5);\n if (numBars < 0) {\n numBars = 0;\n }\n if (numBars > 20) {\n numBars = 20;\n }\n // const progressBar = \"[\" + Array(numBars + 1).join(\"|\") + Array(20 - numBars + 1).join(\" \") + \"]\";\n const progressBar = createProgressBarText({ progress: (numBars + 1) / 20, totalTicks: 20 });\n\n return (\n \n \n \n

    You are attempting to {player.crimeType}.

    \n
    \n\n

    \n Time remaining: {convertTimeMsToTimeElapsedString(player.timeNeededToCompleteWork - player.timeWorked)}\n

    \n\n
    \n
    {progressBar}
    \n
    \n
    \n \n {\n router.toLocation(Locations[LocationName.Slums]);\n player.finishCrime(true);\n }}\n >\n Cancel crime\n \n \n
    \n );\n }\n\n if (player.createProgramName !== \"\") {\n return (\n \n \n \n You are currently working on coding {player.createProgramName}.
    \n
    \n You have been working for {convertTimeMsToTimeElapsedString(player.timeWorked)}\n
    \n
    \n The program is {((player.timeWorkedCreateProgram / player.timeNeededToCompleteWork) * 100).toFixed(2)}\n % complete.
    \n If you cancel, your work will be saved and you can come back to complete the program later.\n
    \n
    \n \n {\n player.finishCreateProgramWork(true);\n router.toTerminal();\n }}\n >\n Cancel work on creating program\n \n \n
    \n );\n }\n\n return <>;\n}\n","import React, { useState, useRef } from \"react\";\n\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nimport { Theme } from \"@mui/material/styles\";\nimport makeStyles from \"@mui/styles/makeStyles\";\nimport createStyles from \"@mui/styles/createStyles\";\nimport Typography from \"@mui/material/Typography\";\nimport Slider from \"@mui/material/Slider\";\nimport Grid from \"@mui/material/Grid\";\nimport FormControlLabel from \"@mui/material/FormControlLabel\";\nimport Switch from \"@mui/material/Switch\";\nimport Select, { SelectChangeEvent } from \"@mui/material/Select\";\nimport MenuItem from \"@mui/material/MenuItem\";\nimport Button from \"@mui/material/Button\";\n\nimport Box from \"@mui/material/Box\";\nimport List from \"@mui/material/List\";\nimport ListItem from \"@mui/material/ListItem\";\nimport Link from \"@mui/material/Link\";\nimport Tooltip from \"@mui/material/Tooltip\";\n\nimport DownloadIcon from \"@mui/icons-material/Download\";\nimport UploadIcon from \"@mui/icons-material/Upload\";\n\nimport { FileDiagnosticModal } from \"../../Diagnostic/FileDiagnosticModal\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { ConfirmationModal } from \"./ConfirmationModal\";\nimport { ThemeEditorModal } from \"./ThemeEditorModal\";\n\nimport { Settings } from \"../../Settings/Settings\";\nimport { save, deleteGame } from \"../../db\";\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n root: {\n width: 50,\n padding: theme.spacing(2),\n userSelect: \"none\",\n },\n }),\n);\n\ninterface IProps {\n player: IPlayer;\n save: () => void;\n export: () => void;\n forceKill: () => void;\n softReset: () => void;\n}\n\nexport function GameOptionsRoot(props: IProps): React.ReactElement {\n const classes = useStyles();\n const importInput = useRef(null);\n\n const [execTime, setExecTime] = useState(Settings.CodeInstructionRunTime);\n const [logSize, setLogSize] = useState(Settings.MaxLogCapacity);\n const [portSize, setPortSize] = useState(Settings.MaxPortCapacity);\n const [terminalSize, setTerminalSize] = useState(Settings.MaxTerminalCapacity);\n\n const [autosaveInterval, setAutosaveInterval] = useState(Settings.AutosaveInterval);\n\n const [suppressMessages, setSuppressMessages] = useState(Settings.SuppressMessages);\n const [suppressFactionInvites, setSuppressFactionInvites] = useState(Settings.SuppressFactionInvites);\n const [suppressTravelConfirmations, setSuppressTravelConfirmations] = useState(Settings.SuppressTravelConfirmation);\n const [suppressBuyAugmentationConfirmation, setSuppressBuyAugmentationConfirmation] = useState(\n Settings.SuppressBuyAugmentationConfirmation,\n );\n const [suppressHospitalizationPopup, setSuppressHospitalizationPopup] = useState(\n Settings.SuppressHospitalizationPopup,\n );\n\n const [suppressBladeburnerPopup, setSuppressBladeburnerPopup] = useState(Settings.SuppressBladeburnerPopup);\n\n const [disableHotkeys, setDisableHotkeys] = useState(Settings.DisableHotkeys);\n const [disableASCIIArt, setDisableASCIIArt] = useState(Settings.DisableASCIIArt);\n const [disableTextEffects, setDisableTextEffects] = useState(Settings.DisableTextEffects);\n const [enableBashHotkeys, setEnableBashHotkeys] = useState(Settings.EnableBashHotkeys);\n const [enableTimestamps, setEnableTimestamps] = useState(Settings.EnableTimestamps);\n\n const [locale, setLocale] = useState(Settings.Locale);\n const [diagnosticOpen, setDiagnosticOpen] = useState(false);\n const [deleteGameOpen, setDeleteOpen] = useState(false);\n const [themeEditorOpen, setThemeEditorOpen] = useState(false);\n\n function handleExecTimeChange(event: any, newValue: number | number[]): void {\n setExecTime(newValue as number);\n Settings.CodeInstructionRunTime = newValue as number;\n }\n\n function handleLogSizeChange(event: any, newValue: number | number[]): void {\n setLogSize(newValue as number);\n Settings.MaxLogCapacity = newValue as number;\n }\n\n function handlePortSizeChange(event: any, newValue: number | number[]): void {\n setPortSize(newValue as number);\n Settings.MaxPortCapacity = newValue as number;\n }\n\n function handleTerminalSizeChange(event: any, newValue: number | number[]): void {\n setTerminalSize(newValue as number);\n Settings.MaxTerminalCapacity = newValue as number;\n }\n\n function handleAutosaveIntervalChange(event: any, newValue: number | number[]): void {\n setAutosaveInterval(newValue as number);\n Settings.AutosaveInterval = newValue as number;\n }\n\n function handleSuppressMessagesChange(event: React.ChangeEvent): void {\n setSuppressMessages(event.target.checked);\n Settings.SuppressMessages = event.target.checked;\n }\n\n function handleSuppressFactionInvitesChange(event: React.ChangeEvent): void {\n setSuppressFactionInvites(event.target.checked);\n Settings.SuppressFactionInvites = event.target.checked;\n }\n\n function handleSuppressTravelConfirmationsChange(event: React.ChangeEvent): void {\n setSuppressTravelConfirmations(event.target.checked);\n Settings.SuppressTravelConfirmation = event.target.checked;\n }\n\n function handleSuppressBuyAugmentationConfirmationChange(event: React.ChangeEvent): void {\n setSuppressBuyAugmentationConfirmation(event.target.checked);\n Settings.SuppressBuyAugmentationConfirmation = event.target.checked;\n }\n\n function handleSuppressHospitalizationPopupChange(event: React.ChangeEvent): void {\n setSuppressHospitalizationPopup(event.target.checked);\n Settings.SuppressHospitalizationPopup = event.target.checked;\n }\n\n function handleSuppressBladeburnerPopupChange(event: React.ChangeEvent): void {\n setSuppressBladeburnerPopup(event.target.checked);\n Settings.SuppressBladeburnerPopup = event.target.checked;\n }\n\n function handleDisableHotkeysChange(event: React.ChangeEvent): void {\n setDisableHotkeys(event.target.checked);\n Settings.DisableHotkeys = event.target.checked;\n }\n\n function handleDisableASCIIArtChange(event: React.ChangeEvent): void {\n setDisableASCIIArt(event.target.checked);\n Settings.DisableASCIIArt = event.target.checked;\n }\n\n function handleDisableTextEffectsChange(event: React.ChangeEvent): void {\n setDisableTextEffects(event.target.checked);\n Settings.DisableTextEffects = event.target.checked;\n }\n function handleLocaleChange(event: SelectChangeEvent): void {\n setLocale(event.target.value as string);\n Settings.Locale = event.target.value as string;\n }\n\n function handleEnableBashHotkeysChange(event: React.ChangeEvent): void {\n setEnableBashHotkeys(event.target.checked);\n Settings.EnableBashHotkeys = event.target.checked;\n }\n function handleEnableTimestampsChange(event: React.ChangeEvent): void {\n setEnableTimestamps(event.target.checked);\n Settings.EnableTimestamps = event.target.checked;\n }\n\n function startImport(): void {\n if (!window.File || !window.FileReader || !window.FileList || !window.Blob) return;\n const ii = importInput.current;\n if (ii === null) throw new Error(\"import input should not be null\");\n ii.click();\n }\n\n function onImport(event: React.ChangeEvent): void {\n const files = event.target.files;\n if (files === null) return;\n const file = files[0];\n if (!file) {\n dialogBoxCreate(\"Invalid file selected\");\n return;\n }\n\n const reader = new FileReader();\n reader.onload = function (this: FileReader, e: ProgressEvent) {\n const target = e.target;\n if (target === null) {\n console.error(\"error importing file\");\n return;\n }\n const result = target.result;\n if (typeof result !== \"string\" || result === null) {\n console.error(\"FileReader event was not type string\");\n return;\n }\n const contents = result;\n save(contents).then(() => location.reload());\n };\n reader.readAsText(file);\n }\n\n return (\n
    \n \n Options\n \n\n \n \n \n \n \n The minimum number of milliseconds it takes to execute an operation in Netscript. Setting this too\n low can result in poor performance if you have many scripts running.\n \n }\n >\n Netscript exec time (ms)\n \n \n \n \n \n The maximum number of lines a script's logs can hold. Setting this too high can cause the game to\n use a lot of memory if you have many scripts running.\n \n }\n >\n Netscript log size\n \n \n \n \n \n The maximum number of entries that can be written to a port using Netscript's write() function.\n Setting this too high can cause the game to use a lot of memory.\n \n }\n >\n Netscript port size\n \n \n \n \n \n The maximum number of entries that can be written to a the terminal. Setting this too high can cause\n the game to use a lot of memory.\n \n }\n >\n Terminal capacity\n \n \n \n \n The time (in seconds) between each autosave. Set to 0 to disable autosave.\n }\n >\n Autosave interval (s)\n \n \n \n \n }\n label={\n \n If this is set, then any messages you receive will not appear as popups on the screen. They will\n still get sent to your home computer as '.msg' files and can be viewed with the 'cat' Terminal\n command.\n \n }\n >\n Suppress messages\n \n }\n />\n \n \n }\n label={\n \n If this is set, then any faction invites you receive will not appear as popups on the screen.\n Your outstanding faction invites can be viewed in the 'Factions' page.\n \n }\n >\n Suppress faction invites\n \n }\n />\n \n \n \n }\n label={\n \n If this is set, the confirmation message before traveling will not show up. You will\n automatically be deducted the travel cost as soon as you click.\n \n }\n >\n Suppress travel confirmations\n \n }\n />\n \n \n \n }\n label={\n \n If this is set, the confirmation message before buying augmentation will not show up.\n \n }\n >\n Suppress buy augmentation confirmation\n \n }\n />\n \n \n \n }\n label={\n \n If this is set, a popup message will no longer be shown when you are hospitalized after taking\n too much damage.\n \n }\n >\n Suppress hospitalization popup\n \n }\n />\n \n {!!props.player.bladeburner && (\n \n \n }\n label={\n \n If this is set, then having your Bladeburner actions interrupted by being busy with something\n else will not display a popup message.\n \n }\n >\n Suppress bladeburner popup\n \n }\n />\n \n )}\n \n }\n label={\n \n If this is set, then most hotkeys (keyboard shortcuts) in the game are disabled. This includes\n Terminal commands, hotkeys to navigate between different parts of the game, and the \"Save and\n Close (Ctrl + b)\" hotkey in the Text Editor.\n \n }\n >\n Disable hotkeys\n \n }\n />\n \n \n }\n label={\n If this is set all ASCII art will be disabled.}>\n Disable ascii art\n \n }\n />\n \n \n }\n label={\n \n If this is set, text effects will not be displayed. This can help if text is difficult to read\n in certain areas.\n \n }\n >\n Disable text effects\n \n }\n />\n \n\n \n }\n label={\n \n Improved Bash emulation mode. Setting this to 1 enables several new Terminal shortcuts and\n features that more closely resemble a real Bash-style shell. Note that when this mode is\n enabled, the default browser shortcuts are overriden by the new Bash shortcuts.\n \n }\n >\n Enable bash hotkeys\n \n }\n />\n \n \n }\n label={\n \n Terminal commands and log entries will be timestamped. The timestamp will have the format: M/D\n h:m\n \n }\n >\n Enable timestamps\n \n }\n />\n \n\n \n Sets the locale for displaying numbers.}>\n Locale \n \n \n \n \n
    \n
    \n
    \n \n \n \n \n
    \n \n \n \n \n \n \n export}>\n \n \n import}>\n \n \n \n \n \n Forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the\n game. After using this, save the game and then reload the page. This is different then normal kill in\n that normal kill will tell the script to shut down while force kill just removes the references to it\n (and it should crash on it's own). This will not remove the files on your computer. Just forcefully\n kill all running instance of all scripts.\n \n }\n >\n \n \n \n \n \n Perform a soft reset. Resets everything as if you had just purchased an Augmentation.\n \n }\n >\n \n \n \n \n \n If your save file is extremely big you can use this button to view a map of all the files on every\n server. Be careful there might be spoilers.\n \n }\n >\n \n \n \n \n \n \n Report bug\n \n \n Changelog\n \n \n Documentation\n \n \n Discord\n \n \n Reddit\n \n \n \n
    \n setDiagnosticOpen(false)} />\n {\n setDeleteOpen(false);\n deleteGame()\n .then(() => location.reload())\n .catch((r) => console.error(`Could not delete game: ${r}`));\n }}\n open={deleteGameOpen}\n onClose={() => setDeleteOpen(false)}\n confirmationText={\"Really delete your game? (It's permanent!)\"}\n />\n setThemeEditorOpen(false)} />\n
    \n );\n}\n","import React from \"react\";\nimport { AllServers } from \"../Server/AllServers\";\nimport { Modal } from \"../ui/React/Modal\";\nimport { numeralWrapper } from \"../ui/numeralFormat\";\n\nimport Table from \"@mui/material/Table\";\nimport TableBody from \"@mui/material/TableBody\";\nimport TableCell from \"@mui/material/TableCell\";\nimport TableContainer from \"@mui/material/TableContainer\";\nimport TableHead from \"@mui/material/TableHead\";\nimport TableRow from \"@mui/material/TableRow\";\nimport Typography from \"@mui/material/Typography\";\nimport Paper from \"@mui/material/Paper\";\nimport Accordion from \"@mui/material/Accordion\";\nimport AccordionSummary from \"@mui/material/AccordionSummary\";\nimport AccordionDetails from \"@mui/material/AccordionDetails\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\n\ninterface IServerProps {\n ip: string;\n}\n\nfunction ServerAccordion(props: IServerProps): React.ReactElement {\n const server = AllServers[props.ip];\n let totalSize = 0;\n for (const f of server.scripts) {\n totalSize += f.code.length;\n }\n\n for (const f of server.textFiles) {\n totalSize += f.text.length;\n }\n\n if (totalSize === 0) {\n return <>;\n }\n\n interface File {\n name: string;\n size: number;\n }\n\n const files: File[] = [];\n\n for (const f of server.scripts) {\n files.push({ name: f.filename, size: f.code.length });\n }\n\n for (const f of server.textFiles) {\n files.push({ name: f.fn, size: f.text.length });\n }\n\n files.sort((a: File, b: File): number => b.size - a.size);\n\n return (\n \n }>\n \n {server.hostname} ({numeralWrapper.formatBigNumber(totalSize)}b)\n \n \n \n \n \n \n \n \n Filename\n \n \n Size\n \n \n \n \n {files.map((file: File) => (\n \n \n {file.name}\n \n \n {numeralWrapper.formatBigNumber(file.size)}b\n \n \n ))}\n \n
    \n
    \n
      \n
      \n
      \n );\n}\n\ninterface IProps {\n open: boolean;\n onClose: () => void;\n}\n\nexport function FileDiagnosticModal(props: IProps): React.ReactElement {\n const ips: string[] = [];\n for (const ip of Object.keys(AllServers)) {\n ips.push(ip);\n }\n\n return (\n \n <>\n \n Welcome to the file diagnostic! If your save file is really big it's likely because you have too many\n text/scripts. This tool can help you narrow down where they are.\n \n {ips.map((ip: string) => (\n \n ))}\n \n \n );\n}\n","import React from \"react\";\nimport { Modal } from \"./Modal\";\n\nimport Button from \"@mui/material/Button\";\nimport Typography from \"@mui/material/Typography\";\n\ninterface IProps {\n open: boolean;\n onClose: () => void;\n onConfirm: () => void;\n confirmationText: string;\n }\n \n export function ConfirmationModal(props: IProps): React.ReactElement {\n return (\n \n <>\n \n {props.confirmationText}\n \n \n \n \n );\n }\n ","import React, { useState } from \"react\";\nimport { Modal } from \"./Modal\";\nimport Button from \"@mui/material/Button\";\nimport Typography from \"@mui/material/Typography\";\nimport TextField from \"@mui/material/TextField\";\nimport DoneIcon from \"@mui/icons-material/Done\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ReplyIcon from \"@mui/icons-material/Reply\";\nimport { Color, ColorPicker } from \"material-ui-color\";\nimport { ThemeEvents } from \"./Theme\";\nimport { Settings, defaultSettings } from \"../../Settings/Settings\";\n\ninterface IProps {\n open: boolean;\n onClose: () => void;\n}\n\nfunction ColorEditor({ name }: { name: string }): React.ReactElement {\n const [color, setColor] = useState(Settings.theme[name]);\n if (color === undefined) return <>;\n const valid = color.match(/#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})/g);\n\n function set(): void {\n if (!valid) return;\n Settings.theme[name] = color;\n ThemeEvents.emit();\n }\n\n function revert(): void {\n Settings.theme[name] = defaultSettings.theme[name];\n setColor(defaultSettings.theme[name]);\n ThemeEvents.emit();\n }\n\n function onChange(event: React.ChangeEvent): void {\n setColor(event.target.value);\n }\n\n function onColorPickerChange(newValue: Color): void {\n setColor(\"#\" + newValue.hex.toLowerCase());\n }\n\n return (\n <>\n \n \n \n ),\n endAdornment: (\n <>\n \n \n \n \n \n \n \n ),\n }}\n />\n \n );\n}\n\nexport function ThemeEditorModal(props: IProps): React.ReactElement {\n return (\n \n \n \n \n \n \n primary\n secondary\n warning\n info\n error\n
      \n \n \n \n\n
      \n \n \n \n\n
      \n \n \n \n\n
      \n \n \n \n\n
      \n \n \n \n\n
      \n \n \n \n \n\n
      \n \n \n \n \n \n \n \n
      \n );\n}\n","import React, { useState, useEffect } from \"react\";\n\nimport { IPlayer } from \"../../IPlayer\";\n\nimport { SleeveElem } from \"../ui/SleeveElem\";\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function SleeveRoot(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => {\n const id = setInterval(rerender, 150);\n return () => clearInterval(id);\n }, []);\n\n return (\n <>\n

      Sleeves

      \n

      \n Duplicate Sleeves are MK-V Synthoids (synthetic androids) into which your consciousness has been copied. In\n other words, these Synthoids contain a perfect duplicate of your mind.\n
      \n
      \n Sleeves can be used to perform different tasks synchronously.\n
      \n
      \n

      \n\n \n \n Documentation\n \n
        \n {props.player.sleeves.map((sleeve, i) => (\n
      • \n \n
      • \n ))}\n
      \n \n );\n}\n","import React, { useState } from \"react\";\n\nimport { Sleeve } from \"../Sleeve\";\nimport { SleeveTaskType } from \"../SleeveTaskTypesEnum\";\n\nimport { IPlayer } from \"../../IPlayer\";\nimport { CONSTANTS } from \"../../../Constants\";\n\nimport { Crimes } from \"../../../Crime/Crimes\";\n\nimport { numeralWrapper } from \"../../../ui/numeralFormat\";\n\nimport { dialogBoxCreate } from \"../../../../utils/DialogBox\";\n\nimport { createProgressBarText } from \"../../../../utils/helpers/createProgressBarText\";\n\nimport { createPopup } from \"../../../ui/React/createPopup\";\n\nimport { SleeveAugmentationsPopup } from \"../ui/SleeveAugmentationsPopup\";\nimport { TravelPopup } from \"../ui/TravelPopup\";\nimport { EarningsTableElement } from \"../ui/EarningsTableElement\";\nimport { Money } from \"../../../ui/React/Money\";\nimport { MoneyRate } from \"../../../ui/React/MoneyRate\";\nimport { ReputationRate } from \"../../../ui/React/ReputationRate\";\nimport { StatsElement } from \"../ui/StatsElement\";\nimport { MoreStatsContent } from \"../ui/MoreStatsContent\";\nimport { MoreEarningsContent } from \"../ui/MoreEarningsContent\";\nimport { TaskSelector } from \"../ui/TaskSelector\";\nimport { FactionWorkType } from \"../../../Faction/FactionWorkTypeEnum\";\n\ninterface IProps {\n player: IPlayer;\n sleeve: Sleeve;\n rerender: () => void;\n}\n\nexport function SleeveElem(props: IProps): React.ReactElement {\n const [abc, setABC] = useState([\"------\", \"------\", \"------\"]);\n\n function openMoreStats(): void {\n dialogBoxCreate();\n }\n\n function openTravel(): void {\n const popupId = \"sleeve-travel-popup\";\n createPopup(popupId, TravelPopup, {\n popupId: popupId,\n sleeve: props.sleeve,\n player: props.player,\n rerender: props.rerender,\n });\n }\n\n function openManageAugmentations(): void {\n const popupId = \"sleeve-augmentation-popup\";\n createPopup(popupId, SleeveAugmentationsPopup, {\n sleeve: props.sleeve,\n player: props.player,\n });\n }\n\n function openMoreEarnings(): void {\n dialogBoxCreate();\n }\n\n function setTask(): void {\n props.sleeve.resetTaskStatus(); // sets to idle\n switch (abc[0]) {\n case \"------\":\n break;\n case \"Work for Company\":\n props.sleeve.workForCompany(props.player, abc[1]);\n break;\n case \"Work for Faction\":\n props.sleeve.workForFaction(props.player, abc[1], abc[2]);\n break;\n case \"Commit Crime\":\n props.sleeve.commitCrime(props.player, abc[1]);\n break;\n case \"Take University Course\":\n props.sleeve.takeUniversityCourse(props.player, abc[2], abc[1]);\n break;\n case \"Workout at Gym\":\n props.sleeve.workoutAtGym(props.player, abc[2], abc[1]);\n break;\n case \"Shock Recovery\":\n props.sleeve.shockRecovery(props.player);\n break;\n case \"Synchronize\":\n props.sleeve.synchronize(props.player);\n break;\n default:\n console.error(`Invalid/Unrecognized taskValue in setSleeveTask(): ${abc[0]}`);\n }\n props.rerender();\n }\n\n let desc = <>;\n switch (props.sleeve.currentTask) {\n case SleeveTaskType.Idle:\n desc = <>This sleeve is currently idle;\n break;\n case SleeveTaskType.Company:\n desc = <>This sleeve is currently working your job at {props.sleeve.currentTaskLocation}.;\n break;\n case SleeveTaskType.Faction: {\n let doing = \"nothing\";\n switch (props.sleeve.factionWorkType) {\n case FactionWorkType.Field:\n doing = \"Field work\";\n break;\n case FactionWorkType.Hacking:\n doing = \"Hacking contracts\";\n break;\n case FactionWorkType.Security:\n doing = \"Security work\";\n break;\n }\n desc = (\n <>\n This sleeve is currently doing {doing} for {props.sleeve.currentTaskLocation}.\n \n );\n break;\n }\n case SleeveTaskType.Crime:\n desc = (\n <>\n This sleeve is currently attempting to {Crimes[props.sleeve.crimeType].type} (Success Rate:{\" \"}\n {numeralWrapper.formatPercentage(Crimes[props.sleeve.crimeType].successRate(props.sleeve))}).\n \n );\n break;\n case SleeveTaskType.Class:\n desc = <>This sleeve is currently studying/taking a course at {props.sleeve.currentTaskLocation}.;\n break;\n case SleeveTaskType.Gym:\n desc = <>This sleeve is currently working out at {props.sleeve.currentTaskLocation}.;\n break;\n case SleeveTaskType.Recovery:\n desc = (\n <>\n This sleeve is currently set to focus on shock recovery. This causes the Sleeve's shock to decrease at a\n faster rate.\n \n );\n break;\n case SleeveTaskType.Synchro:\n desc = (\n <>\n This sleeve is currently set to synchronize with the original consciousness. This causes the Sleeve's\n synchronization to increase.\n \n );\n break;\n default:\n console.error(`Invalid/Unrecognized taskValue in updateSleeveTaskDescription(): ${abc[0]}`);\n }\n\n let data: any[][] = [];\n if (props.sleeve.currentTask === SleeveTaskType.Crime) {\n data = [\n [`Money`, , `(on success)`],\n [`Hacking Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.hack), `(2x on success)`],\n [`Strength Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.str), `(2x on success)`],\n [`Defense Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.def), `(2x on success)`],\n [`Dexterity Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.dex), `(2x on success)`],\n [`Agility Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.agi), `(2x on success)`],\n [`Charisma Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.cha), `(2x on success)`],\n ];\n\n // elems.taskProgressBar.innerText = createProgressBarText({\n // progress: props.sleeve.currentTaskTime / props.sleeve.currentTaskMaxTime,\n // totalTicks: 25,\n // });\n } else {\n data = [\n [`Money:`, ],\n [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.hack)} / s`],\n [`Strength Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.str)} / s`],\n [`Defense Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.def)} / s`],\n [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.dex)} / s`],\n [`Agility Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.agi)} / s`],\n [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.cha)} / s`],\n ];\n if (props.sleeve.currentTask === SleeveTaskType.Company || props.sleeve.currentTask === SleeveTaskType.Faction) {\n const repGain: number = props.sleeve.getRepGain(props.player);\n data.push([`Reputation:`, ReputationRate(5 * repGain)]);\n }\n\n // elems.taskProgressBar.innerText = \"\";\n }\n\n return (\n
      \n
      \n
      \n \n \n \n Travel\n {props.player.money.lt(CONSTANTS.TravelCost) && Not enough money}\n \n \n Manage Augmentations\n {props.sleeve.shock < 100 && Unlocked when sleeve has fully recovered}\n \n
      \n
      \n
      \n \n

      {desc}

      \n

      \n {props.sleeve.currentTask === SleeveTaskType.Crime &&\n createProgressBarText({\n progress: props.sleeve.currentTaskTime / props.sleeve.currentTaskMaxTime,\n totalTicks: 25,\n })}\n

      \n \n
      \n
      \n \n \n
      \n
      \n );\n}\n","import React, { useState, useEffect } from \"react\";\nimport { Sleeve } from \"../Sleeve\";\nimport { findSleevePurchasableAugs } from \"../SleeveHelpers\";\nimport { Augmentations } from \"../../../Augmentation/Augmentations\";\nimport { Augmentation } from \"../../../Augmentation/Augmentation\";\nimport { IPlayer } from \"../../IPlayer\";\nimport { Money } from \"../../../ui/React/Money\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\n\ninterface IProps {\n sleeve: Sleeve;\n player: IPlayer;\n}\n\nexport function SleeveAugmentationsPopup(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => {\n const id = setInterval(rerender, 150);\n return () => clearInterval(id);\n }, []);\n\n // Array of all owned Augmentations. Names only\n const ownedAugNames = props.sleeve.augmentations.map((e) => e.name);\n\n // You can only purchase Augmentations that are actually available from\n // your factions. I.e. you must be in a faction that has the Augmentation\n // and you must also have enough rep in that faction in order to purchase it.\n const availableAugs = findSleevePurchasableAugs(props.sleeve, props.player);\n\n function purchaseAugmentation(aug: Augmentation): void {\n props.sleeve.tryBuyAugmentation(props.player, aug);\n rerender();\n }\n\n return (\n
      \n

      Owned Augmentations:

      \n
      \n {ownedAugNames.map((augName) => {\n const aug = Augmentations[augName];\n let tooltip = aug.info;\n if (typeof tooltip !== \"string\") {\n tooltip = renderToStaticMarkup(tooltip);\n }\n tooltip += \"

      \";\n tooltip += renderToStaticMarkup(aug.stats);\n return (\n
      \n {augName}\n \n
      \n );\n })}\n
      \n

      \n You can purchase Augmentations for your Duplicate Sleeves. These Augmentations have the same effect as they\n would for you. You can only purchase Augmentations that you have unlocked through Factions.\n
      \n
      \n When purchasing an Augmentation for a Duplicate Sleeve, they are immediately installed. This means that the\n Duplicate Sleeve will immediately lose all of its stat experience.\n

      \n {availableAugs.map((aug) => {\n let info = aug.info;\n if (typeof info !== \"string\") {\n info = renderToStaticMarkup(info);\n }\n info += \"

      \";\n info += renderToStaticMarkup(aug.stats);\n\n return (\n
      purchaseAugmentation(aug)}>\n
      \n

      {aug.name}

      \n
      \n Cost: \n
      \n
      \n \n
      \n
      \n );\n })}\n
      \n );\n}\n","import React from \"react\";\nimport { Sleeve } from \"../Sleeve\";\nimport { IPlayer } from \"../../IPlayer\";\nimport { CONSTANTS } from \"../../../Constants\";\nimport { removePopup } from \"../../../ui/React/createPopup\";\nimport { Money } from \"../../../ui/React/Money\";\nimport { WorldMap } from \"../../../ui/React/WorldMap\";\nimport { CityName } from \"../../../Locations/data/CityNames\";\nimport { Settings } from \"../../../Settings/Settings\";\nimport { dialogBoxCreate } from \"../../../../utils/DialogBox\";\n\ninterface IProps {\n popupId: string;\n sleeve: Sleeve;\n player: IPlayer;\n rerender: () => void;\n}\n\nexport function TravelPopup(props: IProps): React.ReactElement {\n function travel(city: string): void {\n if (!props.player.canAfford(CONSTANTS.TravelCost)) {\n dialogBoxCreate(\"You cannot afford to have this sleeve travel to another city\");\n }\n props.sleeve.city = city as CityName;\n props.player.loseMoney(CONSTANTS.TravelCost);\n props.sleeve.resetTaskStatus();\n removePopup(props.popupId);\n props.rerender();\n }\n\n return (\n <>\n

      \n Have this sleeve travel to a different city. This affects the gyms and universities at which this sleeve can\n study. Traveling to a different city costs . It will\n also set your current sleeve task to idle.\n

      \n {Settings.DisableASCIIArt ? (\n Object.values(CityName).map((city: CityName) => (\n \n ))\n ) : (\n travel(city)} />\n )}\n \n );\n}\n","import * as React from \"react\";\n\ninterface IProps {\n title: string;\n stats: any[][];\n}\n\nexport function EarningsTableElement(props: IProps): React.ReactElement {\n return (\n <>\n
      {props.title}
      \n \n \n {props.stats.map((stat: any[], i: number) => (\n \n {stat.map((s: any, i: number) => {\n let style = {};\n if (i !== 0) {\n style = { textAlign: \"right\" };\n }\n return (\n \n );\n })}\n \n ))}\n \n
      \n {s}\n
      \n \n );\n}\n","import { Sleeve } from \"../Sleeve\";\nimport { numeralWrapper } from \"../../../ui/numeralFormat\";\nimport * as React from \"react\";\n\ninterface IProps {\n sleeve: Sleeve;\n}\n\nexport function StatsElement(props: IProps): React.ReactElement {\n let style = {};\n style = { textAlign: \"right\" };\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
      HP: \n {numeralWrapper.formatHp(props.sleeve.hp)} / {numeralWrapper.formatHp(props.sleeve.max_hp)}\n
      City: {props.sleeve.city}
      Hacking: \n {numeralWrapper.formatSkill(props.sleeve.hacking_skill)}\n
      Strength: \n {numeralWrapper.formatSkill(props.sleeve.strength)}\n
      Defense: \n {numeralWrapper.formatSkill(props.sleeve.defense)}\n
      Dexterity: \n {numeralWrapper.formatSkill(props.sleeve.dexterity)}\n
      Agility: \n {numeralWrapper.formatSkill(props.sleeve.agility)}\n
      Charisma: \n {numeralWrapper.formatSkill(props.sleeve.charisma)}\n
      Shock: \n {numeralWrapper.formatSleeveShock(100 - props.sleeve.shock)}\n
      Sync: \n {numeralWrapper.formatSleeveSynchro(props.sleeve.sync)}\n
      Memory: \n {numeralWrapper.formatSleeveMemory(props.sleeve.memory)}\n
      \n \n );\n}\n","import { Sleeve } from \"../Sleeve\";\nimport { numeralWrapper } from \"../../../ui/numeralFormat\";\nimport { StatsTable } from \"../../../ui/React/StatsTable\";\nimport * as React from \"react\";\n\ninterface IProps {\n sleeve: Sleeve;\n}\n\nexport function MoreStatsContent(props: IProps): React.ReactElement {\n return (\n <>\n \n
      \n \n \n );\n}\n","import { Sleeve } from \"../Sleeve\";\nimport { numeralWrapper } from \"../../../ui/numeralFormat\";\nimport { Money } from \"../../../ui/React/Money\";\nimport * as React from \"react\";\nimport { StatsTable } from \"../../../ui/React/StatsTable\";\n\ninterface IProps {\n sleeve: Sleeve;\n}\n\nexport function MoreEarningsContent(props: IProps): React.ReactElement {\n return (\n <>\n ],\n [\"Hacking Exp \", numeralWrapper.formatExp(props.sleeve.earningsForTask.hack)],\n [\"Strength Exp \", numeralWrapper.formatExp(props.sleeve.earningsForTask.str)],\n [\"Defense Exp \", numeralWrapper.formatExp(props.sleeve.earningsForTask.def)],\n [\"Dexterity Exp \", numeralWrapper.formatExp(props.sleeve.earningsForTask.dex)],\n [\"Agility Exp \", numeralWrapper.formatExp(props.sleeve.earningsForTask.agi)],\n [\"Charisma Exp \", numeralWrapper.formatExp(props.sleeve.earningsForTask.cha)],\n ]}\n title=\"Earnings for Current Task:\"\n />\n
      \n ],\n [\"Hacking Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForPlayer.hack)],\n [\"Strength Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForPlayer.str)],\n [\"Defense Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForPlayer.def)],\n [\"Dexterity Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForPlayer.dex)],\n [\"Agility Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForPlayer.agi)],\n [\"Charisma Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForPlayer.cha)],\n ]}\n title=\"Total Earnings for Host Consciousness:\"\n />\n
      \n ],\n [\"Hacking Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForSleeves.hack)],\n [\"Strength Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForSleeves.str)],\n [\"Defense Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForSleeves.def)],\n [\"Dexterity Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForSleeves.dex)],\n [\"Agility Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForSleeves.agi)],\n [\"Charisma Exp: \", numeralWrapper.formatExp(props.sleeve.earningsForSleeves.cha)],\n ]}\n title=\"Total Earnings for Other Sleeves:\"\n />\n
      \n \n );\n}\n","import React, { useState } from \"react\";\nimport { Sleeve } from \"../Sleeve\";\nimport { IPlayer } from \"../../IPlayer\";\nimport { SleeveTaskType } from \"../SleeveTaskTypesEnum\";\nimport { Crimes } from \"../../../Crime/Crimes\";\nimport { LocationName } from \"../../../Locations/data/LocationNames\";\nimport { CityName } from \"../../../Locations/data/CityNames\";\nimport { Factions } from \"../../../Faction/Factions\";\nimport { FactionWorkType } from \"../../../Faction/FactionWorkTypeEnum\";\n\nconst universitySelectorOptions: string[] = [\n \"Study Computer Science\",\n \"Data Structures\",\n \"Networks\",\n \"Algorithms\",\n \"Management\",\n \"Leadership\",\n];\n\nconst gymSelectorOptions: string[] = [\"Train Strength\", \"Train Defense\", \"Train Dexterity\", \"Train Agility\"];\n\ninterface IProps {\n sleeve: Sleeve;\n player: IPlayer;\n setABC: (abc: string[]) => void;\n}\n\ninterface ITaskDetails {\n first: string[];\n second: (s1: string) => string[];\n}\n\nfunction possibleJobs(player: IPlayer, sleeve: Sleeve): string[] {\n // Array of all companies that other sleeves are working at\n const forbiddenCompanies = [];\n for (const otherSleeve of player.sleeves) {\n if (sleeve === otherSleeve) {\n continue;\n }\n if (otherSleeve.currentTask === SleeveTaskType.Company) {\n forbiddenCompanies.push(otherSleeve.currentTaskLocation);\n }\n }\n const allJobs: string[] = Object.keys(player.jobs);\n for (let i = 0; i < allJobs.length; ++i) {\n if (!forbiddenCompanies.includes(allJobs[i])) {\n allJobs[i];\n }\n }\n\n return allJobs;\n}\n\nfunction possibleFactions(player: IPlayer, sleeve: Sleeve): string[] {\n // Array of all factions that other sleeves are working for\n const forbiddenFactions = [\"Bladeburners\"];\n if (player.gang) {\n forbiddenFactions.push(player.gang.facName);\n }\n for (const otherSleeve of player.sleeves) {\n if (sleeve === otherSleeve) {\n continue;\n }\n if (otherSleeve.currentTask === SleeveTaskType.Faction) {\n forbiddenFactions.push(otherSleeve.currentTaskLocation);\n }\n }\n\n const factions = [];\n for (const fac of player.factions) {\n if (!forbiddenFactions.includes(fac)) {\n factions.push(fac);\n }\n }\n\n return factions;\n}\n\nconst tasks: {\n [key: string]: undefined | ((player: IPlayer, sleeve: Sleeve) => ITaskDetails);\n [\"------\"]: (player: IPlayer, sleeve: Sleeve) => ITaskDetails;\n [\"Work for Company\"]: (player: IPlayer, sleeve: Sleeve) => ITaskDetails;\n [\"Work for Faction\"]: (player: IPlayer, sleeve: Sleeve) => ITaskDetails;\n [\"Commit Crime\"]: (player: IPlayer, sleeve: Sleeve) => ITaskDetails;\n [\"Take University Course\"]: (player: IPlayer, sleeve: Sleeve) => ITaskDetails;\n [\"Workout at Gym\"]: (player: IPlayer, sleeve: Sleeve) => ITaskDetails;\n [\"Shock Recovery\"]: (player: IPlayer, sleeve: Sleeve) => ITaskDetails;\n [\"Synchronize\"]: (player: IPlayer, sleeve: Sleeve) => ITaskDetails;\n} = {\n \"------\": (): ITaskDetails => {\n return { first: [\"------\"], second: () => [\"------\"] };\n },\n \"Work for Company\": (player: IPlayer, sleeve: Sleeve): ITaskDetails => {\n let jobs = possibleJobs(player, sleeve);\n\n if (jobs.length === 0) jobs = [\"------\"];\n return { first: jobs, second: () => [\"------\"] };\n },\n \"Work for Faction\": (player: IPlayer, sleeve: Sleeve): ITaskDetails => {\n let factions = possibleFactions(player, sleeve);\n if (factions.length === 0) factions = [\"------\"];\n\n return {\n first: factions,\n second: (s1: string) => {\n const faction = Factions[s1];\n const facInfo = faction.getInfo();\n const options: string[] = [];\n if (facInfo.offerHackingWork) {\n options.push(\"Hacking Contracts\");\n }\n if (facInfo.offerFieldWork) {\n options.push(\"Field Work\");\n }\n if (facInfo.offerSecurityWork) {\n options.push(\"Security Work\");\n }\n return options;\n },\n };\n },\n \"Commit Crime\": (): ITaskDetails => {\n return { first: Object.keys(Crimes), second: () => [\"------\"] };\n },\n \"Take University Course\": (player: IPlayer, sleeve: Sleeve): ITaskDetails => {\n let universities: string[] = [];\n switch (sleeve.city) {\n case CityName.Aevum:\n universities = [LocationName.AevumSummitUniversity];\n break;\n case CityName.Sector12:\n universities = [LocationName.Sector12RothmanUniversity];\n break;\n case CityName.Volhaven:\n universities = [LocationName.VolhavenZBInstituteOfTechnology];\n break;\n default:\n universities = [\"No university available in city!\"];\n break;\n }\n\n return { first: universitySelectorOptions, second: () => universities };\n },\n \"Workout at Gym\": (player: IPlayer, sleeve: Sleeve): ITaskDetails => {\n let gyms: string[] = [];\n switch (sleeve.city) {\n case CityName.Aevum:\n gyms = [LocationName.AevumCrushFitnessGym, LocationName.AevumSnapFitnessGym];\n break;\n case CityName.Sector12:\n gyms = [LocationName.Sector12IronGym, LocationName.Sector12PowerhouseGym];\n break;\n case CityName.Volhaven:\n gyms = [LocationName.VolhavenMilleniumFitnessGym];\n break;\n default:\n gyms = [\"No gym available in city!\"];\n break;\n }\n\n return { first: gymSelectorOptions, second: () => gyms };\n },\n \"Shock Recovery\": (): ITaskDetails => {\n return { first: [\"------\"], second: () => [\"------\"] };\n },\n Synchronize: (): ITaskDetails => {\n return { first: [\"------\"], second: () => [\"------\"] };\n },\n};\n\nconst canDo: {\n [key: string]: undefined | ((player: IPlayer, sleeve: Sleeve) => boolean);\n [\"------\"]: (player: IPlayer, sleeve: Sleeve) => boolean;\n [\"Work for Company\"]: (player: IPlayer, sleeve: Sleeve) => boolean;\n [\"Work for Faction\"]: (player: IPlayer, sleeve: Sleeve) => boolean;\n [\"Commit Crime\"]: (player: IPlayer, sleeve: Sleeve) => boolean;\n [\"Take University Course\"]: (player: IPlayer, sleeve: Sleeve) => boolean;\n [\"Workout at Gym\"]: (player: IPlayer, sleeve: Sleeve) => boolean;\n [\"Shock Recovery\"]: (player: IPlayer, sleeve: Sleeve) => boolean;\n [\"Synchronize\"]: (player: IPlayer, sleeve: Sleeve) => boolean;\n} = {\n \"------\": () => true,\n \"Work for Company\": (player: IPlayer, sleeve: Sleeve) => possibleJobs(player, sleeve).length > 0,\n \"Work for Faction\": (player: IPlayer, sleeve: Sleeve) => possibleFactions(player, sleeve).length > 0,\n \"Commit Crime\": () => true,\n \"Take University Course\": (player: IPlayer, sleeve: Sleeve) => [CityName.Aevum, CityName.Sector12, CityName.Volhaven].includes(sleeve.city),\n \"Workout at Gym\": (player: IPlayer, sleeve: Sleeve) => [CityName.Aevum, CityName.Sector12, CityName.Volhaven].includes(sleeve.city),\n \"Shock Recovery\": (player: IPlayer, sleeve: Sleeve) => sleeve.shock < 100,\n Synchronize: (player: IPlayer, sleeve: Sleeve) => sleeve.sync < 100,\n};\n\nfunction getABC(sleeve: Sleeve): [string, string, string] {\n switch (sleeve.currentTask) {\n case SleeveTaskType.Idle:\n return [\"------\", \"------\", \"------\"];\n case SleeveTaskType.Company:\n return [\"Work for Company\", sleeve.currentTaskLocation, \"------\"];\n case SleeveTaskType.Faction: {\n let workType = \"\";\n switch (sleeve.factionWorkType) {\n case FactionWorkType.Hacking:\n workType = \"Hacking Contracts\";\n break;\n case FactionWorkType.Field:\n workType = \"Field Work\";\n break;\n case FactionWorkType.Security:\n workType = \"Security Work\";\n break;\n }\n return [\"Work for Faction\", sleeve.currentTaskLocation, workType];\n }\n case SleeveTaskType.Crime:\n return [\"Commit Crime\", sleeve.crimeType, \"------\"];\n case SleeveTaskType.Class:\n return [\"Take University Course\", sleeve.className, sleeve.currentTaskLocation];\n case SleeveTaskType.Gym:\n return [\"Workout at Gym\", sleeve.gymStatType, sleeve.currentTaskLocation];\n case SleeveTaskType.Recovery:\n return [\"Shock Recovery\", \"------\", \"------\"];\n case SleeveTaskType.Synchro:\n return [\"Synchronize\", \"------\", \"------\"];\n }\n}\n\nexport function TaskSelector(props: IProps): React.ReactElement {\n const abc = getABC(props.sleeve);\n const [s0, setS0] = useState(abc[0]);\n const [s1, setS1] = useState(abc[1]);\n const [s2, setS2] = useState(abc[2]);\n\n const validActions = Object.keys(canDo).filter((k) => (canDo[k] as (player: IPlayer, sleeve: Sleeve) => boolean)(props.player, props.sleeve),\n );\n\n const detailsF = tasks[s0];\n if (detailsF === undefined) throw new Error(`No function for task '${s0}'`);\n const details = detailsF(props.player, props.sleeve);\n const details2 = details.second(s1);\n\n if (details.first.length > 0 && !details.first.includes(s1)) {\n setS1(details.first[0]);\n props.setABC([s0, details.first[0], s2]);\n }\n if (details2.length > 0 && !details2.includes(s2)) {\n setS2(details2[0]);\n props.setABC([s0, s1, details2[0]]);\n }\n\n function onS0Change(event: React.ChangeEvent): void {\n const n = event.target.value;\n const detailsF = tasks[n];\n if (detailsF === undefined) throw new Error(`No function for task '${s0}'`);\n const details = detailsF(props.player, props.sleeve);\n const details2 = details.second(details.first[0]);\n setS2(details2[0]);\n setS1(details.first[0]);\n setS0(n);\n props.setABC([n, details.first[0], details2[0]]);\n }\n\n function onS1Change(event: React.ChangeEvent): void {\n setS1(event.target.value);\n props.setABC([s0, event.target.value, s2]);\n }\n\n function onS2Change(event: React.ChangeEvent): void {\n setS2(event.target.value);\n props.setABC([s0, s1, event.target.value]);\n }\n\n return (\n <>\n \n {!(details.first.length === 1 && details.first[0] === \"------\") && (\n \n )}\n {!(details2.length === 1 && details2[0] === \"------\") && (\n \n )}\n \n );\n}\n","/**\n * Root React Component for the Hacknet Node UI\n */\nimport React, { useState, useEffect } from \"react\";\n\nimport { GeneralInfo } from \"./GeneralInfo\";\nimport { HacknetNodeElem } from \"./HacknetNodeElem\";\nimport { HacknetServerElem } from \"./HacknetServerElem\";\nimport { HacknetNode } from \"../HacknetNode\";\nimport { HashUpgradePopup } from \"./HashUpgradePopup\";\nimport { MultiplierButtons } from \"./MultiplierButtons\";\nimport { PlayerInfo } from \"./PlayerInfo\";\nimport { PurchaseButton } from \"./PurchaseButton\";\nimport { PurchaseMultipliers } from \"../data/Constants\";\n\nimport {\n getCostOfNextHacknetNode,\n getCostOfNextHacknetServer,\n hasHacknetServers,\n purchaseHacknet,\n} from \"../HacknetHelpers\";\n\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { AllServers } from \"../../Server/AllServers\";\nimport { Server } from \"../../Server/Server\";\n\nimport { createPopup } from \"../../ui/React/createPopup\";\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function HacknetRoot(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n const [purchaseMultiplier, setPurchaseMultiplier] = useState(PurchaseMultipliers.x1);\n\n useEffect(() => {\n const id = setInterval(rerender, 1000);\n return () => clearInterval(id);\n }, []);\n\n function createHashUpgradesPopup(): void {\n const id = \"hacknet-server-hash-upgrades-popup\";\n createPopup(id, HashUpgradePopup, {\n player: props.player,\n });\n }\n\n let totalProduction = 0;\n for (let i = 0; i < props.player.hacknetNodes.length; ++i) {\n const node = props.player.hacknetNodes[i];\n if (hasHacknetServers(props.player)) {\n if (node instanceof HacknetNode) throw new Error(\"node was hacknet node\"); // should never happen\n const hserver = AllServers[node];\n if (hserver instanceof Server) throw new Error(\"node was a normal server\"); // should never happen\n if (hserver) {\n totalProduction += hserver.hashRate;\n } else {\n console.warn(`Could not find Hacknet Server object in AllServers map (i=${i})`);\n }\n } else {\n if (typeof node === \"string\") throw new Error(\"node was ip string\"); // should never happen\n totalProduction += node.moneyGainRatePerSecond;\n }\n }\n\n function handlePurchaseButtonClick(): void {\n purchaseHacknet(props.player);\n rerender();\n }\n\n // Cost to purchase a new Hacknet Node\n let purchaseCost;\n if (hasHacknetServers(props.player)) {\n purchaseCost = getCostOfNextHacknetServer(props.player);\n } else {\n purchaseCost = getCostOfNextHacknetNode(props.player);\n }\n\n // onClick event handlers for purchase multiplier buttons\n const purchaseMultiplierOnClicks = [\n () => setPurchaseMultiplier(PurchaseMultipliers.x1),\n () => setPurchaseMultiplier(PurchaseMultipliers.x5),\n () => setPurchaseMultiplier(PurchaseMultipliers.x10),\n () => setPurchaseMultiplier(PurchaseMultipliers.MAX),\n ];\n\n // HacknetNode components\n const nodes = props.player.hacknetNodes.map((node: string | HacknetNode) => {\n if (hasHacknetServers(props.player)) {\n if (node instanceof HacknetNode) throw new Error(\"node was hacknet node\"); // should never happen\n const hserver = AllServers[node];\n if (hserver == null) {\n throw new Error(`Could not find Hacknet Server object in AllServers map for IP: ${node}`);\n }\n if (hserver instanceof Server) throw new Error(\"node was normal server\"); // should never happen\n return (\n \n );\n } else {\n if (typeof node === \"string\") throw new Error(\"node was ip string\"); // should never happen\n return (\n \n );\n }\n });\n\n return (\n <>\n

      Hacknet {hasHacknetServers(props.player) ? \"Servers\" : \"Nodes\"}

      \n \n\n \n\n
      \n
      \n \n \n
      \n\n {hasHacknetServers(props.player) && (\n \n )}\n\n
        {nodes}
      \n \n );\n}\n","/**\n * React Component for the Hacknet Node UI\n *\n * Displays general information about Hacknet Nodes\n */\nimport React from \"react\";\n\ninterface IProps {\n hasHacknetServers: boolean;\n}\n\nexport function GeneralInfo(props: IProps): React.ReactElement {\n return (\n
      \n

      \n The Hacknet is a global, decentralized network of machines. It is used by hackers all around the world to\n anonymously share computing power and perform distributed cyberattacks without the fear of being traced.\n

      \n {!props.hasHacknetServers ? (\n <>\n

      \n {`Here, you can purchase a Hacknet Node, a specialized machine that can connect ` +\n `and contribute its resources to the Hacknet network. This allows you to take ` +\n `a small percentage of profits from hacks performed on the network. Essentially, ` +\n `you are renting out your Node's computing power.`}\n

      \n

      \n {`Each Hacknet Node you purchase will passively earn you money. Each Hacknet Node ` +\n `can be upgraded in order to increase its computing power and thereby increase ` +\n `the profit you earn from it.`}\n

      \n \n ) : (\n <>\n

      \n {`Here, you can purchase a Hacknet Server, an upgraded version of the Hacknet Node. ` +\n `Hacknet Servers will perform computations and operations on the network, earning ` +\n `you hashes. Hashes can be spent on a variety of different upgrades.`}\n

      \n

      \n {`Hacknet Servers can also be used as servers to run scripts. However, running scripts ` +\n `on a server will reduce its hash rate (hashes generated per second). A Hacknet Server's hash ` +\n `rate will be reduced by the percentage of RAM that is being used by that Server to run ` +\n `scripts.`}\n

      \n \n )}\n
      \n );\n}\n","/**\n * React Component for the Hacknet Node UI.\n * This Component displays the panel for a single Hacknet Node\n */\nimport React from \"react\";\n\nimport { HacknetNodeConstants } from \"../data/Constants\";\nimport {\n getMaxNumberLevelUpgrades,\n getMaxNumberRamUpgrades,\n getMaxNumberCoreUpgrades,\n purchaseLevelUpgrade,\n purchaseRamUpgrade,\n purchaseCoreUpgrade,\n} from \"../HacknetHelpers\";\n\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { HacknetNode } from \"../HacknetNode\";\n\nimport { Money } from \"../../ui/React/Money\";\nimport { MoneyRate } from \"../../ui/React/MoneyRate\";\n\ninterface IProps {\n node: HacknetNode;\n purchaseMultiplier: number | string;\n rerender: () => void;\n player: IPlayer;\n}\n\nexport function HacknetNodeElem(props: IProps): React.ReactElement {\n const node = props.node;\n const purchaseMult = props.purchaseMultiplier;\n const rerender = props.rerender;\n\n // Upgrade Level Button\n let upgradeLevelContent, upgradeLevelClass;\n if (node.level >= HacknetNodeConstants.MaxLevel) {\n upgradeLevelContent = <>MAX LEVEL;\n upgradeLevelClass = \"std-button-disabled\";\n } else {\n let multiplier = 0;\n if (purchaseMult === \"MAX\") {\n multiplier = getMaxNumberLevelUpgrades(props.player, node, HacknetNodeConstants.MaxLevel);\n } else {\n const levelsToMax = HacknetNodeConstants.MaxLevel - node.level;\n multiplier = Math.min(levelsToMax, purchaseMult as number);\n }\n\n const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, props.player.hacknet_node_level_cost_mult);\n upgradeLevelContent = (\n <>\n Upgrade x{multiplier} - \n \n );\n if (props.player.money.lt(upgradeLevelCost)) {\n upgradeLevelClass = \"std-button-disabled\";\n } else {\n upgradeLevelClass = \"std-button\";\n }\n }\n function upgradeLevelOnClick(): void {\n let numUpgrades = purchaseMult;\n if (purchaseMult === \"MAX\") {\n numUpgrades = getMaxNumberLevelUpgrades(props.player, node, HacknetNodeConstants.MaxLevel);\n }\n purchaseLevelUpgrade(props.player, node, numUpgrades as number);\n rerender();\n }\n\n let upgradeRamContent, upgradeRamClass;\n if (node.ram >= HacknetNodeConstants.MaxRam) {\n upgradeRamContent = <>MAX RAM;\n upgradeRamClass = \"std-button-disabled\";\n } else {\n let multiplier = 0;\n if (purchaseMult === \"MAX\") {\n multiplier = getMaxNumberRamUpgrades(props.player, node, HacknetNodeConstants.MaxRam);\n } else {\n const levelsToMax = Math.round(Math.log2(HacknetNodeConstants.MaxRam / node.ram));\n multiplier = Math.min(levelsToMax, purchaseMult as number);\n }\n\n const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, props.player.hacknet_node_ram_cost_mult);\n upgradeRamContent = (\n <>\n Upgrade x{multiplier} - \n \n );\n if (props.player.money.lt(upgradeRamCost)) {\n upgradeRamClass = \"std-button-disabled\";\n } else {\n upgradeRamClass = \"std-button\";\n }\n }\n function upgradeRamOnClick(): void {\n let numUpgrades = purchaseMult;\n if (purchaseMult === \"MAX\") {\n numUpgrades = getMaxNumberRamUpgrades(props.player, node, HacknetNodeConstants.MaxRam);\n }\n purchaseRamUpgrade(props.player, node, numUpgrades as number);\n rerender();\n }\n\n let upgradeCoresContent, upgradeCoresClass;\n if (node.cores >= HacknetNodeConstants.MaxCores) {\n upgradeCoresContent = <>MAX CORES;\n upgradeCoresClass = \"std-button-disabled\";\n } else {\n let multiplier = 0;\n if (purchaseMult === \"MAX\") {\n multiplier = getMaxNumberCoreUpgrades(props.player, node, HacknetNodeConstants.MaxCores);\n } else {\n const levelsToMax = HacknetNodeConstants.MaxCores - node.cores;\n multiplier = Math.min(levelsToMax, purchaseMult as number);\n }\n\n const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, props.player.hacknet_node_core_cost_mult);\n upgradeCoresContent = (\n <>\n Upgrade x{multiplier} - \n \n );\n if (props.player.money.lt(upgradeCoreCost)) {\n upgradeCoresClass = \"std-button-disabled\";\n } else {\n upgradeCoresClass = \"std-button\";\n }\n }\n function upgradeCoresOnClick(): void {\n let numUpgrades = purchaseMult;\n if (purchaseMult === \"MAX\") {\n numUpgrades = getMaxNumberCoreUpgrades(props.player, node, HacknetNodeConstants.MaxCores);\n }\n purchaseCoreUpgrade(props.player, node, numUpgrades as number);\n rerender();\n }\n\n return (\n
    • \n
      \n
      \n

      {node.name}

      \n
      \n
      \n

      Production:

      \n \n (\n )\n \n
      \n
      \n

      Level:

      \n {node.level}\n \n
      \n
      \n

      RAM:

      \n {node.ram}GB\n \n
      \n
      \n

      Cores:

      \n {node.cores}\n \n
      \n
      \n
    • \n );\n}\n","/**\n * Object representing an upgrade that can be purchased with hashes\n */\nexport interface IConstructorParams {\n cost?: number;\n costPerLevel: number;\n desc: string;\n hasTargetServer?: boolean;\n name: string;\n value: number;\n effectText?: (level: number) => JSX.Element | null;\n}\n\nexport class HashUpgrade {\n /**\n * If the upgrade has a flat cost (never increases), it goes here\n * Otherwise, this property should be undefined\n *\n * This property overrides the 'costPerLevel' property\n */\n cost?: number;\n\n /**\n * Base cost for this upgrade. Every time the upgrade is purchased,\n * its cost increases by this same amount (so its 1x, 2x, 3x, 4x, etc.)\n */\n costPerLevel = 0;\n\n /**\n * Description of what the upgrade does\n */\n desc = \"\";\n\n /**\n * Boolean indicating that this upgrade's effect affects a single server,\n * the \"target\" server\n */\n hasTargetServer = false;\n\n // Name of upgrade\n name = \"\";\n\n // Generic value used to indicate the potency/amount of this upgrade's effect\n // The meaning varies between different upgrades\n value = 0;\n\n constructor(p: IConstructorParams) {\n if (p.cost != null) {\n this.cost = p.cost;\n }\n if (p.effectText != null) {\n this.effectText = p.effectText;\n }\n\n this.costPerLevel = p.costPerLevel;\n this.desc = p.desc;\n this.hasTargetServer = p.hasTargetServer ? p.hasTargetServer : false;\n this.name = p.name;\n this.value = p.value;\n }\n\n // Functions that returns the UI element to display the effect of this upgrade.\n effectText: (level: number) => JSX.Element | null = () => null;\n\n getCost(levels: number): number {\n if (typeof this.cost === \"number\") {\n return this.cost;\n }\n\n return Math.round((levels + 1) * this.costPerLevel);\n }\n}\n","// Metadata used to construct all Hash Upgrades\nimport React from \"react\";\nimport { IConstructorParams } from \"../HashUpgrade\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { Money } from \"../../ui/React/Money\";\n\nexport const HashUpgradesMetadata: IConstructorParams[] = [\n {\n cost: 4,\n costPerLevel: 4,\n desc: \"Sell hashes for $1m\",\n name: \"Sell for Money\",\n effectText: (level: number): JSX.Element | null => (\n <>\n Sold for \n \n ),\n value: 1e6,\n },\n {\n costPerLevel: 100,\n desc: \"Sell hashes for $1b in Corporation funds\",\n name: \"Sell for Corporation Funds\",\n effectText: (level: number): JSX.Element | null => (\n <>\n Sold for Corporation funds.\n \n ),\n value: 1e9,\n },\n {\n costPerLevel: 50,\n desc:\n \"Use hashes to decrease the minimum security of a single server by 2%. \" +\n \"Note that a server's minimum security cannot go below 1. This effect persists \" +\n \"until you install Augmentations (since servers are reset at that time).\",\n hasTargetServer: true,\n name: \"Reduce Minimum Security\",\n value: 0.98,\n },\n {\n costPerLevel: 50,\n desc:\n \"Use hashes to increase the maximum amount of money on a single server by 2%. \" +\n \"This effect persists until you install Augmentations (since servers \" +\n \"are reset at that time).\",\n hasTargetServer: true,\n name: \"Increase Maximum Money\",\n value: 1.02,\n },\n {\n costPerLevel: 50,\n desc:\n \"Use hashes to improve the experience earned when studying at a university by 20%. \" +\n \"This effect persists until you install Augmentations\",\n name: \"Improve Studying\",\n effectText: (level: number): JSX.Element | null => <>Improves studying by {level * 20}%,\n value: 20, // Improves studying by value%\n },\n {\n costPerLevel: 50,\n desc:\n \"Use hashes to improve the experience earned when training at the gym by 20%. This effect \" +\n \"persists until you install Augmentations\",\n name: \"Improve Gym Training\",\n effectText: (level: number): JSX.Element | null => <>Improves training by {level * 20}%,\n value: 20, // Improves training by value%\n },\n {\n costPerLevel: 200,\n desc: \"Exchange hashes for 1k Scientific Research in all of your Corporation's Industries\",\n name: \"Exchange for Corporation Research\",\n effectText: (level: number): JSX.Element | null => (\n <>Acquired a total of {level}k Scientific Research in your industries.\n ),\n value: 1000,\n },\n {\n costPerLevel: 250,\n desc: \"Exchange hashes for 100 Bladeburner Rank\",\n name: \"Exchange for Bladeburner Rank\",\n effectText: (level: number): JSX.Element | null => (\n <>Acquired a total of {numeralWrapper.format(100 * level, \"0a\")} Bladeburner rank\n ),\n value: 100,\n },\n {\n costPerLevel: 250,\n desc: \"Exchanges hashes for 10 Bladeburner Skill Points\",\n name: \"Exchange for Bladeburner SP\",\n effectText: (level: number): JSX.Element | null => (\n <>Acquired a total of {numeralWrapper.format(10 * level, \"0a\")} Bladeburner Skill Points\n ),\n value: 10,\n },\n {\n costPerLevel: 200,\n desc: \"Generate a random Coding Contract somewhere on the network\",\n name: \"Generate Coding Contract\",\n effectText: (level: number): JSX.Element | null => <>Generated {level} contracts.,\n value: 1,\n },\n];\n","/**\n * React Component for the Hacknet Node UI.\n * This Component displays the panel for a single Hacknet Node\n */\nimport React from \"react\";\n\nimport { HacknetServerConstants } from \"../data/Constants\";\nimport {\n getMaxNumberLevelUpgrades,\n getMaxNumberRamUpgrades,\n getMaxNumberCoreUpgrades,\n getMaxNumberCacheUpgrades,\n purchaseLevelUpgrade,\n purchaseRamUpgrade,\n purchaseCoreUpgrade,\n purchaseCacheUpgrade,\n updateHashManagerCapacity,\n} from \"../HacknetHelpers\";\n\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { HacknetServer } from \"../HacknetServer\";\n\nimport { Money } from \"../../ui/React/Money\";\nimport { Hashes } from \"../../ui/React/Hashes\";\nimport { HashRate } from \"../../ui/React/HashRate\";\n\ninterface IProps {\n node: HacknetServer;\n purchaseMultiplier: number | string;\n rerender: () => void;\n player: IPlayer;\n}\n\nexport function HacknetServerElem(props: IProps): React.ReactElement {\n const node = props.node;\n const purchaseMult = props.purchaseMultiplier;\n const rerender = props.rerender;\n\n // Upgrade Level Button\n let upgradeLevelContent, upgradeLevelClass;\n if (node.level >= HacknetServerConstants.MaxLevel) {\n upgradeLevelContent = <>MAX LEVEL;\n upgradeLevelClass = \"std-button-disabled\";\n } else {\n let multiplier = 0;\n if (purchaseMult === \"MAX\") {\n multiplier = getMaxNumberLevelUpgrades(props.player, node, HacknetServerConstants.MaxLevel);\n } else {\n const levelsToMax = HacknetServerConstants.MaxLevel - node.level;\n multiplier = Math.min(levelsToMax, purchaseMult as number);\n }\n\n const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, props.player.hacknet_node_level_cost_mult);\n upgradeLevelContent = (\n <>\n Upgrade x{multiplier} - \n \n );\n if (props.player.money.lt(upgradeLevelCost)) {\n upgradeLevelClass = \"std-button-disabled\";\n } else {\n upgradeLevelClass = \"std-button\";\n }\n }\n function upgradeLevelOnClick(): void {\n let numUpgrades = purchaseMult;\n if (purchaseMult === \"MAX\") {\n numUpgrades = getMaxNumberLevelUpgrades(props.player, node, HacknetServerConstants.MaxLevel);\n }\n purchaseLevelUpgrade(props.player, node, numUpgrades as number);\n rerender();\n }\n\n // Upgrade RAM Button\n let upgradeRamContent, upgradeRamClass;\n if (node.maxRam >= HacknetServerConstants.MaxRam) {\n upgradeRamContent = <>MAX RAM;\n upgradeRamClass = \"std-button-disabled\";\n } else {\n let multiplier = 0;\n if (purchaseMult === \"MAX\") {\n multiplier = getMaxNumberRamUpgrades(props.player, node, HacknetServerConstants.MaxRam);\n } else {\n const levelsToMax = Math.round(Math.log2(HacknetServerConstants.MaxRam / node.maxRam));\n multiplier = Math.min(levelsToMax, purchaseMult as number);\n }\n\n const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, props.player.hacknet_node_ram_cost_mult);\n upgradeRamContent = (\n <>\n Upgrade x{multiplier} - \n \n );\n if (props.player.money.lt(upgradeRamCost)) {\n upgradeRamClass = \"std-button-disabled\";\n } else {\n upgradeRamClass = \"std-button\";\n }\n }\n function upgradeRamOnClick(): void {\n let numUpgrades = purchaseMult;\n if (purchaseMult === \"MAX\") {\n numUpgrades = getMaxNumberRamUpgrades(props.player, node, HacknetServerConstants.MaxRam);\n }\n purchaseRamUpgrade(props.player, node, numUpgrades as number);\n rerender();\n }\n\n // Upgrade Cores Button\n let upgradeCoresContent, upgradeCoresClass;\n if (node.cores >= HacknetServerConstants.MaxCores) {\n upgradeCoresContent = <>MAX CORES;\n upgradeCoresClass = \"std-button-disabled\";\n } else {\n let multiplier = 0;\n if (purchaseMult === \"MAX\") {\n multiplier = getMaxNumberCoreUpgrades(props.player, node, HacknetServerConstants.MaxCores);\n } else {\n const levelsToMax = HacknetServerConstants.MaxCores - node.cores;\n multiplier = Math.min(levelsToMax, purchaseMult as number);\n }\n\n const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, props.player.hacknet_node_core_cost_mult);\n upgradeCoresContent = (\n <>\n Upgrade x{multiplier} - \n \n );\n if (props.player.money.lt(upgradeCoreCost)) {\n upgradeCoresClass = \"std-button-disabled\";\n } else {\n upgradeCoresClass = \"std-button\";\n }\n }\n function upgradeCoresOnClick(): void {\n let numUpgrades = purchaseMult;\n if (purchaseMult === \"MAX\") {\n numUpgrades = getMaxNumberCoreUpgrades(props.player, node, HacknetServerConstants.MaxCores);\n }\n purchaseCoreUpgrade(props.player, node, numUpgrades as number);\n rerender();\n }\n\n // Upgrade Cache button\n let upgradeCacheContent, upgradeCacheClass;\n if (node.cache >= HacknetServerConstants.MaxCache) {\n upgradeCacheContent = <>MAX CACHE;\n upgradeCacheClass = \"std-button-disabled\";\n } else {\n let multiplier = 0;\n if (purchaseMult === \"MAX\") {\n multiplier = getMaxNumberCacheUpgrades(props.player, node, HacknetServerConstants.MaxCache);\n } else {\n const levelsToMax = HacknetServerConstants.MaxCache - node.cache;\n multiplier = Math.min(levelsToMax, purchaseMult as number);\n }\n\n const upgradeCacheCost = node.calculateCacheUpgradeCost(multiplier);\n upgradeCacheContent = (\n <>\n Upgrade x{multiplier} - \n \n );\n if (props.player.money.lt(upgradeCacheCost)) {\n upgradeCacheClass = \"std-button-disabled\";\n } else {\n upgradeCacheClass = \"std-button\";\n }\n }\n function upgradeCacheOnClick(): void {\n let numUpgrades = purchaseMult;\n if (purchaseMult === \"MAX\") {\n numUpgrades = getMaxNumberCacheUpgrades(props.player, node, HacknetServerConstants.MaxCache);\n }\n purchaseCacheUpgrade(props.player, node, numUpgrades as number);\n rerender();\n updateHashManagerCapacity(props.player);\n }\n\n return (\n
    • \n
      \n
      \n

      {node.hostname}

      \n
      \n
      \n

      Production:

      \n \n {Hashes(node.totalHashesGenerated)} ({HashRate(node.hashRate)})\n \n
      \n
      \n

      Hash Capacity:

      \n {Hashes(node.hashCapacity)}\n
      \n
      \n

      Level:

      \n {node.level}\n \n
      \n
      \n

      RAM:

      \n {node.maxRam}GB\n \n
      \n
      \n

      Cores:

      \n {node.cores}\n \n
      \n
      \n

      Cache Level:

      \n {node.cache}\n \n
      \n
      \n
    • \n );\n}\n","/**\n * Create the pop-up for purchasing upgrades with hashes\n */\nimport React, { useState, useEffect } from \"react\";\n\nimport { HashManager } from \"../HashManager\";\nimport { HashUpgrades } from \"../HashUpgrades\";\n\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nimport { Hashes } from \"../../ui/React/Hashes\";\nimport { HacknetUpgradeElem } from \"./HacknetUpgradeElem\";\n\ninterface IProps {\n player: IPlayer;\n}\n\nexport function HashUpgradePopup(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => {\n const id = setInterval(() => setRerender((old) => !old), 1000);\n return () => clearInterval(id);\n }, []);\n\n const hashManager = props.player.hashManager;\n if (!(hashManager instanceof HashManager)) {\n throw new Error(`Player does not have a HashManager)`);\n }\n\n const upgradeElems = Object.keys(HashUpgrades).map((upgName) => {\n const upg = HashUpgrades[upgName];\n return (\n \n );\n });\n\n return (\n
      \n

      Spend your hashes on a variety of different upgrades

      \n

      Hashes: {Hashes(props.player.hashManager.hashes)}

      \n {upgradeElems}\n
      \n );\n}\n","import React, { useState } from \"react\";\n\nimport { purchaseHashUpgrade } from \"../HacknetHelpers\";\nimport { HashManager } from \"../HashManager\";\nimport { HashUpgrade } from \"../HashUpgrade\";\n\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nimport { ServerDropdown, ServerType } from \"../../ui/React/ServerDropdown\";\n\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { CopyableText } from \"../../ui/React/CopyableText\";\nimport { Hashes } from \"../../ui/React/Hashes\";\n\ninterface IProps {\n player: IPlayer;\n hashManager: HashManager;\n upg: HashUpgrade;\n rerender: () => void;\n}\n\nexport function HacknetUpgradeElem(props: IProps): React.ReactElement {\n const [selectedServer, setSelectedServer] = useState(\"ecorp\");\n function changeTargetServer(event: React.ChangeEvent): void {\n setSelectedServer(event.target.value);\n }\n\n function purchase(): void {\n const canPurchase = props.hashManager.hashes >= props.hashManager.getUpgradeCost(props.upg.name);\n if (canPurchase) {\n const res = purchaseHashUpgrade(props.player, props.upg.name, selectedServer);\n if (!res) {\n dialogBoxCreate(\n \"Failed to purchase upgrade. This may be because you do not have enough hashes, \" +\n \"or because you do not have access to the feature upgrade affects.\",\n );\n }\n props.rerender();\n }\n }\n\n const hashManager = props.hashManager;\n const upg = props.upg;\n const cost = hashManager.getUpgradeCost(upg.name);\n const level = hashManager.upgrades[upg.name];\n const effect = upg.effectText(level);\n\n // Purchase button\n const canPurchase = hashManager.hashes >= cost;\n const btnClass = canPurchase ? \"std-button\" : \"std-button-disabled\";\n\n // We'll reuse a Bladeburner css class\n return (\n
      \n \n

      \n Cost: {Hashes(cost)}, Bought: {level} times\n

      \n\n

      {upg.desc}

      \n \n {level > 0 && effect &&

      {effect}

      }\n {upg.hasTargetServer && (\n \n )}\n
      \n );\n}\n","/**\n * React Component for the Multiplier buttons on the Hacknet page.\n * These buttons let the player control how many Nodes/Upgrades they're\n * purchasing when using the UI (x1, x5, x10, MAX)\n */\nimport React from \"react\";\n\nimport { PurchaseMultipliers } from \"../data/Constants\";\n\ninterface IMultiplierProps {\n className: string;\n key: string;\n onClick: () => void;\n text: string;\n}\n\nfunction MultiplierButton(props: IMultiplierProps): React.ReactElement {\n return (\n \n );\n}\n\ninterface IProps {\n purchaseMultiplier: number | string;\n onClicks: (() => void)[];\n}\n\nexport function MultiplierButtons(props: IProps): React.ReactElement {\n if (props.purchaseMultiplier == null) {\n throw new Error(`MultiplierButtons constructed without required props`);\n }\n\n const mults = [\"x1\", \"x5\", \"x10\", \"MAX\"];\n const onClicks = props.onClicks;\n const buttons = [];\n for (let i = 0; i < mults.length; ++i) {\n const mult = mults[i];\n const btnProps = {\n className: props.purchaseMultiplier === PurchaseMultipliers[mult] ? \"std-button-disabled\" : \"std-button\",\n key: mult,\n onClick: onClicks[i],\n text: mult,\n };\n\n buttons.push();\n }\n\n return {buttons};\n}\n","/**\n * React Component for displaying Player info and stats on the Hacknet Node UI.\n * This includes:\n * - Player's money\n * - Player's production from Hacknet Nodes\n */\nimport React from \"react\";\n\nimport { hasHacknetServers } from \"../HacknetHelpers\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { Money } from \"../../ui/React/Money\";\nimport { MoneyRate } from \"../../ui/React/MoneyRate\";\nimport { HashRate } from \"../../ui/React/HashRate\";\nimport { Hashes } from \"../../ui/React/Hashes\";\n\ninterface IProps {\n totalProduction: number;\n player: IPlayer;\n}\n\nexport function PlayerInfo(props: IProps): React.ReactElement {\n const hasServers = hasHacknetServers(props.player);\n\n let prod;\n if (hasServers) {\n prod = HashRate(props.totalProduction);\n } else {\n prod = ;\n }\n\n return (\n

      \n Money: \n \n
      \n\n {hasServers && (\n <>\n \n Hashes: {Hashes(props.player.hashManager.hashes)} / {Hashes(props.player.hashManager.capacity)}\n \n
      \n \n )}\n\n Total Hacknet {hasServers ? \"Server\" : \"Node\"} Production: \n {prod}\n

      \n );\n}\n","/**\n * React Component for the button that is used to purchase new Hacknet Nodes\n */\nimport React from \"react\";\n\nimport { hasHacknetServers, hasMaxNumberHacknetServers } from \"../HacknetHelpers\";\nimport { Player } from \"../../Player\";\nimport { Money } from \"../../ui/React/Money\";\n\ninterface IProps {\n multiplier: number | string;\n onClick: () => void;\n cost: number;\n}\n\nexport function PurchaseButton(props: IProps): React.ReactElement {\n const cost = props.cost;\n let className = Player.canAfford(cost) ? \"std-button\" : \"std-button-disabled\";\n let text;\n let style = {};\n if (hasHacknetServers(Player)) {\n if (hasMaxNumberHacknetServers(Player)) {\n className = \"std-button-disabled\";\n text = <>Hacknet Server limit reached;\n style = { color: \"red\" };\n } else {\n text = (\n <>\n Purchase Hacknet Server - \n \n );\n }\n } else {\n text = (\n <>\n Purchase Hacknet Node - \n \n );\n }\n\n return (\n \n );\n}\n","/**\n * React Subcomponent for displaying a location's UI, when that location is a company\n *\n * This subcomponent renders all of the buttons for applying to jobs at a company\n */\nimport React, { useState } from \"react\";\n\nimport { ApplyToJobButton } from \"./ApplyToJobButton\";\n\nimport { Locations } from \"../Locations\";\nimport { LocationName } from \"../data/LocationNames\";\n\nimport { Companies } from \"../../Company/Companies\";\nimport { CompanyPosition } from \"../../Company/CompanyPosition\";\nimport { CompanyPositions } from \"../../Company/CompanyPositions\";\nimport * as posNames from \"../../Company/data/companypositionnames\";\n\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { Reputation } from \"../../ui/React/Reputation\";\nimport { Favor } from \"../../ui/React/Favor\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { use } from \"../../ui/Context\";\nimport { QuitJobPopup } from \"../../Company/ui/QuitJobPopup\";\n\ntype IProps = {\n locName: LocationName;\n};\n\nexport function CompanyLocation(props: IProps): React.ReactElement {\n const p = use.Player();\n const router = use.Router();\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n /**\n * We'll keep a reference to the Company that this component is being rendered for,\n * so we don't have to look it up every time\n */\n const company = Companies[props.locName];\n if (company == null) throw new Error(`CompanyLocation component constructed with invalid company: ${props.locName}`);\n\n /**\n * Reference to the Location that this component is being rendered for\n */\n const location = Locations[props.locName];\n if (location == null) {\n throw new Error(`CompanyLocation component constructed with invalid location: ${props.locName}`);\n }\n\n /**\n * Name of company position that player holds, if applicable\n */\n const jobTitle = p.jobs[props.locName] ? p.jobs[props.locName] : null;\n\n /**\n * CompanyPosition object for the job that the player holds at this company\n * (if he has one)\n */\n const companyPosition = jobTitle ? CompanyPositions[jobTitle] : null;\n\n p.location = props.locName;\n\n function applyForAgentJob(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n p.applyForAgentJob();\n rerender();\n }\n\n function applyForBusinessConsultantJob(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n p.applyForBusinessConsultantJob();\n rerender();\n }\n\n function applyForBusinessJob(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n p.applyForBusinessJob();\n rerender();\n }\n\n function applyForEmployeeJob(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n p.applyForEmployeeJob();\n rerender();\n }\n\n function applyForItJob(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n p.applyForItJob();\n rerender();\n }\n\n function applyForPartTimeEmployeeJob(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n p.applyForPartTimeEmployeeJob();\n rerender();\n }\n\n function applyForPartTimeWaiterJob(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n p.applyForPartTimeWaiterJob();\n rerender();\n }\n\n function applyForSecurityJob(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n p.applyForSecurityJob();\n rerender();\n }\n\n function applyForSoftwareConsultantJob(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n p.applyForSoftwareConsultantJob();\n rerender();\n }\n\n function applyForSoftwareJob(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n p.applyForSoftwareJob();\n rerender();\n }\n\n function applyForWaiterJob(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n p.applyForWaiterJob();\n rerender();\n }\n\n function startInfiltration(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n const loc = location;\n if (!loc.infiltrationData)\n throw new Error(`trying to start infiltration at ${props.locName} but the infiltrationData is null`);\n\n router.toInfiltration(loc);\n }\n\n function work(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n\n const pos = companyPosition;\n if (pos instanceof CompanyPosition) {\n if (pos.isPartTimeJob() || pos.isSoftwareConsultantJob() || pos.isBusinessConsultantJob()) {\n p.startWorkPartTime(router, props.locName);\n } else {\n p.startWork(router, props.locName);\n }\n router.toWork();\n }\n }\n\n function quit(e: React.MouseEvent): void {\n if (!e.isTrusted) return;\n const popupId = `quit-job-popup`;\n createPopup(popupId, QuitJobPopup, {\n locName: props.locName,\n company: company,\n player: p,\n onQuit: rerender,\n popupId: popupId,\n });\n }\n\n const isEmployedHere = jobTitle != null;\n const favorGain = company.getFavorGain();\n\n return (\n
      \n {isEmployedHere && (\n
      \n

      Job Title: {jobTitle}

      \n
      \n

      -------------------------

      \n
      \n

      \n Company reputation: {Reputation(company.playerReputation)}\n \n You will earn {Favor(favorGain[0])} company favor upon resetting after installing Augmentations\n \n

      \n
      \n
      \n

      -------------------------

      \n
      \n

      \n Company Favor: {Favor(company.favor)}\n \n Company favor increases the rate at which you earn reputation for this company by 1% per favor. Company\n favor is gained whenever you reset after installing Augmentations. The amount of favor you gain depends on\n how much reputation you have with the comapny.\n \n

      \n
      \n
      \n

      -------------------------

      \n
      \n \n     \n \n
      \n )}\n {company.hasAgentPositions() && (\n \n )}\n {company.hasBusinessConsultantPositions() && (\n \n )}\n {company.hasBusinessPositions() && (\n \n )}\n {company.hasEmployeePositions() && (\n \n )}\n {company.hasEmployeePositions() && (\n \n )}\n {company.hasITPositions() && (\n \n )}\n {company.hasSecurityPositions() && (\n \n )}\n {company.hasSoftwareConsultantPositions() && (\n \n )}\n {company.hasSoftwarePositions() && (\n \n )}\n {company.hasWaiterPositions() && (\n \n )}\n {company.hasWaiterPositions() && (\n \n )}\n {location.infiltrationData != null && (\n \n )}\n
      \n
      \n
      \n
      \n
      \n
      \n );\n}\n","// Metadata used for constructing Company Positions\nimport { IConstructorParams } from \"../CompanyPosition\";\nimport * as posNames from \"./companypositionnames\";\n\nexport const companyPositionMetadata: IConstructorParams[] = [\n {\n name: posNames.SoftwareCompanyPositions[0], // Software Enginering Intern\n nextPosition: posNames.SoftwareCompanyPositions[1], // Junior Software Engineer\n baseSalary: 33,\n charismaEffectiveness: 15,\n charismaExpGain: 0.02,\n hackingEffectiveness: 85,\n hackingExpGain: 0.05,\n reqdHacking: 1,\n repMultiplier: 0.9,\n },\n {\n name: posNames.SoftwareCompanyPositions[1], // Junior Software Engineer\n nextPosition: posNames.SoftwareCompanyPositions[2], // Senior Software Engineer\n baseSalary: 80,\n charismaEffectiveness: 15,\n charismaExpGain: 0.05,\n hackingEffectiveness: 85,\n hackingExpGain: 0.1,\n reqdHacking: 51,\n reqdReputation: 8e3,\n repMultiplier: 1.1,\n },\n {\n name: posNames.SoftwareCompanyPositions[2], // Senior Software Engineer\n nextPosition: posNames.SoftwareCompanyPositions[3], // Lead Software Developer\n baseSalary: 165,\n charismaEffectiveness: 20,\n charismaExpGain: 0.08,\n hackingEffectiveness: 80,\n hackingExpGain: 0.4,\n reqdCharisma: 51,\n reqdHacking: 251,\n reqdReputation: 40e3,\n repMultiplier: 1.3,\n },\n {\n name: posNames.SoftwareCompanyPositions[3], // Lead Software Developer\n nextPosition: posNames.SoftwareCompanyPositions[4], // Head of Software\n baseSalary: 500,\n charismaEffectiveness: 25,\n charismaExpGain: 0.1,\n hackingEffectiveness: 75,\n hackingExpGain: 0.8,\n reqdCharisma: 151,\n reqdHacking: 401,\n reqdReputation: 200e3,\n repMultiplier: 1.5,\n },\n {\n name: posNames.SoftwareCompanyPositions[4], // Head of Software\n nextPosition: posNames.SoftwareCompanyPositions[5], // Head of Engineering\n baseSalary: 800,\n charismaEffectiveness: 25,\n charismaExpGain: 0.5,\n hackingEffectiveness: 75,\n hackingExpGain: 1,\n reqdCharisma: 251,\n reqdHacking: 501,\n reqdReputation: 400e3,\n repMultiplier: 1.6,\n },\n {\n name: posNames.SoftwareCompanyPositions[5], // Head of Engineering\n nextPosition: posNames.SoftwareCompanyPositions[6], // Vice President of Technology\n baseSalary: 1650,\n charismaEffectiveness: 25,\n charismaExpGain: 0.5,\n hackingEffectiveness: 75,\n hackingExpGain: 1.1,\n reqdCharisma: 251,\n reqdHacking: 501,\n reqdReputation: 800e3,\n repMultiplier: 1.6,\n },\n {\n name: posNames.SoftwareCompanyPositions[6], // Vice President of Technology\n nextPosition: posNames.SoftwareCompanyPositions[7], // Chief Technology Officer\n baseSalary: 2310,\n charismaEffectiveness: 30,\n charismaExpGain: 0.6,\n hackingEffectiveness: 70,\n hackingExpGain: 1.2,\n reqdCharisma: 401,\n reqdHacking: 601,\n reqdReputation: 1.6e6,\n repMultiplier: 1.75,\n },\n {\n name: posNames.SoftwareCompanyPositions[7], // Chief Technology Officer\n nextPosition: null,\n baseSalary: 2640,\n charismaEffectiveness: 35,\n charismaExpGain: 1,\n hackingEffectiveness: 65,\n hackingExpGain: 1.5,\n reqdCharisma: 501,\n reqdHacking: 751,\n reqdReputation: 3.2e6,\n repMultiplier: 2,\n },\n {\n name: posNames.ITCompanyPositions[0], // IT Intern\n nextPosition: posNames.ITCompanyPositions[1], // IT Analyst\n baseSalary: 26,\n charismaEffectiveness: 10,\n charismaExpGain: 0.01,\n hackingEffectiveness: 90,\n hackingExpGain: 0.04,\n reqdHacking: 1,\n repMultiplier: 0.9,\n },\n {\n name: posNames.ITCompanyPositions[1], // IT Analyst\n nextPosition: posNames.ITCompanyPositions[2], // IT Manager\n baseSalary: 66,\n charismaEffectiveness: 15,\n charismaExpGain: 0.02,\n hackingEffectiveness: 85,\n hackingExpGain: 0.08,\n reqdHacking: 26,\n reqdReputation: 7e3,\n repMultiplier: 1.1,\n },\n {\n name: posNames.ITCompanyPositions[2], // IT Manager\n nextPosition: posNames.ITCompanyPositions[3], // Systems Administrator\n baseSalary: 132,\n charismaEffectiveness: 20,\n charismaExpGain: 0.1,\n hackingEffectiveness: 80,\n hackingExpGain: 0.3,\n reqdCharisma: 51,\n reqdHacking: 151,\n reqdReputation: 35e3,\n repMultiplier: 1.3,\n },\n {\n name: posNames.ITCompanyPositions[3], // Systems Administrator\n nextPosition: posNames.SoftwareCompanyPositions[5], // Head of Engineering\n baseSalary: 410,\n charismaEffectiveness: 20,\n charismaExpGain: 0.2,\n hackingEffectiveness: 80,\n hackingExpGain: 0.5,\n reqdCharisma: 76,\n reqdHacking: 251,\n reqdReputation: 175e3,\n repMultiplier: 1.4,\n },\n {\n name: posNames.SecurityEngineerCompanyPositions[0], // Security Engineer\n nextPosition: posNames.SoftwareCompanyPositions[5], // Head of Engineering\n baseSalary: 121,\n charismaEffectiveness: 15,\n charismaExpGain: 0.05,\n hackingEffectiveness: 85,\n hackingExpGain: 0.4,\n reqdCharisma: 26,\n reqdHacking: 151,\n reqdReputation: 35e3,\n repMultiplier: 1.2,\n },\n {\n name: posNames.NetworkEngineerCompanyPositions[0], // Network Engineer\n nextPosition: posNames.NetworkEngineerCompanyPositions[1], // Network Adminsitrator\n baseSalary: 121,\n charismaEffectiveness: 15,\n charismaExpGain: 0.05,\n hackingEffectiveness: 85,\n hackingExpGain: 0.4,\n reqdCharisma: 26,\n reqdHacking: 151,\n reqdReputation: 35e3,\n repMultiplier: 1.2,\n },\n {\n name: posNames.NetworkEngineerCompanyPositions[1], // Network Administrator\n nextPosition: posNames.SoftwareCompanyPositions[5], // Head of Engineering\n baseSalary: 410,\n charismaEffectiveness: 20,\n charismaExpGain: 0.1,\n hackingEffectiveness: 80,\n hackingExpGain: 0.5,\n reqdCharisma: 76,\n reqdHacking: 251,\n reqdReputation: 175e3,\n repMultiplier: 1.3,\n },\n {\n name: posNames.BusinessCompanyPositions[0], // Business Intern\n nextPosition: posNames.BusinessCompanyPositions[1], // Business Analyst\n baseSalary: 46,\n charismaEffectiveness: 90,\n charismaExpGain: 0.08,\n hackingEffectiveness: 10,\n hackingExpGain: 0.01,\n reqdCharisma: 1,\n reqdHacking: 1,\n repMultiplier: 0.9,\n },\n {\n name: posNames.BusinessCompanyPositions[1], // Business Analyst\n nextPosition: posNames.BusinessCompanyPositions[2], // Business Manager\n baseSalary: 100,\n charismaEffectiveness: 85,\n charismaExpGain: 0.15,\n hackingEffectiveness: 15,\n hackingExpGain: 0.02,\n reqdCharisma: 51,\n reqdHacking: 6,\n reqdReputation: 8e3,\n repMultiplier: 1.1,\n },\n {\n name: posNames.BusinessCompanyPositions[2], // Business Manager\n nextPosition: posNames.BusinessCompanyPositions[3], // Operations Manager\n baseSalary: 200,\n charismaEffectiveness: 85,\n charismaExpGain: 0.3,\n hackingEffectiveness: 15,\n hackingExpGain: 0.02,\n reqdCharisma: 101,\n reqdHacking: 51,\n reqdReputation: 40e3,\n repMultiplier: 1.3,\n },\n {\n name: posNames.BusinessCompanyPositions[3], // Operations Manager\n nextPosition: posNames.BusinessCompanyPositions[4], // Chief Financial Officer\n baseSalary: 660,\n charismaEffectiveness: 85,\n charismaExpGain: 0.4,\n hackingEffectiveness: 15,\n hackingExpGain: 0.02,\n reqdCharisma: 226,\n reqdHacking: 51,\n reqdReputation: 200e3,\n repMultiplier: 1.5,\n },\n {\n name: posNames.BusinessCompanyPositions[4], // Chief Financial Officer\n nextPosition: posNames.BusinessCompanyPositions[5], // Chief Executive Officer\n baseSalary: 1950,\n charismaEffectiveness: 90,\n charismaExpGain: 1,\n hackingEffectiveness: 10,\n hackingExpGain: 0.05,\n reqdCharisma: 501,\n reqdHacking: 76,\n reqdReputation: 800e3,\n repMultiplier: 1.6,\n },\n {\n name: posNames.BusinessCompanyPositions[5], // Chief Executive Officer\n nextPosition: null,\n baseSalary: 3900,\n charismaEffectiveness: 90,\n charismaExpGain: 1.5,\n hackingEffectiveness: 10,\n hackingExpGain: 0.05,\n reqdCharisma: 751,\n reqdHacking: 101,\n reqdReputation: 3.2e6,\n repMultiplier: 1.75,\n },\n {\n name: posNames.SecurityCompanyPositions[0], // Police Officer\n nextPosition: posNames.SecurityCompanyPositions[1], // Police Chief\n baseSalary: 82,\n hackingEffectiveness: 5,\n strengthEffectiveness: 20,\n defenseEffectiveness: 20,\n dexterityEffectiveness: 20,\n agilityEffectiveness: 20,\n charismaEffectiveness: 15,\n hackingExpGain: 0.02,\n strengthExpGain: 0.08,\n defenseExpGain: 0.08,\n dexterityExpGain: 0.08,\n agilityExpGain: 0.08,\n charismaExpGain: 0.04,\n reqdHacking: 11,\n reqdStrength: 101,\n reqdDefense: 101,\n reqdDexterity: 101,\n reqdAgility: 101,\n reqdCharisma: 51,\n reqdReputation: 8e3,\n repMultiplier: 1,\n },\n {\n name: posNames.SecurityCompanyPositions[1], // Police Chief\n nextPosition: null,\n baseSalary: 460,\n hackingEffectiveness: 5,\n strengthEffectiveness: 20,\n defenseEffectiveness: 20,\n dexterityEffectiveness: 20,\n agilityEffectiveness: 20,\n charismaEffectiveness: 15,\n hackingExpGain: 0.02,\n strengthExpGain: 0.1,\n defenseExpGain: 0.1,\n dexterityExpGain: 0.1,\n agilityExpGain: 0.1,\n charismaExpGain: 0.1,\n reqdHacking: 101,\n reqdStrength: 301,\n reqdDefense: 301,\n reqdDexterity: 301,\n reqdAgility: 301,\n reqdCharisma: 151,\n reqdReputation: 36e3,\n repMultiplier: 1.25,\n },\n {\n name: posNames.SecurityCompanyPositions[2], // Security Guard\n nextPosition: posNames.SecurityCompanyPositions[3], // Security Officer\n baseSalary: 50,\n hackingEffectiveness: 5,\n strengthEffectiveness: 20,\n defenseEffectiveness: 20,\n dexterityEffectiveness: 20,\n agilityEffectiveness: 20,\n charismaEffectiveness: 15,\n hackingExpGain: 0.01,\n strengthExpGain: 0.04,\n defenseExpGain: 0.04,\n dexterityExpGain: 0.04,\n agilityExpGain: 0.04,\n charismaExpGain: 0.02,\n reqdStrength: 51,\n reqdDefense: 51,\n reqdDexterity: 51,\n reqdAgility: 51,\n reqdCharisma: 1,\n repMultiplier: 1,\n },\n {\n name: posNames.SecurityCompanyPositions[3], // Security Officer\n nextPosition: posNames.SecurityCompanyPositions[4], // Security Supervisor\n baseSalary: 195,\n hackingEffectiveness: 10,\n strengthEffectiveness: 20,\n defenseEffectiveness: 20,\n dexterityEffectiveness: 20,\n agilityEffectiveness: 20,\n charismaEffectiveness: 10,\n hackingExpGain: 0.02,\n strengthExpGain: 0.1,\n defenseExpGain: 0.1,\n dexterityExpGain: 0.1,\n agilityExpGain: 0.1,\n charismaExpGain: 0.05,\n reqdHacking: 26,\n reqdStrength: 151,\n reqdDefense: 151,\n reqdDexterity: 151,\n reqdAgility: 151,\n reqdCharisma: 51,\n reqdReputation: 8e3,\n repMultiplier: 1.1,\n },\n {\n name: posNames.SecurityCompanyPositions[4], // Security Supervisor\n nextPosition: posNames.SecurityCompanyPositions[5], // Head of Security\n baseSalary: 660,\n hackingEffectiveness: 10,\n strengthEffectiveness: 15,\n defenseEffectiveness: 15,\n dexterityEffectiveness: 15,\n agilityEffectiveness: 15,\n charismaEffectiveness: 30,\n hackingExpGain: 0.02,\n strengthExpGain: 0.12,\n defenseExpGain: 0.12,\n dexterityExpGain: 0.12,\n agilityExpGain: 0.12,\n charismaExpGain: 0.1,\n reqdHacking: 26,\n reqdStrength: 251,\n reqdDefense: 251,\n reqdDexterity: 251,\n reqdAgility: 251,\n reqdCharisma: 101,\n reqdReputation: 36e3,\n repMultiplier: 1.25,\n },\n {\n name: posNames.SecurityCompanyPositions[5], // Head of Security\n nextPosition: null,\n baseSalary: 1320,\n hackingEffectiveness: 10,\n strengthEffectiveness: 15,\n defenseEffectiveness: 15,\n dexterityEffectiveness: 15,\n agilityEffectiveness: 15,\n charismaEffectiveness: 30,\n hackingExpGain: 0.05,\n strengthExpGain: 0.15,\n defenseExpGain: 0.15,\n dexterityExpGain: 0.15,\n agilityExpGain: 0.15,\n charismaExpGain: 0.15,\n reqdHacking: 51,\n reqdStrength: 501,\n reqdDefense: 501,\n reqdDexterity: 501,\n reqdAgility: 501,\n reqdCharisma: 151,\n reqdReputation: 144e3,\n repMultiplier: 1.4,\n },\n {\n name: posNames.AgentCompanyPositions[0], // Field Agent\n nextPosition: posNames.AgentCompanyPositions[1], // Secret Agent\n baseSalary: 330,\n hackingEffectiveness: 10,\n strengthEffectiveness: 15,\n defenseEffectiveness: 15,\n dexterityEffectiveness: 20,\n agilityEffectiveness: 20,\n charismaEffectiveness: 20,\n hackingExpGain: 0.04,\n strengthExpGain: 0.08,\n defenseExpGain: 0.08,\n dexterityExpGain: 0.08,\n agilityExpGain: 0.08,\n charismaExpGain: 0.05,\n reqdHacking: 101,\n reqdStrength: 101,\n reqdDefense: 101,\n reqdDexterity: 101,\n reqdAgility: 101,\n reqdCharisma: 101,\n reqdReputation: 8e3,\n repMultiplier: 1,\n },\n {\n name: posNames.AgentCompanyPositions[1], // Secret Agent\n nextPosition: posNames.AgentCompanyPositions[2], // Special Operative\n baseSalary: 990,\n hackingEffectiveness: 15,\n strengthEffectiveness: 15,\n defenseEffectiveness: 15,\n dexterityEffectiveness: 20,\n agilityEffectiveness: 20,\n charismaEffectiveness: 15,\n hackingExpGain: 0.1,\n strengthExpGain: 0.15,\n defenseExpGain: 0.15,\n dexterityExpGain: 0.15,\n agilityExpGain: 0.15,\n charismaExpGain: 0.1,\n reqdHacking: 201,\n reqdStrength: 251,\n reqdDefense: 251,\n reqdDexterity: 251,\n reqdAgility: 251,\n reqdCharisma: 201,\n reqdReputation: 32e3,\n repMultiplier: 1.25,\n },\n {\n name: posNames.AgentCompanyPositions[2], // Special Operative\n nextPosition: null,\n baseSalary: 2000,\n hackingEffectiveness: 15,\n strengthEffectiveness: 15,\n defenseEffectiveness: 15,\n dexterityEffectiveness: 20,\n agilityEffectiveness: 20,\n charismaEffectiveness: 15,\n hackingExpGain: 0.15,\n strengthExpGain: 0.2,\n defenseExpGain: 0.2,\n dexterityExpGain: 0.2,\n agilityExpGain: 0.2,\n charismaExpGain: 0.15,\n reqdHacking: 251,\n reqdStrength: 501,\n reqdDefense: 501,\n reqdDexterity: 501,\n reqdAgility: 501,\n reqdCharisma: 251,\n reqdReputation: 162e3,\n repMultiplier: 1.5,\n },\n {\n name: posNames.MiscCompanyPositions[0], // Waiter\n nextPosition: null,\n baseSalary: 22,\n strengthEffectiveness: 10,\n dexterityEffectiveness: 10,\n agilityEffectiveness: 10,\n charismaEffectiveness: 70,\n strengthExpGain: 0.02,\n defenseExpGain: 0.02,\n dexterityExpGain: 0.02,\n agilityExpGain: 0.02,\n charismaExpGain: 0.05,\n repMultiplier: 1,\n },\n {\n name: posNames.MiscCompanyPositions[1], // Employee\n nextPosition: null,\n baseSalary: 22,\n strengthEffectiveness: 10,\n dexterityEffectiveness: 10,\n agilityEffectiveness: 10,\n charismaEffectiveness: 70,\n strengthExpGain: 0.02,\n defenseExpGain: 0.02,\n dexterityExpGain: 0.02,\n agilityExpGain: 0.02,\n charismaExpGain: 0.04,\n repMultiplier: 1,\n },\n {\n name: posNames.SoftwareConsultantCompanyPositions[0], // Software Consultant\n nextPosition: posNames.SoftwareConsultantCompanyPositions[1], // Senior Software Consultant\n baseSalary: 66,\n hackingEffectiveness: 80,\n charismaEffectiveness: 20,\n hackingExpGain: 0.08,\n charismaExpGain: 0.03,\n reqdHacking: 51,\n repMultiplier: 1,\n },\n {\n name: posNames.SoftwareConsultantCompanyPositions[1], // Senior Software Consultant\n nextPosition: null,\n baseSalary: 132,\n hackingEffectiveness: 75,\n charismaEffectiveness: 25,\n hackingExpGain: 0.25,\n charismaExpGain: 0.06,\n reqdHacking: 251,\n reqdCharisma: 51,\n repMultiplier: 1.2,\n },\n {\n name: posNames.BusinessConsultantCompanyPositions[0], // Business Consultant\n nextPosition: posNames.BusinessConsultantCompanyPositions[1], // Senior Business Consultant\n baseSalary: 66,\n hackingEffectiveness: 20,\n charismaEffectiveness: 80,\n hackingExpGain: 0.015,\n charismaExpGain: 0.15,\n reqdHacking: 6,\n reqdCharisma: 51,\n repMultiplier: 1,\n },\n {\n name: posNames.BusinessConsultantCompanyPositions[1], // Senior Business Consultant\n nextPosition: null,\n baseSalary: 525,\n hackingEffectiveness: 15,\n charismaEffectiveness: 85,\n hackingExpGain: 0.015,\n charismaExpGain: 0.3,\n reqdHacking: 51,\n reqdCharisma: 226,\n repMultiplier: 1.2,\n },\n {\n name: posNames.PartTimeCompanyPositions[0], // Part-time waiter\n nextPosition: null,\n baseSalary: 20,\n strengthEffectiveness: 10,\n dexterityEffectiveness: 10,\n agilityEffectiveness: 10,\n charismaEffectiveness: 70,\n strengthExpGain: 0.0075,\n defenseExpGain: 0.0075,\n dexterityExpGain: 0.0075,\n agilityExpGain: 0.0075,\n charismaExpGain: 0.04,\n repMultiplier: 1,\n },\n {\n name: posNames.PartTimeCompanyPositions[1], // Part-time employee\n nextPosition: null,\n baseSalary: 20,\n strengthEffectiveness: 10,\n dexterityEffectiveness: 10,\n agilityEffectiveness: 10,\n charismaEffectiveness: 70,\n strengthExpGain: 0.0075,\n defenseExpGain: 0.0075,\n dexterityExpGain: 0.0075,\n agilityExpGain: 0.0075,\n charismaExpGain: 0.03,\n repMultiplier: 1,\n },\n];\n","import React from \"react\";\nimport { Company } from \"../Company\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { removePopup } from \"../../ui/React/createPopup\";\n\ninterface IProps {\n locName: string;\n company: Company;\n player: IPlayer;\n onQuit: () => void;\n popupId: string;\n}\n\nexport function QuitJobPopup(props: IProps): React.ReactElement {\n function quit(): void {\n props.player.quitJob(props.locName);\n props.onQuit();\n removePopup(props.popupId);\n }\n\n return (\n <>\n Would you like to quit your job at {props.company.name}?\n
      \n
      \n \n \n );\n}\n","/**\n * React Subcomponent for displaying a location's UI, when that location is a gym\n *\n * This subcomponent renders all of the buttons for training at the gym\n */\nimport * as React from \"react\";\n\nimport { Location } from \"../Location\";\n\nimport { CONSTANTS } from \"../../Constants\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { getServer } from \"../../Server/ServerHelpers\";\nimport { Server } from \"../../Server/Server\";\nimport { SpecialServerIps } from \"../../Server/SpecialServerIps\";\n\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { Money } from \"../../ui/React/Money\";\nimport { IRouter } from \"../../ui/Router\";\n\ntype IProps = {\n loc: Location;\n p: IPlayer;\n router: IRouter;\n};\n\nexport class GymLocation extends React.Component {\n /**\n * Stores button styling that sets them all to block display\n */\n btnStyle: any;\n\n constructor(props: IProps) {\n super(props);\n\n this.btnStyle = { display: \"block\" };\n\n this.trainStrength = this.trainStrength.bind(this);\n this.trainDefense = this.trainDefense.bind(this);\n this.trainDexterity = this.trainDexterity.bind(this);\n this.trainAgility = this.trainAgility.bind(this);\n\n this.calculateCost = this.calculateCost.bind(this);\n }\n\n calculateCost(): number {\n const ip = SpecialServerIps.getIp(this.props.loc.name);\n const server = getServer(ip);\n if (server == null || !server.hasOwnProperty(\"backdoorInstalled\")) return this.props.loc.costMult;\n const discount = (server as Server).backdoorInstalled ? 0.9 : 1;\n return this.props.loc.costMult * discount;\n }\n\n train(stat: string): void {\n const loc = this.props.loc;\n this.props.p.startClass(this.props.router, this.calculateCost(), loc.expMult, stat);\n }\n\n trainStrength(): void {\n this.train(CONSTANTS.ClassGymStrength);\n }\n\n trainDefense(): void {\n this.train(CONSTANTS.ClassGymDefense);\n }\n\n trainDexterity(): void {\n this.train(CONSTANTS.ClassGymDexterity);\n }\n\n trainAgility(): void {\n this.train(CONSTANTS.ClassGymAgility);\n }\n\n render(): React.ReactNode {\n const cost = CONSTANTS.ClassGymBaseCost * this.calculateCost();\n\n return (\n
      \n \n Train Strength ( / sec)\n \n }\n />\n \n Train Defense ( / sec)\n \n }\n />\n \n Train Dexterity ( / sec)\n \n }\n />\n \n Train Agility ( / sec)\n \n }\n />\n
      \n );\n }\n}\n","/**\n * React Subcomponent for displaying a location's UI, when that location is a hospital\n *\n * This subcomponent renders all of the buttons for hospital options\n */\nimport * as React from \"react\";\n\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { getHospitalizationCost } from \"../../Hospital/Hospital\";\n\nimport { AutoupdatingStdButton } from \"../../ui/React/AutoupdatingStdButton\";\nimport { Money } from \"../../ui/React/Money\";\n\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\n\ntype IProps = {\n p: IPlayer;\n};\n\ntype IState = {\n currHp: number;\n};\n\nexport class HospitalLocation extends React.Component {\n /**\n * Stores button styling that sets them all to block display\n */\n btnStyle: any;\n\n constructor(props: IProps) {\n super(props);\n\n this.btnStyle = { display: \"block\" };\n\n this.getCost = this.getCost.bind(this);\n this.getHealed = this.getHealed.bind(this);\n\n this.state = {\n currHp: this.props.p.hp,\n };\n }\n\n getCost(): number {\n return getHospitalizationCost(this.props.p);\n }\n\n getHealed(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n\n if (this.props.p.hp < 0) {\n this.props.p.hp = 0;\n }\n if (this.props.p.hp >= this.props.p.max_hp) {\n return;\n }\n\n const cost = this.getCost();\n this.props.p.loseMoney(cost);\n this.props.p.hp = this.props.p.max_hp;\n this.props.p.recordMoneySource(-1 * cost, \"hospitalization\");\n\n // This just forces a re-render to update the cost\n this.setState({\n currHp: this.props.p.hp,\n });\n\n dialogBoxCreate(\n <>\n You were healed to full health! The hospital billed you for \n ,\n );\n }\n\n render(): React.ReactNode {\n const cost = this.getCost();\n\n return (\n \n Get treatment for wounds - \n \n }\n />\n );\n }\n}\n","/**\n * React Subcomponent for displaying a location's UI, when that location is a slum\n *\n * This subcomponent renders all of the buttons for committing crimes\n */\nimport * as React from \"react\";\n\nimport { Crimes } from \"../../Crime/Crimes\";\n\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { AutoupdatingStdButton } from \"../../ui/React/AutoupdatingStdButton\";\nimport { use } from \"../../ui/Context\";\n\nexport function SlumsLocation(): React.ReactElement {\n const player = use.Player();\n const router = use.Router();\n function shoplift(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.Shoplift.commit(router, player);\n }\n\n function robStore(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.RobStore.commit(router, player);\n }\n\n function mug(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.Mug.commit(router, player);\n }\n\n function larceny(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.Larceny.commit(router, player);\n }\n\n function dealDrugs(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.DealDrugs.commit(router, player);\n }\n\n function bondForgery(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.BondForgery.commit(router, player);\n }\n\n function traffickArms(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.TraffickArms.commit(router, player);\n }\n\n function homicide(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.Homicide.commit(router, player);\n }\n\n function grandTheftAuto(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.GrandTheftAuto.commit(router, player);\n }\n\n function kidnap(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.Kidnap.commit(router, player);\n }\n\n function assassinate(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.Assassination.commit(router, player);\n }\n\n function heist(e: React.MouseEvent): void {\n if (!e.isTrusted) {\n return;\n }\n Crimes.Heist.commit(router, player);\n }\n\n const shopliftChance = Crimes.Shoplift.successRate(player);\n const robStoreChance = Crimes.RobStore.successRate(player);\n const mugChance = Crimes.Mug.successRate(player);\n const larcenyChance = Crimes.Larceny.successRate(player);\n const drugsChance = Crimes.DealDrugs.successRate(player);\n const bondChance = Crimes.BondForgery.successRate(player);\n const armsChance = Crimes.TraffickArms.successRate(player);\n const homicideChance = Crimes.Homicide.successRate(player);\n const gtaChance = Crimes.GrandTheftAuto.successRate(player);\n const kidnapChance = Crimes.Kidnap.successRate(player);\n const assassinateChance = Crimes.Assassination.successRate(player);\n const heistChance = Crimes.Heist.successRate(player);\n\n return (\n
      \n \n \n \n \n \n \n \n \n \n \n \n \n
      \n );\n}\n","/**\n * React Subcomponent for displaying a location's UI, when that location has special\n * actions/options/properties\n *\n * Examples:\n * - Bladeburner @ NSA\n * - Re-sleeving @ VitaLife\n * - Create Corporation @ City Hall\n *\n * This subcomponent creates all of the buttons for interacting with those special\n * properties\n */\nimport React, { useState } from \"react\";\n\nimport { Location } from \"../Location\";\nimport { CreateCorporationPopup } from \"../../Corporation/ui/CreateCorporationPopup\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { LocationName } from \"../data/LocationNames\";\n\nimport { use } from \"../../ui/Context\";\n\nimport { AutoupdatingStdButton } from \"../../ui/React/AutoupdatingStdButton\";\nimport { StdButton } from \"../../ui/React/StdButton\";\n\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\n\ntype IProps = {\n loc: Location;\n};\n\nexport function SpecialLocation(props: IProps): React.ReactElement {\n const player = use.Player();\n const router = use.Router();\n const setRerender = useState(false)[1];\n const inBladeburner = player.inBladeburner();\n /**\n * Click handler for \"Create Corporation\" button at Sector-12 City Hall\n */\n function createCorporationPopup(): void {\n const popupId = `create-start-corporation-popup`;\n createPopup(popupId, CreateCorporationPopup, {\n player: player,\n popupId: popupId,\n router: router,\n });\n }\n\n /**\n * Click handler for Bladeburner button at Sector-12 NSA\n */\n function handleBladeburner(): void {\n const p = player;\n if (p.inBladeburner()) {\n // Enter Bladeburner division\n router.toBladeburner();\n } else {\n // Apply for Bladeburner division\n if (p.strength >= 100 && p.defense >= 100 && p.dexterity >= 100 && p.agility >= 100) {\n p.startBladeburner({ new: true });\n dialogBoxCreate(\"You have been accepted into the Bladeburner division!\");\n setRerender((old) => !old);\n\n const worldHeader = document.getElementById(\"world-menu-header\");\n if (worldHeader instanceof HTMLElement) {\n worldHeader.click();\n worldHeader.click();\n }\n } else {\n dialogBoxCreate(\"Rejected! Please apply again when you have 100 of each combat stat (str, def, dex, agi)\");\n }\n }\n }\n\n /**\n * Click handler for Resleeving button at New Tokyo VitaLife\n */\n function handleResleeving(): void {\n router.toResleeves();\n }\n\n function renderBladeburner(): React.ReactElement {\n if (!player.canAccessBladeburner()) {\n return <>;\n }\n const text = inBladeburner ? \"Enter Bladeburner Headquarters\" : \"Apply to Bladeburner Division\";\n return ;\n }\n\n function renderNoodleBar(): React.ReactElement {\n function EatNoodles(): void {\n dialogBoxCreate(<>You ate some delicious noodles and feel refreshed.);\n }\n\n return ;\n }\n\n function renderCreateCorporation(): React.ReactElement {\n if (!player.canAccessCorporation()) {\n return (\n <>\n

      \n A business man is yelling at a clerk. You should come back later.\n

      \n \n );\n }\n return (\n \n );\n }\n\n function renderResleeving(): React.ReactElement {\n if (!player.canAccessResleeving()) {\n return <>;\n }\n return ;\n }\n\n switch (props.loc.name) {\n case LocationName.NewTokyoVitaLife: {\n return renderResleeving();\n }\n case LocationName.Sector12CityHall: {\n return renderCreateCorporation();\n }\n case LocationName.Sector12NSA: {\n return renderBladeburner();\n }\n case LocationName.NewTokyoNoodleBar: {\n return renderNoodleBar();\n }\n default:\n console.error(`Location ${props.loc.name} doesn't have any special properties`);\n return <>;\n }\n}\n","import React, { useState } from \"react\";\n\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { Money } from \"../../ui/React/Money\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { IRouter } from \"../../ui/Router\";\n\ninterface IProps {\n player: IPlayer;\n popupId: string;\n router: IRouter;\n}\n\nexport function CreateCorporationPopup(props: IProps): React.ReactElement {\n if (!props.player.canAccessCorporation() || props.player.hasCorporation()) {\n removePopup(props.popupId);\n return <>;\n }\n\n const [name, setName] = useState(\"\");\n function onChange(event: React.ChangeEvent): void {\n setName(event.target.value);\n }\n\n function selfFund(): void {\n if (!props.player.canAfford(150e9)) {\n dialogBoxCreate(\"You don't have enough money to create a corporation! You need $150b.\");\n return;\n }\n\n if (name == \"\") {\n dialogBoxCreate(\"Invalid company name!\");\n return;\n }\n\n props.player.startCorporation(name);\n props.player.loseMoney(150e9);\n\n dialogBoxCreate(\n \"Congratulations! You just self-funded your own corporation. You can visit \" +\n \"and manage your company in the City.\",\n );\n removePopup(props.popupId);\n props.router.toCorporation();\n }\n\n function seed(): void {\n if (name == \"\") {\n dialogBoxCreate(\"Invalid company name!\");\n return;\n }\n\n props.player.startCorporation(name, 500e6);\n\n dialogBoxCreate(\n \"Congratulations! You just started your own corporation with government seed money. \" +\n \"You can visit and manage your company in the City.\",\n );\n removePopup(props.popupId);\n props.router.toCorporation();\n }\n\n return (\n <>\n

      \n Would you like to start a corporation? This will require $150b for registration and initial funding. This $150b\n can either be self-funded, or you can obtain the seed money from the government in exchange for 500 million\n shares\n
      \n
      \n If you would like to start one, please enter a name for your corporation below:\n

      \n \n \n \n \n );\n}\n","/**\n * React Subcomponent for displaying a location's UI, when that location is a tech vendor\n *\n * This subcomponent renders all of the buttons for purchasing things from tech vendors\n */\nimport React, { useState, useEffect } from \"react\";\n\nimport { Location } from \"../Location\";\nimport { RamButton } from \"./RamButton\";\nimport { TorButton } from \"./TorButton\";\nimport { CoresButton } from \"./CoresButton\";\n\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { getPurchaseServerCost } from \"../../Server/ServerPurchases\";\n\n\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { Money } from \"../../ui/React/Money\";\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { PurchaseServerPopup } from \"./PurchaseServerPopup\";\n\n\ntype IProps = {\n loc: Location;\n p: IPlayer;\n};\n\nexport function TechVendorLocation(props: IProps): React.ReactElement {\n \n\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n function openPurchaseServer(ram: number, cost: number, p: IPlayer): void {\n const popupId = \"purchase-server-popup\";\n createPopup(popupId, PurchaseServerPopup, {\n ram: ram,\n cost: cost,\n p: p,\n popupId: popupId,\n rerender: rerender\n });\n }\n\n useEffect(() => {\n const id = setInterval(rerender, 1000);\n return () => clearInterval(id);\n }, []);\n const btnStyle = { display: \"block\" };\n\n const purchaseServerButtons: React.ReactNode[] = [];\n for (let i = props.loc.techVendorMinRam; i <= props.loc.techVendorMaxRam; i *= 2) {\n const cost = getPurchaseServerCost(i);\n purchaseServerButtons.push(\n openPurchaseServer(i, cost, props.p)}\n style={btnStyle}\n text={\n <>\n Purchase {i}GB Server - \n \n }\n disabled={!props.p.canAfford(cost)}\n />,\n );\n }\n\n return (\n
      \n {purchaseServerButtons}\n
      \n

      \n \"You can order bigger servers via scripts. We don't take custom order in person.\"\n

      \n
      \n \n \n \n
      \n );\n}\n","import React from \"react\";\n\nimport { CONSTANTS } from \"../../Constants\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { purchaseRamForHomeComputer } from \"../../Server/ServerPurchases\";\n\nimport { StdButtonPurchased } from \"../../ui/React/StdButtonPurchased\";\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { Money } from \"../../ui/React/Money\";\nimport { MathComponent } from \"mathjax-react\";\n\ntype IProps = {\n p: IPlayer;\n rerender: () => void;\n};\n\nexport function RamButton(props: IProps): React.ReactElement {\n const btnStyle = { display: \"block\" };\n\n const homeComputer = props.p.getHomeComputer();\n if (homeComputer.maxRam >= CONSTANTS.HomeComputerMaxRam) {\n return ;\n }\n\n const cost = props.p.getUpgradeHomeRamCost();\n\n function buy(): void {\n purchaseRamForHomeComputer(props.p);\n props.rerender();\n }\n\n return (\n \n Upgrade 'home' RAM ({homeComputer.maxRam}GB -> {homeComputer.maxRam * 2}GB) -{\" \"}\n \n \n }\n tooltip={}\n />\n );\n}\n","/**\n * Determines if the number is a power of 2\n * @param n The number to check.\n */\nexport function isPowerOfTwo(n: number): boolean {\n if (isNaN(n)) {\n return false;\n }\n\n if (n === 0) {\n return false;\n }\n\n // Disabiling the bitwise rule because it's honestly the most effecient way to check for this.\n // tslint:disable-next-line:no-bitwise\n return (n & (n - 1)) === 0;\n}\n","import React from \"react\";\n\nimport { purchaseTorRouter } from \"../LocationsHelpers\";\n\nimport { CONSTANTS } from \"../../Constants\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nimport { StdButtonPurchased } from \"../../ui/React/StdButtonPurchased\";\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { Money } from \"../../ui/React/Money\";\n\ntype IProps = {\n p: IPlayer;\n rerender: () => void;\n};\n\nexport function TorButton(props: IProps): React.ReactElement {\n const btnStyle = { display: \"block\" };\n\n function buy(): void {\n purchaseTorRouter(props.p);\n props.rerender();\n }\n\n if (props.p.hasTorRouter()) {\n return ;\n }\n\n return (\n \n Purchase TOR router - \n \n }\n />\n );\n}\n","/**\n * Location and traveling-related helper functions.\n * Mostly used for UI\n */\nimport { CONSTANTS } from \"../Constants\";\n\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { AddToAllServers, createUniqueRandomIp } from \"../Server/AllServers\";\nimport { safetlyCreateUniqueServer } from \"../Server/ServerHelpers\";\nimport { SpecialServerIps } from \"../Server/SpecialServerIps\";\n\nimport { dialogBoxCreate } from \"../../utils/DialogBox\";\n\n/**\n * Attempt to purchase a TOR router\n * @param {IPlayer} p - Player object\n */\nexport function purchaseTorRouter(p: IPlayer): void {\n if (p.hasTorRouter()) {\n dialogBoxCreate(`You already have a TOR Router!`);\n return;\n }\n if (!p.canAfford(CONSTANTS.TorRouterCost)) {\n dialogBoxCreate(\"You cannot afford to purchase the TOR router!\");\n return;\n }\n p.loseMoney(CONSTANTS.TorRouterCost);\n\n const darkweb = safetlyCreateUniqueServer({\n ip: createUniqueRandomIp(),\n hostname: \"darkweb\",\n organizationName: \"\",\n isConnectedTo: false,\n adminRights: false,\n purchasedByPlayer: false,\n maxRam: 1,\n });\n AddToAllServers(darkweb);\n SpecialServerIps.addIp(\"Darkweb Server\", darkweb.ip);\n\n p.getHomeComputer().serversOnNetwork.push(darkweb.ip);\n darkweb.serversOnNetwork.push(p.getHomeComputer().ip);\n dialogBoxCreate(\n \"You have purchased a TOR router!
      \" +\n \"You now have access to the dark web from your home computer.
      \" +\n \"Use the scan/scan-analyze commands to search for the dark web connection.\",\n );\n}\n","import React from \"react\";\n\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\n\nimport { StdButtonPurchased } from \"../../ui/React/StdButtonPurchased\";\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { Money } from \"../../ui/React/Money\";\nimport { MathComponent } from \"mathjax-react\";\n\ntype IProps = {\n p: IPlayer;\n rerender: () => void;\n};\n\nexport function CoresButton(props: IProps): React.ReactElement {\n const btnStyle = { display: \"block\" };\n\n const homeComputer = props.p.getHomeComputer();\n const maxCores = homeComputer.cpuCores >= 8;\n if (maxCores) {\n return ;\n }\n\n const cost = 1e9 * Math.pow(7.5, homeComputer.cpuCores);\n\n function buy(): void {\n if (maxCores) return;\n if (!props.p.canAfford(cost)) return;\n props.p.loseMoney(cost);\n homeComputer.cpuCores++;\n props.rerender();\n }\n\n return (\n \n Upgrade 'home' cores ({homeComputer.cpuCores} -> {homeComputer.cpuCores + 1}) -{\" \"}\n \n \n }\n tooltip={}\n />\n );\n}\n","/**\n * React Component for the popup used to purchase a new server.\n */\nimport React, { useState } from \"react\";\nimport { removePopup } from \"../../ui/React/createPopup\";\nimport { purchaseServer } from \"../../Server/ServerPurchases\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { Money } from \"../../ui/React/Money\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { StdButton } from \"../../ui/React/StdButton\";\n\ninterface IPurchaseServerPopupProps {\n ram: number;\n cost: number;\n p: IPlayer;\n popupId: string;\n rerender: () => void;\n}\n\nexport function PurchaseServerPopup(props: IPurchaseServerPopupProps): React.ReactElement {\n const [hostname, setHostname] = useState(\"\");\n\n function tryToPurchaseServer(): void {\n purchaseServer(hostname, props.ram, props.cost, props.p);\n\n removePopup(props.popupId);\n }\n\n function onKeyUp(event: React.KeyboardEvent): void {\n if (event.keyCode === 13) tryToPurchaseServer();\n }\n\n function onChange(event: React.ChangeEvent): void {\n setHostname(event.target.value);\n }\n\n return (\n <>\n Would you like to purchase a new server with {numeralWrapper.formatRAM(props.ram)} of RAM for{\" \"}\n ?\n
      \n
      \n Please enter the server hostname below:\n
      \n
      \n \n \n
      \n \n );\n}\n","import React from \"react\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { CONSTANTS } from \"../../Constants\";\nimport { Money } from \"../../ui/React/Money\";\nimport { removePopup } from \"../../ui/React/createPopup\";\n\ninterface IProps {\n player: IPlayer;\n city: string;\n travel: () => void;\n popupId: string;\n}\n\nexport function TravelConfirmationPopup(props: IProps): React.ReactElement {\n const cost = CONSTANTS.TravelCost;\n function travel(): void {\n props.travel();\n removePopup(props.popupId);\n }\n\n return (\n <>\n \n Would you like to travel to {props.city}? The trip will cost .\n \n
      \n
      \n \n \n );\n}\n","/**\n * React Subcomponent for displaying a location's UI, when that location is a university\n *\n * This subcomponent renders all of the buttons for studying/taking courses\n */\nimport * as React from \"react\";\n\nimport { Location } from \"../Location\";\n\nimport { CONSTANTS } from \"../../Constants\";\nimport { getServer } from \"../../Server/ServerHelpers\";\nimport { Server } from \"../../Server/Server\";\nimport { SpecialServerIps } from \"../../Server/SpecialServerIps\";\n\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { Money } from \"../../ui/React/Money\";\nimport { use } from \"../../ui/Context\";\n\ntype IProps = {\n loc: Location;\n};\n\nexport function UniversityLocation(props: IProps): React.ReactElement {\n const player = use.Player();\n const router = use.Router();\n\n function calculateCost(): number {\n const ip = SpecialServerIps.getIp(props.loc.name);\n const server = getServer(ip);\n if (server == null || !server.hasOwnProperty(\"backdoorInstalled\")) return props.loc.costMult;\n const discount = (server as Server).backdoorInstalled ? 0.9 : 1;\n return props.loc.costMult * discount;\n }\n\n function take(stat: string): void {\n const loc = props.loc;\n player.startClass(router, calculateCost(), loc.expMult, stat);\n }\n\n function study(): void {\n take(CONSTANTS.ClassStudyComputerScience);\n }\n\n function dataStructures(): void {\n take(CONSTANTS.ClassDataStructures);\n }\n\n function networks(): void {\n take(CONSTANTS.ClassNetworks);\n }\n\n function algorithms(): void {\n take(CONSTANTS.ClassAlgorithms);\n }\n\n function management(): void {\n take(CONSTANTS.ClassManagement);\n }\n\n function leadership(): void {\n take(CONSTANTS.ClassLeadership);\n }\n\n const costMult: number = calculateCost();\n\n const dataStructuresCost = CONSTANTS.ClassDataStructuresBaseCost * costMult;\n const networksCost = CONSTANTS.ClassNetworksBaseCost * costMult;\n const algorithmsCost = CONSTANTS.ClassAlgorithmsBaseCost * costMult;\n const managementCost = CONSTANTS.ClassManagementBaseCost * costMult;\n const leadershipCost = CONSTANTS.ClassLeadershipBaseCost * costMult;\n\n const earnHackingExpTooltip = `Gain hacking experience!`;\n const earnCharismaExpTooltip = `Gain charisma experience!`;\n\n return (\n
      \n \n \n Take Data Structures course (\n / sec)\n \n }\n tooltip={earnHackingExpTooltip}\n />\n \n Take Networks course (\n / sec)\n \n }\n tooltip={earnHackingExpTooltip}\n />\n \n Take Algorithms course (\n / sec)\n \n }\n tooltip={earnHackingExpTooltip}\n />\n \n Take Management course (\n / sec)\n \n }\n tooltip={earnCharismaExpTooltip}\n />\n \n Take Leadership course (\n / sec)\n \n }\n tooltip={earnCharismaExpTooltip}\n />\n
      \n );\n}\n","/**\n * React Subcomponent for displaying a location's UI, when that location is a gym\n *\n * This subcomponent renders all of the buttons for training at the gym\n */\nimport * as React from \"react\";\nimport { Blackjack } from \"../../Casino/Blackjack\";\nimport { CoinFlip } from \"../../Casino/CoinFlip\";\nimport { Roulette } from \"../../Casino/Roulette\";\nimport { SlotMachine } from \"../../Casino/SlotMachine\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { StdButton } from \"../../ui/React/StdButton\";\n\nenum GameType {\n None = \"none\",\n Coin = \"coin\",\n Slots = \"slots\",\n Roulette = \"roulette\",\n Blackjack = \"blackjack\",\n}\n\ntype IProps = {\n p: IPlayer;\n};\n\ntype IState = {\n game: GameType;\n};\n\nexport class CasinoLocation extends React.Component {\n constructor(props: IProps) {\n super(props);\n\n this.state = {\n game: GameType.None,\n };\n\n this.updateGame = this.updateGame.bind(this);\n }\n\n updateGame(game: GameType): void {\n this.setState({\n game,\n });\n }\n\n renderGames(): React.ReactNode {\n return (\n <>\n this.updateGame(GameType.Coin)} text={\"Play coin flip\"} />\n
      \n this.updateGame(GameType.Slots)} text={\"Play slots\"} />\n
      \n this.updateGame(GameType.Roulette)} text={\"Play roulette\"} />\n
      \n this.updateGame(GameType.Blackjack)} text={\"Play blackjack\"} />\n \n );\n }\n\n renderGame(): React.ReactNode {\n let elem = null;\n switch (this.state.game) {\n case GameType.Coin:\n elem = ;\n break;\n case GameType.Slots:\n elem = ;\n break;\n case GameType.Roulette:\n elem = ;\n break;\n case GameType.Blackjack:\n elem = ;\n break;\n case GameType.None:\n break;\n default:\n throw new Error(`MissingCaseException: ${this.state.game}`);\n }\n\n return (\n <>\n this.updateGame(GameType.None)} text={\"Stop playing\"} />\n {elem}\n \n );\n }\n\n render(): React.ReactNode {\n if (this.state.game === GameType.None) {\n return this.renderGames();\n } else {\n return this.renderGame();\n }\n }\n}\n","import * as React from \"react\";\n\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { Money } from \"../ui/React/Money\";\nimport { Game } from \"./Game\";\nimport { Deck } from \"./CardDeck/Deck\";\nimport { Hand } from \"./CardDeck/Hand\";\nimport { InputAdornment } from \"@mui/material\";\nimport { ReactCard } from \"./CardDeck/ReactCard\";\nimport { MuiTextField } from \"../ui/React/MuiTextField\";\nimport { MuiButton } from \"../ui/React/MuiButton\";\nimport { MuiPaper } from \"../ui/React/MuiPaper\";\n\nconst MAX_BET = 100e6;\n\nenum Result {\n Pending = \"\",\n PlayerWon = \"You won!\",\n PlayerWonByBlackjack = \"You Won! Blackjack!\",\n DealerWon = \"You lost!\",\n Tie = \"Push! (Tie)\",\n}\n\ntype Props = {\n p: IPlayer;\n};\n\ntype State = {\n playerHand: Hand;\n dealerHand: Hand;\n bet: number;\n betInput: string;\n gameInProgress: boolean;\n result: Result;\n gains: number; // Track gains only for this session\n wagerInvalid: boolean;\n wagerInvalidHelperText: string;\n};\n\nexport class Blackjack extends Game {\n deck: Deck;\n\n constructor(props: Props) {\n super(props);\n\n this.deck = new Deck(5); // 5-deck multideck\n\n const initialBet = 1e6;\n\n this.state = {\n playerHand: new Hand([]),\n dealerHand: new Hand([]),\n bet: initialBet,\n betInput: String(initialBet),\n gameInProgress: false,\n result: Result.Pending,\n gains: 0,\n wagerInvalid: false,\n wagerInvalidHelperText: \"\",\n };\n }\n\n canStartGame = (): boolean => {\n const { p } = this.props;\n const { bet } = this.state;\n\n return p.canAfford(bet);\n };\n\n startGame = (): void => {\n if (!this.canStartGame()) {\n return;\n }\n\n // Take money from player right away so that player's dont just \"leave\" to avoid the loss (I mean they could\n // always reload without saving but w.e)\n this.props.p.loseMoney(this.state.bet);\n\n const playerHand = new Hand([this.deck.safeDrawCard(), this.deck.safeDrawCard()]);\n const dealerHand = new Hand([this.deck.safeDrawCard(), this.deck.safeDrawCard()]);\n\n this.setState({\n playerHand,\n dealerHand,\n gameInProgress: true,\n result: Result.Pending,\n });\n\n // If the player is dealt a blackjack and the dealer is not, then the player\n // immediately wins\n if (this.getTrueHandValue(playerHand) === 21) {\n if (this.getTrueHandValue(dealerHand) === 21) {\n this.finishGame(Result.Tie);\n } else {\n this.finishGame(Result.PlayerWonByBlackjack);\n }\n } else if (this.getTrueHandValue(dealerHand) === 21) {\n // Check if dealer won by blackjack. We know at this point that the player does not also have blackjack.\n this.finishGame(Result.DealerWon);\n }\n };\n\n // Returns an array of numbers representing all possible values of the given Hand. The reason it needs to be\n // an array is because an Ace can count as both 1 and 11.\n getHandValue = (hand: Hand): number[] => {\n let result: number[] = [0];\n\n for (let i = 0; i < hand.cards.length; ++i) {\n const value = hand.cards[i].value;\n if (value >= 10) {\n result = result.map((x) => x + 10);\n } else if (value === 1) {\n result = result.flatMap((x) => [x + 1, x + 11]);\n } else {\n result = result.map((x) => x + value);\n }\n }\n\n return result;\n };\n\n // Returns the single hand value used for determine things like victory and whether or not\n // the dealer has to hit. Essentially this uses the biggest value that's 21 or under. If no such value exists,\n // then it means the hand is busted and we can just return whatever\n getTrueHandValue = (hand: Hand): number => {\n const handValues = this.getHandValue(hand);\n const valuesUnder21 = handValues.filter((x) => x <= 21);\n\n if (valuesUnder21.length > 0) {\n valuesUnder21.sort((a, b) => a - b);\n return valuesUnder21[valuesUnder21.length - 1];\n } else {\n // Just return the first value. It doesnt really matter anyways since hand is buted\n return handValues[0];\n }\n };\n\n // Returns all hand values that are 21 or under. If no values are 21 or under, then the first value is returned.\n getHandDisplayValues = (hand: Hand): number[] => {\n const handValues = this.getHandValue(hand);\n if (this.isHandBusted(hand)) {\n // Hand is busted so just return the 1st value, doesn't really matter\n return [...new Set([handValues[0]])];\n } else {\n return [...new Set(handValues.filter((x) => x <= 21))];\n }\n };\n\n isHandBusted = (hand: Hand): boolean => {\n return this.getTrueHandValue(hand) > 21;\n };\n\n playerHit = (event: React.MouseEvent): void => {\n if (!event.isTrusted) {\n return;\n }\n\n const newHand = this.state.playerHand.addCards(this.deck.safeDrawCard());\n\n this.setState({\n playerHand: newHand,\n });\n\n // Check if player busted, and finish the game if so\n if (this.isHandBusted(newHand)) {\n this.finishGame(Result.DealerWon);\n }\n };\n\n playerStay = (event: React.MouseEvent): void => {\n if (!event.isTrusted) {\n return;\n }\n\n // Determine if Dealer needs to hit. A dealer must hit if they have 16 or lower.\n // If the dealer has a Soft 17 (Ace + 6), then they stay.\n let newDealerHand = this.state.dealerHand;\n while (true) {\n // The dealer's \"true\" hand value is the 2nd one if its 21 or less (the 2nd value is always guaranteed\n // to be equal or larger). Otherwise its the 1st.\n const dealerHandValue = this.getTrueHandValue(newDealerHand);\n\n if (dealerHandValue <= 16) {\n newDealerHand = newDealerHand.addCards(this.deck.safeDrawCard());\n } else {\n break;\n }\n }\n\n this.setState({\n dealerHand: newDealerHand,\n });\n\n // If dealer has busted, then player wins\n if (this.isHandBusted(newDealerHand)) {\n this.finishGame(Result.PlayerWon);\n } else {\n const dealerHandValue = this.getTrueHandValue(newDealerHand);\n const playerHandValue = this.getTrueHandValue(this.state.playerHand);\n\n // We expect nobody to have busted. If someone busted, there is an error\n // in our game logic\n if (dealerHandValue > 21 || playerHandValue > 21) {\n throw new Error(\"Someone busted when not expected to\");\n }\n\n if (playerHandValue > dealerHandValue) {\n this.finishGame(Result.PlayerWon);\n } else if (playerHandValue < dealerHandValue) {\n this.finishGame(Result.DealerWon);\n } else {\n this.finishGame(Result.Tie);\n }\n }\n };\n\n finishGame = (result: Result): void => {\n let gains = 0;\n if (this.isPlayerWinResult(result)) {\n gains = this.state.bet;\n\n // We 2x the gains because we took away money at the start, so we need to give the original bet back.\n this.win(this.props.p, 2 * gains);\n } else if (result === Result.DealerWon) {\n gains = -1 * this.state.bet;\n this.win(this.props.p, -this.state.bet); // Get the original bet back\n // Dont need to take money here since we already did it at the start\n } else if (result === Result.Tie) {\n this.win(this.props.p, this.state.bet); // Get the original bet back\n }\n\n this.setState({\n gameInProgress: false,\n result,\n gains: this.state.gains + gains,\n });\n };\n\n isPlayerWinResult = (result: Result): boolean => {\n return result === Result.PlayerWon || result === Result.PlayerWonByBlackjack;\n };\n\n wagerOnChange = (event: React.ChangeEvent): void => {\n const { p } = this.props;\n const betInput = event.target.value;\n const wager = Math.round(parseFloat(betInput));\n if (isNaN(wager)) {\n this.setState({\n bet: 0,\n betInput,\n wagerInvalid: true,\n wagerInvalidHelperText: \"Not a valid number\",\n });\n } else if (wager <= 0) {\n this.setState({\n bet: 0,\n betInput,\n wagerInvalid: true,\n wagerInvalidHelperText: \"Must bet a postive amount\",\n });\n } else if (wager > MAX_BET) {\n this.setState({\n bet: 0,\n betInput,\n wagerInvalid: true,\n wagerInvalidHelperText: \"Exceeds max bet\",\n });\n } else if (!p.canAfford(wager)) {\n this.setState({\n bet: 0,\n betInput,\n wagerInvalid: true,\n wagerInvalidHelperText: \"Not enough money\",\n });\n } else {\n // Valid wager\n this.setState({\n bet: wager,\n betInput,\n wagerInvalid: false,\n wagerInvalidHelperText: \"\",\n result: Result.Pending, // Reset previous game status to clear the win/lose text UI\n });\n }\n };\n\n // Start game button\n startOnClick = (event: React.MouseEvent): void => {\n // Protect against scripting...although maybe this would be fun to automate\n if (!event.isTrusted) {\n return;\n }\n\n if (!this.state.wagerInvalid) {\n this.startGame();\n }\n };\n\n render(): React.ReactNode {\n const { betInput, playerHand, dealerHand, gameInProgress, result, wagerInvalid, wagerInvalidHelperText, gains } =\n this.state;\n\n // Get the player totals to display.\n const playerHandValues = this.getHandDisplayValues(playerHand);\n const dealerHandValues = this.getHandDisplayValues(dealerHand);\n\n return (\n
      \n {/* Wager input */}\n
      \n \n {\"Wager (Max: \"}\n \n {\")\"}\n \n }\n disabled={gameInProgress}\n onChange={this.wagerOnChange}\n error={wagerInvalid}\n helperText={wagerInvalid ? wagerInvalidHelperText : \"\"}\n type=\"number\"\n variant=\"filled\"\n style={{\n width: \"200px\",\n }}\n InputProps={{\n startAdornment: $,\n }}\n />\n\n

      \n {\"Total earnings this session: \"}\n \n

      \n
      \n\n {/* Buttons */}\n {!gameInProgress ? (\n
      \n \n Start\n \n
      \n ) : (\n
      \n Hit\n \n Stay\n \n
      \n )}\n\n {/* Main game part. Displays both if the game is in progress OR if there's a result so you can see\n * the cards that led to that result. */}\n {(gameInProgress || result !== Result.Pending) && (\n
      \n \n
      Player
      \n {playerHand.cards.map((card, i) => (\n \n ))}\n\n
      Value(s): 
      \n {playerHandValues.map((value, i) => (\n
      {value}
      \n ))}\n
      \n\n
      \n\n \n
      Dealer
      \n {dealerHand.cards.map((card, i) => (\n // Hide every card except the first while game is in progress\n
      \n
      \n )}\n\n {/* Results from previous round */}\n {result !== Result.Pending && (\n

      \n {result}\n {this.isPlayerWinResult(result) && (\n <>\n {\" You gained \"}\n \n \n )}\n {result === Result.DealerWon && (\n <>\n {\" You lost \"}\n \n \n )}\n

      \n )}\n
      \n );\n }\n}\n","import { Card, Suit } from \"./Card\";\nimport { shuffle } from \"lodash\";\n\nexport class Deck {\n private cards: Card[] = [];\n\n // Support multiple decks\n constructor(private numDecks = 1) {\n this.reset();\n }\n\n shuffle(): void {\n this.cards = shuffle(this.cards); // Just use lodash\n }\n\n drawCard(): Card {\n if (this.cards.length == 0) {\n throw new Error(\"Tried to draw card from empty deck\");\n }\n\n return this.cards.shift() as Card; // Guaranteed to return a Card since we throw an Error if array is empty\n }\n\n // Draws a card, resetting the deck beforehands if the Deck is empty\n safeDrawCard(): Card {\n if (this.cards.length === 0) {\n this.reset();\n }\n\n return this.drawCard();\n }\n\n // Reset the deck back to the original 52 cards and shuffle it\n reset(): void {\n this.cards = [];\n\n for (let i = 1; i <= 13; ++i) {\n for (let j = 0; j < this.numDecks; ++j) {\n this.cards.push(new Card(i, Suit.Clubs));\n this.cards.push(new Card(i, Suit.Diamonds));\n this.cards.push(new Card(i, Suit.Hearts));\n this.cards.push(new Card(i, Suit.Spades));\n }\n }\n\n this.shuffle();\n }\n\n size(): number {\n return this.cards.length;\n }\n\n isEmpty(): boolean {\n return this.cards.length === 0;\n }\n}\n","/**\n * Wrapper around material-ui's TextField component that styles it with\n * Bitburner's UI theme\n */\n\nimport React from \"react\";\nimport { TextField, TextFieldProps } from \"@mui/material\";\n\nimport makeStyles from '@mui/styles/makeStyles';\n\nconst backgroundColorStyles = {\n backgroundColor: \"rgba(57, 54, 54, 0.9)\",\n \"&:hover\": {\n backgroundColor: \"rgba(70, 70, 70, 0.9)\",\n },\n};\n\nconst formControlStyles = {\n border: \"1px solid #e2e2e1\",\n overflow: \"hidden\",\n borderRadius: 4,\n color: \"white\",\n ...backgroundColorStyles,\n};\n\nconst useStyles = makeStyles({\n root: {\n ...formControlStyles,\n },\n});\n\nconst useInputStyles = makeStyles({\n root: {\n ...backgroundColorStyles,\n color: \"white\",\n },\n focused: {\n backgroundColor: \"rgba(70, 70, 70, 0.9)\",\n },\n disabled: {\n color: \"white\",\n },\n});\n\nconst useLabelStyles = makeStyles({\n root: {\n color: \"white\",\n },\n focused: {\n color: \"white !important\", // Need important to override styles from FormLabel\n },\n disabled: {\n color: \"white !important\", // Need important to override styles from FormLabel\n },\n});\n\nexport const MuiTextField: React.FC = (props: TextFieldProps) => {\n return (\n \n );\n};\n","/**\n * React Subcomponent for displaying a location's UI, when that location is a gym\n *\n * This subcomponent renders all of the buttons for training at the gym\n */\nimport * as React from \"react\";\n\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { StdButton } from \"../ui/React/StdButton\";\nimport { BadRNG } from \"./RNG\";\nimport { Game } from \"./Game\";\nimport { trusted } from \"./utils\";\n\ntype IProps = {\n p: IPlayer;\n};\n\ntype IState = {\n investment: number;\n result: any;\n status: string;\n playLock: boolean;\n};\n\nconst minPlay = 0;\nconst maxPlay = 10e3;\n\nexport class CoinFlip extends Game {\n constructor(props: IProps) {\n super(props);\n\n this.state = {\n investment: 1000,\n result: ,\n status: \"\",\n playLock: false,\n };\n\n this.play = this.play.bind(this);\n this.updateInvestment = this.updateInvestment.bind(this);\n }\n\n updateInvestment(e: React.FormEvent): void {\n let investment: number = parseInt(e.currentTarget.value);\n if (isNaN(investment)) {\n investment = minPlay;\n }\n if (investment > maxPlay) {\n investment = maxPlay;\n }\n if (investment < minPlay) {\n investment = minPlay;\n }\n this.setState({ investment: investment });\n }\n\n play(guess: string): void {\n if (this.reachedLimit(this.props.p)) return;\n const v = BadRNG.random();\n let letter: string;\n if (v < 0.5) {\n letter = \"H\";\n } else {\n letter = \"T\";\n }\n const correct: boolean = guess === letter;\n this.setState({\n result: {letter},\n status: correct ? \" win!\" : \"lose!\",\n playLock: true,\n });\n setTimeout(() => this.setState({ playLock: false }), 250);\n if (correct) {\n this.win(this.props.p, this.state.investment);\n } else {\n this.win(this.props.p, -this.state.investment);\n }\n if (this.reachedLimit(this.props.p)) return;\n }\n\n render(): React.ReactNode {\n return (\n <>\n
      {`+———————+`}
      \n
      {`| |   | |`}
      \n
      \n          {`| | `}\n          {this.state.result}\n          {` | |`}\n        
      \n
      {`| |   | |`}
      \n
      {`+———————+`}
      \n Play for: \n \n
      \n this.play(\"H\"))} text={\"Head!\"} disabled={this.state.playLock} />\n this.play(\"T\"))} text={\"Tail!\"} disabled={this.state.playLock} />\n

      {this.state.status}

      \n \n );\n }\n}\n","import * as React from \"react\";\n\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { StdButton } from \"../ui/React/StdButton\";\nimport { Money } from \"../ui/React/Money\";\nimport { Game } from \"./Game\";\nimport { WHRNG } from \"./RNG\";\nimport { trusted } from \"./utils\";\n\ntype IProps = {\n p: IPlayer;\n};\n\ntype IState = {\n investment: number;\n canPlay: boolean;\n status: string | JSX.Element;\n n: number;\n lock: boolean;\n strategy: Strategy;\n};\n\nconst minPlay = 0;\nconst maxPlay = 1e7;\n\nfunction isRed(n: number): boolean {\n return [1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36].includes(n);\n}\n\ntype Strategy = {\n match: (n: number) => boolean;\n payout: number;\n};\n\nconst redNumbers: number[] = [1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36];\n\nconst strategies: {\n Red: Strategy;\n Black: Strategy;\n Odd: Strategy;\n Even: Strategy;\n High: Strategy;\n Low: Strategy;\n Third1: Strategy;\n Third2: Strategy;\n Third3: Strategy;\n} = {\n Red: {\n match: (n: number): boolean => {\n if (n === 0) return false;\n return redNumbers.includes(n);\n },\n payout: 1,\n },\n Black: {\n match: (n: number): boolean => {\n return !redNumbers.includes(n);\n },\n payout: 1,\n },\n Odd: {\n match: (n: number): boolean => {\n if (n === 0) return false;\n return n % 2 === 1;\n },\n payout: 1,\n },\n Even: {\n match: (n: number): boolean => {\n if (n === 0) return false;\n return n % 2 === 0;\n },\n payout: 1,\n },\n High: {\n match: (n: number): boolean => {\n if (n === 0) return false;\n return n > 18;\n },\n payout: 1,\n },\n Low: {\n match: (n: number): boolean => {\n if (n === 0) return false;\n return n < 19;\n },\n payout: 1,\n },\n Third1: {\n match: (n: number): boolean => {\n if (n === 0) return false;\n return n <= 12;\n },\n payout: 2,\n },\n Third2: {\n match: (n: number): boolean => {\n if (n === 0) return false;\n return n >= 13 && n <= 24;\n },\n payout: 2,\n },\n Third3: {\n match: (n: number): boolean => {\n if (n === 0) return false;\n return n >= 25;\n },\n payout: 2,\n },\n};\n\nfunction Single(s: number): Strategy {\n return {\n match: (n: number): boolean => {\n return s === n;\n },\n payout: 36,\n };\n}\n\nexport class Roulette extends Game {\n interval = -1;\n rng: WHRNG;\n\n constructor(props: IProps) {\n super(props);\n\n this.rng = new WHRNG(new Date().getTime());\n this.state = {\n investment: 1000,\n canPlay: true,\n status: \"waiting\",\n n: 0,\n lock: true,\n strategy: {\n payout: 0,\n match: (): boolean => {\n return false;\n },\n },\n };\n\n this.step = this.step.bind(this);\n this.currentNumber = this.currentNumber.bind(this);\n this.updateInvestment = this.updateInvestment.bind(this);\n }\n\n componentDidMount(): void {\n this.interval = window.setInterval(this.step, 50);\n }\n\n step(): void {\n if (!this.state.lock) {\n this.setState({ n: Math.floor(Math.random() * 37) });\n }\n }\n\n componentWillUnmount(): void {\n clearInterval(this.interval);\n }\n\n updateInvestment(e: React.FormEvent): void {\n let investment: number = parseInt(e.currentTarget.value);\n if (isNaN(investment)) {\n investment = minPlay;\n }\n if (investment > maxPlay) {\n investment = maxPlay;\n }\n if (investment < minPlay) {\n investment = minPlay;\n }\n this.setState({ investment: investment });\n }\n\n currentNumber(): string {\n if (this.state.n === 0) return \"0\";\n const color = isRed(this.state.n) ? \"R\" : \"B\";\n return `${this.state.n}${color}`;\n }\n\n play(s: Strategy): void {\n if (this.reachedLimit(this.props.p)) return;\n this.setState({\n canPlay: false,\n lock: false,\n status: \"playing\",\n strategy: s,\n });\n setTimeout(() => {\n let n = Math.floor(this.rng.random() * 37);\n let status = <>;\n let gain = 0;\n let playerWin = this.state.strategy.match(n);\n // oh yeah, the house straight up cheats. Try finding the seed now!\n if (playerWin && Math.random() > 0.9) {\n playerWin = false;\n while (this.state.strategy.match(n)) {\n n = (n + 1) % 36;\n }\n }\n if (playerWin) {\n gain = this.state.investment * this.state.strategy.payout;\n status = (\n <>\n won \n \n );\n } else {\n gain = -this.state.investment;\n status = (\n <>\n lost \n \n );\n }\n this.win(this.props.p, gain);\n this.setState({\n canPlay: true,\n lock: true,\n status: status,\n n: n,\n });\n this.reachedLimit(this.props.p);\n }, 1600);\n }\n\n render(): React.ReactNode {\n return (\n <>\n

      {this.currentNumber()}

      \n \n

      {this.state.status}

      \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
      \n this.play(Single(3)))} />\n \n this.play(Single(6)))} />\n \n this.play(Single(9)))} />\n \n this.play(Single(12)))} />\n \n this.play(Single(15)))} />\n \n this.play(Single(18)))} />\n \n this.play(Single(21)))} />\n \n this.play(Single(24)))} />\n \n this.play(Single(27)))} />\n \n this.play(Single(30)))} />\n \n this.play(Single(33)))} />\n \n this.play(Single(36)))} />\n
      \n this.play(Single(2)))} />\n \n this.play(Single(5)))} />\n \n this.play(Single(8)))} />\n \n this.play(Single(11)))} />\n \n this.play(Single(14)))} />\n \n this.play(Single(17)))} />\n \n this.play(Single(20)))} />\n \n this.play(Single(23)))} />\n \n this.play(Single(26)))} />\n \n this.play(Single(29)))} />\n \n this.play(Single(32)))} />\n \n this.play(Single(35)))} />\n
      \n this.play(Single(1)))} />\n \n this.play(Single(4)))} />\n \n this.play(Single(7)))} />\n \n this.play(Single(10)))} />\n \n this.play(Single(13)))} />\n \n this.play(Single(16)))} />\n \n this.play(Single(19)))} />\n \n this.play(Single(22)))} />\n \n this.play(Single(25)))} />\n \n this.play(Single(28)))} />\n \n this.play(Single(31)))} />\n \n this.play(Single(34)))} />\n
      \n this.play(strategies.Third1))}\n />\n \n this.play(strategies.Third2))}\n />\n \n this.play(strategies.Third3))}\n />\n
      \n this.play(strategies.Red))}\n />\n \n this.play(strategies.Black))}\n />\n \n this.play(strategies.Odd))}\n />\n \n this.play(strategies.Even))}\n />\n \n this.play(strategies.High))}\n />\n \n this.play(strategies.Low))}\n />\n
      \n this.play(Single(0)))} />\n
      \n \n );\n }\n}\n","import * as React from \"react\";\n\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { StdButton } from \"../ui/React/StdButton\";\nimport { Money } from \"../ui/React/Money\";\nimport { WHRNG } from \"./RNG\";\nimport { Game } from \"./Game\";\nimport { trusted } from \"./utils\";\n\ntype IProps = {\n p: IPlayer;\n};\n\ntype IState = {\n index: number[];\n locks: number[];\n investment: number;\n canPlay: boolean;\n status: string | JSX.Element;\n};\n\n// statically shuffled array of symbols.\nconst symbols = [\n \"D\",\n \"C\",\n \"$\",\n \"?\",\n \"♥\",\n \"A\",\n \"C\",\n \"B\",\n \"C\",\n \"E\",\n \"B\",\n \"E\",\n \"C\",\n \"*\",\n \"D\",\n \"♥\",\n \"B\",\n \"A\",\n \"A\",\n \"A\",\n \"C\",\n \"A\",\n \"D\",\n \"B\",\n \"E\",\n \"?\",\n \"D\",\n \"*\",\n \"@\",\n \"♥\",\n \"B\",\n \"E\",\n \"?\",\n];\n\nfunction getPayout(s: string, n: number): number {\n switch (s) {\n case \"$\":\n return [20, 200, 1000][n];\n case \"@\":\n return [8, 80, 400][n];\n case \"♥\":\n case \"?\":\n return [6, 20, 150][n];\n case \"D\":\n case \"E\":\n return [1, 8, 30][n];\n default:\n return [1, 5, 20][n];\n }\n}\n\nconst payLines = [\n // lines\n [\n [0, 0],\n [0, 1],\n [0, 2],\n [0, 3],\n [0, 4],\n ],\n [\n [1, 0],\n [1, 1],\n [1, 2],\n [1, 3],\n [1, 4],\n ],\n [\n [2, 0],\n [2, 1],\n [2, 2],\n [2, 3],\n [2, 4],\n ],\n\n // Vs\n [\n [2, 0],\n [1, 1],\n [0, 2],\n [1, 3],\n [2, 4],\n ],\n [\n [0, 0],\n [1, 1],\n [2, 2],\n [1, 3],\n [0, 4],\n ],\n\n // rest\n [\n [0, 0],\n [1, 1],\n [1, 2],\n [1, 3],\n [0, 4],\n ],\n [\n [2, 0],\n [1, 1],\n [1, 2],\n [1, 3],\n [2, 4],\n ],\n [\n [1, 0],\n [0, 1],\n [0, 2],\n [0, 3],\n [1, 4],\n ],\n [\n [1, 0],\n [2, 1],\n [2, 2],\n [2, 3],\n [1, 4],\n ],\n];\n\nconst minPlay = 0;\nconst maxPlay = 1e6;\n\nexport class SlotMachine extends Game {\n rng: WHRNG;\n interval = -1;\n\n constructor(props: IProps) {\n super(props);\n this.rng = new WHRNG(this.props.p.totalPlaytime);\n\n this.state = {\n index: [0, 0, 0, 0, 0],\n investment: 1000,\n locks: [0, 0, 0, 0, 0],\n canPlay: true,\n status: \"waiting\",\n };\n\n this.play = this.play.bind(this);\n this.lock = this.lock.bind(this);\n this.unlock = this.unlock.bind(this);\n this.step = this.step.bind(this);\n this.checkWinnings = this.checkWinnings.bind(this);\n this.getTable = this.getTable.bind(this);\n this.updateInvestment = this.updateInvestment.bind(this);\n }\n\n componentDidMount(): void {\n this.interval = window.setInterval(this.step, 50);\n }\n\n step(): void {\n let stoppedOne = false;\n const index = this.state.index.slice();\n for (const i in index) {\n if (index[i] === this.state.locks[i] && !stoppedOne) continue;\n index[i] = (index[i] + 1) % symbols.length;\n stoppedOne = true;\n }\n\n this.setState({ index: index });\n\n if (stoppedOne && index.every((e, i) => e === this.state.locks[i])) {\n this.checkWinnings();\n }\n }\n\n componentWillUnmount(): void {\n clearInterval(this.interval);\n }\n\n getTable(): string[][] {\n return [\n [\n symbols[(this.state.index[0] + symbols.length - 1) % symbols.length],\n symbols[(this.state.index[1] + symbols.length - 1) % symbols.length],\n symbols[(this.state.index[2] + symbols.length - 1) % symbols.length],\n symbols[(this.state.index[3] + symbols.length - 1) % symbols.length],\n symbols[(this.state.index[4] + symbols.length - 1) % symbols.length],\n ],\n [\n symbols[this.state.index[0]],\n symbols[this.state.index[1]],\n symbols[this.state.index[2]],\n symbols[this.state.index[3]],\n symbols[this.state.index[4]],\n ],\n [\n symbols[(this.state.index[0] + 1) % symbols.length],\n symbols[(this.state.index[1] + 1) % symbols.length],\n symbols[(this.state.index[2] + 1) % symbols.length],\n symbols[(this.state.index[3] + 1) % symbols.length],\n symbols[(this.state.index[4] + 1) % symbols.length],\n ],\n ];\n }\n\n play(): void {\n if (this.reachedLimit(this.props.p)) return;\n this.setState({ status: \"playing\" });\n this.win(this.props.p, -this.state.investment);\n if (!this.state.canPlay) return;\n this.unlock();\n setTimeout(this.lock, this.rng.random() * 2000 + 1000);\n }\n\n lock(): void {\n this.setState({\n locks: [\n Math.floor(this.rng.random() * symbols.length),\n Math.floor(this.rng.random() * symbols.length),\n Math.floor(this.rng.random() * symbols.length),\n Math.floor(this.rng.random() * symbols.length),\n Math.floor(this.rng.random() * symbols.length),\n ],\n });\n }\n\n checkWinnings(): void {\n const t = this.getTable();\n const getPaylineData = function (payline: number[][]): string[] {\n const data = [];\n for (const point of payline) {\n data.push(t[point[0]][point[1]]);\n }\n return data;\n };\n\n const countSequence = function (data: string[]): number {\n let count = 1;\n for (let i = 1; i < data.length; i++) {\n if (data[i] !== data[i - 1]) break;\n count++;\n }\n\n return count;\n };\n\n let gains = -this.state.investment;\n for (const payline of payLines) {\n const data = getPaylineData(payline);\n const count = countSequence(data);\n if (count < 3) continue;\n const payout = getPayout(data[0], count - 3);\n gains += this.state.investment * payout;\n this.win(this.props.p, this.state.investment * payout);\n }\n\n this.setState({\n status: (\n <>\n {gains > 0 ? \"gained\" : \"lost\"} \n \n ),\n canPlay: true,\n });\n if (this.reachedLimit(this.props.p)) return;\n }\n\n unlock(): void {\n this.setState({\n locks: [-1, -1, -1, -1, -1],\n canPlay: false,\n });\n }\n\n updateInvestment(e: React.FormEvent): void {\n let investment: number = parseInt(e.currentTarget.value);\n if (isNaN(investment)) {\n investment = minPlay;\n }\n if (investment > maxPlay) {\n investment = maxPlay;\n }\n if (investment < minPlay) {\n investment = minPlay;\n }\n this.setState({ investment: investment });\n }\n\n render(): React.ReactNode {\n const t = this.getTable();\n // prettier-ignore\n return (\n <>\n
      +———————————————————————+
      \n
      | | {t[0][0]} | {t[0][1]} | {t[0][2]} | {t[0][3]} | {t[0][4]} | |
      \n
      | |   |   |   |   |   | |
      \n
      | | {symbols[this.state.index[0]]} | {symbols[this.state.index[1]]} | {symbols[this.state.index[2]]} | {symbols[this.state.index[3]]} | {symbols[this.state.index[4]]} | |
      \n
      | |   |   |   |   |   | |
      \n
      | | {symbols[(this.state.index[0]+1)%symbols.length]} | {symbols[(this.state.index[1]+1)%symbols.length]} | {symbols[(this.state.index[2]+1)%symbols.length]} | {symbols[(this.state.index[3]+1)%symbols.length]} | {symbols[(this.state.index[4]+1)%symbols.length]} | |
      \n
      +———————————————————————+
      \n \n \n

      {this.state.status}

      \n

      Pay lines

      \n\n
      -----   ·····   ·····
      \n
      ·····   -----   ·····
      \n
      ·····   ·····   -----
      \n
      \n\n
      ··^··   \\···/   \\···/
      \n
      ·/·\\·   ·\\·/·   ·---·
      \n
      /···\\   ··v··   ·····
      \n
      \n\n
      ·····   ·---·   ·····
      \n
      ·---·   /···\\   \\···/
      \n
      /···\\   ·····   ·---·
      \n \n );\n }\n}\n\n// https://felgo.com/doc/how-to-make-a-slot-game-tutorial/\n","import React, { useEffect, useState } from \"react\";\n\nfunction replace(str: string, i: number, char: string): string {\n return str.substring(0, i) + char + str.substring(i + 1);\n}\n\ninterface IProps {\n content: string;\n}\n\nfunction randomize(char: string): string {\n const randFrom = (str: string): string => str[Math.floor(Math.random() * str.length)];\n const classes = [\"abcdefghijklmnopqrstuvwxyz\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\", \"1234567890\", \" _\", \"()[]{}<>\"];\n const other = `!@#$%^&*()_+|\\\\';\"/.,?\\`~`;\n\n for (const c of classes) {\n if (c.includes(char)) return randFrom(c);\n }\n\n return randFrom(other);\n}\n\nexport function CorruptableText(props: IProps): JSX.Element {\n const [content, setContent] = useState(props.content);\n\n useEffect(() => {\n let counter = 5;\n const id = setInterval(() => {\n counter--;\n if (counter > 0) return;\n counter = Math.random() * 5;\n const index = Math.random() * content.length;\n const letter = content.charAt(index);\n setContent(replace(content, index, randomize(letter)));\n setTimeout(() => {\n setContent(content);\n }, 50);\n }, 100);\n\n return () => {\n clearInterval(id);\n };\n }, []);\n\n return {content};\n}\n","/**\n * React Component for displaying a City's UI.\n * This UI shows all of the available locations in the city, and lets the player\n * visit those locations\n */\nimport * as React from \"react\";\n\nimport { City } from \"../City\";\nimport { Cities } from \"../Cities\";\nimport { LocationName } from \"../data/LocationNames\";\nimport { Locations } from \"../Locations\";\nimport { Location } from \"../Location\";\nimport { Settings } from \"../../Settings/Settings\";\n\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { use } from \"../../ui/Context\";\nimport { IRouter } from \"../../ui/Router\";\n\ntype IProps = {\n city: City;\n};\n\nfunction toLocation(router: IRouter, location: Location): void {\n if (location.name === LocationName.TravelAgency) {\n router.toTravel();\n } else if (location.name === LocationName.WorldStockExchange) {\n router.toStockMarket();\n } else {\n router.toLocation(location);\n }\n}\n\nfunction LocationLetter(location: Location): React.ReactElement {\n const router = use.Router();\n if (!location) return *;\n return (\n toLocation(router, location)}\n >\n X\n
      \n );\n}\n\nfunction ASCIICity(props: IProps): React.ReactElement {\n const locationLettersRegex = /[A-Z]/g;\n const letterMap: any = {\n A: 0,\n B: 1,\n C: 2,\n D: 3,\n E: 4,\n F: 5,\n G: 6,\n H: 7,\n I: 8,\n J: 9,\n K: 10,\n L: 11,\n M: 12,\n N: 13,\n O: 14,\n P: 15,\n Q: 16,\n R: 17,\n S: 18,\n T: 19,\n U: 20,\n V: 21,\n W: 22,\n X: 23,\n Y: 24,\n Z: 25,\n };\n\n const lineElems = (s: string): JSX.Element[] => {\n const elems: any[] = [];\n const matches: any[] = [];\n let match: any;\n while ((match = locationLettersRegex.exec(s)) !== null) {\n matches.push(match);\n }\n if (matches.length === 0) {\n elems.push(s);\n return elems;\n }\n\n for (let i = 0; i < matches.length; i++) {\n const startI = i === 0 ? 0 : matches[i - 1].index + 1;\n const endI = matches[i].index;\n elems.push(s.slice(startI, endI));\n const locationI = letterMap[s[matches[i].index]];\n elems.push(LocationLetter(Locations[props.city.locations[locationI]]));\n }\n elems.push(s.slice(matches[matches.length - 1].index + 1));\n return elems;\n };\n\n const elems: JSX.Element[] = [];\n const lines = props.city.asciiArt.split(\"\\n\");\n for (const i in lines) {\n elems.push(
      {lineElems(lines[i])}
      );\n }\n\n return
      {elems}
      ;\n}\n\nfunction ListCity(props: IProps): React.ReactElement {\n const router = use.Router();\n const locationButtons = props.city.locations.map((locName) => {\n return (\n
    • \n toLocation(router, Locations[locName])} text={locName} />\n
    • \n );\n });\n\n return
        {locationButtons}
      ;\n}\n\nexport function LocationCity(): React.ReactElement {\n const player = use.Player();\n const city = Cities[player.city];\n return (\n
      \n

      {city.name}

      \n {Settings.DisableASCIIArt ? : }\n
      \n );\n}\n","import React, { useState, useEffect } from \"react\";\nimport { use } from \"../../ui/Context\";\nimport { getAvailableCreatePrograms } from \"../ProgramHelpers\";\n\nimport { Box, ButtonGroup, Tooltip, Typography } from \"@mui/material\";\nimport Button from \"@mui/material/Button\";\n\nexport function ProgramsRoot(): React.ReactElement {\n const player = use.Player();\n const router = use.Router();\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => {\n const id = setInterval(rerender, 1000);\n return () => clearInterval(id);\n }, []);\n\n return (\n <>\n
      \n \n \n This page displays any programs that you are able to create. Writing the code for a program takes time,\n which can vary based on how complex the program is. If you are working on creating a program you can cancel\n at any time. Your progress will be saved and you can continue later.\n \n \n \n {getAvailableCreatePrograms(player).map((program) => {\n const create = program.create;\n if (create === null) return <>;\n\n return (\n \n {\n player.startCreateProgramWork(router, program.name, create.time, create.level);\n }}\n >\n {program.name}\n \n \n );\n })}\n \n
      \n \n );\n}\n","import React, { useState, useEffect, useRef } from \"react\";\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport Editor from \"@monaco-editor/react\";\nimport * as monaco from \"monaco-editor\";\ntype IStandaloneCodeEditor = monaco.editor.IStandaloneCodeEditor;\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { OptionsPopup } from \"./OptionsPopup\";\nimport { Options } from \"./Options\";\nimport { js_beautify as beautifyCode } from \"js-beautify\";\nimport { isValidFilePath } from \"../../Terminal/DirectoryHelpers\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { IRouter } from \"../../ui/Router\";\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { parseFconfSettings } from \"../../Fconf/Fconf\";\nimport { isScriptFilename } from \"../../Script/ScriptHelpersTS\";\nimport { Script } from \"../../Script/Script\";\nimport { TextFile } from \"../../TextFile\";\nimport { calculateRamUsage } from \"../../Script/RamCalculations\";\nimport { RamCalculationErrorCode } from \"../../Script/RamCalculationErrorCodes\";\nimport { numeralWrapper } from \"../../ui/numeralFormat\";\nimport { CursorPositions } from \"../../ScriptEditor/CursorPositions\";\nimport { libSource } from \"../NetscriptDefinitions\";\nimport { NetscriptFunctions } from \"../../NetscriptFunctions\";\nimport { WorkerScript } from \"../../Netscript/WorkerScript\";\nimport { Settings } from \"../../Settings/Settings\";\nimport { iTutorialNextStep, ITutorial, iTutorialSteps } from \"../../InteractiveTutorial\";\n\n let loaded=false;\nlet symbols: string[] = [];\n(function () {\n const ns = NetscriptFunctions({} as WorkerScript);\n\n function populate(ns: any): string[] {\n let symbols: string[] = [];\n const keys = Object.keys(ns);\n for (const key of keys) {\n if (typeof ns[key] === \"object\") {\n symbols.push(key);\n symbols = symbols.concat(populate(ns[key]));\n }\n if (typeof ns[key] === \"function\") {\n symbols.push(key);\n }\n }\n return symbols;\n }\n symbols = populate(ns);\n\n const exclude = [\"heart\", \"break\", \"exploit\", \"bypass\", \"corporation\"];\n symbols = symbols.filter((symbol: string) => !exclude.includes(symbol));\n})();\n\ninterface IProps {\n filename: string;\n code: string;\n player: IPlayer;\n router: IRouter;\n}\n\n/*\n\n*/\n\n// How to load function definition in monaco\n// https://github.com/Microsoft/monaco-editor/issues/1415\n// https://microsoft.github.io/monaco-editor/api/modules/monaco.languages.html\n// https://www.npmjs.com/package/@monaco-editor/react#development-playground\n// https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-custom-languages\n// https://github.com/threehams/typescript-error-guide/blob/master/stories/components/Editor.tsx#L11-L39\n\n// These variables are used to reload a script when it's clicked on. Because we\n// won't have references to the old script.\nlet lastFilename = \"\";\nlet lastCode = \"\";\nlet lastPosition: monaco.Position | null = null;\n\nexport function Root(props: IProps): React.ReactElement {\n const editorRef = useRef(null);\n const [filename, setFilename] = useState(props.filename ? props.filename : lastFilename);\n const [code, setCode] = useState(props.filename ? props.code : lastCode);\n const [ram, setRAM] = useState(\"RAM: ???\");\n const [options, setOptions] = useState({\n theme: Settings.MonacoTheme,\n insertSpaces: Settings.MonacoInsertSpaces,\n });\n\n // store the last known state in case we need to restart without nano.\n useEffect(() => {\n if (props.filename === undefined) return;\n lastFilename = props.filename;\n lastCode = props.code;\n lastPosition = null;\n }, []);\n\n function save(): void {\n if (editorRef.current !== null) {\n const position = editorRef.current.getPosition();\n if (position !== null) {\n CursorPositions.saveCursor(filename, {\n row: position.lineNumber,\n column: position.column,\n });\n }\n }\n lastPosition = null;\n\n // this is duplicate code with saving later.\n if (ITutorial.isRunning && ITutorial.currStep === iTutorialSteps.TerminalTypeScript) {\n //Make sure filename + code properly follow tutorial\n if (filename !== \"n00dles.script\") {\n dialogBoxCreate(\"Leave the script name as 'n00dles'!\");\n return;\n }\n if (code.replace(/\\s/g, \"\").indexOf(\"while(true){hack('n00dles');}\") == -1) {\n dialogBoxCreate(\"Please copy and paste the code from the tutorial!\");\n return;\n }\n\n //Save the script\n const server = props.player.getCurrentServer();\n if (server === null) throw new Error(\"Server should not be null but it is.\");\n let found = false;\n for (let i = 0; i < server.scripts.length; i++) {\n if (filename == server.scripts[i].filename) {\n server.scripts[i].saveScript(code, props.player.currentServer, server.scripts);\n found = true;\n }\n }\n\n if (!found) {\n const script = new Script();\n script.saveScript(code, props.player.currentServer, server.scripts);\n server.scripts.push(script);\n }\n\n iTutorialNextStep();\n\n props.router.toTerminal();\n return;\n }\n\n if (filename == \"\") {\n dialogBoxCreate(\"You must specify a filename!\");\n return;\n }\n\n if (filename !== \".fconf\" && !isValidFilePath(filename)) {\n dialogBoxCreate(\n \"Script filename can contain only alphanumerics, hyphens, and underscores, and must end with an extension.\",\n );\n return;\n }\n\n const server = props.player.getCurrentServer();\n if (server === null) throw new Error(\"Server should not be null but it is.\");\n if (filename === \".fconf\") {\n try {\n parseFconfSettings(code);\n } catch (e) {\n dialogBoxCreate(`Invalid .fconf file: ${e}`);\n return;\n }\n } else if (isScriptFilename(filename)) {\n //If the current script already exists on the server, overwrite it\n for (let i = 0; i < server.scripts.length; i++) {\n if (filename == server.scripts[i].filename) {\n server.scripts[i].saveScript(code, props.player.currentServer, server.scripts);\n props.router.toTerminal();\n return;\n }\n }\n\n //If the current script does NOT exist, create a new one\n const script = new Script();\n script.saveScript(code, props.player.currentServer, server.scripts);\n server.scripts.push(script);\n } else if (filename.endsWith(\".txt\")) {\n for (let i = 0; i < server.textFiles.length; ++i) {\n if (server.textFiles[i].fn === filename) {\n server.textFiles[i].write(code);\n props.router.toTerminal();\n return;\n }\n }\n const textFile = new TextFile(filename, code);\n server.textFiles.push(textFile);\n } else {\n dialogBoxCreate(\"Invalid filename. Must be either a script (.script, .js, or .ns) or \" + \" or text file (.txt)\");\n return;\n }\n props.router.toTerminal();\n }\n\n function beautify(): void {\n if (editorRef.current === null) return;\n const pretty = beautifyCode(code, {\n indent_with_tabs: !options.insertSpaces,\n indent_size: 4,\n brace_style: \"preserve-inline\",\n });\n editorRef.current.setValue(pretty);\n }\n\n function onFilenameChange(event: React.ChangeEvent): void {\n lastFilename = filename;\n setFilename(event.target.value);\n }\n\n function openOptions(): void {\n const id = \"script-editor-options-popup\";\n const newOptions = {\n theme: \"\",\n insertSpaces: false,\n };\n Object.assign(newOptions, options);\n createPopup(id, OptionsPopup, {\n id: id,\n options: newOptions,\n save: (options: Options) => {\n setOptions(options);\n Settings.MonacoTheme = options.theme;\n Settings.MonacoInsertSpaces = options.insertSpaces;\n },\n });\n }\n\n function updateCode(newCode?: string): void {\n if (newCode === undefined) return;\n lastCode = newCode;\n if (editorRef.current !== null) {\n lastPosition = editorRef.current.getPosition();\n }\n setCode(newCode);\n }\n\n async function updateRAM(): Promise {\n const codeCopy = code + \"\";\n const ramUsage = await calculateRamUsage(codeCopy, props.player.getCurrentServer().scripts);\n if (ramUsage > 0) {\n setRAM(\"RAM: \" + numeralWrapper.formatRAM(ramUsage));\n return;\n }\n switch (ramUsage) {\n case RamCalculationErrorCode.ImportError: {\n setRAM(\"RAM: Import Error\");\n break;\n }\n case RamCalculationErrorCode.URLImportError: {\n setRAM(\"RAM: HTTP Import Error\");\n break;\n }\n case RamCalculationErrorCode.SyntaxError:\n default: {\n setRAM(\"RAM: Syntax Error\");\n break;\n }\n }\n return new Promise(() => undefined);\n }\n\n useEffect(() => {\n const id = setInterval(updateRAM, 1000);\n return () => clearInterval(id);\n }, [code]);\n\n useEffect(() => {\n function maybeSave(event: KeyboardEvent): void {\n if (Settings.DisableHotkeys) return;\n //Ctrl + b\n if (event.keyCode == 66 && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n save();\n }\n }\n document.addEventListener(\"keydown\", maybeSave);\n return () => document.removeEventListener(\"keydown\", maybeSave);\n });\n\n function onMount(editor: IStandaloneCodeEditor): void {\n editorRef.current = editor;\n if (editorRef.current === null) return;\n const position = CursorPositions.getCursor(filename);\n if (position.row !== -1)\n editorRef.current.setPosition({\n lineNumber: position.row,\n column: position.column,\n });\n else if (lastPosition !== null)\n editorRef.current.setPosition({\n lineNumber: lastPosition.lineNumber,\n column: lastPosition.column + 1,\n });\n editorRef.current.focus();\n }\n\n function beforeMount(monaco: any): void {\n monaco.languages.registerCompletionItemProvider(\"javascript\", {\n provideCompletionItems: () => {\n const suggestions = [];\n for (const symbol of symbols) {\n suggestions.push({\n label: symbol,\n kind: monaco.languages.CompletionItemKind.Function,\n insertText: symbol,\n insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,\n });\n }\n return { suggestions: suggestions };\n },\n });\n monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, \"netscript.d.ts\");\n monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource, \"netscript.d.ts\");\n loaded=true\n }\n\n return (\n <>\n
      \n

      \n {\" \"}\n Script name: \n

      \n \n \n
      \n Loading script editor!

      }\n height=\"90%\"\n defaultLanguage=\"javascript\"\n defaultValue={code}\n onChange={updateCode}\n theme={options.theme}\n options={options}\n />\n
      \n \n

      \n {ram}\n

      \n \n \n Netscript Documentation\n \n
      \n \n );\n}\n","import React, { useState } from \"react\";\nimport { Options } from \"./Options\";\nimport { StdButton } from \"../../ui/React/StdButton\";\nimport { removePopup } from \"../../ui/React/createPopup\";\n\ninterface IProps {\n id: string;\n options: Options;\n save: (options: Options) => void;\n}\n\nexport function OptionsPopup(props: IProps): React.ReactElement {\n const [theme, setTheme] = useState(props.options.theme);\n const [insertSpaces, setInsertSpaces] = useState(props.options.insertSpaces);\n\n function save(): void {\n props.save({\n theme: theme,\n insertSpaces: insertSpaces,\n });\n removePopup(props.id);\n }\n\n return (\n
      \n
      \n

      Theme:

      \n \n
      \n
      \n

      Use whitespace over tabs:

      \n setInsertSpaces(event.target.checked)} checked={insertSpaces} />\n
      \n
      \n \n
      \n );\n}\n","import { GangMemberTask } from \"./GangMemberTask\";\nimport { GangMemberTasks } from \"./GangMemberTasks\";\nimport { GangMemberUpgrade } from \"./GangMemberUpgrade\";\nimport { GangMemberUpgrades } from \"./GangMemberUpgrades\";\nimport { IAscensionResult } from \"./IAscensionResult\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { AllGangs } from \"./AllGangs\";\nimport { IGang } from \"./IGang\";\nimport { Generic_fromJSON, Generic_toJSON, Reviver } from \"../../utils/JSONReviver\";\n\ninterface IMults {\n hack: number;\n str: number;\n def: number;\n dex: number;\n agi: number;\n cha: number;\n}\n\nexport class GangMember {\n name: string;\n task = \"Unassigned\";\n\n earnedRespect = 0;\n\n hack = 1;\n str = 1;\n def = 1;\n dex = 1;\n agi = 1;\n cha = 1;\n\n hack_exp = 0;\n str_exp = 0;\n def_exp = 0;\n dex_exp = 0;\n agi_exp = 0;\n cha_exp = 0;\n\n hack_mult = 1;\n str_mult = 1;\n def_mult = 1;\n dex_mult = 1;\n agi_mult = 1;\n cha_mult = 1;\n\n hack_asc_points = 0;\n str_asc_points = 0;\n def_asc_points = 0;\n dex_asc_points = 0;\n agi_asc_points = 0;\n cha_asc_points = 0;\n\n upgrades: string[] = []; // Names of upgrades\n augmentations: string[] = []; // Names of augmentations only\n\n constructor(name = \"\") {\n this.name = name;\n }\n\n calculateSkill(exp: number, mult = 1): number {\n return Math.max(Math.floor(mult * (32 * Math.log(exp + 534.5) - 200)), 1);\n }\n\n calculateAscensionMult(points: number): number {\n return Math.max(Math.pow(points / 4000, 0.7), 1);\n }\n\n updateSkillLevels(): void {\n this.hack = this.calculateSkill(this.hack_exp, this.hack_mult * this.calculateAscensionMult(this.hack_asc_points));\n this.str = this.calculateSkill(this.str_exp, this.str_mult * this.calculateAscensionMult(this.str_asc_points));\n this.def = this.calculateSkill(this.def_exp, this.def_mult * this.calculateAscensionMult(this.def_asc_points));\n this.dex = this.calculateSkill(this.dex_exp, this.dex_mult * this.calculateAscensionMult(this.dex_asc_points));\n this.agi = this.calculateSkill(this.agi_exp, this.agi_mult * this.calculateAscensionMult(this.agi_asc_points));\n this.cha = this.calculateSkill(this.cha_exp, this.cha_mult * this.calculateAscensionMult(this.cha_asc_points));\n }\n\n calculatePower(): number {\n return (this.hack + this.str + this.def + this.dex + this.agi + this.cha) / 95;\n }\n\n assignToTask(taskName: string): boolean {\n if (!GangMemberTasks.hasOwnProperty(taskName)) {\n this.task = \"Unassigned\";\n return false;\n }\n this.task = taskName;\n return true;\n }\n\n unassignFromTask(): void {\n this.task = \"Unassigned\";\n }\n\n getTask(): GangMemberTask {\n // TODO(hydroflame): transfer that to a save file migration function\n // Backwards compatibility\n if ((this.task as any) instanceof GangMemberTask) {\n this.task = (this.task as any).name;\n }\n\n if (GangMemberTasks.hasOwnProperty(this.task)) {\n return GangMemberTasks[this.task];\n }\n return GangMemberTasks[\"Unassigned\"];\n }\n\n calculateRespectGain(gang: IGang): number {\n const task = this.getTask();\n if (task.baseRespect === 0) return 0;\n let statWeight =\n (task.hackWeight / 100) * this.hack +\n (task.strWeight / 100) * this.str +\n (task.defWeight / 100) * this.def +\n (task.dexWeight / 100) * this.dex +\n (task.agiWeight / 100) * this.agi +\n (task.chaWeight / 100) * this.cha;\n statWeight -= 4 * task.difficulty;\n if (statWeight <= 0) return 0;\n const territoryMult = Math.max(\n 0.005,\n Math.pow(AllGangs[gang.facName].territory * 100, task.territory.respect) / 100,\n );\n if (isNaN(territoryMult) || territoryMult <= 0) return 0;\n const respectMult = gang.getWantedPenalty();\n return 11 * task.baseRespect * statWeight * territoryMult * respectMult;\n }\n\n calculateWantedLevelGain(gang: IGang): number {\n const task = this.getTask();\n if (task.baseWanted === 0) return 0;\n let statWeight =\n (task.hackWeight / 100) * this.hack +\n (task.strWeight / 100) * this.str +\n (task.defWeight / 100) * this.def +\n (task.dexWeight / 100) * this.dex +\n (task.agiWeight / 100) * this.agi +\n (task.chaWeight / 100) * this.cha;\n statWeight -= 3.5 * task.difficulty;\n if (statWeight <= 0) return 0;\n const territoryMult = Math.max(\n 0.005,\n Math.pow(AllGangs[gang.facName].territory * 100, task.territory.wanted) / 100,\n );\n if (isNaN(territoryMult) || territoryMult <= 0) return 0;\n if (task.baseWanted < 0) {\n return 0.4 * task.baseWanted * statWeight * territoryMult;\n }\n const calc = (7 * task.baseWanted) / Math.pow(3 * statWeight * territoryMult, 0.8);\n\n // Put an arbitrary cap on this to prevent wanted level from rising too fast if the\n // denominator is very small. Might want to rethink formula later\n return Math.min(100, calc);\n }\n\n calculateMoneyGain(gang: IGang): number {\n const task = this.getTask();\n if (task.baseMoney === 0) return 0;\n let statWeight =\n (task.hackWeight / 100) * this.hack +\n (task.strWeight / 100) * this.str +\n (task.defWeight / 100) * this.def +\n (task.dexWeight / 100) * this.dex +\n (task.agiWeight / 100) * this.agi +\n (task.chaWeight / 100) * this.cha;\n\n statWeight -= 3.2 * task.difficulty;\n if (statWeight <= 0) return 0;\n const territoryMult = Math.max(0.005, Math.pow(AllGangs[gang.facName].territory * 100, task.territory.money) / 100);\n if (isNaN(territoryMult) || territoryMult <= 0) return 0;\n const respectMult = gang.getWantedPenalty();\n return 5 * task.baseMoney * statWeight * territoryMult * respectMult;\n }\n\n expMult(): IMults {\n return {\n hack: (this.hack_mult - 1) / 4 + 1,\n str: (this.str_mult - 1) / 4 + 1,\n def: (this.def_mult - 1) / 4 + 1,\n dex: (this.dex_mult - 1) / 4 + 1,\n agi: (this.agi_mult - 1) / 4 + 1,\n cha: (this.cha_mult - 1) / 4 + 1,\n };\n }\n\n gainExperience(numCycles = 1): void {\n const task = this.getTask();\n if (task === GangMemberTasks[\"Unassigned\"]) return;\n const difficultyMult = Math.pow(task.difficulty, 0.9);\n const difficultyPerCycles = difficultyMult * numCycles;\n const weightDivisor = 1500;\n const expMult = this.expMult();\n this.hack_exp += (task.hackWeight / weightDivisor) * difficultyPerCycles * expMult.hack;\n this.str_exp += (task.strWeight / weightDivisor) * difficultyPerCycles * expMult.str;\n this.def_exp += (task.defWeight / weightDivisor) * difficultyPerCycles * expMult.def;\n this.dex_exp += (task.dexWeight / weightDivisor) * difficultyPerCycles * expMult.dex;\n this.agi_exp += (task.agiWeight / weightDivisor) * difficultyPerCycles * expMult.agi;\n this.cha_exp += (task.chaWeight / weightDivisor) * difficultyPerCycles * expMult.cha;\n }\n\n recordEarnedRespect(numCycles = 1, gang: IGang): void {\n this.earnedRespect += this.calculateRespectGain(gang) * numCycles;\n }\n\n getGainedAscensionPoints(): IMults {\n return {\n hack: Math.max(this.hack_exp - 1000, 0),\n str: Math.max(this.str_exp - 1000, 0),\n def: Math.max(this.def_exp - 1000, 0),\n dex: Math.max(this.dex_exp - 1000, 0),\n agi: Math.max(this.agi_exp - 1000, 0),\n cha: Math.max(this.cha_exp - 1000, 0),\n };\n }\n\n canAscend(): boolean {\n const points = this.getGainedAscensionPoints();\n return points.hack > 0 || points.str > 0 || points.def > 0 || points.dex > 0 || points.agi > 0 || points.cha > 0;\n }\n\n getCurrentAscensionMults(): IMults {\n return {\n hack: this.calculateAscensionMult(this.hack_asc_points),\n str: this.calculateAscensionMult(this.str_asc_points),\n def: this.calculateAscensionMult(this.def_asc_points),\n dex: this.calculateAscensionMult(this.dex_asc_points),\n agi: this.calculateAscensionMult(this.agi_asc_points),\n cha: this.calculateAscensionMult(this.cha_asc_points)\n }\n }\n\n getAscensionMultsAfterAscend(): IMults {\n const points = this.getGainedAscensionPoints();\n return {\n hack: this.calculateAscensionMult(this.hack_asc_points + points.hack),\n str: this.calculateAscensionMult(this.str_asc_points + points.str),\n def: this.calculateAscensionMult(this.def_asc_points + points.def),\n dex: this.calculateAscensionMult(this.dex_asc_points + points.dex),\n agi: this.calculateAscensionMult(this.agi_asc_points + points.agi),\n cha: this.calculateAscensionMult(this.cha_asc_points + points.cha),\n }\n }\n\n getAscensionResults(): IMults {\n const postAscend = this.getAscensionMultsAfterAscend();\n const preAscend = this.getCurrentAscensionMults();\n\n return {\n hack: postAscend.hack / preAscend.hack,\n str: postAscend.str / preAscend.str,\n def: postAscend.def / preAscend.def,\n dex: postAscend.dex / preAscend.dex,\n agi: postAscend.agi / preAscend.agi,\n cha: postAscend.cha / preAscend.cha,\n }\n }\n\n ascend(): IAscensionResult {\n const res = this.getAscensionResults();\n const points = this.getGainedAscensionPoints();\n this.hack_asc_points += points.hack;\n this.str_asc_points += points.str;\n this.def_asc_points += points.def;\n this.dex_asc_points += points.dex;\n this.agi_asc_points += points.agi;\n this.cha_asc_points += points.cha;\n\n // Remove upgrades. Then re-calculate multipliers and stats\n this.upgrades.length = 0;\n this.hack_mult = 1;\n this.str_mult = 1;\n this.def_mult = 1;\n this.dex_mult = 1;\n this.agi_mult = 1;\n this.cha_mult = 1;\n for (let i = 0; i < this.augmentations.length; ++i) {\n const aug = GangMemberUpgrades[this.augmentations[i]];\n this.applyUpgrade(aug);\n }\n\n // Clear exp and recalculate stats\n this.hack_exp = 0;\n this.str_exp = 0;\n this.def_exp = 0;\n this.dex_exp = 0;\n this.agi_exp = 0;\n this.cha_exp = 0;\n this.updateSkillLevels();\n\n const respectToDeduct = this.earnedRespect;\n this.earnedRespect = 0;\n return {\n respect: respectToDeduct,\n hack: res.hack,\n str: res.str,\n def: res.def,\n dex: res.dex,\n agi: res.agi,\n cha: res.cha,\n };\n }\n\n applyUpgrade(upg: GangMemberUpgrade): void {\n if (upg.mults.str != null) this.str_mult *= upg.mults.str;\n if (upg.mults.def != null) this.def_mult *= upg.mults.def;\n if (upg.mults.dex != null) this.dex_mult *= upg.mults.dex;\n if (upg.mults.agi != null) this.agi_mult *= upg.mults.agi;\n if (upg.mults.cha != null) this.cha_mult *= upg.mults.cha;\n if (upg.mults.hack != null) this.hack_mult *= upg.mults.hack;\n }\n\n buyUpgrade(upg: GangMemberUpgrade, player: IPlayer, gang: IGang): boolean {\n // Prevent purchasing of already-owned upgrades\n if (this.augmentations.includes(upg.name) || this.upgrades.includes(upg.name)) return false;\n\n if (player.money.lt(gang.getUpgradeCost(upg))) return false;\n player.loseMoney(gang.getUpgradeCost(upg));\n if (upg.type === \"g\") {\n this.augmentations.push(upg.name);\n } else {\n this.upgrades.push(upg.name);\n }\n this.applyUpgrade(upg);\n return true;\n }\n\n /**\n * Serialize the current object to a JSON save state.\n */\n toJSON(): any {\n return Generic_toJSON(\"GangMember\", this);\n }\n\n /**\n * Initiatizes a GangMember object from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n static fromJSON(value: any): GangMember {\n return Generic_fromJSON(GangMember, value.data);\n }\n}\n\nReviver.constructors.GangMember = GangMember;\n","/**\n * The environment in which a script runs. The environment holds\n * Netscript functions and arguments for that script.\n */\nimport { IMap } from \"../types\";\n\nexport class Environment {\n /**\n * Parent environment. Used to implement \"scope\"\n */\n parent: Environment | null = null;\n\n /**\n * Whether or not the script that uses this Environment should stop running\n */\n stopFlag = false;\n\n /**\n * Environment variables (currently only Netscript functions)\n */\n vars: IMap = {};\n\n constructor(parent: Environment | null) {\n if (parent instanceof Environment) {\n this.vars = Object.assign({}, parent.vars);\n }\n\n this.parent = parent;\n }\n\n /**\n * Finds the scope where the variable with the given name is defined\n */\n lookup(name: string): Environment | null {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let scope: Environment | null = this;\n while (scope) {\n if (Object.prototype.hasOwnProperty.call(scope.vars, name)) {\n return scope;\n }\n scope = scope.parent;\n }\n\n return null;\n }\n\n //Get the current value of a variable\n get(name: string): any {\n if (name in this.vars) {\n return this.vars[name];\n }\n\n throw new Error(`Undefined variable ${name}`);\n }\n\n //Sets the value of a variable in any scope\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n set(name: string, value: any): any {\n const scope = this.lookup(name);\n\n //If scope has a value, then this variable is already set in a higher scope, so\n //set is there. Otherwise, create a new variable in the local scope\n if (scope !== null) {\n return (scope.vars[name] = value);\n } else {\n return (this.vars[name] = value);\n }\n }\n\n //Creates (or overwrites) a variable in the current scope\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n def(name: string, value: any): any {\n return (this.vars[name] = value);\n }\n}\n","import { makeRuntimeRejectMsg } from \"./NetscriptEvaluator\";\nimport { ScriptUrl } from \"./Script/ScriptUrl\";\n\n// Makes a blob that contains the code of a given script.\nfunction makeScriptBlob(code) {\n return new Blob([code], { type: \"text/javascript\" });\n}\n\n// Begin executing a user JS script, and return a promise that resolves\n// or rejects when the script finishes.\n// - script is a script to execute (see Script.js). We depend only on .filename and .code.\n// scripts is an array of other scripts on the server.\n// env is the global environment that should be visible to all the scripts\n// (i.e. hack, grow, etc.).\n// When the promise returned by this resolves, we'll have finished\n// running the main function of the script.\nexport async function executeJSScript(scripts = [], workerScript) {\n let loadedModule;\n let urls = null;\n let script = workerScript.getScript();\n if (shouldCompile(script, scripts)) {\n // The URL at the top is the one we want to import. It will\n // recursively import all the other modules in the urlStack.\n //\n // Webpack likes to turn the import into a require, which sort of\n // but not really behaves like import. Particularly, it cannot\n // load fully dynamic content. So we hide the import from webpack\n // by placing it inside an eval call.\n script.markUpdated();\n urls = _getScriptUrls(script, scripts, []);\n script.url = urls[urls.length - 1].url;\n script.module = new Promise((resolve) => resolve(eval(\"import(urls[urls.length - 1].url)\")));\n script.dependencies = urls;\n }\n loadedModule = await script.module;\n\n let ns = workerScript.env.vars;\n\n try {\n // TODO: putting await in a non-async function yields unhelpful\n // \"SyntaxError: unexpected reserved word\" with no line number information.\n if (!loadedModule.main) {\n throw makeRuntimeRejectMsg(\n workerScript,\n `${script.filename} cannot be run because it does not have a main function.`,\n );\n }\n return loadedModule.main(ns);\n } finally {\n // Revoke the generated URLs\n if (urls != null) {\n for (const b in urls) URL.revokeObjectURL(b.url);\n }\n }\n}\n\n/** Returns whether we should compile the script parameter.\n *\n * @param {Script} script\n * @param {Script[]} scripts\n */\nfunction shouldCompile(script, scripts) {\n if (script.module === \"\") return true;\n return script.dependencies.some((dep) => {\n const depScript = scripts.find((s) => s.filename == dep.filename);\n\n // If the script is not present on the server, we should recompile, if only to get any necessary\n // compilation errors.\n if (!depScript) return true;\n\n const depIsMoreRecent = depScript.moduleSequenceNumber > script.moduleSequenceNumber;\n return depIsMoreRecent;\n });\n}\n\n// Gets a stack of blob urls, the top/right-most element being\n// the blob url for the named script on the named server.\n//\n// - script -- the script for whom we are getting a URL.\n// - scripts -- all the scripts available on this server\n// - seen -- The modules above this one -- to prevent mutual dependency.\n//\n// TODO We don't make any effort to cache a given module when it is imported at\n// different parts of the tree. That hasn't presented any problem with during\n// testing, but it might be an idea for the future. Would require a topo-sort\n// then url-izing from leaf-most to root-most.\n/**\n * @param {Script} script\n * @param {Script[]} scripts\n * @param {Script[]} seen\n * @returns {ScriptUrl[]} All of the compiled scripts, with the final one\n * in the list containing the blob corresponding to\n * the script parameter.\n */\n// BUG: apparently seen is never consulted. Oops.\nfunction _getScriptUrls(script, scripts, seen) {\n // Inspired by: https://stackoverflow.com/a/43834063/91401\n /** @type {ScriptUrl[]} */\n const urlStack = [];\n seen.push(script);\n try {\n // Replace every import statement with an import to a blob url containing\n // the corresponding script. E.g.\n //\n // import {foo} from \"bar.js\";\n //\n // becomes\n //\n // import {foo} from \"blob://\"\n //\n // Where the blob URL contains the script content.\n let transformedCode = script.code.replace(\n /((?:from|import)\\s+(?:'|\"))(?:\\.\\/)?([^'\"]+)('|\")/g,\n (unmodified, prefix, filename, suffix) => {\n const isAllowedImport = scripts.some((s) => s.filename == filename);\n if (!isAllowedImport) return unmodified;\n\n // Find the corresponding script.\n const [importedScript] = scripts.filter((s) => s.filename == filename);\n\n // Try to get a URL for the requested script and its dependencies.\n const urls = _getScriptUrls(importedScript, scripts, seen);\n\n // The top url in the stack is the replacement import file for this script.\n urlStack.push(...urls);\n return [prefix, urls[urls.length - 1].url, suffix].join(\"\");\n },\n );\n\n // We automatically define a print function() in the NetscriptJS module so that\n // accidental calls to window.print() do not bring up the \"print screen\" dialog\n transformedCode += `\\n\\nfunction print() {throw new Error(\"Invalid call to window.print(). Did you mean to use Netscript's print()?\");}`;\n\n // If we successfully transformed the code, create a blob url for it and\n // push that URL onto the top of the stack.\n urlStack.push(new ScriptUrl(script.filename, URL.createObjectURL(makeScriptBlob(transformedCode))));\n return urlStack;\n } catch (err) {\n // If there is an error, we need to clean up the URLs.\n for (const url in urlStack) URL.revokeObjectURL(url);\n throw err;\n } finally {\n seen.pop();\n }\n}\n","export class ScriptUrl {\n filename: string;\n url: string;\n\n constructor(filename: string, url: string) {\n this.filename = filename;\n this.url = url;\n }\n}\n","// Checks whether an array is a 2D array.\n// For this, a 2D array is an array which contains only other arrays.\n// If one element in the array is a number or string, it is NOT a 2D array\nexport function is2DArray(arr: any[]): boolean {\n if (arr.constructor !== Array) {\n return false;\n }\n\n return arr.every((e) => {\n return e.constructor === Array;\n });\n}\n","import { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { Milestones } from \"../Milestones\";\nimport { Milestone } from \"../Milestone\";\nimport * as React from \"react\";\n\nimport Typography from \"@mui/material/Typography\";\nimport Box from \"@mui/material/Box\";\n\ninterface IProps {\n player: IPlayer;\n}\n\nfunction highestMilestone(p: IPlayer, milestones: Milestone[]): number {\n let n = -1;\n for (let i = 0; i < milestones.length; i++) {\n if (milestones[i].fulfilled(p)) n = i;\n }\n\n return n;\n}\n\nexport function MilestonesRoot(props: IProps): JSX.Element {\n const n = highestMilestone(props.player, Milestones);\n const milestones = Milestones.map((milestone: Milestone, i: number) => {\n if (i <= n + 1) {\n return (\n \n [{milestone.fulfilled(props.player) ? \"x\" : \" \"}] {milestone.title}\n \n );\n }\n });\n return (\n <>\n Milestones\n \n \n Milestones don't reward you for completing them. They are here to guide you if you're lost. They will reset\n when you install Augmentations.\n \n
      \n\n Completing fl1ght.exe\n {milestones}\n
      \n \n );\n}\n","import React, { useState, useEffect, useRef } from \"react\";\nimport Typography from \"@mui/material/Typography\";\nimport List from \"@mui/material/List\";\nimport ListItem from \"@mui/material/ListItem\";\nimport { Link as MuiLink } from \"@mui/material\";\nimport { Theme } from \"@mui/material/styles\";\nimport makeStyles from \"@mui/styles/makeStyles\";\nimport createStyles from \"@mui/styles/createStyles\";\nimport Box from \"@mui/material/Box\";\nimport { ITerminal, Output, Link } from \"../ITerminal\";\nimport { IRouter } from \"../../ui/Router\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { TerminalInput } from \"./TerminalInput\";\nimport { TerminalEvents, TerminalClearEvents } from \"../TerminalEvents\";\n\ninterface IActionTimerProps {\n terminal: ITerminal;\n}\n\nfunction ActionTimer({ terminal }: IActionTimerProps): React.ReactElement {\n return (\n \n {terminal.getProgressText()}\n \n );\n}\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n nopadding: {\n padding: theme.spacing(0),\n },\n preformatted: {\n whiteSpace: \"pre-wrap\",\n overflowWrap: \"anywhere\",\n margin: theme.spacing(0),\n },\n list: {\n padding: theme.spacing(0),\n height: \"100%\",\n },\n }),\n);\n\ninterface IProps {\n terminal: ITerminal;\n router: IRouter;\n player: IPlayer;\n}\n\nexport function TerminalRoot({ terminal, router, player }: IProps): React.ReactElement {\n const scrollHook = useRef(null);\n const setRerender = useState(0)[1];\n const [key, setKey] = useState(0);\n function rerender(): void {\n setRerender((old) => old + 1);\n }\n\n function clear(): void {\n setKey((key) => key + 1);\n }\n\n useEffect(() => TerminalEvents.subscribe(rerender), []);\n useEffect(() => TerminalClearEvents.subscribe(clear), []);\n\n function doScroll(): void {\n const hook = scrollHook.current;\n if (hook !== null) {\n setTimeout(() => hook.scrollIntoView(true), 50);\n }\n }\n\n doScroll();\n\n useEffect(() => {\n setTimeout(doScroll, 50);\n }, []);\n\n const classes = useStyles();\n return (\n <>\n \n \n {terminal.outputHistory.map((item, i) => {\n if (item instanceof Output)\n return (\n \n \n {item.text}\n \n \n );\n if (item instanceof Link)\n return (\n \n {item.dashes}>  terminal.connectToServer(player, item.hostname)}\n >\n {item.hostname}\n \n \n );\n })}\n\n {terminal.action !== null && (\n \n {\" \"}\n \n )}\n \n
      \n
      \n \n \n \n \n );\n}\n","import React, { useState, useEffect, useRef } from \"react\";\nimport Typography from \"@mui/material/Typography\";\nimport { Theme } from \"@mui/material/styles\";\nimport makeStyles from \"@mui/styles/makeStyles\";\nimport createStyles from \"@mui/styles/createStyles\";\nimport TextField from \"@mui/material/TextField\";\nimport Paper from \"@mui/material/Paper\";\n\nimport { KEY } from \"../../../utils/helpers/keyCodes\";\nimport { ITerminal } from \"../ITerminal\";\nimport { IRouter } from \"../../ui/Router\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { determineAllPossibilitiesForTabCompletion } from \"../determineAllPossibilitiesForTabCompletion\";\nimport { tabCompletion } from \"../tabCompletion\";\nimport { Settings } from \"../../Settings/Settings\";\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n textfield: {\n margin: theme.spacing(0),\n width: \"100%\",\n },\n input: {\n backgroundColor: \"#000\",\n },\n nopadding: {\n padding: theme.spacing(0),\n },\n preformatted: {\n whiteSpace: \"pre-wrap\",\n margin: theme.spacing(0),\n },\n list: {\n padding: theme.spacing(0),\n height: \"100%\",\n },\n }),\n);\n\ninterface IProps {\n terminal: ITerminal;\n router: IRouter;\n player: IPlayer;\n}\n// Save command in case we de-load this screen.\nlet command = \"\";\n\nexport function TerminalInput({ terminal, router, player }: IProps): React.ReactElement {\n const terminalInput = useRef(null);\n\n const [value, setValue] = useState(command);\n const [possibilities, setPossibilities] = useState([]);\n const classes = useStyles();\n\n function saveValue(value: string): void {\n command = value;\n setValue(value);\n }\n\n function handleValueChange(event: React.ChangeEvent): void {\n saveValue(event.target.value);\n setPossibilities([]);\n }\n\n function modifyInput(mod: string): void {\n const ref = terminalInput.current;\n if (!ref) return;\n const inputLength = value.length;\n const start = ref.selectionStart;\n if (start === null) return;\n const inputText = ref.value;\n\n switch (mod.toLowerCase()) {\n case \"backspace\":\n if (start > 0 && start <= inputLength + 1) {\n saveValue(inputText.substr(0, start - 1) + inputText.substr(start));\n }\n break;\n case \"deletewordbefore\": // Delete rest of word before the cursor\n for (let delStart = start - 1; delStart > 0; --delStart) {\n if (inputText.charAt(delStart) === \" \") {\n saveValue(inputText.substr(0, delStart) + inputText.substr(start));\n return;\n }\n }\n break;\n case \"deletewordafter\": // Delete rest of word after the cursor\n for (let delStart = start + 1; delStart <= value.length + 1; ++delStart) {\n if (inputText.charAt(delStart) === \" \") {\n saveValue(inputText.substr(0, start) + inputText.substr(delStart));\n return;\n }\n }\n break;\n case \"clearafter\": // Deletes everything after cursor\n break;\n case \"clearbefore:\": // Deleetes everything before cursor\n break;\n }\n }\n\n function moveTextCursor(loc: string): void {\n const ref = terminalInput.current;\n if (!ref) return;\n const inputLength = value.length;\n const start = ref.selectionStart;\n if (start === null) return;\n\n switch (loc.toLowerCase()) {\n case \"home\":\n ref.setSelectionRange(0, 0);\n break;\n case \"end\":\n ref.setSelectionRange(inputLength, inputLength);\n break;\n case \"prevchar\":\n if (start > 0) {\n ref.setSelectionRange(start - 1, start - 1);\n }\n break;\n case \"prevword\":\n for (let i = start - 2; i >= 0; --i) {\n if (ref.value.charAt(i) === \" \") {\n ref.setSelectionRange(i + 1, i + 1);\n return;\n }\n }\n ref.setSelectionRange(0, 0);\n break;\n case \"nextchar\":\n ref.setSelectionRange(start + 1, start + 1);\n break;\n case \"nextword\":\n for (let i = start + 1; i <= inputLength; ++i) {\n if (ref.value.charAt(i) === \" \") {\n ref.setSelectionRange(i, i);\n return;\n }\n }\n ref.setSelectionRange(inputLength, inputLength);\n break;\n default:\n console.warn(\"Invalid loc argument in Terminal.moveTextCursor()\");\n break;\n }\n }\n\n // Catch all key inputs and redirect them to the terminal.\n useEffect(() => {\n function keyDown(this: Document, event: KeyboardEvent): void {\n if (terminal.contractOpen) return;\n if (terminal.action !== null && event.keyCode === KEY.C && event.ctrlKey) {\n terminal.finishAction(router, player, true);\n return;\n }\n const ref = terminalInput.current;\n if (event.ctrlKey || event.metaKey) return;\n if (event.keyCode === KEY.C && (event.ctrlKey || event.metaKey)) return; // trying to copy\n\n if (ref) ref.focus();\n }\n document.addEventListener(\"keydown\", keyDown);\n return () => document.removeEventListener(\"keydown\", keyDown);\n });\n\n function onKeyDown(event: React.KeyboardEvent): void {\n // Run command.\n if (event.keyCode === KEY.ENTER && value !== \"\") {\n event.preventDefault();\n terminal.print(`[${player.getCurrentServer().hostname} ~${terminal.cwd()}]> ${value}`);\n terminal.executeCommands(router, player, value);\n saveValue(\"\");\n return;\n }\n\n // Autocomplete\n if (event.keyCode === KEY.TAB && value !== \"\") {\n event.preventDefault();\n\n let copy = value;\n const semiColonIndex = copy.lastIndexOf(\";\");\n if (semiColonIndex !== -1) {\n copy = copy.slice(semiColonIndex + 1);\n }\n\n copy = copy.trim();\n copy = copy.replace(/\\s\\s+/g, \" \");\n\n const commandArray = copy.split(\" \");\n let index = commandArray.length - 2;\n if (index < -1) {\n index = 0;\n }\n const allPos = determineAllPossibilitiesForTabCompletion(player, copy, index, terminal.cwd());\n if (allPos.length == 0) {\n return;\n }\n\n let arg = \"\";\n let command = \"\";\n if (commandArray.length == 0) {\n return;\n }\n if (commandArray.length == 1) {\n command = commandArray[0];\n } else if (commandArray.length == 2) {\n command = commandArray[0];\n arg = commandArray[1];\n } else if (commandArray.length == 3) {\n command = commandArray[0] + \" \" + commandArray[1];\n arg = commandArray[2];\n } else {\n arg = commandArray.pop() + \"\";\n command = commandArray.join(\" \");\n }\n\n const newValue = tabCompletion(command, arg, allPos, value);\n if (typeof newValue === \"string\" && newValue !== \"\") {\n saveValue(newValue);\n }\n if (Array.isArray(newValue)) {\n setPossibilities(newValue);\n }\n }\n\n // Clear screen.\n if (event.keyCode === KEY.L && event.ctrlKey) {\n event.preventDefault();\n terminal.clear();\n }\n\n // Select previous command.\n if (event.keyCode === KEY.UPARROW || (Settings.EnableBashHotkeys && event.keyCode === KEY.P && event.ctrlKey)) {\n if (Settings.EnableBashHotkeys) {\n event.preventDefault();\n }\n const i = terminal.commandHistoryIndex;\n const len = terminal.commandHistory.length;\n\n if (len == 0) {\n return;\n }\n if (i < 0 || i > len) {\n terminal.commandHistoryIndex = len;\n }\n\n if (i != 0) {\n --terminal.commandHistoryIndex;\n }\n const prevCommand = terminal.commandHistory[terminal.commandHistoryIndex];\n saveValue(prevCommand);\n const ref = terminalInput.current;\n if (ref) {\n setTimeout(function () {\n ref.selectionStart = ref.selectionEnd = 10000;\n }, 10);\n }\n }\n\n // Select next command\n if (event.keyCode === KEY.DOWNARROW || (Settings.EnableBashHotkeys && event.keyCode === KEY.M && event.ctrlKey)) {\n if (Settings.EnableBashHotkeys) {\n event.preventDefault();\n }\n const i = terminal.commandHistoryIndex;\n const len = terminal.commandHistory.length;\n\n if (len == 0) {\n return;\n }\n if (i < 0 || i > len) {\n terminal.commandHistoryIndex = len;\n }\n\n // Latest command, put nothing\n if (i == len || i == len - 1) {\n terminal.commandHistoryIndex = len;\n saveValue(\"\");\n } else {\n ++terminal.commandHistoryIndex;\n const prevCommand = terminal.commandHistory[terminal.commandHistoryIndex];\n saveValue(prevCommand);\n }\n }\n\n // Extra Bash Emulation Hotkeys, must be enabled through .fconf\n if (Settings.EnableBashHotkeys) {\n if (event.keyCode === KEY.A && event.ctrlKey) {\n event.preventDefault();\n moveTextCursor(\"home\");\n }\n\n if (event.keyCode === KEY.E && event.ctrlKey) {\n event.preventDefault();\n moveTextCursor(\"end\");\n }\n\n if (event.keyCode === KEY.B && event.ctrlKey) {\n event.preventDefault();\n moveTextCursor(\"prevchar\");\n }\n\n if (event.keyCode === KEY.B && event.altKey) {\n event.preventDefault();\n moveTextCursor(\"prevword\");\n }\n\n if (event.keyCode === KEY.F && event.ctrlKey) {\n event.preventDefault();\n moveTextCursor(\"nextchar\");\n }\n\n if (event.keyCode === KEY.F && event.altKey) {\n event.preventDefault();\n moveTextCursor(\"nextword\");\n }\n\n if ((event.keyCode === KEY.H || event.keyCode === KEY.D) && event.ctrlKey) {\n modifyInput(\"backspace\");\n event.preventDefault();\n }\n\n // TODO AFTER THIS:\n // alt + d deletes word after cursor\n // ^w deletes word before cursor\n // ^k clears line after cursor\n // ^u clears line before cursor\n }\n }\n\n return (\n <>\n {possibilities.length > 0 && (\n \n \n Possible autocomplete candidate:\n \n \n {possibilities.join(\" \")}\n \n \n )}\n \n \n [{player.getCurrentServer().hostname} ~{terminal.cwd()}]> \n \n \n ),\n spellCheck: false,\n onKeyDown: onKeyDown,\n }}\n >\n \n );\n}\n","import { evaluateDirectoryPath, getAllParentDirectories } from \"./DirectoryHelpers\";\nimport { getSubdirectories } from \"./DirectoryServerHelpers\";\n\nimport { Aliases, GlobalAliases } from \"../Alias\";\nimport { DarkWebItems } from \"../DarkWeb/DarkWebItems\";\nimport { Message } from \"../Message/Message\";\nimport { IPlayer } from \"../PersonObjects/IPlayer\";\nimport { AllServers } from \"../Server/AllServers\";\n\n// An array of all Terminal commands\nconst commands = [\n \"alias\",\n \"analyze\",\n \"backdoor\",\n \"cat\",\n \"cd\",\n \"check\",\n \"clear\",\n \"cls\",\n \"connect\",\n \"download\",\n \"expr\",\n \"free\",\n \"hack\",\n \"help\",\n \"home\",\n \"hostname\",\n \"ifconfig\",\n \"kill\",\n \"killall\",\n \"ls\",\n \"lscpu\",\n \"mem\",\n \"mv\",\n \"nano\",\n \"ps\",\n \"rm\",\n \"run\",\n \"scan\",\n \"scan-analyze\",\n \"scp\",\n \"sudov\",\n \"tail\",\n \"theme\",\n \"top\",\n];\n\nexport function determineAllPossibilitiesForTabCompletion(\n p: IPlayer,\n input: string,\n index: number,\n currPath = \"\",\n): string[] {\n let allPos: string[] = [];\n allPos = allPos.concat(Object.keys(GlobalAliases));\n const currServ = p.getCurrentServer();\n const homeComputer = p.getHomeComputer();\n\n let parentDirPath = \"\";\n let evaledParentDirPath: string | null = null;\n\n // Helper functions\n function addAllCodingContracts(): void {\n for (const cct of currServ.contracts) {\n allPos.push(cct.fn);\n }\n }\n\n function addAllLitFiles(): void {\n for (const file of currServ.messages) {\n if (!(file instanceof Message)) {\n allPos.push(file);\n }\n }\n }\n\n function addAllMessages(): void {\n for (const file of currServ.messages) {\n if (file instanceof Message) {\n allPos.push(file.filename);\n }\n }\n }\n\n function addAllPrograms(): void {\n for (const program of homeComputer.programs) {\n allPos.push(program);\n }\n }\n\n function addAllScripts(): void {\n for (const script of currServ.scripts) {\n const res = processFilepath(script.filename);\n if (res) {\n allPos.push(res);\n }\n }\n }\n\n function addAllTextFiles(): void {\n for (const txt of currServ.textFiles) {\n const res = processFilepath(txt.fn);\n if (res) {\n allPos.push(res);\n }\n }\n }\n\n function addAllDirectories(): void {\n // Directories are based on the currently evaluated path\n const subdirs = getSubdirectories(currServ, evaledParentDirPath == null ? \"/\" : evaledParentDirPath);\n\n for (let i = 0; i < subdirs.length; ++i) {\n const assembledDirPath = evaledParentDirPath == null ? subdirs[i] : evaledParentDirPath + subdirs[i];\n const res = processFilepath(assembledDirPath);\n if (res != null) {\n subdirs[i] = res;\n }\n }\n\n allPos = allPos.concat(subdirs);\n }\n\n // Convert from the real absolute path back to the original path used in the input\n function convertParentPath(filepath: string): string {\n if (parentDirPath == null || evaledParentDirPath == null) {\n console.warn(`convertParentPath() called when paths are null`);\n return filepath;\n }\n\n if (!filepath.startsWith(evaledParentDirPath)) {\n console.warn(\n `convertParentPath() called for invalid path. (filepath=${filepath}) (evaledParentDirPath=${evaledParentDirPath})`,\n );\n return filepath;\n }\n\n return parentDirPath + filepath.slice(evaledParentDirPath.length);\n }\n\n // Given an a full, absolute filepath, converts it to the proper value\n // for autocompletion purposes\n function processFilepath(filepath: string): string | null {\n if (evaledParentDirPath) {\n if (filepath.startsWith(evaledParentDirPath)) {\n return convertParentPath(filepath);\n }\n } else if (parentDirPath !== \"\") {\n // If the parent directory is the root directory, but we're not searching\n // it from the root directory, we have to add the original path\n let t_parentDirPath = parentDirPath;\n if (!t_parentDirPath.endsWith(\"/\")) {\n t_parentDirPath += \"/\";\n }\n return parentDirPath + filepath;\n } else {\n return filepath;\n }\n\n return null;\n }\n\n function isCommand(cmd: string): boolean {\n let t_cmd = cmd;\n if (!t_cmd.endsWith(\" \")) {\n t_cmd += \" \";\n }\n\n return input.startsWith(t_cmd);\n }\n\n /**\n * If the command starts with './' and the index == -1, then the user\n * has input ./partialexecutablename so autocomplete the script or program.\n * Put './' in front of each script/executable\n */\n if (isCommand(\"./\") && index == -1) {\n //All programs and scripts\n for (let i = 0; i < currServ.scripts.length; ++i) {\n allPos.push(\"./\" + currServ.scripts[i].filename);\n }\n\n //Programs are on home computer\n for (let i = 0; i < homeComputer.programs.length; ++i) {\n allPos.push(\"./\" + homeComputer.programs[i]);\n }\n return allPos;\n }\n\n // Autocomplete the command\n if (index === -1) {\n return commands.concat(Object.keys(Aliases)).concat(Object.keys(GlobalAliases));\n }\n\n // Since we're autocompleting an argument and not a command, the argument might\n // be a file/directory path. We have to account for that when autocompleting\n const commandArray = input.split(\" \");\n if (commandArray.length === 0) {\n console.warn(`Tab autocompletion logic reached invalid branch`);\n return allPos;\n }\n const arg = commandArray[commandArray.length - 1];\n parentDirPath = getAllParentDirectories(arg);\n evaledParentDirPath = evaluateDirectoryPath(parentDirPath, currPath);\n if (evaledParentDirPath === \"/\") {\n evaledParentDirPath = null;\n } else if (evaledParentDirPath == null) {\n return allPos; // Invalid path\n } else {\n evaledParentDirPath += \"/\";\n }\n\n if (isCommand(\"buy\")) {\n const options = [];\n for (const i in DarkWebItems) {\n const item = DarkWebItems[i];\n options.push(item.program);\n }\n\n return options.concat(Object.keys(GlobalAliases));\n }\n\n if (isCommand(\"scp\") && index === 1) {\n for (const iphostname in AllServers) {\n allPos.push(AllServers[iphostname].ip);\n allPos.push(AllServers[iphostname].hostname);\n }\n\n return allPos;\n }\n\n if (isCommand(\"scp\") && index === 0) {\n addAllScripts();\n addAllLitFiles();\n addAllTextFiles();\n addAllDirectories();\n\n return allPos;\n }\n\n if (isCommand(\"connect\")) {\n // All network connections\n for (let i = 0; i < currServ.serversOnNetwork.length; ++i) {\n const serv = AllServers[currServ.serversOnNetwork[i]];\n if (serv == null) {\n continue;\n }\n allPos.push(serv.ip);\n allPos.push(serv.hostname);\n }\n\n return allPos;\n }\n\n if (isCommand(\"kill\") || isCommand(\"tail\") || isCommand(\"mem\") || isCommand(\"check\")) {\n addAllScripts();\n addAllDirectories();\n\n return allPos;\n }\n\n if (isCommand(\"nano\")) {\n addAllScripts();\n addAllTextFiles();\n allPos.push(\".fconf\");\n addAllDirectories();\n\n return allPos;\n }\n\n if (isCommand(\"rm\")) {\n addAllScripts();\n addAllPrograms();\n addAllLitFiles();\n addAllTextFiles();\n addAllCodingContracts();\n addAllDirectories();\n\n return allPos;\n }\n\n if (isCommand(\"run\")) {\n addAllScripts();\n addAllPrograms();\n addAllCodingContracts();\n addAllDirectories();\n\n return allPos;\n }\n\n if (isCommand(\"cat\")) {\n addAllMessages();\n addAllLitFiles();\n addAllTextFiles();\n addAllDirectories();\n\n return allPos;\n }\n\n if (isCommand(\"download\") || isCommand(\"mv\")) {\n addAllScripts();\n addAllTextFiles();\n addAllDirectories();\n\n return allPos;\n }\n\n if (isCommand(\"cd\")) {\n addAllDirectories();\n\n return allPos;\n }\n\n if (isCommand(\"ls\") && index === 0) {\n addAllDirectories();\n }\n\n return allPos;\n}\n","/**\n * Helper functions that implement \"directory\" functionality in the Terminal.\n * These aren't \"real\" directories, it's more of a pseudo-directory implementation\n * that uses mainly string manipulation.\n *\n * This file contains function that deal with Server-related directory things.\n * Functions that deal with the string manipulation can be found in\n * ./DirectoryHelpers.ts\n */\nimport { isValidDirectoryPath, isInRootDirectory, getFirstParentDirectory } from \"./DirectoryHelpers\";\nimport { BaseServer } from \"../Server/BaseServer\";\n\n/**\n * Given a directory (by the full directory path) and a server, returns all\n * subdirectories of that directory. This is only for FIRST-LEVEl/immediate subdirectories\n */\nexport function getSubdirectories(serv: BaseServer, dir: string): string[] {\n const res: string[] = [];\n\n if (!isValidDirectoryPath(dir)) {\n return res;\n }\n\n let t_dir = dir;\n if (!t_dir.endsWith(\"/\")) {\n t_dir += \"/\";\n }\n\n function processFile(fn: string): void {\n if (t_dir === \"/\" && isInRootDirectory(fn)) {\n const subdir = getFirstParentDirectory(fn);\n if (subdir !== \"/\" && !res.includes(subdir)) {\n res.push(subdir);\n }\n } else if (fn.startsWith(t_dir)) {\n const remaining = fn.slice(t_dir.length);\n const subdir = getFirstParentDirectory(remaining);\n if (subdir !== \"/\" && !res.includes(subdir)) {\n res.push(subdir);\n }\n }\n }\n\n for (const script of serv.scripts) {\n processFile(script.filename);\n }\n\n for (const txt of serv.textFiles) {\n processFile(txt.fn);\n }\n\n return res;\n}\n","import { containsAllStrings, longestCommonStart } from \"../../utils/StringHelperFunctions\";\n\n/**\n * Implements tab completion for the Terminal\n *\n * @param command {string} Terminal command, excluding the last incomplete argument\n * @param arg {string} Last argument that is being completed\n * @param allPossibilities {string[]} All values that `arg` can complete to\n */\nexport function tabCompletion(\n command: string,\n arg: string,\n allPossibilities: string[],\n oldValue: string,\n): string[] | string | undefined {\n if (!(allPossibilities.constructor === Array)) {\n return;\n }\n if (!containsAllStrings(allPossibilities)) {\n return;\n }\n\n // Remove all options in allPossibilities that do not match the current string\n // that we are attempting to autocomplete\n if (arg === \"\") {\n for (let i = allPossibilities.length - 1; i >= 0; --i) {\n if (!allPossibilities[i].toLowerCase().startsWith(command.toLowerCase())) {\n allPossibilities.splice(i, 1);\n }\n }\n } else {\n for (let i = allPossibilities.length - 1; i >= 0; --i) {\n if (!allPossibilities[i].toLowerCase().startsWith(arg.toLowerCase())) {\n allPossibilities.splice(i, 1);\n }\n }\n }\n\n const semiColonIndex = oldValue.lastIndexOf(\";\");\n\n let val = \"\";\n if (allPossibilities.length === 0) {\n return;\n } else if (allPossibilities.length === 1) {\n if (arg === \"\") {\n //Autocomplete command\n val = allPossibilities[0] + \" \";\n } else {\n val = command + \" \" + allPossibilities[0];\n }\n\n if (semiColonIndex === -1) {\n // No semicolon, so replace the whole command\n return val;\n } else {\n // Replace only after the last semicolon\n return oldValue.slice(0, semiColonIndex + 1) + \" \" + val;\n }\n } else {\n const longestStartSubstr = longestCommonStart(allPossibilities);\n /**\n * If the longest common starting substring of remaining possibilities is the same\n * as whatevers already in terminal, just list all possible options. Otherwise,\n * change the input in the terminal to the longest common starting substr\n */\n if (arg === \"\") {\n if (longestStartSubstr === command) {\n return allPossibilities;\n } else {\n if (semiColonIndex === -1) {\n // No semicolon, so replace the whole command\n return longestStartSubstr;\n } else {\n // Replace only after the last semicolon\n return `${oldValue.slice(0, semiColonIndex + 1)} ${longestStartSubstr}`;\n }\n }\n } else {\n if (longestStartSubstr === arg) {\n // List all possible options\n return allPossibilities;\n } else {\n if (semiColonIndex == -1) {\n // No semicolon, so replace the whole command\n return `${command} ${longestStartSubstr}`;\n } else {\n // Replace only after the last semicolon\n return `${oldValue.slice(0, semiColonIndex + 1)} ${command} ${longestStartSubstr}`;\n }\n }\n }\n }\n}\n","import React from \"react\";\n\nimport Typography from \"@mui/material/Typography\";\nimport Link from \"@mui/material/Link\";\nimport Box from \"@mui/material/Box\";\nexport function TutorialRoot(): React.ReactElement {\n return (\n <>\n Tutorial (AKA Links to Documentation)\n \n \n Getting Started\n \n
      \n \n Servers & Networking\n \n
      \n \n Hacking\n \n
      \n \n Scripts\n \n
      \n \n Netscript Programming Language\n \n
      \n \n Traveling\n \n
      \n \n Companies\n \n
      \n \n Infiltration\n \n
      \n \n Factions\n \n
      \n \n Augmentations\n \n
      \n \n Keyboard Shortcuts\n \n
      \n \n );\n}\n","/**\n * Root React Component for the \"Active Scripts\" UI page. This page displays\n * and provides information about all of the player's scripts that are currently running\n */\nimport React, { useState, useEffect } from \"react\";\n\nimport { ScriptProduction } from \"./ScriptProduction\";\nimport { ServerAccordions } from \"./ServerAccordions\";\n\nimport { WorkerScript } from \"../../Netscript/WorkerScript\";\n\nimport Typography from \"@mui/material/Typography\";\n\ntype IProps = {\n workerScripts: Map;\n};\n\nexport function ActiveScriptsRoot(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => {\n const id = setInterval(rerender, 20);\n return () => clearInterval(id);\n }, []);\n\n return (\n <>\n \n This page displays a list of all of your scripts that are currently running across every machine. It also\n provides information about each script's production. The scripts are categorized by the hostname of the servers\n on which they are running.\n \n\n \n \n \n );\n}\n","/**\n * React Component for displaying the total production and production rate\n * of scripts on the 'Active Scripts' UI page\n */\nimport * as React from \"react\";\n\nimport { Money } from \"../React/Money\";\nimport { MoneyRate } from \"../React/MoneyRate\";\nimport { use } from \"../Context\";\n\nimport Typography from \"@mui/material/Typography\";\n\nimport { Theme } from \"@mui/material/styles\";\nimport makeStyles from \"@mui/styles/makeStyles\";\nimport createStyles from \"@mui/styles/createStyles\";\nimport Table from \"@mui/material/Table\";\nimport TableBody from \"@mui/material/TableBody\";\nimport TableCell from \"@mui/material/TableCell\";\nimport TableRow from \"@mui/material/TableRow\";\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n cell: {\n borderBottom: \"none\",\n padding: theme.spacing(1),\n margin: theme.spacing(1),\n whiteSpace: \"nowrap\",\n },\n size: {\n width: \"1px\",\n },\n }),\n);\nexport function ScriptProduction(): React.ReactElement {\n const player = use.Player();\n const classes = useStyles();\n const prodRateSinceLastAug = player.scriptProdSinceLastAug / (player.playtimeSinceLastAug / 1000);\n\n return (\n \n \n \n \n Total production:\n \n \n \n \n \n \n \n \n ()\n \n \n \n \n
      \n );\n}\n","/**\n * React Component for rendering the Accordion elements for all servers\n * on which scripts are running\n */\nimport React, { useState, useEffect } from \"react\";\n\nimport { ServerAccordion } from \"./ServerAccordion\";\n\nimport TextField from \"@mui/material/TextField\";\nimport List from \"@mui/material/List\";\nimport TablePagination from \"@mui/material/TablePagination\";\nimport { WorkerScript } from \"../../Netscript/WorkerScript\";\nimport { WorkerScriptStartStopEventEmitter } from \"../../Netscript/WorkerScriptStartStopEventEmitter\";\nimport { getServer } from \"../../Server/ServerHelpers\";\nimport { BaseServer } from \"../../Server/BaseServer\";\nimport { Settings } from \"../../Settings/Settings\";\nimport { TablePaginationActionsAll } from \"../React/TablePaginationActionsAll\";\nimport SearchIcon from \"@mui/icons-material/Search\";\n\n// Map of server hostname -> all workerscripts on that server for all active scripts\ninterface IServerData {\n server: BaseServer;\n workerScripts: WorkerScript[];\n}\n\ninterface IServerToScriptsMap {\n [key: string]: IServerData | undefined;\n}\n\ntype IProps = {\n workerScripts: Map;\n};\n\nexport function ServerAccordions(props: IProps): React.ReactElement {\n const [filter, setFilter] = useState(\"\");\n const [page, setPage] = useState(0);\n const [rowsPerPage, setRowsPerPage] = useState(Settings.ActiveScriptsServerPageSize);\n const setRerender = useState(false)[1];\n\n const handleChangePage = (event: unknown, newPage: number): void => {\n setPage(newPage);\n };\n\n const handleChangeRowsPerPage = (event: React.ChangeEvent): void => {\n Settings.ActiveScriptsServerPageSize = parseInt(event.target.value, 10);\n setRowsPerPage(parseInt(event.target.value, 10));\n setPage(0);\n };\n\n function handleFilterChange(event: React.ChangeEvent): void {\n setFilter(event.target.value);\n setPage(0);\n }\n\n const serverToScriptMap: IServerToScriptsMap = {};\n for (const ws of props.workerScripts.values()) {\n const server = getServer(ws.serverIp);\n if (server == null) {\n console.warn(`WorkerScript has invalid IP address: ${ws.serverIp}`);\n continue;\n }\n\n let data = serverToScriptMap[server.hostname];\n\n if (data === undefined) {\n serverToScriptMap[server.hostname] = {\n server: server,\n workerScripts: [],\n };\n data = serverToScriptMap[server.hostname];\n }\n if (data !== undefined) data.workerScripts.push(ws);\n }\n\n const filtered = Object.values(serverToScriptMap).filter((data) => data && data.server.hostname.includes(filter));\n\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => WorkerScriptStartStopEventEmitter.subscribe(rerender));\n\n return (\n <>\n ,\n spellCheck: false,\n }}\n />\n \n {filtered.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((data) => {\n return (\n data && (\n \n )\n );\n })}\n \n \n \n );\n}\n","/**\n * React Component for rendering the Accordion element for a single\n * server in the 'Active Scripts' UI page\n */\nimport * as React from \"react\";\n\nimport Typography from \"@mui/material/Typography\";\n\nimport ListItemButton from \"@mui/material/ListItemButton\";\nimport ListItemText from \"@mui/material/ListItemText\";\n\nimport Paper from \"@mui/material/Paper\";\nimport Box from \"@mui/material/Box\";\nimport Collapse from \"@mui/material/Collapse\";\nimport ExpandMore from \"@mui/icons-material/ExpandMore\";\nimport ExpandLess from \"@mui/icons-material/ExpandLess\";\nimport { ServerAccordionContent } from \"./ServerAccordionContent\";\n\nimport { BaseServer } from \"../../Server/BaseServer\";\nimport { WorkerScript } from \"../../Netscript/WorkerScript\";\n\nimport { createProgressBarText } from \"../../../utils/helpers/createProgressBarText\";\n\ntype IProps = {\n server: BaseServer;\n workerScripts: WorkerScript[];\n};\n\nexport function ServerAccordion(props: IProps): React.ReactElement {\n const [open, setOpen] = React.useState(false);\n const server = props.server;\n\n // Accordion's header text\n // TODO: calculate the longest hostname length rather than hard coding it\n const longestHostnameLength = 18;\n const paddedName = `${server.hostname}${\" \".repeat(longestHostnameLength)}`.slice(\n 0,\n Math.max(server.hostname.length, longestHostnameLength),\n );\n const barOptions = {\n progress: server.ramUsed / server.maxRam,\n totalTicks: 30,\n };\n const headerTxt = `${paddedName} ${createProgressBarText(barOptions)}`;\n\n return (\n \n setOpen((old) => !old)}>\n {headerTxt}} />\n {open ? : }\n \n \n \n \n \n \n \n );\n}\n","import React, { useState } from \"react\";\nimport { WorkerScript } from \"../../Netscript/WorkerScript\";\nimport { WorkerScriptAccordion } from \"./WorkerScriptAccordion\";\nimport List from \"@mui/material/List\";\nimport TablePagination from \"@mui/material/TablePagination\";\nimport { TablePaginationActionsAll } from \"../React/TablePaginationActionsAll\";\nimport { Settings } from \"../../Settings/Settings\";\n\ninterface IProps {\n workerScripts: WorkerScript[];\n}\n\nexport function ServerAccordionContent(props: IProps): React.ReactElement {\n const [page, setPage] = useState(0);\n const [rowsPerPage, setRowsPerPage] = useState(Settings.ActiveScriptsScriptPageSize);\n const handleChangePage = (event: unknown, newPage: number): void => {\n setPage(newPage);\n };\n\n const handleChangeRowsPerPage = (event: React.ChangeEvent): void => {\n Settings.ActiveScriptsScriptPageSize = parseInt(event.target.value, 10);\n setRowsPerPage(parseInt(event.target.value, 10));\n setPage(0);\n };\n\n return (\n <>\n \n {props.workerScripts.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((ws) => (\n \n ))}\n \n \n \n );\n}\n","/**\n * React Component for displaying a single WorkerScript's info as an\n * Accordion element\n */\nimport * as React from \"react\";\n\nimport { numeralWrapper } from \"../numeralFormat\";\n\nimport Table from \"@mui/material/Table\";\nimport TableCell from \"@mui/material/TableCell\";\nimport TableRow from \"@mui/material/TableRow\";\nimport TableBody from \"@mui/material/TableBody\";\nimport Button from \"@mui/material/Button\";\nimport Box from \"@mui/material/Box\";\nimport Paper from \"@mui/material/Paper\";\nimport Typography from \"@mui/material/Typography\";\nimport IconButton from \"@mui/material/IconButton\";\nimport DeleteIcon from \"@mui/icons-material/Delete\";\nimport ListItemButton from \"@mui/material/ListItemButton\";\nimport ListItemText from \"@mui/material/ListItemText\";\nimport makeStyles from \"@mui/styles/makeStyles\";\n\nimport Collapse from \"@mui/material/Collapse\";\nimport ExpandLess from \"@mui/icons-material/ExpandLess\";\nimport ExpandMore from \"@mui/icons-material/ExpandMore\";\n\nimport { killWorkerScript } from \"../../Netscript/killWorkerScript\";\nimport { WorkerScript } from \"../../Netscript/WorkerScript\";\n\nimport { dialogBoxCreate } from \"../../../utils/DialogBox\";\nimport { logBoxCreate } from \"../../../utils/LogBox\";\nimport { convertTimeMsToTimeElapsedString } from \"../../../utils/StringHelperFunctions\";\nimport { arrayToString } from \"../../../utils/helpers/arrayToString\";\nimport { Money } from \"../React/Money\";\nimport { MoneyRate } from \"../React/MoneyRate\";\n\nconst useStyles = makeStyles({\n noborder: {\n borderBottom: \"none\",\n },\n});\n\ntype IProps = {\n workerScript: WorkerScript;\n};\n\nexport function WorkerScriptAccordion(props: IProps): React.ReactElement {\n const classes = useStyles();\n const [open, setOpen] = React.useState(false);\n const workerScript = props.workerScript;\n const scriptRef = workerScript.scriptRef;\n\n const logClickHandler = logBoxCreate.bind(null, scriptRef);\n const killScript = killWorkerScript.bind(null, scriptRef as any, scriptRef.server);\n\n function killScriptClickHandler(): void {\n killScript();\n dialogBoxCreate(\"Killing script\");\n }\n\n // Calculations for script stats\n const onlineMps = scriptRef.onlineMoneyMade / scriptRef.onlineRunningTime;\n const onlineEps = scriptRef.onlineExpGained / scriptRef.onlineRunningTime;\n\n return (\n <>\n setOpen((old) => !old)} component={Paper}>\n └ {props.workerScript.name}} />\n {open ? : }\n \n \n \n \n \n \n \n └ Threads:\n \n \n {numeralWrapper.formatThreads(props.workerScript.scriptRef.threads)}\n \n \n \n \n └ Args: {arrayToString(props.workerScript.args)}\n \n \n \n \n └ Online Time:\n \n \n {convertTimeMsToTimeElapsedString(scriptRef.onlineRunningTime * 1e3)}\n \n \n \n \n └ Offline Time:\n \n \n {convertTimeMsToTimeElapsedString(scriptRef.offlineRunningTime * 1e3)}\n \n \n \n \n └ Total online production:\n \n \n \n \n \n \n \n \n \n \n  {numeralWrapper.formatExp(scriptRef.onlineExpGained) + \" hacking exp\"}\n \n \n\n \n \n └ Online production rate:\n \n \n \n \n \n \n \n \n \n \n  {numeralWrapper.formatExp(onlineEps) + \" hacking exp / sec\"}\n \n \n\n \n \n └ Total offline production:\n \n \n \n \n \n \n \n \n \n \n  {numeralWrapper.formatExp(scriptRef.offlineExpGained) + \" hacking exp\"}\n \n \n \n
      \n\n \n \n \n \n
      \n
      \n \n );\n}\n","import React, { useState, useEffect } from \"react\";\nimport { IPlayer } from \"../../PersonObjects/IPlayer\";\nimport { IRouter } from \"../../ui/Router\";\nimport { Factions } from \"../Factions\";\nimport { Faction } from \"../Faction\";\nimport { joinFaction } from \"../FactionHelpers\";\n\nimport Typography from \"@mui/material/Typography\";\nimport Box from \"@mui/material/Box\";\nimport Link from \"@mui/material/Link\";\nimport Button from \"@mui/material/Button\";\nimport TableBody from \"@mui/material/TableBody\";\nimport { Table, TableCell } from \"../../ui/React/Table\";\nimport TableRow from \"@mui/material/TableRow\";\n\ninterface IProps {\n player: IPlayer;\n router: IRouter;\n}\n\nexport function FactionsRoot(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n useEffect(() => {\n const id = setInterval(rerender, 1000);\n return () => clearInterval(id);\n }, []);\n function openFaction(faction: Faction): void {\n props.router.toFaction(faction);\n }\n\n function acceptInvitation(event: React.MouseEvent, faction: string): void {\n if (!event.isTrusted) return;\n joinFaction(Factions[faction]);\n setRerender((x) => !x);\n }\n\n return (\n <>\n \n Factions\n \n Lists all factions you have joined\n
      \n \n {props.player.factions.map((faction: string) => (\n openFaction(Factions[faction])}>\n {faction}\n \n ))}\n \n
      \n {props.player.factionInvitations.length > 0 && (\n <>\n \n Outstanding Faction Invitations\n \n \n Lists factions you have been invited to. You can accept these faction invitations at any time.\n \n \n \n {props.player.factionInvitations.map((faction: string) => (\n \n \n {faction}\n \n \n \n \n \n ))}\n \n
      \n \n )}\n \n );\n}\n","import React, { useEffect } from \"react\";\n\nimport { startHackingMission } from \"../../Faction/FactionHelpers\";\nimport { Faction } from \"../../Faction/Faction\";\n\ninterface IProps {\n faction: Faction;\n}\n\nexport function HackingMissionRoot(props: IProps): React.ReactElement {\n useEffect(() => startHackingMission(props.faction));\n return
      ;\n}\n","/**\n * Root React Component for displaying a Faction's UI.\n * This is the component for displaying a single faction's UI, not the list of all\n * accessible factions\n */\nimport React, { useState, useEffect } from \"react\";\n\nimport { AugmentationsPage } from \"./AugmentationsPage\";\nimport { DonateOption } from \"./DonateOption\";\nimport { Info } from \"./Info\";\nimport { Option } from \"./Option\";\n\nimport { CONSTANTS } from \"../../Constants\";\n\nimport { BitNodeMultipliers } from \"../../BitNode/BitNodeMultipliers\";\nimport { Faction } from \"../../Faction/Faction\";\nimport { createSleevePurchasesFromCovenantPopup } from \"../../PersonObjects/Sleeve/SleeveCovenantPurchases\";\nimport { SourceFileFlags } from \"../../SourceFile/SourceFileFlags\";\n\nimport { createPopup } from \"../../ui/React/createPopup\";\nimport { use } from \"../../ui/Context\";\nimport { CreateGangPopup } from \"./CreateGangPopup\";\n\nimport Typography from \"@mui/material/Typography\";\nimport Button from \"@mui/material/Button\";\n\ntype IProps = {\n faction: Faction;\n};\n\n// Info text for all options on the UI\nconst gangInfo = \"Create and manage a gang for this Faction. Gangs will earn you money and \" + \"faction reputation\";\nconst hackingMissionInfo =\n \"Attempt a hacking mission for your faction. \" +\n \"A mission is a mini game that, if won, earns you \" +\n \"significant reputation with this faction. (Recommended hacking level: 200+)\";\nconst hackingContractsInfo =\n \"Complete hacking contracts for your faction. \" +\n \"Your effectiveness, which determines how much \" +\n \"reputation you gain for this faction, is based on your hacking skill. \" +\n \"You will gain hacking exp.\";\nconst fieldWorkInfo =\n \"Carry out field missions for your faction. \" +\n \"Your effectiveness, which determines how much \" +\n \"reputation you gain for this faction, is based on all of your stats. \" +\n \"You will gain exp for all stats.\";\nconst securityWorkInfo =\n \"Serve in a security detail for your faction. \" +\n \"Your effectiveness, which determines how much \" +\n \"reputation you gain for this faction, is based on your combat stats. \" +\n \"You will gain exp for all combat stats.\";\nconst augmentationsInfo =\n \"As your reputation with this faction rises, you will \" +\n \"unlock Augmentations, which you can purchase to enhance \" +\n \"your abilities.\";\nconst sleevePurchasesInfo = \"Purchase Duplicate Sleeves and upgrades. These are permanent!\";\n\nconst GangNames = [\n \"Slum Snakes\",\n \"Tetrads\",\n \"The Syndicate\",\n \"The Dark Army\",\n \"Speakers for the Dead\",\n \"NiteSec\",\n \"The Black Hand\",\n];\n\nexport function FactionRoot(props: IProps): React.ReactElement {\n const setRerender = useState(false)[1];\n function rerender(): void {\n setRerender((old) => !old);\n }\n\n useEffect(() => {\n const id = setInterval(rerender, 1000);\n return () => clearInterval(id);\n }, []);\n\n const faction = props.faction;\n\n const player = use.Player();\n const router = use.Router();\n const [purchasingAugs, setPurchasingAugs] = useState(false);\n\n function manageGang(faction: Faction): void {\n // If player already has a gang, just go to the gang UI\n if (player.inGang()) {\n return router.toGang();\n }\n\n const popupId = \"create-gang-popup\";\n createPopup(popupId, CreateGangPopup, {\n popupId: popupId,\n facName: faction.name,\n player: player,\n router: router,\n });\n }\n\n\n // Route to the main faction page\n function routeToMain(): void {\n setPurchasingAugs(false);\n }\n\n // Route to the purchase augmentation UI for this faction\n function routeToPurchaseAugs(): void {\n setPurchasingAugs(true);\n }\n\n function sleevePurchases(): void {\n createSleevePurchasesFromCovenantPopup(player);\n }\n\n function startFieldWork(faction: Faction): void {\n player.startFactionFieldWork(router, faction);\n }\n\n function startHackingContracts(faction: Faction): void {\n player.startFactionHackWork(router, faction);\n }\n\n function startHackingMission(faction: Faction): void {\n player.singularityStopWork();\n router.toHackingMission(faction);\n }\n\n function startSecurityWork(faction: Faction): void {\n player.startFactionSecurityWork(router, faction);\n }\n\n function MainPage({ faction }: { faction: Faction }): React.ReactElement {\n const p = player;\n const factionInfo = faction.getInfo();\n\n // We have a special flag for whether the player this faction is the player's\n // gang faction because if the player has a gang, they cannot do any other action\n const isPlayersGang = p.inGang() && p.getGangName() === faction.name;\n\n // Flags for whether special options (gang, sleeve purchases, donate, etc.)\n // should be shown\n const favorToDonate = Math.floor(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction);\n const canDonate = faction.favor >= favorToDonate;\n\n const canPurchaseSleeves = faction.name === \"The Covenant\" && p.bitNodeN >= 10 && SourceFileFlags[10];\n\n let canAccessGang = p.canAccessGang() && GangNames.includes(faction.name);\n if (p.inGang()) {\n if (p.getGangName() !== faction.name) {\n canAccessGang = false;\n } else if (p.getGangName() === faction.name) {\n canAccessGang = true;\n }\n }\n\n return (\n <>\n \n \n {faction.name}\n \n \n {canAccessGang &&