mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 05:33:54 +01:00
Copying a NetscriptJS script with scp now properly clears its 'module'.
This commit is contained in:
parent
e621cac0a8
commit
c8421168b6
83
dist/engine.bundle.js
vendored
83
dist/engine.bundle.js
vendored
@ -2860,13 +2860,13 @@ function convertTimeMsToTimeElapsedString(time) {
|
||||
const secTruncMinutes = secTruncHours % secondPerMinute;
|
||||
const seconds = secTruncMinutes;
|
||||
let res = "";
|
||||
if (days) {
|
||||
if (days > 0) {
|
||||
res += `${days} days `;
|
||||
}
|
||||
if (hours) {
|
||||
if (hours > 0) {
|
||||
res += `${hours} hours `;
|
||||
}
|
||||
if (minutes) {
|
||||
if (minutes > 0) {
|
||||
res += `${minutes} minutes `;
|
||||
}
|
||||
res += `${seconds} seconds `;
|
||||
@ -2878,7 +2878,7 @@ function longestCommonStart(strings) {
|
||||
if (!containsAllStrings(strings)) {
|
||||
return "";
|
||||
}
|
||||
if (strings.length == 0) {
|
||||
if (strings.length === 0) {
|
||||
return "";
|
||||
}
|
||||
const A = strings.concat().sort();
|
||||
@ -2886,7 +2886,8 @@ function longestCommonStart(strings) {
|
||||
const a2 = A[A.length - 1];
|
||||
const L = a1.length;
|
||||
let i = 0;
|
||||
while (i < L && a1.charAt(i).toLowerCase() === a2.charAt(i).toLowerCase()) {
|
||||
const areEqualCaseInsensitive = (a, b) => a.toUpperCase() === b.toUpperCase();
|
||||
while (i < L && areEqualCaseInsensitive(a1.charAt(i), a2.charAt(i))) {
|
||||
i++;
|
||||
}
|
||||
return a1.substring(0, i);
|
||||
@ -2912,16 +2913,16 @@ function formatNumber(num, numFractionDigits) {
|
||||
exports.formatNumber = formatNumber;
|
||||
// Count the number of times a substring occurs in a string
|
||||
function numOccurrences(text, subString) {
|
||||
text += "";
|
||||
subString += "";
|
||||
if (subString.length <= 0) {
|
||||
return (text.length + 1);
|
||||
const input = `${text}`;
|
||||
const search = `${subString}`;
|
||||
if (search.length <= 0) {
|
||||
return (input.length + 1);
|
||||
}
|
||||
let n = 0;
|
||||
let pos = 0;
|
||||
const step = subString.length;
|
||||
const step = search.length;
|
||||
while (true) {
|
||||
pos = text.indexOf(subString, pos);
|
||||
pos = input.indexOf(search, pos);
|
||||
if (pos >= 0) {
|
||||
++n;
|
||||
pos += step;
|
||||
@ -2949,6 +2950,7 @@ function numNetscriptOperators(text) {
|
||||
numOccurrences(text, "==") +
|
||||
numOccurrences(text, "!=");
|
||||
if (isNaN(total)) {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
const message = "ERROR in counting number of operators in script. This is a bug, please report to game developer";
|
||||
DialogBox_1.dialogBoxCreate(message, false);
|
||||
return 0;
|
||||
@ -2958,11 +2960,11 @@ function numNetscriptOperators(text) {
|
||||
exports.numNetscriptOperators = numNetscriptOperators;
|
||||
// Checks if a string contains HTML elements
|
||||
function isHTML(str) {
|
||||
const a = document.createElement("div");
|
||||
a.innerHTML = str;
|
||||
const c = a.childNodes;
|
||||
for (let i = c.length; i--;) {
|
||||
if (c[i].nodeType == 1) {
|
||||
const element = document.createElement("div");
|
||||
element.innerHTML = str;
|
||||
const c = element.childNodes;
|
||||
for (let i = c.length - 1; i >= 0; i--) {
|
||||
if (c[i].nodeType === 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -3491,7 +3493,12 @@ let CONSTANTS = {
|
||||
"at levels 1, 2, and 3, respectively (increased from 8%, 12%, 14%)<br>" +
|
||||
"* The effect of Source-File 12 is now additive with itself, rather than multiplicative. This means " +
|
||||
"that level N of Source-File 12 now increases all multipliers by N%<br>" +
|
||||
"* The setting to suppress the confirmation box when purchasing Augmentations was moved into the main Options menu (by Github user hydroflame)<br>"
|
||||
"* The setting to suppress the confirmation box when purchasing Augmentations was moved into the main Options menu (by Github user hydroflame)<br>" +
|
||||
"* Bug Fix: Crime Success rates were being calculated incorrectly (by Github user hydroflame)<br>" +
|
||||
"* When an Infiltration is finished, you will now return back to the company's page, rather than the city<br>" +
|
||||
"* Infiltration faction reputation selector now remembers your last choice<br>" +
|
||||
"* Bug Fix: Copying a NetscriptJS script to another server using scp now properly takes into account " +
|
||||
"the script's changes.<br>"
|
||||
|
||||
|
||||
}
|
||||
@ -12436,14 +12443,14 @@ function initBitNodeMultipliers() {
|
||||
BitNodeMultipliers.CorporationValuation = 0.01;
|
||||
break;
|
||||
case 12: //The Recursion
|
||||
let sf12Lvl = 0;
|
||||
for (let i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_0__["Player"].sourceFiles.length; i++) {
|
||||
var sf12Lvl = 0;
|
||||
for (var i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_0__["Player"].sourceFiles.length; i++) {
|
||||
if (_Player__WEBPACK_IMPORTED_MODULE_0__["Player"].sourceFiles[i].n === 12) {
|
||||
sf12Lvl = _Player__WEBPACK_IMPORTED_MODULE_0__["Player"].sourceFiles[i].lvl;
|
||||
}
|
||||
}
|
||||
const inc = Math.pow(1.01, sf12Lvl);
|
||||
const dec = Math.pow(0.99, sf12Lvl);
|
||||
var inc = Math.pow(1.01, sf12Lvl);
|
||||
var dec = Math.pow(0.99, sf12Lvl);
|
||||
BitNodeMultipliers.HackingLevelMultiplier = dec;
|
||||
|
||||
BitNodeMultipliers.ServerMaxMoney = dec;
|
||||
@ -15842,8 +15849,8 @@ function initSettings() {
|
||||
Settings.MaxPortCapacity = 50;
|
||||
Settings.SuppressMessages = false;
|
||||
Settings.SuppressFactionInvites = false;
|
||||
Settings.SuppressTravelConfirmation = false,
|
||||
Settings.SuppressBuyAugmentationConfirmation = false,
|
||||
Settings.SuppressTravelConfirmation = false;
|
||||
Settings.SuppressBuyAugmentationConfirmation = false;
|
||||
Settings.AutosaveInterval = 60;
|
||||
Settings.DisableHotkeys = false;
|
||||
}
|
||||
@ -17664,7 +17671,7 @@ $(document).keyup(function(e) {
|
||||
})
|
||||
|
||||
//Implements a tab completion feature for terminal
|
||||
// command - Command (first arg only)
|
||||
// command - Terminal command except for the last incomplete argument
|
||||
// arg - Incomplete argument string that the function will try to complete, or will display
|
||||
// a series of possible options for
|
||||
// allPossibilities - Array of strings containing all possibilities that the
|
||||
@ -18826,6 +18833,7 @@ let Terminal = {
|
||||
var oldScript = destServer.scripts[i];
|
||||
oldScript.code = sourceScript.code;
|
||||
oldScript.ramUsage = sourceScript.ramUsage;
|
||||
oldScript.module = "";
|
||||
post(scriptname + " overwriten on " + destServer.hostname);
|
||||
return;
|
||||
}
|
||||
@ -30122,7 +30130,7 @@ const Crimes = {
|
||||
dexterity_exp: 60,
|
||||
agility_exp: 60,
|
||||
|
||||
hacking_skill_success_weight: 0.5,
|
||||
hacking_success_weight: 0.5,
|
||||
dexterity_success_weight: 1,
|
||||
agility_success_weight: 1,
|
||||
|
||||
@ -30144,7 +30152,7 @@ const Crimes = {
|
||||
dexterity_exp: 150,
|
||||
charisma_exp: 15,
|
||||
|
||||
hacking_skill_success_weight: 0.05,
|
||||
hacking_success_weight: 0.05,
|
||||
dexterity_success_weight: 1.25,
|
||||
|
||||
intelligence_exp: 2 * _Constants__WEBPACK_IMPORTED_MODULE_0__["CONSTANTS"].IntelligenceCrimeBaseExpGain,
|
||||
@ -30185,7 +30193,7 @@ const Crimes = {
|
||||
agility_exp: 80,
|
||||
charisma_exp: 40,
|
||||
|
||||
hacking_skill_success_weight: 1,
|
||||
hacking_success_weight: 1,
|
||||
strength_success_weight: 1,
|
||||
dexterity_success_weight: 4,
|
||||
agility_success_weight: 2,
|
||||
@ -30232,7 +30240,7 @@ const Crimes = {
|
||||
agility_exp: 450,
|
||||
charisma_exp: 450,
|
||||
|
||||
hacking_skill_success_weight: 1,
|
||||
hacking_success_weight: 1,
|
||||
strength_success_weight: 1,
|
||||
defense_success_weight: 1,
|
||||
dexterity_success_weight: 1,
|
||||
@ -31568,6 +31576,7 @@ function NetscriptFunctions(workerScript) {
|
||||
var oldScript = destServer.scripts[i];
|
||||
oldScript.code = sourceScript.code;
|
||||
oldScript.ramUsage = sourceScript.ramUsage;
|
||||
oldScript.module = "";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -53348,8 +53357,8 @@ function applySourceFile(srcFile) {
|
||||
_Player__WEBPACK_IMPORTED_MODULE_0__["Player"].company_rep_mult *= incMult;
|
||||
break;
|
||||
case 12: //The testing ground
|
||||
const inc = 1 + (srcFile.level/100);
|
||||
const dec = 1 - (srcFile.level/100);
|
||||
var inc = 1 + (srcFile.level/100);
|
||||
var dec = 1 - (srcFile.level/100);
|
||||
|
||||
_Player__WEBPACK_IMPORTED_MODULE_0__["Player"].hacking_chance_mult *= inc;
|
||||
_Player__WEBPACK_IMPORTED_MODULE_0__["Player"].hacking_speed_mult *= inc;
|
||||
@ -69587,7 +69596,9 @@ function purchaseRamForHomeComputer(cost) {
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// Contains the "information" property for all the Factions, which is just a description of each faction
|
||||
/**
|
||||
* Contains the "information" property for all the Factions, which is just a description of each faction
|
||||
*/
|
||||
class FactionInfo {
|
||||
constructor(infoText, enemies, offerHackingMission, offerHackingWork, offerFieldWork, offerSecurityWork) {
|
||||
this.infoText = infoText;
|
||||
@ -69601,7 +69612,11 @@ class FactionInfo {
|
||||
this.augmentationRepRequirementMult = 1;
|
||||
}
|
||||
}
|
||||
const FactionInfos = {
|
||||
/**
|
||||
* A map of all factions and associated info to them.
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
exports.FactionInfos = {
|
||||
// Endgame
|
||||
Illuminati: new FactionInfo("Humanity never changes. No matter how civilized society becomes, it will eventually" +
|
||||
"fall back into chaos. And from this chaos, we are the Invisible hand that guides them to order. ", [], true, true, true, false),
|
||||
@ -69713,7 +69728,6 @@ const FactionInfos = {
|
||||
"faction, reputation can only be gained through Bladeburner actions. Completing " +
|
||||
"Bladeburner contracts/operations will increase your reputation.", [], false, false, false, false),
|
||||
};
|
||||
exports.FactionInfos = FactionInfos;
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -99962,8 +99976,7 @@ let NetscriptFunctions =
|
||||
"getActionTime|getActionEstimatedSuccessChance|getActionCountRemaining|" +
|
||||
"getRank|getSkillPoints|getSkillLevel|upgradeSkill|getTeamSize|" +
|
||||
"setTeamSize|getCityEstimatedPopulation|getCityEstimatedCommunities|" +
|
||||
"getCityChaos|switchCity|getStamina|joinBladeburnerFaction"
|
||||
;
|
||||
"getCityChaos|switchCity|getStamina|joinBladeburnerFaction";
|
||||
|
||||
var NetscriptHighlightRules = function(options) {
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
|
@ -498,7 +498,12 @@ let CONSTANTS = {
|
||||
"at levels 1, 2, and 3, respectively (increased from 8%, 12%, 14%)<br>" +
|
||||
"* The effect of Source-File 12 is now additive with itself, rather than multiplicative. This means " +
|
||||
"that level N of Source-File 12 now increases all multipliers by N%<br>" +
|
||||
"* The setting to suppress the confirmation box when purchasing Augmentations was moved into the main Options menu (by Github user hydroflame)<br>"
|
||||
"* The setting to suppress the confirmation box when purchasing Augmentations was moved into the main Options menu (by Github user hydroflame)<br>" +
|
||||
"* Bug Fix: Crime Success rates were being calculated incorrectly (by Github user hydroflame)<br>" +
|
||||
"* When an Infiltration is finished, you will now return back to the company's page, rather than the city<br>" +
|
||||
"* Infiltration faction reputation selector now remembers your last choice<br>" +
|
||||
"* Bug Fix: Copying a NetscriptJS script to another server using scp now properly takes into account " +
|
||||
"the script's changes.<br>"
|
||||
|
||||
|
||||
}
|
||||
|
@ -877,6 +877,7 @@ function NetscriptFunctions(workerScript) {
|
||||
var oldScript = destServer.scripts[i];
|
||||
oldScript.code = sourceScript.code;
|
||||
oldScript.ramUsage = sourceScript.ramUsage;
|
||||
oldScript.module = "";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ $(document).keyup(function(e) {
|
||||
})
|
||||
|
||||
//Implements a tab completion feature for terminal
|
||||
// command - Command (first arg only)
|
||||
// command - Terminal command except for the last incomplete argument
|
||||
// arg - Incomplete argument string that the function will try to complete, or will display
|
||||
// a series of possible options for
|
||||
// allPossibilities - Array of strings containing all possibilities that the
|
||||
@ -1466,6 +1466,7 @@ let Terminal = {
|
||||
var oldScript = destServer.scripts[i];
|
||||
oldScript.code = sourceScript.code;
|
||||
oldScript.ramUsage = sourceScript.ramUsage;
|
||||
oldScript.module = "";
|
||||
post(scriptname + " overwriten on " + destServer.hostname);
|
||||
return;
|
||||
}
|
||||
|
@ -49,14 +49,13 @@ function longestCommonStart(strings: string[]): string {
|
||||
if (!containsAllStrings(strings)) {return ""; }
|
||||
if (strings.length === 0) {return ""; }
|
||||
|
||||
const A: string[] = strings.concat()
|
||||
.sort();
|
||||
const A: string[] = strings.concat().sort();
|
||||
const a1: string = A[0];
|
||||
const a2: string = A[A.length - 1];
|
||||
const L: number = a1.length;
|
||||
let i: number = 0;
|
||||
const areEqualCaseInsensitive: EqualityFunc<string> = (a: string, b: string) => a.toUpperCase() === b.toUpperCase();
|
||||
while (i < L && areEqualCaseInsensitive(a1, a2)) {
|
||||
while (i < L && areEqualCaseInsensitive(a1.charAt(i), a2.charAt(i))) {
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -133,7 +132,7 @@ function isHTML(str: string): boolean {
|
||||
const element: HTMLDivElement = document.createElement("div");
|
||||
element.innerHTML = str;
|
||||
const c: NodeListOf<Node & ChildNode> = element.childNodes;
|
||||
for (let i: number = c.length; i >= 0; i--) {
|
||||
for (let i: number = c.length-1; i >= 0; i--) {
|
||||
if (c[i].nodeType === 1) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user