From 58d48f19efe41db8fe558b38f25efc926aea95f8 Mon Sep 17 00:00:00 2001
From: danielyxie Script name:
",
LatestUpdate:
- "v0.40.2
" +
- "------------------------------
" +
- "* Bladeburner Changes:
" +
- "*** Added getBonusTime(), getSkillUpgradeCost(), and getCity() Netscript functions to the API
" +
- "*** Buffed the effects of many Bladeburner Augmentations
" +
- "*** The Blade's Simulacrum Augmentation requires significantly less reputation but slightly more money
" +
- "*** Slightly increased the amount of successes needed for a Contract/Operation in order to increase its max level
" +
- "*** Increased the amount of money gained from Contracts by ~25%
" +
- "*** Increased the base amount of rank gained from Operations by 10%
" +
- "*** Significantly increased the 'randomness' in determining a Contract/Operation's initial count and rate of count increase
" +
- "*** The number (count) of Operations should now increase significantly faster
" +
- "*** There are now, on average, more Synthoid communities in a city
" +
- "*** If automation is enabled (the feature in Bladeburner console), then switching to another action such as working for a company will now disable the automation
" +
- "------------------------------
" +
- "* Stock Market Changes:
" +
- "***Added a watchlist filter feature to the UI that allows you to specify which stocks to show
" +
- "***Added the Four Sigma (4S) Market Data feed, which provides volatility and price forecast information about stocks
" +
- "***Added the 4S Market Data TIX API, which lets you access the aforementioned data through Netscript
" +
- "------------------------------
" +
- "* There is now a setting for enabling/disabling the popup that appears when you are hospitalized
" +
- "* Bug Fix: Stock market should now be correctly initialized in BitNode-8 (by Kline-)
" +
- "* Bug Fix: bladeburner.getCurrentAction() should now properly an 'Idle' object rather than null (by Kline-)
" +
- "* Bug Fix: Bladeburner skill cost multiplier should now properly increase in BitNode-12 (by hydroflame)
" +
- "* Bug Fix: 'document', 'hacknet', and 'window' keywords should no longer be counted multiple times in RAM calculations
" +
- "* Bug Fix: Joining factions through Singularity functions should now prevent you from joining opposing factions
" +
- "* Bug Fix: Four Sigma should no longer have two 'Speech Enhancement' Augmentations (by Kline-)
"
+ "v0.40.3
" +
+ ""
}
diff --git a/src/Fconf.js b/src/Fconf.js
index 77cddf622..be3729360 100644
--- a/src/Fconf.js
+++ b/src/Fconf.js
@@ -1,8 +1,9 @@
import {parse, Node} from "../utils/acorn";
var FconfSettings = {
- ENABLE_BASH_HOTKEYS: false,
- ENABLE_TIMESTAMPS: false,
+ ENABLE_BASH_HOTKEYS: false,
+ ENABLE_TIMESTAMPS: false,
+ WRAP_INPUT: false,
}
var FconfComments = {
@@ -15,6 +16,11 @@ var FconfComments = {
"http://bitburner.readthedocs.io/en/latest/shortcuts.html",
ENABLE_TIMESTAMPS: "Terminal commands and log entries will be timestamped. The timestamp\n" +
"will have the format: M/D h:m",
+ WRAP_INPUT: "Wrap Terminal Input. If this is enabled, then when a Terminal command is\n" +
+ "too long and overflows, then it will wrap to the next line instead of\n" +
+ "side-scrolling\n\n" +
+ "Note that after you enable/disable this, you'll have to run a command\n" +
+ "before its effect takes place.",
}
//Parse Fconf settings from the config text
@@ -74,6 +80,7 @@ function parseFconfSetting(setting, value) {
switch(setting) {
case "ENABLE_BASH_HOTKEYS":
case "ENABLE_TIMESTAMPS":
+ case "WRAP_INPUT":
var value = value.toLowerCase();
if (value === "1" || value === "true" || value === "y") {
value = true;
diff --git a/src/Terminal.js b/src/Terminal.js
index 821416ac2..aac09ecef 100644
--- a/src/Terminal.js
+++ b/src/Terminal.js
@@ -48,6 +48,7 @@ import {yesNoBoxCreate,
import {post, hackProgressBarPost,
hackProgressPost} from "./ui/postToTerminal";
+import autosize from 'autosize';
import * as JSZip from 'jszip';
import * as FileSaver from 'file-saver';
@@ -64,8 +65,8 @@ $(document).keydown(function(event) {
if (event.keyCode === KEY.ENTER) {
event.preventDefault(); //Prevent newline from being entered in Script Editor
- var command = $('input[class=terminal-input]').val();
- post(
+ var command = terminalInput.value;
+ post(
"[" +
(FconfSettings.ENABLE_TIMESTAMPS ? getTimestamp() + " " : "") +
Player.getCurrentServer().hostname +
@@ -520,9 +521,18 @@ let Terminal = {
commandHistoryIndex: 0,
resetTerminalInput: function() {
- document.getElementById("terminal-input-td").innerHTML =
- "
" +
- ""
+ "* Added a setting in .fconf for enabling line-wrap in the Terminal input
"
}
diff --git a/src/HelpText.ts b/src/HelpText.ts
index ff88a21ce..0c5bfaf76 100644
--- a/src/HelpText.ts
+++ b/src/HelpText.ts
@@ -32,7 +32,8 @@ export const TerminalHelpText: string =
"tail [script] [args...] Displays dynamic logs for the specified script
" +
"theme [preset] | bg txt hlgt Change the color scheme of the UI
" +
"top Displays all running scripts and their RAM usage
" +
- 'unalias "[alias name]" Deletes the specified alias
';
+ 'unalias "[alias name]" Deletes the specified alias
' +
+ 'wget [url] [target file] Retrieves code/text from a web server
';
interface IMap
" +
'unalias "r"
' +
"It is not necessary to differentiate between global and non-global aliases when using 'unalias'",
-
+ wget: "wget [url] [target file]
" +
+ "Retrieves data from a URL and downloads it to a file on the current server. The data can only " +
+ "be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists, " +
+ "it will be overwritten by this command.
" +
+ "Note that it will not be possible to download data from many websites because they do not allow " +
+ "cross-origin resource sharing (CORS). Example:
" +
+ "wget https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md game_readme.txt",
};
diff --git a/src/SaveObject.js b/src/SaveObject.js
index 55db3250e..c83734979 100644
--- a/src/SaveObject.js
+++ b/src/SaveObject.js
@@ -451,7 +451,7 @@ function loadImportedGame(saveObj, saveString) {
var popupId = "import-game-restart-game-notice";
var txt = createElement("p", {
- innerText:"Imported game! I would suggest saving the game and then reloading the page " +
+ innerText:"Imported game! You need to SAVE the game and then RELOAD the page " +
"to make sure everything runs smoothly"
});
var gotitBtn = createElement("a", {
diff --git a/src/Terminal.js b/src/Terminal.js
index aac09ecef..3001c1164 100644
--- a/src/Terminal.js
+++ b/src/Terminal.js
@@ -741,7 +741,56 @@ let Terminal = {
$('input[class=terminal-input]').prop('disabled', false);
},
- executeCommand: function(command) {
+ writeToScriptFile : function(server, fn, code) {
+ var ret = {success: false, overwritten: false};
+ if (!isScriptFilename(fn) || !(server instanceof Server)) { return ret; }
+
+ //Check if the script already exists, and overwrite it if it does
+ for (let i = 0; i < server.scripts.length; ++i) {
+ if (fn === server.scripts[i].filename) {
+ let script = server.scripts[i];
+ script.code = code;
+ script.updateRamUsage();
+ script.module = "";
+ ret.overwritten = true;
+ ret.success = true;
+ return ret;
+ }
+ }
+
+ //Otherwise, create a new script
+ var newScript = new Script();
+ newScript.filename = fn;
+ newScript.code = code;
+ newScript.updateRamUsage();
+ newScript.server = server.ip;
+ server.scripts.push(newScript);
+ ret.success = true;
+ return ret;
+ },
+
+ writeToTextFile : function(server, fn, txt) {
+ var ret = {success: false, overwritten: false};
+ if (!fn.endsWith("txt") || !(server instanceof Server)) { return ret; }
+
+ //Check if the text file already exists, and overwrite if it does
+ for (let i = 0; i < server.textFiles.length; ++i) {
+ if (server.textFiles[i].fn === fn) {
+ ret.overwritten = true;
+ server.textFiles[i].text = txt;
+ ret.success = true;
+ return ret;
+ }
+ }
+
+ //Otherwise create a new text file
+ var newFile = new TextFile(fn, txt);
+ server.textFiles.push(newFile);
+ ret.success = true;
+ return ret;
+ },
+
+ executeCommand : function(command) {
command = command.trim();
//Replace all extra whitespace in command with a single space
command = command.replace(/\s\s+/g, ' ');
@@ -1395,8 +1444,7 @@ let Terminal = {
}
}
destServer.messages.push(scriptname);
- post(scriptname + " copied over to " + destServer.hostname);
- return;
+ return post(scriptname + " copied over to " + destServer.hostname);
}
//Scp for txt files
@@ -1412,18 +1460,15 @@ let Terminal = {
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);
- }
+ let tRes = Terminal.writeToTextFile(destServer, txtFile.fn, txtFile.text);
+ if (!tRes.success) {
+ return post("Error: scp failed");
}
- var newFile = new TextFile(txtFile.fn, txtFile.text);
- destServer.textFiles.push(newFile);
- return post(scriptname + " copied over to " + destServer.hostname);
+ if (tRes.overwritten) {
+ post(`WARNING: ${scriptname} already exists on ${destServer.hostname} and will be overwriten`);
+ return post(`${scriptname} overwritten on ${destServer.hostname}`);
+ }
+ return post(`${scriptname} copied over to ${destServer.hostname}`);
}
//Get the current script
@@ -1439,27 +1484,16 @@ let Terminal = {
return;
}
- //Overwrite script if it exists
- 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;
- oldScript.module = "";
- post(scriptname + " overwriten on " + destServer.hostname);
- return;
- }
+ let sRes = Terminal.writeToScriptFile(destServer, scriptname, sourceScript.code);
+ if (!sRes.success) {
+ return post(`Error: scp failed`);
}
-
- var newScript = new Script();
- newScript.filename = scriptname;
- newScript.code = sourceScript.code;
- newScript.ramUsage = sourceScript.ramUsage;
- newScript.destServer = ip;
- destServer.scripts.push(newScript);
- post(scriptname + " copied over to " + destServer.hostname);
- break;
+ if (sRes.overwritten) {
+ post(`WARNING: ${scriptname} already exists on ${destServer.hostname} and will be overwritten`);
+ return post(`${scriptname} overwritten on ${destServer.hostname}`);
+ }
+ post(`${scriptname} copied over to ${destServer.hostname}`);
+ break;
case "sudov":
if (commandArray.length != 1) {
post("Incorrect number of arguments. Usage: sudov"); return;
@@ -1594,10 +1628,25 @@ let Terminal = {
let url = args[0];
let target = args[1];
+ if (!isScriptFilename(target) && !target.endsWith(".txt")) {
+ return post(`wget failed: Invalid target file. Target file must be script or text file`);
+ }
$.get(url, function(data) {
- post(data);
+ let res;
+ if (isScriptFilename(target)) {
+ res = Terminal.writeToScriptFile(s, target, data);
+ } else {
+ res = Terminal.writeToTextFile(s, target, data);
+ }
+ if (!res.success) {
+ return post("wget failed");
+ }
+ if (res.overwritten) {
+ return post(`wget successfully retrieved content and overwrote ${target}`);
+ }
+ return post(`wget successfully retrieved content to new file ${target}`);
}, 'text').fail(function(e) {
- post("wget failed: " + JSON.stringify(e));
+ return post("wget failed: " + JSON.stringify(e));
})
break;
default:
From 93c1d603c5f4c6bfc2a427e62d51c5b56e1badc8 Mon Sep 17 00:00:00 2001
From: danielyxie
@@ -187,7 +187,7 @@
provides information about each script's production. The scripts are categorized by the hostname of the servers on which
they are running.
$
-
+
Total online production of
- Active scripts: $0.000 / sec
+ Active scripts: $0.000 / sec
Total online production since last Aug installation: $0.000
($0.000 / sec)
- Money:
+ Money:
Total Hacknet Node Production: