From 47e57eb6457a14fdf0ccf7fcf4ab9827d47fda8b Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Tue, 6 Jun 2017 19:37:38 -0500 Subject: [PATCH] Fixed bugs with Prestige --- src/Constants.js | 50 +++++++++++++++++++++++------------------------ src/Prestige.js | 9 ++------- src/SaveObject.js | 2 -- 3 files changed, 27 insertions(+), 34 deletions(-) diff --git a/src/Constants.js b/src/Constants.js index 7b68ed8e4..bfbb273bb 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -308,7 +308,7 @@ 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 " + this.ServerFortifyAmount + ". Returns true if the hack is successful and " + + "a server will raise that server's security level by 0.002. Returns true if the hack is successful and " + "false otherwise.
" + "Examples: hack('foodnstuff'); or hack('148.192.0.12');

" + "sleep(n)
Suspends the script for n milliseconds.
Example: sleep(5000);

" + @@ -318,16 +318,16 @@ CONSTANTS = { "is determined by the server's growth rate and varies between servers. Generally, higher-level servers have higher growth rates.

" + "Like hack(), grow() can be called on any server, regardless of where the script is running. " + "The grow() command requires root access to the target server, but there is no required hacking level to run the command. " + - "It grants 0.5 hacking exp when it completes. It also raises the security level of the target server by " + (2 * this.ServerFortifyAmount) + ". " + + "It grants 0.5 hacking exp when it completes. It also raises the security level of the target server by 0.004. " + "Returns the number by which the money on the server was multiplied for the growth. " + "Works offline at a slower rate.
Example: grow('foodnstuff');

" + "weaken(hostname/ip)
Use your hacking skills to attack a server's security, lowering the server's security level. 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. This function lowers the security level of the target server by " + - this.ServerWeakenAmount + ".

Like hack() and grow(), weaken() can be called on " + + "0.1.

Like hack() and grow(), weaken() can be called on " + "any server, regardless of where the script is running. This command requires root access to the target server, but " + "there is no required hacking level to run the command. Grants 3 hacking exp when it completes. Returns " + - this.ServerWeakenAmount + ". Works offline at a slower rate
Example: weaken('foodnstuff');

" + + "0.1. Works offline at a slower rate
Example: weaken('foodnstuff');

" + "print(x)
Prints a value or a variable to the scripts logs (which can be viewed with the 'tail [script]' terminal command )

" + "nuke(hostname/ip)
Run NUKE.exe on the target server. NUKE.exe must exist on your home computer. Does NOT work while offline
Example: nuke('foodnstuff');

" + "brutessh(hostname/ip)
Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer. Does NOT work while offline
Example: brutessh('foodnstuff');

" + @@ -555,7 +555,7 @@ CONSTANTS = { "-Increased monetary cost of RAM (Upgrading home computer and purchasing servers will now be more expensive)

" + "-NEW GROWTH MECHANICS - The rate of growth on a server now depends on a server's security level. A higher security level " + "will result in lower growth on a server when using the grow() command. Furthermore, calling grow() on a server raises that " + - "server's security level by " + (2 * this.ServerFortifyAmount) + ". For reference, if a server has a security level of 10 " + + "server's security level by 0.004. For reference, if a server has a security level of 10 " + "it will have approximately the same growth rate as before.

" + "-Server growth no longer happens naturally

" + "-Servers now have a maximum limit to their money. This limit is 50 times it's starting money

" + @@ -644,30 +644,30 @@ CONSTANTS = { "-You can now see what an Augmentation does and its price even while its locked

", LatestUpdate: - "v0.20.0
" + + "v0.20.0
" + "-Refactored Netscript Interpreter code. Operations in Netscript should now run significantly faster (Every operation " + "such as a variable assignment, a function call, a binary operator, getting a variable's value, etc. used to take up to several seconds, " + - "now each one should only take 750 milliseconds).
" + - "-Percentage money stolen when hacking lowered to compensate for faster script speeds
" + - "-Hacking experience granted by grow() halved
" + - "-Weaken() is now ~11% faster, but only grants 3 base hacking exp upon completion instead of 5
" + + "now each one should only take 750 milliseconds).

" + + "-Percentage money stolen when hacking lowered to compensate for faster script speeds

" + + "-Hacking experience granted by grow() halved

" + + "-Weaken() is now ~11% faster, but only grants 3 base hacking exp upon completion instead of 5

" + "-Rebalancing of script RAM costs. Base RAM Cost for a script increased from 1GB to 1.5GB. Loops, hack(), grow() " + - "and weaken() all cost slightly less RAM than before
" + - "-Added getServerRequiredHackingLevel(server) Netscript command.
" + + "and weaken() all cost slightly less RAM than before

" + + "-Added getServerRequiredHackingLevel(server) Netscript command.

" + "-Added fileExists(file, [server]) Netscript command, which is used to check if a script/program exists on a " + - "specified server
" + - "-Added isRunning(script, [server]) Netscript command, which is used to check if a script is running on the specified server
" + - "-Added killall Terminal command. Kills all running scripts on the current machine
" + - "-Added kill() and killall() Netscript commands. Used to kill scripts on specified machines. See Netscript documentation
" + - "-Re-designed 'Active Scripts' tab
" + - "-Hacknet Node base production rate lowered from 1.6 to 1.55 ($/second)
" + - "-Increased monetary cost of RAM (Upgrading home computer and purchasing servers will now be more expensive)
" + + "specified server

" + + "-Added isRunning(script, [server]) Netscript command, which is used to check if a script is running on the specified server

" + + "-Added killall Terminal command. Kills all running scripts on the current machine

" + + "-Added kill() and killall() Netscript commands. Used to kill scripts on specified machines. See Netscript documentation

" + + "-Re-designed 'Active Scripts' tab

" + + "-Hacknet Node base production rate lowered from 1.6 to 1.55 ($/second)

" + + "-Increased monetary cost of RAM (Upgrading home computer and purchasing servers will now be more expensive)

" + "-NEW GROWTH MECHANICS - The rate of growth on a server now depends on a server's security level. A higher security level " + "will result in lower growth on a server when using the grow() command. Furthermore, calling grow() on a server raises that " + - "server's security level by " + (2 * this.ServerFortifyAmount) + ". For reference, if a server has a security level of 10 " + - "it will have approximately the same growth rate as before.
" + - "-Server growth no longer happens naturally
" + - "-Servers now have a maximum limit to their money. This limit is 50 times it's starting money
" + - "-Hacking now grants 10% less hacking experience
" + - "-You can now edit scripts that are running

", + "server's security level by 0.004. For reference, if a server has a security level of 10 " + + "it will have approximately the same growth rate as before.

" + + "-Server growth no longer happens naturally

" + + "-Servers now have a maximum limit to their money. This limit is 50 times it's starting money

" + + "-Hacking now grants 10% less hacking experience

" + + "-You can now edit scripts that are running
", } \ No newline at end of file diff --git a/src/Prestige.js b/src/Prestige.js index 7d642d241..0392fd640 100644 --- a/src/Prestige.js +++ b/src/Prestige.js @@ -109,8 +109,10 @@ function prestigeAugmentation() { //Delete all running scripts objects for (var i = 0; i < workerScripts.length; ++i) { + deleteActiveScriptsItem(workerScripts[i]); workerScripts[i].env.stopFlag = true; } + workerScripts.length = 0; var homeComp = Player.getHomeComputer(); //Delete all servers except home computer @@ -161,13 +163,6 @@ function prestigeAugmentation() { //Delete messages on home computer homeComp.messages.length = 0; - //Delete active scripts display elements - var list = Engine.ActiveScriptsList.querySelectorAll('#active-scripts-list li'); - for (var i = list.length-1; i >= 0; --i) { - Engine.deleteActiveScriptsItem(i); - } - workerScripts.length = 0; - //Delete Hacknet Nodes Player.hacknetNodes.length = 0; Player.totalHacknetNodeProduction = 0; diff --git a/src/SaveObject.js b/src/SaveObject.js index 032a10a4a..7bc88c30b 100644 --- a/src/SaveObject.js +++ b/src/SaveObject.js @@ -67,9 +67,7 @@ loadGame = function(saveObj) { } if (saveObj.hasOwnProperty("VersionSave")) { try { - console.log("here"); var ver = JSON.parse(saveObj.VersionSave, Reviver); - console.log("version from save: " + ver); if (ver != CONSTANTS.Version) { createNewUpdateText(); }