" +
@@ -2038,21 +2039,17 @@ PlayerObject.prototype.reapplyAllAugmentations = function(resetMultipliers=true)
for (let i = 0; i < this.augmentations.length; ++i) {
//Compatibility with new version
- if (typeof this.augmentations[i] === 'string' || this.augmentations[i] instanceof String) {
- var newOwnedAug = new __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["d" /* PlayerOwnedAugmentation */](this.augmentations[i]);
- if (this.augmentations[i] == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
- newOwnedAug.level = __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor].level;
- }
- this.augmentations[i] = newOwnedAug;
+ if (this.augmentations[i].name === "HacknetNode NIC Architecture Neural-Upload") {
+ this.augmentations[i].name = "Hacknet Node NIC Architecture Neural-Upload";
}
var augName = this.augmentations[i].name;
var aug = __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][augName];
- aug.owned = true;
if (aug == null) {
console.log("WARNING: Invalid augmentation name");
continue;
}
+ aug.owned = true;
if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
for (let j = 0; j < aug.level; ++j) {
Object(__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["e" /* applyAugmentation */])(this.augmentations[i], true);
@@ -2473,7 +2470,7 @@ $(document).on('click', '.dialog-box-close-button', function( event ) {
var dialogBoxOpened = false;
-function dialogBoxCreate(txt) {
+function dialogBoxCreate(txt, preformatted=false) {
var container = document.createElement("div");
container.setAttribute("class", "dialog-box-container");
@@ -2484,8 +2481,16 @@ function dialogBoxCreate(txt) {
closeButton.setAttribute("class", "dialog-box-close-button");
closeButton.innerHTML = "×"
- var textE = document.createElement("p");
- textE.innerHTML = txt.replace(/(?:\r\n|\r|\n)/g, ' ');
+ var textE;
+ if (preformatted) {
+ // For text files as they are often computed data that
+ // shouldn't be wrapped and should retain tabstops.
+ textE = document.createElement("pre");
+ textE.innerHTML = txt;
+ } else {
+ textE = document.createElement("p");
+ textE.innerHTML = txt.replace(/(?:\r\n|\r|\n)/g, ' ');
+ }
content.appendChild(closeButton);
content.appendChild(textE);
@@ -2583,7 +2588,7 @@ function removeElement(elem) {
}
function removeChildrenFromElement(el) {
- if (Object(__WEBPACK_IMPORTED_MODULE_0__StringHelperFunctions_js__["f" /* isString */])(el)) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_0__StringHelperFunctions_js__["g" /* isString */])(el)) {
el = document.getElementById(el);
}
if (el == null) {return;}
@@ -2629,6 +2634,12 @@ function createElement(type, params) {
class:"tooltiptext",
innerHTML:params.tooltip
}));
+ } else if (params.tooltipleft) {
+ el.className += " tooltip";
+ el.appendChild(createElement("span", {
+ class:"tooltiptextleft",
+ innerHTML:params.tooltipleft
+ }));
}
if (params.href) {el.href = params.href;}
if (params.target) {el.target = params.target;}
@@ -2739,7 +2750,7 @@ function powerOfTwo(n) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CONSTANTS; });
let CONSTANTS = {
- Version: "0.34.4",
+ Version: "0.34.5",
//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
@@ -3120,9 +3131,9 @@ let CONSTANTS = {
"the execution of a script is when it saves/loads.
",
TutorialNetscriptText: "Netscript is a programming language implemented for this game. The language has " +
"your basic programming constructs and several built-in commands that are used to hack.
" +
+ "Check out Bitburner's official Netscript documentation" +
+ ". This official documentation will contain more details and " +
"code examples than this documentation page. Also, it can be opened up in another tab/window for convenience!
" +
"
Variables and data types
" +
"The following data types are supported by Netscript: " +
@@ -3180,13 +3191,10 @@ let CONSTANTS = {
"either the IP or hostname of the server you want to hack. The runtime for this command depends on your hacking level and the target server's security level. " +
" A script can hack a server from anywhere. It does not need to be running on the same server to hack that server. " +
"For example, you can create a script that hacks the 'foodnstuff' server and run that script on any server in the game. A successful hack() on " +
- "a server will raise that server's security level by 0.002. Returns true if the hack is successful and " +
- "false otherwise. " +
+ "a server will raise that server's security level by 0.002. Returns the amount of money stolen if the hack is successful and " +
+ "0 if the hack fails. " +
"Examples: hack('foodnstuff'); or hack('148.192.0.12');
" +
- "sleep(n, log=true) Suspends the script for n milliseconds. The second argument is an optional boolean that indicates " +
- "whether or not the function should log the sleep action. If this argument is true, then calling this function will write " +
- "'Sleeping for N milliseconds' to the script's logs. If it's false, then this function will not log anything. " +
- "If this argument is not specified then it will be true by default. Example: sleep(5000);
" +
+ "sleep(n) Suspends the script for n milliseconds. Example: sleep(5000);
" +
"grow(hostname/ip) Use your hacking skills to increase the amount of money available on a server. The argument passed in " +
"must be a string with either the IP or hostname of the target server. The runtime for this command depends on your hacking level and the target server's security level. " +
"When grow() completes, the money available on a target server will be increased by a certain, fixed percentage. This percentage " +
@@ -3206,6 +3214,13 @@ let CONSTANTS = {
"print(x) Prints a value or a variable to the scripts logs (which can be viewed with the 'tail [script]' terminal command ).
" +
"tprint(x) Prints a value or a variable to the Terminal
" +
"clearLog() Clears the script's logs.
" +
+ "disableLog(fn) Disables logging for the given function. Logging can be disabled for every function " +
+ "by passing 'ALL' as an argument.
" +
+ "Note that this does not completely remove all logging functionality. This only stops a function from logging " +
+ "when the function is successful. If the function fails, it will still log the reason for failure.
" +
+ "Notable functions that cannot have their logs disabled: run, exec, exit
" +
+ "enableLog(fn) Re-enables logging for the given function. If 'ALL' is passed into this function " +
+ "as an argument, then it will revert the effects of disableLog('ALL')
" +
"scan(hostname/ip, [hostnames=true]) Returns an array containing the hostnames or IPs of all servers that are one node away from the specified server. " +
"The argument must be a string containing the IP or hostname of the target server. The second argument is a boolean that specifies whether " +
"the hostnames or IPs of the scanned servers should be output. If it is true then hostnames will be returned, and if false then IP addresses will. " +
@@ -3266,8 +3281,8 @@ let CONSTANTS = {
"kill('foo.script', getHostname());
" +
"If you are trying to kill a script named 'foo.script' on the current server that was ran with the arguments 1 and 'foodnstuff', use this:
" +
- "killall(hostname/ip) Kills all running scripts on the specified server. This function takes a single argument which " +
- "must be a string containing the hostname or IP of the target server. This function will always return true.
" +
+ "killall(hostname/ip) Kills all running scripts on the specified server. This function takes a single argument which " +
+ "must be a string containing the hostname or IP of the target server. This function returns true if any scripts were killed, and false otherwise.
" +
"exit() Terminates the script immediately
" +
"scp(script, [source], destination) Copies a script or literature (.lit) file to another server. The first argument is a string with " +
"the filename of the script or literature file " +
@@ -3391,7 +3406,6 @@ let CONSTANTS = {
"getPurchasedServers([hostname=true]) Returns an array with either the hostname or IPs of all of the servers you " +
"have purchased. It takes an optional parameter specifying whether the hostname or IP addresses will be returned. If this " +
"parameter is not specified, it is true by default and hostnames will be returned
" +
- "round(n) Rounds the number n to the nearest integer. If the argument passed in is not a number, then the function will return 0.
" +
"write(port/fn, data='', mode='a') This function can be used to either write data to a port or to a text file (.txt).
" +
"If the first argument is a number between 1 and 10, then it specifies a port and this function will write data to a port. If the second " +
"argument is not specified then it will write an empty string to the port. The third argument, mode, is not used when writing data to a port.
" +
@@ -3407,6 +3421,9 @@ let CONSTANTS = {
"then the string 'NULL PORT DATA' will be returned.
" +
"If the first argument is a string, then it specifies the name of a text file and this function will return the data in the " +
"specified text file. If the text file does not exist, an empty string will be returned
" +
+ "peek(port) This function is used to peek data from a port. It returns the first element from the specified " +
+ "Netscript Port without removing that element. If the port is empty, then the string 'NULL PORT DATA' will be returned.
" +
+ "The argument must be an integer between 1 and 10.
" +
"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.
" +
@@ -3869,20 +3886,38 @@ let CONSTANTS = {
"World Stock Exchange account and TIX API Access ",
LatestUpdate:
- "v0.34.4 " +
- "-Added several new features to Gang UI to make it easier to manage your Gang. " +
- "-Changed the Gang Member upgrade mechanic. Now, rather than only being able to have " +
- "one weapon/armor/vehicle/etc., you can purchase all the upgrades for each Gang member " +
- "and their multipliers will stack. To balance this out, the effects (AKA multipliers) of each Gang member upgrade " +
- "were reduced. " +
- "-Added a new script editor option: Max Error Count. This affects how many approximate lines the script editor will " +
- "process (JSHint) for common errors. Increase this option can affect performance " +
- "-Game theme colors (set using 'theme' Terminal command) are now saved when re-opening the game " +
- "-'download' Terminal command now works on scripts " +
- "-Added stopAction() Singularity function and the spawn() Netscript function " +
- "-The 'Purchase Augmentations' UI screen will now tell you if you need a certain prerequisite for Augmentations. " +
- "-Augmentations with prerequisites can now be purchased as long as their prerequisites are puchased (" +
- "before, you had to actually install the prerequisites before being able to purchase) "
+ "v0.34.5 " +
+ "-Corporation Management Changes: " +
+ "---Market Research unlocks are now cheaper " +
+ "---New 'VeChain' upgrade: displays useful statistics about Corporation " +
+ "---Corporation cycles are processed 25% faster " +
+ "---Corporation valuation was lowered by ~10% (this affects stock price and investments) " +
+ "---Rebalanced the effects of advertising. Should now be more effective for every Industry " +
+ "---Fixed several bugs/exploits involving selling and buying back stock shares " +
+ "---You will now receive a Corporation Handbook (.lit file) when starting out BitNode-3. It contains a brief guide to help you get started. " +
+ "This same handbook can be viewed from the Corporation management screen " +
+ "---Slightly decreased the amount by which a Product's sell price can be marked up " +
+ "---Employees can now be assigned to a 'Training' task, during which they will slowly increase several of their stats " +
+ "-Hopefully fixed an exploit with Array.forEach(). If there are any issues with using forEach, let me know " +
+ "-Arguments passed into a script are now passed by value. This means modifying the 'args' array in a script " +
+ "should no longer cause issues " +
+ "-Scripts executed programatically (via run(), exec(), etc.) will now fail if null/undefined is passed in " +
+ "as an argument " +
+ "-Added peek() Netscript function " +
+ "-killall() Netscript function now returns true if any scripts were killed, and false otherwise. " +
+ "-hack() Netscript function now returns the amount of money gained for successful hacks, and 0 for failed hacks " +
+ "-scp Terminal command and Netscript function now work for txt files " +
+ "-Changes courtesy of Wraithan: " +
+ "---Text files are now displayed using 'pre' rather than 'p' elements when using the 'cat' Terminal command. " +
+ "This means tabs are retained and lines don't automatically wrap " +
+ "---ls() Netscript function now returns text files as well " +
+ "-Removed round() Netscript function, since you can just use Math.round() instead " +
+ "-Added disableLog() and enableLog() Netscript functions " +
+ "-Removed the 'log' argument from sleep(), since you can now use the new disableLog function " +
+ "-'Netscript Documentation' button on script editor now points to new readthedocs documentation rather than wiki " +
+ "-When working for a faction, your current faction reputation is now displayed " +
+ "-Bug Fix: Hacking Missions should no longer break when dragging an existing connection to another Node " +
+ "-Bug Fix: Fixed RAM usage of getNextHacknetNodeCost() (is not 1.5GB instead of 4GB) "
}
@@ -3895,14 +3930,15 @@ let CONSTANTS = {
"use strict";
/* unused harmony export getIndicesOf */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return convertTimeMsToTimeElapsedString; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return longestCommonStart; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isString; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isPositiveNumber; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return longestCommonStart; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isString; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", 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; });
/* unused harmony export numOccurrences */
/* unused harmony export numNetscriptOperators */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isHTML; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isHTML; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return generateRandomString; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__DialogBox_js__ = __webpack_require__(1);
@@ -4045,6 +4081,17 @@ function isHTML(str) {
return false;
}
+//Generates a random alphanumeric string with N characters
+function generateRandomString(n) {
+ var str = "",
+ chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+ for (var i = 0; i < n; i++)
+ str += chars.charAt(Math.floor(Math.random() * chars.length));
+
+ return str;
+}
+
@@ -4068,7 +4115,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Company_js__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__CompanyManagement_js__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__CreateProgram_js__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Faction_js__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Location_js__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Gang_js__ = __webpack_require__(41);
@@ -4085,7 +4132,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__SaveObject_js__ = __webpack_require__(76);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__Script_js__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__Settings_js__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__SourceFile_js__ = __webpack_require__(36);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__SpecialServerIps_js__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__StockMarket_js__ = __webpack_require__(29);
@@ -5879,7 +5926,7 @@ window.onload = function() {
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return prestigeHomeComputer; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Script_js__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__ = __webpack_require__(14);
@@ -6576,7 +6623,7 @@ function processSingleServerGrowth(server, numCycles) {
}
function prestigeHomeComputer(homeComp) {
- homeComp.programs.length = 0;
+ homeComp.programs.length = 0; //Remove programs
homeComp.runningScripts = [];
homeComp.serversOnNetwork = [];
homeComp.isConnectedTo = true;
@@ -6588,7 +6635,7 @@ function prestigeHomeComputer(homeComp) {
script.updateRamUsage();
});
- homeComp.messages.length = 0;
+ homeComp.messages.length = 0; //Remove .lit and .msg files
homeComp.messages.push("hackers-starting-handbook.lit");
}
@@ -17341,7 +17388,7 @@ return jQuery;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(38);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(37);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__ = __webpack_require__(39);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__ = __webpack_require__(1);
@@ -17364,16 +17411,17 @@ function WorkerScript(runningScriptObj) {
this.serverIp = null;
this.code = runningScriptObj.scriptRef.code;
this.env = new __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__["a" /* Environment */](this);
- this.env.set("args", runningScriptObj.args);
+ this.env.set("args", runningScriptObj.args.slice());
this.output = "";
this.ramUsage = 0;
this.scriptRef = runningScriptObj;
this.errorMessage = "";
- this.args = runningScriptObj.args;
+ this.args = runningScriptObj.args.slice();
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
+ this.disableLogs = {}; //Stores names of fns that should have logs disabled
}
//Returns the server on which the workerScript is running
@@ -17593,7 +17641,7 @@ function updateOnlineScriptTimes(numCycles = 1) {
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Location_js__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Missions_js__ = __webpack_require__(28);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Settings_js__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_FactionInvitationBox_js__ = __webpack_require__(75);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__ = __webpack_require__(2);
@@ -17623,7 +17671,7 @@ function factionInit() {
$('#faction-donate-input').on('input', function() {
if (__WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].Page.Faction) {
var val = document.getElementById("faction-donate-input").value;
- if (Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["e" /* isPositiveNumber */])(val)) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["f" /* isPositiveNumber */])(val)) {
var numMoneyDonate = Number(val);
document.getElementById("faction-donate-rep-gain").innerHTML =
"This donation will result in " + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(numMoneyDonate/1000000 * __WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].faction_rep_mult, 3) + " reputation gain";
@@ -18092,7 +18140,7 @@ function displayFactionContent(factionName) {
newDonateWorkButton.addEventListener("click", function() {
var donateAmountVal = document.getElementById("faction-donate-input").value;
- if (Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["e" /* isPositiveNumber */])(donateAmountVal)) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["f" /* isPositiveNumber */])(donateAmountVal)) {
var numMoneyDonate = Number(donateAmountVal);
if (__WEBPACK_IMPORTED_MODULE_7__Player_js__["a" /* Player */].money.lt(numMoneyDonate)) {
Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You cannot afford to donate this much money!");
@@ -20980,6 +21028,120 @@ function initSpecialServerIps() {
/* 15 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Settings; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return initSettings; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return setSettingsLabels; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return loadSettings; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__engine_js__ = __webpack_require__(5);
+
+
+/* Settings.js */
+let Settings = {
+ CodeInstructionRunTime: 50,
+ MaxLogCapacity: 50,
+ MaxPortCapacity: 50,
+ SuppressMessages: false,
+ SuppressFactionInvites: false,
+ AutosaveInterval: 60,
+ ThemeHighlightColor: "#ffffff",
+ ThemeFontColor: "#66ff33",
+ ThemeBackgroundColor: "#000000",
+}
+
+function loadSettings(saveString) {
+ Settings = JSON.parse(saveString);
+}
+
+function initSettings() {
+ Settings.CodeInstructionRunTime = 50;
+ Settings.MaxLogCapacity = 50;
+ Settings.MaxPortCapacity = 50;
+ Settings.SuppressMessages = false;
+ Settings.SuppressFactionInvites = false;
+ Settings.AutosaveInterval = 60;
+}
+
+function setSettingsLabels() {
+ var nsExecTime = document.getElementById("settingsNSExecTimeRangeValLabel");
+ var nsLogLimit = document.getElementById("settingsNSLogRangeValLabel");
+ var nsPortLimit = document.getElementById("settingsNSPortRangeValLabel");
+ var suppressMsgs = document.getElementById("settingsSuppressMessages");
+ var suppressFactionInv = document.getElementById("settingsSuppressFactionInvites")
+ var autosaveInterval = document.getElementById("settingsAutosaveIntervalValLabel");
+
+ //Initialize values on labels
+ nsExecTime.innerHTML = Settings.CodeInstructionRunTime + "ms";
+ nsLogLimit.innerHTML = Settings.MaxLogCapacity;
+ nsPortLimit.innerHTML = Settings.MaxPortCapacity;
+ suppressMsgs.checked = Settings.SuppressMessages;
+ suppressFactionInv.checked = Settings.SuppressFactionInvites;
+ autosaveInterval.innerHTML = Settings.AutosaveInterval;
+
+ //Set handlers for when input changes
+ var nsExecTimeInput = document.getElementById("settingsNSExecTimeRangeVal");
+ var nsLogRangeInput = document.getElementById("settingsNSLogRangeVal");
+ var nsPortRangeInput = document.getElementById("settingsNSPortRangeVal");
+ var nsAutosaveIntervalInput = document.getElementById("settingsAutosaveIntervalVal");
+ nsExecTimeInput.value = Settings.CodeInstructionRunTime;
+ nsLogRangeInput.value = Settings.MaxLogCapacity;
+ nsPortRangeInput.value = Settings.MaxPortCapacity;
+ nsAutosaveIntervalInput.value = Settings.AutosaveInterval;
+
+ nsExecTimeInput.oninput = function() {
+ nsExecTime.innerHTML = this.value + 'ms';
+ Settings.CodeInstructionRunTime = this.value;
+ };
+
+ nsLogRangeInput.oninput = function() {
+ nsLogLimit.innerHTML = this.value;
+ Settings.MaxLogCapacity = this.value;
+ };
+
+ nsPortRangeInput.oninput = function() {
+ nsPortLimit.innerHTML = this.value;
+ Settings.MaxPortCapacity = this.value;
+ };
+
+ nsAutosaveIntervalInput.oninput = function() {
+ autosaveInterval.innerHTML = this.value;
+ Settings.AutosaveInterval = Number(this.value);
+ if (Number(this.value) === 0) {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = Infinity;
+ } else {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = Number(this.value) * 5;
+ }
+ };
+
+ document.getElementById("settingsSuppressMessages").onclick = function() {
+ Settings.SuppressMessages = this.checked;
+ };
+
+ document.getElementById("settingsSuppressFactionInvites").onclick = function() {
+ Settings.SuppressFactionInvites = this.checked;
+ };
+
+ //Theme
+ if (Settings.ThemeHighlightColor == null || Settings.ThemeFontColor == null || Settings.ThemeBackgroundColor == null) {
+ console.log("ERROR: Cannot find Theme Settings");
+ return;
+ }
+ if (/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeHighlightColor) &&
+ /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeFontColor) &&
+ /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeBackgroundColor)) {
+ document.body.style.setProperty('--my-highlight-color', Settings.ThemeHighlightColor);
+ document.body.style.setProperty('--my-font-color', Settings.ThemeFontColor);
+ document.body.style.setProperty('--my-background-color', Settings.ThemeBackgroundColor);
+ }
+}
+
+
+
+
+/***/ }),
+/* 16 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Programs; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return displayCreateProgramContent; });
@@ -21250,120 +21412,6 @@ function initCreateProgramButtons() {
-/***/ }),
-/* 16 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Settings; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return initSettings; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return setSettingsLabels; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return loadSettings; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__engine_js__ = __webpack_require__(5);
-
-
-/* Settings.js */
-let Settings = {
- CodeInstructionRunTime: 50,
- MaxLogCapacity: 50,
- MaxPortCapacity: 50,
- SuppressMessages: false,
- SuppressFactionInvites: false,
- AutosaveInterval: 60,
- ThemeHighlightColor: "#ffffff",
- ThemeFontColor: "#66ff33",
- ThemeBackgroundColor: "#000000",
-}
-
-function loadSettings(saveString) {
- Settings = JSON.parse(saveString);
-}
-
-function initSettings() {
- Settings.CodeInstructionRunTime = 50;
- Settings.MaxLogCapacity = 50;
- Settings.MaxPortCapacity = 50;
- Settings.SuppressMessages = false;
- Settings.SuppressFactionInvites = false;
- Settings.AutosaveInterval = 60;
-}
-
-function setSettingsLabels() {
- var nsExecTime = document.getElementById("settingsNSExecTimeRangeValLabel");
- var nsLogLimit = document.getElementById("settingsNSLogRangeValLabel");
- var nsPortLimit = document.getElementById("settingsNSPortRangeValLabel");
- var suppressMsgs = document.getElementById("settingsSuppressMessages");
- var suppressFactionInv = document.getElementById("settingsSuppressFactionInvites")
- var autosaveInterval = document.getElementById("settingsAutosaveIntervalValLabel");
-
- //Initialize values on labels
- nsExecTime.innerHTML = Settings.CodeInstructionRunTime + "ms";
- nsLogLimit.innerHTML = Settings.MaxLogCapacity;
- nsPortLimit.innerHTML = Settings.MaxPortCapacity;
- suppressMsgs.checked = Settings.SuppressMessages;
- suppressFactionInv.checked = Settings.SuppressFactionInvites;
- autosaveInterval.innerHTML = Settings.AutosaveInterval;
-
- //Set handlers for when input changes
- var nsExecTimeInput = document.getElementById("settingsNSExecTimeRangeVal");
- var nsLogRangeInput = document.getElementById("settingsNSLogRangeVal");
- var nsPortRangeInput = document.getElementById("settingsNSPortRangeVal");
- var nsAutosaveIntervalInput = document.getElementById("settingsAutosaveIntervalVal");
- nsExecTimeInput.value = Settings.CodeInstructionRunTime;
- nsLogRangeInput.value = Settings.MaxLogCapacity;
- nsPortRangeInput.value = Settings.MaxPortCapacity;
- nsAutosaveIntervalInput.value = Settings.AutosaveInterval;
-
- nsExecTimeInput.oninput = function() {
- nsExecTime.innerHTML = this.value + 'ms';
- Settings.CodeInstructionRunTime = this.value;
- };
-
- nsLogRangeInput.oninput = function() {
- nsLogLimit.innerHTML = this.value;
- Settings.MaxLogCapacity = this.value;
- };
-
- nsPortRangeInput.oninput = function() {
- nsPortLimit.innerHTML = this.value;
- Settings.MaxPortCapacity = this.value;
- };
-
- nsAutosaveIntervalInput.oninput = function() {
- autosaveInterval.innerHTML = this.value;
- Settings.AutosaveInterval = Number(this.value);
- if (Number(this.value) === 0) {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = Infinity;
- } else {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = Number(this.value) * 5;
- }
- };
-
- document.getElementById("settingsSuppressMessages").onclick = function() {
- Settings.SuppressMessages = this.checked;
- };
-
- document.getElementById("settingsSuppressFactionInvites").onclick = function() {
- Settings.SuppressFactionInvites = this.checked;
- };
-
- //Theme
- if (Settings.ThemeHighlightColor == null || Settings.ThemeFontColor == null || Settings.ThemeBackgroundColor == null) {
- console.log("ERROR: Cannot find Theme Settings");
- return;
- }
- if (/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeHighlightColor) &&
- /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeFontColor) &&
- /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeBackgroundColor)) {
- document.body.style.setProperty('--my-highlight-color', Settings.ThemeHighlightColor);
- document.body.style.setProperty('--my-font-color', Settings.ThemeFontColor);
- document.body.style.setProperty('--my-background-color', Settings.ThemeBackgroundColor);
- }
-}
-
-
-
-
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
@@ -21399,7 +21447,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @preserve
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Settings_js__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Terminal_js__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_acorn_js__ = __webpack_require__(39);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9__utils_acorn_js__);
@@ -21481,7 +21529,7 @@ function scriptEditorInit() {
var documentationButton = Object(__WEBPACK_IMPORTED_MODULE_12__utils_HelperFunctions_js__["f" /* createElement */])("a", {
display:"inline-block", class:"a-link-button", innerText:"Netscript Documentation",
- href:"https://bitburner.wikia.com/wiki/Netscript",
+ href:"https://bitburner.readthedocs.io/en/latest/index.html",
target:"_blank"
});
@@ -22077,7 +22125,7 @@ __WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["c" /* Reviver */].construc
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Terminal; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(47);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__ = __webpack_require__(46);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__engine_js__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__HelpText_js__ = __webpack_require__(69);
@@ -22090,7 +22138,7 @@ __WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__["c" /* Reviver */].construc
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__RedPill_js__ = __webpack_require__(34);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Script_js__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Settings_js__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__SpecialServerIps_js__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__TextFile_js__ = __webpack_require__(50);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__ = __webpack_require__(4);
@@ -22325,7 +22373,7 @@ function tabCompletion(command, arg, allPossibilities, index=0) {
document.getElementById("terminal-input-text-box").value = val;
document.getElementById("terminal-input-text-box").focus();
} else {
- var longestStartSubstr = Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["g" /* longestCommonStart */])(allPossibilities);
+ var longestStartSubstr = Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["h" /* longestCommonStart */])(allPossibilities);
//If the longest common starting substring of remaining possibilities is the same
//as whatevers already in terminal, just list all possible options. Otherwise,
//change the input in the terminal to the longest common starting substr
@@ -22412,6 +22460,9 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) {
allPos.push(currServ.messages[i]);
}
}
+ for (var i = 0; i < currServ.textFiles.length; ++i) {
+ allPos.push(currServ.textFiles[i].fn);
+ }
}
if (input.startsWith("connect ") || input.startsWith("telnet ")) {
@@ -22443,7 +22494,7 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) {
allPos.push(currServ.programs[i]);
}
for (var i = 0; i < currServ.messages.length; ++i) {
- if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) && Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["f" /* isString */])(currServ.messages[i]) &&
+ if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) && Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["g" /* isString */])(currServ.messages[i]) &&
currServ.messages[i].endsWith(".lit")) {
allPos.push(currServ.messages[i]);
}
@@ -22923,7 +22974,7 @@ let Terminal = {
}
}
} else if (fn.endsWith(".txt")) {
- var txtFile = Object(__WEBPACK_IMPORTED_MODULE_17__TextFile_js__["b" /* getTextFile */])(fn, s);
+ var txtFile = Object(__WEBPACK_IMPORTED_MODULE_17__TextFile_js__["c" /* getTextFile */])(fn, s);
if (txtFile !== null) {
return txtFile.download();
}
@@ -23128,7 +23179,7 @@ let Terminal = {
} else if (delTarget.endsWith(".lit")) {
for (var i = 0; i < s.messages.length; ++i) {
var f = s.messages[i];
- if (!(f instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) && Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["f" /* isString */])(f) && f === delTarget) {
+ if (!(f instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) && Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["g" /* isString */])(f) && f === delTarget) {
s.messages.splice(i, 1);
return;
}
@@ -23215,16 +23266,17 @@ let Terminal = {
return;
}
var scriptname = args[0];
- if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")){
- post("Error: scp only works for .script and .lit files");
+ if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script") &&
+ !scriptname.endsWith(".txt")){
+ post("Error: scp only works for .script, .txt, and .lit files");
return;
}
- var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(args[1]);
- if (server == null) {
+ var destServer = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(args[1]);
+ if (destServer == null) {
post("Invalid destination. " + args[1] + " not found");
return;
}
- var ip = server.ip;
+ var ip = destServer.ip;
var currServ = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer();
//Scp for lit files
@@ -23233,26 +23285,49 @@ let Terminal = {
for (var i = 0; i < currServ.messages.length; ++i) {
if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) && currServ.messages[i] == scriptname) {
found = true;
+ break;
}
}
- if (!found) {
- post("Error: no such file exists!");
- return;
- }
+ if (!found) {return post("Error: no such file exists!");}
- for (var i = 0; i < server.messages.length; ++i) {
- if (server.messages[i] === scriptname) {
- post(scriptname + " copied over to " + server.hostname);
+ for (var i = 0; i < destServer.messages.length; ++i) {
+ if (destServer.messages[i] === scriptname) {
+ post(scriptname + " copied over to " + destServer.hostname);
return; //Already exists
}
}
- server.messages.push(scriptname);
- post(scriptname + " copied over to " + server.hostname);
+ destServer.messages.push(scriptname);
+ post(scriptname + " copied over to " + destServer.hostname);
return;
}
+ //Scp for txt files
+ if (scriptname.endsWith(".txt")) {
+ var found = false, txtFile;
+ for (var i = 0; i < currServ.textFiles.length; ++i) {
+ if (currServ.textFiles[i].fn === scriptname) {
+ found = true;
+ txtFile = currServ.textFiles[i];
+ break;
+ }
+ }
+ if (!found) {return post("Error: no such file exists!");}
+
+ for (var i = 0; i < destServer.textFiles.length; ++i) {
+ if (destServer.textFiles[i].fn === scriptname) {
+ //Overwrite
+ destServer.textFiles[i].text = txtFile.text;
+ post("WARNING: " + scriptname + " already exists on " + destServer.hostname +
+ "and will be overwriten");
+ return post(scriptname + " copied over to " + destServer.hostname);
+ }
+ }
+ var newFile = new __WEBPACK_IMPORTED_MODULE_17__TextFile_js__["a" /* TextFile */](txtFile.fn, txtFile.text);
+ destServer.textFiles.push(newFile);
+ return post(scriptname + " copied over to " + destServer.hostname);
+ }
//Get the current script
var sourceScript = null;
@@ -23268,13 +23343,13 @@ let Terminal = {
}
//Overwrite script if it exists
- for (var i = 0; i < server.scripts.length; ++i) {
- if (scriptname == server.scripts[i].filename) {
- post("WARNING: " + scriptname + " already exists on " + server.hostname + " and will be overwritten");
- var oldScript = server.scripts[i];
+ for (var i = 0; i < destServer.scripts.length; ++i) {
+ if (scriptname == destServer.scripts[i].filename) {
+ post("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and will be overwritten");
+ var oldScript = destServer.scripts[i];
oldScript.code = sourceScript.code;
oldScript.ramUsage = sourceScript.ramUsage;
- post(scriptname + " overwriten on " + server.hostname);
+ post(scriptname + " overwriten on " + destServer.hostname);
return;
}
}
@@ -23283,9 +23358,9 @@ let Terminal = {
newScript.filename = scriptname;
newScript.code = sourceScript.code;
newScript.ramUsage = sourceScript.ramUsage;
- newScript.server = ip;
- server.scripts.push(newScript);
- post(scriptname + " copied over to " + server.hostname);
+ newScript.destServer = ip;
+ destServer.scripts.push(newScript);
+ post(scriptname + " copied over to " + destServer.hostname);
break;
case "sudov":
if (commandArray.length != 1) {
@@ -24062,7 +24137,7 @@ let AugmentationNames = {
ADRPheromone2: "ADR-V2 Pheromone Gene",
HacknetNodeCPUUpload: "Hacknet Node CPU Architecture Neural-Upload",
HacknetNodeCacheUpload: "Hacknet Node Cache Architecture Neural-Upload",
- HacknetNodeNICUpload: "HacknetNode NIC Architecture Neural-Upload",
+ HacknetNodeNICUpload: "Hacknet Node NIC Architecture Neural-Upload",
HacknetNodeKernelDNI: "Hacknet Node Kernel Direct-Neural Interface",
HacknetNodeCoreDNI: "Hacknet Node Core Direct-Neural Interface",
NeuroFluxGovernor: "NeuroFlux Governor",
@@ -25987,7 +26062,7 @@ function installAugmentations(cbScript=null) {
Object(__WEBPACK_IMPORTED_MODULE_5__Prestige_js__["a" /* prestigeAugmentation */])();
//Run a script after prestiging
- if (cbScript && Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["f" /* isString */])(cbScript)) {
+ if (cbScript && Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["g" /* isString */])(cbScript)) {
var home = __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].getHomeComputer();
for (var i = 0; i < home.scripts.length; ++i) {
if (home.scripts[i].filename === cbScript) {
@@ -27209,7 +27284,7 @@ function getJobRequirementText(company, pos, tooltiptext=false) {
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Crimes_js__ = __webpack_require__(32);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Company_js__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__ = __webpack_require__(46);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__engine_js__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Faction_js__ = __webpack_require__(11);
@@ -27220,7 +27295,7 @@ function getJobRequirementText(company, pos, tooltiptext=false) {
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Script_js__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__Settings_js__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__SpecialServerIps_js__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__Terminal_js__ = __webpack_require__(19);
@@ -27336,7 +27411,9 @@ function NetscriptFunctions(workerScript) {
}
out.push(entry);
}
- workerScript.scriptRef.log('scan() returned ' + server.serversOnNetwork.length + ' connections for ' + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scan == null) {
+ workerScript.scriptRef.log('scan() returned ' + server.serversOnNetwork.length + ' connections for ' + server.hostname);
+ }
return out;
},
hack : function(ip){
@@ -27373,8 +27450,9 @@ function NetscriptFunctions(workerScript) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot hack this server (" + server.hostname + ") because user's hacking skill is not high enough");
}
- workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds (t=" + threads + ")");
- //console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds (t=" + threads + ")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {
+ workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds (t=" + threads + ")");
+ }
return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["e" /* netscriptDelay */])(hackingTime* 1000, workerScript).then(function() {
if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
var hackChance = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["i" /* scriptCalculateHackingChance */])(server);
@@ -27400,26 +27478,28 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainHackingExp(expGainedOnSuccess);
workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
- //console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
- workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(moneyGained, 2) + " and " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnSuccess, 4) + " exp (t=" + threads + ")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {
+ workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(moneyGained, 2) + " and " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnSuccess, 4) + " exp (t=" + threads + ")");
+ }
server.fortify(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ServerFortifyAmount * threads);
- return Promise.resolve(true);
+ return Promise.resolve(moneyGained);
} else {
- //Player only gains 25% exp for failure? TODO Can change this later to balance
+ //Player only gains 25% exp for failure?
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainHackingExp(expGainedOnFailure);
workerScript.scriptRef.onlineExpGained += expGainedOnFailure;
- //console.log("Script unsuccessful to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp");
- workerScript.scriptRef.log("Script FAILED to hack " + server.hostname + ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnFailure, 4) + " exp (t=" + threads + ")");
- return Promise.resolve(false);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {
+ workerScript.scriptRef.log("Script FAILED to hack " + server.hostname + ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnFailure, 4) + " exp (t=" + threads + ")");
+ }
+ return Promise.resolve(0);
}
});
},
- sleep : function(time,log=true){
+ sleep : function(time){
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");
}
- if (log) {
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sleep == null) {
workerScript.scriptRef.log("Sleeping for " + time + " milliseconds");
}
return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["e" /* netscriptDelay */])(time, workerScript).then(function() {
@@ -27453,8 +27533,9 @@ function NetscriptFunctions(workerScript) {
}
var growTime = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["h" /* scriptCalculateGrowTime */])(server);
- //console.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds")
- workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growTime/1000, 3) + " seconds (t=" + threads + ")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.grow == null) {
+ workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growTime/1000, 3) + " seconds (t=" + threads + ")");
+ }
return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["e" /* netscriptDelay */])(growTime, workerScript).then(function() {
if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
server.moneyAvailable += (1 * threads); //It can be grown even if it has no money
@@ -27464,9 +27545,11 @@ function NetscriptFunctions(workerScript) {
if (growthPercentage == 1) {
expGain = 0;
}
- workerScript.scriptRef.log("Available money on " + server.hostname + " grown by "
- + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growthPercentage*100 - 100, 6) + "%. Gained " +
- Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads +")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.grow == null) {
+ workerScript.scriptRef.log("Available money on " + server.hostname + " grown by " +
+ Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growthPercentage*100 - 100, 6) + "%. Gained " +
+ Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads +")");
+ }
workerScript.scriptRef.onlineExpGained += expGain;
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainHackingExp(expGain);
return Promise.resolve(growthPercentage);
@@ -27499,15 +27582,19 @@ function NetscriptFunctions(workerScript) {
}
var weakenTime = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["l" /* scriptCalculateWeakenTime */])(server);
- workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " +
- Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(weakenTime/1000, 3) + " seconds (t=" + threads + ")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.weaken == null) {
+ workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " +
+ Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(weakenTime/1000, 3) + " seconds (t=" + threads + ")");
+ }
return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["e" /* netscriptDelay */])(weakenTime, workerScript).then(function() {
if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
server.weaken(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads);
workerScript.scriptRef.recordWeaken(server.ip, threads);
var expGain = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["g" /* scriptCalculateExpGain */])(server) * threads;
- workerScript.scriptRef.log("Server security level on " + server.hostname + " weakened to " + server.hackDifficulty +
- ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads + ")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.weaken == null) {
+ workerScript.scriptRef.log("Server security level on " + server.hostname + " weakened to " + server.hackDifficulty +
+ ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads + ")");
+ }
workerScript.scriptRef.onlineExpGained += expGain;
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainHackingExp(expGain);
return Promise.resolve(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads);
@@ -27526,7 +27613,7 @@ function NetscriptFunctions(workerScript) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "tprint() call has incorrect number of arguments. Takes 1 argument");
}
var x = args.toString();
- if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["d" /* isHTML */])(x)) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["e" /* isHTML */])(x)) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].takeDamage(1);
Object(__WEBPACK_IMPORTED_MODULE_26__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You suddenly feel a sharp shooting pain through your body as an angry voice in your head exclaims:
" +
"DON'T USE TPRINT() TO OUTPUT HTML ELEMENTS TO YOUR TERMINAL!!!!
" +
@@ -27539,6 +27626,16 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {return 0;}
workerScript.scriptRef.clearLog();
},
+ disableLog : function(fn) {
+ if (workerScript.checkingRam) {return 0;}
+ workerScript.disableLogs[fn] = true;
+ workerScript.scriptRef.log("Disabled logging for " + fn);
+ },
+ enableLog : function(fn) {
+ if (workerScript.checkingRam) {return 0;}
+ delete workerScript.disableLogs[fn];
+ workerScript.scriptRef.log("Enabled logging for " + fn);
+ },
nuke : function(ip){
if (workerScript.checkingRam) {
if (workerScript.loadedFns.nuke) {
@@ -27563,10 +27660,14 @@ function NetscriptFunctions(workerScript) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Not enough ports opened to use NUKE.exe virus");
}
if (server.hasAdminRights) {
- workerScript.scriptRef.log("Already have root access to " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.nuke == null) {
+ workerScript.scriptRef.log("Already have root access to " + server.hostname);
+ }
} else {
server.hasAdminRights = true;
- workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.nuke == null) {
+ workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access");
+ }
}
return true;
},
@@ -27592,11 +27693,15 @@ function NetscriptFunctions(workerScript) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the BruteSSH.exe program!");
}
if (!server.sshPortOpen) {
- workerScript.scriptRef.log("Executed BruteSSH.exe on " + server.hostname + " to open SSH port (22)");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.brutessh == null) {
+ workerScript.scriptRef.log("Executed BruteSSH.exe on " + server.hostname + " to open SSH port (22)");
+ }
server.sshPortOpen = true;
++server.openPortCount;
} else {
- workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.brutessh == null) {
+ workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname);
+ }
}
return true;
},
@@ -27621,11 +27726,15 @@ function NetscriptFunctions(workerScript) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the FTPCrack.exe program!");
}
if (!server.ftpPortOpen) {
- workerScript.scriptRef.log("Executed FTPCrack.exe on " + server.hostname + " to open FTP port (21)");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.ftpcrack == null) {
+ workerScript.scriptRef.log("Executed FTPCrack.exe on " + server.hostname + " to open FTP port (21)");
+ }
server.ftpPortOpen = true;
++server.openPortCount;
} else {
- workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.ftpcrack == null) {
+ workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname);
+ }
}
return true;
},
@@ -27650,11 +27759,15 @@ function NetscriptFunctions(workerScript) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the relaySMTP.exe program!");
}
if (!server.smtpPortOpen) {
- workerScript.scriptRef.log("Executed relaySMTP.exe on " + server.hostname + " to open SMTP port (25)");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.relaysmtp == null) {
+ workerScript.scriptRef.log("Executed relaySMTP.exe on " + server.hostname + " to open SMTP port (25)");
+ }
server.smtpPortOpen = true;
++server.openPortCount;
} else {
- workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.relaysmtp == null) {
+ workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname);
+ }
}
return true;
},
@@ -27679,11 +27792,15 @@ function NetscriptFunctions(workerScript) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the HTTPWorm.exe program!");
}
if (!server.httpPortOpen) {
- workerScript.scriptRef.log("Executed HTTPWorm.exe on " + server.hostname + " to open HTTP port (80)");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.httpworm == null) {
+ workerScript.scriptRef.log("Executed HTTPWorm.exe on " + server.hostname + " to open HTTP port (80)");
+ }
server.httpPortOpen = true;
++server.openPortCount;
} else {
- workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.httpworm == null) {
+ workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname);
+ }
}
return true;
},
@@ -27708,11 +27825,15 @@ function NetscriptFunctions(workerScript) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the SQLInject.exe program!");
}
if (!server.sqlPortOpen) {
- workerScript.scriptRef.log("Executed SQLInject.exe on " + server.hostname + " to open SQL port (1433)");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sqlinject == null) {
+ workerScript.scriptRef.log("Executed SQLInject.exe on " + server.hostname + " to open SQL port (1433)");
+ }
server.sqlPortOpen = true;
++server.openPortCount;
} else {
- workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sqlinject == null) {
+ workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname);
+ }
}
return true;
},
@@ -27782,7 +27903,9 @@ function NetscriptFunctions(workerScript) {
setTimeout(()=>{
NetscriptFunctions(workerScript).run.apply(this, arguments);
}, 20000);
- workerScript.scriptRef.log("spawn() will execute " + scriptname + " in 20 seconds");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.spawn == null) {
+ workerScript.scriptRef.log("spawn() will execute " + scriptname + " in 20 seconds");
+ }
NetscriptFunctions(workerScript).exit();
},
kill : function(filename,ip) {
@@ -27814,10 +27937,14 @@ function NetscriptFunctions(workerScript) {
}
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...");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.kill == null) {
+ workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForKillTarget) + ". May take up to a few minutes for the scripts to die...");
+ }
return true;
} else {
- workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForKillTarget));
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.kill == null) {
+ workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForKillTarget));
+ }
return false;
}
},
@@ -27839,11 +27966,14 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("killall() failed. Invalid IP or hostname passed in: " + ip);
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "killall() failed. Invalid IP or hostname passed in: " + ip);
}
+ var scriptsRunning = (server.runningScripts.length > 0);
for (var i = server.runningScripts.length-1; i >= 0; --i) {
Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip);
}
- workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die");
- return true;
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.killall == null) {
+ workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die");
+ }
+ return scriptsRunning;
},
exit : function() {
if (workerScript.checkingRam) {
@@ -27886,8 +28016,9 @@ function NetscriptFunctions(workerScript) {
});
return res;
}
- if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() only works for .script and .lit files");
+ if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script") &&
+ !scriptname.endsWith("txt")) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() does not work with this file type. It only works for .script, .lit, and .txt files");
}
var destServer, currServ;
@@ -27926,6 +28057,7 @@ function NetscriptFunctions(workerScript) {
for (var i = 0; i < currServ.messages.length; ++i) {
if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_12__Message_js__["a" /* Message */]) && currServ.messages[i] == scriptname) {
found = true;
+ break;
}
}
@@ -27936,12 +28068,50 @@ function NetscriptFunctions(workerScript) {
for (var i = 0; i < destServer.messages.length; ++i) {
if (destServer.messages[i] === scriptname) {
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ }
return true; //Already exists
}
}
destServer.messages.push(scriptname);
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ }
+ return true;
+ }
+
+ //Scp for text files
+ if (scriptname.endsWith(".txt")) {
+ var found = false, txtFile;
+ for (var i = 0; i < currServ.textFiles.length; ++i) {
+ if (currServ.textFiles[i].fn === scriptname) {
+ found = true;
+ txtFile = currServ.textFiles[i];
+ break;
+ }
+ }
+
+ if (!found) {
+ workerScript.scriptRef.log(scriptname + " does not exist. scp() failed");
+ return false;
+ }
+
+ for (var i = 0; i < destServer.textFiles.length; ++i) {
+ if (destServer.textFiles[i].fn === scriptname) {
+ //Overwrite
+ destServer.textFiles[i].text = txtFile.text;
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ }
+ return true;
+ }
+ }
+ var newFile = new __WEBPACK_IMPORTED_MODULE_21__TextFile_js__["a" /* TextFile */](txtFile.fn, txtFile.text);
+ destServer.textFiles.push(newFile);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ }
return true;
}
@@ -27961,8 +28131,10 @@ function NetscriptFunctions(workerScript) {
//Overwrite script if it already exists
for (var i = 0; i < destServer.scripts.length; ++i) {
if (scriptname == destServer.scripts[i].filename) {
- workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten.");
- workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten.");
+ workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname);
+ }
var oldScript = destServer.scripts[i];
oldScript.code = sourceScript.code;
oldScript.ramUsage = sourceScript.ramUsage;
@@ -27977,7 +28149,9 @@ function NetscriptFunctions(workerScript) {
newScript.ramUsage = sourceScript.ramUsage;
newScript.server = destServer.ip;
destServer.scripts.push(newScript);
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ }
return true;
},
ls : function(ip, grep) {
@@ -28042,6 +28216,16 @@ function NetscriptFunctions(workerScript) {
}
}
+ for (var i = 0; i < server.textFiles.length; i++) {
+ if (filter) {
+ if (server.textFiles[i].fn.includes(filter)) {
+ allFiles.push(server.textFiles[i].fn);
+ }
+ } else {
+ allFiles.push(server.textFiles[i].fn);
+ }
+ }
+
//Sort the files alphabetically then print each
allFiles.sort();
return allFiles;
@@ -28105,7 +28289,9 @@ function NetscriptFunctions(workerScript) {
}
}
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].updateSkillLevels();
- workerScript.scriptRef.log("getHackingLevel() returned " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getHackingLevel == null) {
+ 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() {
@@ -28154,10 +28340,14 @@ function NetscriptFunctions(workerScript) {
}
if (server.hostname == "home") {
//Return player's money
- workerScript.scriptRef.log("getServerMoneyAvailable('home') returned player's money: $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.toNumber(), 2));
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMoneyAvailable == null) {
+ workerScript.scriptRef.log("getServerMoneyAvailable('home') returned player's money: $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.toNumber(), 2));
+ }
return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.toNumber();
}
- workerScript.scriptRef.log("getServerMoneyAvailable() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyAvailable, 2) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMoneyAvailable == null) {
+ workerScript.scriptRef.log("getServerMoneyAvailable() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyAvailable, 2) + " for " + server.hostname);
+ }
return server.moneyAvailable;
},
getServerSecurityLevel : function(ip){
@@ -28174,7 +28364,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.hackDifficulty, 3) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerSecurityLevel == null) {
+ workerScript.scriptRef.log("getServerSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.hackDifficulty, 3) + " for " + server.hostname);
+ }
return server.hackDifficulty;
},
getServerBaseSecurityLevel : function(ip){
@@ -28191,7 +28383,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.baseDifficulty, 3) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerBaseSecurityLevel == null) {
+ workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.baseDifficulty, 3) + " for " + server.hostname);
+ }
return server.baseDifficulty;
},
getServerMinSecurityLevel : function(ip) {
@@ -28208,7 +28402,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.minDifficulty, 3) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMinSecurityLevel == null) {
+ 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) {
@@ -28225,7 +28421,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.requiredHackingSkill, 0) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerRequiredHackingLevel == null) {
+ workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.requiredHackingSkill, 0) + " for " + server.hostname);
+ }
return server.requiredHackingSkill;
},
getServerMaxMoney : function(ip){
@@ -28242,7 +28440,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerMaxMoney() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyMax, 0) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMaxMoney == null) {
+ workerScript.scriptRef.log("getServerMaxMoney() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyMax, 0) + " for " + server.hostname);
+ }
return server.moneyMax;
},
getServerGrowth : function(ip) {
@@ -28259,7 +28459,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerGrowth() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.serverGrowth, 0) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerGrowth == null) {
+ 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) {
@@ -28276,7 +28478,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerNumPortsRequired() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.numOpenPortsRequired, 0) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerNumPortsRequired == null) {
+ workerScript.scriptRef.log("getServerNumPortsRequired() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.numOpenPortsRequired, 0) + " for " + server.hostname);
+ }
return server.numOpenPortsRequired;
},
getServerRam : function(ip) {
@@ -28293,7 +28497,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerRam() failed. Invalid IP or hostname passed in: " + ip);
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerRam() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerRam() returned [" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.maxRam, 2) + "GB, " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.ramUsed, 2) + "GB]");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerRam == null) {
+ workerScript.scriptRef.log("getServerRam() returned [" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.maxRam, 2) + "GB, " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.ramUsed, 2) + "GB]");
+ }
return [server.maxRam, server.ramUsed];
},
serverExists : function(ip) {
@@ -28340,7 +28546,7 @@ function NetscriptFunctions(workerScript) {
return true;
}
}
- var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["b" /* getTextFile */])(filename, server);
+ var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["c" /* getTextFile */])(filename, server);
if (txtFile != null) {
return true;
}
@@ -28375,7 +28581,7 @@ function NetscriptFunctions(workerScript) {
return 0;
} else {
workerScript.loadedFns.getNextHacknetNodeCost = true;
- return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptHacknetNodesRamCost;
+ return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptPurchaseHacknetRamCost;
}
}
return Object(__WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__["b" /* getCostOfNextHacknetNode */])();
@@ -28467,8 +28673,10 @@ function NetscriptFunctions(workerScript) {
if (__WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].Page.StockMarket) {
Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["p" /* updateStockPlayerPosition */])(stock);
}
- workerScript.scriptRef.log("Bought " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
- Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.buyStock == null) {
+ workerScript.scriptRef.log("Bought " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
+ Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share");
+ }
return stock.price;
},
sellStock : function(symbol, shares) {
@@ -28510,9 +28718,11 @@ function NetscriptFunctions(workerScript) {
if (__WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].Page.StockMarket) {
Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["p" /* updateStockPlayerPosition */])(stock);
}
- workerScript.scriptRef.log("Sold " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
- Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share. Gained " +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gains, 2));
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sellStock == null) {
+ workerScript.scriptRef.log("Sold " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
+ Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share. Gained " +
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gains, 2));
+ }
return stock.price;
},
shortStock(symbol, shares) {
@@ -28705,7 +28915,9 @@ function NetscriptFunctions(workerScript) {
homeComputer.serversOnNetwork.push(newServ.ip);
newServ.serversOnNetwork.push(homeComputer.ip);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(cost);
- workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2));
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseServer == null) {
+ workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2));
+ }
return newServ.hostname;
},
deleteServer : function(hostname) {
@@ -28770,7 +28982,9 @@ function NetscriptFunctions(workerScript) {
for (var i = 0; i < homeComputer.serversOnNetwork.length; ++i) {
if (ip == homeComputer.serversOnNetwork[i]) {
homeComputer.serversOnNetwork.splice(i, 1);
- workerScript.scriptRef.log("Deleted server " + hostnameStr);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.deleteServer == null) {
+ workerScript.scriptRef.log("Deleted server " + hostnameStr);
+ }
return true;
}
}
@@ -28802,10 +29016,6 @@ function NetscriptFunctions(workerScript) {
});
return res;
},
- round : function(n) {
- if (isNaN(n)) {return 0;}
- return Math.round(n);
- },
write : function(port, data="", mode="a") {
if (workerScript.checkingRam) {
if (workerScript.loadedFns.write) {
@@ -28831,15 +29041,15 @@ function NetscriptFunctions(workerScript) {
return true;
}
return false;
- } else if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(port)) { //Write to text file
+ } else if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["g" /* isString */])(port)) { //Write to text file
var fn = port;
var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
if (server == null) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error getting Server for this script in write(). This is a bug please contact game dev");
}
- var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["b" /* getTextFile */])(fn, server);
+ var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["c" /* getTextFile */])(fn, server);
if (txtFile == null) {
- txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["a" /* createTextFile */])(fn, data, server);
+ txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["b" /* createTextFile */])(fn, data, server);
return true;
}
if (mode === "w") {
@@ -28871,18 +29081,18 @@ function NetscriptFunctions(workerScript) {
if (port == null) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERR: Could not find port: " + port + ". This is a bug contact the game developer");
}
- if (port.length == 0) {
+ if (port.length === 0) {
return "NULL PORT DATA";
} else {
return port.shift();
}
- } else if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(port)) { //Read from text file
+ } else if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["g" /* isString */])(port)) { //Read from text file
var fn = port;
var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
if (server == null) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error getting Server for this script in read(). This is a bug please contact game dev");
}
- var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["b" /* getTextFile */])(fn, server);
+ var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["c" /* getTextFile */])(fn, server);
if (txtFile !== null) {
return txtFile.text;
} else {
@@ -28892,6 +29102,30 @@ function NetscriptFunctions(workerScript) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument passed in for read(): " + port);
}
},
+ peek : function(port) {
+ if (workerScript.checkingRam) {
+ if (workerScript.loadedFns.peek) {
+ return 0;
+ } else {
+ workerScript.loadedFns.peek = true;
+ return __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ScriptReadWriteRamCost;
+ }
+ }
+ if (isNaN(port) || port < 1 || port > 10) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERR: peek() called with invalid argument. Must be a port number between 1 and 10");
+ }
+ var portName = "Port" + String(port);
+ var port = __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["a" /* NetscriptPorts */][portName];
+ if (port == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERR: Could not find port: " + port + ". This is a bug contact the game developer");
+ }
+ if (port.length === 0) {
+ return "NULL PORT DATA";
+ } else {
+ var foo = port.slice();
+ return foo[0];
+ }
+ },
clear : function(port) {
if (workerScript.checkingRam) {
if (workerScript.loadedFns.clear) {
@@ -28911,13 +29145,13 @@ function NetscriptFunctions(workerScript) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERR: Could not find port: " + port + ". This is a bug contact the game developer");
}
port.length = 0;
- } else if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(port)) { //Clear text file
+ } else if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["g" /* isString */])(port)) { //Clear text file
var fn = port;
var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
if (server == null) {
throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error getting Server for this script in clear(). This is a bug please contact game dev");
}
- var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["b" /* getTextFile */])(fn, server);
+ var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["c" /* getTextFile */])(fn, server);
if (txtFile != null) {
txtFile.write("");
}
@@ -28964,7 +29198,7 @@ function NetscriptFunctions(workerScript) {
} 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) {
+ if (!(f instanceof __WEBPACK_IMPORTED_MODULE_12__Message_js__["a" /* Message */]) && Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["g" /* isString */])(f) && f === fn) {
s.messages.splice(i, 1);
return true;
}
@@ -29177,7 +29411,7 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("ERROR: confirm() failed because a pop-up dialog box is already open");
return false;
}
- if (!Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(txt)) {txt = String(txt);}
+ if (!Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["g" /* isString */])(txt)) {txt = String(txt);}
var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
yesBtn.innerHTML = "Yes";
noBtn.innerHTML = "No";
@@ -29218,7 +29452,9 @@ function NetscriptFunctions(workerScript) {
}
if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.universityCourse == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
var costMult, expMult;
@@ -29280,7 +29516,9 @@ function NetscriptFunctions(workerScript) {
return false;
}
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startClass(costMult, expMult, task);
- workerScript.scriptRef.log("Started " + task + " at " + universityName);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.universityCourse == null) {
+ workerScript.scriptRef.log("Started " + task + " at " + universityName);
+ }
return true;
},
@@ -29307,7 +29545,9 @@ function NetscriptFunctions(workerScript) {
}
if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.gymWorkout == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
var costMult, expMult;
switch(gymName.toLowerCase()) {
@@ -29382,7 +29622,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("Invalid stat: " + stat + ". gymWorkout() failed");
return false;
}
- workerScript.scriptRef.log("Started training " + stat + " at " + gymName);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.gymWorkout == null) {
+ workerScript.scriptRef.log("Started training " + stat + " at " + gymName);
+ }
return true;
},
@@ -29414,7 +29656,9 @@ function NetscriptFunctions(workerScript) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(200000);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city = cityname;
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("Traveled to " + cityname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.travelToCity == null) {
+ workerScript.scriptRef.log("Traveled to " + cityname);
+ }
return true;
default:
workerScript.scriptRef.log("ERROR: Invalid city name passed into travelToCity().");
@@ -29460,7 +29704,9 @@ function NetscriptFunctions(workerScript) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().serversOnNetwork.push(darkweb.ip);
darkweb.serversOnNetwork.push(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().ip);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("You have purchased a Tor router!");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseTor == null) {
+ workerScript.scriptRef.log("You have purchased a Tor router!");
+ }
return true;
},
purchaseProgram(programName) {
@@ -29492,8 +29738,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].BruteSSHProgram);
- workerScript.scriptRef.log("You have purchased the BruteSSH.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the BruteSSH.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -29504,8 +29751,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].FTPCrackProgram);
- workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -29516,8 +29764,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram);
- workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -29528,8 +29777,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].HTTPWormProgram);
- workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -29540,8 +29790,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].SQLInjectProgram);
- workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -29552,8 +29803,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV1);
- workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -29564,8 +29816,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV2);
- workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -29637,7 +29890,9 @@ function NetscriptFunctions(workerScript) {
}
if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.stopAction == null) {
+ workerScript.scriptRef.log(txt);
+ }
return true;
}
return false;
@@ -29681,7 +29936,9 @@ function NetscriptFunctions(workerScript) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(cost);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.upgradeHomeRam == null) {
+ workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
+ }
return true;
},
getUpgradeHomeRamCost() {
@@ -29742,7 +29999,9 @@ function NetscriptFunctions(workerScript) {
if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForCompany == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition.isPartTimeJob()) {
@@ -29750,7 +30009,9 @@ function NetscriptFunctions(workerScript) {
} else {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startWork();
}
- workerScript.scriptRef.log("Began working at " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyName + " as a " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition.positionName);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForCompany == null) {
+ workerScript.scriptRef.log("Began working at " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyName + " as a " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition.positionName);
+ }
return true;
},
applyToCompany(companyName, field) {
@@ -29823,14 +30084,18 @@ function NetscriptFunctions(workerScript) {
return false;
}
//The Player object's applyForJob function can return string with special error messages
- if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(res)) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["g" /* isString */])(res)) {
workerScript.scriptRef.log(res);
return false;
}
if (res) {
- workerScript.scriptRef.log("You were offered a new job at " + companyName + " as a " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition.positionName);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.applyToCompany == null) {
+ workerScript.scriptRef.log("You were offered a new job at " + companyName + " as a " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition.positionName);
+ }
} else {
- workerScript.scriptRef.log("You failed to get a new job/promotion at " + companyName + " in the " + field + " field.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.applyToCompany == null) {
+ workerScript.scriptRef.log("You failed to get a new job/promotion at " + companyName + " in the " + field + " field.");
+ }
}
return res;
},
@@ -29917,7 +30182,9 @@ function NetscriptFunctions(workerScript) {
var fac = __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][name];
Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["h" /* joinFaction */])(fac);
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("Joined the " + name + " faction.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.joinFaction == null) {
+ workerScript.scriptRef.log("Joined the " + name + " faction.");
+ }
return true;
},
workForFaction(name, type) {
@@ -29955,7 +30222,9 @@ function NetscriptFunctions(workerScript) {
if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForFaction == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
var fac = __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][name];
@@ -30064,7 +30333,9 @@ function NetscriptFunctions(workerScript) {
}
if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.createProgram == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
switch(name.toLowerCase()) {
@@ -30164,7 +30435,9 @@ function NetscriptFunctions(workerScript) {
}
if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.commitCrime == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
//Set Location to slums
@@ -30425,7 +30698,7 @@ function NetscriptFunctions(workerScript) {
var res = Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["k" /* purchaseAugmentation */])(aug, fac, true);
workerScript.scriptRef.log(res);
- if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(res) && res.startsWith("You purchased")) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["g" /* isString */])(res) && res.startsWith("You purchased")) {
__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
return true;
} else {
@@ -35297,12 +35570,12 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v7.2.3 https://github.com/MikeM
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return initMessages; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Message; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(21);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Missions_js__ = __webpack_require__(28);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__RedPill_js__ = __webpack_require__(34);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(7);
@@ -37031,7 +37304,7 @@ HackingMission.prototype.setActionButtonsActive = function(nodeType=null) {
//True for active, false for inactive
HackingMission.prototype.setActionButton = function(i, active=true) {
- if (Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["f" /* isString */])(i)) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["g" /* isString */])(i)) {
switch (i) {
case NodeActions.Attack:
i = 0;
@@ -37331,7 +37604,7 @@ HackingMission.prototype.updateNodeDomElement = function(nodeObj) {
//an argument
HackingMission.prototype.getNodeFromElement = function(el) {
var id;
- if (Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["f" /* isString */])(el)) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["g" /* isString */])(el)) {
id = el;
} else {
id = el.id;
@@ -37657,14 +37930,16 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
var targetNode = null, def, atk;
if (nodeObj.conn) {
- var targetNode;
- if (nodeObj.conn.target) {
+ if (nodeObj.conn.target != null) {
targetNode = this.getNodeFromElement(nodeObj.conn.target);
} else {
targetNode = this.getNodeFromElement(nodeObj.conn.targetId);
}
- if (targetNode.plyrCtrl) {
+ if (targetNode == null) {
+ //Player is in the middle of dragging the connection,
+ //so the target node is null. Do nothing here
+ } else if (targetNode.plyrCtrl) {
def = this.playerDef;
atk = this.enemyAtk;
} else if (targetNode.enmyCtrl) {
@@ -37681,17 +37956,20 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
var enmyHacking = this.difficulty * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionDifficultyToHacking;
switch(nodeObj.action) {
case NodeActions.Attack:
+ if (targetNode == null) {break;}
if (nodeObj.conn == null) {break;}
var dmg = this.calculateAttackDamage(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
targetNode.hp -= (dmg/5 * numCycles);
break;
case NodeActions.Scan:
+ if (targetNode == null) {break;}
if (nodeObj.conn == null) {break;}
var eff = this.calculateScanEffect(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
targetNode.def -= (eff/5 * numCycles);
calcStats = true;
break;
case NodeActions.Weaken:
+ if (targetNode == null) {break;}
if (nodeObj.conn == null) {break;}
var eff = this.calculateWeakenEffect(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
targetNode.atk -= (eff/5 * numCycles);
@@ -38568,9 +38846,11 @@ function shortStock(stock, shares, workerScript=null) {
stock.playerAvgShortPx = newTotal / stock.playerShortShares;
updateStockPlayerPosition(stock);
if (tixApi) {
- workerScript.scriptRef.log("Bought a short position of " + Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at " +
- __WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js___default()(stock.price).format('($0.000a)') + " per share. Paid " +
- __WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].StockMarketCommission).format('($0.000a)') + " in commission fees.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.shortStock == null) {
+ workerScript.scriptRef.log("Bought a short position of " + Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at " +
+ __WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js___default()(stock.price).format('($0.000a)') + " per share. Paid " +
+ __WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].StockMarketCommission).format('($0.000a)') + " in commission fees.");
+ }
} else {
Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Bought a short position of " + Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share. You also paid $" +
@@ -38610,9 +38890,11 @@ function sellShort(stock, shares, workerScript=null) {
}
updateStockPlayerPosition(stock);
if (tixApi) {
- workerScript.scriptRef.log("Sold your short position of " + shares + " shares of " + stock.symbol + " at " +
- __WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js___default()(stock.price).format('($0.000a)') + " per share. After commissions, you gained " +
- "a total of " + __WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js___default()(origCost + profit).format('($0.000a)'));
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sellShort == null) {
+ workerScript.scriptRef.log("Sold your short position of " + shares + " shares of " + stock.symbol + " at " +
+ __WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js___default()(stock.price).format('($0.000a)') + " per share. After commissions, you gained " +
+ "a total of " + __WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js___default()(origCost + profit).format('($0.000a)'));
+ }
} else {
Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Sold your short position of " + Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share. After commissions, you gained " +
@@ -39483,17 +39765,19 @@ function logBoxUpdateText() {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Corporation; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Location_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js__ = __webpack_require__(24);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__utils_decimal_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js__ = __webpack_require__(17);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Literature_js__ = __webpack_require__(48);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Location_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_decimal_js__ = __webpack_require__(24);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__utils_decimal_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js__ = __webpack_require__(17);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__ = __webpack_require__(13);
+
@@ -39528,18 +39812,18 @@ CorporationState.prototype.getState = function() {
}
CorporationState.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("CorporationState", this);
+ return Object(__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["b" /* Generic_toJSON */])("CorporationState", this);
}
CorporationState.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(CorporationState, value.data);
+ return Object(__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(CorporationState, value.data);
}
-__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.CorporationState = CorporationState;
+__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["c" /* Reviver */].constructors.CorporationState = CorporationState;
/* Constants */
var TOTALSHARES = 1e9; //Total number of shares you have at your company
-var CyclesPerMarketCycle = 100;
+var CyclesPerMarketCycle = 75;
var CyclesPerIndustryStateCycle = CyclesPerMarketCycle / companyStates.length;
var SecsPerMarketCycle = CyclesPerMarketCycle / 5;
var Cities = ["Aevum", "Chongqing", "Sector-12", "New Tokyo", "Ishima", "Volhaven"];
@@ -39690,14 +39974,14 @@ Material.prototype.processMarket = function() {
}
Material.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Material", this);
+ return Object(__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Material", this);
}
Material.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Material, value.data);
+ return Object(__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Material, value.data);
}
-__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.Material = Material;
+__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["c" /* Reviver */].constructors.Material = Material;
//Map of material (by name) to their sizes (how much space it takes in warehouse)
let MaterialSizes = {
@@ -39744,12 +40028,12 @@ function Product(params={}) {
//These values are specific to a city
//The data is [qty, prod, sell]
this.data = {
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Aevum]: [0, 0, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Chongqing]: [0, 0, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12]: [0, 0, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].NewTokyo]: [0, 0, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Ishima]: [0, 0, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Volhaven]: [0, 0, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Aevum]: [0, 0, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Chongqing]: [0, 0, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12]: [0, 0, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].NewTokyo]: [0, 0, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Ishima]: [0, 0, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Volhaven]: [0, 0, 0],
}
//Only applies for location-based products like restaurants/hospitals
@@ -39764,21 +40048,21 @@ function Product(params={}) {
//[Whether production/sale is limited, limit amount]
this.prdman = {
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Aevum]: [false, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Chongqing]: [false, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12]: [false, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].NewTokyo]: [false, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Ishima]: [false, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Volhaven]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Aevum]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Chongqing]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].NewTokyo]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Ishima]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Volhaven]: [false, 0],
}
this.sllman = {
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Aevum]: [false, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Chongqing]: [false, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12]: [false, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].NewTokyo]: [false, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Ishima]: [false, 0],
- [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Volhaven]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Aevum]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Chongqing]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].NewTokyo]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Ishima]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Volhaven]: [false, 0],
}
}
@@ -39840,9 +40124,9 @@ Product.prototype.finishProduct = function(employeeProd, industry) {
this.calculateRating(industry);
var advMult = 1 + (Math.pow(this.advCost, 0.1) / 100);
console.log("advMult: " + advMult);
- this.mku = 100 / (advMult * this.qlt * (busRatio + mgmtRatio));
+ this.mku = 100 / (advMult * Math.pow((this.qlt + 0.001), 0.9) * (busRatio + mgmtRatio));
this.dmd = industry.awareness === 0 ? 20 : 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_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, 70);
//Calculate the product's required materials
//For now, just set it to be the same as the requirements to make materials
@@ -39883,14 +40167,14 @@ Product.prototype.calculateRating = function(industry) {
}
Product.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Product", this);
+ return Object(__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Product", this);
}
Product.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Product, value.data);
+ return Object(__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Product, value.data);
}
-__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.Product = Product;
+__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["c" /* Reviver */].constructors.Product = Product;
var Industries = {
Energy: "Energy",
@@ -39928,33 +40212,47 @@ var IndustryStartingCosts = {
var IndustryDescriptions = {
Energy: "Engage in the production and distribution of energy.
MP: $" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.bCost, 2) +
"Market Price: The price you would pay if " +
"you were to buy this material on the market
Quality: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.qlt, 2) +
"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_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* 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", {
- innerText: "Buy (" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.buy, 3) + ")", display:"inline-block", class:"a-link-button",
+ buttonPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ innerText: "Buy (" + Object(__WEBPACK_IMPORTED_MODULE_9__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_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
innerText:"Confirm", class:"a-link-button",
clickListener:()=>{
if (isNaN(input.value)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid amount");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid amount");
} else {
mat.buy = parseFloat(input.value);
if (isNaN(mat.buy)) {mat.buy = 0;}
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(purchasePopupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
innerText:"Cancel", class:"a-link-button",
clickListener:()=>{
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(purchasePopupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(purchasePopupId);
}
});
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(purchasePopupId, [txt, input, confirmBtn, cancelBtn]);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* createPopup */])(purchasePopupId, [txt, input, confirmBtn, cancelBtn]);
input.focus();
}
}));
@@ -41578,27 +41970,27 @@ 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_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("select", {}),
+ citySelector = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("option", {
text:company.divisions[i].name, value:company.divisions[i].name,
changeListener:()=>{
var industryName = industrySelector.options[industrySelector.selectedIndex].value;
for (var foo = 0; foo < company.divisions.length; ++foo) {
if (company.divisions[foo].name == industryName) {
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["c" /* clearSelector */])(citySelector);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["c" /* clearSelector */])(citySelector);
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_6__utils_HelperFunctions_js__["f" /* createElement */])("option", {
value:cityName, text:cityName,
}));
}
@@ -41616,7 +42008,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_6__utils_HelperFunctions_js__["f" /* createElement */])("option", {
value:cityName, text:cityName,
}));
}
@@ -41626,18 +42018,18 @@ 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_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button", display:"inline-block", innerText:"Export",
clickListener:()=>{
var industryName = industrySelector.options[industrySelector.selectedIndex].text,
cityName = citySelector.options[citySelector.selectedIndex].text,
amt = parseFloat(exportAmount.value);
if (isNaN(amt)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid amount entered for export");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid amount entered for export");
return;
}
var exportObj = {ind:industryName, city:cityName, amt:amt};
@@ -41649,7 +42041,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__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
} else {
console.log("ERROR: Target city for export does not have warehouse in specified city");
@@ -41657,27 +42049,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__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
});
- var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button", display:"inline-block", innerText:"Cancel",
clickListener:()=>{
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
});
- var currExportsText = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ var currExportsText = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {
class:"cmpy-mgmt-existing-export",
innerHTML: "Industry: " + mat.exp[i].ind + " " +
"City: " + mat.exp[i].city + " " +
@@ -41695,44 +42087,44 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
}
}
mat.exp.splice(i, 1); //Remove export object
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* 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_6__utils_HelperFunctions_js__["g" /* 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_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("br", {})); // Force line break
//Button to set sell amount
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) + ")");
+ innerTextString = (mat.sllman[1] === -1 ? "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sll, 3) + "/MAX)" :
+ "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sll, 3) + "/" + Object(__WEBPACK_IMPORTED_MODULE_9__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)) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["g" /* 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);
+ innerTextString += " @ $" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(eval(sCost), 2);
} else {
- innerTextString += " @ $" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sCost, 2);
+ innerTextString += " @ $" + Object(__WEBPACK_IMPORTED_MODULE_9__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_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
innerHTML: "Enter the maximum amount of " + mat.name + " you would like " +
"to sell per second, as well as the price at which you would " +
"like to sell at.
" +
@@ -41744,16 +42136,16 @@ 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 = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("br", {});
- var inputQty = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ var br = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("br", {});
+ var inputQty = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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", {
+ var inputPx = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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", {
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
innerText:"Confirm", class:"a-link-button", margin:"6px",
clickListener:()=>{
//Parse price
@@ -41763,7 +42155,7 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
var temp = cost.replace(/MP/g, mat.bCost);
var temp = eval(temp);
if (temp == null || isNaN(temp)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value or expression for sell price field");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value or expression for sell price field");
return false;
}
@@ -41778,7 +42170,7 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
mat.sllman[0] = true;
mat.sllman[1] = -1;
} else if (isNaN(inputQty.value)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for sell quantity field! Must be numeric or 'MAX'");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for sell quantity field! Must be numeric or 'MAX'");
return false;
} else {
var qty = parseFloat(inputQty.value);
@@ -41793,17 +42185,17 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
}
this.createUI(parentRefs);
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(sellPopupid);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(sellPopupid);
return false;
}
});
- var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
innerText:"Cancel", class:"a-link-button", margin: "6px",
clickListener:()=>{
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(sellPopupid);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(sellPopupid);
}
});
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(sellPopupid, [txt, br, inputQty, inputPx, confirmBtn, cancelBtn]);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* createPopup */])(sellPopupid, [txt, br, inputQty, inputPx, confirmBtn, cancelBtn]);
inputQty.focus();
}
}));
@@ -41814,15 +42206,15 @@ 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_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {
class:"cmpy-mgmt-warehouse-product-div"
});
//Products being designed TODO
if (!product.fin) {
- div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
innerHTML: "Designing " + product.name + "... " +
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.prog, 2) + "% complete",
+ Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.prog, 2) + "% complete",
}));
industryWarehousePanel.appendChild(div);
return;
@@ -41831,47 +42223,47 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) {
//Completed products
var cmpAndDmdText = "";
if (company.unlockUpgrades[2] === 1) {
- cmpAndDmdText += " Competition: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.cmp, 3);
+ cmpAndDmdText += " Competition: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.cmp, 3);
}
if (company.unlockUpgrades[3] === 1) {
- cmpAndDmdText += " Demand: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.dmd, 3);
+ cmpAndDmdText += " Demand: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.dmd, 3);
}
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", {
- innerHTML: "
Est. Production Cost: " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(product.pCost).format("$0.000a") +
+ "
Est. Production Cost: " + __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(product.pCost).format("$0.000a") +
"An estimate of how much it costs to produce one unit of this product. " +
"If your sell price exceeds this by too much, people won't buy your product. The better your " +
"product is, the higher you can mark up its price.
" +
- "Size: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.siz, 3),
+ "Size: " + Object(__WEBPACK_IMPORTED_MODULE_9__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_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {
display:"inline-block",
});
div.appendChild(buttonPanel);
//Sell button
- var sellInnerTextString = (product.sllman[city][1] === -1 ? "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.data[city][2], 3) + "/MAX)" :
- "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.data[city][2], 3) + "/" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.sllman[city][1], 3) + ")");
+ var sellInnerTextString = (product.sllman[city][1] === -1 ? "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.data[city][2], 3) + "/MAX)" :
+ "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.data[city][2], 3) + "/" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.sllman[city][1], 3) + ")");
if (product.sCost) {
- sellInnerTextString += (" @ " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(product.sCost).format("$0.000a"));
+ sellInnerTextString += (" @ " + __WEBPACK_IMPORTED_MODULE_8__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_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
innerText:sellInnerTextString, class:"a-link-button", display:"inline-block",margin:"6px",
clickListener:()=>{
var popupId = "cmpy-mgmt-sell-product-popup";
- var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
innerHTML:"Enter the maximum amount of " + product.name + " you would like " +
"to sell per second, as well as the price at which you would like to " +
"sell it at.
" +
@@ -41880,19 +42272,19 @@ 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_6__utils_HelperFunctions_js__["f" /* createElement */])("input", {
type:"text", value:product.sllman[city][1] ? product.sllman[city][1] : null, placeholder: "Sell amount"
});
- var inputPx = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ var inputPx = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button", innerText:"Confirm",
clickListener:()=>{
//Parse price
var cost = parseFloat(inputPx.value);
if (isNaN(cost)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for sell price field");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for sell price field");
return false;
}
product.sCost = cost;
@@ -41902,7 +42294,7 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) {
product.sllman[city][0] = true;
product.sllman[city][1] = -1;
} else if (isNaN(inputQty.value)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for sell quantity field! Must be numeric");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for sell quantity field! Must be numeric");
return false;
} else {
var qty = parseFloat(inputQty.value);
@@ -41915,50 +42307,50 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) {
}
}
this.createUI(parentRefs);
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
});
- var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button", innerText:"Cancel",
clickListener:()=>{
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
});
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, inputQty, inputPx, confirmBtn, cancelBtn]);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("br",{})); //force line break
//Limit production button
var limitProductionInnerText = "Limit Production";
if (product.prdman[city][0]) {
- limitProductionInnerText += " (" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.prdman[city][1], 3) + ")";
+ limitProductionInnerText += " (" + Object(__WEBPACK_IMPORTED_MODULE_9__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_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button", innerText:limitProductionInnerText,display:"inline-block",
clickListener:()=>{
var popupId = "cmpy-mgmt-limit-product-production-popup";
- var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
innerText:"Enter a limit to the amount of this product you would " +
"like to product per second. Leave the box empty to set no limit."
});
- var input = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ var input = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button", display:"inline-block", innerText:"Limit production", margin:'6px',
clickListener:()=>{
if (input.value === "") {
product.prdman[city][0] = false;
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
var qty = parseFloat(input.value);
if (isNaN(qty)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value entered");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value entered");
return false;
}
if (qty < 0) {
@@ -41967,62 +42359,62 @@ Warehouse.prototype.createProductUI = function(product, parentRefs) {
product.prdman[city][0] = true;
product.prdman[city][1] = qty;
}
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
});
- var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button", display:"inline-block", innerText:"Cancel", margin:"6px",
clickListener:()=>{
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
});
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, input, confirmBtn, cancelBtn]);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:'a-link-button', display:"inline-block",innerText:"Discontinue",
clickListener:()=>{
var popupId = "cmpy-mgmt-discontinue-product-popup";
- var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
innerText:"Are you sure you want to do this? Discontinuing a product " +
"removes it completely and permanently. You will no longer " +
"produce this product and all of its existing stock will be " +
"removed and left unsold",
});
- var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button",innerText:"Discontinue",
clickListener:()=>{
industry.discontinueProduct(product, parentRefs);
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
});
- var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button", innerText:"Cancel",
clickListener:()=>{
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
});
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, confirmBtn, cancelBtn]);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, confirmBtn, cancelBtn]);
}
}));
industryWarehousePanel.appendChild(div);
}
Warehouse.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Warehouse", this);
+ return Object(__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Warehouse", this);
}
Warehouse.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Warehouse, value.data);
+ return Object(__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Warehouse, value.data);
}
-__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.Warehouse = Warehouse;
+__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["c" /* Reviver */].constructors.Warehouse = Warehouse;
//Corporation Unlock Upgrades
//Upgrades for entire corporation, unlocks features, either you have it or you dont
@@ -42038,15 +42430,19 @@ var CorporationUnlockUpgrades = {
"This allows you to purchase exactly however many materials you need for production."],
//Displays each material/product's demand
- "2": [2, 25e9, "Market Research - Demand",
+ "2": [2, 5e9, "Market Research - Demand",
"Mine and analyze market data to determine the demand of all resources. " +
"The demand attribute, which affects sales, will be displayed for every material and product."],
//Display's each material/product's competition
- "3": [3, 25e9, "Market Data - Competition",
+ "3": [3, 5e9, "Market Data - Competition",
"Mine and analyze market data to determine how much competition there is on the market " +
"for all resources. The competition attribute, which affects sales, will be displayed for " +
"for every material and product."],
+ "4": [4, 10e9, "VeChain",
+ "Use AI and blockchain technology to identify where you can improve your supply chain systems. " +
+ "This upgrade will allow you to view a wide array of useful statistics about your " +
+ "Corporation."]
}
//Corporation Upgrades
@@ -42120,9 +42516,9 @@ function Corporation(params={}) {
this.divisions = [];
//Financial stats
- this.funds = new __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js___default.a(150e9);
- this.revenue = new __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js___default.a(0);
- this.expenses = new __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js___default.a(0);
+ this.funds = new __WEBPACK_IMPORTED_MODULE_4__utils_decimal_js___default.a(150e9);
+ this.revenue = new __WEBPACK_IMPORTED_MODULE_4__utils_decimal_js___default.a(0);
+ this.expenses = new __WEBPACK_IMPORTED_MODULE_4__utils_decimal_js___default.a(0);
this.fundingRound = 0;
this.public = false; //Publicly traded
this.numShares = TOTALSHARES;
@@ -42144,11 +42540,24 @@ Corporation.prototype.getState = function() {
return this.state.getState();
}
+var numMarketCyclesPersist = 1;
Corporation.prototype.process = function(numCycles=1) {
var corp = this;
this.storedCycles += numCycles;
if (this.storedCycles >= CyclesPerIndustryStateCycle) {
- var state = this.getState(), marketCycles = 1;
+ var state = this.getState();
+
+ //Determine number of market cycles at the START state
+ if (state === "START") {
+ if (this.storedCycles >= 2*CyclesPerMarketCycle) {
+ //Enough cycles stored for 2+ market cycles
+ numMarketCyclesPersist = Math.floor(this.storedCycles / CyclesPerMarketCycle);
+ } else {
+ numMarketCyclesPersist = 1;
+ }
+ }
+ var marketCycles = numMarketCyclesPersist;
+
this.storedCycles -= (marketCycles * CyclesPerIndustryStateCycle);
this.divisions.forEach(function(ind) {
ind.process(marketCycles, state, corp);
@@ -42156,8 +42565,8 @@ Corporation.prototype.process = function(numCycles=1) {
//At the start of a new cycle, calculate profits from previous cycle
if (state === "START") {
- this.revenue = new __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js___default.a(0);
- this.expenses = new __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js___default.a(0);
+ this.revenue = new __WEBPACK_IMPORTED_MODULE_4__utils_decimal_js___default.a(0);
+ this.expenses = new __WEBPACK_IMPORTED_MODULE_4__utils_decimal_js___default.a(0);
this.divisions.forEach((ind)=>{
this.revenue = this.revenue.plus(ind.lastCycleRevenue);
this.expenses = this.expenses.plus(ind.lastCycleExpenses);
@@ -42165,10 +42574,10 @@ Corporation.prototype.process = function(numCycles=1) {
var profit = this.revenue.minus(this.expenses);
var cycleProfit = profit.times(marketCycles * SecsPerMarketCycle);
if (isNaN(this.funds)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("There was an error calculating your Corporations funds and they got reset to 0. " +
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("There was an error calculating your Corporations funds and they got reset to 0. " +
"This is a bug. Please report to game developer.
" +
"(Your funds have been set to $150b for the inconvenience)");
- this.funds = new __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js___default.a(150e9);
+ this.funds = new __WEBPACK_IMPORTED_MODULE_4__utils_decimal_js___default.a(150e9);
}
this.funds = this.funds.plus(cycleProfit);
this.updateSharePrice();
@@ -42182,13 +42591,13 @@ Corporation.prototype.process = function(numCycles=1) {
Corporation.prototype.determineValuation = function() {
var val, profit = (this.revenue.minus(this.expenses)).toNumber();
if (this.public) {
- val = this.funds.toNumber() + (profit * 100e3);
+ val = this.funds.toNumber() + (profit * 90e3);
val *= (Math.pow(1.1, this.divisions.length));
val = Math.max(val, 0);
} else {
val = 10e9 + Math.max(this.funds.toNumber(), 0) / 3; //Base valuation
if (profit > 0) {
- val += (profit * 400e3);
+ val += (profit * 350e3);
val *= (Math.pow(1.1, this.divisions.length));
} else {
val = 10e9 * Math.pow(1.1, this.divisions.length);
@@ -42218,8 +42627,8 @@ Corporation.prototype.getInvestment = function() {
}
var funding = val * percShares * 4,
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 */])();
+ yesBtn = Object(__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(),
+ noBtn = Object(__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
yesBtn.innerHTML = "Accept";
noBtn.innerHML = "Reject";
yesBtn.addEventListener("click", ()=>{
@@ -42227,46 +42636,46 @@ Corporation.prototype.getInvestment = function() {
this.funds = this.funds.plus(funding);
this.numShares -= investShares;
this.displayCorporationOverviewContent();
- return Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ return Object(__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
});
noBtn.addEventListener("click", ()=>{
- return Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ return Object(__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
});
- Object(__WEBPACK_IMPORTED_MODULE_9__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("An investment firm has offered you " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(funding).format('$0.000a') +
- " in funding in exchange for a " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(percShares*100).format("0.000a") +
- "% stake in the company (" + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(investShares).format('0.000a') + " shares).
" +
+ Object(__WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("An investment firm has offered you " + __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(funding).format('$0.000a') +
+ " in funding in exchange for a " + __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(percShares*100).format("0.000a") +
+ "% stake in the company (" + __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(investShares).format('0.000a') + " shares).
" +
"Do you accept or reject this offer?");
}
Corporation.prototype.goPublic = function() {
var goPublicPopupId = "cmpy-mgmt-go-public-popup";
var initialSharePrice = this.determineValuation() / (TOTALSHARES);
- var txt = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
innerHTML: "Enter the number of shares you would like to issue " +
"for your IPO. These shares will be publicly sold " +
"and you will no longer own them. You will receive " +
- __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(initialSharePrice).format('$0.000a') + " per share.
" +
+ __WEBPACK_IMPORTED_MODULE_8__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 " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(this.numShares).format("0.000a") + " of shares that you can issue.",
+ "You have a total of " + __WEBPACK_IMPORTED_MODULE_8__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_6__utils_HelperFunctions_js__["f" /* createElement */])("input", {
type:"number",
placeholder: "Shares to issue",
});
- var br = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("br", {});
- var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var br = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("br", {});
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button",
innerText:"Go Public",
clickListener:()=>{
var numShares = Math.round(input.value);
var initialSharePrice = this.determineValuation() / (TOTALSHARES);
if (isNaN(numShares)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for number of issued shares");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for number of issued shares");
return false;
}
if (numShares > this.numShares) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Error: You don't have that many shares to issue!");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Error: You don't have that many shares to issue!");
return false;
}
this.public = true;
@@ -42275,19 +42684,19 @@ Corporation.prototype.goPublic = function() {
this.numShares -= numShares;
this.funds = this.funds.plus(numShares * initialSharePrice);
this.displayCorporationOverviewContent();
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(goPublicPopupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(goPublicPopupId);
return false;
}
});
- var noBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var noBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button",
innerText:"Cancel",
clickListener:()=>{
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(goPublicPopupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(goPublicPopupId);
return false;
}
});
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(goPublicPopupId, [txt, br, input, yesBtn, noBtn]);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* createPopup */])(goPublicPopupId, [txt, br, input, yesBtn, noBtn]);
}
Corporation.prototype.updateSharePrice = function() {
@@ -42307,7 +42716,7 @@ Corporation.prototype.unlock = function(upgrade) {
this.unlockUpgrades.push(0);
}
if (this.funds.lt(price)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough funds to unlock this!");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough funds to unlock this!");
return;
}
this.unlockUpgrades[upgN] = 1;
@@ -42322,7 +42731,7 @@ Corporation.prototype.upgrade = function(upgrade) {
while (this.upgradeMultipliers.length <= upgN) {this.upgradeMultipliers.push(1);}
var totalCost = basePrice * Math.pow(priceMult, this.upgrades[upgN]);
if (this.funds.lt(totalCost)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough funds to purchase this!");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough funds to purchase this!");
return;
}
++this.upgrades[upgN];
@@ -42402,24 +42811,25 @@ var companyManagementDiv, companyManagementHeaderTabs, companyManagementPanel,
currentCityUi,
corporationUnlockUpgrades, corporationUpgrades,
industryOverviewPanel, industryOverviewText,
- industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeManagementUI, industryEmployeeInfo,
+ industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeAutohireButton,
+ industryEmployeeManagementUI, industryEmployeeInfo, industryIndividualEmployeeInfo,
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_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {id:"cmpy-mgmt-header-tabs"});
companyManagementDiv.appendChild(companyManagementHeaderTabs);
//Create division/industry tabs at the top
this.updateUIHeaderTabs();
//Create the 'panel' that will have the actual content in the UI
- companyManagementPanel = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", {id:"cmpy-mgmt-panel"});
+ companyManagementPanel = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {id:"cmpy-mgmt-panel"});
companyManagementDiv.appendChild(companyManagementPanel);
document.getElementById("entire-game-container").appendChild(companyManagementDiv);
@@ -42428,14 +42838,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_6__utils_HelperFunctions_js__["k" /* removeChildrenFromElement */])(companyManagementHeaderTabs);
} else {
console.log("ERROR: Header tabs div has not yet been created when Corporation.updateUIHeaderTabs() is called");
return;
}
//Corporation overview tabs
- var cmpyOverviewHdrTab = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("button", {
+ var cmpyOverviewHdrTab = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("button", {
id:"cmpy-mgmt-company-tab",
class:"cmpy-mgmt-header-tab",
innerText:this.name,
@@ -42454,26 +42864,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_6__utils_HelperFunctions_js__["f" /* createElement */])("button", {
id:'cmpy-mgmt-expand-industry-tab',
class:"cmpy-mgmt-header-tab",
innerText:"Expand into new Industry",
clickListener: ()=>{
if (document.getElementById("cmpy-mgmt-expand-industry-popup") != null) {return;}
- var container = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ var container = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("div", {class:"popup-box-content"}),
+ txt = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {}),
+ nameInput = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("input", {
type:"text",
id:"cmpy-mgmt-expand-industry-name-input",
color:"white",
@@ -42482,11 +42892,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_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("span", {
class:"popup-box-button",
innerText:"Create Division",
clickListener: ()=>{
@@ -42495,14 +42905,14 @@ Corporation.prototype.updateUIHeaderTabs = function() {
for (var i = 0; i < this.divisions.length; ++i) {
if (this.divisions[i].name === newDivisionName) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("This name is already in use!");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("This name is already in use!");
return false;
}
}
if (this.funds.lt(IndustryStartingCosts[ind])) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Not enough money to create a new division in this industry");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Not enough money to create a new division in this industry");
} else if (newDivisionName === "") {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("New division must have a name!");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("New division must have a name!");
} else {
this.funds = this.funds.minus(IndustryStartingCosts[ind]);
var newInd = new Industry({
@@ -42512,28 +42922,31 @@ Corporation.prototype.updateUIHeaderTabs = function() {
this.divisions.push(newInd);
this.updateUIHeaderTabs();
this.selectHeaderTab(headerTabs[headerTabs.length-2]);
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])("cmpy-mgmt-expand-industry-popup");
- this.displayDivisionContent(newInd, __WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])("cmpy-mgmt-expand-industry-popup");
+ this.displayDivisionContent(newInd, __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12);
}
return false;
}
}),
- noBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("span", {
+ noBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("span", {
class:"popup-box-button",
innerText:"Cancel",
clickListener: function() {
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])("cmpy-mgmt-expand-industry-popup");
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])("cmpy-mgmt-expand-industry-popup");
return false;
}
});
//Add industry types to selector
+ //Have Agriculture be first as recommended option
+ selector.add(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("option", {
+ text:Industries["Agriculture"], value:"Agriculture"
+ }))
for (var key in Industries) {
- if (Industries.hasOwnProperty(key)) {
+ if (key !== "Agriculture" && Industries.hasOwnProperty(key)) {
var ind = Industries[key];
- selector.add(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("option", {
- text: ind,
- value:key,
+ selector.add(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("option", {
+ text: ind,value:key,
}));
}
}
@@ -42577,13 +42990,13 @@ 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_6__utils_HelperFunctions_js__["f" /* createElement */])("button", {
id:tabId,
class:"cmpy-mgmt-header-tab",
innerText:division.name,
clickListener:()=>{
this.selectHeaderTab(tab);
- this.displayDivisionContent(division, __WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12);
+ this.displayDivisionContent(division, __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12);
return false;
}
});
@@ -42618,7 +43031,7 @@ 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_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
id:"cmpy-mgmt-overview-text",
}));
if (headerTabs && headerTabs.length >= 1) {
@@ -42626,66 +43039,64 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
}
//Check if player has Corporation Handbook
- var homeComp = __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].getHomeComputer(), hasHandbook = false,
+ var homeComp = __WEBPACK_IMPORTED_MODULE_3__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) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["g" /* isString */])(homeComp.messages[i]) && homeComp.messages[i] === handbookFn) {
hasHandbook = true;
break;
}
}
- if (!hasHandbook) {
- companyManagementPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* 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;
- }
- }));
- }
+ companyManagementPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", innerText:"Getting Started Guide", display:"inline-block",
+ tooltip:"Get a copy of and read 'The Complete Handbook for Creating a Successful Corporation.' " +
+ "This is a .lit file that guides you through the beginning of setting up a Corporation and " +
+ "provides some tips/pointers for helping you get started with managing it.",
+ clickListener:()=>{
+ if (!hasHandbook) {homeComp.messages.push(handbookFn);}
+ Object(__WEBPACK_IMPORTED_MODULE_1__Literature_js__["b" /* showLiterature */])(handbookFn);
+ return false;
+ }
+ }));
//Investors
if (this.public) {
//Sell share buttons
- var sellShares = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var sellShares = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
innerHTML: "Enter the number of shares you would like to sell. The current price of your " +
- "company's stock is " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(currentStockPrice).format("$0.000a"),
+ "company's stock is " + __WEBPACK_IMPORTED_MODULE_8__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", {
+ var profitIndicator = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {});
+ var input = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("input", {
type:"number", placeholder:"Shares to sell", margin:"5px",
inputListener: ()=> {
var numShares = Math.round(input.value);
- if (isNaN(numShares)) {
+ if (isNaN(numShares) || shares <= 0) {
profitIndicator.innerText = "ERROR: Invalid value entered for number of shares to sell"
} else if (numShares > this.numShares) {
profitIndicator.innerText = "You don't have this many shares to sell!";
} else {
profitIndicator.innerText = "Sell " + numShares + " shares for a total of " +
- __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(numShares * currentStockPrice).format('$0.000a');
+ __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(numShares * currentStockPrice).format('$0.000a');
}
}
});
- var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button", innerText:"Sell shares", display:"inline-block",
clickListener:()=>{
var shares = Math.round(input.value);
- if (isNaN(shares)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: Invalid value for number of shares");
+ if (isNaN(shares) || shares <= 0) {
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: Invalid value for number of shares");
} else if (shares > this.numShares) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: You don't have this many shares to sell");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: You don't have this many shares to sell");
} else {
this.numShares -= shares;
if (isNaN(this.issuedShares)) {
@@ -42699,65 +43110,65 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
}
}
this.issuedShares += shares;
- __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].gainMoney(shares * this.sharePrice);
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gainMoney(shares * this.sharePrice);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
}
});
- var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button", innerText:"Cancel", display:"inline-block",
clickListener:()=>{
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
});
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, profitIndicator, input, confirmBtn, cancelBtn]);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, profitIndicator, input, confirmBtn, cancelBtn]);
}
});
//Buyback shares button
- var buybackShares = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var buybackShares = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
innerHTML: "Enter the number of shares you would like to buy back at market price. The current price of your " +
- "company's stock is " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(currentStockPrice).format("$0.000a") +
- ". Your company currently has " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.issuedShares, 3) + " outstanding stock shares",
+ "company's stock is " + __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(currentStockPrice).format("$0.000a") +
+ ". Your company currently has " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.issuedShares, 3) + " outstanding stock shares",
});
- 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", {
+ var costIndicator = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {});
+ var input = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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
- if (isNaN(numShares)) {
+ if (isNaN(numShares) || shares <= 0) {
costIndicator.innerText = "ERROR: Invalid value entered for number of shares to buyback"
} else if (numShares > this.issuedShares) {
costIndicator.innerText = "There are not this many shares available to buy back. " +
"There are only " + this.issuedShares + " outstanding shares.";
} else {
costIndicator.innerText = "Purchase " + numShares + " shares for a total of " +
- __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(numShares * currentStockPrice).format('$0.000a');
+ __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(numShares * currentStockPrice).format('$0.000a');
}
}
});
- var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button", innerText:"Buy shares", display:"inline-block",
clickListener:()=>{
var shares = Math.round(input.value);
var tempStockPrice = this.sharePrice;
- if (isNaN(shares)) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: Invalid value for number of shares");
+ if (isNaN(shares) || shares <= 0) {
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: Invalid value for number of shares");
} else if (shares > this.issuedShares) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: There are not this many oustanding shares to buy back");
- } else if (shares * tempStockPrice > __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].money) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: You do not have enough money to purchase this many shares (you need " +
- __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(shares * tempStockPrice).format("$0.000a") + ")");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: There are not this many oustanding shares to buy back");
+ } else if (shares * tempStockPrice > __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].money) {
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: You do not have enough money to purchase this many shares (you need " +
+ __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(shares * tempStockPrice).format("$0.000a") + ")");
} else {
this.numShares += shares;
if (isNaN(this.issuedShares)) {
@@ -42771,31 +43182,31 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
}
}
this.issuedShares -= shares;
- __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].loseMoney(shares * tempStockPrice);
+ __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].loseMoney(shares * tempStockPrice);
//TODO REMOVE from Player money
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
}
return false;
}
});
- var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button",
innerText:"Cancel",
display:"inline-block",
clickListener:()=>{
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(popupId);
return false;
}
});
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, costIndicator, input, confirmBtn, cancelBtn]);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, costIndicator, input, confirmBtn, cancelBtn]);
}
});
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_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class: this.fundingRound >= 4 ? "a-link-button-inactive" : "a-link-button tooltip",
innerText: "Find Investors",
display:"inline-block",
@@ -42804,7 +43215,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
}
});
if (this.fundingRound < 4) {
- var findInvestorsTooltip = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("span", {
+ var findInvestorsTooltip = Object(__WEBPACK_IMPORTED_MODULE_6__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"
@@ -42812,7 +43223,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
findInvestors.appendChild(findInvestorsTooltip);
}
- var goPublic = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ var goPublic = Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("a", {
class:"a-link-button tooltip",
innerText:"Go Public",
display:"inline-block",
@@ -42821,7 +43232,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_6__utils_HelperFunctions_js__["f" /* createElement */])("span", {
class:"tooltiptext",
innerText: "Become a publicly traded and owned entity. Going public involves " +
"issuing shares for an IPO. Once you are a public company, " +
@@ -42839,10 +43250,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_6__utils_HelperFunctions_js__["f" /* 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_6__utils_HelperFunctions_js__["f" /* createElement */])("h1", {
innerText:"Unlocks", margin:"6px", padding:"6px",
}));
@@ -42867,13 +43278,13 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
return;
}
- upgradeContainer.appendChild(Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ upgradeContainer.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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"),
+ innerHTML:upgrade[2] + " - " + __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(upgrade[1]).format("$0.000a"),
tooltip: upgrade[3],
clickListener:()=>{
if (corp.funds.lt(upgrade[1])) {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Insufficient funds");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Insufficient funds");
} else {
corp.unlock(upgrade);
corp.displayCorporationOverviewContent();
@@ -42885,7 +43296,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_6__utils_HelperFunctions_js__["f" /* createElement */])("h1", {
innerText:"Upgrades", margin:"6px", padding:"6px",
}));
@@ -42899,13 +43310,13 @@ 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", {
+ upgradeContainer.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* 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"),
+ innerHTML:upgrade[4] + " - " + __WEBPACK_IMPORTED_MODULE_8__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");
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Insufficient funds");
} else {
corp.upgrade(upgrade);
corp.displayCorporationOverviewContent();
@@ -42925,19 +43336,19 @@ Corporation.prototype.updateCorporationOverviewContent = function() {
return;
}
var totalFunds = this.funds,
- totalRevenue = new __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js___default.a(0),
- totalExpenses = new __WEBPACK_IMPORTED_MODULE_3__utils_decimal_js___default.a(0);
+ totalRevenue = new __WEBPACK_IMPORTED_MODULE_4__utils_decimal_js___default.a(0),
+ totalExpenses = new __WEBPACK_IMPORTED_MODULE_4__utils_decimal_js___default.a(0);
var profit = this.revenue.minus(this.expenses).toNumber(),
- 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");
+ profitStr = profit >= 0 ? __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(profit).format("$0.000a") : "-" + __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(-1 * profit).format("$0.000a");
- var txt = "Total Funds: " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(totalFunds.toNumber()).format('$0.000a') + " " +
- "Total Revenue: " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(this.revenue.toNumber()).format("$0.000a") + " / s " +
- "Total Expenses: " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(this.expenses.toNumber()).format("$0.000a") + "/ s " +
+ var txt = "Total Funds: " + __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(totalFunds.toNumber()).format('$0.000a') + " " +
+ "Total Revenue: " + __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(this.revenue.toNumber()).format("$0.000a") + " / s " +
+ "Total Expenses: " + __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default()(this.expenses.toNumber()).format("$0.000a") + "/ s " +
"Total Profits: " + profitStr + " / s " +
"Publicly Traded: " + (this.public ? "Yes" : "No") + " " +
- "Owned Stock Shares: " + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(this.numShares).format('0.000a') + " " +
- "Stock Price: " + (this.public ? "$" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.sharePrice, 2) : "N/A") + "
Production Multiplier: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.prodMult, 2) +
"Production gain from owning production-boosting materials " +
"such as hardware, Robots, AI Cores, and Real Estate
" +
- "Scientific Research: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.sciResearch.qty, 3);
+ "Scientific Research: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.sciResearch.qty, 3);
//Office and Employee List
var office = division.offices[currentCityUi];
@@ -43553,30 +44010,51 @@ Corporation.prototype.updateDivisionContent = function(division) {
"Size: " + office.employees.length + " / " + office.size + " employees";
if (office.employees.length >= office.size) {
industryEmployeeHireButton.className = "a-link-button-inactive";
+ industryEmployeeAutohireButton.className = "a-link-button-inactive tooltip";
} else {
industryEmployeeHireButton.className = "a-link-button";
+ industryEmployeeAutohireButton.className = "a-link-button tooltip";
}
- 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) {
- 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);
+ //Employee Overview stats
+ //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) {
+ 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_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(avgMorale, 3) + " " +
+ "Avg Employee Happiness: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(avgHappiness, 3) + " " +
+ "Avg Employee Energy: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(avgEnergy, 3);
+ if (vechain) { //VeChain - Statistics
+ industryEmployeeInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("br", {}));
+ industryEmployeeInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerText:"Material Production: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.getOfficeProductivity(office), 3),
+ tooltip: "The base amount of material this office can produce. Does not include " +
+ "production multipliers from upgrades and materials. This value is based off " +
+ "the productivity of your Operations, Engineering, and Management employees"
+ }));
+ industryEmployeeInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("br", {}));
+ industryEmployeeInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerText:"Product Production: " + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.getOfficeProductivity(office, {forProduct:true}), 3),
+ tooltip: "The base amount of any given Product this office can produce. Does not include " +
+ "production multipliers from upgrades and materials. This value is based off " +
+ "the productivity of your Operations, Engineering, and Management employees"
+ }));
+ industryEmployeeInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("br", {}));
+ industryEmployeeInfo.appendChild(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerText: "Business Multiplier: x" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.getBusinessFactor(office), 3),
+ tooltip: "The effect this office's 'Business' employees has on boosting sales"
+ }));
}
-
//Warehouse
var warehouse = division.warehouses[currentCityUi];
@@ -43586,7 +44064,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_6__utils_HelperFunctions_js__["f" /* createElement */])("button", {
id:"cmpy-mgmt-city-" + city + "-tab",
class:"cmpy-mgmt-city-tab",
innerText:city,
@@ -43612,7 +44090,7 @@ Corporation.prototype.selectCityTab = function(activeTab, city) {
Corporation.prototype.clearUI = function() {
//Delete everything
- if (companyManagementDiv != null) {Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["m" /* removeElementById */])(companyManagementDiv.id);}
+ if (companyManagementDiv != null) {Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["m" /* removeElementById */])(companyManagementDiv.id);}
//Reset global DOM variables
companyManagementDiv = null;
@@ -43628,8 +44106,10 @@ Corporation.prototype.clearUI = function() {
industryEmployeePanel = null;
industryEmployeeText = null;
industryEmployeeHireButton = null;
+ industryEmployeeAutohireButton = null;
industryEmployeeManagementUI = null;
industryEmployeeInfo = null;
+ industryIndividualEmployeeInfo = null;
industryOfficeUpgradeSizeButton = null;
@@ -43643,14 +44123,14 @@ Corporation.prototype.clearUI = function() {
}
Corporation.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Corporation", this);
+ return Object(__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Corporation", this);
}
Corporation.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Corporation, value.data);
+ return Object(__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Corporation, value.data);
}
-__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.Corporation = Corporation;
+__WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__["c" /* Reviver */].constructors.Corporation = Corporation;
@@ -44349,7 +44829,7 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=fa
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__BitNode_js__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(22);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Location_js__ = __webpack_require__(12);
@@ -44363,6 +44843,8 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=fa
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Terminal_js__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_16__utils_decimal_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_DialogBox_js__ = __webpack_require__(1);
+
@@ -44503,11 +44985,8 @@ function prestigeAugmentation() {
function prestigeSourceFile() {
Object(__WEBPACK_IMPORTED_MODULE_2__BitNode_js__["c" /* initBitNodeMultipliers */])();
- //Crime statistics
__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].prestigeSourceFile();
-
- //Delete all Worker Scripts objects
- Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])();
+ Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])(); //Delete all Worker Scripts objects
var homeComp = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer();
@@ -44589,7 +45068,7 @@ function prestigeSourceFile() {
//Reinitialize Bit Node flags
Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__["f" /* initSingularitySFFlags */])();
- //Reset Stock market
+ //Reset Stock market, gang, and corporation
if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount) {
Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["g" /* initStockMarket */])();
Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["i" /* initSymbolToStockMap */])();
@@ -44600,11 +45079,17 @@ function prestigeSourceFile() {
stockMarketList.removeChild(stockMarketList.firstChild);
}
+ __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gang = null;
+ __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].corporation = null;
+
+
+ //BitNode 3, get Handbook .lit file
+ homeComp.messages.push("corporation-management-handbook.lit");
+ Object(__WEBPACK_IMPORTED_MODULE_17__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You received a copy of the Corporation Management Handbook on your home computer. " +
+ "Read it if you need help getting started with Corporations!");
+
//Gain int exp
__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainIntelligenceExp(5);
-
- //Reset gang
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gang = null;
}
@@ -44824,7 +45309,7 @@ function applySourceFile(srcFile) {
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(38);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Script_js__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__ = __webpack_require__(39);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__);
@@ -44859,7 +45344,6 @@ Promise.config({
* Returns a promise
*/
function evaluate(exp, workerScript) {
- /* return new Promise(function(resolve, reject) {*/
return Promise.delay(__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].CodeInstructionRunTime).then(function() {
var env = workerScript.env;
if (env.stopFlag) {return Promise.reject(workerScript);}
@@ -44876,7 +45360,7 @@ function evaluate(exp, workerScript) {
}).catch(function(e) {
if (e.constructor === Array && e.length === 2 && e[0] === "RETURNSTATEMENT") {
return Promise.reject(e);
- } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["f" /* isString */])(e)) {
+ } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["g" /* isString */])(e)) {
workerScript.errorMessage = e;
return Promise.reject(workerScript);
} else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
@@ -44948,7 +45432,7 @@ function evaluate(exp, workerScript) {
//Return statement from function
return Promise.resolve(e[1]);
workerScript.fnWorker = null;
- } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["f" /* isString */])(e)) {
+ } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["g" /* isString */])(e)) {
return Promise.reject(makeRuntimeRejectMsg(workerScript, e));
} else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
//Parse out the err message from the WorkerScript and re-reject
@@ -44971,6 +45455,13 @@ function evaluate(exp, workerScript) {
} else if (exp.callee.type == "MemberExpression"){
return evaluate(exp.callee.object, workerScript).then(function(object) {
try {
+ if (func === "NETSCRIPTFOREACH") {
+ return evaluateForeach(object, args, workerScript).then(function(res) {
+ return Promise.resolve(res);
+ }).catch(function(e) {
+ return Promise.reject(e);
+ });
+ }
var res = func.apply(object,args);
return Promise.resolve(res);
} catch (e) {
@@ -45019,6 +45510,9 @@ function evaluate(exp, workerScript) {
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."));
}
+ if (object != null && object instanceof Array && exp.property.name === "forEach") {
+ return "NETSCRIPTFOREACH";
+ }
try {
return Promise.resolve(object[exp.property.name])
} catch (e) {
@@ -45369,35 +45863,43 @@ function evaluateFor(exp, workerScript) {
}
recurse();
});
- /*
- return evaluate(exp.test, workerScript).then(function(resCond) {
- if (resCond) {
- //Execute code (body), update, and then recurse
- return evaluate(exp.body, workerScript).then(function(resCode) {
- return evaluate(exp.update, workerScript);
- }).catch(function(e) {
- if (e == "CONTINUESTATEMENT" ||
- (e instanceof WorkerScript && e.errorMessage == "CONTINUESTATEMENT")) {
- //Continue statement, recurse to next iteration
- return evaluate(exp.update, workerScript).then(function(resPostloop) {
- return evaluateFor(exp, workerScript);
- }).then(function(foo) {
- return Promise.resolve("endForLoop");
- }).catch(function(e) {
- return Promise.reject(e);
- });
- } else {
- return Promise.reject(e);
- }
- }).then(function(resPostloop) {
- return evaluateFor(exp, workerScript);
- }).then(function(foo) {
- return Promise.resolve("endForLoop");
- });
- } else {
- return Promise.resolve("endForLoop"); //Doesn't need to resolve to any particular value
+}
+
+function evaluateForeach(arr, args, workerScript) {
+ console.log("evaluateForeach called");
+ if (!(arr instanceof Array)) {
+ return Promise.reject("Invalid array passed into forEach");
+ }
+ if (!(args instanceof Array) && args.length != 1) {
+ return Promise.reject("Invalid argument passed into forEach");
+ }
+ var func = args[0];
+ if (typeof func !== "function") {
+ return Promise.reject("Invalid function passed into forEach");
+ }
+ console.log(func);
+ return new Promise(function(resolve, reject) {
+ //Don't return a promise so the promise chain is broken on each recursion
+ function recurse(i) {
+ console.log("recurse() called with i: " + i);
+ if (i >= arr.length) {
+ resolve();
+ } else {
+ return Promise.delay(__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].CodeInstructionRunTime).then(function() {
+ console.log("About to apply function");
+ var res = func.apply(null, [arr[i]]);
+ console.log("Applied function");
+ ++i;
+ Promise.resolve(res).then(function(val) {
+ recurse(i);
+ }, reject).catch(function(e) {
+ return Promise.reject(e);
+ });
+ });
+ }
}
- });*/
+ recurse(0);
+ });
}
function evaluateWhile(exp, workerScript) {
@@ -45535,6 +46037,14 @@ function runScriptFromScript(server, scriptname, args, workerScript, threads=1)
return Promise.resolve(false);
}
+ //'null/undefined' arguments are not allowed
+ for (var i = 0; i < args.length; ++i) {
+ if (args[i] == null) {
+ workerScript.scriptRef.log("ERROR: Cannot execute a script with null/undefined as an argument");
+ return Promise.resolve(false);
+ }
+ }
+
//Check if the script exists and if it does run it
for (var i = 0; i < server.scripts.length; ++i) {
if (server.scripts[i].filename == scriptname) {
@@ -45576,7 +46086,7 @@ function getErrorLineNumber(exp, workerScript) {
}
function isScriptErrorMessage(msg) {
- if (!Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["f" /* isString */])(msg)) {return false;}
+ if (!Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["g" /* isString */])(msg)) {return false;}
let splitMsg = msg.split("|");
if (splitMsg.length != 4){
return false;
@@ -45728,19 +46238,6 @@ Environment.prototype = {
}
return res[idx[idx.length-1]] = value;
},
- /*
- setArrayElement: function(name, idx, value) {
- var scope = this.lookup(name);
- if (!scope && this.parent) {
- console.log("Here");
- throw new Error("Undefined variable " + name);
- }
- var arr = (scope || this).vars[name];
- if (!(arr.constructor === Array || arr instanceof Array)) {
- throw new Error("Variable is not an array: " + name);
- }
- return (scope || this).vars[name][idx] = value;
- },*/
//Creates (or overwrites) a variable in the current scope
def: function(name, value) {
@@ -51650,7 +52147,7 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */
/* unused harmony export buyDarkwebItem */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return parseDarkwebItemPrice; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DarkWebItems; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Terminal_js__ = __webpack_require__(19);
@@ -52035,17 +52532,51 @@ function initLiterature() {
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
";
+ txt = "Getting Started with Corporations " +
+ "To get started, visit the City Hall in Sector-12 in order to create a Corporation. This requires " +
+ "$150b of your own money, but this $150b will get put into your Corporation's funds. " +
+ "After creating your Corporation, you will see it listed as one of the locations in the city. Click on " +
+ "your Corporation in order to manage it.
" +
+ "Your Corporation can have many different divisions, each in a different Industry. There are many different " +
+ "types of Industries, each with different properties. To create your first division, click the " +
+ "'Expand into new Industry' button at the top of the management UI. The Agriculture " +
+ "and Software industries are recommended for your first division.
" +
+ "The first thing you'll need to do is hire some employees. Employees can be assigned to five different positions. " +
+ "Each position has a different effect on various aspects of your Corporation. It is recommended to have at least " +
+ "one employee at each position.
" +
+ "Each industry uses some combination of Materials in order to produce other Materials and/or create Products. " +
+ "Specific information about this is displayed in each of your divisions' UI.
" +
+ "Products are special, industry-specific objects. They are different than Materials because you " +
+ "must manually choose to develop them, and you can choose to develop any number of Products. Developing " +
+ "a Product takes time, but a Product typically generates significantly more revenue than any Material. " +
+ "Not all industries allow you to create Products. To create a Product, look for a button " +
+ "in the top-left panel of the division UI (e.g. For the Software Industry, the button says 'Develop Software').
" +
+ "To get your supply chain system started, " +
+ "purchase the Materials that your industry needs to produce other Materials/Products. This can be done " +
+ "by clicking the 'Buy' button next to the corresponding Material(s). After you have the required Materials, " +
+ "you will immediately start production. The amount of Materials/Products you produce is based on a variety of factors, " +
+ "one of which is your employees and their productivity.
" +
+ "Once you start producing Materials/Products, you can sell them in order to start earning revenue. This can be done " +
+ "by clicking the 'Sell' button next to the corresponding Material or Product. The amount of Material/Product you sell is dependent " +
+ "on a wide variety of different factors.
" +
+ "These are the basics of getting your Corporation up and running! Now, you can start purchasing upgrades to improve " +
+ "your bottom line. If you need money, consider looking for seed investors, who will give you money in exchange for stock shares. " +
+ "Otherwise, once you feel you are ready, take your Corporation public! Once your Corporation goes public, you can no longer " +
+ "find investors. Instead, your Corporation will be publicly traded and its stock price will change based on how well " +
+ "it's performing financially. You can then sell your stock shares in order to make money.
" +
+ "Tips/Pointers " +
+ "-Purchasing Hardware, Robots, AI Cores, and Real Estate can potentially increase your production. " +
+ "The effects of these depend on what industry you are in.
" +
+ "-In order to optimize your production, you will need a good balance of Operators, Managers, and Engineers
" +
+ "-Different employees excel in different jobs. For example, the highly intelligent employees will probably do best " +
+ "if they are assigned to do Engineering work or Research & Development.
" +
+ "-If your employees have low morale, energy, or happiness, their production will greatly suffer.
" +
+ "-Tech is important, but don't neglect sales! Having several Businessmen can boost your sales and your bottom line.
" +
+ "-Don't forget to advertise your company. You won't have any business if nobody knows you.
" +
+ "-Having company awareness is great, but what's really important is your company's popularity. Try to keep " +
+ "your popularity as high as possible to see the biggest benefit for your sales
" +
+ "-Remember, you need to spend money to make money!
" + this.text, true);
}
TextFile.prototype.download = function() {
@@ -73724,8 +74255,8 @@ 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|" +
+ "clearLog|disableLog|enableLog|" +
+ "relaysmtp|httpworm|sqlinject|run|exec|spawn|kill|killall|exit|" +
"scp|ls|hasRootAccess|" +
"getIp|getHackingMultipliers|getBitNodeMultipliers|getStats|isBusy|" +
"getHostname|getHackingLevel|getServerMoneyAvailable|getServerMaxMoney|" +
@@ -73734,13 +74265,14 @@ var NetscriptHighlightRules = function(options) {
"getServerRequiredHackingLevel|getServerNumPortsRequired|getServerRam|" +
"serverExists|fileExists|isRunning|getNextHacknetNodeCost|" +
"purchaseHacknetNode|deleteServer|getPurchasedServers|" +
- "purchaseServer|round|write|read|clear|" +
+ "purchaseServer|round|write|read|peek|clear|" +
"scriptRunning|scriptKill|getScriptRam|" +
"getHackTime|getGrowTime|getWeakenTime|getScriptIncome|getScriptExpGain|" +
"getTimeSinceLastAug|" +
"universityCourse|" +
"gymWorkout|travelToCity|purchaseTor|purchaseProgram|upgradeHomeRam|" +
"getUpgradeHomeRamCost|workForCompany|applyToCompany|getCompanyRep|" +
+ "stopAction|" +
"checkFactionInvitations|joinFaction|workForFaction|getFactionRep|" +
"createProgram|commitCrime|getCrimeChance|getOwnedAugmentations|" +
"getAugmentationsFromFaction|" +
@@ -84141,7 +84673,7 @@ let TerminalHelpText =
'alias [-g] [name="value"] Create or display Terminal aliases ' +
"analyze Get information about the current machine " +
"buy [-l/program] Purchase a program through the Dark Web " +
- "cat [file] Display a .msg or .lit file " +
+ "cat [file] Display a .msg, .lit, or .txt file " +
"check [script] [args...] Print a script's logs to Terminal " +
"clear Clear all text on the terminal " +
"cls See 'clear' command " +
@@ -84164,7 +84696,7 @@ let TerminalHelpText =
"run [name] [-t] [n] [args...] Execute a program or script " +
"scan Prints all immediately-available network connections " +
"scan-analyze [d] [-a] Prints info for all servers up to d nodes away " +
- "scp [file] [server] Copies a script or .lit file to a destination server " +
+ "scp [file] [server] Copies a file to a destination server " +
"sudov Shows whether you have root access on this computer " +
"tail [script] [args...] Displays dynamic logs for the specified script " +
"theme [preset] | bg txt hlgt Change the color scheme of the UI " +
@@ -84202,10 +84734,10 @@ let HelpTexts = {
"dark web to the Terminal, as well as their costs.
" +
"Otherwise, the name of the program must be passed in as a parameter. This is name is NOT case-sensitive.",
cat: "cat [file] " +
- "Display message files, which are files ending with the '.msg' extension, or a literature file, which " +
- "are files ending with the '.lit' extension. Examples:
" +
+ "Display message (.msg), literature (.lit), or text (.txt) files. Examples:
" +
"cat j1.msg " +
- "cat foo.lit",
+ "cat foo.lit " +
+ "cat servers.txt",
check: "check [script name] [args...] " +
"Print the logs of the script specified by the script name and arguments to the Terminal. Each argument must be separated by " +
"a space. Remember that a running script is uniquely " +
@@ -84308,7 +84840,8 @@ let HelpTexts = {
"-a flag at the end of the command if you would like to enable that.",
scp: "scp [filename] [target server] " +
"Copies the specified file from the current server to the target server. " +
- "This command only works for script files (.script extension) and literature files (.lit extension). " +
+ "This command only works for script files (.script extension), literature files (.lit extension), " +
+ "and text files (.txt extension). " +
"The second argument passed in must be the hostname or IP of the target server.",
sudov: "sudov " +
"Prints whether or not you have root access to the current machine",
@@ -104943,7 +105476,7 @@ function factionInvitationBoxCreate(faction) {
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Script_js__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Settings_js__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__StockMarket_js__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__ = __webpack_require__(1);
@@ -104992,6 +105525,7 @@ function BitburnerSaveObject() {
this.StockMarketSave = "";
this.SettingsSave = "";
this.VersionSave = "";
+ this.AllGangsSave = "";
}
BitburnerSaveObject.prototype.saveGame = function(db) {
@@ -105180,6 +105714,7 @@ function loadImportedGame(saveObj, saveString) {
var tempGlobalAliases = null;
var tempMessages = null;
var tempStockMarket = null;
+ var tempAllGangs = null;
//Check to see if the imported save file can be parsed. If any
//errors are caught it will fail
@@ -105231,7 +105766,7 @@ function loadImportedGame(saveObj, saveString) {
}
if (saveObj.hasOwnProperty("StockMarketSave")) {
try {
- tempStockMarket = JSON.parse(saveObj.StockMarketSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ tempStockMarket = JSON.parse(tempSaveObj.StockMarketSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
} catch(e) {
console.log("Parsing StockMarket save failed: " + e);
tempStockMarket = {};
@@ -105260,9 +105795,9 @@ function loadImportedGame(saveObj, saveString) {
} else {
//createNewUpdateText();
}
- if (tempPlayer.bitNodeN == 2 && tempPlayer.inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
+ if (tempPlayer.bitNodeN == 2 && tempPlayer.inGang() && tempSaveObj.hasOwnProperty("AllGangsSave")) {
try {
- AllGangs = JSON.parse(saveObj.AllGangsSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
+ Object(__WEBPACK_IMPORTED_MODULE_5__Gang_js__["d" /* loadAllGangs */])(tempSaveObj.AllGangsSave);
} catch(e) {
console.log("ERROR: Failed to parse AllGangsSave: " + e);
}
diff --git a/doc/build/doctrees/environment.pickle b/doc/build/doctrees/environment.pickle
index 4a47ec1a3..a91ffcc2a 100644
Binary files a/doc/build/doctrees/environment.pickle and b/doc/build/doctrees/environment.pickle differ
diff --git a/doc/build/doctrees/netscript.doctree b/doc/build/doctrees/netscript.doctree
index b2786f2cc..d4bd06dc4 100644
Binary files a/doc/build/doctrees/netscript.doctree and b/doc/build/doctrees/netscript.doctree differ
diff --git a/doc/build/doctrees/netscriptfunctions.doctree b/doc/build/doctrees/netscriptfunctions.doctree
index f63dbec8e..6ebde9926 100644
Binary files a/doc/build/doctrees/netscriptfunctions.doctree and b/doc/build/doctrees/netscriptfunctions.doctree differ
diff --git a/doc/build/doctrees/netscriptloopsandconditionals.doctree b/doc/build/doctrees/netscriptloopsandconditionals.doctree
index 0c5a991e4..b8dc9699a 100644
Binary files a/doc/build/doctrees/netscriptloopsandconditionals.doctree and b/doc/build/doctrees/netscriptloopsandconditionals.doctree differ
diff --git a/doc/build/doctrees/netscriptmisc.doctree b/doc/build/doctrees/netscriptmisc.doctree
new file mode 100644
index 000000000..664f9a037
Binary files /dev/null and b/doc/build/doctrees/netscriptmisc.doctree differ
diff --git a/doc/build/doctrees/netscriptsingularityfunctions.doctree b/doc/build/doctrees/netscriptsingularityfunctions.doctree
index c288eafb7..2bcaad59f 100644
Binary files a/doc/build/doctrees/netscriptsingularityfunctions.doctree and b/doc/build/doctrees/netscriptsingularityfunctions.doctree differ
diff --git a/doc/build/html/_sources/netscript.rst.txt b/doc/build/html/_sources/netscript.rst.txt
index f4bd2d0f9..295b131c9 100644
--- a/doc/build/html/_sources/netscript.rst.txt
+++ b/doc/build/html/_sources/netscript.rst.txt
@@ -23,3 +23,4 @@ to reach out to the developer!
Hacknet Node API
Trade Information eXchange (TIX) API
Singularity Functions
+ Miscellaneous
diff --git a/doc/build/html/_sources/netscriptfunctions.rst.txt b/doc/build/html/_sources/netscriptfunctions.rst.txt
index 8661ee953..2adbdab2e 100644
--- a/doc/build/html/_sources/netscriptfunctions.rst.txt
+++ b/doc/build/html/_sources/netscriptfunctions.rst.txt
@@ -12,7 +12,7 @@ hack
.. js:function:: hack(hostname/ip)
:param string hostname/ip: IP or hostname of the target server to hack
- :returns: True if the hack is successful, false otherwise
+ :returns: The amount of money stolen if the hack is successful, and zero otherwise
Function that is used to try and hack servers to steal money and gain hacking experience. The runtime for this command depends
on your hacking level and the target server's security level. In order to hack a server you must first gain root access
@@ -72,10 +72,9 @@ weaken
sleep
^^^^^
-.. js:function:: sleep(n[, log=true])
+.. js:function:: sleep(n)
:param number n: Number of milliseconds to sleep
- :param boolean log: Optional boolean specifying whether or not to log the action
Suspends the script for n milliseconds.
@@ -97,6 +96,39 @@ tprint
Prints a value or a variable to the Terminal
+clearLog
+^^^^^^^^
+
+.. js:function:: clearLog()
+
+ Clears the script's logs
+
+disableLog
+^^^^^^^^^^
+
+.. js:function:: disableLog(fn)
+
+ :param string fn: Name of function for which to disable logging
+
+ Disables logging for the given function. Logging can be disabled for
+ all functions by passing 'ALL' as the argument.
+
+ Note that this does not completely remove all logging functionality.
+ This only stops a function from logging
+ when the function is successful. If the function fails, it will still log the reason for failure.
+
+ Notable functions that cannot have their logs disabled: run, exec, exit
+
+enableLog
+^^^^^^^^^
+
+.. js:function:: enableLog(fn)
+
+ :param string fn: Name of function for which to enable logging
+
+ Re-enables logging for the given function. If 'ALL' is passed into this function
+ as an argument, then it will revert the effects of disableLog('ALL')
+
scan
^^^^
@@ -304,7 +336,8 @@ killall
:param string hostname/ip: IP or hostname of the server on which to kill all scripts
- Kills all running scripts on the specified server. This function will always return true.
+ Kills all running scripts on the specified server. This function returns true if any scripts were killed, and
+ false otherwise. In other words, it will return true if there are any scripts running on the target server.
exit
@@ -346,9 +379,10 @@ scp
ls
^^
-.. js:function:: ls(hostname/ip)
+.. js:function:: ls(hostname/ip, [grep])
:param string hostname/ip: Hostname or IP of the target server
+ :param string grep: a substring to search for in the filename
Returns an array with the filenames of all files on the specified server (as strings). The returned array
is sorted in alphabetic order
@@ -639,15 +673,6 @@ getPurchasedServers
Returns an array with either the hostnames or IPs of all of the servers you have purchased.
-round
-^^^^^
-
-.. js:function:: round(n)
-
- :param number n: Number to round
-
- Returns the argument *n* rounded to the nearest integer. If the argument passed in is not a number, then the function will return 0.
-
write
^^^^^
@@ -684,6 +709,18 @@ read
If the argument *port/fn* is a string, then it specifies the name of a text file (.txt) and this function will return the data in the specified text file. If
the text file does not exist, an empty string will be returned.
+peek
+^^^^
+
+.. js:function:: peek(port)
+
+ :param number port: Port to peek. Must be an integer between 1 and 10
+
+ This function is used to peek at the data from a port. It returns the first element in the specified port
+ without removing that element. If the port is empty, the string "NULL PORT DATA" will be returned.
+
+ Read about how `Netscript Ports work here `_.
+
clear
^^^^^
@@ -697,6 +734,16 @@ clear
If the *port/fn* argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file.
+rm
+^^
+
+.. js:function:: rm(fn)
+
+ :param string fn: Filename of file to remove. Must include the extension
+ :returns: True if it successfully deletes the file, and false otherwise
+
+ Removes the specified file from the current server. This function works for every file type except message (.msg) files.
+
scriptRunning
^^^^^^^^^^^^^
diff --git a/doc/build/html/_sources/netscriptloopsandconditionals.rst.txt b/doc/build/html/_sources/netscriptloopsandconditionals.rst.txt
index 59c11280e..e47e16fd9 100644
--- a/doc/build/html/_sources/netscriptloopsandconditionals.rst.txt
+++ b/doc/build/html/_sources/netscriptloopsandconditionals.rst.txt
@@ -2,9 +2,6 @@ Netscript Loops and Conditionals
================================
-Loops and Conditionals
-----------------------
-
Netscript loops and conditionals are the same as Javascript. However, the one caveat is that when declaring variables such as the
iterator for traversing a loop, you should not use the 'var' or 'let' keyword. For reference, you can see the Javascript
documentation for loops/conditionals here:
diff --git a/doc/build/html/_sources/netscriptmisc.rst.txt b/doc/build/html/_sources/netscriptmisc.rst.txt
new file mode 100644
index 000000000..edf960583
--- /dev/null
+++ b/doc/build/html/_sources/netscriptmisc.rst.txt
@@ -0,0 +1,37 @@
+Netscript Miscellaneous
+=======================
+
+
+Comments
+--------
+Netscript supports comments using the same syntax as `Javascript comments `_.
+Comments are not evaluated as code, and can be used to document and/or explain code::
+
+ //This is a comment and will not get executed even though its in the code
+ /* Multi
+ * line
+ * comment */
+ print("This code will actually get executed");
+
+Javascript Math Module
+----------------------
+
+The `Javascript Math Module `_ is
+supported in Netscript and is used in the same way::
+
+ numThreads = Math.floor(getServerRam("foodnstuff")[1] / 3.4);
+
+Javascript Date Module
+----------------------
+
+The `Javascript Date Module `_ is supported in Netscript.
+However, since the 'new' operator does not work in Netscript, only the Date module's static functions can be used:
+
+* now()
+* UTC()
+* Parse()
+* Maybe some others I don't know about
+
+Example::
+
+ time = Date.now();
diff --git a/doc/build/html/genindex.html b/doc/build/html/genindex.html
index 41108b5ed..0d1f263e6 100644
--- a/doc/build/html/genindex.html
+++ b/doc/build/html/genindex.html
@@ -102,6 +102,8 @@
diff --git a/doc/build/html/netscript.html b/doc/build/html/netscript.html
index ddaac0436..d98bd8958 100644
--- a/doc/build/html/netscript.html
+++ b/doc/build/html/netscript.html
@@ -76,10 +76,7 @@ to reach out to the developer!
-
diff --git a/doc/build/html/netscriptfunctions.html b/doc/build/html/netscriptfunctions.html
index cd4df12a5..244698783 100644
--- a/doc/build/html/netscriptfunctions.html
+++ b/doc/build/html/netscriptfunctions.html
@@ -70,7 +70,7 @@ This includes information such as function signatures, what they do, and their r
-
Returns:
True if the hack is successful, false otherwise
+
Returns:
The amount of money stolen if the hack is successful, and zero otherwise
@@ -158,14 +158,13 @@ root access to the target server, but there is no required hacking level to run
fn (string) -- Name of function for which to disable logging
+
+
+
+
+
+
Disables logging for the given function. Logging can be disabled for
+all functions by passing 'ALL' as the argument.
+
Note that this does not completely remove all logging functionality.
+This only stops a function from logging
+when the function is successful. If the function fails, it will still log the reason for failure.
+
Notable functions that cannot have their logs disabled: run, exec, exit
@@ -544,7 +598,8 @@ is not the same as foo.script run with the argument 2, even though they
-
Kills all running scripts on the specified server. This function will always return true.
+
Kills all running scripts on the specified server. This function returns true if any scripts were killed, and
+false otherwise. In other words, it will return true if there are any scripts running on the target server.
@@ -599,13 +654,14 @@ then this function will return true if at least one of the files in the array is
@@ -1152,6 +1188,28 @@ will remove the first element from that queue and return it. If the queue is emp
the text file does not exist, an empty string will be returned.
+
port (number) -- Port to peek. Must be an integer between 1 and 10
+
+
+
+
+
+
This function is used to peek at the data from a port. It returns the first element in the specified port
+without removing that element. If the port is empty, the string "NULL PORT DATA" will be returned.
Netscript loops and conditionals are the same as Javascript. However, the one caveat is that when declaring variables such as the
iterator for traversing a loop, you should not use the 'var' or 'let' keyword. For reference, you can see the Javascript
documentation for loops/conditionals here:
@@ -86,7 +84,6 @@ Otherwise, the money available on the server will be grown using the grow() Nets
}
-
@@ -101,16 +98,14 @@ Otherwise, the money available on the server will be grown using the grow() Nets
Netscript supports comments using the same syntax as Javascript comments.
+Comments are not evaluated as code, and can be used to document and/or explain code:
+
//Thisisacommentandwillnotgetexecutedeventhoughitsinthecode
+/*Multi
+ *line
+ *comment*/
+print("This code will actually get executed");
+
The Javascript Date Module is supported in Netscript.
+However, since the 'new' operator does not work in Netscript, only the Date module's static functions can be used:
" +
@@ -4065,30 +4239,51 @@ Corporation.prototype.updateDivisionContent = function(division) {
"Size: " + office.employees.length + " / " + office.size + " employees";
if (office.employees.length >= office.size) {
industryEmployeeHireButton.className = "a-link-button-inactive";
+ industryEmployeeAutohireButton.className = "a-link-button-inactive tooltip";
} else {
industryEmployeeHireButton.className = "a-link-button";
+ industryEmployeeAutohireButton.className = "a-link-button tooltip";
}
- 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) {
- 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);
+ //Employee Overview stats
+ //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) {
+ 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);
+ if (vechain) { //VeChain - Statistics
+ industryEmployeeInfo.appendChild(createElement("br", {}));
+ industryEmployeeInfo.appendChild(createElement("p", {
+ innerText:"Material Production: " + formatNumber(division.getOfficeProductivity(office), 3),
+ tooltip: "The base amount of material this office can produce. Does not include " +
+ "production multipliers from upgrades and materials. This value is based off " +
+ "the productivity of your Operations, Engineering, and Management employees"
+ }));
+ industryEmployeeInfo.appendChild(createElement("br", {}));
+ industryEmployeeInfo.appendChild(createElement("p", {
+ innerText:"Product Production: " + formatNumber(division.getOfficeProductivity(office, {forProduct:true}), 3),
+ tooltip: "The base amount of any given Product this office can produce. Does not include " +
+ "production multipliers from upgrades and materials. This value is based off " +
+ "the productivity of your Operations, Engineering, and Management employees"
+ }));
+ industryEmployeeInfo.appendChild(createElement("br", {}));
+ industryEmployeeInfo.appendChild(createElement("p", {
+ innerText: "Business Multiplier: x" + formatNumber(division.getBusinessFactor(office), 3),
+ tooltip: "The effect this office's 'Business' employees has on boosting sales"
+ }));
}
-
//Warehouse
var warehouse = division.warehouses[currentCityUi];
@@ -4140,8 +4335,10 @@ Corporation.prototype.clearUI = function() {
industryEmployeePanel = null;
industryEmployeeText = null;
industryEmployeeHireButton = null;
+ industryEmployeeAutohireButton = null;
industryEmployeeManagementUI = null;
industryEmployeeInfo = null;
+ industryIndividualEmployeeInfo = null;
industryOfficeUpgradeSizeButton = null;
diff --git a/src/Constants.js b/src/Constants.js
index 80b3a189f..749b54534 100644
--- a/src/Constants.js
+++ b/src/Constants.js
@@ -1,5 +1,5 @@
let CONSTANTS = {
- Version: "0.34.4",
+ Version: "0.34.5",
//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
@@ -380,9 +380,9 @@ let CONSTANTS = {
"the execution of a script is when it saves/loads.
",
TutorialNetscriptText: "Netscript is a programming language implemented for this game. The language has " +
"your basic programming constructs and several built-in commands that are used to hack.
" +
+ "Check out Bitburner's official Netscript documentation" +
+ ". This official documentation will contain more details and " +
"code examples than this documentation page. Also, it can be opened up in another tab/window for convenience!
" +
"
Variables and data types
" +
"The following data types are supported by Netscript: " +
@@ -440,13 +440,10 @@ let CONSTANTS = {
"either the IP or hostname of the server you want to hack. The runtime for this command depends on your hacking level and the target server's security level. " +
" A script can hack a server from anywhere. It does not need to be running on the same server to hack that server. " +
"For example, you can create a script that hacks the 'foodnstuff' server and run that script on any server in the game. A successful hack() on " +
- "a server will raise that server's security level by 0.002. Returns true if the hack is successful and " +
- "false otherwise. " +
+ "a server will raise that server's security level by 0.002. Returns the amount of money stolen if the hack is successful and " +
+ "0 if the hack fails. " +
"Examples: hack('foodnstuff'); or hack('148.192.0.12');
" +
- "sleep(n, log=true) Suspends the script for n milliseconds. The second argument is an optional boolean that indicates " +
- "whether or not the function should log the sleep action. If this argument is true, then calling this function will write " +
- "'Sleeping for N milliseconds' to the script's logs. If it's false, then this function will not log anything. " +
- "If this argument is not specified then it will be true by default. Example: sleep(5000);
" +
+ "sleep(n) Suspends the script for n milliseconds. Example: sleep(5000);
" +
"grow(hostname/ip) Use your hacking skills to increase the amount of money available on a server. The argument passed in " +
"must be a string with either the IP or hostname of the target server. The runtime for this command depends on your hacking level and the target server's security level. " +
"When grow() completes, the money available on a target server will be increased by a certain, fixed percentage. This percentage " +
@@ -466,6 +463,13 @@ let CONSTANTS = {
"print(x) Prints a value or a variable to the scripts logs (which can be viewed with the 'tail [script]' terminal command ).
" +
"tprint(x) Prints a value or a variable to the Terminal
" +
"clearLog() Clears the script's logs.
" +
+ "disableLog(fn) Disables logging for the given function. Logging can be disabled for every function " +
+ "by passing 'ALL' as an argument.
" +
+ "Note that this does not completely remove all logging functionality. This only stops a function from logging " +
+ "when the function is successful. If the function fails, it will still log the reason for failure.
" +
+ "Notable functions that cannot have their logs disabled: run, exec, exit
" +
+ "enableLog(fn) Re-enables logging for the given function. If 'ALL' is passed into this function " +
+ "as an argument, then it will revert the effects of disableLog('ALL')
" +
"scan(hostname/ip, [hostnames=true]) Returns an array containing the hostnames or IPs of all servers that are one node away from the specified server. " +
"The argument must be a string containing the IP or hostname of the target server. The second argument is a boolean that specifies whether " +
"the hostnames or IPs of the scanned servers should be output. If it is true then hostnames will be returned, and if false then IP addresses will. " +
@@ -526,8 +530,8 @@ let CONSTANTS = {
"kill('foo.script', getHostname());
" +
"If you are trying to kill a script named 'foo.script' on the current server that was ran with the arguments 1 and 'foodnstuff', use this:
" +
- "killall(hostname/ip) Kills all running scripts on the specified server. This function takes a single argument which " +
- "must be a string containing the hostname or IP of the target server. This function will always return true.
" +
+ "killall(hostname/ip) Kills all running scripts on the specified server. This function takes a single argument which " +
+ "must be a string containing the hostname or IP of the target server. This function returns true if any scripts were killed, and false otherwise.
" +
"exit() Terminates the script immediately
" +
"scp(script, [source], destination) Copies a script or literature (.lit) file to another server. The first argument is a string with " +
"the filename of the script or literature file " +
@@ -651,7 +655,6 @@ let CONSTANTS = {
"getPurchasedServers([hostname=true]) Returns an array with either the hostname or IPs of all of the servers you " +
"have purchased. It takes an optional parameter specifying whether the hostname or IP addresses will be returned. If this " +
"parameter is not specified, it is true by default and hostnames will be returned
" +
- "round(n) Rounds the number n to the nearest integer. If the argument passed in is not a number, then the function will return 0.
" +
"write(port/fn, data='', mode='a') This function can be used to either write data to a port or to a text file (.txt).
" +
"If the first argument is a number between 1 and 10, then it specifies a port and this function will write data to a port. If the second " +
"argument is not specified then it will write an empty string to the port. The third argument, mode, is not used when writing data to a port.
" +
@@ -667,6 +670,9 @@ let CONSTANTS = {
"then the string 'NULL PORT DATA' will be returned.
" +
"If the first argument is a string, then it specifies the name of a text file and this function will return the data in the " +
"specified text file. If the text file does not exist, an empty string will be returned
" +
+ "peek(port) This function is used to peek data from a port. It returns the first element from the specified " +
+ "Netscript Port without removing that element. If the port is empty, then the string 'NULL PORT DATA' will be returned.
" +
+ "The argument must be an integer between 1 and 10.
" +
"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.
" +
@@ -1129,20 +1135,38 @@ let CONSTANTS = {
"World Stock Exchange account and TIX API Access ",
LatestUpdate:
- "v0.34.4 " +
- "-Added several new features to Gang UI to make it easier to manage your Gang. " +
- "-Changed the Gang Member upgrade mechanic. Now, rather than only being able to have " +
- "one weapon/armor/vehicle/etc., you can purchase all the upgrades for each Gang member " +
- "and their multipliers will stack. To balance this out, the effects (AKA multipliers) of each Gang member upgrade " +
- "were reduced. " +
- "-Added a new script editor option: Max Error Count. This affects how many approximate lines the script editor will " +
- "process (JSHint) for common errors. Increase this option can affect performance " +
- "-Game theme colors (set using 'theme' Terminal command) are now saved when re-opening the game " +
- "-'download' Terminal command now works on scripts " +
- "-Added stopAction() Singularity function and the spawn() Netscript function " +
- "-The 'Purchase Augmentations' UI screen will now tell you if you need a certain prerequisite for Augmentations. " +
- "-Augmentations with prerequisites can now be purchased as long as their prerequisites are puchased (" +
- "before, you had to actually install the prerequisites before being able to purchase) "
+ "v0.34.5 " +
+ "-Corporation Management Changes: " +
+ "---Market Research unlocks are now cheaper " +
+ "---New 'VeChain' upgrade: displays useful statistics about Corporation " +
+ "---Corporation cycles are processed 25% faster " +
+ "---Corporation valuation was lowered by ~10% (this affects stock price and investments) " +
+ "---Rebalanced the effects of advertising. Should now be more effective for every Industry " +
+ "---Fixed several bugs/exploits involving selling and buying back stock shares " +
+ "---You will now receive a Corporation Handbook (.lit file) when starting out BitNode-3. It contains a brief guide to help you get started. " +
+ "This same handbook can be viewed from the Corporation management screen " +
+ "---Slightly decreased the amount by which a Product's sell price can be marked up " +
+ "---Employees can now be assigned to a 'Training' task, during which they will slowly increase several of their stats " +
+ "-Hopefully fixed an exploit with Array.forEach(). If there are any issues with using forEach, let me know " +
+ "-Arguments passed into a script are now passed by value. This means modifying the 'args' array in a script " +
+ "should no longer cause issues " +
+ "-Scripts executed programatically (via run(), exec(), etc.) will now fail if null/undefined is passed in " +
+ "as an argument " +
+ "-Added peek() Netscript function " +
+ "-killall() Netscript function now returns true if any scripts were killed, and false otherwise. " +
+ "-hack() Netscript function now returns the amount of money gained for successful hacks, and 0 for failed hacks " +
+ "-scp Terminal command and Netscript function now work for txt files " +
+ "-Changes courtesy of Wraithan: " +
+ "---Text files are now displayed using 'pre' rather than 'p' elements when using the 'cat' Terminal command. " +
+ "This means tabs are retained and lines don't automatically wrap " +
+ "---ls() Netscript function now returns text files as well " +
+ "-Removed round() Netscript function, since you can just use Math.round() instead " +
+ "-Added disableLog() and enableLog() Netscript functions " +
+ "-Removed the 'log' argument from sleep(), since you can now use the new disableLog function " +
+ "-'Netscript Documentation' button on script editor now points to new readthedocs documentation rather than wiki " +
+ "-When working for a faction, your current faction reputation is now displayed " +
+ "-Bug Fix: Hacking Missions should no longer break when dragging an existing connection to another Node " +
+ "-Bug Fix: Fixed RAM usage of getNextHacknetNodeCost() (is not 1.5GB instead of 4GB) "
}
export {CONSTANTS};
diff --git a/src/HelpText.js b/src/HelpText.js
index 62d490058..fdc03aef9 100644
--- a/src/HelpText.js
+++ b/src/HelpText.js
@@ -4,7 +4,7 @@ let TerminalHelpText =
'alias [-g] [name="value"] Create or display Terminal aliases ' +
"analyze Get information about the current machine " +
"buy [-l/program] Purchase a program through the Dark Web " +
- "cat [file] Display a .msg or .lit file " +
+ "cat [file] Display a .msg, .lit, or .txt file " +
"check [script] [args...] Print a script's logs to Terminal " +
"clear Clear all text on the terminal " +
"cls See 'clear' command " +
@@ -27,7 +27,7 @@ let TerminalHelpText =
"run [name] [-t] [n] [args...] Execute a program or script " +
"scan Prints all immediately-available network connections " +
"scan-analyze [d] [-a] Prints info for all servers up to d nodes away " +
- "scp [file] [server] Copies a script or .lit file to a destination server " +
+ "scp [file] [server] Copies a file to a destination server " +
"sudov Shows whether you have root access on this computer " +
"tail [script] [args...] Displays dynamic logs for the specified script " +
"theme [preset] | bg txt hlgt Change the color scheme of the UI " +
@@ -65,10 +65,10 @@ let HelpTexts = {
"dark web to the Terminal, as well as their costs.
" +
"Otherwise, the name of the program must be passed in as a parameter. This is name is NOT case-sensitive.",
cat: "cat [file] " +
- "Display message files, which are files ending with the '.msg' extension, or a literature file, which " +
- "are files ending with the '.lit' extension. Examples:
" +
+ "Display message (.msg), literature (.lit), or text (.txt) files. Examples:
" +
"cat j1.msg " +
- "cat foo.lit",
+ "cat foo.lit " +
+ "cat servers.txt",
check: "check [script name] [args...] " +
"Print the logs of the script specified by the script name and arguments to the Terminal. Each argument must be separated by " +
"a space. Remember that a running script is uniquely " +
@@ -171,7 +171,8 @@ let HelpTexts = {
"-a flag at the end of the command if you would like to enable that.",
scp: "scp [filename] [target server] " +
"Copies the specified file from the current server to the target server. " +
- "This command only works for script files (.script extension) and literature files (.lit extension). " +
+ "This command only works for script files (.script extension), literature files (.lit extension), " +
+ "and text files (.txt extension). " +
"The second argument passed in must be the hostname or IP of the target server.",
sudov: "sudov " +
"Prints whether or not you have root access to the current machine",
diff --git a/src/Literature.js b/src/Literature.js
index 5b39b278c..92cfac4a4 100644
--- a/src/Literature.js
+++ b/src/Literature.js
@@ -41,17 +41,51 @@ function initLiterature() {
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
";
+ txt = "Getting Started with Corporations " +
+ "To get started, visit the City Hall in Sector-12 in order to create a Corporation. This requires " +
+ "$150b of your own money, but this $150b will get put into your Corporation's funds. " +
+ "After creating your Corporation, you will see it listed as one of the locations in the city. Click on " +
+ "your Corporation in order to manage it.
" +
+ "Your Corporation can have many different divisions, each in a different Industry. There are many different " +
+ "types of Industries, each with different properties. To create your first division, click the " +
+ "'Expand into new Industry' button at the top of the management UI. The Agriculture " +
+ "and Software industries are recommended for your first division.
" +
+ "The first thing you'll need to do is hire some employees. Employees can be assigned to five different positions. " +
+ "Each position has a different effect on various aspects of your Corporation. It is recommended to have at least " +
+ "one employee at each position.
" +
+ "Each industry uses some combination of Materials in order to produce other Materials and/or create Products. " +
+ "Specific information about this is displayed in each of your divisions' UI.
" +
+ "Products are special, industry-specific objects. They are different than Materials because you " +
+ "must manually choose to develop them, and you can choose to develop any number of Products. Developing " +
+ "a Product takes time, but a Product typically generates significantly more revenue than any Material. " +
+ "Not all industries allow you to create Products. To create a Product, look for a button " +
+ "in the top-left panel of the division UI (e.g. For the Software Industry, the button says 'Develop Software').
" +
+ "To get your supply chain system started, " +
+ "purchase the Materials that your industry needs to produce other Materials/Products. This can be done " +
+ "by clicking the 'Buy' button next to the corresponding Material(s). After you have the required Materials, " +
+ "you will immediately start production. The amount of Materials/Products you produce is based on a variety of factors, " +
+ "one of which is your employees and their productivity.
" +
+ "Once you start producing Materials/Products, you can sell them in order to start earning revenue. This can be done " +
+ "by clicking the 'Sell' button next to the corresponding Material or Product. The amount of Material/Product you sell is dependent " +
+ "on a wide variety of different factors.
" +
+ "These are the basics of getting your Corporation up and running! Now, you can start purchasing upgrades to improve " +
+ "your bottom line. If you need money, consider looking for seed investors, who will give you money in exchange for stock shares. " +
+ "Otherwise, once you feel you are ready, take your Corporation public! Once your Corporation goes public, you can no longer " +
+ "find investors. Instead, your Corporation will be publicly traded and its stock price will change based on how well " +
+ "it's performing financially. You can then sell your stock shares in order to make money.
" +
+ "Tips/Pointers " +
+ "-Purchasing Hardware, Robots, AI Cores, and Real Estate can potentially increase your production. " +
+ "The effects of these depend on what industry you are in.
" +
+ "-In order to optimize your production, you will need a good balance of Operators, Managers, and Engineers
" +
+ "-Different employees excel in different jobs. For example, the highly intelligent employees will probably do best " +
+ "if they are assigned to do Engineering work or Research & Development.
" +
+ "-If your employees have low morale, energy, or happiness, their production will greatly suffer.
" +
+ "-Tech is important, but don't neglect sales! Having several Businessmen can boost your sales and your bottom line.
" +
+ "-Don't forget to advertise your company. You won't have any business if nobody knows you.
" +
+ "-Having company awareness is great, but what's really important is your company's popularity. Try to keep " +
+ "your popularity as high as possible to see the biggest benefit for your sales
" +
+ "-Remember, you need to spend money to make money!
" +
+ "-Corporations do not reset when installing Augmentations, but they do reset when destroying a BitNode";
Literatures[fn] = new Literature(title, fn, txt);
title = "A Green Tomorrow";
diff --git a/src/Missions.js b/src/Missions.js
index c03d26292..c5128bff1 100644
--- a/src/Missions.js
+++ b/src/Missions.js
@@ -1162,14 +1162,16 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
var targetNode = null, def, atk;
if (nodeObj.conn) {
- var targetNode;
- if (nodeObj.conn.target) {
+ if (nodeObj.conn.target != null) {
targetNode = this.getNodeFromElement(nodeObj.conn.target);
} else {
targetNode = this.getNodeFromElement(nodeObj.conn.targetId);
}
- if (targetNode.plyrCtrl) {
+ if (targetNode == null) {
+ //Player is in the middle of dragging the connection,
+ //so the target node is null. Do nothing here
+ } else if (targetNode.plyrCtrl) {
def = this.playerDef;
atk = this.enemyAtk;
} else if (targetNode.enmyCtrl) {
@@ -1186,17 +1188,20 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
var enmyHacking = this.difficulty * CONSTANTS.HackingMissionDifficultyToHacking;
switch(nodeObj.action) {
case NodeActions.Attack:
+ if (targetNode == null) {break;}
if (nodeObj.conn == null) {break;}
var dmg = this.calculateAttackDamage(atk, def, plyr ? Player.hacking_skill : enmyHacking);
targetNode.hp -= (dmg/5 * numCycles);
break;
case NodeActions.Scan:
+ if (targetNode == null) {break;}
if (nodeObj.conn == null) {break;}
var eff = this.calculateScanEffect(atk, def, plyr ? Player.hacking_skill : enmyHacking);
targetNode.def -= (eff/5 * numCycles);
calcStats = true;
break;
case NodeActions.Weaken:
+ if (targetNode == null) {break;}
if (nodeObj.conn == null) {break;}
var eff = this.calculateWeakenEffect(atk, def, plyr ? Player.hacking_skill : enmyHacking);
targetNode.atk -= (eff/5 * numCycles);
diff --git a/src/NetscriptEnvironment.js b/src/NetscriptEnvironment.js
index 2eab117c1..e9a125766 100644
--- a/src/NetscriptEnvironment.js
+++ b/src/NetscriptEnvironment.js
@@ -75,19 +75,6 @@ Environment.prototype = {
}
return res[idx[idx.length-1]] = value;
},
- /*
- setArrayElement: function(name, idx, value) {
- var scope = this.lookup(name);
- if (!scope && this.parent) {
- console.log("Here");
- throw new Error("Undefined variable " + name);
- }
- var arr = (scope || this).vars[name];
- if (!(arr.constructor === Array || arr instanceof Array)) {
- throw new Error("Variable is not an array: " + name);
- }
- return (scope || this).vars[name][idx] = value;
- },*/
//Creates (or overwrites) a variable in the current scope
def: function(name, value) {
diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js
index 41581d905..b94de8423 100644
--- a/src/NetscriptEvaluator.js
+++ b/src/NetscriptEvaluator.js
@@ -27,7 +27,6 @@ Promise.config({
* Returns a promise
*/
function evaluate(exp, workerScript) {
- /* return new Promise(function(resolve, reject) {*/
return Promise.delay(Settings.CodeInstructionRunTime).then(function() {
var env = workerScript.env;
if (env.stopFlag) {return Promise.reject(workerScript);}
@@ -139,6 +138,13 @@ function evaluate(exp, workerScript) {
} else if (exp.callee.type == "MemberExpression"){
return evaluate(exp.callee.object, workerScript).then(function(object) {
try {
+ if (func === "NETSCRIPTFOREACH") {
+ return evaluateForeach(object, args, workerScript).then(function(res) {
+ return Promise.resolve(res);
+ }).catch(function(e) {
+ return Promise.reject(e);
+ });
+ }
var res = func.apply(object,args);
return Promise.resolve(res);
} catch (e) {
@@ -187,6 +193,9 @@ function evaluate(exp, workerScript) {
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."));
}
+ if (object != null && object instanceof Array && exp.property.name === "forEach") {
+ return "NETSCRIPTFOREACH";
+ }
try {
return Promise.resolve(object[exp.property.name])
} catch (e) {
@@ -537,35 +546,43 @@ function evaluateFor(exp, workerScript) {
}
recurse();
});
- /*
- return evaluate(exp.test, workerScript).then(function(resCond) {
- if (resCond) {
- //Execute code (body), update, and then recurse
- return evaluate(exp.body, workerScript).then(function(resCode) {
- return evaluate(exp.update, workerScript);
- }).catch(function(e) {
- if (e == "CONTINUESTATEMENT" ||
- (e instanceof WorkerScript && e.errorMessage == "CONTINUESTATEMENT")) {
- //Continue statement, recurse to next iteration
- return evaluate(exp.update, workerScript).then(function(resPostloop) {
- return evaluateFor(exp, workerScript);
- }).then(function(foo) {
- return Promise.resolve("endForLoop");
- }).catch(function(e) {
- return Promise.reject(e);
- });
- } else {
- return Promise.reject(e);
- }
- }).then(function(resPostloop) {
- return evaluateFor(exp, workerScript);
- }).then(function(foo) {
- return Promise.resolve("endForLoop");
- });
- } else {
- return Promise.resolve("endForLoop"); //Doesn't need to resolve to any particular value
+}
+
+function evaluateForeach(arr, args, workerScript) {
+ console.log("evaluateForeach called");
+ if (!(arr instanceof Array)) {
+ return Promise.reject("Invalid array passed into forEach");
+ }
+ if (!(args instanceof Array) && args.length != 1) {
+ return Promise.reject("Invalid argument passed into forEach");
+ }
+ var func = args[0];
+ if (typeof func !== "function") {
+ return Promise.reject("Invalid function passed into forEach");
+ }
+ console.log(func);
+ return new Promise(function(resolve, reject) {
+ //Don't return a promise so the promise chain is broken on each recursion
+ function recurse(i) {
+ console.log("recurse() called with i: " + i);
+ if (i >= arr.length) {
+ resolve();
+ } else {
+ return Promise.delay(Settings.CodeInstructionRunTime).then(function() {
+ console.log("About to apply function");
+ var res = func.apply(null, [arr[i]]);
+ console.log("Applied function");
+ ++i;
+ Promise.resolve(res).then(function(val) {
+ recurse(i);
+ }, reject).catch(function(e) {
+ return Promise.reject(e);
+ });
+ });
+ }
}
- });*/
+ recurse(0);
+ });
}
function evaluateWhile(exp, workerScript) {
@@ -703,6 +720,14 @@ function runScriptFromScript(server, scriptname, args, workerScript, threads=1)
return Promise.resolve(false);
}
+ //'null/undefined' arguments are not allowed
+ for (var i = 0; i < args.length; ++i) {
+ if (args[i] == null) {
+ workerScript.scriptRef.log("ERROR: Cannot execute a script with null/undefined as an argument");
+ return Promise.resolve(false);
+ }
+ }
+
//Check if the script exists and if it does run it
for (var i = 0; i < server.scripts.length; ++i) {
if (server.scripts[i].filename == scriptname) {
diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js
index 9fde02dae..3cb247c73 100644
--- a/src/NetscriptFunctions.js
+++ b/src/NetscriptFunctions.js
@@ -128,7 +128,9 @@ function NetscriptFunctions(workerScript) {
}
out.push(entry);
}
- workerScript.scriptRef.log('scan() returned ' + server.serversOnNetwork.length + ' connections for ' + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scan == null) {
+ workerScript.scriptRef.log('scan() returned ' + server.serversOnNetwork.length + ' connections for ' + server.hostname);
+ }
return out;
},
hack : function(ip){
@@ -165,8 +167,9 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "Cannot hack this server (" + server.hostname + ") because user's hacking skill is not high enough");
}
- workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds (t=" + threads + ")");
- //console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds (t=" + threads + ")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {
+ workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds (t=" + threads + ")");
+ }
return netscriptDelay(hackingTime* 1000, workerScript).then(function() {
if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
var hackChance = scriptCalculateHackingChance(server);
@@ -192,26 +195,28 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);
Player.gainHackingExp(expGainedOnSuccess);
workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
- //console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
- workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp (t=" + threads + ")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {
+ workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp (t=" + threads + ")");
+ }
server.fortify(CONSTANTS.ServerFortifyAmount * threads);
- return Promise.resolve(true);
+ return Promise.resolve(moneyGained);
} else {
- //Player only gains 25% exp for failure? TODO Can change this later to balance
+ //Player only gains 25% exp for failure?
Player.gainHackingExp(expGainedOnFailure);
workerScript.scriptRef.onlineExpGained += expGainedOnFailure;
- //console.log("Script unsuccessful to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp");
- workerScript.scriptRef.log("Script FAILED to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp (t=" + threads + ")");
- return Promise.resolve(false);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {
+ workerScript.scriptRef.log("Script FAILED to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp (t=" + threads + ")");
+ }
+ return Promise.resolve(0);
}
});
},
- sleep : function(time,log=true){
+ sleep : function(time){
if (workerScript.checkingRam) {return 0;}
if (time === undefined) {
throw makeRuntimeRejectMsg(workerScript, "sleep() call has incorrect number of arguments. Takes 1 argument");
}
- if (log) {
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sleep == null) {
workerScript.scriptRef.log("Sleeping for " + time + " milliseconds");
}
return netscriptDelay(time, workerScript).then(function() {
@@ -245,8 +250,9 @@ function NetscriptFunctions(workerScript) {
}
var growTime = scriptCalculateGrowTime(server);
- //console.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds")
- workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds (t=" + threads + ")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.grow == null) {
+ workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds (t=" + threads + ")");
+ }
return netscriptDelay(growTime, workerScript).then(function() {
if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
server.moneyAvailable += (1 * threads); //It can be grown even if it has no money
@@ -256,9 +262,11 @@ function NetscriptFunctions(workerScript) {
if (growthPercentage == 1) {
expGain = 0;
}
- workerScript.scriptRef.log("Available money on " + server.hostname + " grown by "
- + formatNumber(growthPercentage*100 - 100, 6) + "%. Gained " +
- formatNumber(expGain, 4) + " hacking exp (t=" + threads +")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.grow == null) {
+ workerScript.scriptRef.log("Available money on " + server.hostname + " grown by " +
+ formatNumber(growthPercentage*100 - 100, 6) + "%. Gained " +
+ formatNumber(expGain, 4) + " hacking exp (t=" + threads +")");
+ }
workerScript.scriptRef.onlineExpGained += expGain;
Player.gainHackingExp(expGain);
return Promise.resolve(growthPercentage);
@@ -291,15 +299,19 @@ function NetscriptFunctions(workerScript) {
}
var weakenTime = scriptCalculateWeakenTime(server);
- workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " +
- formatNumber(weakenTime/1000, 3) + " seconds (t=" + threads + ")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.weaken == null) {
+ workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " +
+ formatNumber(weakenTime/1000, 3) + " seconds (t=" + threads + ")");
+ }
return netscriptDelay(weakenTime, workerScript).then(function() {
if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
server.weaken(CONSTANTS.ServerWeakenAmount * threads);
workerScript.scriptRef.recordWeaken(server.ip, threads);
var expGain = scriptCalculateExpGain(server) * threads;
- workerScript.scriptRef.log("Server security level on " + server.hostname + " weakened to " + server.hackDifficulty +
- ". Gained " + formatNumber(expGain, 4) + " hacking exp (t=" + threads + ")");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.weaken == null) {
+ workerScript.scriptRef.log("Server security level on " + server.hostname + " weakened to " + server.hackDifficulty +
+ ". Gained " + formatNumber(expGain, 4) + " hacking exp (t=" + threads + ")");
+ }
workerScript.scriptRef.onlineExpGained += expGain;
Player.gainHackingExp(expGain);
return Promise.resolve(CONSTANTS.ServerWeakenAmount * threads);
@@ -331,6 +343,16 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {return 0;}
workerScript.scriptRef.clearLog();
},
+ disableLog : function(fn) {
+ if (workerScript.checkingRam) {return 0;}
+ workerScript.disableLogs[fn] = true;
+ workerScript.scriptRef.log("Disabled logging for " + fn);
+ },
+ enableLog : function(fn) {
+ if (workerScript.checkingRam) {return 0;}
+ delete workerScript.disableLogs[fn];
+ workerScript.scriptRef.log("Enabled logging for " + fn);
+ },
nuke : function(ip){
if (workerScript.checkingRam) {
if (workerScript.loadedFns.nuke) {
@@ -355,10 +377,14 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "Not enough ports opened to use NUKE.exe virus");
}
if (server.hasAdminRights) {
- workerScript.scriptRef.log("Already have root access to " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.nuke == null) {
+ workerScript.scriptRef.log("Already have root access to " + server.hostname);
+ }
} else {
server.hasAdminRights = true;
- workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.nuke == null) {
+ workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access");
+ }
}
return true;
},
@@ -384,11 +410,15 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "You do not have the BruteSSH.exe program!");
}
if (!server.sshPortOpen) {
- workerScript.scriptRef.log("Executed BruteSSH.exe on " + server.hostname + " to open SSH port (22)");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.brutessh == null) {
+ workerScript.scriptRef.log("Executed BruteSSH.exe on " + server.hostname + " to open SSH port (22)");
+ }
server.sshPortOpen = true;
++server.openPortCount;
} else {
- workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.brutessh == null) {
+ workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname);
+ }
}
return true;
},
@@ -413,11 +443,15 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "You do not have the FTPCrack.exe program!");
}
if (!server.ftpPortOpen) {
- workerScript.scriptRef.log("Executed FTPCrack.exe on " + server.hostname + " to open FTP port (21)");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.ftpcrack == null) {
+ workerScript.scriptRef.log("Executed FTPCrack.exe on " + server.hostname + " to open FTP port (21)");
+ }
server.ftpPortOpen = true;
++server.openPortCount;
} else {
- workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.ftpcrack == null) {
+ workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname);
+ }
}
return true;
},
@@ -442,11 +476,15 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "You do not have the relaySMTP.exe program!");
}
if (!server.smtpPortOpen) {
- workerScript.scriptRef.log("Executed relaySMTP.exe on " + server.hostname + " to open SMTP port (25)");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.relaysmtp == null) {
+ workerScript.scriptRef.log("Executed relaySMTP.exe on " + server.hostname + " to open SMTP port (25)");
+ }
server.smtpPortOpen = true;
++server.openPortCount;
} else {
- workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.relaysmtp == null) {
+ workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname);
+ }
}
return true;
},
@@ -471,11 +509,15 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "You do not have the HTTPWorm.exe program!");
}
if (!server.httpPortOpen) {
- workerScript.scriptRef.log("Executed HTTPWorm.exe on " + server.hostname + " to open HTTP port (80)");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.httpworm == null) {
+ workerScript.scriptRef.log("Executed HTTPWorm.exe on " + server.hostname + " to open HTTP port (80)");
+ }
server.httpPortOpen = true;
++server.openPortCount;
} else {
- workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.httpworm == null) {
+ workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname);
+ }
}
return true;
},
@@ -500,11 +542,15 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "You do not have the SQLInject.exe program!");
}
if (!server.sqlPortOpen) {
- workerScript.scriptRef.log("Executed SQLInject.exe on " + server.hostname + " to open SQL port (1433)");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sqlinject == null) {
+ workerScript.scriptRef.log("Executed SQLInject.exe on " + server.hostname + " to open SQL port (1433)");
+ }
server.sqlPortOpen = true;
++server.openPortCount;
} else {
- workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sqlinject == null) {
+ workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname);
+ }
}
return true;
},
@@ -574,7 +620,9 @@ function NetscriptFunctions(workerScript) {
setTimeout(()=>{
NetscriptFunctions(workerScript).run.apply(this, arguments);
}, 20000);
- workerScript.scriptRef.log("spawn() will execute " + scriptname + " in 20 seconds");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.spawn == null) {
+ workerScript.scriptRef.log("spawn() will execute " + scriptname + " in 20 seconds");
+ }
NetscriptFunctions(workerScript).exit();
},
kill : function(filename,ip) {
@@ -606,10 +654,14 @@ function NetscriptFunctions(workerScript) {
}
var res = killWorkerScript(runningScriptObj, server.ip);
if (res) {
- workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + printArray(argsForKillTarget) + ". May take up to a few minutes for the scripts to die...");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.kill == null) {
+ workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + 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: " + printArray(argsForKillTarget));
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.kill == null) {
+ workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + printArray(argsForKillTarget));
+ }
return false;
}
},
@@ -631,11 +683,14 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("killall() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "killall() failed. Invalid IP or hostname passed in: " + ip);
}
+ var scriptsRunning = (server.runningScripts.length > 0);
for (var i = server.runningScripts.length-1; i >= 0; --i) {
killWorkerScript(server.runningScripts[i], server.ip);
}
- workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die");
- return true;
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.killall == null) {
+ workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die");
+ }
+ return scriptsRunning;
},
exit : function() {
if (workerScript.checkingRam) {
@@ -678,8 +733,9 @@ function NetscriptFunctions(workerScript) {
});
return res;
}
- if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) {
- throw makeRuntimeRejectMsg(workerScript, "Error: scp() only works for .script and .lit files");
+ if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script") &&
+ !scriptname.endsWith("txt")) {
+ throw makeRuntimeRejectMsg(workerScript, "Error: scp() does not work with this file type. It only works for .script, .lit, and .txt files");
}
var destServer, currServ;
@@ -718,6 +774,7 @@ function NetscriptFunctions(workerScript) {
for (var i = 0; i < currServ.messages.length; ++i) {
if (!(currServ.messages[i] instanceof Message) && currServ.messages[i] == scriptname) {
found = true;
+ break;
}
}
@@ -728,12 +785,50 @@ function NetscriptFunctions(workerScript) {
for (var i = 0; i < destServer.messages.length; ++i) {
if (destServer.messages[i] === scriptname) {
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ }
return true; //Already exists
}
}
destServer.messages.push(scriptname);
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ }
+ return true;
+ }
+
+ //Scp for text files
+ if (scriptname.endsWith(".txt")) {
+ var found = false, txtFile;
+ for (var i = 0; i < currServ.textFiles.length; ++i) {
+ if (currServ.textFiles[i].fn === scriptname) {
+ found = true;
+ txtFile = currServ.textFiles[i];
+ break;
+ }
+ }
+
+ if (!found) {
+ workerScript.scriptRef.log(scriptname + " does not exist. scp() failed");
+ return false;
+ }
+
+ for (var i = 0; i < destServer.textFiles.length; ++i) {
+ if (destServer.textFiles[i].fn === scriptname) {
+ //Overwrite
+ destServer.textFiles[i].text = txtFile.text;
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ }
+ return true;
+ }
+ }
+ var newFile = new TextFile(txtFile.fn, txtFile.text);
+ destServer.textFiles.push(newFile);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ }
return true;
}
@@ -753,8 +848,10 @@ function NetscriptFunctions(workerScript) {
//Overwrite script if it already exists
for (var i = 0; i < destServer.scripts.length; ++i) {
if (scriptname == destServer.scripts[i].filename) {
- workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten.");
- workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten.");
+ workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname);
+ }
var oldScript = destServer.scripts[i];
oldScript.code = sourceScript.code;
oldScript.ramUsage = sourceScript.ramUsage;
@@ -769,7 +866,9 @@ function NetscriptFunctions(workerScript) {
newScript.ramUsage = sourceScript.ramUsage;
newScript.server = destServer.ip;
destServer.scripts.push(newScript);
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ }
return true;
},
ls : function(ip, grep) {
@@ -834,6 +933,16 @@ function NetscriptFunctions(workerScript) {
}
}
+ for (var i = 0; i < server.textFiles.length; i++) {
+ if (filter) {
+ if (server.textFiles[i].fn.includes(filter)) {
+ allFiles.push(server.textFiles[i].fn);
+ }
+ } else {
+ allFiles.push(server.textFiles[i].fn);
+ }
+ }
+
//Sort the files alphabetically then print each
allFiles.sort();
return allFiles;
@@ -897,7 +1006,9 @@ function NetscriptFunctions(workerScript) {
}
}
Player.updateSkillLevels();
- workerScript.scriptRef.log("getHackingLevel() returned " + Player.hacking_skill);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getHackingLevel == null) {
+ workerScript.scriptRef.log("getHackingLevel() returned " + Player.hacking_skill);
+ }
return Player.hacking_skill;
},
getHackingMultipliers : function() {
@@ -946,10 +1057,14 @@ function NetscriptFunctions(workerScript) {
}
if (server.hostname == "home") {
//Return player's money
- workerScript.scriptRef.log("getServerMoneyAvailable('home') returned player's money: $" + formatNumber(Player.money.toNumber(), 2));
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMoneyAvailable == null) {
+ workerScript.scriptRef.log("getServerMoneyAvailable('home') returned player's money: $" + formatNumber(Player.money.toNumber(), 2));
+ }
return Player.money.toNumber();
}
- workerScript.scriptRef.log("getServerMoneyAvailable() returned " + formatNumber(server.moneyAvailable, 2) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMoneyAvailable == null) {
+ workerScript.scriptRef.log("getServerMoneyAvailable() returned " + formatNumber(server.moneyAvailable, 2) + " for " + server.hostname);
+ }
return server.moneyAvailable;
},
getServerSecurityLevel : function(ip){
@@ -966,7 +1081,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerSecurityLevel() returned " + formatNumber(server.hackDifficulty, 3) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerSecurityLevel == null) {
+ workerScript.scriptRef.log("getServerSecurityLevel() returned " + formatNumber(server.hackDifficulty, 3) + " for " + server.hostname);
+ }
return server.hackDifficulty;
},
getServerBaseSecurityLevel : function(ip){
@@ -983,7 +1100,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + formatNumber(server.baseDifficulty, 3) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerBaseSecurityLevel == null) {
+ workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + formatNumber(server.baseDifficulty, 3) + " for " + server.hostname);
+ }
return server.baseDifficulty;
},
getServerMinSecurityLevel : function(ip) {
@@ -1000,7 +1119,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + formatNumber(server.minDifficulty, 3) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMinSecurityLevel == null) {
+ workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + formatNumber(server.minDifficulty, 3) + " for " + server.hostname);
+ }
return server.minDifficulty;
},
getServerRequiredHackingLevel : function(ip) {
@@ -1017,7 +1138,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + formatNumber(server.requiredHackingSkill, 0) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerRequiredHackingLevel == null) {
+ workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + formatNumber(server.requiredHackingSkill, 0) + " for " + server.hostname);
+ }
return server.requiredHackingSkill;
},
getServerMaxMoney : function(ip){
@@ -1034,7 +1157,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerMaxMoney() returned " + formatNumber(server.moneyMax, 0) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMaxMoney == null) {
+ workerScript.scriptRef.log("getServerMaxMoney() returned " + formatNumber(server.moneyMax, 0) + " for " + server.hostname);
+ }
return server.moneyMax;
},
getServerGrowth : function(ip) {
@@ -1051,7 +1176,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerGrowth() returned " + formatNumber(server.serverGrowth, 0) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerGrowth == null) {
+ workerScript.scriptRef.log("getServerGrowth() returned " + formatNumber(server.serverGrowth, 0) + " for " + server.hostname);
+ }
return server.serverGrowth;
},
getServerNumPortsRequired : function(ip) {
@@ -1068,7 +1195,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerNumPortsRequired() returned " + formatNumber(server.numOpenPortsRequired, 0) + " for " + server.hostname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerNumPortsRequired == null) {
+ workerScript.scriptRef.log("getServerNumPortsRequired() returned " + formatNumber(server.numOpenPortsRequired, 0) + " for " + server.hostname);
+ }
return server.numOpenPortsRequired;
},
getServerRam : function(ip) {
@@ -1085,7 +1214,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerRam() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerRam() failed. Invalid IP or hostname passed in: " + ip);
}
- workerScript.scriptRef.log("getServerRam() returned [" + formatNumber(server.maxRam, 2) + "GB, " + formatNumber(server.ramUsed, 2) + "GB]");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerRam == null) {
+ workerScript.scriptRef.log("getServerRam() returned [" + formatNumber(server.maxRam, 2) + "GB, " + formatNumber(server.ramUsed, 2) + "GB]");
+ }
return [server.maxRam, server.ramUsed];
},
serverExists : function(ip) {
@@ -1167,7 +1298,7 @@ function NetscriptFunctions(workerScript) {
return 0;
} else {
workerScript.loadedFns.getNextHacknetNodeCost = true;
- return CONSTANTS.ScriptHacknetNodesRamCost;
+ return CONSTANTS.ScriptPurchaseHacknetRamCost;
}
}
return getCostOfNextHacknetNode();
@@ -1259,8 +1390,10 @@ function NetscriptFunctions(workerScript) {
if (Engine.currentPage == Engine.Page.StockMarket) {
updateStockPlayerPosition(stock);
}
- workerScript.scriptRef.log("Bought " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at $" +
- formatNumber(stock.price, 2) + " per share");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.buyStock == null) {
+ workerScript.scriptRef.log("Bought " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at $" +
+ formatNumber(stock.price, 2) + " per share");
+ }
return stock.price;
},
sellStock : function(symbol, shares) {
@@ -1302,9 +1435,11 @@ function NetscriptFunctions(workerScript) {
if (Engine.currentPage == Engine.Page.StockMarket) {
updateStockPlayerPosition(stock);
}
- workerScript.scriptRef.log("Sold " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at $" +
- formatNumber(stock.price, 2) + " per share. Gained " +
- "$" + formatNumber(gains, 2));
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sellStock == null) {
+ workerScript.scriptRef.log("Sold " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at $" +
+ formatNumber(stock.price, 2) + " per share. Gained " +
+ "$" + formatNumber(gains, 2));
+ }
return stock.price;
},
shortStock(symbol, shares) {
@@ -1497,7 +1632,9 @@ function NetscriptFunctions(workerScript) {
homeComputer.serversOnNetwork.push(newServ.ip);
newServ.serversOnNetwork.push(homeComputer.ip);
Player.loseMoney(cost);
- workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + formatNumber(cost, 2));
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseServer == null) {
+ workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + formatNumber(cost, 2));
+ }
return newServ.hostname;
},
deleteServer : function(hostname) {
@@ -1562,7 +1699,9 @@ function NetscriptFunctions(workerScript) {
for (var i = 0; i < homeComputer.serversOnNetwork.length; ++i) {
if (ip == homeComputer.serversOnNetwork[i]) {
homeComputer.serversOnNetwork.splice(i, 1);
- workerScript.scriptRef.log("Deleted server " + hostnameStr);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.deleteServer == null) {
+ workerScript.scriptRef.log("Deleted server " + hostnameStr);
+ }
return true;
}
}
@@ -1594,10 +1733,6 @@ function NetscriptFunctions(workerScript) {
});
return res;
},
- round : function(n) {
- if (isNaN(n)) {return 0;}
- return Math.round(n);
- },
write : function(port, data="", mode="a") {
if (workerScript.checkingRam) {
if (workerScript.loadedFns.write) {
@@ -1663,7 +1798,7 @@ function NetscriptFunctions(workerScript) {
if (port == null) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Could not find port: " + port + ". This is a bug contact the game developer");
}
- if (port.length == 0) {
+ if (port.length === 0) {
return "NULL PORT DATA";
} else {
return port.shift();
@@ -1684,6 +1819,30 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "Invalid argument passed in for read(): " + port);
}
},
+ peek : function(port) {
+ if (workerScript.checkingRam) {
+ if (workerScript.loadedFns.peek) {
+ return 0;
+ } else {
+ workerScript.loadedFns.peek = true;
+ return CONSTANTS.ScriptReadWriteRamCost;
+ }
+ }
+ if (isNaN(port) || port < 1 || port > 10) {
+ throw makeRuntimeRejectMsg(workerScript, "ERR: peek() called with invalid argument. Must be a port number between 1 and 10");
+ }
+ var portName = "Port" + String(port);
+ var port = NetscriptPorts[portName];
+ if (port == null) {
+ throw makeRuntimeRejectMsg(workerScript, "ERR: Could not find port: " + port + ". This is a bug contact the game developer");
+ }
+ if (port.length === 0) {
+ return "NULL PORT DATA";
+ } else {
+ var foo = port.slice();
+ return foo[0];
+ }
+ },
clear : function(port) {
if (workerScript.checkingRam) {
if (workerScript.loadedFns.clear) {
@@ -2010,7 +2169,9 @@ function NetscriptFunctions(workerScript) {
}
if (Player.isWorking) {
var txt = Player.singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.universityCourse == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
var costMult, expMult;
@@ -2072,7 +2233,9 @@ function NetscriptFunctions(workerScript) {
return false;
}
Player.startClass(costMult, expMult, task);
- workerScript.scriptRef.log("Started " + task + " at " + universityName);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.universityCourse == null) {
+ workerScript.scriptRef.log("Started " + task + " at " + universityName);
+ }
return true;
},
@@ -2099,7 +2262,9 @@ function NetscriptFunctions(workerScript) {
}
if (Player.isWorking) {
var txt = Player.singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.gymWorkout == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
var costMult, expMult;
switch(gymName.toLowerCase()) {
@@ -2174,7 +2339,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("Invalid stat: " + stat + ". gymWorkout() failed");
return false;
}
- workerScript.scriptRef.log("Started training " + stat + " at " + gymName);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.gymWorkout == null) {
+ workerScript.scriptRef.log("Started training " + stat + " at " + gymName);
+ }
return true;
},
@@ -2206,7 +2373,9 @@ function NetscriptFunctions(workerScript) {
Player.loseMoney(200000);
Player.city = cityname;
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("Traveled to " + cityname);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.travelToCity == null) {
+ workerScript.scriptRef.log("Traveled to " + cityname);
+ }
return true;
default:
workerScript.scriptRef.log("ERROR: Invalid city name passed into travelToCity().");
@@ -2252,7 +2421,9 @@ function NetscriptFunctions(workerScript) {
Player.getHomeComputer().serversOnNetwork.push(darkweb.ip);
darkweb.serversOnNetwork.push(Player.getHomeComputer().ip);
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("You have purchased a Tor router!");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseTor == null) {
+ workerScript.scriptRef.log("You have purchased a Tor router!");
+ }
return true;
},
purchaseProgram(programName) {
@@ -2284,8 +2455,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.BruteSSHProgram);
- workerScript.scriptRef.log("You have purchased the BruteSSH.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the BruteSSH.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -2296,8 +2468,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.FTPCrackProgram);
- workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -2308,8 +2481,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.RelaySMTPProgram);
- workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -2320,8 +2494,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.HTTPWormProgram);
- workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -2332,8 +2507,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.SQLInjectProgram);
- workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -2344,8 +2520,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.DeepscanV1);
- workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -2356,8 +2533,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.DeepscanV2);
- workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program " +
- "can be found on your home computer.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
+ workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program can be found on your home computer.");
+ }
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@@ -2429,7 +2607,9 @@ function NetscriptFunctions(workerScript) {
}
if (Player.isWorking) {
var txt = Player.singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.stopAction == null) {
+ workerScript.scriptRef.log(txt);
+ }
return true;
}
return false;
@@ -2473,7 +2653,9 @@ function NetscriptFunctions(workerScript) {
Player.loseMoney(cost);
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.upgradeHomeRam == null) {
+ workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
+ }
return true;
},
getUpgradeHomeRamCost() {
@@ -2534,7 +2716,9 @@ function NetscriptFunctions(workerScript) {
if (Player.isWorking) {
var txt = Player.singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForCompany == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
if (Player.companyPosition.isPartTimeJob()) {
@@ -2542,7 +2726,9 @@ function NetscriptFunctions(workerScript) {
} else {
Player.startWork();
}
- workerScript.scriptRef.log("Began working at " + Player.companyName + " as a " + Player.companyPosition.positionName);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForCompany == null) {
+ workerScript.scriptRef.log("Began working at " + Player.companyName + " as a " + Player.companyPosition.positionName);
+ }
return true;
},
applyToCompany(companyName, field) {
@@ -2620,9 +2806,13 @@ function NetscriptFunctions(workerScript) {
return false;
}
if (res) {
- workerScript.scriptRef.log("You were offered a new job at " + companyName + " as a " + Player.companyPosition.positionName);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.applyToCompany == null) {
+ workerScript.scriptRef.log("You were offered a new job at " + companyName + " as a " + Player.companyPosition.positionName);
+ }
} else {
- workerScript.scriptRef.log("You failed to get a new job/promotion at " + companyName + " in the " + field + " field.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.applyToCompany == null) {
+ workerScript.scriptRef.log("You failed to get a new job/promotion at " + companyName + " in the " + field + " field.");
+ }
}
return res;
},
@@ -2709,7 +2899,9 @@ function NetscriptFunctions(workerScript) {
var fac = Factions[name];
joinFaction(fac);
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("Joined the " + name + " faction.");
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.joinFaction == null) {
+ workerScript.scriptRef.log("Joined the " + name + " faction.");
+ }
return true;
},
workForFaction(name, type) {
@@ -2747,7 +2939,9 @@ function NetscriptFunctions(workerScript) {
if (Player.isWorking) {
var txt = Player.singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForFaction == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
var fac = Factions[name];
@@ -2856,7 +3050,9 @@ function NetscriptFunctions(workerScript) {
}
if (Player.isWorking) {
var txt = Player.singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.createProgram == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
switch(name.toLowerCase()) {
@@ -2956,7 +3152,9 @@ function NetscriptFunctions(workerScript) {
}
if (Player.isWorking) {
var txt = Player.singularityStopWork();
- workerScript.scriptRef.log(txt);
+ if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.commitCrime == null) {
+ workerScript.scriptRef.log(txt);
+ }
}
//Set Location to slums
diff --git a/src/NetscriptWorker.js b/src/NetscriptWorker.js
index 4466b46f5..0729f0304 100644
--- a/src/NetscriptWorker.js
+++ b/src/NetscriptWorker.js
@@ -19,16 +19,17 @@ function WorkerScript(runningScriptObj) {
this.serverIp = null;
this.code = runningScriptObj.scriptRef.code;
this.env = new Environment(this);
- this.env.set("args", runningScriptObj.args);
+ this.env.set("args", runningScriptObj.args.slice());
this.output = "";
this.ramUsage = 0;
this.scriptRef = runningScriptObj;
this.errorMessage = "";
- this.args = runningScriptObj.args;
+ this.args = runningScriptObj.args.slice();
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
+ this.disableLogs = {}; //Stores names of fns that should have logs disabled
}
//Returns the server on which the workerScript is running
diff --git a/src/Player.js b/src/Player.js
index 571d97964..86ed0cd46 100644
--- a/src/Player.js
+++ b/src/Player.js
@@ -1069,8 +1069,9 @@ PlayerObject.prototype.workForFaction = function(numCycles) {
}
var txt = document.getElementById("work-in-progress-text");
- txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name + "." +
- " You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "
" +
+ txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name +
+ " (Current Faction Reputation: " + formatNumber(faction.playerReputation, 0) + "). " +
+ "You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "