mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-09 17:23:53 +01:00
Merged pull requests and fixed merge conflicts
This commit is contained in:
commit
bbb5f04c87
442
dist/engine.bundle.js
vendored
442
dist/engine.bundle.js
vendored
@ -499,6 +499,18 @@ PlayerObject.prototype.getHomeComputer = function() {
|
||||
return _Server_js__WEBPACK_IMPORTED_MODULE_12__["AllServers"][this.homeComputer];
|
||||
}
|
||||
|
||||
PlayerObject.prototype.getUpgradeHomeRamCost = function() {
|
||||
//Calculate how many times ram has been upgraded (doubled)
|
||||
const currentRam = Player.getHomeComputer().maxRam;
|
||||
const numUpgrades = Math.log2(currentRam);
|
||||
|
||||
//Calculate cost
|
||||
//Have cost increase by some percentage each time RAM has been upgraded
|
||||
const mult = Math.pow(1.58, numUpgrades);
|
||||
var cost = currentRam * _Constants_js__WEBPACK_IMPORTED_MODULE_3__["CONSTANTS"].BaseCostFor1GBOfRamHome * mult;
|
||||
return cost;
|
||||
}
|
||||
|
||||
//Calculates skill level based on experience. The same formula will be used for every skill
|
||||
PlayerObject.prototype.calculateSkill = function(exp) {
|
||||
return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);
|
||||
@ -3416,6 +3428,8 @@ let CONSTANTS = {
|
||||
|
||||
LatestUpdate:
|
||||
"v0.37.3<br>" +
|
||||
"* New BitNode: BN-7 Bladeburner 2079<br>" +
|
||||
"* New BitNode: BN-12 The Recursion<br>" +
|
||||
"* Bladeburner Changes:<br>" +
|
||||
"*** Bladeburner progress is no longer reset when installing Augmentations<br>" +
|
||||
"*** The number of successess needed to increase a Contract/Operation's max level now scales with the current max level (gradually gets harder)<br>" +
|
||||
@ -5218,16 +5232,8 @@ function initLocationButtons() {
|
||||
});
|
||||
|
||||
purchaseHomeRam.addEventListener("click", function() {
|
||||
//Calculate how many times ram has been upgraded (doubled)
|
||||
var currentRam = _Player_js__WEBPACK_IMPORTED_MODULE_8__["Player"].getHomeComputer().maxRam;
|
||||
var newRam = currentRam * 2;
|
||||
var numUpgrades = Math.log2(currentRam);
|
||||
|
||||
//Calculate cost
|
||||
//Have cost increase by some percentage each time RAM has been upgraded
|
||||
var cost = currentRam * _Constants_js__WEBPACK_IMPORTED_MODULE_3__["CONSTANTS"].BaseCostFor1GBOfRamHome;
|
||||
var mult = Math.pow(1.58, numUpgrades);
|
||||
cost = cost * mult;
|
||||
const cost = _Player_js__WEBPACK_IMPORTED_MODULE_8__["Player"].getUpgradeHomeRamCost();
|
||||
const ram = _Player_js__WEBPACK_IMPORTED_MODULE_8__["Player"].getHomeComputer().maxRam;
|
||||
|
||||
var yesBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_17__["yesNoBoxGetYesButton"])(), noBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_17__["yesNoBoxGetNoButton"])();
|
||||
yesBtn.innerHTML = "Purchase"; noBtn.innerHTML = "Cancel";
|
||||
@ -5239,8 +5245,8 @@ function initLocationButtons() {
|
||||
Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_17__["yesNoBoxClose"])();
|
||||
});
|
||||
Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_17__["yesNoBoxCreate"])("Would you like to purchase additional RAM for your home computer? <br><br>" +
|
||||
"This will upgrade your RAM from " + currentRam + "GB to " + newRam + "GB. <br><br>" +
|
||||
"This will cost $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_16__["formatNumber"])(cost, 2));
|
||||
"This will upgrade your RAM from " + ram + "GB to " + ram*2 + "GB. <br><br>" +
|
||||
"This will cost " + numeral_min_numeral_min__WEBPACK_IMPORTED_MODULE_15___default()(cost).format('$0.000a'));
|
||||
});
|
||||
|
||||
purchaseHomeCores.addEventListener("click", function() {
|
||||
@ -5666,7 +5672,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _Augmentations_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Augmentations.js */ 19);
|
||||
/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./BitNode.js */ 15);
|
||||
/* harmony import */ var _Bladeburner_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Bladeburner.js */ 26);
|
||||
/* harmony import */ var _CinematicText_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./CinematicText.js */ 69);
|
||||
/* harmony import */ var _CinematicText_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./CinematicText.js */ 68);
|
||||
/* harmony import */ var _Company_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Company.js */ 9);
|
||||
/* harmony import */ var _CompanyManagement_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./CompanyManagement.js */ 41);
|
||||
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Constants.js */ 3);
|
||||
@ -7476,7 +7482,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitNode.js */ 15);
|
||||
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants.js */ 3);
|
||||
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Player.js */ 0);
|
||||
/* harmony import */ var _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NetscriptEnvironment.js */ 68);
|
||||
/* harmony import */ var _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NetscriptEnvironment.js */ 67);
|
||||
/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NetscriptWorker.js */ 20);
|
||||
/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Server.js */ 10);
|
||||
/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Settings.js */ 22);
|
||||
@ -10923,14 +10929,14 @@ function displayFactionContent(factionName) {
|
||||
favorGain = favorGain[0];
|
||||
elements.push(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["createElement"])("p", {
|
||||
innerText: "Reputation: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_14__["formatNumber"])(faction.playerReputation, 4),
|
||||
tooltip:"You will earn " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_14__["formatNumber"])(favorGain, 4) +
|
||||
tooltip:"You will earn " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_14__["formatNumber"])(favorGain, 0) +
|
||||
" faction favor upon resetting after installing an Augmentation"
|
||||
}))
|
||||
elements.push(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["createElement"])("p", {
|
||||
innerText:"---------------",
|
||||
}));
|
||||
elements.push(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["createElement"])("p", {
|
||||
innerText:"Faction Favor: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_14__["formatNumber"])(faction.favor, 4),
|
||||
innerText:"Faction Favor: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_14__["formatNumber"])(faction.favor, 0),
|
||||
tooltip:"Faction favor increases the rate at which " +
|
||||
"you earn reputation for this faction by 1% per favor. Faction favor " +
|
||||
"is gained whenever you reset after installing an Augmentation. The amount of " +
|
||||
@ -12441,7 +12447,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _DarkWeb_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DarkWeb.js */ 34);
|
||||
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./engine.js */ 5);
|
||||
/* harmony import */ var _Fconf_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Fconf.js */ 32);
|
||||
/* harmony import */ var _HelpText_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./HelpText.js */ 70);
|
||||
/* harmony import */ var _HelpText_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./HelpText.js */ 69);
|
||||
/* harmony import */ var _InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./InteractiveTutorial.js */ 24);
|
||||
/* harmony import */ var _Literature_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Literature.js */ 52);
|
||||
/* harmony import */ var _Message_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Message.js */ 28);
|
||||
@ -17155,9 +17161,9 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ActiveScriptsUI.js */ 40);
|
||||
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants.js */ 3);
|
||||
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./engine.js */ 5);
|
||||
/* harmony import */ var _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NetscriptEnvironment.js */ 68);
|
||||
/* harmony import */ var _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NetscriptEnvironment.js */ 67);
|
||||
/* harmony import */ var _NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NetscriptEvaluator.js */ 6);
|
||||
/* harmony import */ var _NetscriptJSEvaluator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./NetscriptJSEvaluator.js */ 62);
|
||||
/* harmony import */ var _NetscriptJSEvaluator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./NetscriptJSEvaluator.js */ 82);
|
||||
/* harmony import */ var _NetscriptPort_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./NetscriptPort.js */ 45);
|
||||
/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Server.js */ 10);
|
||||
/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Settings.js */ 22);
|
||||
@ -30210,7 +30216,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _TextFile_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./TextFile.js */ 42);
|
||||
/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./NetscriptWorker.js */ 20);
|
||||
/* harmony import */ var _NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./NetscriptEvaluator.js */ 6);
|
||||
/* harmony import */ var _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./NetscriptEnvironment.js */ 68);
|
||||
/* harmony import */ var _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./NetscriptEnvironment.js */ 67);
|
||||
/* harmony import */ var _NetscriptPort_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./NetscriptPort.js */ 45);
|
||||
/* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! decimal.js */ 23);
|
||||
/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../utils/DialogBox.js */ 7);
|
||||
@ -30218,8 +30224,8 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../utils/IPAddress.js */ 16);
|
||||
/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
|
||||
/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 12);
|
||||
var sprintf = __webpack_require__(/*! sprintf-js */ 67).sprintf,
|
||||
vsprintf = __webpack_require__(/*! sprintf-js */ 67).vsprintf
|
||||
var sprintf = __webpack_require__(/*! sprintf-js */ 66).sprintf,
|
||||
vsprintf = __webpack_require__(/*! sprintf-js */ 66).vsprintf
|
||||
|
||||
|
||||
|
||||
@ -32712,15 +32718,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
}
|
||||
|
||||
//Calculate how many times ram has been upgraded (doubled)
|
||||
var currentRam = _Player_js__WEBPACK_IMPORTED_MODULE_15__["Player"].getHomeComputer().maxRam;
|
||||
var numUpgrades = Math.log2(currentRam);
|
||||
|
||||
//Calculate cost
|
||||
//Have cost increase by some percentage each time RAM has been upgraded
|
||||
var cost = currentRam * _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].BaseCostFor1GBOfRamHome;
|
||||
var mult = Math.pow(1.55, numUpgrades);
|
||||
cost = cost * mult;
|
||||
const cost = _Player_js__WEBPACK_IMPORTED_MODULE_15__["Player"].getUpgradeHomeRamCost();
|
||||
|
||||
if (_Player_js__WEBPACK_IMPORTED_MODULE_15__["Player"].money.lt(cost)) {
|
||||
workerScript.scriptRef.log("ERROR: upgradeHomeRam() failed because you don't have enough money");
|
||||
@ -32752,15 +32750,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
}
|
||||
|
||||
//Calculate how many times ram has been upgraded (doubled)
|
||||
var currentRam = _Player_js__WEBPACK_IMPORTED_MODULE_15__["Player"].getHomeComputer().maxRam;
|
||||
var numUpgrades = Math.log2(currentRam);
|
||||
|
||||
//Calculate cost
|
||||
//Have cost increase by some percentage each time RAM has been upgraded
|
||||
var cost = currentRam * _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].BaseCostFor1GBOfRamHome;
|
||||
var mult = Math.pow(1.55, numUpgrades);
|
||||
return cost * mult;
|
||||
return _Player_js__WEBPACK_IMPORTED_MODULE_15__["Player"].getUpgradeHomeRamCost();
|
||||
},
|
||||
workForCompany : function() {
|
||||
var ramCost = _Constants_js__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ScriptSingularityFn2RamCost;
|
||||
@ -33765,7 +33755,7 @@ function NetscriptFunctions(workerScript) {
|
||||
|
||||
var support = __webpack_require__(/*! ./support */ 49);
|
||||
var base64 = __webpack_require__(/*! ./base64 */ 105);
|
||||
var nodejsUtils = __webpack_require__(/*! ./nodejsUtils */ 64);
|
||||
var nodejsUtils = __webpack_require__(/*! ./nodejsUtils */ 63);
|
||||
var setImmediate = __webpack_require__(/*! core-js/library/fn/set-immediate */ 167);
|
||||
var external = __webpack_require__(/*! ./external */ 57);
|
||||
|
||||
@ -59564,7 +59554,7 @@ function logBoxUpdateText() {
|
||||
|
||||
/*<replacement>*/
|
||||
|
||||
var processNextTick = __webpack_require__(/*! process-nextick-args */ 66).nextTick;
|
||||
var processNextTick = __webpack_require__(/*! process-nextick-args */ 65).nextTick;
|
||||
/*</replacement>*/
|
||||
|
||||
/*<replacement>*/
|
||||
@ -59584,7 +59574,7 @@ util.inherits = __webpack_require__(/*! inherits */ 54);
|
||||
/*</replacement>*/
|
||||
|
||||
var Readable = __webpack_require__(/*! ./_stream_readable */ 111);
|
||||
var Writable = __webpack_require__(/*! ./_stream_writable */ 79);
|
||||
var Writable = __webpack_require__(/*! ./_stream_writable */ 78);
|
||||
|
||||
util.inherits(Duplex, Readable);
|
||||
|
||||
@ -60208,7 +60198,7 @@ if (typeof Object.create === 'function') {
|
||||
|
||||
var utils = __webpack_require__(/*! ./utils */ 31);
|
||||
var support = __webpack_require__(/*! ./support */ 49);
|
||||
var nodejsUtils = __webpack_require__(/*! ./nodejsUtils */ 64);
|
||||
var nodejsUtils = __webpack_require__(/*! ./nodejsUtils */ 63);
|
||||
var GenericWorker = __webpack_require__(/*! ./stream/GenericWorker */ 38);
|
||||
|
||||
/**
|
||||
@ -60496,7 +60486,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _Augmentations_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Augmentations.js */ 19);
|
||||
/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BitNode.js */ 15);
|
||||
/* harmony import */ var _Bladeburner_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Bladeburner.js */ 26);
|
||||
/* harmony import */ var _CinematicText_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./CinematicText.js */ 69);
|
||||
/* harmony import */ var _CinematicText_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./CinematicText.js */ 68);
|
||||
/* harmony import */ var _Company_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Company.js */ 9);
|
||||
/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./CreateProgram.js */ 14);
|
||||
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./engine.js */ 5);
|
||||
@ -62972,130 +62962,6 @@ function isnan (val) {
|
||||
/***/ }),
|
||||
/* 61 */,
|
||||
/* 62 */
|
||||
/*!*************************************!*\
|
||||
!*** ./src/NetscriptJSEvaluator.js ***!
|
||||
\*************************************/
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeScriptBlob", function() { return makeScriptBlob; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "executeJSScript", function() { return executeJSScript; });
|
||||
/* harmony import */ var _NetscriptJSPreamble_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NetscriptJSPreamble.js */ 128);
|
||||
/* harmony import */ var _NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NetscriptEvaluator.js */ 6);
|
||||
|
||||
|
||||
|
||||
// Makes a blob that contains the code of a given script.
|
||||
function makeScriptBlob(code) {
|
||||
return new Blob([code], {type: "text/javascript"});
|
||||
}
|
||||
|
||||
// Begin executing a user JS script, and return a promise that resolves
|
||||
// or rejects when the script finishes.
|
||||
// - script is a script to execute (see Script.js). We depend only on .filename and .code.
|
||||
// scripts is an array of other scripts on the server.
|
||||
// env is the global environment that should be visible to all the scripts
|
||||
// (i.e. hack, grow, etc.).
|
||||
// When the promise returned by this resolves, we'll have finished
|
||||
// running the main function of the script.
|
||||
async function executeJSScript(scripts = [], workerScript) {
|
||||
let loadedModule;
|
||||
let urlStack = null;
|
||||
let script = workerScript.getScript();
|
||||
if (script.module === "") {
|
||||
// The URL at the top is the one we want to import. It will
|
||||
// recursively import all the other modules in the urlStack.
|
||||
//
|
||||
// Webpack likes to turn the import into a require, which sort of
|
||||
// but not really behaves like import. Particularly, it cannot
|
||||
// load fully dynamic content. So we hide the import from webpack
|
||||
// by placing it inside an eval call.
|
||||
urlStack = _getScriptUrls(script, scripts, []);
|
||||
script.module = await eval('import(urlStack[urlStack.length - 1])');
|
||||
}
|
||||
loadedModule = script.module;
|
||||
|
||||
let ns = workerScript.env.vars;
|
||||
//ns.threads = workerScript.threads;
|
||||
//ns.args = workerScript.args;
|
||||
|
||||
try {
|
||||
// TODO: putting await in a non-async function yields unhelpful
|
||||
// "SyntaxError: unexpected reserved word" with no line number information.
|
||||
if (!loadedModule.main) {
|
||||
throw Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_1__["makeRuntimeRejectMsg"])(script.filename +
|
||||
" did not have a main function, cannot run it.");
|
||||
}
|
||||
return loadedModule.main(ns);
|
||||
} finally {
|
||||
// Revoke the generated URLs
|
||||
if (urlStack != null) {
|
||||
for (const url in urlStack) URL.revokeObjectURL(url);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Gets a stack of blob urls, the top/right-most element being
|
||||
// the blob url for the named script on the named server.
|
||||
//
|
||||
// - script -- the script for whom we are getting a URL.
|
||||
// - scripts -- all the scripts available on this server
|
||||
// - envHeader -- the preamble that goes at the start of every NSJS script.
|
||||
// - seen -- The modules above this one -- to prevent mutual dependency.
|
||||
//
|
||||
// TODO We don't make any effort to cache a given module when it is imported at
|
||||
// different parts of the tree. That hasn't presented any problem with during
|
||||
// testing, but it might be an idea for the future. Would require a topo-sort
|
||||
// then url-izing from leaf-most to root-most.
|
||||
function _getScriptUrls(script, scripts, seen) {
|
||||
// Inspired by: https://stackoverflow.com/a/43834063/91401
|
||||
const urlStack = [];
|
||||
seen.push(script);
|
||||
try {
|
||||
// Replace every import statement with an import to a blob url containing
|
||||
// the corresponding script. E.g.
|
||||
//
|
||||
// import {foo} from "bar.js";
|
||||
//
|
||||
// becomes
|
||||
//
|
||||
// import {foo} from "blob://<uuid>"
|
||||
//
|
||||
// Where the blob URL contains the script content.
|
||||
const transformedCode = script.code.replace(/((?:from|import)\s+(?:'|"))([^'"]+)('|";)/g,
|
||||
(unmodified, prefix, filename, suffix) => {
|
||||
const isAllowedImport = scripts.some(s => s.filename == filename);
|
||||
if (!isAllowedImport) return unmodified;
|
||||
|
||||
// Find the corresponding script.
|
||||
const [importedScript] = scripts.filter(s => s.filename == filename);
|
||||
|
||||
// Try to get a URL for the requested script and its dependencies.
|
||||
const urls = _getScriptUrls(importedScript, scripts, seen);
|
||||
|
||||
// The top url in the stack is the replacement import file for this script.
|
||||
urlStack.push(...urls);
|
||||
return [prefix, urls[urls.length - 1], suffix].join('');
|
||||
});
|
||||
|
||||
|
||||
// If we successfully transformed the code, create a blob url for it and
|
||||
// push that URL onto the top of the stack.
|
||||
urlStack.push(URL.createObjectURL(makeScriptBlob(transformedCode)));
|
||||
return urlStack;
|
||||
} catch (err) {
|
||||
// If there is an error, we need to clean up the URLs.
|
||||
for (const url in urlStack) URL.revokeObjectURL(url);
|
||||
throw err;
|
||||
} finally {
|
||||
seen.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 63 */
|
||||
/*!****************************************************************************!*\
|
||||
!*** ./node_modules/jszip/node_modules/core-js/library/modules/_global.js ***!
|
||||
\****************************************************************************/
|
||||
@ -63107,7 +62973,7 @@ var global = module.exports = typeof window != 'undefined' && window.Math == Mat
|
||||
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
|
||||
|
||||
/***/ }),
|
||||
/* 64 */
|
||||
/* 63 */
|
||||
/*!***********************************************!*\
|
||||
!*** ./node_modules/jszip/lib/nodejsUtils.js ***!
|
||||
\***********************************************/
|
||||
@ -63170,7 +63036,7 @@ module.exports = {
|
||||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 60).Buffer))
|
||||
|
||||
/***/ }),
|
||||
/* 65 */
|
||||
/* 64 */
|
||||
/*!*******************************************!*\
|
||||
!*** ./node_modules/safe-buffer/index.js ***!
|
||||
\*******************************************/
|
||||
@ -63241,7 +63107,7 @@ SafeBuffer.allocUnsafeSlow = function (size) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 66 */
|
||||
/* 65 */
|
||||
/*!****************************************************!*\
|
||||
!*** ./node_modules/process-nextick-args/index.js ***!
|
||||
\****************************************************/
|
||||
@ -63296,7 +63162,7 @@ function nextTick(fn, arg1, arg2, arg3) {
|
||||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ 59)))
|
||||
|
||||
/***/ }),
|
||||
/* 67 */
|
||||
/* 66 */
|
||||
/*!************************************************!*\
|
||||
!*** ./node_modules/sprintf-js/src/sprintf.js ***!
|
||||
\************************************************/
|
||||
@ -63524,7 +63390,7 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 68 */
|
||||
/* 67 */
|
||||
/*!*************************************!*\
|
||||
!*** ./src/NetscriptEnvironment.js ***!
|
||||
\*************************************/
|
||||
@ -63635,7 +63501,7 @@ Environment.prototype = {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 69 */
|
||||
/* 68 */
|
||||
/*!******************************!*\
|
||||
!*** ./src/CinematicText.js ***!
|
||||
\******************************/
|
||||
@ -63748,7 +63614,7 @@ function cinematicTextEnd() {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 70 */
|
||||
/* 69 */
|
||||
/*!*************************!*\
|
||||
!*** ./src/HelpText.js ***!
|
||||
\*************************/
|
||||
@ -63978,10 +63844,10 @@ let HelpTexts = {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 70 */,
|
||||
/* 71 */,
|
||||
/* 72 */,
|
||||
/* 73 */,
|
||||
/* 74 */
|
||||
/* 73 */
|
||||
/*!************************************************!*\
|
||||
!*** ./node_modules/pako/lib/zlib/messages.js ***!
|
||||
\************************************************/
|
||||
@ -64023,7 +63889,7 @@ module.exports = {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 75 */
|
||||
/* 74 */
|
||||
/*!*****************************************!*\
|
||||
!*** ./node_modules/jszip/lib/crc32.js ***!
|
||||
\*****************************************/
|
||||
@ -64110,7 +63976,7 @@ module.exports = function crc32wrapper(input, crc) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 76 */
|
||||
/* 75 */
|
||||
/*!****************************************************!*\
|
||||
!*** ./node_modules/jszip/lib/compressedObject.js ***!
|
||||
\****************************************************/
|
||||
@ -64195,7 +64061,7 @@ module.exports = CompressedObject;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 77 */
|
||||
/* 76 */
|
||||
/*!*********************************************************************************!*\
|
||||
!*** ./node_modules/jszip/node_modules/core-js/library/modules/_descriptors.js ***!
|
||||
\*********************************************************************************/
|
||||
@ -64207,7 +64073,7 @@ module.exports = !__webpack_require__(/*! ./_fails */ 102)(function(){
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 78 */
|
||||
/* 77 */
|
||||
/*!*******************************************************************************!*\
|
||||
!*** ./node_modules/jszip/node_modules/core-js/library/modules/_is-object.js ***!
|
||||
\*******************************************************************************/
|
||||
@ -64218,7 +64084,7 @@ module.exports = function(it){
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 79 */
|
||||
/* 78 */
|
||||
/*!**************************************************************!*\
|
||||
!*** ./node_modules/readable-stream/lib/_stream_writable.js ***!
|
||||
\**************************************************************/
|
||||
@ -64254,7 +64120,7 @@ module.exports = function(it){
|
||||
|
||||
/*<replacement>*/
|
||||
|
||||
var processNextTick = __webpack_require__(/*! process-nextick-args */ 66).nextTick;
|
||||
var processNextTick = __webpack_require__(/*! process-nextick-args */ 65).nextTick;
|
||||
/*</replacement>*/
|
||||
|
||||
module.exports = Writable;
|
||||
@ -64307,7 +64173,7 @@ var Stream = __webpack_require__(/*! ./internal/streams/stream */ 110);
|
||||
|
||||
/*<replacement>*/
|
||||
|
||||
var Buffer = __webpack_require__(/*! safe-buffer */ 65).Buffer;
|
||||
var Buffer = __webpack_require__(/*! safe-buffer */ 64).Buffer;
|
||||
var OurUint8Array = global.Uint8Array || function () {};
|
||||
function _uint8ArrayToBuffer(chunk) {
|
||||
return Buffer.from(chunk);
|
||||
@ -64905,7 +64771,7 @@ Writable.prototype._destroy = function (err, cb) {
|
||||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ 59), __webpack_require__(/*! ./../../timers-browserify/main.js */ 108).setImmediate, __webpack_require__(/*! ./../../webpack/buildin/global.js */ 47)))
|
||||
|
||||
/***/ }),
|
||||
/* 80 */
|
||||
/* 79 */
|
||||
/*!**********************************************************!*\
|
||||
!*** ./node_modules/readable-stream/readable-browser.js ***!
|
||||
\**********************************************************/
|
||||
@ -64914,14 +64780,14 @@ Writable.prototype._destroy = function (err, cb) {
|
||||
exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ 111);
|
||||
exports.Stream = exports;
|
||||
exports.Readable = exports;
|
||||
exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ 79);
|
||||
exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ 78);
|
||||
exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ 51);
|
||||
exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ 106);
|
||||
exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ 172);
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 81 */
|
||||
/* 80 */
|
||||
/*!***************************************!*\
|
||||
!*** ./node_modules/events/events.js ***!
|
||||
\***************************************/
|
||||
@ -65232,7 +65098,7 @@ function isUndefined(arg) {
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 82 */
|
||||
/* 81 */
|
||||
/*!***************************************!*\
|
||||
!*** (webpack)/buildin/amd-define.js ***!
|
||||
\***************************************/
|
||||
@ -65243,6 +65109,130 @@ module.exports = function() {
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 82 */
|
||||
/*!*************************************!*\
|
||||
!*** ./src/NetscriptJSEvaluator.js ***!
|
||||
\*************************************/
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeScriptBlob", function() { return makeScriptBlob; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "executeJSScript", function() { return executeJSScript; });
|
||||
/* harmony import */ var _NetscriptJSPreamble_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NetscriptJSPreamble.js */ 128);
|
||||
/* harmony import */ var _NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NetscriptEvaluator.js */ 6);
|
||||
|
||||
|
||||
|
||||
// Makes a blob that contains the code of a given script.
|
||||
function makeScriptBlob(code) {
|
||||
return new Blob([code], {type: "text/javascript"});
|
||||
}
|
||||
|
||||
// Begin executing a user JS script, and return a promise that resolves
|
||||
// or rejects when the script finishes.
|
||||
// - script is a script to execute (see Script.js). We depend only on .filename and .code.
|
||||
// scripts is an array of other scripts on the server.
|
||||
// env is the global environment that should be visible to all the scripts
|
||||
// (i.e. hack, grow, etc.).
|
||||
// When the promise returned by this resolves, we'll have finished
|
||||
// running the main function of the script.
|
||||
async function executeJSScript(scripts = [], workerScript) {
|
||||
let loadedModule;
|
||||
let urlStack = null;
|
||||
let script = workerScript.getScript();
|
||||
if (script.module === "") {
|
||||
// The URL at the top is the one we want to import. It will
|
||||
// recursively import all the other modules in the urlStack.
|
||||
//
|
||||
// Webpack likes to turn the import into a require, which sort of
|
||||
// but not really behaves like import. Particularly, it cannot
|
||||
// load fully dynamic content. So we hide the import from webpack
|
||||
// by placing it inside an eval call.
|
||||
urlStack = _getScriptUrls(script, scripts, []);
|
||||
script.module = await eval('import(urlStack[urlStack.length - 1])');
|
||||
}
|
||||
loadedModule = script.module;
|
||||
|
||||
let ns = workerScript.env.vars;
|
||||
//ns.threads = workerScript.threads;
|
||||
//ns.args = workerScript.args;
|
||||
|
||||
try {
|
||||
// TODO: putting await in a non-async function yields unhelpful
|
||||
// "SyntaxError: unexpected reserved word" with no line number information.
|
||||
if (!loadedModule.main) {
|
||||
throw Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_1__["makeRuntimeRejectMsg"])(script.filename +
|
||||
" did not have a main function, cannot run it.");
|
||||
}
|
||||
return loadedModule.main(ns);
|
||||
} finally {
|
||||
// Revoke the generated URLs
|
||||
if (urlStack != null) {
|
||||
for (const url in urlStack) URL.revokeObjectURL(url);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Gets a stack of blob urls, the top/right-most element being
|
||||
// the blob url for the named script on the named server.
|
||||
//
|
||||
// - script -- the script for whom we are getting a URL.
|
||||
// - scripts -- all the scripts available on this server
|
||||
// - envHeader -- the preamble that goes at the start of every NSJS script.
|
||||
// - seen -- The modules above this one -- to prevent mutual dependency.
|
||||
//
|
||||
// TODO We don't make any effort to cache a given module when it is imported at
|
||||
// different parts of the tree. That hasn't presented any problem with during
|
||||
// testing, but it might be an idea for the future. Would require a topo-sort
|
||||
// then url-izing from leaf-most to root-most.
|
||||
function _getScriptUrls(script, scripts, seen) {
|
||||
// Inspired by: https://stackoverflow.com/a/43834063/91401
|
||||
const urlStack = [];
|
||||
seen.push(script);
|
||||
try {
|
||||
// Replace every import statement with an import to a blob url containing
|
||||
// the corresponding script. E.g.
|
||||
//
|
||||
// import {foo} from "bar.js";
|
||||
//
|
||||
// becomes
|
||||
//
|
||||
// import {foo} from "blob://<uuid>"
|
||||
//
|
||||
// Where the blob URL contains the script content.
|
||||
const transformedCode = script.code.replace(/((?:from|import)\s+(?:'|"))([^'"]+)('|";)/g,
|
||||
(unmodified, prefix, filename, suffix) => {
|
||||
const isAllowedImport = scripts.some(s => s.filename == filename);
|
||||
if (!isAllowedImport) return unmodified;
|
||||
|
||||
// Find the corresponding script.
|
||||
const [importedScript] = scripts.filter(s => s.filename == filename);
|
||||
|
||||
// Try to get a URL for the requested script and its dependencies.
|
||||
const urls = _getScriptUrls(importedScript, scripts, seen);
|
||||
|
||||
// The top url in the stack is the replacement import file for this script.
|
||||
urlStack.push(...urls);
|
||||
return [prefix, urls[urls.length - 1], suffix].join('');
|
||||
});
|
||||
|
||||
|
||||
// If we successfully transformed the code, create a blob url for it and
|
||||
// push that URL onto the top of the stack.
|
||||
urlStack.push(URL.createObjectURL(makeScriptBlob(transformedCode)));
|
||||
return urlStack;
|
||||
} catch (err) {
|
||||
// If there is an error, we need to clean up the URLs.
|
||||
for (const url in urlStack) URL.revokeObjectURL(url);
|
||||
throw err;
|
||||
} finally {
|
||||
seen.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 83 */
|
||||
/*!********************************!*\
|
||||
@ -66274,7 +66264,7 @@ exports.DEFLATE = __webpack_require__(/*! ./flate */ 147);
|
||||
|
||||
|
||||
var GenericWorker = __webpack_require__(/*! ./GenericWorker */ 38);
|
||||
var crc32 = __webpack_require__(/*! ../crc32 */ 75);
|
||||
var crc32 = __webpack_require__(/*! ../crc32 */ 74);
|
||||
var utils = __webpack_require__(/*! ../utils */ 31);
|
||||
|
||||
/**
|
||||
@ -66713,8 +66703,8 @@ module.exports = StreamHelper;
|
||||
\********************************************************************************/
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var isObject = __webpack_require__(/*! ./_is-object */ 78)
|
||||
, document = __webpack_require__(/*! ./_global */ 63).document
|
||||
var isObject = __webpack_require__(/*! ./_is-object */ 77)
|
||||
, document = __webpack_require__(/*! ./_global */ 62).document
|
||||
// in old IE typeof document.createElement is 'object'
|
||||
, is = isObject(document) && isObject(document.createElement);
|
||||
module.exports = function(it){
|
||||
@ -67123,7 +67113,7 @@ function done(stream, er, data) {
|
||||
"use strict";
|
||||
|
||||
|
||||
var Buffer = __webpack_require__(/*! safe-buffer */ 65).Buffer;
|
||||
var Buffer = __webpack_require__(/*! safe-buffer */ 64).Buffer;
|
||||
|
||||
var isEncoding = Buffer.isEncoding || function (encoding) {
|
||||
encoding = '' + encoding;
|
||||
@ -67476,7 +67466,7 @@ exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
|
||||
|
||||
/*<replacement>*/
|
||||
|
||||
var processNextTick = __webpack_require__(/*! process-nextick-args */ 66).nextTick;
|
||||
var processNextTick = __webpack_require__(/*! process-nextick-args */ 65).nextTick;
|
||||
/*</replacement>*/
|
||||
|
||||
// undocumented cb() API, needed for core, not for public API
|
||||
@ -67554,7 +67544,7 @@ module.exports = {
|
||||
\*****************************************************************************/
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(/*! events */ 81).EventEmitter;
|
||||
module.exports = __webpack_require__(/*! events */ 80).EventEmitter;
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -67590,7 +67580,7 @@ module.exports = __webpack_require__(/*! events */ 81).EventEmitter;
|
||||
|
||||
/*<replacement>*/
|
||||
|
||||
var processNextTick = __webpack_require__(/*! process-nextick-args */ 66).nextTick;
|
||||
var processNextTick = __webpack_require__(/*! process-nextick-args */ 65).nextTick;
|
||||
/*</replacement>*/
|
||||
|
||||
module.exports = Readable;
|
||||
@ -67606,7 +67596,7 @@ var Duplex;
|
||||
Readable.ReadableState = ReadableState;
|
||||
|
||||
/*<replacement>*/
|
||||
var EE = __webpack_require__(/*! events */ 81).EventEmitter;
|
||||
var EE = __webpack_require__(/*! events */ 80).EventEmitter;
|
||||
|
||||
var EElistenerCount = function (emitter, type) {
|
||||
return emitter.listeners(type).length;
|
||||
@ -67619,7 +67609,7 @@ var Stream = __webpack_require__(/*! ./internal/streams/stream */ 110);
|
||||
|
||||
/*<replacement>*/
|
||||
|
||||
var Buffer = __webpack_require__(/*! safe-buffer */ 65).Buffer;
|
||||
var Buffer = __webpack_require__(/*! safe-buffer */ 64).Buffer;
|
||||
var OurUint8Array = global.Uint8Array || function () {};
|
||||
function _uint8ArrayToBuffer(chunk) {
|
||||
return Buffer.from(chunk);
|
||||
@ -69908,7 +69898,7 @@ var saveAs = saveAs || (function(view) {
|
||||
|
||||
if (typeof module !== "undefined" && module.exports) {
|
||||
module.exports.saveAs = saveAs;
|
||||
} else if (("function" !== "undefined" && __webpack_require__(/*! !webpack amd define */ 82) !== null) && (__webpack_require__(/*! !webpack amd options */ 130) !== null)) {
|
||||
} else if (("function" !== "undefined" && __webpack_require__(/*! !webpack amd define */ 81) !== null) && (__webpack_require__(/*! !webpack amd options */ 130) !== null)) {
|
||||
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
|
||||
return saveAs;
|
||||
}).call(exports, __webpack_require__, exports, module),
|
||||
@ -70070,7 +70060,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeEnvHeader", function() { return makeEnvHeader; });
|
||||
/* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uuid/v4 */ 115);
|
||||
/* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(uuid_v4__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var sprintf_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! sprintf-js */ 67);
|
||||
/* harmony import */ var sprintf_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! sprintf-js */ 66);
|
||||
/* harmony import */ var sprintf_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(sprintf_js__WEBPACK_IMPORTED_MODULE_1__);
|
||||
// A utility function that adds a preamble to each Netscript JS
|
||||
// script. This preamble will set all the global functions and
|
||||
@ -75449,8 +75439,8 @@ module.exports = __webpack_amd_options__;
|
||||
|
||||
var readerFor = __webpack_require__(/*! ./reader/readerFor */ 88);
|
||||
var utils = __webpack_require__(/*! ./utils */ 31);
|
||||
var CompressedObject = __webpack_require__(/*! ./compressedObject */ 76);
|
||||
var crc32fn = __webpack_require__(/*! ./crc32 */ 75);
|
||||
var CompressedObject = __webpack_require__(/*! ./compressedObject */ 75);
|
||||
var crc32fn = __webpack_require__(/*! ./crc32 */ 74);
|
||||
var utf8 = __webpack_require__(/*! ./utf8 */ 55);
|
||||
var compressions = __webpack_require__(/*! ./compressions */ 95);
|
||||
var support = __webpack_require__(/*! ./support */ 49);
|
||||
@ -76104,7 +76094,7 @@ var utf8 = __webpack_require__(/*! ./utf8 */ 55);
|
||||
var utils = __webpack_require__(/*! ./utils */ 31);
|
||||
var ZipEntries = __webpack_require__(/*! ./zipEntries */ 134);
|
||||
var Crc32Probe = __webpack_require__(/*! ./stream/Crc32Probe */ 96);
|
||||
var nodejsUtils = __webpack_require__(/*! ./nodejsUtils */ 64);
|
||||
var nodejsUtils = __webpack_require__(/*! ./nodejsUtils */ 63);
|
||||
|
||||
/**
|
||||
* Check the CRC32 of an entry.
|
||||
@ -76278,7 +76268,7 @@ module.exports = NodejsStreamInputAdapter;
|
||||
var utils = __webpack_require__(/*! ../utils */ 31);
|
||||
var GenericWorker = __webpack_require__(/*! ../stream/GenericWorker */ 38);
|
||||
var utf8 = __webpack_require__(/*! ../utf8 */ 55);
|
||||
var crc32 = __webpack_require__(/*! ../crc32 */ 75);
|
||||
var crc32 = __webpack_require__(/*! ../crc32 */ 74);
|
||||
var signature = __webpack_require__(/*! ../signature */ 89);
|
||||
|
||||
/**
|
||||
@ -79172,7 +79162,7 @@ var zlib_inflate = __webpack_require__(/*! ./zlib/inflate */ 141);
|
||||
var utils = __webpack_require__(/*! ./utils/common */ 48);
|
||||
var strings = __webpack_require__(/*! ./utils/strings */ 92);
|
||||
var c = __webpack_require__(/*! ./zlib/constants */ 90);
|
||||
var msg = __webpack_require__(/*! ./zlib/messages */ 74);
|
||||
var msg = __webpack_require__(/*! ./zlib/messages */ 73);
|
||||
var ZStream = __webpack_require__(/*! ./zlib/zstream */ 91);
|
||||
var GZheader = __webpack_require__(/*! ./zlib/gzheader */ 138);
|
||||
|
||||
@ -80848,7 +80838,7 @@ var utils = __webpack_require__(/*! ../utils/common */ 48);
|
||||
var trees = __webpack_require__(/*! ./trees */ 143);
|
||||
var adler32 = __webpack_require__(/*! ./adler32 */ 94);
|
||||
var crc32 = __webpack_require__(/*! ./crc32 */ 93);
|
||||
var msg = __webpack_require__(/*! ./messages */ 74);
|
||||
var msg = __webpack_require__(/*! ./messages */ 73);
|
||||
|
||||
/* Public constants ==========================================================*/
|
||||
/* ===========================================================================*/
|
||||
@ -82713,7 +82703,7 @@ exports.deflateTune = deflateTune;
|
||||
var zlib_deflate = __webpack_require__(/*! ./zlib/deflate */ 144);
|
||||
var utils = __webpack_require__(/*! ./utils/common */ 48);
|
||||
var strings = __webpack_require__(/*! ./utils/strings */ 92);
|
||||
var msg = __webpack_require__(/*! ./zlib/messages */ 74);
|
||||
var msg = __webpack_require__(/*! ./zlib/messages */ 73);
|
||||
var ZStream = __webpack_require__(/*! ./zlib/zstream */ 91);
|
||||
|
||||
var toString = Object.prototype.toString;
|
||||
@ -83308,7 +83298,7 @@ exports.generateWorker = function (zip, options, comment) {
|
||||
var StreamHelper = __webpack_require__(/*! ./stream/StreamHelper */ 100);
|
||||
var DataWorker = __webpack_require__(/*! ./stream/DataWorker */ 98);
|
||||
var utf8 = __webpack_require__(/*! ./utf8 */ 55);
|
||||
var CompressedObject = __webpack_require__(/*! ./compressedObject */ 76);
|
||||
var CompressedObject = __webpack_require__(/*! ./compressedObject */ 75);
|
||||
var GenericWorker = __webpack_require__(/*! ./stream/GenericWorker */ 38);
|
||||
|
||||
/**
|
||||
@ -83889,7 +83879,7 @@ module.exports = function(it){
|
||||
\**************************************************************************/
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(/*! ./_global */ 63).document && document.documentElement;
|
||||
module.exports = __webpack_require__(/*! ./_global */ 62).document && document.documentElement;
|
||||
|
||||
/***/ }),
|
||||
/* 156 */
|
||||
@ -83926,7 +83916,7 @@ var ctx = __webpack_require__(/*! ./_ctx */ 103)
|
||||
, invoke = __webpack_require__(/*! ./_invoke */ 156)
|
||||
, html = __webpack_require__(/*! ./_html */ 155)
|
||||
, cel = __webpack_require__(/*! ./_dom-create */ 101)
|
||||
, global = __webpack_require__(/*! ./_global */ 63)
|
||||
, global = __webpack_require__(/*! ./_global */ 62)
|
||||
, process = global.process
|
||||
, setTask = global.setImmediate
|
||||
, clearTask = global.clearImmediate
|
||||
@ -84022,7 +84012,7 @@ module.exports = function(bitmap, value){
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// 7.1.1 ToPrimitive(input [, PreferredType])
|
||||
var isObject = __webpack_require__(/*! ./_is-object */ 78);
|
||||
var isObject = __webpack_require__(/*! ./_is-object */ 77);
|
||||
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
|
||||
// and the second argument - flag - preferred type is a string
|
||||
module.exports = function(it, S){
|
||||
@ -84041,7 +84031,7 @@ module.exports = function(it, S){
|
||||
\************************************************************************************/
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = !__webpack_require__(/*! ./_descriptors */ 77) && !__webpack_require__(/*! ./_fails */ 102)(function(){
|
||||
module.exports = !__webpack_require__(/*! ./_descriptors */ 76) && !__webpack_require__(/*! ./_fails */ 102)(function(){
|
||||
return Object.defineProperty(__webpack_require__(/*! ./_dom-create */ 101)('div'), 'a', {get: function(){ return 7; }}).a != 7;
|
||||
});
|
||||
|
||||
@ -84052,7 +84042,7 @@ module.exports = !__webpack_require__(/*! ./_descriptors */ 77) && !__webpack_re
|
||||
\*******************************************************************************/
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var isObject = __webpack_require__(/*! ./_is-object */ 78);
|
||||
var isObject = __webpack_require__(/*! ./_is-object */ 77);
|
||||
module.exports = function(it){
|
||||
if(!isObject(it))throw TypeError(it + ' is not an object!');
|
||||
return it;
|
||||
@ -84070,7 +84060,7 @@ var anObject = __webpack_require__(/*! ./_an-object */ 161)
|
||||
, toPrimitive = __webpack_require__(/*! ./_to-primitive */ 159)
|
||||
, dP = Object.defineProperty;
|
||||
|
||||
exports.f = __webpack_require__(/*! ./_descriptors */ 77) ? Object.defineProperty : function defineProperty(O, P, Attributes){
|
||||
exports.f = __webpack_require__(/*! ./_descriptors */ 76) ? Object.defineProperty : function defineProperty(O, P, Attributes){
|
||||
anObject(O);
|
||||
P = toPrimitive(P, true);
|
||||
anObject(Attributes);
|
||||
@ -84091,7 +84081,7 @@ exports.f = __webpack_require__(/*! ./_descriptors */ 77) ? Object.definePropert
|
||||
|
||||
var dP = __webpack_require__(/*! ./_object-dp */ 162)
|
||||
, createDesc = __webpack_require__(/*! ./_property-desc */ 158);
|
||||
module.exports = __webpack_require__(/*! ./_descriptors */ 77) ? function(object, key, value){
|
||||
module.exports = __webpack_require__(/*! ./_descriptors */ 76) ? function(object, key, value){
|
||||
return dP.f(object, key, createDesc(1, value));
|
||||
} : function(object, key, value){
|
||||
object[key] = value;
|
||||
@ -84117,7 +84107,7 @@ module.exports = function(it){
|
||||
\****************************************************************************/
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var global = __webpack_require__(/*! ./_global */ 63)
|
||||
var global = __webpack_require__(/*! ./_global */ 62)
|
||||
, core = __webpack_require__(/*! ./_core */ 104)
|
||||
, ctx = __webpack_require__(/*! ./_ctx */ 103)
|
||||
, hide = __webpack_require__(/*! ./_hide */ 163)
|
||||
@ -84210,7 +84200,7 @@ module.exports = __webpack_require__(/*! ../modules/_core */ 104).setImmediate;
|
||||
\*****************************************************/
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(/*! ./readable */ 80).PassThrough
|
||||
module.exports = __webpack_require__(/*! ./readable */ 79).PassThrough
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -84220,7 +84210,7 @@ module.exports = __webpack_require__(/*! ./readable */ 80).PassThrough
|
||||
\***************************************************/
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(/*! ./readable */ 80).Transform
|
||||
module.exports = __webpack_require__(/*! ./readable */ 79).Transform
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -84240,7 +84230,7 @@ module.exports = __webpack_require__(/*! ./lib/_stream_duplex.js */ 51);
|
||||
\**********************************************************/
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(/*! ./lib/_stream_writable.js */ 79);
|
||||
module.exports = __webpack_require__(/*! ./lib/_stream_writable.js */ 78);
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -84593,7 +84583,7 @@ function config (name) {
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Buffer = __webpack_require__(/*! safe-buffer */ 65).Buffer;
|
||||
var Buffer = __webpack_require__(/*! safe-buffer */ 64).Buffer;
|
||||
var util = __webpack_require__(/*! util */ 175);
|
||||
|
||||
function copyBuffer(src, target, offset) {
|
||||
@ -84708,11 +84698,11 @@ if (util && util.inspect && util.inspect.custom) {
|
||||
|
||||
module.exports = Stream;
|
||||
|
||||
var EE = __webpack_require__(/*! events */ 81).EventEmitter;
|
||||
var EE = __webpack_require__(/*! events */ 80).EventEmitter;
|
||||
var inherits = __webpack_require__(/*! inherits */ 54);
|
||||
|
||||
inherits(Stream, EE);
|
||||
Stream.Readable = __webpack_require__(/*! readable-stream/readable.js */ 80);
|
||||
Stream.Readable = __webpack_require__(/*! readable-stream/readable.js */ 79);
|
||||
Stream.Writable = __webpack_require__(/*! readable-stream/writable.js */ 171);
|
||||
Stream.Duplex = __webpack_require__(/*! readable-stream/duplex.js */ 170);
|
||||
Stream.Transform = __webpack_require__(/*! readable-stream/transform.js */ 169);
|
||||
@ -85047,10 +85037,10 @@ var utils = __webpack_require__(/*! ./utils */ 31);
|
||||
var GenericWorker = __webpack_require__(/*! ./stream/GenericWorker */ 38);
|
||||
var StreamHelper = __webpack_require__(/*! ./stream/StreamHelper */ 100);
|
||||
var defaults = __webpack_require__(/*! ./defaults */ 99);
|
||||
var CompressedObject = __webpack_require__(/*! ./compressedObject */ 76);
|
||||
var CompressedObject = __webpack_require__(/*! ./compressedObject */ 75);
|
||||
var ZipObject = __webpack_require__(/*! ./zipObject */ 149);
|
||||
var generate = __webpack_require__(/*! ./generate */ 148);
|
||||
var nodejsUtils = __webpack_require__(/*! ./nodejsUtils */ 64);
|
||||
var nodejsUtils = __webpack_require__(/*! ./nodejsUtils */ 63);
|
||||
var NodejsStreamInputAdapter = __webpack_require__(/*! ./nodejs/NodejsStreamInputAdapter */ 136);
|
||||
|
||||
|
||||
@ -101400,7 +101390,7 @@ init(true);function init(packaged) {
|
||||
if (!global || !global.document)
|
||||
return;
|
||||
|
||||
options.packaged = packaged || acequire.packaged || module.packaged || (global.define && __webpack_require__(/*! !webpack amd define */ 82).packaged);
|
||||
options.packaged = packaged || acequire.packaged || module.packaged || (global.define && __webpack_require__(/*! !webpack amd define */ 81).packaged);
|
||||
|
||||
var scriptOptions = {};
|
||||
var scriptUrl = "";
|
||||
@ -117427,7 +117417,7 @@ exports.config = acequire("./config");
|
||||
exports.acequire = acequire;
|
||||
|
||||
if (true)
|
||||
exports.define = __webpack_require__(/*! !webpack amd define */ 82);
|
||||
exports.define = __webpack_require__(/*! !webpack amd define */ 81);
|
||||
exports.edit = function(el) {
|
||||
if (typeof el == "string") {
|
||||
var _id = el;
|
||||
|
@ -489,6 +489,8 @@ let CONSTANTS = {
|
||||
|
||||
LatestUpdate:
|
||||
"v0.37.3<br>" +
|
||||
"* New BitNode: BN-7 Bladeburner 2079<br>" +
|
||||
"* New BitNode: BN-12 The Recursion<br>" +
|
||||
"* Bladeburner Changes:<br>" +
|
||||
"*** Bladeburner progress is no longer reset when installing Augmentations<br>" +
|
||||
"*** The number of successess needed to increase a Contract/Operation's max level now scales with the current max level (gradually gets harder)<br>" +
|
||||
|
@ -185,14 +185,14 @@ function displayFactionContent(factionName) {
|
||||
favorGain = favorGain[0];
|
||||
elements.push(createElement("p", {
|
||||
innerText: "Reputation: " + formatNumber(faction.playerReputation, 4),
|
||||
tooltip:"You will earn " + formatNumber(favorGain, 4) +
|
||||
tooltip:"You will earn " + formatNumber(favorGain, 0) +
|
||||
" faction favor upon resetting after installing an Augmentation"
|
||||
}))
|
||||
elements.push(createElement("p", {
|
||||
innerText:"---------------",
|
||||
}));
|
||||
elements.push(createElement("p", {
|
||||
innerText:"Faction Favor: " + formatNumber(faction.favor, 4),
|
||||
innerText:"Faction Favor: " + formatNumber(faction.favor, 0),
|
||||
tooltip:"Faction favor increases the rate at which " +
|
||||
"you earn reputation for this faction by 1% per favor. Faction favor " +
|
||||
"is gained whenever you reset after installing an Augmentation. The amount of " +
|
||||
|
@ -1761,16 +1761,8 @@ function initLocationButtons() {
|
||||
});
|
||||
|
||||
purchaseHomeRam.addEventListener("click", function() {
|
||||
//Calculate how many times ram has been upgraded (doubled)
|
||||
var currentRam = Player.getHomeComputer().maxRam;
|
||||
var newRam = currentRam * 2;
|
||||
var numUpgrades = Math.log2(currentRam);
|
||||
|
||||
//Calculate cost
|
||||
//Have cost increase by some percentage each time RAM has been upgraded
|
||||
var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRamHome;
|
||||
var mult = Math.pow(1.58, numUpgrades);
|
||||
cost = cost * mult;
|
||||
const cost = Player.getUpgradeHomeRamCost();
|
||||
const ram = Player.getHomeComputer().maxRam;
|
||||
|
||||
var yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton();
|
||||
yesBtn.innerHTML = "Purchase"; noBtn.innerHTML = "Cancel";
|
||||
@ -1782,8 +1774,8 @@ function initLocationButtons() {
|
||||
yesNoBoxClose();
|
||||
});
|
||||
yesNoBoxCreate("Would you like to purchase additional RAM for your home computer? <br><br>" +
|
||||
"This will upgrade your RAM from " + currentRam + "GB to " + newRam + "GB. <br><br>" +
|
||||
"This will cost $" + formatNumber(cost, 2));
|
||||
"This will upgrade your RAM from " + ram + "GB to " + ram*2 + "GB. <br><br>" +
|
||||
"This will cost " + numeral(cost).format('$0.000a'));
|
||||
});
|
||||
|
||||
purchaseHomeCores.addEventListener("click", function() {
|
||||
|
@ -2510,15 +2510,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
}
|
||||
|
||||
//Calculate how many times ram has been upgraded (doubled)
|
||||
var currentRam = Player.getHomeComputer().maxRam;
|
||||
var numUpgrades = Math.log2(currentRam);
|
||||
|
||||
//Calculate cost
|
||||
//Have cost increase by some percentage each time RAM has been upgraded
|
||||
var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRamHome;
|
||||
var mult = Math.pow(1.55, numUpgrades);
|
||||
cost = cost * mult;
|
||||
const cost = Player.getUpgradeHomeRamCost();
|
||||
|
||||
if (Player.money.lt(cost)) {
|
||||
workerScript.scriptRef.log("ERROR: upgradeHomeRam() failed because you don't have enough money");
|
||||
@ -2550,15 +2542,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
}
|
||||
|
||||
//Calculate how many times ram has been upgraded (doubled)
|
||||
var currentRam = Player.getHomeComputer().maxRam;
|
||||
var numUpgrades = Math.log2(currentRam);
|
||||
|
||||
//Calculate cost
|
||||
//Have cost increase by some percentage each time RAM has been upgraded
|
||||
var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRamHome;
|
||||
var mult = Math.pow(1.55, numUpgrades);
|
||||
return cost * mult;
|
||||
return Player.getUpgradeHomeRamCost();
|
||||
},
|
||||
workForCompany : function() {
|
||||
var ramCost = CONSTANTS.ScriptSingularityFn2RamCost;
|
||||
|
@ -401,6 +401,18 @@ PlayerObject.prototype.getHomeComputer = function() {
|
||||
return AllServers[this.homeComputer];
|
||||
}
|
||||
|
||||
PlayerObject.prototype.getUpgradeHomeRamCost = function() {
|
||||
//Calculate how many times ram has been upgraded (doubled)
|
||||
const currentRam = Player.getHomeComputer().maxRam;
|
||||
const numUpgrades = Math.log2(currentRam);
|
||||
|
||||
//Calculate cost
|
||||
//Have cost increase by some percentage each time RAM has been upgraded
|
||||
const mult = Math.pow(1.58, numUpgrades);
|
||||
var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRamHome * mult;
|
||||
return cost;
|
||||
}
|
||||
|
||||
//Calculates skill level based on experience. The same formula will be used for every skill
|
||||
PlayerObject.prototype.calculateSkill = function(exp) {
|
||||
return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -19,11 +19,10 @@ module.exports = {
|
||||
"dist/engine": "./src/engine.js",
|
||||
"tests/tests": "./tests/index.js",
|
||||
},
|
||||
devtool: "nosources-source-map",
|
||||
devtool: "source-map",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "./"),
|
||||
filename: "[name].bundle.js",
|
||||
devtoolModuleFilenameTemplate: "[id]"
|
||||
filename: "[name].bundle.js"
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
|
Loading…
Reference in New Issue
Block a user