From 5f817c8016c47c6f64a0ab70688b2192cd9e9895 Mon Sep 17 00:00:00 2001 From: danielyxie Date: Sat, 27 Jan 2018 00:52:39 -0600 Subject: [PATCH] V 0.34.2 Changes --- css/companymanagement.css | 1 - css/menupages.css | 20 - dist/bundle.js | 2544 ++++++++++++++++++++++++++----------- index.html | 6 +- src/Company.js | 2 +- src/CompanyManagement.js | 564 +++++--- src/Constants.js | 56 +- src/Literature.js | 15 + src/Location.js | 2 +- src/NetscriptEvaluator.js | 9 +- src/NetscriptFunctions.js | 805 +++++++++++- src/NetscriptWorker.js | 7 +- src/Script.js | 282 ++-- src/Terminal.js | 29 +- src/TextFile.js | 11 + src/engine.js | 10 +- utils/HelperFunctions.js | 3 + 17 files changed, 3242 insertions(+), 1124 deletions(-) diff --git a/css/companymanagement.css b/css/companymanagement.css index 5c0d82d15..cdb80e4e3 100644 --- a/css/companymanagement.css +++ b/css/companymanagement.css @@ -126,7 +126,6 @@ margin:4px; padding:12px; border-radius:25px; - width:45%; color:var(--my-font-color); } diff --git a/css/menupages.css b/css/menupages.css index 0fc5c0adb..20ce88328 100644 --- a/css/menupages.css +++ b/css/menupages.css @@ -64,26 +64,6 @@ margin-right: 0px; } -#script-editor-save-and-close-button, -#script-editor-netscript-doc-button, -#script-editor-status-text { - display: inline-block; -} - -#script-editor-status-text { - margin: 10px; -} - -#script-editor-save-and-close-button { - float:left; -} - -#script-editor-netscript-doc-button { - float: right; - padding-right: 0px; - margin-right: 2px; -} - #script-editor-wrapper { height:100%; width: 70%; diff --git a/dist/bundle.js b/dist/bundle.js index d0fb45222..b7dd2d88b 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -2514,16 +2514,16 @@ function dialogBoxCreate(txt) { /* unused harmony export sizeOfObject */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addOffset; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return clearEventListeners; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getRandomInt; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getRandomInt; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return compareArrays; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return printArray; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return powerOfTwo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return printArray; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return powerOfTwo; }); /* unused harmony export clearEventListenersEl */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return removeElementById; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return createElement; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return createAccordionElement; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return removeChildrenFromElement; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return createPopup; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return removeElementById; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return createElement; }); +/* unused harmony export createAccordionElement */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return removeChildrenFromElement; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return createPopup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return clearSelector; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__StringHelperFunctions_js__ = __webpack_require__(4); //General helper functions @@ -2599,6 +2599,7 @@ function createElement(type, params) { if (params.visibility) {el.style.visibility = params.visibility;} if (params.margin) {el.style.margin = params.margin;} if (params.marginLeft) {el.style.marginLeft = params.marginLeft;} + if (params.marginTop) {el.style.marginTop = params.marginTop;} if (params.padding) {el.style.padding = params.padding;} if (params.color) {el.style.color = params.color;} if (params.border) {el.style.border = params.border;} @@ -2622,6 +2623,8 @@ function createElement(type, params) { innerHTML:params.tooltip })); } + if (params.href) {el.href = params.href;} + if (params.target) {el.target = params.target;} if (params.clickListener) { el.addEventListener("click", params.clickListener); } @@ -2725,7 +2728,7 @@ function powerOfTwo(n) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CONSTANTS; }); let CONSTANTS = { - Version: "0.34.1", + Version: "0.34.2", //Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then @@ -2736,8 +2739,8 @@ let CONSTANTS = { CorpFactionRepRequirement: 250000, /* Base costs */ - BaseCostFor1GBOfRamHome: 30000, - BaseCostFor1GBOfRamServer: 50000, //1 GB of RAM + BaseCostFor1GBOfRamHome: 32000, + BaseCostFor1GBOfRamServer: 55000, //1 GB of RAM BaseCostFor1GBOfRamHacknetNode: 30000, BaseCostForHacknetNode: 1000, @@ -2767,29 +2770,23 @@ let CONSTANTS = { //RAM Costs for different commands ScriptWhileRamCost: 0.2, ScriptForRamCost: 0.2, - ScriptIfRamCost: 0.1, + ScriptIfRamCost: 0.15, ScriptHackRamCost: 0.1, ScriptGrowRamCost: 0.15, ScriptWeakenRamCost: 0.15, ScriptScanRamCost: 0.2, - ScriptNukeRamCost: 0.05, - ScriptBrutesshRamCost: 0.05, - ScriptFtpcrackRamCost: 0.05, - ScriptRelaysmtpRamCost: 0.05, - ScriptHttpwormRamCost: 0.05, - ScriptSqlinjectRamCost: 0.05, - ScriptRunRamCost: 0.8, - ScriptExecRamCost: 1.1, - ScriptScpRamCost: 0.5, + ScriptPortProgramRamCost: 0.05, + ScriptRunRamCost: 1.0, + ScriptExecRamCost: 1.3, + ScriptScpRamCost: 0.6, ScriptKillRamCost: 0.5, //Kill and killall ScriptHasRootAccessRamCost: 0.05, ScriptGetHostnameRamCost: 0.05, //getHostname() and getIp() ScriptGetHackingLevelRamCost: 0.05, //getHackingLevel() ScriptGetMultipliersRamCost: 4.0, //getHackingMultipliers() and getBitNodeMultipliers() - ScriptGetServerCost: 0.1, + ScriptGetServerRamCost: 0.1, ScriptFileExistsRamCost: 0.1, ScriptIsRunningRamCost: 0.1, - ScriptOperatorRamCost: 0.01, ScriptPurchaseHacknetRamCost: 1.5, ScriptHacknetNodesRamCost: 1.0, //Base cost for accessing hacknet nodes array ScriptHNUpgLevelRamCost: 0.4, @@ -2797,7 +2794,7 @@ let CONSTANTS = { ScriptHNUpgCoreRamCost: 0.8, ScriptGetStockRamCost: 2.0, ScriptBuySellStockRamCost: 2.5, - ScriptPurchaseServerRamCost: 2.0, + ScriptPurchaseServerRamCost: 2.25, ScriptRoundRamCost: 0.05, ScriptReadWriteRamCost: 1.0, ScriptArbScriptRamCost: 1.0, //Functions that apply to all scripts regardless of args @@ -3339,8 +3336,8 @@ let CONSTANTS = { "serverExists(hostname/ip)
Returns a boolean denoting whether or not the specified server exists. The argument " + "must be a string with the hostname or IP of the target server.

" + "fileExists(filename, [hostname/ip])
Returns a boolean (true or false) indicating whether the specified file exists on a server. " + - "The first argument must be a string with the name of the file. A file can either be a script, program, or literature file. A script name is case-sensitive, but a " + - "program/literature file is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe.

" + + "The first argument must be a string with the filename. A file can either be a script, program, literature file, or a text file. The filename for a script is case-sensitive, but " + + "for the other files it is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe.

" + "The second argument is a string with the hostname or IP of the server on which to search for the program. This second argument is optional. " + "If it is omitted, then the function will search through the current server (the server running the script that calls this function) for the file.
" + "Example: fileExists('foo.script', 'foodnstuff');
" + @@ -3393,6 +3390,8 @@ let CONSTANTS = { "clear(port/fn)
This function is used to clear a Netscript Port or a text file.

" + "It takes a single argument. If this argument is a number between 1 and 10, then it specifies a port and will clear it (deleting all data from it). " + "If the argument is a string, then it specifies the name of a text file (.txt) and will clear the text file so that it is empty.

" + + "rm(fn)
This function is used to remove a file. It takes a string with the filename as the argument. Returns " + + "true if it successfully deletes the given file, and false otherwise. This function works for every file type except message files (.msg).

" + "scriptRunning(scriptname, hostname/ip)
Returns a boolean indicating whether any instance of the specified script is running " + "on a server, regardless of its arguments. This is different than the isRunning() function because it does not " + "try to identify a specific instance of a running script by its arguments.

" + @@ -3844,6 +3843,30 @@ let CONSTANTS = { LatestUpdate: "v0.34.2
" + + "-Corporation Management Changes:
" + + "---Added advertising mechanics
" + + "---Added Industry-specific purchases
" + + "---Re-designed employee management UI
" + + "---Rebalancing: Made many upgrades/purchases cheaper. Receive more money from investors in early stage. Company valuation is higher after going public
" + + "---Multiple bug fixes
" + + "-Added rm() Netscript function
" + + "-Updated the way script RAM usage is calculated. Now, a function only increases RAM usage the " + + "first time it is called. i.e. even if you call hack() multiple times in a script, it only counts " + + "against RAM usage once. The same change applies for while/for loops and if conditionals.
" + + "-The RAM cost of the following were increased:
" + + "---If statements: increased by 0.05GB
" + + "---run() and exec(): increased by 0.2GB
" + + "---scp(): increased by 0.1GB
" + + "---purchaseServer(): increased by 0.25GB
" + + "-Note: You may need to re-save all of your scripts in order to re-calculate their RAM usages. Otherwise, " + + "it should automatically be re-calculated when you reset/prestige
" + + "-The cost to upgrade your home computer's RAM has been increased (both the base cost and the exponential upgrade multiplier)
" + + "-The cost of purchasing a server was increased by 10% (it is now $55k per RAM)
" + + "-Bug fix: (Hopefully) removed an exploit where you could avoid RAM usage for Netscript function calls " + + "by assigning functions to a variable (foo = hack(); foo('helios');)
" + + "-Bug fix: (Hopefully) removed an exploit where you could run arbitrary Javascript code using the constructor() " + + "method
" + + "-Thanks to Github user mateon1 and Reddit users havoc_mayhem and spaceglace for notifying me of the above exploits
" + "-The fileExists() Netscript function now works on text files (.txt). Thanks to Github user devoidfury for this
" } @@ -3862,7 +3885,7 @@ let CONSTANTS = { /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isPositiveNumber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return containsAllStrings; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return formatNumber; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return numOccurrences; }); +/* unused harmony export numOccurrences */ /* unused harmony export numNetscriptOperators */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isHTML; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__DialogBox_js__ = __webpack_require__(1); @@ -4525,7 +4548,7 @@ let Engine = { /* Display character info */ displayCharacterInfo: function() { - Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["k" /* removeChildrenFromElement */])(Engine.Display.characterInfo); + Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["j" /* removeChildrenFromElement */])(Engine.Display.characterInfo); var companyPosition = ""; if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].companyPosition != "") { @@ -4537,7 +4560,7 @@ let Engine = { intText = 'Intelligence: ' + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].intelligence).toLocaleString() + "


"; } - Engine.Display.characterInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("pre", { + Engine.Display.characterInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("pre", { innerHTML: 'General

' + 'Current City: ' + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].city + '

' + @@ -4596,13 +4619,13 @@ let Engine = { if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].sourceFiles.length !== 0) { var index = "BitNode" + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].bitNodeN; - Engine.Display.characterInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("p", { + Engine.Display.characterInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("p", { width:"60%", innerHTML: "
Current BitNode: " + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].bitNodeN + " (" + __WEBPACK_IMPORTED_MODULE_8__BitNode_js__["b" /* BitNodes */][index].name + ")

", })); - Engine.Display.characterInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("p", { + Engine.Display.characterInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("p", { width:"60%", fontSize: "13px", marginLeft:"4%", innerHTML:__WEBPACK_IMPORTED_MODULE_8__BitNode_js__["b" /* BitNodes */][index].info, })) @@ -4661,8 +4684,8 @@ let Engine = { var genericLocationsList = document.getElementById("generic-locations-list"); genericLocationsList.style.display = "inline"; if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].corporation instanceof __WEBPACK_IMPORTED_MODULE_10__CompanyManagement_js__["a" /* Corporation */] && document.getElementById("location-corporation-button") == null) { - var li = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("li", {}); - li.appendChild(Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var li = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("li", {}); + li.appendChild(Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { innerText:__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].corporation.name, id:"location-corporation-button", class:"a-link-button", clickListener:()=>{ @@ -4970,7 +4993,6 @@ let Engine = { messages: 150, stockTick: 30, //Update stock prices sCr: 1500, - updateScriptEditorDisplay: 5, }, decrementAllCounters: function(numCycles = 1) { @@ -5030,6 +5052,8 @@ let Engine = { if (Engine.Counters.updateDisplaysLong <= 0) { if (Engine.currentPage === Engine.Page.Gang) { Object(__WEBPACK_IMPORTED_MODULE_15__Gang_js__["f" /* updateGangContent */])(); + } else if (Engine.currentPage === Engine.Page.ScriptEditor) { + Object(__WEBPACK_IMPORTED_MODULE_27__Script_js__["f" /* updateScriptEditorContent */])(); } Engine.Counters.updateDisplaysLong = 15; } @@ -5091,13 +5115,6 @@ let Engine = { } Engine.Counters.sCr = 1500; } - - if (Engine.Counters.updateScriptEditorDisplay <= 0) { - if (Engine.currentPage == Engine.Page.ScriptEditor) { - Object(__WEBPACK_IMPORTED_MODULE_27__Script_js__["f" /* updateScriptEditorContent */])(); - } - Engine.Counters.updateScriptEditorDisplay = 5; - } }, /* Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly */ @@ -6000,210 +6017,210 @@ __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].construct function initForeignServers() { //MegaCorporations var ECorpServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "ecorp", "ECorp", false, false, false, 0); - ECorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1150, 1300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(30000000000, 70000000000), 99, 99); + ECorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1150, 1300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(30000000000, 70000000000), 99, 99); ECorpServer.setPortProperties(5); AddToAllServers(ECorpServer); var MegaCorpServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "megacorp", "MegaCorp", false, false, false, 0); - MegaCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1150, 1300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40000000000, 60000000000), 99, 99); + MegaCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1150, 1300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(40000000000, 60000000000), 99, 99); MegaCorpServer.setPortProperties(5); AddToAllServers(MegaCorpServer); var BachmanAndAssociatesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "b-and-a", "Bachman & Associates", false, false, false, 0); - BachmanAndAssociatesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1050), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(65, 75)); + BachmanAndAssociatesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1000, 1050), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(20000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(65, 75)); BachmanAndAssociatesServer.setPortProperties(5); AddToAllServers(BachmanAndAssociatesServer); var BladeIndustriesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "blade", "Blade Industries", false, false, false, 2); - BladeIndustriesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1100), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(12000000000, 20000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(90, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 75)); + BladeIndustriesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1000, 1100), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(12000000000, 20000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(90, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 75)); BladeIndustriesServer.setPortProperties(5); BladeIndustriesServer.messages.push("beyond-man.lit"); AddToAllServers(BladeIndustriesServer); var NWOServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "nwo", "New World Order", false, false, false, 2); - NWOServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(25000000000, 35000000000), 99, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 85)); + NWOServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(25000000000, 35000000000), 99, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(75, 85)); NWOServer.setPortProperties(5); NWOServer.messages.push("the-hidden-world.lit"); AddToAllServers(NWOServer); var ClarkeIncorporatedServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "clarkeinc", "Clarke Incorporated", false, false, false, 2); - ClarkeIncorporatedServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 70)); + ClarkeIncorporatedServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(15000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 70)); ClarkeIncorporatedServer.setPortProperties(5); ClarkeIncorporatedServer.messages.push("beyond-man.lit"); ClarkeIncorporatedServer.messages.push("cost-of-immortality.lit"); AddToAllServers(ClarkeIncorporatedServer); var OmniTekIncorporatedServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "omnitek", "OmniTek Incorporated", false, false, false, 2); - OmniTekIncorporatedServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900, 1100), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000000000, 20000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(90, 99), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(95, 99)); + OmniTekIncorporatedServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(900, 1100), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(15000000000, 20000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(90, 99), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(95, 99)); OmniTekIncorporatedServer.setPortProperties(5); OmniTekIncorporatedServer.messages.push("coded-intelligence.lit"); AddToAllServers(OmniTekIncorporatedServer); var FourSigmaServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "4sigma", "FourSigma", false, false, false, 0); - FourSigmaServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(950, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 99)); + FourSigmaServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(950, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(15000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(75, 99)); FourSigmaServer.setPortProperties(5); AddToAllServers(FourSigmaServer); var KuaiGongInternationalServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "kuai-gong", "KuaiGong International", false, false, false, 0); - KuaiGongInternationalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1250), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000000000, 30000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(95, 99), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(90, 99)); + KuaiGongInternationalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1000, 1250), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(20000000000, 30000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(95, 99), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(90, 99)); KuaiGongInternationalServer.setPortProperties(5); AddToAllServers(KuaiGongInternationalServer); //Technology and communications companies (large targets) var FulcrumTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "fulcrumtech", "Fulcrum Technologies", false, false, false, 64); - FulcrumTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1400000000, 1800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 99)); + FulcrumTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1400000000, 1800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(80, 99)); FulcrumTechnologiesServer.setPortProperties(5); FulcrumTechnologiesServer.messages.push("simulated-reality.lit"); AddToAllServers(FulcrumTechnologiesServer); var FulcrumSecretTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "fulcrumassets", "Fulcrum Technologies Assets", false, false, false, 0); - FulcrumSecretTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1200, 1500), 1000000, 99, 1); + FulcrumSecretTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1200, 1500), 1000000, 99, 1); FulcrumSecretTechnologiesServer.setPortProperties(5); AddToAllServers(FulcrumSecretTechnologiesServer); __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].FulcrumSecretTechnologies, FulcrumSecretTechnologiesServer.ip); var StormTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "stormtech", "Storm Technologies", false, false, false, 0); - StormTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900, 1050), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 90)); + StormTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(900, 1050), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1000000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 90)); StormTechnologiesServer.setPortProperties(5); AddToAllServers(StormTechnologiesServer); var DefCommServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "defcomm", "DefComm", false, false, false, 0); - DefCommServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900, 1000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800000000, 950000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 70)); + DefCommServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(900, 1000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(800000000, 950000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 70)); DefCommServer.setPortProperties(5); AddToAllServers(DefCommServer); var InfoCommServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "infocomm", "InfoComm", false, false, false, 0); - InfoCommServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(875, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(600000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 75)); + InfoCommServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(875, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(600000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(35, 75)); InfoCommServer.setPortProperties(5); AddToAllServers(InfoCommServer); var HeliosLabsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "helios", "Helios Labs", false, false, false, 2); - HeliosLabsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(550000000, 750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80)); + HeliosLabsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(550000000, 750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 80)); HeliosLabsServer.setPortProperties(5); HeliosLabsServer.messages.push("beyond-man.lit"); AddToAllServers(HeliosLabsServer); var VitaLifeServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "vitalife", "VitaLife", false, false, false, 32); - VitaLifeServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(775, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(700000000, 800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80)); + VitaLifeServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(775, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(700000000, 800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 80)); VitaLifeServer.setPortProperties(5); VitaLifeServer.messages.push("A-Green-Tomorrow.lit"); AddToAllServers(VitaLifeServer); var IcarusMicrosystemsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "icarus", "Icarus Microsystems", false, false, false, 0); - IcarusMicrosystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(850, 925), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95)); + IcarusMicrosystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(850, 925), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(900000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(85, 95)); IcarusMicrosystemsServer.setPortProperties(5); AddToAllServers(IcarusMicrosystemsServer); var UniversalEnergyServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "univ-energy", "Universal Energy", false, false, false, 32); - UniversalEnergyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1100000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90)); + UniversalEnergyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1100000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(80, 90)); UniversalEnergyServer.setPortProperties(4); AddToAllServers(UniversalEnergyServer); var TitanLabsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "titan-labs", "Titan Laboratories", false, false, false, 32); - TitanLabsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(750000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80)); + TitanLabsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(800, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(750000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 80)); TitanLabsServer.setPortProperties(5); TitanLabsServer.messages.push("coded-intelligence.lit"); AddToAllServers(TitanLabsServer); var MicrodyneTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "microdyne", "Microdyne Technologies", false, false, false, 16); - MicrodyneTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(500000000, 700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(65, 75), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 90)); + MicrodyneTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(800, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(500000000, 700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(65, 75), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 90)); MicrodyneTechnologiesServer.setPortProperties(5); MicrodyneTechnologiesServer.messages.push("synthetic-muscles.lit"); AddToAllServers(MicrodyneTechnologiesServer); var TaiYangDigitalServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "taiyang-digital", "Taiyang Digital", false, false, false, 2); - TaiYangDigitalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(850, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80)); + TaiYangDigitalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(850, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(800000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 80)); TaiYangDigitalServer.setPortProperties(5); TaiYangDigitalServer.messages.push("A-Green-Tomorrow.lit"); TaiYangDigitalServer.messages.push("brighter-than-the-sun.lit"); AddToAllServers(TaiYangDigitalServer); var GalacticCyberSystemsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "galactic-cyber", "Galactic Cybersystems", false, false, false, 0); - GalacticCyberSystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(825, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(750000000, 850000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 90)); + GalacticCyberSystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(825, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(750000000, 850000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 90)); GalacticCyberSystemsServer.setPortProperties(5); AddToAllServers(GalacticCyberSystemsServer); //Defense Companies ("Large" Companies) var AeroCorpServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "aerocorp", "AeroCorp", false, false, false, 2); - AeroCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(850, 925), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65)); + AeroCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(850, 925), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1000000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(55, 65)); AeroCorpServer.setPortProperties(5); AeroCorpServer.messages.push("man-and-machine.lit"); AddToAllServers(AeroCorpServer); var OmniaCybersystemsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "omnia", "Omnia Cybersystems", false, false, false, 0); - OmniaCybersystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(850, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 70)); + OmniaCybersystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(850, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(900000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 70)); OmniaCybersystemsServer.setPortProperties(5); AddToAllServers(OmniaCybersystemsServer); var ZBDefenseServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "zb-def", "ZB Defense Industries", false, false, false, 2); - ZBDefenseServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(775, 825), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(65, 75)); + ZBDefenseServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(775, 825), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(900000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(65, 75)); ZBDefenseServer.setPortProperties(4); ZBDefenseServer.messages.push("synthetic-muscles.lit"); AddToAllServers(ZBDefenseServer); var AppliedEnergeticsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "applied-energetics", "Applied Energetics", false, false, false, 0); - AppliedEnergeticsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(775, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(700000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 75)); + AppliedEnergeticsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(775, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(700000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 75)); AppliedEnergeticsServer.setPortProperties(4); AddToAllServers(AppliedEnergeticsServer); var SolarisSpaceSystemsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "solaris", "Solaris Space Systems", false, false, false, 2); - SolarisSpaceSystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(750, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(700000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80)); + SolarisSpaceSystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(750, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(700000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 80)); SolarisSpaceSystemsServer.setPortProperties(5); SolarisSpaceSystemsServer.messages.push("A-Green-Tomorrow.lit"); SolarisSpaceSystemsServer.messages.push("the-failed-frontier.lit"); AddToAllServers(SolarisSpaceSystemsServer); var DeltaOneServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "deltaone", "Delta One", false, false, false, 0); - DeltaOneServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1300000000, 1700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 70)); + DeltaOneServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1300000000, 1700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 70)); DeltaOneServer.setPortProperties(5); AddToAllServers(DeltaOneServer); //Health, medicine, pharmaceutical companies ("Large" targets) var GlobalPharmaceuticalsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "global-pharm", "Global Pharmaceuticals", false, false, false, 16); - GlobalPharmaceuticalsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(750, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1500000000, 1750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90)); + GlobalPharmaceuticalsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(750, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1500000000, 1750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(80, 90)); GlobalPharmaceuticalsServer.setPortProperties(4); GlobalPharmaceuticalsServer.messages.push("A-Green-Tomorrow.lit"); AddToAllServers(GlobalPharmaceuticalsServer); var NovaMedicalServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "nova-med", "Nova Medical", false, false, false, 0); - NovaMedicalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(775, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1100000000, 1250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(65, 85)); + NovaMedicalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(775, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1100000000, 1250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(65, 85)); NovaMedicalServer.setPortProperties(4); AddToAllServers(NovaMedicalServer); var ZeusMedicalServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "zeus-med", "Zeus Medical", false, false, false, 0); - ZeusMedicalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1300000000, 1500000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80)); + ZeusMedicalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(800, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1300000000, 1500000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 80)); ZeusMedicalServer.setPortProperties(5); AddToAllServers(ZeusMedicalServer); var UnitaLifeGroupServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "unitalife", "UnitaLife Group", false, false, false, 32); - UnitaLifeGroupServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(775, 825), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80)); + UnitaLifeGroupServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(775, 825), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(1000000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 80)); UnitaLifeGroupServer.setPortProperties(4); AddToAllServers(UnitaLifeGroupServer); //"Medium level" targets var LexoCorpServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "lexo-corp", "Lexo Corporation", false, false, false, 16); - LexoCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(650, 750), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(700000000, 800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65)); + LexoCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(650, 750), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(700000000, 800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(55, 65)); LexoCorpServer.setPortProperties(4); AddToAllServers(LexoCorpServer); var RhoConstructionServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "rho-construction", "Rho Construction", false, false, false, 0); - RhoConstructionServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(475, 525), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(500000000, 700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40, 60)); + RhoConstructionServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(475, 525), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(500000000, 700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(40, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(40, 60)); RhoConstructionServer.setPortProperties(3); AddToAllServers(RhoConstructionServer); var AlphaEnterprisesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "alpha-ent", "Alpha Enterprises", false, false, false, 2); - AlphaEnterprisesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(500, 600), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(600000000, 750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 60)); + AlphaEnterprisesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(500, 600), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(600000000, 750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 60)); AlphaEnterprisesServer.setPortProperties(4); AlphaEnterprisesServer.messages.push("sector-12-crime.lit"); AddToAllServers(AlphaEnterprisesServer); var AevumPoliceServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "aevum-police", "Aevum Police Network", false, false, false, 0); - AevumPoliceServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(400, 450), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(200000000, 400000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(30, 50)); + AevumPoliceServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(400, 450), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(200000000, 400000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(30, 50)); AevumPoliceServer.setPortProperties(4); AddToAllServers(AevumPoliceServer); var RothmanUniversityServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "rothman-uni", "Rothman University Network", false, false, false, 4); - RothmanUniversityServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(370, 430), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(175000000, 250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 55), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 45)); + RothmanUniversityServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(370, 430), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(175000000, 250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(45, 55), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(35, 45)); RothmanUniversityServer.setPortProperties(3); RothmanUniversityServer.messages.push("secret-societies.lit"); RothmanUniversityServer.messages.push("the-failed-frontier.lit"); @@ -6211,12 +6228,12 @@ function initForeignServers() { AddToAllServers(RothmanUniversityServer); var ZBInstituteOfTechnologyServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "zb-institute", "ZB Institute of Technology Network", false, false, false, 4); - ZBInstituteOfTechnologyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(725, 775), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(65, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 85)); + ZBInstituteOfTechnologyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(725, 775), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(800000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(65, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(75, 85)); ZBInstituteOfTechnologyServer.setPortProperties(5); AddToAllServers(ZBInstituteOfTechnologyServer); var SummitUniversityServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "summit-uni", "Summit University Network", false, false, false, 4); - SummitUniversityServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(425, 475), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(200000000, 350000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40, 60)); + SummitUniversityServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(425, 475), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(200000000, 350000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(45, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(40, 60)); SummitUniversityServer.setPortProperties(3); SummitUniversityServer.messages.push("secret-societies.lit"); SummitUniversityServer.messages.push("the-failed-frontier.lit"); @@ -6224,35 +6241,35 @@ function initForeignServers() { AddToAllServers(SummitUniversityServer); var SysCoreSecuritiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "syscore", "SysCore Securities", false, false, false, 0); - SysCoreSecuritiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(550, 650), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(400000000, 600000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 70)); + SysCoreSecuritiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(550, 650), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(400000000, 600000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 70)); SysCoreSecuritiesServer.setPortProperties(4); AddToAllServers(SysCoreSecuritiesServer); var CatalystVenturesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "catalyst", "Catalyst Ventures", false, false, false, 2); - CatalystVenturesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(400, 450), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(300000000, 550000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(25, 55)); + CatalystVenturesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(400, 450), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(300000000, 550000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(25, 55)); CatalystVenturesServer.setPortProperties(3); CatalystVenturesServer.messages.push("tensions-in-tech-race.lit"); AddToAllServers(CatalystVenturesServer); var TheHubServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "the-hub", "The Hub", false, false, false, 0); - TheHubServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(275, 325), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(150000000, 200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 45), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 55)); + TheHubServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(275, 325), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(150000000, 200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(35, 45), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(45, 55)); TheHubServer.setPortProperties(2); AddToAllServers(TheHubServer); var CompuTekServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "comptek", "CompuTek", false, false, false, 8); - CompuTekServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(300, 400), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(220000000, 250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 65)); + CompuTekServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(300, 400), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(220000000, 250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(45, 65)); CompuTekServer.setPortProperties(3); CompuTekServer.messages.push("man-and-machine.lit"); AddToAllServers(CompuTekServer); var NetLinkTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "netlink", "NetLink Technologies", false, false, false, 2); - NetLinkTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(375, 425), 275000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 75)); + NetLinkTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(375, 425), 275000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(45, 75)); NetLinkTechnologiesServer.setPortProperties(3); NetLinkTechnologiesServer.messages.push("simulated-reality.lit"); AddToAllServers(NetLinkTechnologiesServer); var JohnsonOrthopedicsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "johnson-ortho", "Johnson Orthopedics", false, false, false, 4); - JohnsonOrthopedicsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(250, 300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70000000, 85000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 65)); + JohnsonOrthopedicsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(250, 300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(70000000, 85000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(35, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(35, 65)); JohnsonOrthopedicsServer.setPortProperties(2); AddToAllServers(JohnsonOrthopedicsServer); @@ -6317,14 +6334,14 @@ function initForeignServers() { AddToAllServers(MaxHardwareServer); var OmegaSoftwareServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "omega-net", "Omega Software", false, false, false, 32); - OmegaSoftwareServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(180, 220), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60000000, 70000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(25, 35), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(30, 40)); + OmegaSoftwareServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(180, 220), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(60000000, 70000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(25, 35), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(30, 40)); OmegaSoftwareServer.setPortProperties(2); OmegaSoftwareServer.messages.push("the-new-god.lit"); AddToAllServers(OmegaSoftwareServer); //Gyms var CrushFitnessGymServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "crush-fitness", "Crush Fitness", false, false, false, 0); - CrushFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(225, 275), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40000000, 60000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 45), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(27, 33)); + CrushFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(225, 275), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(40000000, 60000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(35, 45), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(27, 33)); CrushFitnessGymServer.setPortProperties(2); AddToAllServers(CrushFitnessGymServer); @@ -6334,23 +6351,23 @@ function initForeignServers() { AddToAllServers(IronGymServer); var MilleniumFitnessGymServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "millenium-fitness", "Millenium Fitness Network", false, false, false, 0); - MilleniumFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(475, 525), 250000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 55), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(25, 45)); + MilleniumFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(475, 525), 250000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(45, 55), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(25, 45)); MilleniumFitnessGymServer.setPortProperties(3); AddToAllServers(MilleniumFitnessGymServer); var PowerhouseGymServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "powerhouse-fitness", "Powerhouse Fitness", false, false, false, 0); - PowerhouseGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(950, 1100), 900000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 60)); + PowerhouseGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(950, 1100), 900000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 60)); PowerhouseGymServer.setPortProperties(5); AddToAllServers(PowerhouseGymServer); var SnapFitnessGymServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "snap-fitness", "Snap Fitness", false, false, false, 0); - SnapFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(675, 800), 450000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40, 60)); + SnapFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(675, 800), 450000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(40, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(40, 60)); SnapFitnessGymServer.setPortProperties(4); AddToAllServers(SnapFitnessGymServer); //Faction servers, cannot hack money from these var BitRunnersServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "run4theh111z", "The Runners", false, false, false, 2); - BitRunnersServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(505, 550), 0, 0, 0); + BitRunnersServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(505, 550), 0, 0, 0); BitRunnersServer.setPortProperties(4); BitRunnersServer.messages.push("simulated-reality.lit"); BitRunnersServer.messages.push("the-new-god.lit"); @@ -6358,27 +6375,27 @@ function initForeignServers() { __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].BitRunnersServer, BitRunnersServer.ip); var TheBlackHandServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "I.I.I.I", "I.I.I.I", false, false, false, 2); - TheBlackHandServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(340, 365), 0, 0, 0); + TheBlackHandServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(340, 365), 0, 0, 0); TheBlackHandServer.setPortProperties(3); TheBlackHandServer.messages.push("democracy-is-dead.lit"); AddToAllServers(TheBlackHandServer); __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].TheBlackHandServer, TheBlackHandServer.ip); var NiteSecServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "avmnite-02h", "NiteSec", false, false, false, 2); - NiteSecServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(202, 220), 0, 0, 0); + NiteSecServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(202, 220), 0, 0, 0); NiteSecServer.setPortProperties(2); NiteSecServer.messages.push("democracy-is-dead.lit"); AddToAllServers(NiteSecServer); __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].NiteSecServer, NiteSecServer.ip); var DarkArmyServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), ".", ".", false, false, false, 0); - DarkArmyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(505, 550), 0, 0, 0); + DarkArmyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(505, 550), 0, 0, 0); DarkArmyServer.setPortProperties(4); AddToAllServers(DarkArmyServer); __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].TheDarkArmyServer, DarkArmyServer.ip); var CyberSecServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "CSEC", "CyberSec", false, false, false, 2); - CyberSecServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(51, 60), 0, 0, 0); + CyberSecServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* getRandomInt */])(51, 60), 0, 0, 0); CyberSecServer.setPortProperties(1); CyberSecServer.messages.push("democracy-is-dead.lit"); AddToAllServers(CyberSecServer); @@ -17338,9 +17355,10 @@ function WorkerScript(runningScriptObj) { this.scriptRef = runningScriptObj; this.errorMessage = ""; this.args = runningScriptObj.args; - //this.killTrigger = function() {}; //CB func used to clear any delays (netscriptDelay()) this.delay = null; this.fnWorker = null; //Workerscript for a function call + this.checkingRam = false; + this.loadedFns = {}; //Stores names of fns that are "loaded" by this script, thus using RAM } //Returns the server on which the workerScript is running @@ -17378,7 +17396,6 @@ function runScriptsLoop() { //items fucks up the indexing for (var i = workerScripts.length - 1; i >= 0; i--) { if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == true) { - console.log("Deleting script: " + workerScripts[i].name); //Delete script from the runningScripts array on its host serverIp var ip = workerScripts[i].serverIp; var name = workerScripts[i].name; @@ -17408,7 +17425,7 @@ function runScriptsLoop() { if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == false) { try { var ast = Object(__WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__["parse"])(workerScripts[i].code); - //console.log(ast); + console.log(ast); } catch (e) { console.log("Error parsing script: " + workerScripts[i].name); Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Syntax ERROR in " + workerScripts[i].name + ":
" + e); @@ -17426,7 +17443,6 @@ function runScriptsLoop() { w.env.stopFlag = true; w.scriptRef.log("Script finished running"); }).catch(function(w) { - console.log(w); if (w instanceof Error) { Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Script runtime unknown error. This is a bug please contact game developer"); console.log("ERROR: Evaluating workerscript returns an Error. THIS SHOULDN'T HAPPEN: " + w.toString()); @@ -17450,7 +17466,7 @@ function runScriptsLoop() { Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Script runtime error:
Server Ip: " + serverIp + "
Script name: " + scriptName + - "
Args:" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["j" /* printArray */])(w.args) + "
" + errorMsg); + "
Args:" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["i" /* printArray */])(w.args) + "
" + errorMsg); w.scriptRef.log("Script crashed with runtime error"); } else { w.scriptRef.log("Script killed"); @@ -17507,7 +17523,7 @@ function addWorkerScript(runningScriptObj, server) { var ramAvailable = server.maxRam - server.ramUsed; if (ramUsage > ramAvailable) { Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Not enough RAM to run script " + runningScriptObj.filename + " with args " + - Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["j" /* printArray */])(runningScriptObj.args) + ". This likely occurred because you re-loaded " + + Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["i" /* printArray */])(runningScriptObj.args) + ". This likely occurred because you re-loaded " + "the game and the script's RAM usage increased (either because of an update to the game or " + "your changes to the script.)"); return; @@ -20393,7 +20409,7 @@ function initLocationButtons() { //Calculate cost //Have cost increase by some percentage each time RAM has been upgraded var cost = currentRam * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome; - var mult = Math.pow(1.55, numUpgrades); + var mult = Math.pow(1.58, numUpgrades); cost = cost * mult; var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])(); @@ -21117,67 +21133,67 @@ function getNumAvailableCreateProgram() { function initCreateProgramButtons() { var createProgramList = document.getElementById("create-program-list"); - nukeALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + nukeALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", id:"create-program-nuke", innerText:Programs.NukeProgram, tooltip:"This virus is used to gain root access to a machine if enough ports are opened.", }); createProgramList.appendChild(nukeALink); - bruteSshALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + bruteSshALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", id:"create-program-brutessh", innerText:Programs.BruteSSHProgram, tooltip:"This program executes a brute force attack that opens SSH ports" }); createProgramList.appendChild(bruteSshALink); - ftpCrackALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + ftpCrackALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", id:"create-program-ftpcrack", innerText:Programs.FTPCrackProgram, tooltip:"This program cracks open FTP ports" }); createProgramList.appendChild(ftpCrackALink); - relaySmtpALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + relaySmtpALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", id:"create-program-relaysmtp", innerText:Programs.RelaySMTPProgram, tooltip:"This program opens SMTP ports by redirecting data" }) ; createProgramList.appendChild(relaySmtpALink); - httpWormALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + httpWormALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", id:"create-program-httpworm", innerText:Programs.HTTPWormProgram, tooltip:"This virus opens up HTTP ports" }); createProgramList.appendChild(httpWormALink); - sqlInjectALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + sqlInjectALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", id:"create-program-sqlinject", innerText:Programs.SQLInjectProgram, tooltip:"This virus opens SQL ports" }); createProgramList.appendChild(sqlInjectALink); - deepscanv1ALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + deepscanv1ALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", id:"create-program-deepscanv1", innerText:Programs.DeepscanV1, tooltip:"This program allows you to use the scan-analyze command with a depth up to 5" }); createProgramList.appendChild(deepscanv1ALink); - deepscanv2ALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + deepscanv2ALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", id:"create-program-deepscanv2", innerText:Programs.DeepscanV2, tooltip:"This program allows you to use the scan-analyze command with a depth up to 10" }); createProgramList.appendChild(deepscanv2ALink); - servProfilerALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + servProfilerALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", id:"create-program-serverprofiler", innerText:Programs.ServerProfiler, tooltip:"This program is used to display hacking and Netscript-related information about servers" }); createProgramList.appendChild(servProfilerALink); - bitFlumeALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + bitFlumeALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", id:"create-program-bitflume", innerText:Programs.BitFlume, tooltip:"This program creates a portal to the BitNode Nexus (allows you to restart and switch BitNodes)" }); createProgramList.appendChild(bitFlumeALink); - autolinkALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", { + autolinkALink = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", id:"create-program-autolink", innerText:"AutoLink.exe", tooltip:"This program allows you to directly connect to other servers through the 'scan-analyze' command" }); @@ -21367,10 +21383,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @preserve /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Server_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Settings_js__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Terminal_js__ = __webpack_require__(23); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_JSONReviver_js__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_acorn_js__ = __webpack_require__(48); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9__utils_acorn_js__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__ = __webpack_require__(7); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_HelperFunctions_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__ = __webpack_require__(4); var ace = __webpack_require__(54); __webpack_require__(56); __webpack_require__(57); @@ -21401,21 +21419,60 @@ __webpack_require__(68); + var keybindings = { ace: null, vim: "ace/keyboard/vim", emacs: "ace/keyboard/emacs", }; +var scriptEditorRamCheck = null, scriptEditorRamText = null; function scriptEditorInit() { - //Initialize save and close button - var closeButton = document.getElementById("script-editor-save-and-close-button"); - - closeButton.addEventListener("click", function() { - saveAndCloseScriptEditor(); - return false; + //Create buttons at the bottom of script editor + var wrapper = document.getElementById("script-editor-buttons-wrapper"); + if (wrapper == null) { + console.log("Error finding 'script-editor-buttons-wrapper'"); + return; + } + var closeButton = Object(__WEBPACK_IMPORTED_MODULE_12__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class:"a-link-button", display:"inline-block", + innerText:"Save & Close (Ctrl + b)", + clickListener:()=>{ + saveAndCloseScriptEditor(); + return false; + } }); + scriptEditorRamText = Object(__WEBPACK_IMPORTED_MODULE_12__utils_HelperFunctions_js__["e" /* createElement */])("p", { + display:"inline-block", margin:"10px", id:"script-editor-status-text" + }); + + var checkboxLabel = Object(__WEBPACK_IMPORTED_MODULE_12__utils_HelperFunctions_js__["e" /* createElement */])("label", { + for:"script-editor-ram-check", margin:"4px", marginTop: "8px", + innerText:"Dynamic RAM Usage Checker", color:"white", + tooltip:"Enable/Disable the dynamic RAM Usage display. You may " + + "want to disable it for very long scripts because there may be " + + "performance issues" + }); + + scriptEditorRamCheck = Object(__WEBPACK_IMPORTED_MODULE_12__utils_HelperFunctions_js__["e" /* createElement */])("input", { + type:"checkbox", name:"script-editor-ram-check", id:"script-editor-ram-check", + margin:"4px", marginTop: "8px", + }); + scriptEditorRamCheck.checked = true; + + var documentationButton = Object(__WEBPACK_IMPORTED_MODULE_12__utils_HelperFunctions_js__["e" /* createElement */])("a", { + display:"inline-block", class:"a-link-button", innerText:"Netscript Documentation", + href:"https://bitburner.wikia.com/wiki/Netscript", + target:"_blank" + }); + + wrapper.appendChild(closeButton); + wrapper.appendChild(scriptEditorRamText); + wrapper.appendChild(scriptEditorRamCheck); + wrapper.appendChild(checkboxLabel); + wrapper.appendChild(documentationButton); + //Initialize ACE Script editor var editor = ace.edit('javascript-editor'); editor.getSession().setMode('ace/mode/netscript'); @@ -21497,14 +21554,19 @@ function scriptEditorInit() { } document.addEventListener("DOMContentLoaded", scriptEditorInit, false); -//Updates line number and RAM usage in script +//Updates RAM usage in script function updateScriptEditorContent() { + if (scriptEditorRamCheck == null || !scriptEditorRamCheck.checked) { + scriptEditorRamText.innerText = "N/A"; + return; + } var editor = ace.edit('javascript-editor'); var code = editor.getValue(); var codeCopy = code.repeat(1); var ramUsage = calculateRamUsage(codeCopy); - document.getElementById("script-editor-status-text").innerText = - "RAM: " + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(ramUsage, 2).toString() + "GB"; + if (ramUsage !== -1) { + scriptEditorRamText.innerText = "RAM: " + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(ramUsage, 2).toString() + "GB"; + } } //Define key commands in script editor (ctrl o to save + close, etc.) @@ -21522,26 +21584,26 @@ function saveAndCloseScriptEditor() { var filename = document.getElementById("script-editor-filename").value; if (__WEBPACK_IMPORTED_MODULE_2__InteractiveTutorial_js__["b" /* iTutorialIsRunning */] && __WEBPACK_IMPORTED_MODULE_2__InteractiveTutorial_js__["a" /* currITutorialStep */] == __WEBPACK_IMPORTED_MODULE_2__InteractiveTutorial_js__["e" /* iTutorialSteps */].TerminalTypeScript) { if (filename != "foodnstuff") { - Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Leave the script name as 'foodnstuff'!"); + Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Leave the script name as 'foodnstuff'!"); return; } var editor = ace.edit('javascript-editor'); var code = editor.getValue(); code = code.replace(/\s/g, ""); if (code.indexOf("while(true){hack('foodnstuff');}") == -1) { - Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Please copy and paste the code from the tutorial!"); + Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Please copy and paste the code from the tutorial!"); return; } Object(__WEBPACK_IMPORTED_MODULE_2__InteractiveTutorial_js__["c" /* iTutorialNextStep */])(); } if (filename == "") { - Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You must specify a filename!"); + Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You must specify a filename!"); return; } if (checkValidFilename(filename) == false) { - Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Script filename can contain only alphanumerics, hyphens, and underscores"); + Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Script filename can contain only alphanumerics, hyphens, and underscores"); return; } @@ -21603,166 +21665,99 @@ Script.prototype.saveScript = function() { //Updates how much RAM the script uses when it is running. Script.prototype.updateRamUsage = function() { var codeCopy = this.code.repeat(1); - this.ramUsage = calculateRamUsage(codeCopy); - console.log("ram usage: " + this.ramUsage); - if (isNaN(this.ramUsage)) { - Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR in calculating ram usage. This is a bug, please report to game develoepr"); + var res = calculateRamUsage(codeCopy); + if (res !== -1) { + this.ramUsage = res; } } function calculateRamUsage(codeCopy) { - codeCopy = codeCopy.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1'); //Delete comments - codeCopy = codeCopy.replace(/\s/g,''); //Remove all whitespace - var baseRam = 1.4; - var whileCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "while("); - var forCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "for("); - var ifCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "if("); - var hackCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "hack("); - var growCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "grow("); - var weakenCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "weaken("); - var scanCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "scan("); - var nukeCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "nuke("); - var brutesshCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "brutessh("); - var ftpcrackCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "ftpcrack("); - var relaysmtpCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "relaysmtp("); - var httpwormCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "httpworm("); - var sqlinjectCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "sqlinject("); - var runCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "run("); - var execCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "exec("); - var killCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "kill(") + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "killall(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "exit("); - var scpCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "scp("); - var hasRootAccessCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "hasRootAccess("); - var getHostnameCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getHostname(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getIp("); - var getHackingLevelCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getHackingLevel("); - var getMultipliersCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getHackingMultipliers(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getBitNodeMultipliers("); - var getServerCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getServerMoneyAvailable(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getServerMaxMoney(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getServerSecurityLevel(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getServerBaseSecurityLevel(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getServerMinSecurityLevel(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getServerGrowth(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getServerRequiredHackingLevel(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getServerNumPortsRequired(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getServerRam(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "serverExists("); - var fileExistsCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "fileExists("); - var isRunningCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "isRunning("); - var purchaseHacknetCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "purchaseHacknetNode("); - var hacknetnodesArrayCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "hacknetnodes["); - var hnUpgLevelCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, ".upgradeLevel("); - var hnUpgRamCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, ".upgradeRam()"); - var hnUpgCoreCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, ".upgradeCore()"); - var scriptGetStockCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getStockPrice(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getStockPosition("); - var scriptBuySellStockCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "buyStock(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "sellStock(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "shortStock(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "sellShort(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "placeOrder(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "cancelOrder("); - var scriptPurchaseServerCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "purchaseServer(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "deleteServer(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getPurchasedServers("); - var scriptRoundCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "round("); - var scriptWriteCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "write(") + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "clear("); - var scriptReadCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "read("); - var arbScriptCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "scriptRunning(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "scriptKill("); - var getScriptCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getScriptRam(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getScriptIncome(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getScriptExpGain("); - var getHackTimeCount = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getHackTime(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getGrowTime(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getWeakenTime(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getTimeSinceLastAug("); - var singFn1Count = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "universityCourse(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "gymWorkout(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "travelToCity(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "purchaseTor(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "purchaseProgram(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getStats(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "isBusy("); - var singFn2Count = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "upgradeHomeRam(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getUpgradeHomeRamCost(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "workForCompany(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "applyToCompany(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getCompanyRep(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "checkFactionInvitations(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "joinFaction(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "workForFaction(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getFactionRep("); - var singFn3Count = Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "createProgram(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "commitCrime(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getCrimeChance(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getOwnedAugmentations(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getAugmentationsFromFaction(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "getAugmentationCost(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "purchaseAugmentation(") + - Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["h" /* numOccurrences */])(codeCopy, "installAugmentations("); + //Create a temporary/mock WorkerScript and an AST from the code + var workerScript = new __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]({ + filename:"foo", + scriptRef: {code:""}, + args:[] + }); + workerScript.checkingRam = true; //Netscript functions will return RAM usage - if (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].bitNodeN != 4) { - singFn1Count *= 10; - singFn2Count *= 10; - singFn3Count *= 10; + try { + var ast = Object(__WEBPACK_IMPORTED_MODULE_9__utils_acorn_js__["parse"])(codeCopy); + } catch(e) { + console.log("returning -1 bc parsing error: " + e.toString()); + return -1; } - return baseRam + - ((whileCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptWhileRamCost) + - (forCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptForRamCost) + - (ifCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptIfRamCost) + - (hackCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptHackRamCost) + - (growCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptGrowRamCost) + - (weakenCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptWeakenRamCost) + - (scanCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptScanRamCost) + - (nukeCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptNukeRamCost) + - (brutesshCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptBrutesshRamCost) + - (ftpcrackCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptFtpcrackRamCost) + - (relaysmtpCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptRelaysmtpRamCost) + - (httpwormCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptHttpwormRamCost) + - (sqlinjectCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptSqlinjectRamCost) + - (runCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptRunRamCost) + - (execCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptExecRamCost) + - (killCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptKillRamCost) + - (scpCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptScpRamCost) + - (hasRootAccessCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptHasRootAccessRamCost) + - (getHostnameCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptGetHostnameRamCost) + - (getHackingLevelCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptGetHackingLevelRamCost) + - (getMultipliersCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptGetMultipliersRamCost) + - (getServerCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptGetServerCost) + - (fileExistsCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptFileExistsRamCost) + - (isRunningCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptIsRunningRamCost) + - (purchaseHacknetCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptPurchaseHacknetRamCost) + - (hacknetnodesArrayCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptHacknetNodesRamCost) + - (hnUpgLevelCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptHNUpgLevelRamCost) + - (hnUpgRamCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptHNUpgRamRamCost) + - (hnUpgCoreCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptHNUpgCoreRamCost) + - (scriptGetStockCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptGetStockRamCost) + - (scriptBuySellStockCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptBuySellStockRamCost) + - (scriptPurchaseServerCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptPurchaseServerRamCost) + - (scriptRoundCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptRoundRamCost) + - (scriptWriteCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptReadWriteRamCost) + - (scriptReadCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptReadWriteRamCost) + - (arbScriptCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptArbScriptRamCost) + - (getScriptCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptGetScriptRamCost) + - (getHackTimeCount * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptGetHackTimeRamCost) + - (singFn1Count * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn1RamCost) + - (singFn2Count * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn2RamCost) + - (singFn3Count * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn3RamCost)); + //Search through AST, scanning for any 'Identifier' nodes for functions, or While/For/If nodes + var queue = [], ramUsage = 1.4; + var whileUsed = false, forUsed = false, ifUsed = false; + queue.push(ast); + while (queue.length != 0) { + var exp = queue.shift(); + switch (exp.type) { + case "BlockStatement": + case "Program": + for (var i = 0; i < exp.body.length; ++i) { + if (exp.body[i] instanceof __WEBPACK_IMPORTED_MODULE_9__utils_acorn_js__["Node"]) { + queue.push(exp.body[i]); + } + } + break; + case "WhileStatement": + if (!whileUsed) { + ramUsage += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptWhileRamCost; + whileUsed = true; + } + break; + case "ForStatement": + if (!forUsed) { + ramUsage += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptForRamCost; + forUsed = true; + } + break; + case "IfStatement": + if (!ifUsed) { + ramUsage += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].ScriptIfRamCost; + ifUsed = true; + } + break; + case "Identifier": + if (exp.name in workerScript.env.vars) { + var func = workerScript.env.get(exp.name); + if (typeof func === "function") { + try { + var res = func.apply(null, []); + if (!isNaN(res)) {ramUsage += res;} + } catch(e) { + console.log("ERROR applying function: " + e); + } + } + } + break; + default: + break; + } + + for (var prop in exp) { + if (exp.hasOwnProperty(prop)) { + if (exp[prop] instanceof __WEBPACK_IMPORTED_MODULE_9__utils_acorn_js__["Node"]) { + queue.push(exp[prop]); + } + } + } + } + return ramUsage; } Script.prototype.toJSON = function() { - return Object(__WEBPACK_IMPORTED_MODULE_10__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Script", this); + return Object(__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Script", this); } Script.fromJSON = function(value) { - return Object(__WEBPACK_IMPORTED_MODULE_10__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Script, value.data); + return Object(__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Script, value.data); } -__WEBPACK_IMPORTED_MODULE_10__utils_JSONReviver_js__["c" /* Reviver */].constructors.Script = Script; +__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["c" /* Reviver */].constructors.Script = Script; //Called when the game is loaded. Loads all running scripts (from all servers) //into worker scripts so that they will start running @@ -21814,7 +21809,7 @@ function scriptCalculateOfflineProduction(runningScriptObj) { console.log(runningScriptObj.filename + " called grow() on " + serv.hostname + " " + timesGrown + " times while offline"); runningScriptObj.log("Called grow() on " + serv.hostname + " " + timesGrown + " times while offline"); var growth = Object(__WEBPACK_IMPORTED_MODULE_6__Server_js__["j" /* processSingleServerGrowth */])(serv, timesGrown * 450); - runningScriptObj.log(serv.hostname + " grown by " + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growth * 100 - 100, 6) + "% from grow() calls made while offline"); + runningScriptObj.log(serv.hostname + " grown by " + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growth * 100 - 100, 6) + "% from grow() calls made while offline"); } } @@ -21885,7 +21880,7 @@ function scriptCalculateOfflineProduction(runningScriptObj) { function findRunningScript(filename, args, server) { for (var i = 0; i < server.runningScripts.length; ++i) { if (server.runningScripts[i].filename == filename && - Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["d" /* compareArrays */])(server.runningScripts[i].args, args)) { + Object(__WEBPACK_IMPORTED_MODULE_12__utils_HelperFunctions_js__["d" /* compareArrays */])(server.runningScripts[i].args, args)) { return server.runningScripts[i]; } } @@ -21966,15 +21961,15 @@ RunningScript.prototype.recordWeaken = function(serverIp, n=1) { } RunningScript.prototype.toJSON = function() { - return Object(__WEBPACK_IMPORTED_MODULE_10__utils_JSONReviver_js__["b" /* Generic_toJSON */])("RunningScript", this); + return Object(__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["b" /* Generic_toJSON */])("RunningScript", this); } RunningScript.fromJSON = function(value) { - return Object(__WEBPACK_IMPORTED_MODULE_10__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(RunningScript, value.data); + return Object(__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(RunningScript, value.data); } -__WEBPACK_IMPORTED_MODULE_10__utils_JSONReviver_js__["c" /* Reviver */].constructors.RunningScript = RunningScript; +__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["c" /* Reviver */].constructors.RunningScript = RunningScript; //Creates an object that creates a map/dictionary with the IP of each existing server as //a key. Initializes every key with a specified value that can either by a number or an array @@ -22006,15 +22001,15 @@ AllServersMap.prototype.printConsole = function() { } AllServersMap.prototype.toJSON = function() { - return Object(__WEBPACK_IMPORTED_MODULE_10__utils_JSONReviver_js__["b" /* Generic_toJSON */])("AllServersMap", this); + return Object(__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["b" /* Generic_toJSON */])("AllServersMap", this); } AllServersMap.fromJSON = function(value) { - return Object(__WEBPACK_IMPORTED_MODULE_10__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(AllServersMap, value.data); + return Object(__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(AllServersMap, value.data); } -__WEBPACK_IMPORTED_MODULE_10__utils_JSONReviver_js__["c" /* Reviver */].constructors.AllServersMap = AllServersMap; +__WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["c" /* Reviver */].constructors.AllServersMap = AllServersMap; @@ -24465,7 +24460,7 @@ let CompanyPositions = { CompanyPositions.VicePresident.setPerformanceParameters(70, 0, 0, 0, 0, 30, 1.75); CompanyPositions.VicePresident.setExperienceGains(1.2, 0, 0, 0, 0, .6); CompanyPositions.CTO.setPerformanceParameters(65, 0, 0, 0, 0, 35, 2); - CompanyPositions.CTO.setExperienceGains(1.5, 0, 0, 0, 1); + CompanyPositions.CTO.setExperienceGains(1.5, 0, 0, 0, 0, 1); //Business CompanyPositions.BusinessIntern.setPerformanceParameters(10, 0, 0, 0, 0, 90, 0.9); @@ -25377,6 +25372,14 @@ function NetscriptFunctions(workerScript) { sprintf : sprintf, vsprintf: vsprintf, scan : function(ip=workerScript.serverIp, hostnames=true){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.scan) { + return 0; + } else { + workerScript.loadedFns.scan = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptScanRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, 'Invalid IP or hostname passed into scan() command'); @@ -25398,6 +25401,14 @@ function NetscriptFunctions(workerScript) { return out; }, hack : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.hack) { + return 0; + } else { + workerScript.loadedFns.hack = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptHackRamCost; + } + } if (ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Hack() call has incorrect number of arguments. Takes 1 argument"); } @@ -25465,6 +25476,7 @@ function NetscriptFunctions(workerScript) { }); }, sleep : function(time,log=true){ + if (workerScript.checkingRam) {return 0;} if (time === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "sleep() call has incorrect number of arguments. Takes 1 argument"); } @@ -25476,6 +25488,14 @@ function NetscriptFunctions(workerScript) { }); }, grow : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.grow) { + return 0; + } else { + workerScript.loadedFns.grow = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGrowRamCost; + } + } var threads = workerScript.scriptRef.threads; if (isNaN(threads) || threads < 1) {threads = 1;} if (ip === undefined) { @@ -25514,6 +25534,14 @@ function NetscriptFunctions(workerScript) { }); }, weaken : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.weaken) { + return 0; + } else { + workerScript.loadedFns.weaken = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptWeakenRamCost; + } + } var threads = workerScript.scriptRef.threads; if (isNaN(threads) || threads < 1) {threads = 1;} if (ip === undefined) { @@ -25547,12 +25575,14 @@ function NetscriptFunctions(workerScript) { }); }, print : function(args){ + if (workerScript.checkingRam) {return 0;} if (args === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "print() call has incorrect number of arguments. Takes 1 argument"); } workerScript.scriptRef.log(args.toString()); }, tprint : function(args) { + if (workerScript.checkingRam) {return 0;} if (args === undefined || args == null) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "tprint() call has incorrect number of arguments. Takes 1 argument"); } @@ -25567,9 +25597,18 @@ function NetscriptFunctions(workerScript) { Object(__WEBPACK_IMPORTED_MODULE_20__Terminal_js__["b" /* post */])(workerScript.scriptRef.filename + ": " + args.toString()); }, clearLog : function() { + if (workerScript.checkingRam) {return 0;} workerScript.scriptRef.clearLog(); }, nuke : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.nuke) { + return 0; + } else { + workerScript.loadedFns.nuke = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -25593,6 +25632,14 @@ function NetscriptFunctions(workerScript) { return true; }, brutessh : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.brutessh) { + return 0; + } else { + workerScript.loadedFns.brutessh = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -25615,6 +25662,14 @@ function NetscriptFunctions(workerScript) { return true; }, ftpcrack : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.ftpcrack) { + return 0; + } else { + workerScript.loadedFns.ftpcrack = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -25636,6 +25691,14 @@ function NetscriptFunctions(workerScript) { return true; }, relaysmtp : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.relaysmtp) { + return 0; + } else { + workerScript.loadedFns.relaysmtp = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -25657,6 +25720,14 @@ function NetscriptFunctions(workerScript) { return true; }, httpworm : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.httpworm) { + return 0; + } else { + workerScript.loadedFns.httpworm = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -25678,6 +25749,14 @@ function NetscriptFunctions(workerScript) { return true; }, sqlinject : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.sqlinject) { + return 0; + } else { + workerScript.loadedFns.sqlinject = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -25699,6 +25778,14 @@ function NetscriptFunctions(workerScript) { return true; }, run : function(scriptname,threads = 1){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.run) { + return 0; + } else { + workerScript.loadedFns.run = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptRunRamCost; + } + } if (scriptname === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "run() call has incorrect number of arguments. Usage: run(scriptname, [numThreads], [arg1], [arg2]...)"); } @@ -25716,7 +25803,15 @@ function NetscriptFunctions(workerScript) { return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["f" /* runScriptFromScript */])(scriptServer, scriptname, argsForNewScript, workerScript, threads); }, - exec : function(scriptname,ip,threads = 1){ + exec : function(scriptname,ip,threads = 1) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.exec) { + return 0; + } else { + workerScript.loadedFns.exec = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptExecRamCost; + } + } if (scriptname === undefined || ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "exec() call has incorrect number of arguments. Usage: exec(scriptname, server, [numThreads], [arg1], [arg2]...)"); } @@ -25733,7 +25828,16 @@ function NetscriptFunctions(workerScript) { } return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["f" /* runScriptFromScript */])(server, scriptname, argsForNewScript, workerScript, threads); }, - kill : function(filename,ip){ + kill : function(filename,ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.kill) { + return 0; + } else { + workerScript.loadedFns.kill = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptKillRamCost; + } + } + if (filename === undefined || ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "kill() call has incorrect number of arguments. Usage: kill(scriptname, server, [arg1], [arg2]...)"); } @@ -25748,19 +25852,28 @@ function NetscriptFunctions(workerScript) { } var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(filename, argsForKillTarget, server); if (runningScriptObj == null) { - workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForKillTarget)); + workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["i" /* printArray */])(argsForKillTarget)); return false; } var res = Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScriptObj, server.ip); if (res) { - workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForKillTarget) + ". May take up to a few minutes for the scripts to die..."); + workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["i" /* printArray */])(argsForKillTarget) + ". May take up to a few minutes for the scripts to die..."); return true; } else { - workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForKillTarget)); + workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["i" /* printArray */])(argsForKillTarget)); return false; } }, killall : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.killall) { + return 0; + } else { + workerScript.loadedFns.killall = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptKillRamCost; + } + } + if (ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "killall() call has incorrect number of arguments. Takes 1 argument"); } @@ -25776,6 +25889,14 @@ function NetscriptFunctions(workerScript) { return true; }, exit : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.exit) { + return 0; + } else { + workerScript.loadedFns.exit = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptKillRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp); if (server == null) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error getting Server for this script in exit(). This is a bug please contact game dev"); @@ -25786,7 +25907,15 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("Exit failed(). This is a bug please contact game developer"); } }, - scp : function(scriptname, ip1, ip2){ + scp : function(scriptname, ip1, ip2) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.scp) { + return 0; + } else { + workerScript.loadedFns.scp = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptScpRamCost; + } + } if (arguments.length !== 2 && arguments.length !== 3) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments"); } @@ -25895,6 +26024,14 @@ function NetscriptFunctions(workerScript) { return true; }, ls : function(ip, grep) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.ls) { + return 0; + } else { + workerScript.loadedFns.ls = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptScanRamCost; + } + } if (ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ls() failed because of invalid arguments. Usage: ls(ip/hostname, [grep filter])"); } @@ -25952,7 +26089,15 @@ function NetscriptFunctions(workerScript) { allFiles.sort(); return allFiles; }, - hasRootAccess : function(ip){ + hasRootAccess : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.hasRootAccess) { + return 0; + } else { + workerScript.loadedFns.hasRootAccess = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptHasRootAccessRamCost; + } + } if (ip===undefined){ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() call has incorrect number of arguments. Takes 1 argument"); } @@ -25964,6 +26109,14 @@ function NetscriptFunctions(workerScript) { return server.hasAdminRights; }, getIp : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getIp) { + return 0; + } else { + workerScript.loadedFns.getIp = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetHostnameRamCost; + } + } var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp); if (scriptServer == null) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev"); @@ -25971,6 +26124,14 @@ function NetscriptFunctions(workerScript) { return scriptServer.ip; }, getHostname : function(){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getHostname) { + return 0; + } else { + workerScript.loadedFns.getHostname = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetHostnameRamCost; + } + } var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp); if (scriptServer == null) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev"); @@ -25978,11 +26139,27 @@ function NetscriptFunctions(workerScript) { return scriptServer.hostname; }, getHackingLevel : function(){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getHackingLevel) { + return 0; + } else { + workerScript.loadedFns.getHackingLevel = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetHackingLevelRamCost; + } + } __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].updateSkillLevels(); workerScript.scriptRef.log("getHackingLevel() returned " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill); return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill; }, getHackingMultipliers : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getHackingMultipliers) { + return 0; + } else { + workerScript.loadedFns.getHackingMultipliers = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetMultipliersRamCost; + } + } return { chance: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_chance_mult, speed: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_speed_mult, @@ -25991,12 +26168,28 @@ function NetscriptFunctions(workerScript) { }; }, getBitNodeMultipliers: function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getBitNodeMultipliers) { + return 0; + } else { + workerScript.loadedFns.getBitNodeMultipliers = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetMultipliersRamCost; + } + } if (!hasAISF) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getBitNodeMultipliers(). It requires Source-File 5 to run."); } return __WEBPACK_IMPORTED_MODULE_2__BitNode_js__["a" /* BitNodeMultipliers */]; }, getServerMoneyAvailable : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerMoneyAvailable) { + return 0; + } else { + workerScript.loadedFns.getServerMoneyAvailable = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetServerRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip); @@ -26011,6 +26204,14 @@ function NetscriptFunctions(workerScript) { return server.moneyAvailable; }, getServerSecurityLevel : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerSecurityLevel) { + return 0; + } else { + workerScript.loadedFns.getServerSecurityLevel = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetServerRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); @@ -26020,6 +26221,14 @@ function NetscriptFunctions(workerScript) { return server.hackDifficulty; }, getServerBaseSecurityLevel : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerBaseSecurityLevel) { + return 0; + } else { + workerScript.loadedFns.getServerBaseSecurityLevel = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetServerRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); @@ -26029,6 +26238,14 @@ function NetscriptFunctions(workerScript) { return server.baseDifficulty; }, getServerMinSecurityLevel : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerMinSecurityLevel) { + return 0; + } else { + workerScript.loadedFns.getServerMinSecurityLevel = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetServerRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); @@ -26037,7 +26254,15 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.minDifficulty, 3) + " for " + server.hostname); return server.minDifficulty; }, - getServerRequiredHackingLevel : function(ip){ + getServerRequiredHackingLevel : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerRequiredHackingLevel) { + return 0; + } else { + workerScript.loadedFns.getServerRequiredHackingLevel = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetServerRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip); @@ -26047,6 +26272,14 @@ function NetscriptFunctions(workerScript) { return server.requiredHackingSkill; }, getServerMaxMoney : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerMaxMoney) { + return 0; + } else { + workerScript.loadedFns.getServerMaxMoney = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetServerRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip); @@ -26056,6 +26289,14 @@ function NetscriptFunctions(workerScript) { return server.moneyMax; }, getServerGrowth : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerGrowth) { + return 0; + } else { + workerScript.loadedFns.getServerGrowth = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetServerRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getServerGrowth() failed. Invalid IP or hostname passed in: " + ip); @@ -26064,7 +26305,15 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("getServerGrowth() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.serverGrowth, 0) + " for " + server.hostname); return server.serverGrowth; }, - getServerNumPortsRequired : function(ip){ + getServerNumPortsRequired : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerNumPortsRequired) { + return 0; + } else { + workerScript.loadedFns.getServerNumPortsRequired = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetServerRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip); @@ -26074,6 +26323,14 @@ function NetscriptFunctions(workerScript) { return server.numOpenPortsRequired; }, getServerRam : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerRam) { + return 0; + } else { + workerScript.loadedFns.getServerRam = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetServerRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getServerRam() failed. Invalid IP or hostname passed in: " + ip); @@ -26083,9 +26340,25 @@ function NetscriptFunctions(workerScript) { return [server.maxRam, server.ramUsed]; }, serverExists : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.serverExists) { + return 0; + } else { + workerScript.loadedFns.serverExists = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetServerRamCost; + } + } return (Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip) !== null); }, - fileExists : function(filename,ip=workerScript.serverIp){ + fileExists : function(filename,ip=workerScript.serverIp) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.fileExists) { + return 0; + } else { + workerScript.loadedFns.fileExists = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptFileExistsRamCost; + } + } if (filename === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() call has incorrect number of arguments. Usage: fileExists(scriptname, [server])"); } @@ -26116,7 +26389,15 @@ function NetscriptFunctions(workerScript) { } return false; }, - isRunning : function(filename,ip){ + isRunning : function(filename,ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.isRunning) { + return 0; + } else { + workerScript.loadedFns.isRunning = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptIsRunningRamCost; + } + } if (filename === undefined || ip === undefined) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() call has incorrect number of arguments. Usage: isRunning(scriptname, server, [arg1], [arg2]...)"); } @@ -26131,9 +26412,38 @@ function NetscriptFunctions(workerScript) { } return (Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(filename, argsForTargetScript, server) != null); }, - getNextHacknetNodeCost : __WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__["b" /* getCostOfNextHacknetNode */], - purchaseHacknetNode : __WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__["d" /* purchaseHacknet */], + getNextHacknetNodeCost : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getNextHacknetNodeCost) { + return 0; + } else { + workerScript.loadedFns.getNextHacknetNodeCost = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptHacknetNodesRamCost; + } + } + return Object(__WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__["b" /* getCostOfNextHacknetNode */])(); + }, + + purchaseHacknetNode : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.purchaseHacknetNode) { + return 0; + } else { + workerScript.loadedFns.purchaseHacknetNode = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptPurchaseHacknetRamCost; + } + } + Object(__WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__["d" /* purchaseHacknet */])(); + }, getStockPrice : function(symbol) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getStockPrice) { + return 0; + } else { + workerScript.loadedFns.getStockPrice = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetStockRamCost; + } + } if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPrice()"); } @@ -26144,6 +26454,14 @@ function NetscriptFunctions(workerScript) { return parseFloat(stock.price.toFixed(3)); }, getStockPosition : function(symbol) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getStockPosition) { + return 0; + } else { + workerScript.loadedFns.getStockPosition = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetStockRamCost; + } + } if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPosition()"); } @@ -26154,6 +26472,14 @@ function NetscriptFunctions(workerScript) { return [stock.playerShares, stock.playerAvgPx, stock.playerShortShares, stock.playerAvgShortPx]; }, buyStock : function(symbol, shares) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.buyStock) { + return 0; + } else { + workerScript.loadedFns.buyStock = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptBuySellStockRamCost; + } + } if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use buyStock()"); } @@ -26189,6 +26515,14 @@ function NetscriptFunctions(workerScript) { return stock.price; }, sellStock : function(symbol, shares) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.sellStock) { + return 0; + } else { + workerScript.loadedFns.sellStock = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptBuySellStockRamCost; + } + } if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use sellStock()"); } @@ -26225,6 +26559,14 @@ function NetscriptFunctions(workerScript) { return stock.price; }, shortStock(symbol, shares) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.shortStock) { + return 0; + } else { + workerScript.loadedFns.shortStock = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptBuySellStockRamCost; + } + } if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use shortStock()"); } @@ -26241,6 +26583,14 @@ function NetscriptFunctions(workerScript) { return res ? stock.price : 0; }, sellShort(symbol, shares) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.sellShort) { + return 0; + } else { + workerScript.loadedFns.sellShort = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptBuySellStockRamCost; + } + } if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use sellShort()"); } @@ -26257,6 +26607,14 @@ function NetscriptFunctions(workerScript) { return res ? stock.price : 0; }, placeOrder(symbol, shares, price, type, pos) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.placeOrder) { + return 0; + } else { + workerScript.loadedFns.placeOrder = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptBuySellStockRamCost; + } + } if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use placeOrder()"); } @@ -26295,6 +26653,14 @@ function NetscriptFunctions(workerScript) { return Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["k" /* placeOrder */])(stock, shares, price, orderType, orderPos, workerScript); }, cancelOrder(symbol, shares, price, type, pos) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.cancelOrder) { + return 0; + } else { + workerScript.loadedFns.cancelOrder = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptBuySellStockRamCost; + } + } if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use cancelOrder()"); } @@ -26342,6 +26708,14 @@ function NetscriptFunctions(workerScript) { return Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["e" /* cancelOrder */])(params, workerScript); }, purchaseServer : function(hostname, ram) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.purchaseServer) { + return 0; + } else { + workerScript.loadedFns.purchaseServer = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptPurchaseServerRamCost; + } + } var hostnameStr = String(hostname); hostnameStr = hostnameStr.replace(/\s\s+/g, ''); if (hostnameStr == "") { @@ -26356,7 +26730,7 @@ function NetscriptFunctions(workerScript) { } ram = Math.round(ram); - if (isNaN(ram) || !Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["i" /* powerOfTwo */])(ram)) { + if (isNaN(ram) || !Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["h" /* powerOfTwo */])(ram)) { workerScript.scriptRef.log("Error: Invalid ram argument passed to purchaseServer(). Must be numeric and a power of 2"); return ""; } @@ -26378,6 +26752,14 @@ function NetscriptFunctions(workerScript) { return newServ.hostname; }, deleteServer : function(hostname) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.deleteServer) { + return 0; + } else { + workerScript.loadedFns.deleteServer = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptPurchaseServerRamCost; + } + } var hostnameStr = String(hostname); hostnameStr = hostnameStr.replace(/\s\s+/g, ''); var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["c" /* GetServerByHostname */])(hostnameStr); @@ -26441,6 +26823,14 @@ function NetscriptFunctions(workerScript) { return false; }, getPurchasedServers : function(hostname=true) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getPurchasedServers) { + return 0; + } else { + workerScript.loadedFns.getPurchasedServers = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptPurchaseServerRamCost; + } + } var res = []; __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers.forEach(function(ip) { if (hostname) { @@ -26460,6 +26850,14 @@ function NetscriptFunctions(workerScript) { return Math.round(n); }, write : function(port, data="", mode="a") { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.write) { + return 0; + } else { + workerScript.loadedFns.write = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptReadWriteRamCost; + } + } if (!isNaN(port)) { //Write to port //Port 1-10 if (port < 1 || port > 10) { @@ -26498,6 +26896,14 @@ function NetscriptFunctions(workerScript) { } }, read : function(port) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.read) { + return 0; + } else { + workerScript.loadedFns.read = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptReadWriteRamCost; + } + } if (!isNaN(port)) { //Read from port //Port 1-10 if (port < 1 || port > 10) { @@ -26530,6 +26936,14 @@ function NetscriptFunctions(workerScript) { } }, clear : function(port) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.clear) { + return 0; + } else { + workerScript.loadedFns.clear = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptReadWriteRamCost; + } + } if (!isNaN(port)) { //Clear port if (port < 1 || port > 10) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERR: Trying to read from invalid port: " + port + ". Only ports 1-10 are valid"); @@ -26555,7 +26969,68 @@ function NetscriptFunctions(workerScript) { } return 0; }, + rm : function(fn) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.rm) { + return 0; + } else { + workerScript.loadedFns.rm = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptReadWriteRamCost; + } + } + var s = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp); + if (s == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error getting Server for this script in clear(). This is a bug please contact game dev"); + } + + if (fn.includes(".exe")) { + for (var i = 0; i < s.programs.length; ++i) { + if (s.programs[i] === fn) { + s.programs.splice(i, 1); + return true; + } + } + } else if (fn.endsWith(".script")) { + for (var i = 0; i < s.scripts.length; ++i) { + if (s.scripts[i].filename === fn) { + //Check that the script isnt currently running + for (var j = 0; j < s.runningScripts.length; ++j) { + if (s.runningScripts[j].filename === fn) { + workerScript.scriptRef.log("Cannot delete a script that is currently running!"); + return false; + } + } + s.scripts.splice(i, 1); + return true; + } + } + } else if (fn.endsWith(".lit")) { + for (var i = 0; i < s.messages.length; ++i) { + var f = s.messages[i]; + if (!(f instanceof __WEBPACK_IMPORTED_MODULE_12__Message_js__["a" /* Message */]) && Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(f) && f === fn) { + s.messages.splice(i, 1); + return true; + } + } + } else if (fn.endsWith(".txt")) { + for (var i = 0; i < s.textFiles.length; ++i) { + if (s.textFiles[i].fn === fn) { + s.textFiles.splice(i, 1); + return true; + } + } + } + return false; + }, scriptRunning : function(scriptname, ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.scriptRunning) { + return 0; + } else { + workerScript.loadedFns.scriptRunning = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptArbScriptRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("scriptRunning() failed. Invalid IP or hostname passed in: " + ip); @@ -26569,6 +27044,14 @@ function NetscriptFunctions(workerScript) { return false; }, scriptKill : function(scriptname, ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.scriptKill) { + return 0; + } else { + workerScript.loadedFns.scriptKill = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptArbScriptRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("scriptKill() failed. Invalid IP or hostname passed in: " + ip); @@ -26584,6 +27067,14 @@ function NetscriptFunctions(workerScript) { return suc; }, getScriptRam : function (scriptname, ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getScriptRam) { + return 0; + } else { + workerScript.loadedFns.getScriptRam = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetScriptRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getScriptRam() failed. Invalid IP or hostname passed in: " + ip); @@ -26597,6 +27088,14 @@ function NetscriptFunctions(workerScript) { return 0; }, getHackTime : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getHackTime) { + return 0; + } else { + workerScript.loadedFns.getHackTime = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetHackTimeRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getHackTime() failed. Invalid IP or hostname passed in: " + ip); @@ -26605,6 +27104,14 @@ function NetscriptFunctions(workerScript) { return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["j" /* scriptCalculateHackingTime */])(server); //Returns seconds }, getGrowTime : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getGrowTime) { + return 0; + } else { + workerScript.loadedFns.getGrowTime = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetHackTimeRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getGrowTime() failed. Invalid IP or hostname passed in: " + ip); @@ -26613,6 +27120,14 @@ function NetscriptFunctions(workerScript) { return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["h" /* scriptCalculateGrowTime */])(server) / 1000; //Returns seconds }, getWeakenTime : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getWeakenTime) { + return 0; + } else { + workerScript.loadedFns.getWeakenTime = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetHackTimeRamCost; + } + } var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip); if (server == null) { workerScript.scriptRef.log("getWeakenTime() failed. Invalid IP or hostname passed in: " + ip); @@ -26621,6 +27136,14 @@ function NetscriptFunctions(workerScript) { return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["l" /* scriptCalculateWeakenTime */])(server) / 1000; //Returns seconds }, getScriptIncome : function(scriptname, ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getScriptIncome) { + return 0; + } else { + workerScript.loadedFns.getScriptIncome = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetScriptRamCost; + } + } if (arguments.length === 0) { //Get total script income var res = []; @@ -26640,13 +27163,21 @@ function NetscriptFunctions(workerScript) { } var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(scriptname, argsForScript, server); if (runningScriptObj == null) { - workerScript.scriptRef.log("getScriptIncome() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForScript)); + workerScript.scriptRef.log("getScriptIncome() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["i" /* printArray */])(argsForScript)); return -1; } return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime; } }, getScriptExpGain : function(scriptname, ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getScriptExpGain) { + return 0; + } else { + workerScript.loadedFns.getScriptExpGain = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetScriptRamCost; + } + } if (arguments.length === 0) { var total = 0; for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["h" /* workerScripts */].length; ++i) { @@ -26666,16 +27197,25 @@ function NetscriptFunctions(workerScript) { } var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(scriptname, argsForScript, server); if (runningScriptObj == null) { - workerScript.scriptRef.log("getScriptExpGain() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForScript)); + workerScript.scriptRef.log("getScriptExpGain() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["i" /* printArray */])(argsForScript)); return -1; } return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime; } }, getTimeSinceLastAug : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getTimeSinceLastAug) { + return 0; + } else { + workerScript.loadedFns.getTimeSinceLastAug = true; + return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptGetHackTimeRamCost; + } + } return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].playtimeSinceLastAug; }, prompt : function(txt) { + if (workerScript.checkingRam) {return 0;} if (__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["e" /* yesNoBoxOpen */]) { workerScript.scriptRef.log("ERROR: confirm() failed because a pop-up dialog box is already open"); return false; @@ -26699,6 +27239,16 @@ function NetscriptFunctions(workerScript) { /* Singularity Functions */ universityCourse : function(universityName, className) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.universityCourse) { + return 0; + } else { + workerScript.loadedFns.universityCourse = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn1RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run universityCourse(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -26778,6 +27328,16 @@ function NetscriptFunctions(workerScript) { }, gymWorkout : function(gymName, stat) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.gymWorkout) { + return 0; + } else { + workerScript.loadedFns.gymWorkout = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn1RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run gymWorkout(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -26870,6 +27430,16 @@ function NetscriptFunctions(workerScript) { }, travelToCity(cityname) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.travelToCity) { + return 0; + } else { + workerScript.loadedFns.travelToCity = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn1RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run travelToCity(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -26896,6 +27466,16 @@ function NetscriptFunctions(workerScript) { }, purchaseTor() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.purchaseTor) { + return 0; + } else { + workerScript.loadedFns.purchaseTor = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn1RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseTor(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -26927,6 +27507,16 @@ function NetscriptFunctions(workerScript) { return true; }, purchaseProgram(programName) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.purchaseProgram) { + return 0; + } else { + workerScript.loadedFns.purchaseProgram = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn1RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseProgram(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -27031,6 +27621,16 @@ function NetscriptFunctions(workerScript) { return true; }, getStats : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getStats) { + return 0; + } else { + workerScript.loadedFns.getStats = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn1RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getStats(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -27049,6 +27649,16 @@ function NetscriptFunctions(workerScript) { } }, isBusy : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.isBusy) { + return 0; + } else { + workerScript.loadedFns.isBusy = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn1RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run isBusy(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -27058,6 +27668,16 @@ function NetscriptFunctions(workerScript) { return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking; }, upgradeHomeRam() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.upgradeHomeRam) { + return 0; + } else { + workerScript.loadedFns.upgradeHomeRam = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn2RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run upgradeHomeRam(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -27090,6 +27710,16 @@ function NetscriptFunctions(workerScript) { return true; }, getUpgradeHomeRamCost() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getUpgradeHomeRamCost) { + return 0; + } else { + workerScript.loadedFns.getUpgradeHomeRamCost = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn2RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getUpgradeHomeRamCost(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -27108,6 +27738,16 @@ function NetscriptFunctions(workerScript) { return cost * mult; }, workForCompany() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.workForCompany) { + return 0; + } else { + workerScript.loadedFns.workForCompany = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn2RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -27139,6 +27779,16 @@ function NetscriptFunctions(workerScript) { return true; }, applyToCompany(companyName, field) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.applyToCompany) { + return 0; + } else { + workerScript.loadedFns.applyToCompany = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn2RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run applyToCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -27210,6 +27860,16 @@ function NetscriptFunctions(workerScript) { return res; }, getCompanyRep(companyName) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getCompanyRep) { + return 0; + } else { + workerScript.loadedFns.getCompanyRep = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn2RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getCompanyRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -27225,6 +27885,16 @@ function NetscriptFunctions(workerScript) { return company.playerReputation; }, checkFactionInvitations() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.checkFactionInvitations) { + return 0; + } else { + workerScript.loadedFns.checkFactionInvitations = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn2RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run checkFactionInvitations(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -27235,6 +27905,16 @@ function NetscriptFunctions(workerScript) { return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].factionInvitations.slice(); }, joinFaction(name) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.joinFaction) { + return 0; + } else { + workerScript.loadedFns.joinFaction = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn2RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run joinFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -27266,6 +27946,16 @@ function NetscriptFunctions(workerScript) { return true; }, workForFaction(name, type) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.workForFaction) { + return 0; + } else { + workerScript.loadedFns.workForFaction = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn2RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -27352,6 +28042,16 @@ function NetscriptFunctions(workerScript) { return true; }, getFactionRep(name) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getFactionRep) { + return 0; + } else { + workerScript.loadedFns.getFactionRep = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn2RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getFactionRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -27367,6 +28067,16 @@ function NetscriptFunctions(workerScript) { return __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][name].playerReputation; }, createProgram(name) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.createProgram) { + return 0; + } else { + workerScript.loadedFns.createProgram = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn3RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run createProgram(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -27457,6 +28167,16 @@ function NetscriptFunctions(workerScript) { return true; }, commitCrime : function(crime) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.commitCrime) { + return 0; + } else { + workerScript.loadedFns.commitCrime = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn3RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run commitCrime(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -27538,6 +28258,16 @@ function NetscriptFunctions(workerScript) { } }, getCrimeChance(crime) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getCrimeChance) { + return 0; + } else { + workerScript.loadedFns.getCrimeChance = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn3RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getCrimeChance(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -27575,6 +28305,16 @@ function NetscriptFunctions(workerScript) { } }, getOwnedAugmentations(purchased=false) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getOwnedAugmentations) { + return 0; + } else { + workerScript.loadedFns.getOwnedAugmentations = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn3RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getOwnedAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -27593,6 +28333,16 @@ function NetscriptFunctions(workerScript) { return res; }, getAugmentationsFromFaction(facname) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getAugmentationsFromFaction) { + return 0; + } else { + workerScript.loadedFns.getAugmentationsFromFaction = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn3RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getAugmentationsFromFaction(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -27613,6 +28363,16 @@ function NetscriptFunctions(workerScript) { return res; }, getAugmentationCost(name) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getAugmentationCost) { + return 0; + } else { + workerScript.loadedFns.getAugmentationCost = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn3RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getAugmentationCost(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -27629,6 +28389,16 @@ function NetscriptFunctions(workerScript) { return [aug.baseRepRequirement, aug.baseCost]; }, purchaseAugmentation(faction, name) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.purchaseAugmentation) { + return 0; + } else { + workerScript.loadedFns.purchaseAugmentation = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn3RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseAugmentation(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -27688,6 +28458,16 @@ function NetscriptFunctions(workerScript) { } }, installAugmentations(cbScript) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.installAugmentations) { + return 0; + } else { + workerScript.loadedFns.installAugmentations = true; + var ramCost = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptSingularityFn3RamCost; + if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run installAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -27738,6 +28518,8 @@ function NetscriptFunctions(workerScript) { /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_StringHelperFunctions_js__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_HelperFunctions_js__ = __webpack_require__(2); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_LogBox_js__ = __webpack_require__(30); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__utils_YesNoBox_js__ = __webpack_require__(14); + @@ -27762,12 +28544,8 @@ function NetscriptFunctions(workerScript) { /* Write text to terminal */ //If replace is true then spaces are replaced with " " -function post(input, replace=true) { - if (replace) { - $("#terminal-input").before('' + input.replace( / /g, " " ) + ''); - } else { - $("#terminal-input").before('' + input + ''); - } +function post(input) { + $("#terminal-input").before('' + input + ''); updateTerminalScroll(); } @@ -28471,7 +29249,7 @@ let Terminal = { if (__WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) { Object(__WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__["c" /* executeDarkwebTerminalCommand */])(commandArray); } else { - post("You need to be connected to the Dark Web to use the buy command"); + post("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)"); } break; case "cat": @@ -29363,7 +30141,21 @@ let Terminal = { post("Agility: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].agility + " / 1500"); break; case __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].BitFlume: - Object(__WEBPACK_IMPORTED_MODULE_12__RedPill_js__["a" /* hackWorldDaemon */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN, true); + var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_20__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), + noBtn = Object(__WEBPACK_IMPORTED_MODULE_20__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])(); + yesBtn.innerHTML = "Travel to BitNode Nexus"; + noBtn.innerHTML = "Cancel"; + yesBtn.addEventListener("click", function() { + Object(__WEBPACK_IMPORTED_MODULE_12__RedPill_js__["a" /* hackWorldDaemon */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN, true); + return Object(__WEBPACK_IMPORTED_MODULE_20__utils_YesNoBox_js__["a" /* yesNoBoxClose */])(); + }); + noBtn.addEventListener("click", function() { + return Object(__WEBPACK_IMPORTED_MODULE_20__utils_YesNoBox_js__["a" /* yesNoBoxClose */])(); + }); + Object(__WEBPACK_IMPORTED_MODULE_20__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("WARNING: USING THIS PROGRAM WILL CAUSE YOU TO LOSE ALL OF YOUR PROGRESS ON THE CURRENT BITNODE.

" + + "Do you want to travel to the BitNode Nexus? This allows you to reset the current BitNode " + + "and select a new one."); + break; default: post("Invalid executable. Cannot be run"); @@ -29452,7 +30244,7 @@ let Terminal = { return; } else { //Able to run script - post("Running script with " + numThreads + " thread(s) and args: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_HelperFunctions_js__["j" /* printArray */])(args) + "."); + post("Running script with " + numThreads + " thread(s) and args: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_HelperFunctions_js__["i" /* printArray */])(args) + "."); post("May take a few seconds to start up the process..."); var runningScriptObj = new __WEBPACK_IMPORTED_MODULE_13__Script_js__["b" /* RunningScript */](script, args); runningScriptObj.threads = numThreads; @@ -34738,7 +35530,7 @@ function createActiveScriptsText(workerscript, item) { //Server ip/hostname var threads = "Threads: " + workerscript.scriptRef.threads; - var args = "Args: " + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["j" /* printArray */])(workerscript.args); + var args = "Args: " + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["i" /* printArray */])(workerscript.args); itemTextHeader.innerHTML = threads + "
" + args + "
"; @@ -35732,16 +36524,16 @@ HackingMission.prototype.init = function() { //Randomly generate enemy nodes (CPU and Firewall) based on difficulty var numNodes = Math.min(8, Math.max(1, Math.round(this.difficulty / 4))); var numFirewalls = Math.min(20, - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(Math.round(this.difficulty/3), Math.round(this.difficulty/3) + 1)); - var numDatabases = Math.min(10, Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(1, Math.round(this.difficulty / 3) + 1)); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(Math.round(this.difficulty/3), Math.round(this.difficulty/3) + 1)); + var numDatabases = Math.min(10, Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(1, Math.round(this.difficulty / 3) + 1)); var totalNodes = numNodes + numFirewalls + numDatabases; var xlimit = 7 - Math.floor(totalNodes / 8); var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(0.8 + (this.difficulty / 5), 10); for (var i = 0; i < numNodes; ++i) { var stats = { - atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 86), - def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(5, 10), - hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(210, 230) + atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(80, 86), + def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(5, 10), + hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(210, 230) } this.enemyCores.push(new Node(NodeTypes.Core, stats)); this.enemyCores[i].setControlledByEnemy(); @@ -35750,8 +36542,8 @@ HackingMission.prototype.init = function() { for (var i = 0; i < numFirewalls; ++i) { var stats = { atk: 0, - def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 20), - hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(275, 300) + def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(10, 20), + hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(275, 300) } this.enemyNodes.push(new Node(NodeTypes.Firewall, stats)); this.enemyNodes[i].setControlledByEnemy(); @@ -35760,8 +36552,8 @@ HackingMission.prototype.init = function() { for (var i = 0; i < numDatabases; ++i) { var stats = { atk: 0, - def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(30, 55), - hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(210, 275) + def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(30, 55), + hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(210, 275) } var node = new Node(NodeTypes.Database, stats); node.setControlledByEnemy(); @@ -36151,7 +36943,7 @@ HackingMission.prototype.setNodePosition = function(nodeObj, x, y) { } HackingMission.prototype.setNodeRandomPosition = function(nodeObj, xlimit=0) { - var i = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, this.availablePositions.length - 1); + var i = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(0, this.availablePositions.length - 1); if (this.availablePositions[i][1] < xlimit) { //Recurse if not within limit return this.setNodeRandomPosition(nodeObj, xlimit); @@ -36175,22 +36967,22 @@ HackingMission.prototype.createMap = function() { for (var x = 0; x < 8; ++x) { for (var y = 0; y < 8; ++y) { if (!(this.map[x][y] instanceof Node)) { - var node, type = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, 2); + var node, type = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(0, 2); var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(0.85 + (this.difficulty / 2), 15); switch (type) { case 0: //Spam var stats = { atk: 0, - def: averageAttack * 1.1 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(15, 45), - hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(200, 225) + def: averageAttack * 1.1 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(15, 45), + hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(200, 225) } node = new Node(NodeTypes.Spam, stats); break; case 1: //Transfer var stats = { atk: 0, - def: averageAttack * 1.1 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(15, 45), - hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(250, 275) + def: averageAttack * 1.1 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(15, 45), + hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(250, 275) } node = new Node(NodeTypes.Transfer, stats); break; @@ -36198,8 +36990,8 @@ HackingMission.prototype.createMap = function() { default: var stats = { atk: 0, - def: averageAttack * 1.1 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(30, 70), - hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(300, 320) + def: averageAttack * 1.1 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(30, 70), + hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(300, 320) } node = new Node(NodeTypes.Shield, stats); break; @@ -36872,7 +37664,7 @@ HackingMission.prototype.enemyAISelectAction = function(nodeObj) { if (nodeObj.conn == null) { if (this.miscNodes.length === 0) { //Randomly pick a player node and attack it if its reachable - var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, this.playerNodes.length-1); + var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(0, this.playerNodes.length-1); var node; if (this.playerNodes.length === 0) { node = null; @@ -36888,7 +37680,7 @@ HackingMission.prototype.enemyAISelectAction = function(nodeObj) { ++node.targetedCount; } else { //Randomly pick a player core and attack it if its reachable - rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, this.playerCores.length-1); + rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(0, this.playerCores.length-1); if (this.playerCores.length === 0) { return; //No Misc Nodes, no player Nodes, no Player cores. Player lost } else { @@ -36906,7 +37698,7 @@ HackingMission.prototype.enemyAISelectAction = function(nodeObj) { } } else { //Randomly pick a misc node and attack it if its reachable - var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, this.miscNodes.length-1); + var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(0, this.miscNodes.length-1); var node = this.miscNodes[rand]; if (this.nodeReachableByEnemy(node)) { nodeObj.conn = this.jsplumbinstance.connect({ @@ -37318,135 +38110,135 @@ function initStockMarket() { } var ecorp = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumECorp; - var ecorpStk = new Stock(ecorp, StockSymbols[ecorp], 0.45, true, 19, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000, 25000)); + var ecorpStk = new Stock(ecorp, StockSymbols[ecorp], 0.45, true, 19, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(20000, 25000)); StockMarket[ecorp] = ecorpStk; var megacorp = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12MegaCorp; - var megacorpStk = new Stock(megacorp, StockSymbols[megacorp], 0.45, true, 19, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(25000, 33000)); + var megacorpStk = new Stock(megacorp, StockSymbols[megacorp], 0.45, true, 19, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(25000, 33000)); StockMarket[megacorp] = megacorpStk; var blade = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12BladeIndustries; - var bladeStk = new Stock(blade, StockSymbols[blade], 0.75, true, 13, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000, 22000)); + var bladeStk = new Stock(blade, StockSymbols[blade], 0.75, true, 13, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(15000, 22000)); StockMarket[blade] = bladeStk; var clarke = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumClarkeIncorporated; - var clarkeStk = new Stock(clarke, StockSymbols[clarke], 0.7, true, 12, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000, 20000)); + var clarkeStk = new Stock(clarke, StockSymbols[clarke], 0.7, true, 12, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(15000, 20000)); StockMarket[clarke] = clarkeStk; var omnitek = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenOmniTekIncorporated; - var omnitekStk = new Stock(omnitek, StockSymbols[omnitek], 0.65, true, 12, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(35000, 40000)); + var omnitekStk = new Stock(omnitek, StockSymbols[omnitek], 0.65, true, 12, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(35000, 40000)); StockMarket[omnitek] = omnitekStk; var foursigma = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12FourSigma; - var foursigmaStk = new Stock(foursigma, StockSymbols[foursigma], 1.05, true, 17, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(60000, 70000)); + var foursigmaStk = new Stock(foursigma, StockSymbols[foursigma], 1.05, true, 17, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(60000, 70000)); StockMarket[foursigma] = foursigmaStk; var kuaigong = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].ChongqingKuaiGongInternational; - var kuaigongStk = new Stock(kuaigong, StockSymbols[kuaigong], 0.8, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000, 24000)); + var kuaigongStk = new Stock(kuaigong, StockSymbols[kuaigong], 0.8, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(20000, 24000)); StockMarket[kuaigong] = kuaigongStk; var fulcrum = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumFulcrumTechnologies; - var fulcrumStk = new Stock(fulcrum, StockSymbols[fulcrum], 1.25, true, 16, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(30000, 35000)); + var fulcrumStk = new Stock(fulcrum, StockSymbols[fulcrum], 1.25, true, 16, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(30000, 35000)); StockMarket[fulcrum] = fulcrumStk; var storm = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].IshimaStormTechnologies; - var stormStk = new Stock(storm, StockSymbols[storm], 0.85, true, 7, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(21000, 24000)); + var stormStk = new Stock(storm, StockSymbols[storm], 0.85, true, 7, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(21000, 24000)); StockMarket[storm] = stormStk; var defcomm = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].NewTokyoDefComm; - var defcommStk = new Stock(defcomm, StockSymbols[defcomm], 0.65, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(10000, 15000)); + var defcommStk = new Stock(defcomm, StockSymbols[defcomm], 0.65, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(10000, 15000)); StockMarket[defcomm] = defcommStk; var helios = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenHeliosLabs; - var heliosStk = new Stock(helios, StockSymbols[helios], 0.6, true, 9, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(12000, 16000)); + var heliosStk = new Stock(helios, StockSymbols[helios], 0.6, true, 9, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(12000, 16000)); StockMarket[helios] = heliosStk; var vitalife = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].NewTokyoVitaLife; - var vitalifeStk = new Stock(vitalife, StockSymbols[vitalife], 0.75, true, 7, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(10000, 12000)); + var vitalifeStk = new Stock(vitalife, StockSymbols[vitalife], 0.75, true, 7, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(10000, 12000)); StockMarket[vitalife] = vitalifeStk; var icarus = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12IcarusMicrosystems; - var icarusStk = new Stock(icarus, StockSymbols[icarus], 0.65, true, 7.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(16000, 20000)); + var icarusStk = new Stock(icarus, StockSymbols[icarus], 0.65, true, 7.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(16000, 20000)); StockMarket[icarus] = icarusStk; var universalenergy = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12UniversalEnergy; - var universalenergyStk = new Stock(universalenergy, StockSymbols[universalenergy], 0.55, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000, 25000)); + var universalenergyStk = new Stock(universalenergy, StockSymbols[universalenergy], 0.55, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(20000, 25000)); StockMarket[universalenergy] = universalenergyStk; var aerocorp = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumAeroCorp; - var aerocorpStk = new Stock(aerocorp, StockSymbols[aerocorp], 0.6, true, 6, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(10000, 15000)); + var aerocorpStk = new Stock(aerocorp, StockSymbols[aerocorp], 0.6, true, 6, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(10000, 15000)); StockMarket[aerocorp] = aerocorpStk; var omnia = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenOmniaCybersystems; - var omniaStk = new Stock(omnia, StockSymbols[omnia], 0.7, true, 4.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(9000, 12000)); + var omniaStk = new Stock(omnia, StockSymbols[omnia], 0.7, true, 4.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(9000, 12000)); StockMarket[omnia] = omniaStk; var solaris = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].ChongqingSolarisSpaceSystems; - var solarisStk = new Stock(solaris, StockSymbols[solaris], 0.75, true, 8.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(18000, 24000)); + var solarisStk = new Stock(solaris, StockSymbols[solaris], 0.75, true, 8.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(18000, 24000)); StockMarket[solaris] = solarisStk; var globalpharm = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].NewTokyoGlobalPharmaceuticals; - var globalpharmStk = new Stock(globalpharm, StockSymbols[globalpharm], 0.6, true, 10.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(18000, 24000)); + var globalpharmStk = new Stock(globalpharm, StockSymbols[globalpharm], 0.6, true, 10.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(18000, 24000)); StockMarket[globalpharm] = globalpharmStk; var nova = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].IshimaNovaMedical; - var novaStk = new Stock(nova, StockSymbols[nova], 0.75, true, 5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(18000, 24000)); + var novaStk = new Stock(nova, StockSymbols[nova], 0.75, true, 5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(18000, 24000)); StockMarket[nova] = novaStk; var watchdog = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumWatchdogSecurity; - var watchdogStk = new Stock(watchdog, StockSymbols[watchdog], 2.5, true, 1.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(5000, 7500)); + var watchdogStk = new Stock(watchdog, StockSymbols[watchdog], 2.5, true, 1.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(5000, 7500)); StockMarket[watchdog] = watchdogStk; var lexocorp = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenLexoCorp; - var lexocorpStk = new Stock(lexocorp, StockSymbols[lexocorp], 1.25, true, 6, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(5000, 7500)); + var lexocorpStk = new Stock(lexocorp, StockSymbols[lexocorp], 1.25, true, 6, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(5000, 7500)); StockMarket[lexocorp] = lexocorpStk; var rho = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumRhoConstruction; - var rhoStk = new Stock(rho, StockSymbols[rho], 0.6, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(3000, 6000)); + var rhoStk = new Stock(rho, StockSymbols[rho], 0.6, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(3000, 6000)); StockMarket[rho] = rhoStk; var alpha = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12AlphaEnterprises; - var alphaStk = new Stock(alpha, StockSymbols[alpha], 1.9, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(5000, 7500)); + var alphaStk = new Stock(alpha, StockSymbols[alpha], 1.9, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(5000, 7500)); StockMarket[alpha] = alphaStk; var syscore = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenSysCoreSecurities; - var syscoreStk = new Stock(syscore, StockSymbols[syscore], 1.6, true, 3, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(4000, 7000)) + var syscoreStk = new Stock(syscore, StockSymbols[syscore], 1.6, true, 3, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(4000, 7000)) StockMarket[syscore] = syscoreStk; var computek = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenCompuTek; - var computekStk = new Stock(computek, StockSymbols[computek], 0.9, true, 4, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(2000, 5000)); + var computekStk = new Stock(computek, StockSymbols[computek], 0.9, true, 4, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(2000, 5000)); StockMarket[computek] = computekStk; var netlink = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumNetLinkTechnologies; - var netlinkStk = new Stock(netlink, StockSymbols[netlink], 4.2, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(2000, 4000)); + var netlinkStk = new Stock(netlink, StockSymbols[netlink], 4.2, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(2000, 4000)); StockMarket[netlink] = netlinkStk; var omega = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].IshimaOmegaSoftware; - var omegaStk = new Stock(omega, StockSymbols[omega], 1, true, 0.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(3000, 6000)); + var omegaStk = new Stock(omega, StockSymbols[omega], 1, true, 0.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(3000, 6000)); StockMarket[omega] = omegaStk; var fns = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12FoodNStuff; - var fnsStk = new Stock(fns, StockSymbols[fns], 0.75, false, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 4000)); + var fnsStk = new Stock(fns, StockSymbols[fns], 0.75, false, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(1000, 4000)); StockMarket[fns] = fnsStk; var sigmacosm = "Sigma Cosmetics"; - var sigmacosmStk = new Stock(sigmacosm, StockSymbols[sigmacosm], 2.8, true, 0, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(2000, 3000)); + var sigmacosmStk = new Stock(sigmacosm, StockSymbols[sigmacosm], 2.8, true, 0, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(2000, 3000)); StockMarket[sigmacosm] = sigmacosmStk; var joesguns = "Joes Guns"; - var joesgunsStk = new Stock(joesguns, StockSymbols[joesguns], 3.8, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(500, 1000)); + var joesgunsStk = new Stock(joesguns, StockSymbols[joesguns], 3.8, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(500, 1000)); StockMarket[joesguns] = joesgunsStk; var catalyst = "Catalyst Ventures"; - var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.45, true, 13.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(500, 1000)); + var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.45, true, 13.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(500, 1000)); StockMarket[catalyst] = catalystStk; var microdyne = "Microdyne Technologies"; - var microdyneStk = new Stock(microdyne, StockSymbols[microdyne], 0.75, true, 8, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000, 25000)); + var microdyneStk = new Stock(microdyne, StockSymbols[microdyne], 0.75, true, 8, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(20000, 25000)); StockMarket[microdyne] = microdyneStk; var titanlabs = "Titan Laboratories"; - var titanlabsStk = new Stock(titanlabs, StockSymbols[titanlabs], 0.6, true, 11, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000, 20000)); + var titanlabsStk = new Stock(titanlabs, StockSymbols[titanlabs], 0.6, true, 11, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(15000, 20000)); StockMarket[titanlabs] = titanlabsStk; var orders = {}; @@ -38274,8 +39066,8 @@ function updateStockPlayerPosition(stock) { if (stock.playerShares === 0 && stock.playerShortShares === 0 && StockMarket["Orders"] && StockMarket["Orders"][stock.symbol] && StockMarket["Orders"][stock.symbol].length === 0) { - Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["l" /* removeElementById */])(tickerId + "-hdr"); - Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["l" /* removeElementById */])(tickerId + "-panel"); + Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["k" /* removeElementById */])(tickerId + "-hdr"); + Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["k" /* removeElementById */])(tickerId + "-panel"); return; } else { //If the ticker hasn't been created, create it (handles updating) @@ -38355,8 +39147,8 @@ function updateStockOrderList(stock) { if (stock.playerShares === 0 && stock.playerShortShares === 0 && StockMarket["Orders"] && StockMarket["Orders"][stock.symbol] && StockMarket["Orders"][stock.symbol].length === 0) { - Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["l" /* removeElementById */])(tickerId + "-hdr"); - Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["l" /* removeElementById */])(tickerId + "-panel"); + Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["k" /* removeElementById */])(tickerId + "-hdr"); + Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["k" /* removeElementById */])(tickerId + "-panel"); return; } else { //If the ticker hasn't been created, create it (handles updating) @@ -38462,7 +39254,7 @@ function logBoxCreate(script) { document.getElementById('log-box-kill-script').style.display = "inline-block"; logBoxOpen(); document.getElementById("log-box-text-header").innerHTML = - logBoxCurrentScript.filename + " " + Object(__WEBPACK_IMPORTED_MODULE_1__HelperFunctions_js__["j" /* printArray */])(logBoxCurrentScript.args) + ":

"; + logBoxCurrentScript.filename + " " + Object(__WEBPACK_IMPORTED_MODULE_1__HelperFunctions_js__["i" /* printArray */])(logBoxCurrentScript.args) + ":

"; logBoxCurrentScript.logUpd = true; logBoxUpdateText(); } @@ -38554,12 +39346,10 @@ var WarehouseInitialCost = 5e9; //Initial purchase cost of warehouse var WarehouseInitialSize = 100; var WarehouseUpgradeBaseCost = 1e9; -var OfficeInitialCost = 5e9; +var OfficeInitialCost = 4e9; var OfficeInitialSize = 3; var OfficeUpgradeBaseCost = 1e9; - - function Material(params={}) { this.name = params.name ? params.name : ""; this.qty = 0; //Quantity @@ -38851,7 +39641,7 @@ Product.prototype.finishProduct = function(employeeProd, industry) { console.log("advMult: " + advMult); this.mku = 100 / (advMult * this.qlt * (busRatio + mgmtRatio)); this.dmd = industry.awareness === 0 ? 100 : Math.min(100, advMult * (100 * (industry.popularity / industry.awareness))); - this.cmp = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, 70); + this.cmp = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(0, 70); //Calculate the product's required materials //For now, just set it to be the same as the requirements to make materials @@ -39024,6 +39814,20 @@ var ProductRatingWeights = { } } +//Industry upgrades +//The structure is: +// [index in array, base price, price mult, benefit mult (if applicable), name, desc] +var IndustryUpgrades = { + "0": [0, 500e3, 1, 1.05, + "Coffee", "Provide your employees with coffee, increasing their energy by 5%."], + "1": [1, 1e9, 1.02, 1.01, + "AdVert.Inc", "Hire AdVert.Inc to advertise your company. Each level of " + + "this upgrade grants your company a static increase of 5 and 1 to its awareness and " + + "popularity, respectively. It will then increase your company's awareness by 1%, and its popularity " + + "by a random percentage between 5% and 15%. These effects are increased by other upgrades " + + "that increase the power of your advertising."] +} + var empManualAssignmentModeActive = false; function Industry(params={}) { this.offices = { //Maps locations to offices. 0 if no office at that location @@ -39089,6 +39893,10 @@ function Industry(params={}) { this.thisCycleRevenue = new __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js___default.a(0); this.thisCycleExpenses = new __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js___default.a(0); + //Upgrades + var numUpgrades = Object.keys(IndustryUpgrades).length; + this.upgrades = Array(numUpgrades).fill(0); + this.state = "START"; this.init(); @@ -39245,6 +40053,10 @@ Industry.prototype.init = function() { case Industries.Software: this.sciFac = 0.7; this.advFac = 0.5; + this.hwFac = 0.25; + this.reFac = 0.1; + this.aiFac = 0.1; + this.robFac = 0.05; this.reqMats = { "Hardware": 0.5, "Energy": 1, @@ -39373,6 +40185,18 @@ Industry.prototype.process = function(marketCycles=1, state, company) { //Process change in demand/competition of materials/products this.processMaterialMarket(marketCycles); this.processProductMarket(marketCycles); + + //Process loss of popularity + this.popularity -= (marketCycles * .0001); + this.popularity = Math.max(0, this.popularity); + + //Process Dreamsense gains + var popularityGain = company.getDreamSenseGain(), awarenessGain = popularityGain * 4; + if (popularityGain > 0) { + this.popularity += (popularityGain * marketCycles); + this.awareness += (awarenessGain * marketCycles); + } + return; } @@ -39424,7 +40248,7 @@ Industry.prototype.processProductMarket = function(marketCycles=1) { for (var name in this.products) { if (this.products.hasOwnProperty(name)) { var product = this.products[name]; - var change = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(1, 5) * 0.001; + var change = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(1, 5) * 0.001; if (this.type === Industries.Pharmaceutical || this.type === Industries.Software || this.type === Industries.Robotics) { change *= 2.5; @@ -39543,9 +40367,6 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) { Math.pow(this.sciResearch.qty, this.sciFac) + Math.pow(warehouse.materials["AICores"].qty, this.aiFac) / 10e3); } - } else { - console.log("Production of materials failed because producableFrac <= 0 or prod <= 0."); - console.log("prod: " + prod); } //Per second var fooProd = prod * producableFrac / (SecsPerMarketCycle * marketCycles); @@ -39560,7 +40381,10 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) { for (var matName in warehouse.materials) { if (warehouse.materials.hasOwnProperty(matName)) { var mat = warehouse.materials[matName]; - if (mat.sCost < 0 || mat.sllman[0] === false) {continue;} + if (mat.sCost < 0 || mat.sllman[0] === false) { + mat.sll = 0; + continue; + } var mat = warehouse.materials[matName]; var sCost; @@ -39588,7 +40412,8 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) { } var businessFactor = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]); var maxSell = (mat.qlt + .001) * mat.dmd * (100 - mat.cmp)/100 * markup * businessFactor * - (this.awareness === 0 ? 0.01 : (this.popularity + .001) / this.awareness); + Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) * + (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01)); var sellAmt; if (mat.sllman[1] !== -1) { //Sell amount is manually limited @@ -39796,7 +40621,8 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio } } var maxSell = Math.pow(product.rat, 0.95) * product.dmd * (1-(product.cmp/100)) * - (this.awareness === 0 ? 0.01 : (this.popularity+0.001) / this.awareness) * markup; + markup * businessFactor * Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) * + (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01)); var sellAmt; if (product.sllman[city][0] && product.sllman[city][1] > 0) { //Sell amount is manually limited @@ -39840,6 +40666,33 @@ Industry.prototype.discontinueProduct = function(product, parentRefs) { } } +Industry.prototype.upgrade = function(upgrade, refs) { + var corporation = refs.corporation, division = refs.division, + office = refs.office; + var upgN = upgrade[0], basePrice = upgrade[1], priceMult = upgrade[2], + upgradeBenefit = upgrade[3]; + while (this.upgrades.length <= upgN) {this.upgrades.push(0);} + ++this.upgrades[upgN]; + + switch (upgN) { + case 0: //Coffee, 5% energy per employee + for (var i = 0; i < office.employees.length; ++i) { + office.employees[i].ene = Math.min(office.employees[i].ene * 1.05, 100); + } + break; + case 1: //AdVert.Inc, + var advMult = corporation.getAdvertisingMultiplier(); + this.awareness += (5 * advMult); + this.popularity += (1 * advMult); + this.awareness *= (1.01 * advMult); + this.popularity *= ((1 + Math.random(5, 15) / 100) * advMult); + break; + default: + console.log("ERROR: Un-implemented function index: " + upgN); + break; + } +} + Industry.prototype.toJSON = function() { return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Industry", this); } @@ -39866,21 +40719,21 @@ function Employee(params={}) { this.name = params.name ? params.name : "Bobby"; //Morale, happiness, and energy are 0-100 - this.mor = params.morale ? params.morale : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100); - this.hap = params.happiness ? params.happiness : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100); - this.ene = params.energy ? params.energy : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100); + this.mor = params.morale ? params.morale : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 100); + this.hap = params.happiness ? params.happiness : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 100); + this.ene = params.energy ? params.energy : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 100); - this.age = params.age ? params.age : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(20, 50); - this.int = params.intelligence ? params.intelligence : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50); - this.cha = params.charisma ? params.charisma : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50); - this.exp = params.experience ? params.experience : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50); - this.cre = params.creativity ? params.creativity : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50); - this.eff = params.efficiency ? params.efficiency : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50); - this.sal = params.salary ? params.salary : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0.1, 5); + this.age = params.age ? params.age : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(20, 50); + this.int = params.intelligence ? params.intelligence : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(10, 50); + this.cha = params.charisma ? params.charisma : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(10, 50); + this.exp = params.experience ? params.experience : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(10, 50); + this.cre = params.creativity ? params.creativity : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(10, 50); + this.eff = params.efficiency ? params.efficiency : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(10, 50); + this.sal = params.salary ? params.salary : Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(0.1, 5); this.pro = 0; //Productivity, This is calculated this.loc = params.loc ? params.loc : ""; - this.pos = params.position ? params.position : EmployeePositions.Operations; + this.pos = EmployeePositions.Unassigned; } //Returns the amount the employee needs to be paid @@ -39939,6 +40792,9 @@ Employee.prototype.calculateProductivity = function(corporation) { prodMult = (1.5 * effInt) + (0.8 * this.exp) + (effCre) + (0.5 * effEff); break; + case EmployeePositions.Unassigned: + prodMult = 0; + break; default: console.log("ERROR: Invalid employee position: " + this.pos); break; @@ -39963,7 +40819,7 @@ Employee.prototype.createUI = function(panel, corporation) { effInt = this.int * corporation.getEmployeeIntMultiplier(), effEff = this.eff * corporation.getEmployeeEffMultiplier(); panel.style.color = "white"; - panel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + panel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { id:"cmpy-mgmt-employee-" + this.name + "-panel-text", innerHTML:"Morale: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.mor, 3) + "
" + "Happiness: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.hap, 3) + "
" + @@ -39978,10 +40834,10 @@ Employee.prototype.createUI = function(panel, corporation) { })); //Selector for employee position - var selector = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("select", {}); + var selector = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("select", {}); for (var key in EmployeePositions) { if (EmployeePositions.hasOwnProperty(key)) { - selector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("option", { + selector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("option", { text: EmployeePositions[key], value: EmployeePositions[key], })); @@ -40107,18 +40963,19 @@ OfficeSpace.prototype.calculateEmployeeProductivity = function(marketCycles=1, c } //Takes care of UI as well -OfficeSpace.prototype.findEmployees = function(company) { +OfficeSpace.prototype.findEmployees = function(parentRefs) { + var company = parentRefs.corporation, division = parentRefs.division; if (document.getElementById("cmpy-mgmt-hire-employee-popup") != null) {return;} //Generate three random employees (meh, decent, amazing) - var mult1 = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(25, 50)/100, - mult2 = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(51, 75)/100, - mult3 = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(76, 100)/100; - var int = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100), - cha = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100), - exp = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100), - cre = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100), - eff = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100), + var mult1 = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(25, 50)/100, + mult2 = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(51, 75)/100, + mult3 = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(76, 100)/100; + var int = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 100), + cha = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 100), + exp = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 100), + cre = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 100), + eff = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(50, 100), sal = 2.2 * (int + cha + exp + cre + eff); var emp1 = new Employee({ @@ -40148,12 +41005,12 @@ OfficeSpace.prototype.findEmployees = function(company) { salary: sal * mult3, }); - var text = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("h1", { + var text = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("h1", { innerHTML: "Select one of the following candidates for hire:", }); var createEmpDiv = function(employee, office) { - var div = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { + var div = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { class:"cmpy-mgmt-find-employee-option", innerHTML: "Intelligence: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(employee.int, 1) + "
" + "Charisma: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(employee.cha, 1) + "
" + @@ -40162,20 +41019,20 @@ OfficeSpace.prototype.findEmployees = function(company) { "Efficiency: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(employee.eff, 1) + "
" + "Salary: " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(employee.sal).format('$0.000a') + " \ s
", clickListener:()=>{ - office.hireEmployee(employee, company); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])("cmpy-mgmt-hire-employee-popup"); + office.hireEmployee(employee, parentRefs); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])("cmpy-mgmt-hire-employee-popup"); return false; } }); return div; }; - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Cancel", float:"right", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])("cmpy-mgmt-hire-employee-popup"); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])("cmpy-mgmt-hire-employee-popup"); return false; } }); @@ -40186,10 +41043,11 @@ OfficeSpace.prototype.findEmployees = function(company) { createEmpDiv(emp3, this), cancelBtn]; - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])("cmpy-mgmt-hire-employee-popup", elems); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])("cmpy-mgmt-hire-employee-popup", elems); } -OfficeSpace.prototype.hireEmployee = function(employee, company) { +OfficeSpace.prototype.hireEmployee = function(employee, parentRefs) { + var company = parentRefs.corporation, division = parentRefs.division; var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["j" /* yesNoTxtInpBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["i" /* yesNoTxtInpBoxGetNoButton */])(); yesBtn.innerHTML = "Hire"; @@ -40204,7 +41062,7 @@ OfficeSpace.prototype.hireEmployee = function(employee, company) { } employee.name = name; this.employees.push(employee); - company.updateUIContent(); + company.displayDivisionContent(division, currentCityUi); return Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])(); }); noBtn.addEventListener("click", ()=>{ @@ -40213,6 +41071,28 @@ OfficeSpace.prototype.hireEmployee = function(employee, company) { Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["g" /* yesNoTxtInpBoxCreate */])("Give your employee a nickname!"); } +//Finds the first unassigned employee and assigns its to the specified job +OfficeSpace.prototype.assignEmployeeToJob = function(job) { + for (var i = 0; i < this.employees.length; ++i) { + if (this.employees[i].pos === EmployeePositions.Unassigned) { + this.employees[i].pos = job; + return true; + } + } + return false; +} + +//Finds the first employee with the given job and unassigns it +OfficeSpace.prototype.unassignEmployeeFromJob = function(job) { + for (var i = 0; i < this.employees.length; ++i) { + if (this.employees[i].pos === job) { + this.employees[i].pos = EmployeePositions.Unassigned; + return true; + } + } + return false; +} + OfficeSpace.prototype.toJSON = function() { return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("OfficeSpace", this); } @@ -40275,11 +41155,11 @@ Warehouse.prototype.createUI = function(parentRefs) { return; } var company = parentRefs.company, industry = parentRefs.industry; - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeChildrenFromElement */])(industryWarehousePanel); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["j" /* removeChildrenFromElement */])(industryWarehousePanel); var storageText = "Storage: " + (this.sizedUsed >= this.size ? Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.sizeUsed, 3) : Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.sizeUsed, 3)) + "/" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.size, 3); - industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: storageText, display:"inline-block", color: this.sizeUsed >= this.size ? "red" : "white", @@ -40287,7 +41167,7 @@ Warehouse.prototype.createUI = function(parentRefs) { //Upgrade warehouse size button var upgradeCost = WarehouseUpgradeBaseCost * Math.pow(1.07, Math.round(this.size / 100) - 1); - industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { innerText:"Upgrade Warehouse Size - " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(upgradeCost).format('$0.000a'), display:"inline-block", class: company.funds.lt(upgradeCost) ? "a-link-button-inactive" : "a-link-button", @@ -40339,12 +41219,12 @@ Warehouse.prototype.createUI = function(parentRefs) { console.log("ERROR: Invalid state: " + industry.state); break; } - industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML:reqText, })); //Materials - industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: "
Materials:
", })); for (var matName in this.materials) { @@ -40359,7 +41239,7 @@ Warehouse.prototype.createUI = function(parentRefs) { //Products if (!(industry.makesProducts && Object.keys(industry.products).length > 0)) {return;} - industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: "
Products:
", })); for (var productName in industry.products) { @@ -40377,7 +41257,7 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { var company = parentRefs.company, industry = parentRefs.industry; var purchasePopupId = "cmpy-mgmt-material-purchase-popup", sellPopupid = "cmpy-mgmt-material-sell-popup"; - var div = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { + var div = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { class:"cmpy-mgmt-warehouse-material-div", }); @@ -40409,28 +41289,28 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { "The quality of your material. Higher quality " + "will lead to more sales

"; - div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: innerTxt, id: "cmpy-mgmt-warehouse-" + matName + "-text", display:"inline-block", })); - var buttonPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { + var buttonPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { display:"inline-block", }); div.appendChild(buttonPanel); //Button to set purchase amount - buttonPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + buttonPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { innerText: "Buy (" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.buy, 3) + ")", display:"inline-block", class:"a-link-button", clickListener:()=>{ - var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: "Enter the amount of " + mat.name + " you would like " + "to purchase per second. This material's cost changes constantly" }); - var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { + var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { type:"number", value:mat.buy ? mat.buy : null, placeholder: "Purchase amount" }); - var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { innerText:"Confirm", class:"a-link-button", clickListener:()=>{ if (isNaN(input.value)) { @@ -40438,19 +41318,19 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { } else { mat.buy = parseFloat(input.value); if (isNaN(mat.buy)) {mat.buy = 0;} - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(purchasePopupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(purchasePopupId); this.createUI(parentRefs); return false; } } }); - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { innerText:"Cancel", class:"a-link-button", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(purchasePopupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(purchasePopupId); } }); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(purchasePopupId, [txt, input, confirmBtn, cancelBtn]); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(purchasePopupId, [txt, input, confirmBtn, cancelBtn]); input.focus(); } })); @@ -40459,17 +41339,17 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { if (company.unlockUpgrades[0] === 1) { //Export unlock upgrade function createExportPopup() { var popupId = "cmpy-mgmt-export-popup"; - var exportTxt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var exportTxt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerText:"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." }); //Select industry and city to export to - var industrySelector = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("select", {}), - citySelector = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("select", {}); + var industrySelector = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("select", {}), + citySelector = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("select", {}); for (var i = 0; i < company.divisions.length; ++i) { - industrySelector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("option", { + industrySelector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("option", { text:company.divisions[i].name, value:company.divisions[i].name, changeListener:()=>{ var industryName = industrySelector.options[industrySelector.selectedIndex].value; @@ -40479,7 +41359,7 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { var selectedIndustry = company.divisions[foo]; for (var cityName in company.divisions[foo].warehouses) { if (company.divisions[foo].warehouses[cityName] instanceof Warehouse) { - citySelector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("option", { + citySelector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("option", { value:cityName, text:cityName, })); } @@ -40497,7 +41377,7 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { for (var cityName in company.divisions[i].warehouses) { if (company.divisions[i].warehouses.hasOwnProperty(cityName) && company.divisions[i].warehouses[cityName] instanceof Warehouse) { - citySelector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("option", { + citySelector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("option", { value:cityName, text:cityName, })); } @@ -40507,11 +41387,11 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { } //Select amount to export - var exportAmount = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { + var exportAmount = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { type:"number", placeholder:"Export amount / s" }); - var exportBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var exportBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", display:"inline-block", innerText:"Export", clickListener:()=>{ var industryName = industrySelector.options[industrySelector.selectedIndex].text, @@ -40530,7 +41410,7 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { var warehouse = company.divisions[i].warehouses[cityName]; if (warehouse instanceof Warehouse) { warehouse.materials[matName].imp += amt; - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } else { console.log("ERROR: Target city for export does not have warehouse in specified city"); @@ -40538,27 +41418,27 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { } } console.log("ERROR: Could not find target industry/city for export"); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", display:"inline-block", innerText:"Cancel", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - var currExportsText = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var currExportsText = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerText:"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." }); var currExports = []; for (var i = 0; i < mat.exp.length; ++i) { (function(i, mat, currExports){ - currExports.push(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { + currExports.push(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { class:"cmpy-mgmt-existing-export", innerHTML: "Industry: " + mat.exp[i].ind + "
" + "City: " + mat.exp[i].city + "
" + @@ -40576,38 +41456,44 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { } } mat.exp.splice(i, 1); //Remove export object - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); createExportPopup(); } })); })(i, mat, currExports); } - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [exportTxt, industrySelector, citySelector, exportAmount, + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(popupId, [exportTxt, industrySelector, citySelector, exportAmount, exportBtn, cancelBtn, currExportsText].concat(currExports)); } - buttonPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + buttonPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { innerText:"Export", display:"inline-block", class:"a-link-button", clickListener:()=>{createExportPopup();} })); } - buttonPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("br", {})); // Force line break + buttonPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br", {})); // Force line break //Button to set sell amount - var innerTextString = (mat.sllman[1] === -1 ? "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sll, 3) + "/MAX)" : - "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sll, 3) + "/" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sllman[1], 3) + ")") - if (mat.sCost) { - if (Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["f" /* isString */])(mat.sCost)) { - var sCost = mat.sCost.replace(/MP/g, mat.bCost); - innerTextString += " @ $" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(eval(sCost), 2); - } else { - innerTextString += " @ $" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sCost, 2); + var innerTextString; + if (mat.sllman[0]) { + innerTextString = (mat.sllman[1] === -1 ? "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sll, 3) + "/MAX)" : + "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sll, 3) + "/" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sllman[1], 3) + ")"); + if (mat.sCost) { + if (Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["f" /* isString */])(mat.sCost)) { + var sCost = mat.sCost.replace(/MP/g, mat.bCost); + innerTextString += " @ $" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(eval(sCost), 2); + } else { + innerTextString += " @ $" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sCost, 2); + } } + } else { + innerTextString = "Sell (0.000/0.000)"; } - buttonPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + + buttonPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { innerText: innerTextString, display:"inline-block", class:"a-link-button", clickListener:()=>{ - var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: "Enter the maximum amount of " + mat.name + " you would like " + "to sell per second, as well as the price at which you would " + "like to sell at.

" + @@ -40619,16 +41505,17 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { "changing price that depends on the market price. For example, if you set the sell price " + "to 'MP+10' then it will always be sold at $10 above the market price.", }); - var inputQty = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { - type:"text", value: mat.sllman[1] ? mat.sllman[1] : null, placeholder: "Sell amount" + var br = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br", {}); + var inputQty = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { + type:"text", marginTop:"4px", + value: mat.sllman[1] ? mat.sllman[1] : null, placeholder: "Sell amount" }); - var inputPx = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { - type:"text", value: mat.sCost ? mat.sCost : null, placeholder: "Sell price" + var inputPx = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { + type:"text", marginTop:"4px", + value: mat.sCost ? mat.sCost : null, placeholder: "Sell price" }); - var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { - innerText:"Confirm", - class:"a-link-button", - margin:"6px", + var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + innerText:"Confirm", class:"a-link-button", margin:"6px", clickListener:()=>{ //Parse price //Sanitize cost @@ -40659,6 +41546,7 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { if (isNaN(qty)) {qty = 0;} if (qty === 0) { mat.sllman[0] = false; + mat.sllman[1] = 0; } else { mat.sllman[0] = true; mat.sllman[1] = qty; @@ -40666,19 +41554,17 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { } this.createUI(parentRefs); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(sellPopupid); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(sellPopupid); return false; } }); - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { - innerText:"Cancel", - class:"a-link-button", - margin: "6px", + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + innerText:"Cancel", class:"a-link-button", margin: "6px", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(sellPopupid); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(sellPopupid); } }); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(sellPopupid, [txt, inputQty, inputPx, confirmBtn, cancelBtn]); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(sellPopupid, [txt, br, inputQty, inputPx, confirmBtn, cancelBtn]); inputQty.focus(); } })); @@ -40689,13 +41575,13 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { Warehouse.prototype.createProductUI = function(product, parentRefs) { var company = parentRefs.company, industry = parentRefs.industry, city = currentCityUi; - var div = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { + var div = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { class:"cmpy-mgmt-warehouse-product-div" }); //Products being designed TODO if (!product.fin) { - div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: "Designing " + product.name + "...
" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.prog, 2) + "% complete", })); @@ -40705,7 +41591,7 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) { //Completed products var totalGain = product.data[city][1] - product.data[city][2]; //Production - sale - div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: "

" + product.name + ": " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.data[city][0], 3) + //Quantity "(" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalGain, 3) + "/s)" + "Prod: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.data[city][1], 3) + "/s
" + @@ -40723,7 +41609,7 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) { "product is, the higher you can mark up its price.


" + "Size: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.siz, 3), })); - var buttonPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { + var buttonPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { display:"inline-block", }); div.appendChild(buttonPanel); @@ -40734,11 +41620,11 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) { if (product.sCost) { sellInnerTextString += (" @ " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(product.sCost).format("$0.000a")); } - div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { innerText:sellInnerTextString, class:"a-link-button", display:"inline-block",margin:"6px", clickListener:()=>{ var popupId = "cmpy-mgmt-sell-product-popup"; - var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML:"Enter the maximum amount of " + product.name + " you would like " + "to sell per second, as well as the price at which you would like to " + "sell it at.

" + @@ -40747,13 +41633,13 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) { "Setting the sell amount to 'MAX' will result in you always selling the " + "maximum possible amount of the material.

", }); - var inputQty = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { + var inputQty = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { type:"text", value:product.sllman[city][1] ? product.sllman[city][1] : null, placeholder: "Sell amount" }); - var inputPx = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { + var inputPx = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { type:"text", value: product.sCost ? product.sCost : null, placeholder: "Sell price" }); - var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Confirm", clickListener:()=>{ //Parse price @@ -40782,45 +41668,45 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) { } } this.createUI(parentRefs); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Cancel", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, inputQty, inputPx, confirmBtn, cancelBtn]); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(popupId, [txt, inputQty, inputPx, confirmBtn, cancelBtn]); inputQty.focus(); } })); - div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("br",{})); //force line break + div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br",{})); //force line break //Limit production button var limitProductionInnerText = "Limit Production"; if (product.prdman[city][0]) { limitProductionInnerText += " (" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.prdman[city][1], 3) + ")"; } - div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:limitProductionInnerText,display:"inline-block", clickListener:()=>{ var popupId = "cmpy-mgmt-limit-product-production-popup"; - var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerText:"Enter a limit to the amount of this product you would " + "like to product per second. Leave the box empty to set no limit." }); - var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { + var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { type:"number", placeholder:"Limit" }); - var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", display:"inline-block", innerText:"Limit production", margin:'6px', clickListener:()=>{ if (input.value === "") { product.prdman[city][0] = false; - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } var qty = parseFloat(input.value); @@ -40834,48 +41720,48 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) { product.prdman[city][0] = true; product.prdman[city][1] = qty; } - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", display:"inline-block", innerText:"Cancel", margin:"6px", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, input, confirmBtn, cancelBtn]); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(popupId, [txt, input, confirmBtn, cancelBtn]); } })); //Discontinue button - div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:'a-link-button', display:"inline-block",innerText:"Discontinue", clickListener:()=>{ var popupId = "cmpy-mgmt-discontinue-product-popup"; - var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerText:"Are you sure you want to do this? Discontinuing a product " + "removes it completely and permanently. You will no longer " + "produce this product and all of its existing stock will be " + "removed and left unsold", }); - var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button",innerText:"Discontinue", clickListener:()=>{ industry.discontinueProduct(product, parentRefs); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Cancel", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, confirmBtn, cancelBtn]); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(popupId, [txt, confirmBtn, cancelBtn]); } })); industryWarehousePanel.appendChild(div); @@ -40922,46 +41808,48 @@ var CorporationUnlockUpgrades = { // name, desc] var CorporationUpgrades = { //Smart factories, increases production - "0": [0, 4e9, 1.07, 0.02, + "0": [0, 2e9, 1.07, 0.02, "Smart Factories", "Advanced AI automatically optimizes the operation and productivity " + "of factories. Each level of this upgrade increases your global production by 2% (additive)."], //Smart warehouses, increases storage size - "1": [1, 4e9, 1.07, .1, + "1": [1, 2e9, 1.07, .1, "Smart Storage", "Advanced AI automatically optimizes your warehouse storage methods. " + "Each level of this upgrade increases your global warehouse storage size by 10% (additive)."], //Advertise through dreams, passive popularity/ awareness gain - "2": [2, 999999e9, 1.08, .001, - "DreamSense", "NOT YET IMPLEMENTED! - Use DreamSense LCC Technologies to advertise your corporation " + + "2": [2, 8e9, 1.09, .001, + "DreamSense", "Use DreamSense LCC Technologies to advertise your corporation " + "to consumers through their dreams. Each level of this upgrade provides a passive " + - "increase in awareness of your company by 0.001 / second."], + "increase in awareness of all of your companies (divisions) by 0.004 / market cycle," + + "and in popularity by 0.001 / market cycle. A market cycle is approximately " + + "20 seconds."], //Makes advertising more effective - "3": [3, 999999e9, 1.11, 0.1, - "Wilson Analytics", "NOT YET IMPLEMENTED - Purchase data and analysis from Wilson, a marketing research " + + "3": [3, 4e9, 1.11, 0.1, + "Wilson Analytics", "Purchase data and analysis from Wilson, a marketing research " + "firm. Each level of this upgrades increases the effectiveness of your " + "advertising by 10% (additive)."], //Augmentation for employees, increases cre - "4": [4, 2e9, 1.06, 0.1, + "4": [4, 1e9, 1.06, 0.1, "Nuoptimal Nootropic Injector Implants", "Purchase the Nuoptimal Nootropic " + "Injector augmentation for your employees. Each level of this upgrade " + "globally increases the creativity of your employees by 10% (additive)."], //Augmentation for employees, increases cha - "5": [5, 2e9, 1.06, 0.1, + "5": [5, 1e9, 1.06, 0.1, "Speech Processor Implants", "Purchase the Speech Processor augmentation for your employees. " + "Each level of this upgrade globally increases the charisma of your employees by 10% (additive)."], //Augmentation for employees, increases int - "6": [6, 2e9, 1.06, 0.1, + "6": [6, 1e9, 1.06, 0.1, "Neural Accelerators", "Purchase the Neural Accelerator augmentation for your employees. " + "Each level of this upgrade globally increases the intelligence of your employees " + "by 10% (additive)."], //Augmentation for employees, increases eff - "7": [7, 2e9, 1.06, 0.1, + "7": [7, 1e9, 1.06, 0.1, "FocusWires", "Purchase the FocusWire augmentation for your employees. Each level " + "of this upgrade globally increases the efficiency of your employees by 10% (additive)."], @@ -40972,7 +41860,7 @@ var CorporationUpgrades = { "by 1% (additive)."], //Improves scientific research rate - "9": [9, 5e9, 1.08, 0.05, + "9": [9, 5e9, 1.07, 0.05, "Project Insight", "Purchase 'Project Insight', a R&D service provided by the secretive " + "Fulcrum Technologies. Each level of this upgrade globally increases the amount of " + "Scientific Research you produce by 5% (additive)."], @@ -41039,7 +41927,7 @@ Corporation.prototype.process = function(numCycles=1) { Corporation.prototype.determineValuation = function() { var val, profit = (this.revenue.minus(this.expenses)).toNumber(); if (this.public) { - val = 25e9 + this.funds.toNumber() + (profit * 25e3); + val = this.funds.toNumber() + (profit * 100e3); val *= (Math.pow(1.1, this.divisions.length)); val = Math.max(val, 0); } else { @@ -41073,7 +41961,7 @@ Corporation.prototype.getInvestment = function() { case 4: return; } - var funding = val * percShares, + var funding = val * percShares * 2, investShares = Math.floor(TOTALSHARES * percShares), yesBtn = Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])(); @@ -41083,6 +41971,7 @@ Corporation.prototype.getInvestment = function() { ++this.fundingRound; this.funds = this.funds.plus(funding); this.numShares -= investShares; + this.displayCorporationOverviewContent(); return Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["a" /* yesNoBoxClose */])(); }); noBtn.addEventListener("click", ()=>{ @@ -41097,20 +41986,21 @@ Corporation.prototype.getInvestment = function() { Corporation.prototype.goPublic = function() { var goPublicPopupId = "cmpy-mgmt-go-public-popup"; var initialSharePrice = this.determineValuation() / (TOTALSHARES); - var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: "Enter the number of shares you would like to issue " + "for your IPO. These shares will be publicly sold " + "and you will no longer own them. You will receive " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(initialSharePrice).format('$0.000a') + " per share.

" + "Furthermore, issuing more shares now will help drive up " + "your company's stock price in the future.

" + - "You have a total of " + this.numShares + " of shares that you can issue.", + "You have a total of " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(this.numShares).format("0.000a") + " of shares that you can issue.", }); - var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { + var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { type:"number", placeholder: "Shares to issue", }); - var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var br = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br", {}); + var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Go Public", clickListener:()=>{ @@ -41129,19 +42019,19 @@ Corporation.prototype.goPublic = function() { this.issuedShares = numShares; this.numShares -= numShares; this.funds = this.funds.plus(numShares * initialSharePrice); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(goPublicPopupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(goPublicPopupId); return false; } }); - var noBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var noBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Cancel", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(goPublicPopupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(goPublicPopupId); return false; } }); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(goPublicPopupId, [txt, input, yesBtn, noBtn]); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(goPublicPopupId, [txt, br, input, yesBtn, noBtn]); } Corporation.prototype.updateSharePrice = function() { @@ -41210,6 +42100,11 @@ Corporation.prototype.getStorageMultiplier = function() { if (isNaN(mult) || mult < 1) {return 1;} else {return mult;} } +Corporation.prototype.getDreamSenseGain = function() { + var gain = this.upgradeMultipliers[2] - 1; + return gain <= 0 ? 0 : gain; +} + Corporation.prototype.getAdvertisingMultiplier = function() { var mult = this.upgradeMultipliers[3]; if (isNaN(mult) || mult < 1) {return 1;} else {return mult;} @@ -41245,31 +42140,30 @@ Corporation.prototype.getScientificResearchMultiplier = function() { if (isNaN(mult) || mult < 1) {return 1;} else {return mult;} } - //Keep 'global' variables for DOM elements so we don't have to search //through the DOM tree repeatedly when updating UI var companyManagementDiv, companyManagementHeaderTabs, companyManagementPanel, currentCityUi, corporationUnlockUpgrades, corporationUpgrades, industryOverviewPanel, industryOverviewText, - industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeList, + industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeManagementUI, industryEmployeeInfo, industryOfficeUpgradeSizeButton, industryWarehousePanel, headerTabs, cityTabs; Corporation.prototype.createUI = function() { - companyManagementDiv = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { + companyManagementDiv = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { id:"cmpy-mgmt-container", position:"fixed", class:"generic-menupage-container" }); - companyManagementHeaderTabs = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", {id:"cmpy-mgmt-header-tabs"}); + companyManagementHeaderTabs = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", {id:"cmpy-mgmt-header-tabs"}); companyManagementDiv.appendChild(companyManagementHeaderTabs); //Create division/industry tabs at the top this.updateUIHeaderTabs(); //Create the 'panel' that will have the actual content in the UI - companyManagementPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", {id:"cmpy-mgmt-panel"}); + companyManagementPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", {id:"cmpy-mgmt-panel"}); companyManagementDiv.appendChild(companyManagementPanel); document.getElementById("entire-game-container").appendChild(companyManagementDiv); @@ -41278,14 +42172,14 @@ Corporation.prototype.createUI = function() { Corporation.prototype.updateUIHeaderTabs = function() { if (companyManagementHeaderTabs) { - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeChildrenFromElement */])(companyManagementHeaderTabs); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["j" /* removeChildrenFromElement */])(companyManagementHeaderTabs); } else { console.log("ERROR: Header tabs div has not yet been created when Corporation.updateUIHeaderTabs() is called"); return; } //Corporation overview tabs - var cmpyOverviewHdrTab = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("button", { + var cmpyOverviewHdrTab = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("button", { id:"cmpy-mgmt-company-tab", class:"cmpy-mgmt-header-tab", innerText:this.name, @@ -41304,26 +42198,26 @@ Corporation.prototype.updateUIHeaderTabs = function() { } //Create a tab to expand into a new industry - companyManagementHeaderTabs.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("button", { + companyManagementHeaderTabs.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("button", { id:'cmpy-mgmt-expand-industry-tab', class:"cmpy-mgmt-header-tab", innerText:"Expand into new Industry", clickListener: ()=>{ if (document.getElementById("cmpy-mgmt-expand-industry-popup") != null) {return;} - var container = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { + var container = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { class:"popup-box-container", id:"cmpy-mgmt-expand-industry-popup", }), - content = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", {class:"popup-box-content"}), - txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + content = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", {class:"popup-box-content"}), + txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: "Create a new division to expand into a new industry:", }), - selector = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("select", { + selector = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("select", { class:"cmpy-mgmt-industry-select" }), - industryDescription = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", {}), - nameInput = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { + industryDescription = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", {}), + nameInput = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { type:"text", id:"cmpy-mgmt-expand-industry-name-input", color:"white", @@ -41332,11 +42226,11 @@ Corporation.prototype.updateUIHeaderTabs = function() { maxLength: 30, pattern:"[a-zA-Z0-9-_]" }), - nameLabel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("label", { + nameLabel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("label", { for:"cmpy-mgmt-expand-industry-name-input", innerText:"Division name: " }), - yesBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("span", { + yesBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("span", { class:"popup-box-button", innerText:"Create Division", clickListener: ()=>{ @@ -41362,17 +42256,17 @@ Corporation.prototype.updateUIHeaderTabs = function() { this.divisions.push(newInd); this.updateUIHeaderTabs(); this.selectHeaderTab(headerTabs[headerTabs.length-2]); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])("cmpy-mgmt-expand-industry-popup"); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])("cmpy-mgmt-expand-industry-popup"); this.displayDivisionContent(newInd, __WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12); } return false; } }), - noBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("span", { + noBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("span", { class:"popup-box-button", innerText:"Cancel", clickListener: function() { - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])("cmpy-mgmt-expand-industry-popup"); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])("cmpy-mgmt-expand-industry-popup"); return false; } }); @@ -41381,7 +42275,7 @@ Corporation.prototype.updateUIHeaderTabs = function() { for (var key in Industries) { if (Industries.hasOwnProperty(key)) { var ind = Industries[key]; - selector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("option", { + selector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("option", { text: ind, value:key, })); @@ -41427,7 +42321,7 @@ Corporation.prototype.selectHeaderTab = function(currentTab) { Corporation.prototype.createDivisionUIHeaderTab = function(division) { var tabId = "cmpy-mgmt-" + division.name + "-tab"; - var tab = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("button", { + var tab = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("button", { id:tabId, class:"cmpy-mgmt-header-tab", innerText:division.name, @@ -41468,31 +42362,54 @@ Corporation.prototype.updateUIContent = function() { Corporation.prototype.displayCorporationOverviewContent = function() { this.clearUIPanel(); - companyManagementPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + companyManagementPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { id:"cmpy-mgmt-overview-text", })); if (headerTabs && headerTabs.length >= 1) { this.selectHeaderTab(headerTabs[0]); } + //Check if player has Corporation Handbook + var homeComp = __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].getHomeComputer(), hasHandbook = false, + handbookFn = "corporation-management-handbook.lit"; + for (var i = 0; i < homeComp.messages.length; ++i) { + if (Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["f" /* isString */])(homeComp.messages[i]) && homeComp.messages[i] === handbookFn) { + hasHandbook = true; + break; + } + } + + if (!hasHandbook) { + companyManagementPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class:"a-link-button", innerText:"Get Handbook", display:"inline-block", + tooltip:"Get a copy of 'The Complete Handbook for Creating a Successful Corporation.'" + + "This is a .lit file that provides some tips/pointers for helping you get started with " + + "starting and managing a Corporation.", + clickListener:()=>{ + homeComp.messages.push(handbookFn); + this.displayCorporationOverviewContent(); + return false; + } + })); + } + //Investors if (this.public) { //Sell share buttons - var sellShares = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { - class:"a-link-button tooltip", - innerText:"Sell Shares", - display:"inline-block", + var sellShares = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class:"a-link-button", innerText:"Sell Shares", display:"inline-block", + tooltip:"Sell your shares in the company. This is the only way to " + + "profit from your business venture.", clickListener:()=>{ var popupId = "cmpy-mgmt-sell-shares-popup"; var currentStockPrice = this.sharePrice; - var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: "Enter the number of shares you would like to sell. The current price of your " + "company's stock is " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(currentStockPrice).format("$0.000a"), }); - var profitIndicator = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", {}); - var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { - type:"number", - placeholder:"Shares to sell", + var profitIndicator = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", {}); + var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { + type:"number", placeholder:"Shares to sell", margin:"5px", inputListener: ()=> { var numShares = Math.round(input.value); if (isNaN(numShares)) { @@ -41505,10 +42422,8 @@ Corporation.prototype.displayCorporationOverviewContent = function() { } } }); - var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { - class:"a-link-button", - innerText:"Sell shares", - display:"inline-block", + var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class:"a-link-button", innerText:"Sell shares", display:"inline-block", clickListener:()=>{ var shares = Math.round(input.value); if (isNaN(shares)) { @@ -41519,47 +42434,37 @@ Corporation.prototype.displayCorporationOverviewContent = function() { this.numShares -= shares; this.issuedShares += shares; __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].gainMoney(shares * this.sharePrice); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } } }); - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { - class:"a-link-button", - innerText:"Cancel", - display:"inline-block", + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class:"a-link-button", innerText:"Cancel", display:"inline-block", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, profitIndicator, input, confirmBtn, cancelBtn]); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(popupId, [txt, profitIndicator, input, confirmBtn, cancelBtn]); } }); - var sellSharesTooltip = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("span", { - class:"tooltiptext", - innerText:"Sell your shares in the company. This is the only way to " + - "profit from your business venture.", - }); - sellShares.appendChild(sellSharesTooltip); //Buyback shares button - var buybackShares = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { - class:"a-link-button tooltip", - innerText:"Buyback shares", - display:"inline-block", + var buybackShares = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class:"a-link-button", innerText:"Buyback shares", display:"inline-block", + tooltip:"Buy back shares you that previously issued or sold at market price.", clickListener:()=>{ var popupId = "cmpy-mgmt-buyback-shares-popup"; var currentStockPrice = this.sharePrice; - var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML: "Enter the number of shares you would like to buy back at market price. The current price of your " + "company's stock is " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(currentStockPrice).format("$0.000a"), }); - var costIndicator = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", {}); - var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { - type:"number", - placeholder:"Shares to sell", + var costIndicator = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", {}); + var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { + type:"number", placeholder:"Shares to buyback", margin:"5px", inputListener: ()=> { var numShares = Math.round(input.value); //TODO add conditional for if player doesn't have enough money @@ -41574,10 +42479,8 @@ Corporation.prototype.displayCorporationOverviewContent = function() { } } }); - var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { - class:"a-link-button", - innerText:"Sell shares", - display:"inline-block", + var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class:"a-link-button", innerText:"Buy shares", display:"inline-block", clickListener:()=>{ var shares = Math.round(input.value); var tempStockPrice = this.sharePrice; @@ -41591,36 +42494,31 @@ Corporation.prototype.displayCorporationOverviewContent = function() { } else { this.numShares += shares; this.issuedShares -= shares; + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].loseMoney(shares * tempStockPrice); //TODO REMOVE from Player money - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); } return false; } }); - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Cancel", display:"inline-block", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, costIndicator, input, confirmBtn, cancelBtn]); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(popupId, [txt, costIndicator, input, confirmBtn, cancelBtn]); } }); - var buybackSharesTooltip = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("span", { - class:"tooltiptext", - innerText:"Buy back shares you that previously issued or sold at market " + - "price." - }); - buybackShares.appendChild(buybackSharesTooltip); companyManagementPanel.appendChild(sellShares); companyManagementPanel.appendChild(buybackShares); } else { - var findInvestors = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var findInvestors = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class: this.fundingRound >= 4 ? "a-link-button-inactive" : "a-link-button tooltip", innerText: "Find Investors", display:"inline-block", @@ -41628,14 +42526,16 @@ Corporation.prototype.displayCorporationOverviewContent = function() { this.getInvestment(); } }); - var findInvestorsTooltip = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("span", { - class:"tooltiptext", - innerText:"Search for private investors who will give you startup funding in exchange " + - "for equity (stock shares) in your company" - }); - findInvestors.appendChild(findInvestorsTooltip); + if (this.fundingRound < 4) { + var findInvestorsTooltip = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("span", { + class:"tooltiptext", + innerText:"Search for private investors who will give you startup funding in exchange " + + "for equity (stock shares) in your company" + }); + findInvestors.appendChild(findInvestorsTooltip); + } - var goPublic = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var goPublic = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button tooltip", innerText:"Go Public", display:"inline-block", @@ -41644,7 +42544,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() { return false; } }); - var goPublicTooltip = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("span", { + var goPublicTooltip = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("span", { class:"tooltiptext", innerText: "Become a publicly traded and owned entity. Going public involves " + "issuing shares for an IPO. Once you are a public company, " + @@ -41662,10 +42562,10 @@ Corporation.prototype.displayCorporationOverviewContent = function() { //Don't show upgrades if player hasn't opened any divisions if (this.divisions.length <= 0) {return; } //Corporation Upgrades - var upgradeContainer = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { + var upgradeContainer = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { class:"cmpy-mgmt-upgrade-container", }); - upgradeContainer.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("h1", { + upgradeContainer.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("h1", { innerText:"Unlocks", margin:"6px", padding:"6px", })); @@ -41690,8 +42590,8 @@ Corporation.prototype.displayCorporationOverviewContent = function() { return; } - upgradeContainer.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { - class:"cmpy-mgmt-upgrade-div", + upgradeContainer.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { + class:"cmpy-mgmt-upgrade-div", width:"45%", innerHTML:upgrade[2] + " - " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(upgrade[1]).format("$0.000a"), tooltip: upgrade[3], clickListener:()=>{ @@ -41708,7 +42608,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() { } //Levelable upgrades - upgradeContainer.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("h1", { + upgradeContainer.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("h1", { innerText:"Upgrades", margin:"6px", padding:"6px", })); @@ -41722,8 +42622,8 @@ Corporation.prototype.displayCorporationOverviewContent = function() { var baseCost = upgrade[1], priceMult = upgrade[2]; var cost = baseCost * Math.pow(priceMult, corp.upgrades[i]); - upgradeContainer.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { - class:"cmpy-mgmt-upgrade-div", + upgradeContainer.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { + class:"cmpy-mgmt-upgrade-div", width:"45%", innerHTML:upgrade[4] + " - " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(cost).format("$0.000a"), tooltip:upgrade[5], clickListener:()=>{ @@ -41799,19 +42699,19 @@ Corporation.prototype.displayDivisionContent = function(division, city) { } //Expand into new City button - companyManagementPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("button", { + companyManagementPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("button", { class:"cmpy-mgmt-city-tab", innerText:"Expand into new City", display:"inline-block", clickListener:()=>{ var popupId = "cmpy-mgmt-expand-city-popup"; - var text = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var text = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerText: "Would you like to expand into a new city by opening an office? " + "This would cost " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(OfficeInitialCost).format('$0.000a'), }); - var citySelector = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("select", {}); + var citySelector = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("select", {margin:"5px"}); for (var cityName in division.offices) { if (division.offices.hasOwnProperty(cityName)) { if (!(division.offices[cityName] instanceof OfficeSpace)) { - citySelector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("option", { + citySelector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("option", { text: cityName, value: cityName })); @@ -41819,7 +42719,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) { } } - var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { innerText:"Confirm", class:"a-link-button", display:"inline-block", margin:"3px", clickListener:()=>{ var city = citySelector.options[citySelector.selectedIndex].value; @@ -41834,56 +42734,104 @@ Corporation.prototype.displayDivisionContent = function(division, city) { }); this.displayDivisionContent(division, city); } - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { innerText:"Cancel", class:"a-link-button", display:"inline-block", margin:"3px", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }) - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [text, citySelector, confirmBtn, cancelBtn]); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(popupId, [text, citySelector, confirmBtn, cancelBtn]); return false; } })); - companyManagementPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("br", {})); // Force line break + companyManagementPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br", {})); // Force line break + + //Get office object + var office = division.offices[currentCityUi]; + if (!(office instanceof OfficeSpace)) { + console.log("ERROR: Current city for UI does not have an office space"); + return; + } //Left and right panels - var leftPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { - class:"cmpy-mgmt-industry-left-panel" - }); - var rightPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { - class:"cmpy-mgmt-industry-right-panel" - }); + var leftPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", {class:"cmpy-mgmt-industry-left-panel"}); + var rightPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", {class:"cmpy-mgmt-industry-right-panel"}); companyManagementPanel.appendChild(leftPanel); companyManagementPanel.appendChild(rightPanel); //Different sections (Overview, Employee/Office, and Warehouse) - industryOverviewPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { - id:"cmpy-mgmt-industry-overview-panel", - class:"cmpy-mgmt-industry-overview-panel" + industryOverviewPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { + id:"cmpy-mgmt-industry-overview-panel", class:"cmpy-mgmt-industry-overview-panel" }); leftPanel.appendChild(industryOverviewPanel); - industryEmployeePanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { - id:"cmpy-mgmt-employee-panel", - class:"cmpy-mgmt-employee-panel" + industryEmployeePanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { + id:"cmpy-mgmt-employee-panel", class:"cmpy-mgmt-employee-panel" }); leftPanel.appendChild(industryEmployeePanel); - industryWarehousePanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", { - id:"cmpy-mgmt-warehouse-panel", - class:"cmpy-mgmt-warehouse-panel" + industryWarehousePanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { + id:"cmpy-mgmt-warehouse-panel", class:"cmpy-mgmt-warehouse-panel" }); rightPanel.appendChild(industryWarehousePanel); - //Industry overview text element - industryOverviewText = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", {}); + //Industry overview text + industryOverviewText = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", {}); industryOverviewPanel.appendChild(industryOverviewText); + //Industry overview Purchases & Upgrades + var numUpgrades = Object.keys(IndustryUpgrades).length; + while (division.upgrades.length < numUpgrades) {division.upgrades.push(0);} //Backwards compatibility + + var industryOverviewUpgrades = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", {}); + industryOverviewUpgrades.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("h1", {innerText:"Purchases & Upgrades", margin:"4px", padding:"4px"})); + for (var i = 0; i < numUpgrades; ++i) { + (function(i, corp, division, office) { + var upgrade = IndustryUpgrades[i.toString()]; + if (upgrade == null) { + console.log("ERROR: Could not find levelable upgrade index: " + i); + return; + } + + var baseCost = upgrade[1], priceMult = upgrade[2], cost = 0; + switch(i) { + case 0: //Coffee, cost is static per employee + cost = office.employees.length * baseCost; + break; + default: + cost = baseCost * Math.pow(priceMult, division.upgrades[i]); + break; + } + industryOverviewUpgrades.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", { + class:"cmpy-mgmt-upgrade-div", display:"inline-block", + innerHTML:upgrade[4] + ' - ' + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(cost).format("$0.000a"), + tooltip:upgrade[5], + clickListener:()=>{ + if (corp.funds.lt(cost)) { + Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Insufficient funds"); + } else { + corp.funds = corp.funds.minus(cost); + division.upgrade(upgrade, { + corporation:corp, + office:office, + }); + corp.displayDivisionContent(division, city); + } + } + })); + industryOverviewUpgrades.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br", {})); + + })(i, this, division, office); + } + + + industryOverviewPanel.appendChild(industryOverviewUpgrades); + //Industry Overview 'Create Product' button if applicable if (division.makesProducts) { //Get the text on the button based on Industry type @@ -41935,17 +42883,17 @@ Corporation.prototype.displayDivisionContent = function(division, city) { "Investing money in marketing the product will help the product's sales."; //Create the button - industryOverviewPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + industryOverviewPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:createProductButtonText, margin:"6px", display:"inline-block", clickListener:()=>{ var popupId = "cmpy-mgmt-create-product-popup"; - var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML:createProductPopupText, }); - var designCity = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("select", {}); + var designCity = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("select", {}); for (var cityName in division.offices) { if (division.offices[cityName] instanceof OfficeSpace) { - designCity.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("option", { + designCity.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("option", { value:cityName, text:cityName })); @@ -41959,19 +42907,19 @@ Corporation.prototype.displayDivisionContent = function(division, city) { } else if (division.type === Industries.RealEstate) { foo = "Property Name"; } - var productNameInput = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { + var productNameInput = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { placeholder:foo, }); - var lineBreak1 = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("br",{}); - var designInvestInput = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { + var lineBreak1 = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br",{}); + var designInvestInput = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { type:"number", placeholder:"Design investment" }); - var marketingInvestInput = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { + var marketingInvestInput = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { type:"number", placeholder:"Marketing investment" }); - var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Develop Product", clickListener:()=>{ @@ -41996,33 +42944,28 @@ Corporation.prototype.displayDivisionContent = function(division, city) { }); this.funds = this.funds.minus(designInvest + marketingInvest); division.products[product.name] = product; - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); } this.updateUIContent(); return false; } }) - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Cancel", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }) - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, designCity, productNameInput, lineBreak1, + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(popupId, [txt, designCity, productNameInput, lineBreak1, designInvestInput, marketingInvestInput, confirmBtn, cancelBtn]); } })); } //Employee and Office Panel - var office = division.offices[currentCityUi]; - if (!(office instanceof OfficeSpace)) { - console.log("ERROR: Current city for UI does not have an office space"); - return; - } - industryEmployeeText = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + industryEmployeeText = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { id: "cmpy-mgmt-employee-p", display:"block", innerHTML: "

Office Space


" + @@ -42033,28 +42976,28 @@ Corporation.prototype.displayDivisionContent = function(division, city) { }); industryEmployeePanel.appendChild(industryEmployeeText); - industryEmployeeHireButton = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + industryEmployeeHireButton = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Hire Employee", display:"inline-block", clickListener:()=>{ - office.findEmployees(this); + office.findEmployees({corporation:this, division:division}); return false; } }); industryEmployeePanel.appendChild(industryEmployeeHireButton); //Upgrade Office Size button - industryOfficeUpgradeSizeButton = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + industryOfficeUpgradeSizeButton = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Upgrade Office size", display:"inline-block", margin:"6px", clickListener:()=>{ var popupId = "cmpy-mgmt-upgrade-office-size-popup"; - var upgradeCost = OfficeInitialCost * Math.pow(1.13, Math.round(office.size / OfficeInitialSize)); - var text = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var upgradeCost = OfficeInitialCost * Math.pow(1.07, Math.round(office.size / OfficeInitialSize)); + var text = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerHTML:"Increase the size of your office space to fit " + OfficeInitialSize + " more employees. This will cost " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(upgradeCost).format('$0.000a'), }); - var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", display:"inline-block", margin:"8px", @@ -42068,44 +43011,42 @@ Corporation.prototype.displayDivisionContent = function(division, city) { Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Office space increased! It can now hold " + office.size + " employees"); this.updateUIContent(); } - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", innerText:"Cancel", display:"inline-block", margin:"8px", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }) - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [text, confirmBtn, cancelBtn]); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(popupId, [text, confirmBtn, cancelBtn]); return false; } }); industryEmployeePanel.appendChild(industryOfficeUpgradeSizeButton); //Throw Office Party - industryEmployeePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("br",{})); - industryEmployeePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { - class:"a-link-button", - display:"inline-block", - innerText:"Throw Office Party", + industryEmployeePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br",{})); + industryEmployeePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class:"a-link-button", display:"inline-block", innerText:"Throw Office Party", tooltip:"Throw an office party to increase your employee's morale and happiness", clickListener:()=>{ var popupId = "cmpy-mgmt-throw-office-party-popup"; - var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerText:"Enter the amount of money you would like to spend PER EMPLOYEE " + "on this office party" }); - var totalCostTxt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", { + var totalCostTxt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { innerText:"Throwing this party will cost a total of $0" }); - var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", { - type:"number", + var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("input", { + type:"number", margin:"5px", placeholder:"$ / employee", inputListener:()=>{ if (isNaN(input.value) || input.value < 0) { totalCostTxt.innerText = "Invalid value entered!" @@ -42115,7 +43056,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) { } } }); - var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", display:"inline-block", innerText:"Throw Party", @@ -42134,62 +43075,157 @@ Corporation.prototype.displayDivisionContent = function(division, city) { } Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You threw a party for the office! The morale and happiness " + "of each employee increased by " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])((mult-1) * 100, 2) + "%."); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); } } return false; } }); - var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { class:"a-link-button", display:"inline-block", innerText:"Cancel", clickListener:()=>{ - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(popupId); return false; } }); - Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, totalCostTxt, input, confirmBtn, cancelBtn]); + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createPopup */])(popupId, [txt, totalCostTxt, input, confirmBtn, cancelBtn]); } })); - /* - //Employee list - var industryEmployeeList = createElement("ul", { - id:"cmpy-mgmt-employee-ul" - }); - industryEmployeePanel.appendChild(industryEmployeeList); - for (var i = 0; i < office.employees.length; ++i) { - (function(corp) { - var emp = office.employees[i]; - var li = createAccordionElement({ - id:"cmpy-mgmt-employee-" + emp.name, - hdrText:emp.name, - }); - var panel = li.children[1]; - if (panel == null) { - console.log("ERROR: Could not find employee accordion panel"); - return; - } - emp.createUI(panel, corp); - industryEmployeeList.appendChild(li); - })(this); - } - */ + industryEmployeeManagementUI = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", {}); if (empManualAssignmentModeActive) { //Employees manually assigned + industryEmployeeManagementUI.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class:"a-link-button", display:"inline-block", margin:"4px", + innerText:"Switch to Auto Mode", + tooltip:"Switch to Automatic Assignment Mode, which will automatically " + + "assign employees to your selected jobs. You simply have to select " + + "the number of assignments for each job", + clickListener:()=>{ + empManualAssignmentModeActive = false; + this.displayDivisionContent(division, city); + } + })); + industryEmployeeManagementUI.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br", {})); + + industryEmployeeInfo = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("div", {margin:"4px", padding:"4px"}); + + var selector = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("select", { + color: "white", backgroundColor:"black", margin:"4px", padding:"4px", + changeListener:()=>{ + var name = selector.options[selector.selectedIndex].text; + for (var i = 0; i < office.employees.length; ++i) { + if (office.employees[i].name === name) { + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["j" /* removeChildrenFromElement */])(industryEmployeeInfo); + office.employees[i].createUI(industryEmployeeInfo, this); + return; + } + } + console.log("ERROR: Employee in selector could not be found"); + } + }); + + for (var i = 0; i < office.employees.length; ++i) { + selector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("option", {text:office.employees[i].name})); + } + + selector.selectedIndex = -1; + + industryEmployeeManagementUI.appendChild(selector); + industryEmployeeManagementUI.appendChild(industryEmployeeInfo); } else { //Player only manages the number of each occupation, not who gets what job + industryEmployeeManagementUI.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class:"a-link-button", display:"inline-block", margin:"4px", + innerText:"Switch to Manual Mode", + tooltip:"Switch to Manual Assignment Mode, which allows you to " + + "specify which employees should get which jobs", + clickListener:()=>{ + empManualAssignmentModeActive = true; + this.displayDivisionContent(division, city); + } + })); + industryEmployeeManagementUI.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br", {})); + var opCount = 0, engCount = 0, busCount = 0, + mgmtCount = 0, rndCount = 0, unassignedCount = 0; + for (var i = 0; i < office.employees.length; ++i) { + switch (office.employees[i].pos) { + case EmployeePositions.Operations: + ++opCount; break; + case EmployeePositions.Engineer: + ++engCount; break; + case EmployeePositions.Business: + ++busCount; break; + case EmployeePositions.Management: + ++mgmtCount; break; + case EmployeePositions.RandD: + ++rndCount; break; + case EmployeePositions.Unassigned: + ++unassignedCount; break; + default: + console.log("ERROR: Unrecognized employee position: " + office.employees[i].pos); + break; + } + } + + //Unassigned employee count display + industryEmployeeManagementUI.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", { + display:"inline-block", + innerText:"Unassigned Employees: " + unassignedCount, + })); + industryEmployeeManagementUI.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br", {})); + + //General display of employee information (avg morale, avg energy, etc.) + industryEmployeeInfo = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("p", {margin:"4px", padding:"4px"}); + industryEmployeeManagementUI.appendChild(industryEmployeeInfo); + industryEmployeeManagementUI.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br", {})); + + var positions = [EmployeePositions.Operations, EmployeePositions.Engineer, + EmployeePositions.Business, EmployeePositions.Management, + EmployeePositions.RandD]; + var counts = [opCount, engCount, busCount, mgmtCount, rndCount]; + for (var i = 0; i < positions.length; ++i) { + (function(corp, i) { + var info = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("h2", { + display:"inline-block", width:"40%", + innerText: positions[i] + "(" + counts[i] + ")" + }); + var plusBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class: unassignedCount > 0 ? "a-link-button" : "a-link-button-inactive", + display:"inline-block", innerText:"+", + clickListener:()=>{ + office.assignEmployeeToJob(positions[i]); + corp.displayDivisionContent(division, city); + } + }); + var minusBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { + class: counts[i] > 0 ? "a-link-button" : "a-link-button-inactive", + display:"inline-block", innerText:"-", + clickListener:()=>{ + office.unassignEmployeeFromJob(positions[i]); + corp.displayDivisionContent(division, city); + } + }); + var newline = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("br", {}); + industryEmployeeManagementUI.appendChild(info); + industryEmployeeManagementUI.appendChild(plusBtn); + industryEmployeeManagementUI.appendChild(minusBtn); + industryEmployeeManagementUI.appendChild(newline); + })(this, i); + } } + industryEmployeePanel.appendChild(industryEmployeeManagementUI); //Warehouse Panel var warehouse = division.warehouses[currentCityUi]; if (warehouse instanceof Warehouse) { warehouse.createUI({industry:division, company: this}); } else { - industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", { + industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("a", { innerText:"Purchase Warehouse ($5b)", class: "a-link-button", clickListener:()=>{ @@ -42220,8 +43256,8 @@ Corporation.prototype.updateDivisionContent = function(division) { profitStr = profit >= 0 ? __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(profit).format("$0.000a") : "-" + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(-1 * profit).format("$0.000a"); industryOverviewText.innerHTML = "Industry: " + division.type + "

" + - "Awareness: " + division.awareness + "
" + - "Popularity: " + division.popularity + "

" + + "Awareness: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.awareness, 3) + "
" + + "Popularity: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.popularity, 3) + "

" + "Revenue: " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(division.lastCycleRevenue.toNumber()).format("$0.000a") + " / s
" + "Expenses: " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(division.lastCycleExpenses.toNumber()).format("$0.000a") + " /s
" + "Profit: " + profitStr + " / s

" + @@ -42243,27 +43279,28 @@ Corporation.prototype.updateDivisionContent = function(division) { } else { industryEmployeeHireButton.className = "a-link-button"; } - var employeeList = document.getElementById("cmpy-mgmt-employee-ul"); - if (employeeList && office instanceof OfficeSpace) { + + if (!empManualAssignmentModeActive) { + //Calculate average morale, happiness, and energy + var totalMorale = 0, totalHappiness = 0, totalEnergy = 0, + avgMorale = 0, avgHappiness = 0, avgEnergy = 0; for (var i = 0; i < office.employees.length; ++i) { - (function(company) { - var emp = office.employees[i]; - var panel = document.getElementById("cmpy-mgmt-employee-" + emp.name + "-panel"); - if (panel == null) { - var li = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createAccordionElement */])({ - id:"cmpy-mgmt-employee-" + emp.name, - hdrText:emp.name, - }); - panel = li.children[1]; - emp.createUI(panel, company); - employeeList.appendChild(li); - return; - } - emp.updateUI(panel, company); - })(this); + totalMorale += office.employees[i].mor; + totalHappiness += office.employees[i].hap; + totalEnergy += office.employees[i].ene; } + if (office.employees.length > 0) { + avgMorale = totalMorale / office.employees.length; + avgHappiness = totalHappiness / office.employees.length; + avgEnergy = totalEnergy / office.employees.length; + } + industryEmployeeInfo.innerHTML = + "Avg Employee Morale: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(avgMorale, 3) + "
" + + "Avg Employee Happiness: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(avgHappiness, 3) + "
" + + "Avg Employee Energy: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(avgEnergy, 3); } + //Warehouse var warehouse = division.warehouses[currentCityUi]; if (warehouse instanceof Warehouse) { @@ -42272,7 +43309,7 @@ Corporation.prototype.updateDivisionContent = function(division) { } Corporation.prototype.createCityUITab = function(city, division) { - var tab = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("button", { + var tab = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["e" /* createElement */])("button", { id:"cmpy-mgmt-city-" + city + "-tab", class:"cmpy-mgmt-city-tab", innerText:city, @@ -42298,7 +43335,7 @@ Corporation.prototype.selectCityTab = function(activeTab, city) { Corporation.prototype.clearUI = function() { //Delete everything - if (companyManagementDiv != null) {Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(companyManagementDiv.id);} + if (companyManagementDiv != null) {Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["k" /* removeElementById */])(companyManagementDiv.id);} //Reset global DOM variables companyManagementDiv = null; @@ -42311,10 +43348,11 @@ Corporation.prototype.clearUI = function() { industryOverviewPanel = null; industryOverviewText = null; - industryEmployeePanel = null; - industryEmployeeText = null; - industryEmployeeHireButton = null; - industryEmployeeList = null; + industryEmployeePanel = null; + industryEmployeeText = null; + industryEmployeeHireButton = null; + industryEmployeeManagementUI = null; + industryEmployeeInfo = null; industryOfficeUpgradeSizeButton = null; @@ -42828,7 +43866,7 @@ function giveSourceFile(bitNodeNumber) { function loadBitVerse(destroyedBitNodeNum, flume=false) { //Clear the screen var container = document.getElementById("red-pill-container"); - Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["k" /* removeChildrenFromElement */])(container); + Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["j" /* removeChildrenFromElement */])(container); //Create the Bit Verse var bitVerseImage = document.createElement("pre"); @@ -42988,7 +44026,7 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=fa if (!flume) {giveSourceFile(destroyedBitNode);} redPillFlag = false; var container = document.getElementById("red-pill-container"); - Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["k" /* removeChildrenFromElement */])(container); + Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["j" /* removeChildrenFromElement */])(container); //Set new Bit Node __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].bitNodeN = newBitNode; @@ -43566,6 +44604,11 @@ function evaluate(exp, workerScript) { return Promise.resolve(exp.value); break; case "Identifier": + //Javascript constructor() method can be used as an exploit to run arbitrary code + if (exp.name == "constructor") { + return Promise.reject(makeRuntimeRejectMsg(workerScript, "Illegal usage of constructor() method. If you have your own function named 'constructor', you must re-name it.")); + } + if (!(exp.name in env.vars)){ return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.name + " not defined")); } @@ -43685,9 +44728,11 @@ function evaluate(exp, workerScript) { } else { return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression")); } - }); } else { + if (exp.property.name === "constructor") { + return Promise.reject(makeRuntimeRejectMsg(workerScript, "Illegal usage of constructor() method. If you have your own function named 'constructor', you must re-name it.")); + } try { return Promise.resolve(object[exp.property.name]) } catch (e) { @@ -44222,7 +45267,7 @@ function runScriptFromScript(server, scriptname, args, workerScript, threads=1) return Promise.resolve(false); } else { //Able to run script - workerScript.scriptRef.log("Running script: " + scriptname + " on " + server.hostname + " with " + threads + " threads and args: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["j" /* printArray */])(args) + ". May take a few seconds to start up..."); + workerScript.scriptRef.log("Running script: " + scriptname + " on " + server.hostname + " with " + threads + " threads and args: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["i" /* printArray */])(args) + ". May take a few seconds to start up..."); var runningScriptObj = new __WEBPACK_IMPORTED_MODULE_7__Script_js__["b" /* RunningScript */](script, args); runningScriptObj.threads = threads; server.runningScripts.push(runningScriptObj); //Push onto runningScripts @@ -45114,9 +46159,9 @@ function processAllGangTerritory(numCycles=1) { if (gangStoredTerritoryCycles < __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].GangTerritoryUpdateTimer) {return;} for (var i = 0; i < GangNames.length; ++i) { - var other = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, GangNames.length-1); + var other = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(0, GangNames.length-1); while(other == i) { - other = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, GangNames.length-1); + other = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* getRandomInt */])(0, GangNames.length-1); } var thisPwr = AllGangs[GangNames[i]].power; var otherPwr = AllGangs[GangNames[other]].power; @@ -46960,6 +48005,21 @@ function initLiterature() { "Netscript command to copy your scripts onto these servers and then run them."; Literatures[fn] = new Literature(title, fn, txt); + title = "The Complete Handbook for Creating a Successful Corporation"; + fn = "corporation-management-handbook.lit"; + txt = "This is a brief collection of tips/pointers on how to successfully start and manage a Corporation.

" + + "-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

"; + Literatures[fn] = new Literature(title, fn, txt); + title = "A Green Tomorrow"; fn = "A-Green-Tomorrow.lit"; txt = "Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to " + @@ -51175,6 +52235,17 @@ function createTextFile(fn, txt, server) { return file; } +function deleteTextFile(fn, server) { + if (!fn.endsWith(".txt")) {fn += ".txt";} + for (var i = 0; i < server.textFiles.length; ++i) { + if (server.textFiles[i].fn === fn) { + server.textFiles.splice(i, 1); + return true; + } + } + return false; +} + @@ -51470,7 +52541,7 @@ function nextInfiltrationLevel(inst) { bribeButton.style.display = "none"; escapeButton.style.display = "none"; - var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, 5); //This needs to change if more scenarios are added + var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* getRandomInt */])(0, 5); //This needs to change if more scenarios are added var scenario = null; switch (rand) { case 1: @@ -72261,6 +73332,7 @@ var NetscriptHighlightRules = function(options) { "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions "isNaN|parseFloat|parseInt|" + "hack|sleep|grow|weaken|print|tprint|scan|nuke|brutessh|ftpcrack|" + //Netscript functions + "clearLog|" + "relaysmtp|httpworm|sqlinject|run|exec|kill|killall|exit|" + "scp|ls|hasRootAccess|" + "getIp|getHackingMultipliers|getBitNodeMultipliers|getStats|isBusy|" + diff --git a/index.html b/index.html index 32723459f..cfbcf5bc5 100644 --- a/index.html +++ b/index.html @@ -101,11 +101,7 @@
-
- Save & Close (Ctrl + b) -

- Netscript Documentation -
+
diff --git a/src/Company.js b/src/Company.js index 7386ea9d6..f8906d396 100644 --- a/src/Company.js +++ b/src/Company.js @@ -356,7 +356,7 @@ let CompanyPositions = { CompanyPositions.VicePresident.setPerformanceParameters(70, 0, 0, 0, 0, 30, 1.75); CompanyPositions.VicePresident.setExperienceGains(1.2, 0, 0, 0, 0, .6); CompanyPositions.CTO.setPerformanceParameters(65, 0, 0, 0, 0, 35, 2); - CompanyPositions.CTO.setExperienceGains(1.5, 0, 0, 0, 1); + CompanyPositions.CTO.setExperienceGains(1.5, 0, 0, 0, 0, 1); //Business CompanyPositions.BusinessIntern.setPerformanceParameters(10, 0, 0, 0, 0, 90, 0.9); diff --git a/src/CompanyManagement.js b/src/CompanyManagement.js index 4fbe201fb..12671c638 100644 --- a/src/CompanyManagement.js +++ b/src/CompanyManagement.js @@ -59,12 +59,10 @@ var WarehouseInitialCost = 5e9; //Initial purchase cost of warehouse var WarehouseInitialSize = 100; var WarehouseUpgradeBaseCost = 1e9; -var OfficeInitialCost = 5e9; +var OfficeInitialCost = 4e9; var OfficeInitialSize = 3; var OfficeUpgradeBaseCost = 1e9; - - function Material(params={}) { this.name = params.name ? params.name : ""; this.qty = 0; //Quantity @@ -529,6 +527,20 @@ var ProductRatingWeights = { } } +//Industry upgrades +//The structure is: +// [index in array, base price, price mult, benefit mult (if applicable), name, desc] +var IndustryUpgrades = { + "0": [0, 500e3, 1, 1.05, + "Coffee", "Provide your employees with coffee, increasing their energy by 5%."], + "1": [1, 1e9, 1.02, 1.01, + "AdVert.Inc", "Hire AdVert.Inc to advertise your company. Each level of " + + "this upgrade grants your company a static increase of 5 and 1 to its awareness and " + + "popularity, respectively. It will then increase your company's awareness by 1%, and its popularity " + + "by a random percentage between 5% and 15%. These effects are increased by other upgrades " + + "that increase the power of your advertising."] +} + var empManualAssignmentModeActive = false; function Industry(params={}) { this.offices = { //Maps locations to offices. 0 if no office at that location @@ -594,6 +606,10 @@ function Industry(params={}) { this.thisCycleRevenue = new Decimal(0); this.thisCycleExpenses = new Decimal(0); + //Upgrades + var numUpgrades = Object.keys(IndustryUpgrades).length; + this.upgrades = Array(numUpgrades).fill(0); + this.state = "START"; this.init(); @@ -750,6 +766,10 @@ Industry.prototype.init = function() { case Industries.Software: this.sciFac = 0.7; this.advFac = 0.5; + this.hwFac = 0.25; + this.reFac = 0.1; + this.aiFac = 0.1; + this.robFac = 0.05; this.reqMats = { "Hardware": 0.5, "Energy": 1, @@ -878,6 +898,18 @@ Industry.prototype.process = function(marketCycles=1, state, company) { //Process change in demand/competition of materials/products this.processMaterialMarket(marketCycles); this.processProductMarket(marketCycles); + + //Process loss of popularity + this.popularity -= (marketCycles * .0001); + this.popularity = Math.max(0, this.popularity); + + //Process Dreamsense gains + var popularityGain = company.getDreamSenseGain(), awarenessGain = popularityGain * 4; + if (popularityGain > 0) { + this.popularity += (popularityGain * marketCycles); + this.awareness += (awarenessGain * marketCycles); + } + return; } @@ -1048,9 +1080,6 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) { Math.pow(this.sciResearch.qty, this.sciFac) + Math.pow(warehouse.materials["AICores"].qty, this.aiFac) / 10e3); } - } else { - console.log("Production of materials failed because producableFrac <= 0 or prod <= 0."); - console.log("prod: " + prod); } //Per second var fooProd = prod * producableFrac / (SecsPerMarketCycle * marketCycles); @@ -1065,7 +1094,10 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) { for (var matName in warehouse.materials) { if (warehouse.materials.hasOwnProperty(matName)) { var mat = warehouse.materials[matName]; - if (mat.sCost < 0 || mat.sllman[0] === false) {continue;} + if (mat.sCost < 0 || mat.sllman[0] === false) { + mat.sll = 0; + continue; + } var mat = warehouse.materials[matName]; var sCost; @@ -1093,7 +1125,8 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) { } var businessFactor = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]); var maxSell = (mat.qlt + .001) * mat.dmd * (100 - mat.cmp)/100 * markup * businessFactor * - (this.awareness === 0 ? 0.01 : (this.popularity + .001) / this.awareness); + Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) * + (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01)); var sellAmt; if (mat.sllman[1] !== -1) { //Sell amount is manually limited @@ -1301,7 +1334,8 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio } } var maxSell = Math.pow(product.rat, 0.95) * product.dmd * (1-(product.cmp/100)) * - (this.awareness === 0 ? 0.01 : (this.popularity+0.001) / this.awareness) * markup; + markup * businessFactor * Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) * + (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01)); var sellAmt; if (product.sllman[city][0] && product.sllman[city][1] > 0) { //Sell amount is manually limited @@ -1345,6 +1379,33 @@ Industry.prototype.discontinueProduct = function(product, parentRefs) { } } +Industry.prototype.upgrade = function(upgrade, refs) { + var corporation = refs.corporation, division = refs.division, + office = refs.office; + var upgN = upgrade[0], basePrice = upgrade[1], priceMult = upgrade[2], + upgradeBenefit = upgrade[3]; + while (this.upgrades.length <= upgN) {this.upgrades.push(0);} + ++this.upgrades[upgN]; + + switch (upgN) { + case 0: //Coffee, 5% energy per employee + for (var i = 0; i < office.employees.length; ++i) { + office.employees[i].ene = Math.min(office.employees[i].ene * 1.05, 100); + } + break; + case 1: //AdVert.Inc, + var advMult = corporation.getAdvertisingMultiplier(); + this.awareness += (5 * advMult); + this.popularity += (1 * advMult); + this.awareness *= (1.01 * advMult); + this.popularity *= ((1 + Math.random(5, 15) / 100) * advMult); + break; + default: + console.log("ERROR: Un-implemented function index: " + upgN); + break; + } +} + Industry.prototype.toJSON = function() { return Generic_toJSON("Industry", this); } @@ -1385,7 +1446,7 @@ function Employee(params={}) { this.pro = 0; //Productivity, This is calculated this.loc = params.loc ? params.loc : ""; - this.pos = params.position ? params.position : EmployeePositions.Operations; + this.pos = EmployeePositions.Unassigned; } //Returns the amount the employee needs to be paid @@ -1444,6 +1505,9 @@ Employee.prototype.calculateProductivity = function(corporation) { prodMult = (1.5 * effInt) + (0.8 * this.exp) + (effCre) + (0.5 * effEff); break; + case EmployeePositions.Unassigned: + prodMult = 0; + break; default: console.log("ERROR: Invalid employee position: " + this.pos); break; @@ -1612,7 +1676,8 @@ OfficeSpace.prototype.calculateEmployeeProductivity = function(marketCycles=1, c } //Takes care of UI as well -OfficeSpace.prototype.findEmployees = function(company) { +OfficeSpace.prototype.findEmployees = function(parentRefs) { + var company = parentRefs.corporation, division = parentRefs.division; if (document.getElementById("cmpy-mgmt-hire-employee-popup") != null) {return;} //Generate three random employees (meh, decent, amazing) @@ -1667,7 +1732,7 @@ OfficeSpace.prototype.findEmployees = function(company) { "Efficiency: " + formatNumber(employee.eff, 1) + "
" + "Salary: " + numeral(employee.sal).format('$0.000a') + " \ s
", clickListener:()=>{ - office.hireEmployee(employee, company); + office.hireEmployee(employee, parentRefs); removeElementById("cmpy-mgmt-hire-employee-popup"); return false; } @@ -1694,7 +1759,8 @@ OfficeSpace.prototype.findEmployees = function(company) { createPopup("cmpy-mgmt-hire-employee-popup", elems); } -OfficeSpace.prototype.hireEmployee = function(employee, company) { +OfficeSpace.prototype.hireEmployee = function(employee, parentRefs) { + var company = parentRefs.corporation, division = parentRefs.division; var yesBtn = yesNoTxtInpBoxGetYesButton(), noBtn = yesNoTxtInpBoxGetNoButton(); yesBtn.innerHTML = "Hire"; @@ -1709,7 +1775,7 @@ OfficeSpace.prototype.hireEmployee = function(employee, company) { } employee.name = name; this.employees.push(employee); - company.updateUIContent(); + company.displayDivisionContent(division, currentCityUi); return yesNoTxtInpBoxClose(); }); noBtn.addEventListener("click", ()=>{ @@ -1718,6 +1784,28 @@ OfficeSpace.prototype.hireEmployee = function(employee, company) { yesNoTxtInpBoxCreate("Give your employee a nickname!"); } +//Finds the first unassigned employee and assigns its to the specified job +OfficeSpace.prototype.assignEmployeeToJob = function(job) { + for (var i = 0; i < this.employees.length; ++i) { + if (this.employees[i].pos === EmployeePositions.Unassigned) { + this.employees[i].pos = job; + return true; + } + } + return false; +} + +//Finds the first employee with the given job and unassigns it +OfficeSpace.prototype.unassignEmployeeFromJob = function(job) { + for (var i = 0; i < this.employees.length; ++i) { + if (this.employees[i].pos === job) { + this.employees[i].pos = EmployeePositions.Unassigned; + return true; + } + } + return false; +} + OfficeSpace.prototype.toJSON = function() { return Generic_toJSON("OfficeSpace", this); } @@ -2099,16 +2187,22 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { buttonPanel.appendChild(createElement("br", {})); // Force line break //Button to set sell amount - var innerTextString = (mat.sllman[1] === -1 ? "Sell (" + formatNumber(mat.sll, 3) + "/MAX)" : - "Sell (" + formatNumber(mat.sll, 3) + "/" + formatNumber(mat.sllman[1], 3) + ")") - if (mat.sCost) { - if (isString(mat.sCost)) { - var sCost = mat.sCost.replace(/MP/g, mat.bCost); - innerTextString += " @ $" + formatNumber(eval(sCost), 2); - } else { - innerTextString += " @ $" + formatNumber(mat.sCost, 2); + var innerTextString; + if (mat.sllman[0]) { + innerTextString = (mat.sllman[1] === -1 ? "Sell (" + formatNumber(mat.sll, 3) + "/MAX)" : + "Sell (" + formatNumber(mat.sll, 3) + "/" + formatNumber(mat.sllman[1], 3) + ")"); + if (mat.sCost) { + if (isString(mat.sCost)) { + var sCost = mat.sCost.replace(/MP/g, mat.bCost); + innerTextString += " @ $" + formatNumber(eval(sCost), 2); + } else { + innerTextString += " @ $" + formatNumber(mat.sCost, 2); + } } + } else { + innerTextString = "Sell (0.000/0.000)"; } + buttonPanel.appendChild(createElement("a", { innerText: innerTextString, display:"inline-block", class:"a-link-button", clickListener:()=>{ @@ -2124,16 +2218,17 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { "changing price that depends on the market price. For example, if you set the sell price " + "to 'MP+10' then it will always be sold at $10 above the market price.", }); + var br = createElement("br", {}); var inputQty = createElement("input", { - type:"text", value: mat.sllman[1] ? mat.sllman[1] : null, placeholder: "Sell amount" + type:"text", marginTop:"4px", + value: mat.sllman[1] ? mat.sllman[1] : null, placeholder: "Sell amount" }); var inputPx = createElement("input", { - type:"text", value: mat.sCost ? mat.sCost : null, placeholder: "Sell price" + type:"text", marginTop:"4px", + value: mat.sCost ? mat.sCost : null, placeholder: "Sell price" }); var confirmBtn = createElement("a", { - innerText:"Confirm", - class:"a-link-button", - margin:"6px", + innerText:"Confirm", class:"a-link-button", margin:"6px", clickListener:()=>{ //Parse price //Sanitize cost @@ -2164,6 +2259,7 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { if (isNaN(qty)) {qty = 0;} if (qty === 0) { mat.sllman[0] = false; + mat.sllman[1] = 0; } else { mat.sllman[0] = true; mat.sllman[1] = qty; @@ -2176,14 +2272,12 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) { } }); var cancelBtn = createElement("a", { - innerText:"Cancel", - class:"a-link-button", - margin: "6px", + innerText:"Cancel", class:"a-link-button", margin: "6px", clickListener:()=>{ removeElementById(sellPopupid); } }); - createPopup(sellPopupid, [txt, inputQty, inputPx, confirmBtn, cancelBtn]); + createPopup(sellPopupid, [txt, br, inputQty, inputPx, confirmBtn, cancelBtn]); inputQty.focus(); } })); @@ -2427,46 +2521,48 @@ var CorporationUnlockUpgrades = { // name, desc] var CorporationUpgrades = { //Smart factories, increases production - "0": [0, 4e9, 1.07, 0.02, + "0": [0, 2e9, 1.07, 0.02, "Smart Factories", "Advanced AI automatically optimizes the operation and productivity " + "of factories. Each level of this upgrade increases your global production by 2% (additive)."], //Smart warehouses, increases storage size - "1": [1, 4e9, 1.07, .1, + "1": [1, 2e9, 1.07, .1, "Smart Storage", "Advanced AI automatically optimizes your warehouse storage methods. " + "Each level of this upgrade increases your global warehouse storage size by 10% (additive)."], //Advertise through dreams, passive popularity/ awareness gain - "2": [2, 999999e9, 1.08, .001, - "DreamSense", "NOT YET IMPLEMENTED! - Use DreamSense LCC Technologies to advertise your corporation " + + "2": [2, 8e9, 1.09, .001, + "DreamSense", "Use DreamSense LCC Technologies to advertise your corporation " + "to consumers through their dreams. Each level of this upgrade provides a passive " + - "increase in awareness of your company by 0.001 / second."], + "increase in awareness of all of your companies (divisions) by 0.004 / market cycle," + + "and in popularity by 0.001 / market cycle. A market cycle is approximately " + + "20 seconds."], //Makes advertising more effective - "3": [3, 999999e9, 1.11, 0.1, - "Wilson Analytics", "NOT YET IMPLEMENTED - Purchase data and analysis from Wilson, a marketing research " + + "3": [3, 4e9, 1.11, 0.1, + "Wilson Analytics", "Purchase data and analysis from Wilson, a marketing research " + "firm. Each level of this upgrades increases the effectiveness of your " + "advertising by 10% (additive)."], //Augmentation for employees, increases cre - "4": [4, 2e9, 1.06, 0.1, + "4": [4, 1e9, 1.06, 0.1, "Nuoptimal Nootropic Injector Implants", "Purchase the Nuoptimal Nootropic " + "Injector augmentation for your employees. Each level of this upgrade " + "globally increases the creativity of your employees by 10% (additive)."], //Augmentation for employees, increases cha - "5": [5, 2e9, 1.06, 0.1, + "5": [5, 1e9, 1.06, 0.1, "Speech Processor Implants", "Purchase the Speech Processor augmentation for your employees. " + "Each level of this upgrade globally increases the charisma of your employees by 10% (additive)."], //Augmentation for employees, increases int - "6": [6, 2e9, 1.06, 0.1, + "6": [6, 1e9, 1.06, 0.1, "Neural Accelerators", "Purchase the Neural Accelerator augmentation for your employees. " + "Each level of this upgrade globally increases the intelligence of your employees " + "by 10% (additive)."], //Augmentation for employees, increases eff - "7": [7, 2e9, 1.06, 0.1, + "7": [7, 1e9, 1.06, 0.1, "FocusWires", "Purchase the FocusWire augmentation for your employees. Each level " + "of this upgrade globally increases the efficiency of your employees by 10% (additive)."], @@ -2477,7 +2573,7 @@ var CorporationUpgrades = { "by 1% (additive)."], //Improves scientific research rate - "9": [9, 5e9, 1.08, 0.05, + "9": [9, 5e9, 1.07, 0.05, "Project Insight", "Purchase 'Project Insight', a R&D service provided by the secretive " + "Fulcrum Technologies. Each level of this upgrade globally increases the amount of " + "Scientific Research you produce by 5% (additive)."], @@ -2544,7 +2640,7 @@ Corporation.prototype.process = function(numCycles=1) { Corporation.prototype.determineValuation = function() { var val, profit = (this.revenue.minus(this.expenses)).toNumber(); if (this.public) { - val = 25e9 + this.funds.toNumber() + (profit * 25e3); + val = this.funds.toNumber() + (profit * 100e3); val *= (Math.pow(1.1, this.divisions.length)); val = Math.max(val, 0); } else { @@ -2578,7 +2674,7 @@ Corporation.prototype.getInvestment = function() { case 4: return; } - var funding = val * percShares, + var funding = val * percShares * 2, investShares = Math.floor(TOTALSHARES * percShares), yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton(); @@ -2588,6 +2684,7 @@ Corporation.prototype.getInvestment = function() { ++this.fundingRound; this.funds = this.funds.plus(funding); this.numShares -= investShares; + this.displayCorporationOverviewContent(); return yesNoBoxClose(); }); noBtn.addEventListener("click", ()=>{ @@ -2609,12 +2706,13 @@ Corporation.prototype.goPublic = function() { numeral(initialSharePrice).format('$0.000a') + " per share.

" + "Furthermore, issuing more shares now will help drive up " + "your company's stock price in the future.

" + - "You have a total of " + this.numShares + " of shares that you can issue.", + "You have a total of " + numeral(this.numShares).format("0.000a") + " of shares that you can issue.", }); var input = createElement("input", { type:"number", placeholder: "Shares to issue", }); + var br = createElement("br", {}); var yesBtn = createElement("a", { class:"a-link-button", innerText:"Go Public", @@ -2646,7 +2744,7 @@ Corporation.prototype.goPublic = function() { return false; } }); - createPopup(goPublicPopupId, [txt, input, yesBtn, noBtn]); + createPopup(goPublicPopupId, [txt, br, input, yesBtn, noBtn]); } Corporation.prototype.updateSharePrice = function() { @@ -2715,6 +2813,11 @@ Corporation.prototype.getStorageMultiplier = function() { if (isNaN(mult) || mult < 1) {return 1;} else {return mult;} } +Corporation.prototype.getDreamSenseGain = function() { + var gain = this.upgradeMultipliers[2] - 1; + return gain <= 0 ? 0 : gain; +} + Corporation.prototype.getAdvertisingMultiplier = function() { var mult = this.upgradeMultipliers[3]; if (isNaN(mult) || mult < 1) {return 1;} else {return mult;} @@ -2750,14 +2853,13 @@ Corporation.prototype.getScientificResearchMultiplier = function() { if (isNaN(mult) || mult < 1) {return 1;} else {return mult;} } - //Keep 'global' variables for DOM elements so we don't have to search //through the DOM tree repeatedly when updating UI var companyManagementDiv, companyManagementHeaderTabs, companyManagementPanel, currentCityUi, corporationUnlockUpgrades, corporationUpgrades, industryOverviewPanel, industryOverviewText, - industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeList, + industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeManagementUI, industryEmployeeInfo, industryOfficeUpgradeSizeButton, industryWarehousePanel, headerTabs, cityTabs; @@ -2980,13 +3082,37 @@ Corporation.prototype.displayCorporationOverviewContent = function() { this.selectHeaderTab(headerTabs[0]); } + //Check if player has Corporation Handbook + var homeComp = Player.getHomeComputer(), hasHandbook = false, + handbookFn = "corporation-management-handbook.lit"; + for (var i = 0; i < homeComp.messages.length; ++i) { + if (isString(homeComp.messages[i]) && homeComp.messages[i] === handbookFn) { + hasHandbook = true; + break; + } + } + + if (!hasHandbook) { + companyManagementPanel.appendChild(createElement("a", { + class:"a-link-button", innerText:"Get Handbook", display:"inline-block", + tooltip:"Get a copy of 'The Complete Handbook for Creating a Successful Corporation.'" + + "This is a .lit file that provides some tips/pointers for helping you get started with " + + "starting and managing a Corporation.", + clickListener:()=>{ + homeComp.messages.push(handbookFn); + this.displayCorporationOverviewContent(); + return false; + } + })); + } + //Investors if (this.public) { //Sell share buttons var sellShares = createElement("a", { - class:"a-link-button tooltip", - innerText:"Sell Shares", - display:"inline-block", + class:"a-link-button", innerText:"Sell Shares", display:"inline-block", + tooltip:"Sell your shares in the company. This is the only way to " + + "profit from your business venture.", clickListener:()=>{ var popupId = "cmpy-mgmt-sell-shares-popup"; var currentStockPrice = this.sharePrice; @@ -2996,8 +3122,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() { }); var profitIndicator = createElement("p", {}); var input = createElement("input", { - type:"number", - placeholder:"Shares to sell", + type:"number", placeholder:"Shares to sell", margin:"5px", inputListener: ()=> { var numShares = Math.round(input.value); if (isNaN(numShares)) { @@ -3011,9 +3136,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() { } }); var confirmBtn = createElement("a", { - class:"a-link-button", - innerText:"Sell shares", - display:"inline-block", + class:"a-link-button", innerText:"Sell shares", display:"inline-block", clickListener:()=>{ var shares = Math.round(input.value); if (isNaN(shares)) { @@ -3031,9 +3154,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() { } }); var cancelBtn = createElement("a", { - class:"a-link-button", - innerText:"Cancel", - display:"inline-block", + class:"a-link-button", innerText:"Cancel", display:"inline-block", clickListener:()=>{ removeElementById(popupId); return false; @@ -3042,18 +3163,11 @@ Corporation.prototype.displayCorporationOverviewContent = function() { createPopup(popupId, [txt, profitIndicator, input, confirmBtn, cancelBtn]); } }); - var sellSharesTooltip = createElement("span", { - class:"tooltiptext", - innerText:"Sell your shares in the company. This is the only way to " + - "profit from your business venture.", - }); - sellShares.appendChild(sellSharesTooltip); //Buyback shares button var buybackShares = createElement("a", { - class:"a-link-button tooltip", - innerText:"Buyback shares", - display:"inline-block", + class:"a-link-button", innerText:"Buyback shares", display:"inline-block", + tooltip:"Buy back shares you that previously issued or sold at market price.", clickListener:()=>{ var popupId = "cmpy-mgmt-buyback-shares-popup"; var currentStockPrice = this.sharePrice; @@ -3063,8 +3177,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() { }); var costIndicator = createElement("p", {}); var input = createElement("input", { - type:"number", - placeholder:"Shares to sell", + type:"number", placeholder:"Shares to buyback", margin:"5px", inputListener: ()=> { var numShares = Math.round(input.value); //TODO add conditional for if player doesn't have enough money @@ -3080,9 +3193,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() { } }); var confirmBtn = createElement("a", { - class:"a-link-button", - innerText:"Sell shares", - display:"inline-block", + class:"a-link-button", innerText:"Buy shares", display:"inline-block", clickListener:()=>{ var shares = Math.round(input.value); var tempStockPrice = this.sharePrice; @@ -3096,6 +3207,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() { } else { this.numShares += shares; this.issuedShares -= shares; + Player.loseMoney(shares * tempStockPrice); //TODO REMOVE from Player money removeElementById(popupId); } @@ -3115,12 +3227,6 @@ Corporation.prototype.displayCorporationOverviewContent = function() { createPopup(popupId, [txt, costIndicator, input, confirmBtn, cancelBtn]); } }); - var buybackSharesTooltip = createElement("span", { - class:"tooltiptext", - innerText:"Buy back shares you that previously issued or sold at market " + - "price." - }); - buybackShares.appendChild(buybackSharesTooltip); companyManagementPanel.appendChild(sellShares); companyManagementPanel.appendChild(buybackShares); @@ -3133,12 +3239,14 @@ Corporation.prototype.displayCorporationOverviewContent = function() { this.getInvestment(); } }); - var findInvestorsTooltip = createElement("span", { - class:"tooltiptext", - innerText:"Search for private investors who will give you startup funding in exchange " + - "for equity (stock shares) in your company" - }); - findInvestors.appendChild(findInvestorsTooltip); + if (this.fundingRound < 4) { + var findInvestorsTooltip = createElement("span", { + class:"tooltiptext", + innerText:"Search for private investors who will give you startup funding in exchange " + + "for equity (stock shares) in your company" + }); + findInvestors.appendChild(findInvestorsTooltip); + } var goPublic = createElement("a", { class:"a-link-button tooltip", @@ -3196,7 +3304,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() { } upgradeContainer.appendChild(createElement("div", { - class:"cmpy-mgmt-upgrade-div", + class:"cmpy-mgmt-upgrade-div", width:"45%", innerHTML:upgrade[2] + " - " + numeral(upgrade[1]).format("$0.000a"), tooltip: upgrade[3], clickListener:()=>{ @@ -3228,7 +3336,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() { var baseCost = upgrade[1], priceMult = upgrade[2]; var cost = baseCost * Math.pow(priceMult, corp.upgrades[i]); upgradeContainer.appendChild(createElement("div", { - class:"cmpy-mgmt-upgrade-div", + class:"cmpy-mgmt-upgrade-div", width:"45%", innerHTML:upgrade[4] + " - " + numeral(cost).format("$0.000a"), tooltip:upgrade[5], clickListener:()=>{ @@ -3312,7 +3420,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) { innerText: "Would you like to expand into a new city by opening an office? " + "This would cost " + numeral(OfficeInitialCost).format('$0.000a'), }); - var citySelector = createElement("select", {}); + var citySelector = createElement("select", {margin:"5px"}); for (var cityName in division.offices) { if (division.offices.hasOwnProperty(cityName)) { if (!(division.offices[cityName] instanceof OfficeSpace)) { @@ -3356,39 +3464,87 @@ Corporation.prototype.displayDivisionContent = function(division, city) { })); companyManagementPanel.appendChild(createElement("br", {})); // Force line break + //Get office object + var office = division.offices[currentCityUi]; + if (!(office instanceof OfficeSpace)) { + console.log("ERROR: Current city for UI does not have an office space"); + return; + } + //Left and right panels - var leftPanel = createElement("div", { - class:"cmpy-mgmt-industry-left-panel" - }); - var rightPanel = createElement("div", { - class:"cmpy-mgmt-industry-right-panel" - }); + var leftPanel = createElement("div", {class:"cmpy-mgmt-industry-left-panel"}); + var rightPanel = createElement("div", {class:"cmpy-mgmt-industry-right-panel"}); companyManagementPanel.appendChild(leftPanel); companyManagementPanel.appendChild(rightPanel); //Different sections (Overview, Employee/Office, and Warehouse) industryOverviewPanel = createElement("div", { - id:"cmpy-mgmt-industry-overview-panel", - class:"cmpy-mgmt-industry-overview-panel" + id:"cmpy-mgmt-industry-overview-panel", class:"cmpy-mgmt-industry-overview-panel" }); leftPanel.appendChild(industryOverviewPanel); industryEmployeePanel = createElement("div", { - id:"cmpy-mgmt-employee-panel", - class:"cmpy-mgmt-employee-panel" + id:"cmpy-mgmt-employee-panel", class:"cmpy-mgmt-employee-panel" }); leftPanel.appendChild(industryEmployeePanel); industryWarehousePanel = createElement("div", { - id:"cmpy-mgmt-warehouse-panel", - class:"cmpy-mgmt-warehouse-panel" + id:"cmpy-mgmt-warehouse-panel", class:"cmpy-mgmt-warehouse-panel" }); rightPanel.appendChild(industryWarehousePanel); - //Industry overview text element + //Industry overview text industryOverviewText = createElement("p", {}); industryOverviewPanel.appendChild(industryOverviewText); + //Industry overview Purchases & Upgrades + var numUpgrades = Object.keys(IndustryUpgrades).length; + while (division.upgrades.length < numUpgrades) {division.upgrades.push(0);} //Backwards compatibility + + var industryOverviewUpgrades = createElement("div", {}); + industryOverviewUpgrades.appendChild(createElement("h1", {innerText:"Purchases & Upgrades", margin:"4px", padding:"4px"})); + for (var i = 0; i < numUpgrades; ++i) { + (function(i, corp, division, office) { + var upgrade = IndustryUpgrades[i.toString()]; + if (upgrade == null) { + console.log("ERROR: Could not find levelable upgrade index: " + i); + return; + } + + var baseCost = upgrade[1], priceMult = upgrade[2], cost = 0; + switch(i) { + case 0: //Coffee, cost is static per employee + cost = office.employees.length * baseCost; + break; + default: + cost = baseCost * Math.pow(priceMult, division.upgrades[i]); + break; + } + industryOverviewUpgrades.appendChild(createElement("div", { + class:"cmpy-mgmt-upgrade-div", display:"inline-block", + innerHTML:upgrade[4] + ' - ' + numeral(cost).format("$0.000a"), + tooltip:upgrade[5], + clickListener:()=>{ + if (corp.funds.lt(cost)) { + dialogBoxCreate("Insufficient funds"); + } else { + corp.funds = corp.funds.minus(cost); + division.upgrade(upgrade, { + corporation:corp, + office:office, + }); + corp.displayDivisionContent(division, city); + } + } + })); + industryOverviewUpgrades.appendChild(createElement("br", {})); + + })(i, this, division, office); + } + + + industryOverviewPanel.appendChild(industryOverviewUpgrades); + //Industry Overview 'Create Product' button if applicable if (division.makesProducts) { //Get the text on the button based on Industry type @@ -3522,11 +3678,6 @@ Corporation.prototype.displayDivisionContent = function(division, city) { } //Employee and Office Panel - var office = division.offices[currentCityUi]; - if (!(office instanceof OfficeSpace)) { - console.log("ERROR: Current city for UI does not have an office space"); - return; - } industryEmployeeText = createElement("p", { id: "cmpy-mgmt-employee-p", display:"block", @@ -3543,7 +3694,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) { innerText:"Hire Employee", display:"inline-block", clickListener:()=>{ - office.findEmployees(this); + office.findEmployees({corporation:this, division:division}); return false; } }); @@ -3554,7 +3705,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) { class:"a-link-button", innerText:"Upgrade Office size", display:"inline-block", margin:"6px", clickListener:()=>{ var popupId = "cmpy-mgmt-upgrade-office-size-popup"; - var upgradeCost = OfficeInitialCost * Math.pow(1.13, Math.round(office.size / OfficeInitialSize)); + var upgradeCost = OfficeInitialCost * Math.pow(1.07, Math.round(office.size / OfficeInitialSize)); var text = createElement("p", { innerHTML:"Increase the size of your office space to fit " + OfficeInitialSize + " more employees. This will cost " + numeral(upgradeCost).format('$0.000a'), @@ -3596,9 +3747,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) { //Throw Office Party industryEmployeePanel.appendChild(createElement("br",{})); industryEmployeePanel.appendChild(createElement("a", { - class:"a-link-button", - display:"inline-block", - innerText:"Throw Office Party", + class:"a-link-button", display:"inline-block", innerText:"Throw Office Party", tooltip:"Throw an office party to increase your employee's morale and happiness", clickListener:()=>{ var popupId = "cmpy-mgmt-throw-office-party-popup"; @@ -3610,7 +3759,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) { innerText:"Throwing this party will cost a total of $0" }); var input = createElement("input", { - type:"number", + type:"number", margin:"5px", placeholder:"$ / employee", inputListener:()=>{ if (isNaN(input.value) || input.value < 0) { totalCostTxt.innerText = "Invalid value entered!" @@ -3658,36 +3807,131 @@ Corporation.prototype.displayDivisionContent = function(division, city) { } })); - /* - //Employee list - var industryEmployeeList = createElement("ul", { - id:"cmpy-mgmt-employee-ul" - }); - industryEmployeePanel.appendChild(industryEmployeeList); - for (var i = 0; i < office.employees.length; ++i) { - (function(corp) { - var emp = office.employees[i]; - var li = createAccordionElement({ - id:"cmpy-mgmt-employee-" + emp.name, - hdrText:emp.name, - }); - var panel = li.children[1]; - if (panel == null) { - console.log("ERROR: Could not find employee accordion panel"); - return; - } - emp.createUI(panel, corp); - industryEmployeeList.appendChild(li); - })(this); - } - */ + industryEmployeeManagementUI = createElement("div", {}); if (empManualAssignmentModeActive) { //Employees manually assigned + industryEmployeeManagementUI.appendChild(createElement("a", { + class:"a-link-button", display:"inline-block", margin:"4px", + innerText:"Switch to Auto Mode", + tooltip:"Switch to Automatic Assignment Mode, which will automatically " + + "assign employees to your selected jobs. You simply have to select " + + "the number of assignments for each job", + clickListener:()=>{ + empManualAssignmentModeActive = false; + this.displayDivisionContent(division, city); + } + })); + industryEmployeeManagementUI.appendChild(createElement("br", {})); + + industryEmployeeInfo = createElement("div", {margin:"4px", padding:"4px"}); + + var selector = createElement("select", { + color: "white", backgroundColor:"black", margin:"4px", padding:"4px", + changeListener:()=>{ + var name = selector.options[selector.selectedIndex].text; + for (var i = 0; i < office.employees.length; ++i) { + if (office.employees[i].name === name) { + removeChildrenFromElement(industryEmployeeInfo); + office.employees[i].createUI(industryEmployeeInfo, this); + return; + } + } + console.log("ERROR: Employee in selector could not be found"); + } + }); + + for (var i = 0; i < office.employees.length; ++i) { + selector.add(createElement("option", {text:office.employees[i].name})); + } + + selector.selectedIndex = -1; + + industryEmployeeManagementUI.appendChild(selector); + industryEmployeeManagementUI.appendChild(industryEmployeeInfo); } else { //Player only manages the number of each occupation, not who gets what job + industryEmployeeManagementUI.appendChild(createElement("a", { + class:"a-link-button", display:"inline-block", margin:"4px", + innerText:"Switch to Manual Mode", + tooltip:"Switch to Manual Assignment Mode, which allows you to " + + "specify which employees should get which jobs", + clickListener:()=>{ + empManualAssignmentModeActive = true; + this.displayDivisionContent(division, city); + } + })); + industryEmployeeManagementUI.appendChild(createElement("br", {})); + var opCount = 0, engCount = 0, busCount = 0, + mgmtCount = 0, rndCount = 0, unassignedCount = 0; + for (var i = 0; i < office.employees.length; ++i) { + switch (office.employees[i].pos) { + case EmployeePositions.Operations: + ++opCount; break; + case EmployeePositions.Engineer: + ++engCount; break; + case EmployeePositions.Business: + ++busCount; break; + case EmployeePositions.Management: + ++mgmtCount; break; + case EmployeePositions.RandD: + ++rndCount; break; + case EmployeePositions.Unassigned: + ++unassignedCount; break; + default: + console.log("ERROR: Unrecognized employee position: " + office.employees[i].pos); + break; + } + } + + //Unassigned employee count display + industryEmployeeManagementUI.appendChild(createElement("p", { + display:"inline-block", + innerText:"Unassigned Employees: " + unassignedCount, + })); + industryEmployeeManagementUI.appendChild(createElement("br", {})); + + //General display of employee information (avg morale, avg energy, etc.) + industryEmployeeInfo = createElement("p", {margin:"4px", padding:"4px"}); + industryEmployeeManagementUI.appendChild(industryEmployeeInfo); + industryEmployeeManagementUI.appendChild(createElement("br", {})); + + var positions = [EmployeePositions.Operations, EmployeePositions.Engineer, + EmployeePositions.Business, EmployeePositions.Management, + EmployeePositions.RandD]; + var counts = [opCount, engCount, busCount, mgmtCount, rndCount]; + for (var i = 0; i < positions.length; ++i) { + (function(corp, i) { + var info = createElement("h2", { + display:"inline-block", width:"40%", + innerText: positions[i] + "(" + counts[i] + ")" + }); + var plusBtn = createElement("a", { + class: unassignedCount > 0 ? "a-link-button" : "a-link-button-inactive", + display:"inline-block", innerText:"+", + clickListener:()=>{ + office.assignEmployeeToJob(positions[i]); + corp.displayDivisionContent(division, city); + } + }); + var minusBtn = createElement("a", { + class: counts[i] > 0 ? "a-link-button" : "a-link-button-inactive", + display:"inline-block", innerText:"-", + clickListener:()=>{ + office.unassignEmployeeFromJob(positions[i]); + corp.displayDivisionContent(division, city); + } + }); + var newline = createElement("br", {}); + industryEmployeeManagementUI.appendChild(info); + industryEmployeeManagementUI.appendChild(plusBtn); + industryEmployeeManagementUI.appendChild(minusBtn); + industryEmployeeManagementUI.appendChild(newline); + })(this, i); + } } + industryEmployeePanel.appendChild(industryEmployeeManagementUI); //Warehouse Panel var warehouse = division.warehouses[currentCityUi]; @@ -3725,8 +3969,8 @@ Corporation.prototype.updateDivisionContent = function(division) { profitStr = profit >= 0 ? numeral(profit).format("$0.000a") : "-" + numeral(-1 * profit).format("$0.000a"); industryOverviewText.innerHTML = "Industry: " + division.type + "

" + - "Awareness: " + division.awareness + "
" + - "Popularity: " + division.popularity + "

" + + "Awareness: " + formatNumber(division.awareness, 3) + "
" + + "Popularity: " + formatNumber(division.popularity, 3) + "

" + "Revenue: " + numeral(division.lastCycleRevenue.toNumber()).format("$0.000a") + " / s
" + "Expenses: " + numeral(division.lastCycleExpenses.toNumber()).format("$0.000a") + " /s
" + "Profit: " + profitStr + " / s

" + @@ -3748,27 +3992,28 @@ Corporation.prototype.updateDivisionContent = function(division) { } else { industryEmployeeHireButton.className = "a-link-button"; } - var employeeList = document.getElementById("cmpy-mgmt-employee-ul"); - if (employeeList && office instanceof OfficeSpace) { + + if (!empManualAssignmentModeActive) { + //Calculate average morale, happiness, and energy + var totalMorale = 0, totalHappiness = 0, totalEnergy = 0, + avgMorale = 0, avgHappiness = 0, avgEnergy = 0; for (var i = 0; i < office.employees.length; ++i) { - (function(company) { - var emp = office.employees[i]; - var panel = document.getElementById("cmpy-mgmt-employee-" + emp.name + "-panel"); - if (panel == null) { - var li = createAccordionElement({ - id:"cmpy-mgmt-employee-" + emp.name, - hdrText:emp.name, - }); - panel = li.children[1]; - emp.createUI(panel, company); - employeeList.appendChild(li); - return; - } - emp.updateUI(panel, company); - })(this); + totalMorale += office.employees[i].mor; + totalHappiness += office.employees[i].hap; + totalEnergy += office.employees[i].ene; } + if (office.employees.length > 0) { + avgMorale = totalMorale / office.employees.length; + avgHappiness = totalHappiness / office.employees.length; + avgEnergy = totalEnergy / office.employees.length; + } + industryEmployeeInfo.innerHTML = + "Avg Employee Morale: " + formatNumber(avgMorale, 3) + "
" + + "Avg Employee Happiness: " + formatNumber(avgHappiness, 3) + "
" + + "Avg Employee Energy: " + formatNumber(avgEnergy, 3); } + //Warehouse var warehouse = division.warehouses[currentCityUi]; if (warehouse instanceof Warehouse) { @@ -3816,10 +4061,11 @@ Corporation.prototype.clearUI = function() { industryOverviewPanel = null; industryOverviewText = null; - industryEmployeePanel = null; - industryEmployeeText = null; - industryEmployeeHireButton = null; - industryEmployeeList = null; + industryEmployeePanel = null; + industryEmployeeText = null; + industryEmployeeHireButton = null; + industryEmployeeManagementUI = null; + industryEmployeeInfo = null; industryOfficeUpgradeSizeButton = null; diff --git a/src/Constants.js b/src/Constants.js index 82154553e..63c18cd8b 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -1,5 +1,5 @@ let CONSTANTS = { - Version: "0.34.1", + Version: "0.34.2", //Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then @@ -10,8 +10,8 @@ let CONSTANTS = { CorpFactionRepRequirement: 250000, /* Base costs */ - BaseCostFor1GBOfRamHome: 30000, - BaseCostFor1GBOfRamServer: 50000, //1 GB of RAM + BaseCostFor1GBOfRamHome: 32000, + BaseCostFor1GBOfRamServer: 55000, //1 GB of RAM BaseCostFor1GBOfRamHacknetNode: 30000, BaseCostForHacknetNode: 1000, @@ -41,29 +41,23 @@ let CONSTANTS = { //RAM Costs for different commands ScriptWhileRamCost: 0.2, ScriptForRamCost: 0.2, - ScriptIfRamCost: 0.1, + ScriptIfRamCost: 0.15, ScriptHackRamCost: 0.1, ScriptGrowRamCost: 0.15, ScriptWeakenRamCost: 0.15, ScriptScanRamCost: 0.2, - ScriptNukeRamCost: 0.05, - ScriptBrutesshRamCost: 0.05, - ScriptFtpcrackRamCost: 0.05, - ScriptRelaysmtpRamCost: 0.05, - ScriptHttpwormRamCost: 0.05, - ScriptSqlinjectRamCost: 0.05, - ScriptRunRamCost: 0.8, - ScriptExecRamCost: 1.1, - ScriptScpRamCost: 0.5, + ScriptPortProgramRamCost: 0.05, + ScriptRunRamCost: 1.0, + ScriptExecRamCost: 1.3, + ScriptScpRamCost: 0.6, ScriptKillRamCost: 0.5, //Kill and killall ScriptHasRootAccessRamCost: 0.05, ScriptGetHostnameRamCost: 0.05, //getHostname() and getIp() ScriptGetHackingLevelRamCost: 0.05, //getHackingLevel() ScriptGetMultipliersRamCost: 4.0, //getHackingMultipliers() and getBitNodeMultipliers() - ScriptGetServerCost: 0.1, + ScriptGetServerRamCost: 0.1, ScriptFileExistsRamCost: 0.1, ScriptIsRunningRamCost: 0.1, - ScriptOperatorRamCost: 0.01, ScriptPurchaseHacknetRamCost: 1.5, ScriptHacknetNodesRamCost: 1.0, //Base cost for accessing hacknet nodes array ScriptHNUpgLevelRamCost: 0.4, @@ -71,7 +65,7 @@ let CONSTANTS = { ScriptHNUpgCoreRamCost: 0.8, ScriptGetStockRamCost: 2.0, ScriptBuySellStockRamCost: 2.5, - ScriptPurchaseServerRamCost: 2.0, + ScriptPurchaseServerRamCost: 2.25, ScriptRoundRamCost: 0.05, ScriptReadWriteRamCost: 1.0, ScriptArbScriptRamCost: 1.0, //Functions that apply to all scripts regardless of args @@ -613,8 +607,8 @@ let CONSTANTS = { "serverExists(hostname/ip)
Returns a boolean denoting whether or not the specified server exists. The argument " + "must be a string with the hostname or IP of the target server.

" + "fileExists(filename, [hostname/ip])
Returns a boolean (true or false) indicating whether the specified file exists on a server. " + - "The first argument must be a string with the name of the file. A file can either be a script, program, or literature file. A script name is case-sensitive, but a " + - "program/literature file is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe.

" + + "The first argument must be a string with the filename. A file can either be a script, program, literature file, or a text file. The filename for a script is case-sensitive, but " + + "for the other files it is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe.

" + "The second argument is a string with the hostname or IP of the server on which to search for the program. This second argument is optional. " + "If it is omitted, then the function will search through the current server (the server running the script that calls this function) for the file.
" + "Example: fileExists('foo.script', 'foodnstuff');
" + @@ -667,6 +661,8 @@ let CONSTANTS = { "clear(port/fn)
This function is used to clear a Netscript Port or a text file.

" + "It takes a single argument. If this argument is a number between 1 and 10, then it specifies a port and will clear it (deleting all data from it). " + "If the argument is a string, then it specifies the name of a text file (.txt) and will clear the text file so that it is empty.

" + + "rm(fn)
This function is used to remove a file. It takes a string with the filename as the argument. Returns " + + "true if it successfully deletes the given file, and false otherwise. This function works for every file type except message files (.msg).

" + "scriptRunning(scriptname, hostname/ip)
Returns a boolean indicating whether any instance of the specified script is running " + "on a server, regardless of its arguments. This is different than the isRunning() function because it does not " + "try to identify a specific instance of a running script by its arguments.

" + @@ -1118,6 +1114,30 @@ let CONSTANTS = { LatestUpdate: "v0.34.2
" + + "-Corporation Management Changes:
" + + "---Added advertising mechanics
" + + "---Added Industry-specific purchases
" + + "---Re-designed employee management UI
" + + "---Rebalancing: Made many upgrades/purchases cheaper. Receive more money from investors in early stage. Company valuation is higher after going public
" + + "---Multiple bug fixes
" + + "-Added rm() Netscript function
" + + "-Updated the way script RAM usage is calculated. Now, a function only increases RAM usage the " + + "first time it is called. i.e. even if you call hack() multiple times in a script, it only counts " + + "against RAM usage once. The same change applies for while/for loops and if conditionals.
" + + "-The RAM cost of the following were increased:
" + + "---If statements: increased by 0.05GB
" + + "---run() and exec(): increased by 0.2GB
" + + "---scp(): increased by 0.1GB
" + + "---purchaseServer(): increased by 0.25GB
" + + "-Note: You may need to re-save all of your scripts in order to re-calculate their RAM usages. Otherwise, " + + "it should automatically be re-calculated when you reset/prestige
" + + "-The cost to upgrade your home computer's RAM has been increased (both the base cost and the exponential upgrade multiplier)
" + + "-The cost of purchasing a server was increased by 10% (it is now $55k per RAM)
" + + "-Bug fix: (Hopefully) removed an exploit where you could avoid RAM usage for Netscript function calls " + + "by assigning functions to a variable (foo = hack(); foo('helios');)
" + + "-Bug fix: (Hopefully) removed an exploit where you could run arbitrary Javascript code using the constructor() " + + "method
" + + "-Thanks to Github user mateon1 and Reddit users havoc_mayhem and spaceglace for notifying me of the above exploits
" + "-The fileExists() Netscript function now works on text files (.txt). Thanks to Github user devoidfury for this
" } diff --git a/src/Literature.js b/src/Literature.js index 7c837bb52..5b39b278c 100644 --- a/src/Literature.js +++ b/src/Literature.js @@ -39,6 +39,21 @@ function initLiterature() { "Netscript command to copy your scripts onto these servers and then run them."; Literatures[fn] = new Literature(title, fn, txt); + title = "The Complete Handbook for Creating a Successful Corporation"; + fn = "corporation-management-handbook.lit"; + txt = "This is a brief collection of tips/pointers on how to successfully start and manage a Corporation.

" + + "-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

"; + Literatures[fn] = new Literature(title, fn, txt); + title = "A Green Tomorrow"; fn = "A-Green-Tomorrow.lit"; txt = "Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to " + diff --git a/src/Location.js b/src/Location.js index d76c2cc48..ea9734c45 100644 --- a/src/Location.js +++ b/src/Location.js @@ -1768,7 +1768,7 @@ function initLocationButtons() { //Calculate cost //Have cost increase by some percentage each time RAM has been upgraded var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRamHome; - var mult = Math.pow(1.55, numUpgrades); + var mult = Math.pow(1.58, numUpgrades); cost = cost * mult; var yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton(); diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js index 2e9405bf9..41581d905 100644 --- a/src/NetscriptEvaluator.js +++ b/src/NetscriptEvaluator.js @@ -58,6 +58,11 @@ function evaluate(exp, workerScript) { return Promise.resolve(exp.value); break; case "Identifier": + //Javascript constructor() method can be used as an exploit to run arbitrary code + if (exp.name == "constructor") { + return Promise.reject(makeRuntimeRejectMsg(workerScript, "Illegal usage of constructor() method. If you have your own function named 'constructor', you must re-name it.")); + } + if (!(exp.name in env.vars)){ return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.name + " not defined")); } @@ -177,9 +182,11 @@ function evaluate(exp, workerScript) { } else { return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression")); } - }); } else { + if (exp.property.name === "constructor") { + return Promise.reject(makeRuntimeRejectMsg(workerScript, "Illegal usage of constructor() method. If you have your own function named 'constructor', you must re-name it.")); + } try { return Promise.resolve(object[exp.property.name]) } catch (e) { diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index dff169ac5..6a4daa2d5 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -103,6 +103,14 @@ function NetscriptFunctions(workerScript) { sprintf : sprintf, vsprintf: vsprintf, scan : function(ip=workerScript.serverIp, hostnames=true){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.scan) { + return 0; + } else { + workerScript.loadedFns.scan = true; + return CONSTANTS.ScriptScanRamCost; + } + } var server = getServer(ip); if (server == null) { throw makeRuntimeRejectMsg(workerScript, 'Invalid IP or hostname passed into scan() command'); @@ -124,6 +132,14 @@ function NetscriptFunctions(workerScript) { return out; }, hack : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.hack) { + return 0; + } else { + workerScript.loadedFns.hack = true; + return CONSTANTS.ScriptHackRamCost; + } + } if (ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "Hack() call has incorrect number of arguments. Takes 1 argument"); } @@ -191,6 +207,7 @@ function NetscriptFunctions(workerScript) { }); }, sleep : function(time,log=true){ + if (workerScript.checkingRam) {return 0;} if (time === undefined) { throw makeRuntimeRejectMsg(workerScript, "sleep() call has incorrect number of arguments. Takes 1 argument"); } @@ -202,6 +219,14 @@ function NetscriptFunctions(workerScript) { }); }, grow : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.grow) { + return 0; + } else { + workerScript.loadedFns.grow = true; + return CONSTANTS.ScriptGrowRamCost; + } + } var threads = workerScript.scriptRef.threads; if (isNaN(threads) || threads < 1) {threads = 1;} if (ip === undefined) { @@ -240,6 +265,14 @@ function NetscriptFunctions(workerScript) { }); }, weaken : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.weaken) { + return 0; + } else { + workerScript.loadedFns.weaken = true; + return CONSTANTS.ScriptWeakenRamCost; + } + } var threads = workerScript.scriptRef.threads; if (isNaN(threads) || threads < 1) {threads = 1;} if (ip === undefined) { @@ -273,12 +306,14 @@ function NetscriptFunctions(workerScript) { }); }, print : function(args){ + if (workerScript.checkingRam) {return 0;} if (args === undefined) { throw makeRuntimeRejectMsg(workerScript, "print() call has incorrect number of arguments. Takes 1 argument"); } workerScript.scriptRef.log(args.toString()); }, tprint : function(args) { + if (workerScript.checkingRam) {return 0;} if (args === undefined || args == null) { throw makeRuntimeRejectMsg(workerScript, "tprint() call has incorrect number of arguments. Takes 1 argument"); } @@ -293,9 +328,18 @@ function NetscriptFunctions(workerScript) { post(workerScript.scriptRef.filename + ": " + args.toString()); }, clearLog : function() { + if (workerScript.checkingRam) {return 0;} workerScript.scriptRef.clearLog(); }, nuke : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.nuke) { + return 0; + } else { + workerScript.loadedFns.nuke = true; + return CONSTANTS.ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -319,6 +363,14 @@ function NetscriptFunctions(workerScript) { return true; }, brutessh : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.brutessh) { + return 0; + } else { + workerScript.loadedFns.brutessh = true; + return CONSTANTS.ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -341,6 +393,14 @@ function NetscriptFunctions(workerScript) { return true; }, ftpcrack : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.ftpcrack) { + return 0; + } else { + workerScript.loadedFns.ftpcrack = true; + return CONSTANTS.ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -362,6 +422,14 @@ function NetscriptFunctions(workerScript) { return true; }, relaysmtp : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.relaysmtp) { + return 0; + } else { + workerScript.loadedFns.relaysmtp = true; + return CONSTANTS.ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -383,6 +451,14 @@ function NetscriptFunctions(workerScript) { return true; }, httpworm : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.httpworm) { + return 0; + } else { + workerScript.loadedFns.httpworm = true; + return CONSTANTS.ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -404,6 +480,14 @@ function NetscriptFunctions(workerScript) { return true; }, sqlinject : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.sqlinject) { + return 0; + } else { + workerScript.loadedFns.sqlinject = true; + return CONSTANTS.ScriptPortProgramRamCost; + } + } if (ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); } @@ -425,6 +509,14 @@ function NetscriptFunctions(workerScript) { return true; }, run : function(scriptname,threads = 1){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.run) { + return 0; + } else { + workerScript.loadedFns.run = true; + return CONSTANTS.ScriptRunRamCost; + } + } if (scriptname === undefined) { throw makeRuntimeRejectMsg(workerScript, "run() call has incorrect number of arguments. Usage: run(scriptname, [numThreads], [arg1], [arg2]...)"); } @@ -442,7 +534,15 @@ function NetscriptFunctions(workerScript) { return runScriptFromScript(scriptServer, scriptname, argsForNewScript, workerScript, threads); }, - exec : function(scriptname,ip,threads = 1){ + exec : function(scriptname,ip,threads = 1) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.exec) { + return 0; + } else { + workerScript.loadedFns.exec = true; + return CONSTANTS.ScriptExecRamCost; + } + } if (scriptname === undefined || ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "exec() call has incorrect number of arguments. Usage: exec(scriptname, server, [numThreads], [arg1], [arg2]...)"); } @@ -459,7 +559,16 @@ function NetscriptFunctions(workerScript) { } return runScriptFromScript(server, scriptname, argsForNewScript, workerScript, threads); }, - kill : function(filename,ip){ + kill : function(filename,ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.kill) { + return 0; + } else { + workerScript.loadedFns.kill = true; + return CONSTANTS.ScriptKillRamCost; + } + } + if (filename === undefined || ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "kill() call has incorrect number of arguments. Usage: kill(scriptname, server, [arg1], [arg2]...)"); } @@ -487,6 +596,15 @@ function NetscriptFunctions(workerScript) { } }, killall : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.killall) { + return 0; + } else { + workerScript.loadedFns.killall = true; + return CONSTANTS.ScriptKillRamCost; + } + } + if (ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "killall() call has incorrect number of arguments. Takes 1 argument"); } @@ -502,6 +620,14 @@ function NetscriptFunctions(workerScript) { return true; }, exit : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.exit) { + return 0; + } else { + workerScript.loadedFns.exit = true; + return CONSTANTS.ScriptKillRamCost; + } + } var server = getServer(workerScript.serverIp); if (server == null) { throw makeRuntimeRejectMsg(workerScript, "Error getting Server for this script in exit(). This is a bug please contact game dev"); @@ -512,7 +638,15 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("Exit failed(). This is a bug please contact game developer"); } }, - scp : function(scriptname, ip1, ip2){ + scp : function(scriptname, ip1, ip2) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.scp) { + return 0; + } else { + workerScript.loadedFns.scp = true; + return CONSTANTS.ScriptScpRamCost; + } + } if (arguments.length !== 2 && arguments.length !== 3) { throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments"); } @@ -621,6 +755,14 @@ function NetscriptFunctions(workerScript) { return true; }, ls : function(ip, grep) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.ls) { + return 0; + } else { + workerScript.loadedFns.ls = true; + return CONSTANTS.ScriptScanRamCost; + } + } if (ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "ls() failed because of invalid arguments. Usage: ls(ip/hostname, [grep filter])"); } @@ -678,7 +820,15 @@ function NetscriptFunctions(workerScript) { allFiles.sort(); return allFiles; }, - hasRootAccess : function(ip){ + hasRootAccess : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.hasRootAccess) { + return 0; + } else { + workerScript.loadedFns.hasRootAccess = true; + return CONSTANTS.ScriptHasRootAccessRamCost; + } + } if (ip===undefined){ throw makeRuntimeRejectMsg(workerScript, "hasRootAccess() call has incorrect number of arguments. Takes 1 argument"); } @@ -690,6 +840,14 @@ function NetscriptFunctions(workerScript) { return server.hasAdminRights; }, getIp : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getIp) { + return 0; + } else { + workerScript.loadedFns.getIp = true; + return CONSTANTS.ScriptGetHostnameRamCost; + } + } var scriptServer = getServer(workerScript.serverIp); if (scriptServer == null) { throw makeRuntimeRejectMsg(workerScript, "Could not find server. This is a bug in the game. Report to game dev"); @@ -697,6 +855,14 @@ function NetscriptFunctions(workerScript) { return scriptServer.ip; }, getHostname : function(){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getHostname) { + return 0; + } else { + workerScript.loadedFns.getHostname = true; + return CONSTANTS.ScriptGetHostnameRamCost; + } + } var scriptServer = getServer(workerScript.serverIp); if (scriptServer == null) { throw makeRuntimeRejectMsg(workerScript, "Could not find server. This is a bug in the game. Report to game dev"); @@ -704,11 +870,27 @@ function NetscriptFunctions(workerScript) { return scriptServer.hostname; }, getHackingLevel : function(){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getHackingLevel) { + return 0; + } else { + workerScript.loadedFns.getHackingLevel = true; + return CONSTANTS.ScriptGetHackingLevelRamCost; + } + } Player.updateSkillLevels(); workerScript.scriptRef.log("getHackingLevel() returned " + Player.hacking_skill); return Player.hacking_skill; }, getHackingMultipliers : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getHackingMultipliers) { + return 0; + } else { + workerScript.loadedFns.getHackingMultipliers = true; + return CONSTANTS.ScriptGetMultipliersRamCost; + } + } return { chance: Player.hacking_chance_mult, speed: Player.hacking_speed_mult, @@ -717,12 +899,28 @@ function NetscriptFunctions(workerScript) { }; }, getBitNodeMultipliers: function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getBitNodeMultipliers) { + return 0; + } else { + workerScript.loadedFns.getBitNodeMultipliers = true; + return CONSTANTS.ScriptGetMultipliersRamCost; + } + } if (!hasAISF) { throw makeRuntimeRejectMsg(workerScript, "Cannot run getBitNodeMultipliers(). It requires Source-File 5 to run."); } return BitNodeMultipliers; }, getServerMoneyAvailable : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerMoneyAvailable) { + return 0; + } else { + workerScript.loadedFns.getServerMoneyAvailable = true; + return CONSTANTS.ScriptGetServerRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip); @@ -737,6 +935,14 @@ function NetscriptFunctions(workerScript) { return server.moneyAvailable; }, getServerSecurityLevel : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerSecurityLevel) { + return 0; + } else { + workerScript.loadedFns.getServerSecurityLevel = true; + return CONSTANTS.ScriptGetServerRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); @@ -746,6 +952,14 @@ function NetscriptFunctions(workerScript) { return server.hackDifficulty; }, getServerBaseSecurityLevel : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerBaseSecurityLevel) { + return 0; + } else { + workerScript.loadedFns.getServerBaseSecurityLevel = true; + return CONSTANTS.ScriptGetServerRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); @@ -755,6 +969,14 @@ function NetscriptFunctions(workerScript) { return server.baseDifficulty; }, getServerMinSecurityLevel : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerMinSecurityLevel) { + return 0; + } else { + workerScript.loadedFns.getServerMinSecurityLevel = true; + return CONSTANTS.ScriptGetServerRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); @@ -763,7 +985,15 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + formatNumber(server.minDifficulty, 3) + " for " + server.hostname); return server.minDifficulty; }, - getServerRequiredHackingLevel : function(ip){ + getServerRequiredHackingLevel : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerRequiredHackingLevel) { + return 0; + } else { + workerScript.loadedFns.getServerRequiredHackingLevel = true; + return CONSTANTS.ScriptGetServerRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip); @@ -773,6 +1003,14 @@ function NetscriptFunctions(workerScript) { return server.requiredHackingSkill; }, getServerMaxMoney : function(ip){ + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerMaxMoney) { + return 0; + } else { + workerScript.loadedFns.getServerMaxMoney = true; + return CONSTANTS.ScriptGetServerRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip); @@ -782,6 +1020,14 @@ function NetscriptFunctions(workerScript) { return server.moneyMax; }, getServerGrowth : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerGrowth) { + return 0; + } else { + workerScript.loadedFns.getServerGrowth = true; + return CONSTANTS.ScriptGetServerRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getServerGrowth() failed. Invalid IP or hostname passed in: " + ip); @@ -790,7 +1036,15 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("getServerGrowth() returned " + formatNumber(server.serverGrowth, 0) + " for " + server.hostname); return server.serverGrowth; }, - getServerNumPortsRequired : function(ip){ + getServerNumPortsRequired : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerNumPortsRequired) { + return 0; + } else { + workerScript.loadedFns.getServerNumPortsRequired = true; + return CONSTANTS.ScriptGetServerRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip); @@ -800,6 +1054,14 @@ function NetscriptFunctions(workerScript) { return server.numOpenPortsRequired; }, getServerRam : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getServerRam) { + return 0; + } else { + workerScript.loadedFns.getServerRam = true; + return CONSTANTS.ScriptGetServerRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getServerRam() failed. Invalid IP or hostname passed in: " + ip); @@ -809,9 +1071,25 @@ function NetscriptFunctions(workerScript) { return [server.maxRam, server.ramUsed]; }, serverExists : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.serverExists) { + return 0; + } else { + workerScript.loadedFns.serverExists = true; + return CONSTANTS.ScriptGetServerRamCost; + } + } return (getServer(ip) !== null); }, - fileExists : function(filename,ip=workerScript.serverIp){ + fileExists : function(filename,ip=workerScript.serverIp) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.fileExists) { + return 0; + } else { + workerScript.loadedFns.fileExists = true; + return CONSTANTS.ScriptFileExistsRamCost; + } + } if (filename === undefined) { throw makeRuntimeRejectMsg(workerScript, "fileExists() call has incorrect number of arguments. Usage: fileExists(scriptname, [server])"); } @@ -842,7 +1120,15 @@ function NetscriptFunctions(workerScript) { } return false; }, - isRunning : function(filename,ip){ + isRunning : function(filename,ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.isRunning) { + return 0; + } else { + workerScript.loadedFns.isRunning = true; + return CONSTANTS.ScriptIsRunningRamCost; + } + } if (filename === undefined || ip === undefined) { throw makeRuntimeRejectMsg(workerScript, "isRunning() call has incorrect number of arguments. Usage: isRunning(scriptname, server, [arg1], [arg2]...)"); } @@ -857,9 +1143,38 @@ function NetscriptFunctions(workerScript) { } return (findRunningScript(filename, argsForTargetScript, server) != null); }, - getNextHacknetNodeCost : getCostOfNextHacknetNode, - purchaseHacknetNode : purchaseHacknet, + getNextHacknetNodeCost : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getNextHacknetNodeCost) { + return 0; + } else { + workerScript.loadedFns.getNextHacknetNodeCost = true; + return CONSTANTS.ScriptHacknetNodesRamCost; + } + } + return getCostOfNextHacknetNode(); + }, + + purchaseHacknetNode : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.purchaseHacknetNode) { + return 0; + } else { + workerScript.loadedFns.purchaseHacknetNode = true; + return CONSTANTS.ScriptPurchaseHacknetRamCost; + } + } + purchaseHacknet(); + }, getStockPrice : function(symbol) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getStockPrice) { + return 0; + } else { + workerScript.loadedFns.getStockPrice = true; + return CONSTANTS.ScriptGetStockRamCost; + } + } if (!Player.hasTixApiAccess) { throw makeRuntimeRejectMsg(workerScript, "You don't have TIX API Access! Cannot use getStockPrice()"); } @@ -870,6 +1185,14 @@ function NetscriptFunctions(workerScript) { return parseFloat(stock.price.toFixed(3)); }, getStockPosition : function(symbol) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getStockPosition) { + return 0; + } else { + workerScript.loadedFns.getStockPosition = true; + return CONSTANTS.ScriptGetStockRamCost; + } + } if (!Player.hasTixApiAccess) { throw makeRuntimeRejectMsg(workerScript, "You don't have TIX API Access! Cannot use getStockPosition()"); } @@ -880,6 +1203,14 @@ function NetscriptFunctions(workerScript) { return [stock.playerShares, stock.playerAvgPx, stock.playerShortShares, stock.playerAvgShortPx]; }, buyStock : function(symbol, shares) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.buyStock) { + return 0; + } else { + workerScript.loadedFns.buyStock = true; + return CONSTANTS.ScriptBuySellStockRamCost; + } + } if (!Player.hasTixApiAccess) { throw makeRuntimeRejectMsg(workerScript, "You don't have TIX API Access! Cannot use buyStock()"); } @@ -915,6 +1246,14 @@ function NetscriptFunctions(workerScript) { return stock.price; }, sellStock : function(symbol, shares) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.sellStock) { + return 0; + } else { + workerScript.loadedFns.sellStock = true; + return CONSTANTS.ScriptBuySellStockRamCost; + } + } if (!Player.hasTixApiAccess) { throw makeRuntimeRejectMsg(workerScript, "You don't have TIX API Access! Cannot use sellStock()"); } @@ -951,6 +1290,14 @@ function NetscriptFunctions(workerScript) { return stock.price; }, shortStock(symbol, shares) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.shortStock) { + return 0; + } else { + workerScript.loadedFns.shortStock = true; + return CONSTANTS.ScriptBuySellStockRamCost; + } + } if (!Player.hasTixApiAccess) { throw makeRuntimeRejectMsg(workerScript, "You don't have TIX API Access! Cannot use shortStock()"); } @@ -967,6 +1314,14 @@ function NetscriptFunctions(workerScript) { return res ? stock.price : 0; }, sellShort(symbol, shares) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.sellShort) { + return 0; + } else { + workerScript.loadedFns.sellShort = true; + return CONSTANTS.ScriptBuySellStockRamCost; + } + } if (!Player.hasTixApiAccess) { throw makeRuntimeRejectMsg(workerScript, "You don't have TIX API Access! Cannot use sellShort()"); } @@ -983,6 +1338,14 @@ function NetscriptFunctions(workerScript) { return res ? stock.price : 0; }, placeOrder(symbol, shares, price, type, pos) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.placeOrder) { + return 0; + } else { + workerScript.loadedFns.placeOrder = true; + return CONSTANTS.ScriptBuySellStockRamCost; + } + } if (!Player.hasTixApiAccess) { throw makeRuntimeRejectMsg(workerScript, "You don't have TIX API Access! Cannot use placeOrder()"); } @@ -1021,6 +1384,14 @@ function NetscriptFunctions(workerScript) { return placeOrder(stock, shares, price, orderType, orderPos, workerScript); }, cancelOrder(symbol, shares, price, type, pos) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.cancelOrder) { + return 0; + } else { + workerScript.loadedFns.cancelOrder = true; + return CONSTANTS.ScriptBuySellStockRamCost; + } + } if (!Player.hasTixApiAccess) { throw makeRuntimeRejectMsg(workerScript, "You don't have TIX API Access! Cannot use cancelOrder()"); } @@ -1068,6 +1439,14 @@ function NetscriptFunctions(workerScript) { return cancelOrder(params, workerScript); }, purchaseServer : function(hostname, ram) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.purchaseServer) { + return 0; + } else { + workerScript.loadedFns.purchaseServer = true; + return CONSTANTS.ScriptPurchaseServerRamCost; + } + } var hostnameStr = String(hostname); hostnameStr = hostnameStr.replace(/\s\s+/g, ''); if (hostnameStr == "") { @@ -1104,6 +1483,14 @@ function NetscriptFunctions(workerScript) { return newServ.hostname; }, deleteServer : function(hostname) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.deleteServer) { + return 0; + } else { + workerScript.loadedFns.deleteServer = true; + return CONSTANTS.ScriptPurchaseServerRamCost; + } + } var hostnameStr = String(hostname); hostnameStr = hostnameStr.replace(/\s\s+/g, ''); var server = GetServerByHostname(hostnameStr); @@ -1167,6 +1554,14 @@ function NetscriptFunctions(workerScript) { return false; }, getPurchasedServers : function(hostname=true) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getPurchasedServers) { + return 0; + } else { + workerScript.loadedFns.getPurchasedServers = true; + return CONSTANTS.ScriptPurchaseServerRamCost; + } + } var res = []; Player.purchasedServers.forEach(function(ip) { if (hostname) { @@ -1186,6 +1581,14 @@ function NetscriptFunctions(workerScript) { return Math.round(n); }, write : function(port, data="", mode="a") { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.write) { + return 0; + } else { + workerScript.loadedFns.write = true; + return CONSTANTS.ScriptReadWriteRamCost; + } + } if (!isNaN(port)) { //Write to port //Port 1-10 if (port < 1 || port > 10) { @@ -1224,6 +1627,14 @@ function NetscriptFunctions(workerScript) { } }, read : function(port) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.read) { + return 0; + } else { + workerScript.loadedFns.read = true; + return CONSTANTS.ScriptReadWriteRamCost; + } + } if (!isNaN(port)) { //Read from port //Port 1-10 if (port < 1 || port > 10) { @@ -1256,6 +1667,14 @@ function NetscriptFunctions(workerScript) { } }, clear : function(port) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.clear) { + return 0; + } else { + workerScript.loadedFns.clear = true; + return CONSTANTS.ScriptReadWriteRamCost; + } + } if (!isNaN(port)) { //Clear port if (port < 1 || port > 10) { throw makeRuntimeRejectMsg(workerScript, "ERR: Trying to read from invalid port: " + port + ". Only ports 1-10 are valid"); @@ -1281,7 +1700,68 @@ function NetscriptFunctions(workerScript) { } return 0; }, + rm : function(fn) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.rm) { + return 0; + } else { + workerScript.loadedFns.rm = true; + return CONSTANTS.ScriptReadWriteRamCost; + } + } + var s = getServer(workerScript.serverIp); + if (s == null) { + throw makeRuntimeRejectMsg(workerScript, "Error getting Server for this script in clear(). This is a bug please contact game dev"); + } + + if (fn.includes(".exe")) { + for (var i = 0; i < s.programs.length; ++i) { + if (s.programs[i] === fn) { + s.programs.splice(i, 1); + return true; + } + } + } else if (fn.endsWith(".script")) { + for (var i = 0; i < s.scripts.length; ++i) { + if (s.scripts[i].filename === fn) { + //Check that the script isnt currently running + for (var j = 0; j < s.runningScripts.length; ++j) { + if (s.runningScripts[j].filename === fn) { + workerScript.scriptRef.log("Cannot delete a script that is currently running!"); + return false; + } + } + s.scripts.splice(i, 1); + return true; + } + } + } else if (fn.endsWith(".lit")) { + for (var i = 0; i < s.messages.length; ++i) { + var f = s.messages[i]; + if (!(f instanceof Message) && isString(f) && f === fn) { + s.messages.splice(i, 1); + return true; + } + } + } else if (fn.endsWith(".txt")) { + for (var i = 0; i < s.textFiles.length; ++i) { + if (s.textFiles[i].fn === fn) { + s.textFiles.splice(i, 1); + return true; + } + } + } + return false; + }, scriptRunning : function(scriptname, ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.scriptRunning) { + return 0; + } else { + workerScript.loadedFns.scriptRunning = true; + return CONSTANTS.ScriptArbScriptRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("scriptRunning() failed. Invalid IP or hostname passed in: " + ip); @@ -1295,6 +1775,14 @@ function NetscriptFunctions(workerScript) { return false; }, scriptKill : function(scriptname, ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.scriptKill) { + return 0; + } else { + workerScript.loadedFns.scriptKill = true; + return CONSTANTS.ScriptArbScriptRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("scriptKill() failed. Invalid IP or hostname passed in: " + ip); @@ -1310,6 +1798,14 @@ function NetscriptFunctions(workerScript) { return suc; }, getScriptRam : function (scriptname, ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getScriptRam) { + return 0; + } else { + workerScript.loadedFns.getScriptRam = true; + return CONSTANTS.ScriptGetScriptRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getScriptRam() failed. Invalid IP or hostname passed in: " + ip); @@ -1323,6 +1819,14 @@ function NetscriptFunctions(workerScript) { return 0; }, getHackTime : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getHackTime) { + return 0; + } else { + workerScript.loadedFns.getHackTime = true; + return CONSTANTS.ScriptGetHackTimeRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getHackTime() failed. Invalid IP or hostname passed in: " + ip); @@ -1331,6 +1835,14 @@ function NetscriptFunctions(workerScript) { return scriptCalculateHackingTime(server); //Returns seconds }, getGrowTime : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getGrowTime) { + return 0; + } else { + workerScript.loadedFns.getGrowTime = true; + return CONSTANTS.ScriptGetHackTimeRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getGrowTime() failed. Invalid IP or hostname passed in: " + ip); @@ -1339,6 +1851,14 @@ function NetscriptFunctions(workerScript) { return scriptCalculateGrowTime(server) / 1000; //Returns seconds }, getWeakenTime : function(ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getWeakenTime) { + return 0; + } else { + workerScript.loadedFns.getWeakenTime = true; + return CONSTANTS.ScriptGetHackTimeRamCost; + } + } var server = getServer(ip); if (server == null) { workerScript.scriptRef.log("getWeakenTime() failed. Invalid IP or hostname passed in: " + ip); @@ -1347,6 +1867,14 @@ function NetscriptFunctions(workerScript) { return scriptCalculateWeakenTime(server) / 1000; //Returns seconds }, getScriptIncome : function(scriptname, ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getScriptIncome) { + return 0; + } else { + workerScript.loadedFns.getScriptIncome = true; + return CONSTANTS.ScriptGetScriptRamCost; + } + } if (arguments.length === 0) { //Get total script income var res = []; @@ -1373,6 +1901,14 @@ function NetscriptFunctions(workerScript) { } }, getScriptExpGain : function(scriptname, ip) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getScriptExpGain) { + return 0; + } else { + workerScript.loadedFns.getScriptExpGain = true; + return CONSTANTS.ScriptGetScriptRamCost; + } + } if (arguments.length === 0) { var total = 0; for (var i = 0; i < workerScripts.length; ++i) { @@ -1399,9 +1935,18 @@ function NetscriptFunctions(workerScript) { } }, getTimeSinceLastAug : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getTimeSinceLastAug) { + return 0; + } else { + workerScript.loadedFns.getTimeSinceLastAug = true; + return CONSTANTS.ScriptGetHackTimeRamCost; + } + } return Player.playtimeSinceLastAug; }, prompt : function(txt) { + if (workerScript.checkingRam) {return 0;} if (yesNoBoxOpen) { workerScript.scriptRef.log("ERROR: confirm() failed because a pop-up dialog box is already open"); return false; @@ -1425,6 +1970,16 @@ function NetscriptFunctions(workerScript) { /* Singularity Functions */ universityCourse : function(universityName, className) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.universityCourse) { + return 0; + } else { + workerScript.loadedFns.universityCourse = true; + var ramCost = CONSTANTS.ScriptSingularityFn1RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run universityCourse(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -1504,6 +2059,16 @@ function NetscriptFunctions(workerScript) { }, gymWorkout : function(gymName, stat) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.gymWorkout) { + return 0; + } else { + workerScript.loadedFns.gymWorkout = true; + var ramCost = CONSTANTS.ScriptSingularityFn1RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run gymWorkout(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -1596,6 +2161,16 @@ function NetscriptFunctions(workerScript) { }, travelToCity(cityname) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.travelToCity) { + return 0; + } else { + workerScript.loadedFns.travelToCity = true; + var ramCost = CONSTANTS.ScriptSingularityFn1RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run travelToCity(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -1622,6 +2197,16 @@ function NetscriptFunctions(workerScript) { }, purchaseTor() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.purchaseTor) { + return 0; + } else { + workerScript.loadedFns.purchaseTor = true; + var ramCost = CONSTANTS.ScriptSingularityFn1RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run purchaseTor(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -1653,6 +2238,16 @@ function NetscriptFunctions(workerScript) { return true; }, purchaseProgram(programName) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.purchaseProgram) { + return 0; + } else { + workerScript.loadedFns.purchaseProgram = true; + var ramCost = CONSTANTS.ScriptSingularityFn1RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run purchaseProgram(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -1757,6 +2352,16 @@ function NetscriptFunctions(workerScript) { return true; }, getStats : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getStats) { + return 0; + } else { + workerScript.loadedFns.getStats = true; + var ramCost = CONSTANTS.ScriptSingularityFn1RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run getStats(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -1775,6 +2380,16 @@ function NetscriptFunctions(workerScript) { } }, isBusy : function() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.isBusy) { + return 0; + } else { + workerScript.loadedFns.isBusy = true; + var ramCost = CONSTANTS.ScriptSingularityFn1RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 1)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run isBusy(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); @@ -1784,6 +2399,16 @@ function NetscriptFunctions(workerScript) { return Player.isWorking; }, upgradeHomeRam() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.upgradeHomeRam) { + return 0; + } else { + workerScript.loadedFns.upgradeHomeRam = true; + var ramCost = CONSTANTS.ScriptSingularityFn2RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run upgradeHomeRam(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -1816,6 +2441,16 @@ function NetscriptFunctions(workerScript) { return true; }, getUpgradeHomeRamCost() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getUpgradeHomeRamCost) { + return 0; + } else { + workerScript.loadedFns.getUpgradeHomeRamCost = true; + var ramCost = CONSTANTS.ScriptSingularityFn2RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run getUpgradeHomeRamCost(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -1834,6 +2469,16 @@ function NetscriptFunctions(workerScript) { return cost * mult; }, workForCompany() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.workForCompany) { + return 0; + } else { + workerScript.loadedFns.workForCompany = true; + var ramCost = CONSTANTS.ScriptSingularityFn2RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run workForCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -1865,6 +2510,16 @@ function NetscriptFunctions(workerScript) { return true; }, applyToCompany(companyName, field) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.applyToCompany) { + return 0; + } else { + workerScript.loadedFns.applyToCompany = true; + var ramCost = CONSTANTS.ScriptSingularityFn2RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run applyToCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -1936,6 +2591,16 @@ function NetscriptFunctions(workerScript) { return res; }, getCompanyRep(companyName) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getCompanyRep) { + return 0; + } else { + workerScript.loadedFns.getCompanyRep = true; + var ramCost = CONSTANTS.ScriptSingularityFn2RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run getCompanyRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -1951,6 +2616,16 @@ function NetscriptFunctions(workerScript) { return company.playerReputation; }, checkFactionInvitations() { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.checkFactionInvitations) { + return 0; + } else { + workerScript.loadedFns.checkFactionInvitations = true; + var ramCost = CONSTANTS.ScriptSingularityFn2RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run checkFactionInvitations(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -1961,6 +2636,16 @@ function NetscriptFunctions(workerScript) { return Player.factionInvitations.slice(); }, joinFaction(name) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.joinFaction) { + return 0; + } else { + workerScript.loadedFns.joinFaction = true; + var ramCost = CONSTANTS.ScriptSingularityFn2RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run joinFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -1992,6 +2677,16 @@ function NetscriptFunctions(workerScript) { return true; }, workForFaction(name, type) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.workForFaction) { + return 0; + } else { + workerScript.loadedFns.workForFaction = true; + var ramCost = CONSTANTS.ScriptSingularityFn2RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run workForFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -2078,6 +2773,16 @@ function NetscriptFunctions(workerScript) { return true; }, getFactionRep(name) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getFactionRep) { + return 0; + } else { + workerScript.loadedFns.getFactionRep = true; + var ramCost = CONSTANTS.ScriptSingularityFn2RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 2)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run getFactionRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); @@ -2093,6 +2798,16 @@ function NetscriptFunctions(workerScript) { return Factions[name].playerReputation; }, createProgram(name) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.createProgram) { + return 0; + } else { + workerScript.loadedFns.createProgram = true; + var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run createProgram(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -2183,6 +2898,16 @@ function NetscriptFunctions(workerScript) { return true; }, commitCrime : function(crime) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.commitCrime) { + return 0; + } else { + workerScript.loadedFns.commitCrime = true; + var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run commitCrime(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -2264,6 +2989,16 @@ function NetscriptFunctions(workerScript) { } }, getCrimeChance(crime) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getCrimeChance) { + return 0; + } else { + workerScript.loadedFns.getCrimeChance = true; + var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run getCrimeChance(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -2301,6 +3036,16 @@ function NetscriptFunctions(workerScript) { } }, getOwnedAugmentations(purchased=false) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getOwnedAugmentations) { + return 0; + } else { + workerScript.loadedFns.getOwnedAugmentations = true; + var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run getOwnedAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -2319,6 +3064,16 @@ function NetscriptFunctions(workerScript) { return res; }, getAugmentationsFromFaction(facname) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getAugmentationsFromFaction) { + return 0; + } else { + workerScript.loadedFns.getAugmentationsFromFaction = true; + var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run getAugmentationsFromFaction(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -2339,6 +3094,16 @@ function NetscriptFunctions(workerScript) { return res; }, getAugmentationCost(name) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.getAugmentationCost) { + return 0; + } else { + workerScript.loadedFns.getAugmentationCost = true; + var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run getAugmentationCost(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -2355,6 +3120,16 @@ function NetscriptFunctions(workerScript) { return [aug.baseRepRequirement, aug.baseCost]; }, purchaseAugmentation(faction, name) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.purchaseAugmentation) { + return 0; + } else { + workerScript.loadedFns.purchaseAugmentation = true; + var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run purchaseAugmentation(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); @@ -2414,6 +3189,16 @@ function NetscriptFunctions(workerScript) { } }, installAugmentations(cbScript) { + if (workerScript.checkingRam) { + if (workerScript.loadedFns.installAugmentations) { + return 0; + } else { + workerScript.loadedFns.installAugmentations = true; + var ramCost = CONSTANTS.ScriptSingularityFn3RamCost; + if (Player.bitNodeN !== 4) {ramCost *= 10;} + return ramCost; + } + } if (Player.bitNodeN != 4) { if (!(hasSingularitySF && singularitySFLvl >= 3)) { throw makeRuntimeRejectMsg(workerScript, "Cannot run installAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); diff --git a/src/NetscriptWorker.js b/src/NetscriptWorker.js index 963b28ca0..464259de3 100644 --- a/src/NetscriptWorker.js +++ b/src/NetscriptWorker.js @@ -25,9 +25,10 @@ function WorkerScript(runningScriptObj) { this.scriptRef = runningScriptObj; this.errorMessage = ""; this.args = runningScriptObj.args; - //this.killTrigger = function() {}; //CB func used to clear any delays (netscriptDelay()) this.delay = null; this.fnWorker = null; //Workerscript for a function call + this.checkingRam = false; + this.loadedFns = {}; //Stores names of fns that are "loaded" by this script, thus using RAM } //Returns the server on which the workerScript is running @@ -65,7 +66,6 @@ function runScriptsLoop() { //items fucks up the indexing for (var i = workerScripts.length - 1; i >= 0; i--) { if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == true) { - console.log("Deleting script: " + workerScripts[i].name); //Delete script from the runningScripts array on its host serverIp var ip = workerScripts[i].serverIp; var name = workerScripts[i].name; @@ -95,7 +95,7 @@ function runScriptsLoop() { if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == false) { try { var ast = parse(workerScripts[i].code); - //console.log(ast); + console.log(ast); } catch (e) { console.log("Error parsing script: " + workerScripts[i].name); dialogBoxCreate("Syntax ERROR in " + workerScripts[i].name + ":
" + e); @@ -113,7 +113,6 @@ function runScriptsLoop() { w.env.stopFlag = true; w.scriptRef.log("Script finished running"); }).catch(function(w) { - console.log(w); if (w instanceof Error) { dialogBoxCreate("Script runtime unknown error. This is a bug please contact game developer"); console.log("ERROR: Evaluating workerscript returns an Error. THIS SHOULDN'T HAPPEN: " + w.toString()); diff --git a/src/Script.js b/src/Script.js index 59575bc1d..d7a676fda 100644 --- a/src/Script.js +++ b/src/Script.js @@ -18,16 +18,18 @@ import {Engine} from "./engine.js"; import {iTutorialSteps, iTutorialNextStep, iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial.js"; import {NetscriptFunctions} from "./NetscriptFunctions.js"; -import {addWorkerScript, killWorkerScript} from "./NetscriptWorker.js"; +import {addWorkerScript, killWorkerScript, + WorkerScript} from "./NetscriptWorker.js"; import {Player} from "./Player.js"; import {AllServers, processSingleServerGrowth} from "./Server.js"; import {Settings} from "./Settings.js"; import {post} from "./Terminal.js"; +import {parse, Node} from "../utils/acorn.js"; import {dialogBoxCreate} from "../utils/DialogBox.js"; import {Reviver, Generic_toJSON, Generic_fromJSON} from "../utils/JSONReviver.js"; -import {compareArrays} from "../utils/HelperFunctions.js"; +import {compareArrays, createElement} from "../utils/HelperFunctions.js"; import {formatNumber, numOccurrences, numNetscriptOperators} from "../utils/StringHelperFunctions.js"; @@ -37,15 +39,53 @@ var keybindings = { emacs: "ace/keyboard/emacs", }; +var scriptEditorRamCheck = null, scriptEditorRamText = null; function scriptEditorInit() { - //Initialize save and close button - var closeButton = document.getElementById("script-editor-save-and-close-button"); - - closeButton.addEventListener("click", function() { - saveAndCloseScriptEditor(); - return false; + //Create buttons at the bottom of script editor + var wrapper = document.getElementById("script-editor-buttons-wrapper"); + if (wrapper == null) { + console.log("Error finding 'script-editor-buttons-wrapper'"); + return; + } + var closeButton = createElement("a", { + class:"a-link-button", display:"inline-block", + innerText:"Save & Close (Ctrl + b)", + clickListener:()=>{ + saveAndCloseScriptEditor(); + return false; + } }); + scriptEditorRamText = createElement("p", { + display:"inline-block", margin:"10px", id:"script-editor-status-text" + }); + + var checkboxLabel = createElement("label", { + for:"script-editor-ram-check", margin:"4px", marginTop: "8px", + innerText:"Dynamic RAM Usage Checker", color:"white", + tooltip:"Enable/Disable the dynamic RAM Usage display. You may " + + "want to disable it for very long scripts because there may be " + + "performance issues" + }); + + scriptEditorRamCheck = createElement("input", { + type:"checkbox", name:"script-editor-ram-check", id:"script-editor-ram-check", + margin:"4px", marginTop: "8px", + }); + scriptEditorRamCheck.checked = true; + + var documentationButton = createElement("a", { + display:"inline-block", class:"a-link-button", innerText:"Netscript Documentation", + href:"https://bitburner.wikia.com/wiki/Netscript", + target:"_blank" + }); + + wrapper.appendChild(closeButton); + wrapper.appendChild(scriptEditorRamText); + wrapper.appendChild(scriptEditorRamCheck); + wrapper.appendChild(checkboxLabel); + wrapper.appendChild(documentationButton); + //Initialize ACE Script editor var editor = ace.edit('javascript-editor'); editor.getSession().setMode('ace/mode/netscript'); @@ -127,14 +167,19 @@ function scriptEditorInit() { } document.addEventListener("DOMContentLoaded", scriptEditorInit, false); -//Updates line number and RAM usage in script +//Updates RAM usage in script function updateScriptEditorContent() { + if (scriptEditorRamCheck == null || !scriptEditorRamCheck.checked) { + scriptEditorRamText.innerText = "N/A"; + return; + } var editor = ace.edit('javascript-editor'); var code = editor.getValue(); var codeCopy = code.repeat(1); var ramUsage = calculateRamUsage(codeCopy); - document.getElementById("script-editor-status-text").innerText = - "RAM: " + formatNumber(ramUsage, 2).toString() + "GB"; + if (ramUsage !== -1) { + scriptEditorRamText.innerText = "RAM: " + formatNumber(ramUsage, 2).toString() + "GB"; + } } //Define key commands in script editor (ctrl o to save + close, etc.) @@ -233,154 +278,87 @@ Script.prototype.saveScript = function() { //Updates how much RAM the script uses when it is running. Script.prototype.updateRamUsage = function() { var codeCopy = this.code.repeat(1); - this.ramUsage = calculateRamUsage(codeCopy); - console.log("ram usage: " + this.ramUsage); - if (isNaN(this.ramUsage)) { - dialogBoxCreate("ERROR in calculating ram usage. This is a bug, please report to game develoepr"); + var res = calculateRamUsage(codeCopy); + if (res !== -1) { + this.ramUsage = res; } } function calculateRamUsage(codeCopy) { - codeCopy = codeCopy.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1'); //Delete comments - codeCopy = codeCopy.replace(/\s/g,''); //Remove all whitespace - var baseRam = 1.4; - var whileCount = numOccurrences(codeCopy, "while("); - var forCount = numOccurrences(codeCopy, "for("); - var ifCount = numOccurrences(codeCopy, "if("); - var hackCount = numOccurrences(codeCopy, "hack("); - var growCount = numOccurrences(codeCopy, "grow("); - var weakenCount = numOccurrences(codeCopy, "weaken("); - var scanCount = numOccurrences(codeCopy, "scan("); - var nukeCount = numOccurrences(codeCopy, "nuke("); - var brutesshCount = numOccurrences(codeCopy, "brutessh("); - var ftpcrackCount = numOccurrences(codeCopy, "ftpcrack("); - var relaysmtpCount = numOccurrences(codeCopy, "relaysmtp("); - var httpwormCount = numOccurrences(codeCopy, "httpworm("); - var sqlinjectCount = numOccurrences(codeCopy, "sqlinject("); - var runCount = numOccurrences(codeCopy, "run("); - var execCount = numOccurrences(codeCopy, "exec("); - var killCount = numOccurrences(codeCopy, "kill(") + numOccurrences(codeCopy, "killall(") + - numOccurrences(codeCopy, "exit("); - var scpCount = numOccurrences(codeCopy, "scp("); - var hasRootAccessCount = numOccurrences(codeCopy, "hasRootAccess("); - var getHostnameCount = numOccurrences(codeCopy, "getHostname(") + - numOccurrences(codeCopy, "getIp("); - var getHackingLevelCount = numOccurrences(codeCopy, "getHackingLevel("); - var getMultipliersCount = numOccurrences(codeCopy, "getHackingMultipliers(") + - numOccurrences(codeCopy, "getBitNodeMultipliers("); - var getServerCount = numOccurrences(codeCopy, "getServerMoneyAvailable(") + - numOccurrences(codeCopy, "getServerMaxMoney(") + - numOccurrences(codeCopy, "getServerSecurityLevel(") + - numOccurrences(codeCopy, "getServerBaseSecurityLevel(") + - numOccurrences(codeCopy, "getServerMinSecurityLevel(") + - numOccurrences(codeCopy, "getServerGrowth(") + - numOccurrences(codeCopy, "getServerRequiredHackingLevel(") + - numOccurrences(codeCopy, "getServerNumPortsRequired(") + - numOccurrences(codeCopy, "getServerRam(") + - numOccurrences(codeCopy, "serverExists("); - var fileExistsCount = numOccurrences(codeCopy, "fileExists("); - var isRunningCount = numOccurrences(codeCopy, "isRunning("); - var purchaseHacknetCount = numOccurrences(codeCopy, "purchaseHacknetNode("); - var hacknetnodesArrayCount = numOccurrences(codeCopy, "hacknetnodes["); - var hnUpgLevelCount = numOccurrences(codeCopy, ".upgradeLevel("); - var hnUpgRamCount = numOccurrences(codeCopy, ".upgradeRam()"); - var hnUpgCoreCount = numOccurrences(codeCopy, ".upgradeCore()"); - var scriptGetStockCount = numOccurrences(codeCopy, "getStockPrice(") + - numOccurrences(codeCopy, "getStockPosition("); - var scriptBuySellStockCount = numOccurrences(codeCopy, "buyStock(") + - numOccurrences(codeCopy, "sellStock(") + - numOccurrences(codeCopy, "shortStock(") + - numOccurrences(codeCopy, "sellShort(") + - numOccurrences(codeCopy, "placeOrder(") + - numOccurrences(codeCopy, "cancelOrder("); - var scriptPurchaseServerCount = numOccurrences(codeCopy, "purchaseServer(") + - numOccurrences(codeCopy, "deleteServer(") + - numOccurrences(codeCopy, "getPurchasedServers("); - var scriptRoundCount = numOccurrences(codeCopy, "round("); - var scriptWriteCount = numOccurrences(codeCopy, "write(") + numOccurrences(codeCopy, "clear("); - var scriptReadCount = numOccurrences(codeCopy, "read("); - var arbScriptCount = numOccurrences(codeCopy, "scriptRunning(") + - numOccurrences(codeCopy, "scriptKill("); - var getScriptCount = numOccurrences(codeCopy, "getScriptRam(") + - numOccurrences(codeCopy, "getScriptIncome(") + - numOccurrences(codeCopy, "getScriptExpGain("); - var getHackTimeCount = numOccurrences(codeCopy, "getHackTime(") + - numOccurrences(codeCopy, "getGrowTime(") + - numOccurrences(codeCopy, "getWeakenTime(") + - numOccurrences(codeCopy, "getTimeSinceLastAug("); - var singFn1Count = numOccurrences(codeCopy, "universityCourse(") + - numOccurrences(codeCopy, "gymWorkout(") + - numOccurrences(codeCopy, "travelToCity(") + - numOccurrences(codeCopy, "purchaseTor(") + - numOccurrences(codeCopy, "purchaseProgram(") + - numOccurrences(codeCopy, "getStats(") + - numOccurrences(codeCopy, "isBusy("); - var singFn2Count = numOccurrences(codeCopy, "upgradeHomeRam(") + - numOccurrences(codeCopy, "getUpgradeHomeRamCost(") + - numOccurrences(codeCopy, "workForCompany(") + - numOccurrences(codeCopy, "applyToCompany(") + - numOccurrences(codeCopy, "getCompanyRep(") + - numOccurrences(codeCopy, "checkFactionInvitations(") + - numOccurrences(codeCopy, "joinFaction(") + - numOccurrences(codeCopy, "workForFaction(") + - numOccurrences(codeCopy, "getFactionRep("); - var singFn3Count = numOccurrences(codeCopy, "createProgram(") + - numOccurrences(codeCopy, "commitCrime(") + - numOccurrences(codeCopy, "getCrimeChance(") + - numOccurrences(codeCopy, "getOwnedAugmentations(") + - numOccurrences(codeCopy, "getAugmentationsFromFaction(") + - numOccurrences(codeCopy, "getAugmentationCost(") + - numOccurrences(codeCopy, "purchaseAugmentation(") + - numOccurrences(codeCopy, "installAugmentations("); + //Create a temporary/mock WorkerScript and an AST from the code + var workerScript = new WorkerScript({ + filename:"foo", + scriptRef: {code:""}, + args:[] + }); + workerScript.checkingRam = true; //Netscript functions will return RAM usage - if (Player.bitNodeN != 4) { - singFn1Count *= 10; - singFn2Count *= 10; - singFn3Count *= 10; + try { + var ast = parse(codeCopy); + } catch(e) { + console.log("returning -1 bc parsing error: " + e.toString()); + return -1; } - return baseRam + - ((whileCount * CONSTANTS.ScriptWhileRamCost) + - (forCount * CONSTANTS.ScriptForRamCost) + - (ifCount * CONSTANTS.ScriptIfRamCost) + - (hackCount * CONSTANTS.ScriptHackRamCost) + - (growCount * CONSTANTS.ScriptGrowRamCost) + - (weakenCount * CONSTANTS.ScriptWeakenRamCost) + - (scanCount * CONSTANTS.ScriptScanRamCost) + - (nukeCount * CONSTANTS.ScriptNukeRamCost) + - (brutesshCount * CONSTANTS.ScriptBrutesshRamCost) + - (ftpcrackCount * CONSTANTS.ScriptFtpcrackRamCost) + - (relaysmtpCount * CONSTANTS.ScriptRelaysmtpRamCost) + - (httpwormCount * CONSTANTS.ScriptHttpwormRamCost) + - (sqlinjectCount * CONSTANTS.ScriptSqlinjectRamCost) + - (runCount * CONSTANTS.ScriptRunRamCost) + - (execCount * CONSTANTS.ScriptExecRamCost) + - (killCount * CONSTANTS.ScriptKillRamCost) + - (scpCount * CONSTANTS.ScriptScpRamCost) + - (hasRootAccessCount * CONSTANTS.ScriptHasRootAccessRamCost) + - (getHostnameCount * CONSTANTS.ScriptGetHostnameRamCost) + - (getHackingLevelCount * CONSTANTS.ScriptGetHackingLevelRamCost) + - (getMultipliersCount * CONSTANTS.ScriptGetMultipliersRamCost) + - (getServerCount * CONSTANTS.ScriptGetServerCost) + - (fileExistsCount * CONSTANTS.ScriptFileExistsRamCost) + - (isRunningCount * CONSTANTS.ScriptIsRunningRamCost) + - (purchaseHacknetCount * CONSTANTS.ScriptPurchaseHacknetRamCost) + - (hacknetnodesArrayCount * CONSTANTS.ScriptHacknetNodesRamCost) + - (hnUpgLevelCount * CONSTANTS.ScriptHNUpgLevelRamCost) + - (hnUpgRamCount * CONSTANTS.ScriptHNUpgRamRamCost) + - (hnUpgCoreCount * CONSTANTS.ScriptHNUpgCoreRamCost) + - (scriptGetStockCount * CONSTANTS.ScriptGetStockRamCost) + - (scriptBuySellStockCount * CONSTANTS.ScriptBuySellStockRamCost) + - (scriptPurchaseServerCount * CONSTANTS.ScriptPurchaseServerRamCost) + - (scriptRoundCount * CONSTANTS.ScriptRoundRamCost) + - (scriptWriteCount * CONSTANTS.ScriptReadWriteRamCost) + - (scriptReadCount * CONSTANTS.ScriptReadWriteRamCost) + - (arbScriptCount * CONSTANTS.ScriptArbScriptRamCost) + - (getScriptCount * CONSTANTS.ScriptGetScriptRamCost) + - (getHackTimeCount * CONSTANTS.ScriptGetHackTimeRamCost) + - (singFn1Count * CONSTANTS.ScriptSingularityFn1RamCost) + - (singFn2Count * CONSTANTS.ScriptSingularityFn2RamCost) + - (singFn3Count * CONSTANTS.ScriptSingularityFn3RamCost)); + //Search through AST, scanning for any 'Identifier' nodes for functions, or While/For/If nodes + var queue = [], ramUsage = 1.4; + var whileUsed = false, forUsed = false, ifUsed = false; + queue.push(ast); + while (queue.length != 0) { + var exp = queue.shift(); + switch (exp.type) { + case "BlockStatement": + case "Program": + for (var i = 0; i < exp.body.length; ++i) { + if (exp.body[i] instanceof Node) { + queue.push(exp.body[i]); + } + } + break; + case "WhileStatement": + if (!whileUsed) { + ramUsage += CONSTANTS.ScriptWhileRamCost; + whileUsed = true; + } + break; + case "ForStatement": + if (!forUsed) { + ramUsage += CONSTANTS.ScriptForRamCost; + forUsed = true; + } + break; + case "IfStatement": + if (!ifUsed) { + ramUsage += CONSTANTS.ScriptIfRamCost; + ifUsed = true; + } + break; + case "Identifier": + if (exp.name in workerScript.env.vars) { + var func = workerScript.env.get(exp.name); + if (typeof func === "function") { + try { + var res = func.apply(null, []); + if (!isNaN(res)) {ramUsage += res;} + } catch(e) { + console.log("ERROR applying function: " + e); + } + } + } + break; + default: + break; + } + + for (var prop in exp) { + if (exp.hasOwnProperty(prop)) { + if (exp[prop] instanceof Node) { + queue.push(exp[prop]); + } + } + } + } + return ramUsage; } Script.prototype.toJSON = function() { diff --git a/src/Terminal.js b/src/Terminal.js index 508a4a68e..6d522fc73 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -32,15 +32,14 @@ import {containsAllStrings, longestCommonStart, formatNumber, isString} from "../utils/StringHelperFunctions.js"; import {addOffset, printArray} from "../utils/HelperFunctions.js"; import {logBoxCreate} from "../utils/LogBox.js"; +import {yesNoBoxCreate, + yesNoBoxGetYesButton, + yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox.js"; /* Write text to terminal */ //If replace is true then spaces are replaced with " " -function post(input, replace=true) { - if (replace) { - $("#terminal-input").before('' + input.replace( / /g, " " ) + ''); - } else { - $("#terminal-input").before('' + input + ''); - } +function post(input) { + $("#terminal-input").before('' + input + ''); updateTerminalScroll(); } @@ -744,7 +743,7 @@ let Terminal = { if (SpecialServerIps.hasOwnProperty("Darkweb Server")) { executeDarkwebTerminalCommand(commandArray); } else { - post("You need to be connected to the Dark Web to use the buy command"); + post("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)"); } break; case "cat": @@ -1636,7 +1635,21 @@ let Terminal = { post("Agility: " + Player.agility + " / 1500"); break; case Programs.BitFlume: - hackWorldDaemon(Player.bitNodeN, true); + var yesBtn = yesNoBoxGetYesButton(), + noBtn = yesNoBoxGetNoButton(); + yesBtn.innerHTML = "Travel to BitNode Nexus"; + noBtn.innerHTML = "Cancel"; + yesBtn.addEventListener("click", function() { + hackWorldDaemon(Player.bitNodeN, true); + return yesNoBoxClose(); + }); + noBtn.addEventListener("click", function() { + return yesNoBoxClose(); + }); + yesNoBoxCreate("WARNING: USING THIS PROGRAM WILL CAUSE YOU TO LOSE ALL OF YOUR PROGRESS ON THE CURRENT BITNODE.

" + + "Do you want to travel to the BitNode Nexus? This allows you to reset the current BitNode " + + "and select a new one."); + break; default: post("Invalid executable. Cannot be run"); diff --git a/src/TextFile.js b/src/TextFile.js index 7a0596f39..e8f771979 100644 --- a/src/TextFile.js +++ b/src/TextFile.js @@ -75,4 +75,15 @@ function createTextFile(fn, txt, server) { return file; } +function deleteTextFile(fn, server) { + if (!fn.endsWith(".txt")) {fn += ".txt";} + for (var i = 0; i < server.textFiles.length; ++i) { + if (server.textFiles[i].fn === fn) { + server.textFiles.splice(i, 1); + return true; + } + } + return false; +} + export {TextFile, getTextFile, createTextFile}; diff --git a/src/engine.js b/src/engine.js index 60823c195..e5dcbd71c 100644 --- a/src/engine.js +++ b/src/engine.js @@ -937,7 +937,6 @@ let Engine = { messages: 150, stockTick: 30, //Update stock prices sCr: 1500, - updateScriptEditorDisplay: 5, }, decrementAllCounters: function(numCycles = 1) { @@ -997,6 +996,8 @@ let Engine = { if (Engine.Counters.updateDisplaysLong <= 0) { if (Engine.currentPage === Engine.Page.Gang) { updateGangContent(); + } else if (Engine.currentPage === Engine.Page.ScriptEditor) { + updateScriptEditorContent(); } Engine.Counters.updateDisplaysLong = 15; } @@ -1058,13 +1059,6 @@ let Engine = { } Engine.Counters.sCr = 1500; } - - if (Engine.Counters.updateScriptEditorDisplay <= 0) { - if (Engine.currentPage == Engine.Page.ScriptEditor) { - updateScriptEditorContent(); - } - Engine.Counters.updateScriptEditorDisplay = 5; - } }, /* Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly */ diff --git a/utils/HelperFunctions.js b/utils/HelperFunctions.js index 4f3328ac8..c30adc8bb 100644 --- a/utils/HelperFunctions.js +++ b/utils/HelperFunctions.js @@ -71,6 +71,7 @@ function createElement(type, params) { if (params.visibility) {el.style.visibility = params.visibility;} if (params.margin) {el.style.margin = params.margin;} if (params.marginLeft) {el.style.marginLeft = params.marginLeft;} + if (params.marginTop) {el.style.marginTop = params.marginTop;} if (params.padding) {el.style.padding = params.padding;} if (params.color) {el.style.color = params.color;} if (params.border) {el.style.border = params.border;} @@ -94,6 +95,8 @@ function createElement(type, params) { innerHTML:params.tooltip })); } + if (params.href) {el.href = params.href;} + if (params.target) {el.target = params.target;} if (params.clickListener) { el.addEventListener("click", params.clickListener); }