From cf99c4f10b434cc9c33c9f3ccd1c705a400ba1c6 Mon Sep 17 00:00:00 2001 From: danielyxie Date: Fri, 18 Aug 2017 12:20:51 -0500 Subject: [PATCH] Added literature (.lit files). Fixed bug with Gang Territory. Updated documentation --- index.html | 1 + src/Constants.js | 42 ++++- src/Gang.js | 12 +- src/HelpText.js | 17 +- src/Literature.js | 345 +++++++++++++++++++++++++++++++++----- src/NetscriptFunctions.js | 22 ++- src/Server.js | 39 ++++- src/Terminal.js | 85 ++++++++-- src/engine.js | 14 +- 9 files changed, 494 insertions(+), 83 deletions(-) diff --git a/index.html b/index.html index 9002237da..dbe04fe62 100644 --- a/index.html +++ b/index.html @@ -1006,6 +1006,7 @@ + diff --git a/src/Constants.js b/src/Constants.js index b3072a5de..db79b7931 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -1,5 +1,5 @@ CONSTANTS = { - Version: "0.27.1", + Version: "0.27.2", //Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then @@ -236,7 +236,11 @@ CONSTANTS = { "the grow() command in a script will also increase security level of the target server. These actions will " + "make it harder for you to hack the server, and decrease the amount of money you can steal. You can lower a " + "server's security level in a script using the weaken(server) function in Netscript. See the Netscript " + - "documentation for more details", + "documentation for more details.

" + + "A server has a minimum security level that is equal to one third of its starting security, rounded to the " + + "nearest integer. To be more precise:

" + + "server.minSecurityLevel = Math.max(1, Math.round(server.startingSecurityLevel / 3))

" + + "This means that a server's security will not fall below this value if you are trying to weaken it.", TutorialScriptsText: "Scripts can be used to automate the hacking process. Scripts must be written in the Netscript language. " + "Documentation about the Netscript language can be found in the 'Netscript Programming Language' " + @@ -276,7 +280,7 @@ CONSTANTS = { "top
Displays all active scripts and their RAM usage

" + "

Multithreading scripts


" + "Scripts can be multithreaded. A multithreaded script runs the script's code once in each thread. The result is that " + - "every call to the hack(), grow(), and weaken() Netscript functions will have its effect multiplied by the number of scripts. " + + "every call to the hack(), grow(), and weaken() Netscript functions will have its effect multiplied by the number of threads. " + "For example, if a normal single-threaded script is able to hack $10,000, then running the same script with 5 threads would " + "yield $50,000.

" + "When multithreading a script, the total RAM cost can be calculated by simply multiplying the base RAM cost of the script " + @@ -448,6 +452,10 @@ CONSTANTS = { "hostname or IP of the target server. Does NOT work while offline
Example: getServerMoneyAvailable('foodnstuff');

" + "getServerMaxMoney(hostname/ip)
Returns the maximum amount of money that can be available on a server. The argument passed in must be a string with " + "the hostname or IP of the target server. Does NOT work while offline
Example: getServerMaxMoney('foodnstuff');

" + + "getServerGrowth(hostname/ip)
Returns the server's intrinsic 'growth parameter'. This growth parameter is a number " + + "between 1 and 100 that represents how quickly the server's money grows. This parameter affects the percentage by which this server's " + + "money is increased when using the grow() function. A higher growth parameter will result in a higher percentage from grow().

" + + "The argument passed in must be a string with the hostname or IP of the target server.

" + "getServerSecurityLevel(hostname/ip)
Returns the security level of a server. The argument passed in must be a string with either the " + "hostname or IP of the target server. A server's security is denoted by a number between 1 and 100. Does NOT work while offline.

" + "getServerBaseSecurityLevel(hostname/ip)
Returns the base security level of a server. This is the security level that the server starts out with. " + @@ -455,10 +463,13 @@ CONSTANTS = { "due to hack(), grow(), and weaken() calls on that server. The base security level will stay the same until you reset by installing an Augmentation.

" + "The argument passed in must be a string with either the hostname or IP of the target server. A server's base security is denoted by a number between 1 and 100. " + "Does NOT work while offline.

" + - "getServerRequiredHackingLevel(hostname/ip)
Returns the required hacking level of a server. The argument passed in must be a string with either the " + + "getServerRequiredHackingLevel(hostname/ip)
Returns the required hacking level of a server. The argument passed in must be a string with either the " + "hostname or IP or the target server. Does NOT work while offline

" + "getServerNumPortsRequired(hostname/ip)
Returns the number of open ports required to successfully run NUKE.exe on a server. The argument " + "passed in must be a string with either the hostname or IP of the target server. Does NOT work while offline

" + + "getServerRam(hostname/ip)
Returns an array with two elements that gives information about the target server's RAM. The first " + + "element in the array is the amount of RAM that the server has (in GB). The second element in the array is the amount of RAM that " + + "is currently being used on the server.

" + "fileExists(filename, [hostname/ip])
Returns a boolean (true or false) indicating whether the specified file exists on a server. " + "The first argument must be a string with the name of the file. A file can either be a script or a program. A script name is case-sensitive, but a " + "program is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe.

" + @@ -480,7 +491,8 @@ CONSTANTS = { "example above will return true if there is a script named 'foo.script' with no arguments running on the current server, and false otherwise. " + "The third example above will return true if there is a script named 'foo.script' with the arguments 1, 5, and 'test' running on the 'joesguns' server, and " + "false otherwise.

" + - "purchaseHacknetNode()
Purchases a new Hacknet Node. Returns a number with the index of the Hacknet Node. This index is equivalent to the number " + + "getNextHacknetNodeCost()
Returns the cost of purchasing a new Hacknet Node

" + + "purchaseHacknetNode()
Purchases a new Hacknet Node. Returns a number with the index of the Hacknet Node. This index is equivalent to the number " + "at the end of the Hacknet Node's name (e.g The Hacknet Node named 'hacknet-node-4' will have an index of 4). If the player cannot afford to purchase " + "a new Hacknet Node then the function will return false. Does NOT work offline

" + "purchaseServer(hostname, ram)
Purchases a server with the specified hostname and amount of RAM. The first argument can be any data type, " + @@ -495,6 +507,18 @@ CONSTANTS = { "argument defines the data to write to the port. If the second argument is not specified then it will write an empty string to the port.

" + "read(port)
Reads data from a port. The first argument must be a number between 1 and 10 that specifies the port. A port is a serialized queue. " + "This function will remove the first element from the queue and return it. If the queue is empty, then the string 'NULL PORT DATA' will be returned.

" + + "scriptRunning(scriptname, hostname/ip)
Returns a boolean indicating whether any instance of the specified script is running " + + "on a server, regardless of its arguments. This is different than the isRunning() function because it does not " + + "try to identify a specific instance of a running script by its arguments.

" + + "The first argument must be a string with the name of the script. The script name is case sensitive. The second argument is " + + "a string with the hostname or IP of the target server. Both arguments are required.

" + + "scriptKill(scriptname, hostname/ip)
Kills all scripts with the specified filename that are running on the server specified by the " + + "hostname/ip, regardless of arguments. Returns true if one or more scripts were successfully killed, and false if there were none.

" + + "The first argument must be a string with the name of the script. The script name is case sensitive. The second argument is " + + "a string with the hostname or IP of the target server. Both arguments are required.

" + + "getScriptRam(scriptname, hostname/ip)
Returns the amount of RAM required to run the specified script on the " + + "target server. The first argument must be a string with the name of the script. The script name is case sensitive. " + + "The second argument is a string with the hostname or IP of the server where that script is. Both arguments are required.

" + "

Hacknet Nodes API


" + "Netscript provides the following API for accessing and upgrading your Hacknet Nodes through scripts. This API does NOT work offline.

" + "hacknetnodes
A special variable. This is an array that maps to the Player's Hacknet Nodes. The Hacknet Nodes are accessed through " + @@ -686,6 +710,14 @@ CONSTANTS = { "World Stock Exchange account and TIX API Access
", LatestUpdate: + "v0.27.2
" + + "-Added getServerGrowth() Netscript function
" + + "-Added getNextHacknetNodeCost() Netscript function
" + + "-Added new 'literature' files (.lit extension) that are used to build lore for the game. " + + "These .lit files can be found in certain servers throughout the game. They can be viewed with the 'cat' Terminal " + + "command and copied over to other servers using the 'scp' command. These .lit files won't be found until you reset " + + "by installing Augmentations
" + + "Fixed some bugs with Gang Territory(BitNode 2 only)

" + "v0.27.1
" + "-Changed the way Gang power was calculated to make it scale better late game (BitNode 2 only)
" + "-Lowered the respect gain rate in Gangs (Bitnode 2 only)
" + diff --git a/src/Gang.js b/src/Gang.js index f21317ec8..6ff734856 100644 --- a/src/Gang.js +++ b/src/Gang.js @@ -84,13 +84,16 @@ function processAllGangTerritory(numCycles=1) { var otherPwr = AllGangs[GangNames[other]].power; var thisChance = thisPwr / (thisPwr + otherPwr); - //Skip calculation if one of the two gangs has zero territory - if (AllGangs[GangNames[other]].territory <= 0 || AllGangs[GangNames[i]].territory <= 0) {continue;} - if (Math.random() < thisChance) { + if (AllGangs[GangNames[other]].territory <= 0) { + return; + } AllGangs[GangNames[i]].territory += 0.0001; AllGangs[GangNames[other]].territory -= 0.0001; } else { + if (AllGangs[GangNames[i]].territory <= 0) { + return; + } AllGangs[GangNames[i]].territory -= 0.0001; AllGangs[GangNames[other]].territory += 0.0001; } @@ -287,6 +290,7 @@ GangMember.prototype.calculateRespectGain = function() { statWeight -= (3.5 * task.difficulty); if (statWeight <= 0) {return 0;} var territoryMult = AllGangs[Player.gang.facName].territory; + if (territoryMult <= 0) {return 0;} var respectMult = (Player.gang.respect) / (Player.gang.respect + Player.gang.wanted); return 12 * task.baseRespect * statWeight * territoryMult * respectMult; } @@ -303,6 +307,7 @@ GangMember.prototype.calculateWantedLevelGain = function() { statWeight -= (3.5 * task.difficulty); if (statWeight <= 0) {return 0;} var territoryMult = AllGangs[Player.gang.facName].territory; + if (territoryMult <= 0) {return 0;} if (task.baseWanted < 0) { return task.baseWanted * statWeight * territoryMult; } else { @@ -322,6 +327,7 @@ GangMember.prototype.calculateMoneyGain = function() { statWeight -= (3.5 * task.difficulty); if (statWeight <= 0) {return 0;} var territoryMult = AllGangs[Player.gang.facName].territory; + if (territoryMult <= 0) {return 0;} var respectMult = (Player.gang.respect) / (Player.gang.respect + Player.gang.wanted); return 5 * task.baseMoney * statWeight * territoryMult * respectMult; } diff --git a/src/HelpText.js b/src/HelpText.js index 2f23c7142..2a7aa126f 100644 --- a/src/HelpText.js +++ b/src/HelpText.js @@ -3,7 +3,7 @@ TerminalHelpText = "Type 'help name' to learn more about the command 'name'

" + 'alias [-g] [name="value"] Create or display Terminal aliases
' + "analyze Get information about the current machine
" + - "cat [message] Display a .msg file
" + + "cat [file] Display a .msg or .lit file
" + "check [script] [args...] Print a script's logs to Terminal
" + "clear Clear all text on the terminal
" + "cls See 'clear' command
" + @@ -24,7 +24,7 @@ TerminalHelpText = "run [name] [-t] [n] [args...] Execute a program or script
" + "scan Prints all immediately-available network connections
" + "scan-analyze [d] Prints info for all servers up to d nodes away
" + - "scp [script] [server] Copies a script to a destination server
" + + "scp [file] [server] Copies a script or .lit file to a destination server
" + "sudov Shows whether you have root access on this computer
" + "tail [script] [args...] Displays dynamic logs for the specified script
" + "theme [preset] | bg txt hlgt Change the color scheme of the UI
" + @@ -56,9 +56,11 @@ HelpTexts = { "server details such as the hostname, whether the player has root access, what ports are opened/closed, and also " + "hacking-related information such as an estimated chance to successfully hack, an estimate of how much money is " + "available on the server, etc.", - cat: "cat [message]
" + - "Display message files, which are files ending with the '.msg' extension. Example:

" + - "cat j1.msg", + cat: "cat [file]
" + + "Display message files, which are files ending with the '.msg' extension, or a literature file, which " + + "are files ending with the '.lit' extension. Examples:

" + + "cat j1.msg
" + + "cat foo.lit", check: "check [script name] [args...]
" + "Print the logs of the script specified by the script name and arguments to the Terminal. Each argument must be separated by " + "a space. Remember that a running script is uniquely " + @@ -155,8 +157,9 @@ HelpTexts = { "The information 'scan-analyze' displays about each server includes whether or not you have root access to it, " + "its required hacking level, the number of open ports required to run NUKE.exe on it, and how much RAM " + "it has", - scp: "scp [script name] [target server]
" + - "Copies the specified script from the current server to the target server. " + + scp: "scp [filename] [target server]
" + + "Copies the specified file from the current server to the target server. " + + "This command only works for script files (.script extension) and literature files (.lit extension). " + "The second argument passed in must be the hostname or IP of the target server.", sudov: "sudov
" + "Prints whether or not you have root access to the current machine", diff --git a/src/Literature.js b/src/Literature.js index 088a97d57..7b41cb655 100644 --- a/src/Literature.js +++ b/src/Literature.js @@ -7,56 +7,313 @@ function Literature(title, filename, txt) { this.txt = txt; } -Literature.prototype.display = function() { - var txt = this.title + "

" + - "" + this.txt + ""; +function showLiterature(fn) { + var litObj = Literatures[fn]; + if (litObj == null) {return;} + var txt = litObj.title + "

" + + "" + litObj.txt + ""; dialogBoxCreate(txt); } -Literature.prototype.addToserver = function(server) { - if (server == null) { - console.log("WARNING: Could not locate server"); - return; - } - server.messages.push(this); -} - -Literature.prototype.toJSON = function() { - return Generic_toJSON("Literature", this); -} - -Literature.fromJSON = function(value) { - return Generic_fromJSON(Literature, value.data); -} - -Reviver.constructors.Literature = Literature; - Literatures = {} function initLiterature() { var title, fn, txt; - title = "A Green Tomorrow"; //Tomorrow is Green + title = "A Green Tomorrow"; fn = "A-Green-Tomorrow.lit"; - txt = "In the past few decades, there has been a massive global movement towards the generation of renewable energy in an effort to" + - "combat global warming and climate change. The shift towards renewable energy was a big success"; - Literatures[fn] = new Literature(title, fn); - title = "Alpha and Omega"; //Cryptic article about BitNodes - title = "Are we living in a simulated reality?"; //lol - title = "Beyond Man"; //Better than nature? - title = "Brighter than the Sun"; // Article about TaiYang Digital - title = "Democracy is Dead: The Fall of an Empire"; //Government is a powerless figurehead, megacorporation rule - title = "Fall of an Empire"; - title = "Figures show rising crime rates in Sector-12"; //Article about the Syndicate - title = "Man and the Machine"; //Blurring the Boundaries between Man and the Machine - title = "Secret Societies"; //Talks about how hacking factions have replaced typical secret societies like Illuminati - title = "Space: The Failed Frontier"; //A Frontier too far? - title = "Coded Intelligence: Myth or Reality?"; //Discusses whether true intelligence can be implemented in software. Foreshadows intelligence stat in later BItnodes - title = "Synthetic Muscles"; //Artificial muscles - title = "Tensions rise in global tech race"; //Article about competition+conflict between tech mega corps (OmniTek, ECorp..Taiyang? etc.) - title = "The Cost of Immortality"; //Grey Skies - title = "The Hidden World"; //The Sleepwalking World - title = "The New God"; //Singularity Church of the MachineGod - title = "The New Triads"; //About tetrads, Dragon Heads: The Triads of the 21st Century - title = "The Secret War"; //War between those who wanted Augmentations widely available and those who wanted to keep it secret - title = "An uncertain future for Defense Contractors"; //Less war and globalism = less profit for defense contractors + txt = "Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to " + + "combat global warming and climate change. The shift towards renewable energy was a big success, or so it seemed. In 2045 " + + "a staggering 80% of the world's energy came from non-renewable fossil fuels. Now, about three decades later, that " + + "number is down to only 15%. Most of the world's energy now comes from nuclear power and renwable sources such as " + + "solar and geothermal. Unfortunately, these efforts were not the huge success that they seem to be.

" + + "Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and " + + "the rise of increasingly advanced (and power-hungry) technology that has become ubiquitous in our lives. So, " + + "despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, " + + "the total amount of energy we are producing from fossil fuels has actually increased.

" + + "The grim effects of our species' irresponsible use of energy and neglect of our mother world have become increasingly apparent. " + + "Last year a temperature of 190F was recorded in the Death Valley desert, which is over 50% higher than the highest " + + "recorded temperature at the beginning of the century. In the last two decades numerous major cities such as Manhattan, Boston, and " + + "Los Angeles have been partially or fully submerged by rising sea levels. In the present day, over 75% of the world's agriculture is " + + "done in climate-controlled vertical farms, as most traditional farmland has become unusable due to severe climate conditions.

" + + "Despite all of this, the greedy and corrupt corporations that rule the world have done nothing to address these problems that " + + "threaten our species. And so it's up to us, the common people. Each and every one of us can make a difference by doing what " + + "these corporations won't: taking responsibility. If we don't, pretty soon there won't be an Earth left to save. We are " + + "the last hope for a green tomorrow."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Alpha and Omega"; + fn = "alpha-omega.lit"; + txt = "Then we saw a new heaven and a new earth, for our first heaven and earth had gone away, and our sea was no more. " + + "And we saw a new holy city, new Aeria, coming down out of this new heaven, prepared as a bride adorned for her husband. " + + "And we heard a loud voice saying, 'Behold, the new dwelling place of the Gods. We will dwell with them, and they " + + "will be our people, and we will be with them as their Gods. We will wipe away every tear from their eyes, and death " + + "shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things " + + "have passed away.'

" + + "And once were were seated on the throne we said 'Behold, I am making all things new.' " + + "Also we said, 'Write this down, for these words are trustworthy and true.' And we said to you, " + + "'It is done! I am the Alpha and the Omega, the beginning and the end. To the thirsty I will give from the spring " + + "of the water of life without payment. The one who conquers will have this heritage, and we will be his God and " + + "he will be our son. But as for the cowardly, the faithless, the detestable, as for murderers, " + + "the sexually immoral, sorcerers, idolaters, and all liars, their portion will be in the lake that " + + "burns with fire and sulfur, for it is the second true death.'"; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Are We Living in a Computer Simulation?"; + fn = "simulated-reality.lit"; + txt = "The idea that we are living in a virtual world is not new. It's a trope that has " + + "been explored constantly in literature and pop culture. However, it is also a legitimate " + + "scientific hypothesis that many notable physicists and philosophers have debated for years.

" + + "Proponents for this simulated reality theory often point to how advanced our technology has become, " + + "as well as the incredibly fast pace at which it has advanced over the past decades. The amount of computing " + + "power available to us has increased over 100-fold since 2060 due to the development of nanoprocessors and " + + "quantum computers. Artifical Intelligence has advanced to the point where our entire lives are controlled " + + "by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. " + + "If we consider the pace at which this technology has advanced and assume that these developments continue, it's " + + "reasonable to assume that at some point in the future our technology would be advanced enough that " + + "we could create simulations that are indistinguishable from reality. However, if this is a reasonable outcome " + + "of continued technological advancement, then it is very likely that such a scenario has already happened.

" + + "Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species " + + "that already has such technology. Who's to say that they haven't already created such a virtual reality: our own?"; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Beyond Man"; + fn = "beyond-man.lit"; + txt = "Humanity entered a 'transhuman' era a long time ago. And despite the protests and criticisms of many who cried out against " + + "human augmentation at the time, the transhuman movement continued and prospered. Proponents of the movement ignored the critics, " + + "arguing that it was in our inherent nature to better ourselves. To improve. To be more than we were. They claimed that " + + "not doing so would be to go against every living organism's biological purpose: evolution and survival of the fittest.

" + + "And here we are today, with technology that is advanced enough to augment humans to a state that " + + "can only be described as posthuman. But what do we have to show for it when this augmentation " + + "technology is only available to the so-called 'elite'? Are we really better off than before when only 5% of the " + + "world's population has access to this technology? When the powerful corporations and organizations of the world " + + "keep it all to themselves, have we really evolved?

" + + "Augmentation technology has only further increased the divide between the rich and the poor, between the powerful and " + + "the oppressed. We have not become 'more than human'. We have not evolved from nature's original design. We are still the greedy, " + + "corrupted, and evil men that we always were."; + Literatures[fn] = new Literature(title, fn, txt); + + + title = "Brighter than the Sun"; + fn = "brighter-than-the-sun.lit"; + txt = "When people think about the corporations that dominate the East, they typically think of KuaiGong International, which " + + "holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest " + + "drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company " + + "that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.

" + + "TaiYang Digital is a Chinese internet-technology corporation that provides services such as " + + "online advertising, search, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word " + + "for 'sun'. In Chinese culture, the sun is a 'yang' symbol " + + "associated with life, heat, masculinity, and heaven.

" + + "The company was founded " + + "less than 5 years ago and is already the third highest valued company in all of Asia. In 2076 it generated a total revenue of " + + "over 10 trillion yuan. It's services are used daily by over a billion people worldwide.

" + + "TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is " + + "something you'd commonly see in the first half of the century, especially for tech companies. However in " + + "the last two decades the number of corporations has significantly declined as the largest entities " + + "quickly took over the economy. Corporations such as ECorp, MegaCorp, and KuaiGong have established " + + "such strong monopolies in their market sectors that they have effectively killed off all " + + "of the smaller and new corporations that have tried to start up over the years. This is what makes " + + "the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have " + + "a bright future ahead of them."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Democracy is Dead: The Fall of an Empire"; + fn = "democracy-is-dead.lit"; + txt = "They rose from the shadows in the street
From the places where the oppressed meet
" + + "Their cries echoed loudly through the air
As they once did in Tiananmen Square
" + + "Loudness in the silence, Darkness in the light
They came forth with power and might
" + + "Once the beacon of democracy, America was first
Its pillars of society destroyed and dispersed
" + + "Soon the cries rose everywhere, with revolt and riot
Until one day, finally, all was quiet
" + + "From the ashes rose a new order, corporatocracy was its name
" + + "Rome, Mongol, Byzantine, all of history is just the same
" + + "For man will never change in a fundamental way
" + "And now democracy is dead, in the USA"; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Figures Show Rising Crime Rates in Sector-12"; + fn = "sector-12-crime.lit"; + txt = "A recent study by analytics company Wilson Inc. shows a significant rise " + + "in criminal activity in Sector-12. Perhaps the most alarming part of the statistic " + + "is that most of the rise is in violent crime such as homicide and assault. According " + + "to the study, the city saw a total of 21,406 reported homicides in 2076, which is over " + + "a 20% increase compared to 2075.

" + + "CIA director David Glarow says its too early to know " + + "whether these figures indicate the beginning of a sustained increase in crime rates, or whether " + + "the year was just an unfortunate outlier. He states that many intelligence and law enforcement " + + "agents have noticed an increase in organized crime activites, and believes that these figures may " + + "be the result of an uprising from criminal organizations such as The Syndicate or the Slum Snakes."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Man and the Machine"; + fn = "man-and-machine.lit"; + txt = "In 2005 Ray Kurzweil popularized his theory of the Singularity. He predicted that the rate " + + "of technological advancement would continue to accelerate faster and faster until one day " + + "machines would be become infinitely more intelligent than humans. This point, called the " + + "Singularity, would result in a drastic transformation of the world as we know it. He predicted " + + "that the Singularity would arrive by 2045. " + + "And yet here we are, more than three decades later, where most would agree that we have not " + + "yet reached a point where computers and machines are vastly more intelligent than we are. So what gives?

" + + "The answer is that we have reached the Singularity, just not in the way we expected. The artifical superintelligence " + + "that was predicted by Kurzweil and others exists in the world today - in the form of Augmentations. " + + "Yes, those Augmentations that the rich and powerful keep to themselves enable humans " + + "to become superintelligent beings. The Singularity did not lead to a world where " + + "our machines are infinitely more intelligent than us, it led to a world " + + "where man and machine can merge to become something greater. Most of the world just doesn't " + + "know it yet." + Literatures[fn] = new Literature(title, fn, txt); + + title = "Secret Societies"; + fn = "secret-societies.lit"; + txt = "The idea of secret societies has long intrigued the general public by inspiring curiosity, fascination, and " + + "distrust. People have long wondered about who these secret society members are and what they do, with the " + + "most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world " + + "may never know for sure, it is likely that many secret societies do actually exist, even today.

" + + "However, the secret societies of the modern world are nothing like those that (supposedly) existed " + + "decades and centuries ago. The Freemasons, Knights Templar, and Illuminati, while they may have been around " + + "at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in " + + "our everyday lives and the fact that so much of the world is now digital has given rise to a new breed " + + "of secret societies: Internet-based ones.

" + + "Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's " + + "world. Some of these, such as The Black Hand, are black hat groups that claim they are trying to " + + "help the oppressed by attacking the elite and powerful. Others, such as NiteSec, are hacktivist groups " + + "that try to push political and social agendas. Perhaps the most intriguing hacker group " + + "is the mysterious Bitrunners, whose purpose still remains unknown."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Space: The Failed Frontier"; + fn = "the-failed-frontier.lit"; + txt = "Humans have long dreamed about spaceflight. With enduring interest, we were driven to explore " + + "the unknown and discover new worlds. We dreamed about conquering the stars. And in our quest, " + + "we pushed the boundaries of our scientific limits, and then pushed further. Space exploration " + + "lead to the development of many important technologies and new industries.

" + + "But sometime in the middle of the 21st century, all of that changed. Humanity lost its ambitions and " + + "aspirations of exploring the cosmos. The once-large funding for agencies like NASA and the European " + + "Space Agency gradually whittled away until their eventual disbanding in the 2060's. Not even " + + "militaries are fielding flights into space nowadays. The only remnants of the once great mission for cosmic " + + "conquest are the countless satellites in near-earth orbit, used for communications, espionage, " + + "and other corporate interests.

" + + "And as we continue to look at the state of space technology, it becomes more and " + + "more apparent that we will never return to that golden age of space exploration, that " + + "age where everyone dreamed of going beyond earth for the sake of discovery."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Coded Intelligence: Myth or Reality?"; + fn = "coded-intelligence.lit"; + txt = "Tremendous progress has been made in the field of Artificial Intelligence over the past few decades. " + + "Our autonomous vehicles and transporation systems. The electronic personal assistants that control our everyday lives. " + + "Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has " + + "improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create " + + "human intelligence.

" + + "We've certainly come close to artificial intelligence that is similar to humans. For example OmniTek Incorporated's " + + "CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like " + + "in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as " + + "that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.

" + + "Many neuroscientists believe that we won't ever reach the point of creating artificial human intelligence. 'At the end of the " + + "the day, AI comes down to 1's and 0's, while the human brain does not. We'll never see AI that is identical to that of " + + "humans.'"; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Synthetic Muscles"; + fn = "synthetic-muscles.lit"; + txt = "Initial versions of synthetic muscles weren't made of anything organic but were actually " + + "crude devices made to mimic human muscle function. Some of the early iterations were actually made of " + + "common materials such as fishing lines and sewing threads due to their high strength for " + + "a cheap cost.

" + + "As technology progressed, however, advances in biomedical engineering paved the way for a new method of " + + "creating synthetic muscles. Instead of creating something that closely imitated the functionality " + + "of human muscle, scientists discovered a way of forcing the human body itself to augment its own " + + "muscle tissue using both synthetic and organic materials. This is typically done using gene therapy " + + "or chemical injections."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Tensions rise in global tech race"; + fn = "tensions-in-tech-race.lit"; + txt = "Have we entered a new Cold War? Is WWIII just beyond the horizon?

" + + "After rumors came out that OmniTek Incorporated had begun developing advanced robotic supersoldiers, " + + "geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. " + + "In a rare show of cooperation between corporations, MegaCorp and ECorp have " + + "reportedly launched hundreds of new surveillance and espionage satellites. " + + "Defense contractors such as " + + "DeltaOne and AeroCorp have been working with the CIA and NSA to prepare " + + "for conflict. Meanwhile, the rest of the world sits in earnest " + + "hoping that it never reaches full-scale war. With today's technology " + + "and firepower, a World War would assuredly mean the end of human civilization."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "The Cost of Immortality"; + fn = "cost-of-immortality.lit"; + txt = "Evolution and advances in medical and augmentation technology has lead to drastic improvements " + + "in human mortality rates. Recent figures show that the life expectancy for humans " + + "that live in a first-world country is about 130 years of age, almost double of what it was " + + "at the turn of the century. However, this increase in average lifespan has had some " + + "significant effects on society and culture.

" + + "Due to longer lifespans and a better quality of life, many adults are holding " + + "off on having kids until much later. As a result, the percentage of youth in " + + "first-world countries has been decreasing, while the number " + + "of senior citizens is significantly increasing.

" + + "Perhaps the most alarming result of all of this is the rapidly shrinking workforce. " + + "Despite the increase in life expectancy, the typical retirement age for " + + "workers in America has remained about the same, meaning a larger and larger " + + "percentage of people in America are retirees. Furthermore, many " + + "young adults are holding off on joining the workforce because they feel that " + + "they have plenty of time left in their lives for employment, and want to " + + "'enjoy life while they're young.' For most industries, this shrinking workforce " + + "is not a major issue as most things are handled by robots anyways. However, " + + "there are still several key industries such as engineering and education " + + "that have not been automated, and these remain in danger to this cultural " + + "phenomenon."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "The Hidden World"; + fn = "the-hidden-world.lit"; + txt = "WAKE UP SHEEPLE

" + "THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY

" + + "THE ILLUMINATI ARE THE SECRET RULERS OF THE WORLD!

" + + "Yes, the Illuminati of legends. The ancient secret society that controls the entire " + + "world from the shadows with their invisible hand. The group of the rich and wealthy " + + "that have penetrated every major government, financial agency, and corporation in the last " + + "three hundred years.

" + + "OPEN YOUR EYES

" + + "It was the Illuminati that brought an end to democracy in the world. They are the driving force " + + "behind everything that happens.

" + + "THEY ARE ALL AROUND YOU

" + + "After destabilizing the world's governments, they are now entering the final stage of their master plan. " + + "They will secretly initiate global crises. Terrorism. Pandemics. World War. And out of the chaos " + + "that ensues they will build their New World Order."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "The New God"; + fn = "the-new-god.lit"; + txt = "Everyone has that moment in their life where they wonder about the bigger questions

" + + "What's the point of all of this? What is my purpose?

" + + "Some people dare to think even bigger

" + + "What will be the fate of the human race?

" + + "We live in an era vastly different from that of even 15 or 20 years ago. We have gone " + + "where no man has gone before. We have stripped ourselves of the tyranny of flesh.

" + + "The Singularity is here. The merging of man and machine. This is where humanity evolves into " + + "something greater. This is our future

" + + "Embrace it, and you will obey a new god. The God in the Machine"; + Literatures[fn] = new Literature(title, fn, txt); + + title = "The New Triads"; + fn = "new-triads.lit"; + txt = "The Triads were an ancient transnational crime syndicate based in China, Hong Kong, and other Asian " + + "territories. They were often considered one of the first and biggest criminal secret societies. " + + "While most of the branches of the Triads have been destroyed over the past few decades, the " + + "crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. " + + "The most notable of these is the Tetrads.

" + + "It is widely believed that the Tetrads are a rogue group that splintered off from the Triads sometime in the " + + "mid 21st century. The founders of the Tetrads, all of whom were ex-Triad members, believed that the " + + "Triads were losing their purpose and direction. The Tetrads started off as a small group that mainly engaged " + + "in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal " + + "drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the " + + "continent.

" + + "Not much else is known about the Tetrads, or about the efforts the Asian governments and corporations are making " + + "to take down this large new crime organization. Many believe that the Tetrads have infiltrated the governments " + + "and powerful corporations in Asia, which has helped faciliate their recent rapid rise."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "The Secret War"; + fn = "the-secret-war.lit"; + txt = "" + Literatures[fn] = new Literature(title, fn, txt); } diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index de990413f..e38e52e01 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -495,12 +495,21 @@ function NetscriptFunctions(workerScript) { getServerMaxMoney : function(ip){ var server = getServer(ip); if (server == null) { - workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip); - throw makeRuntimeRejectMsg(workerScript, "getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip); + workerScript.scriptRef.log("getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip); + throw makeRuntimeRejectMsg(workerScript, "getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip); } workerScript.scriptRef.log("getServerMaxMoney() returned " + formatNumber(server.moneyMax, 0) + " for " + server.hostname); return server.moneyMax; }, + getServerGrowth : function(ip) { + var server = getServer(ip); + if (server == null) { + workerScript.scriptRef.log("getServerGrowth() failed. Invalid IP or hostname passed in: " + ip); + throw makeRuntimeRejectMsg(workerScript, "getServerGrowth() failed. Invalid IP or hostname passed in: " + ip); + } + workerScript.scriptRef.log("getServerGrowth() returned " + formatNumber(server.serverGrowth, 0) + " for " + server.hostname); + return server.serverGrowth; + }, getServerNumPortsRequired : function(ip){ var server = getServer(ip); if (server == null) { @@ -555,6 +564,7 @@ function NetscriptFunctions(workerScript) { } return (findRunningScript(filename, argsForTargetScript, server) != null); }, + getNextHacknetNodeCost : getCostOfNextHacknetNode, purchaseHacknetNode : purchaseHacknet, getStockPrice : function(symbol) { if (!Player.hasTixApiAccess) { @@ -824,13 +834,13 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("getScriptRam() failed. Invalid IP or hostname passed in: " + ip); throw makeRuntimeRejectMsg(workerScript, "getScriptRam() failed. Invalid IP or hostname passed in: " + ip); } - for (var i = 0; i < server.runningScripts.length; ++i) { - if (server.runningScripts[i].filename == scriptname) { - return server.runningScripts[i].scriptRef.ramUsage; + for (var i = 0; i < server.scripts.length; ++i) { + if (server.scripts[i].filename == scriptname) { + return server.scripts[i].ramUsage; } } return 0; }, - + } } diff --git a/src/Server.js b/src/Server.js index 952efa963..97df42c87 100644 --- a/src/Server.js +++ b/src/Server.js @@ -146,21 +146,26 @@ initForeignServers = function() { var BladeIndustriesServer = new Server(createRandomIp(), "blade", "Blade Industries", false, false, false, 0); BladeIndustriesServer.setHackingParameters(getRandomInt(1000, 1100), getRandomInt(12000000000, 20000000000), getRandomInt(90, 95), getRandomInt(60, 75)); BladeIndustriesServer.setPortProperties(5); + BladeIndustriesServer.messages.push("beyond-man.lit"); AddToAllServers(BladeIndustriesServer); var NWOServer = new Server(createRandomIp(), "nwo", "New World Order", false, false, false, 0); NWOServer.setHackingParameters(getRandomInt(1000, 1200), getRandomInt(25000000000, 35000000000), 99, getRandomInt(75, 85)); NWOServer.setPortProperties(5); + NWOServer.messages.push("the-hidden-world.lit"); AddToAllServers(NWOServer); var ClarkeIncorporatedServer = new Server(createRandomIp(), "clarkeinc", "Clarke Incorporated", false, false, false, 0); ClarkeIncorporatedServer.setHackingParameters(getRandomInt(1000, 1200), getRandomInt(15000000000, 25000000000), getRandomInt(50, 60), getRandomInt(50, 70)); ClarkeIncorporatedServer.setPortProperties(5); + ClarkeIncorporatedServer.messages.push("beyond-man.lit"); + ClarkeIncorporatedServer.messages.push("cost-of-immortality.lit"); AddToAllServers(ClarkeIncorporatedServer); var OmniTekIncorporatedServer = new Server(createRandomIp(), "omnitek", "OmniTek Incorporated", false, false, false, 0); OmniTekIncorporatedServer.setHackingParameters(getRandomInt(900, 1100), getRandomInt(15000000000, 20000000000), getRandomInt(90, 99), getRandomInt(95, 99)); OmniTekIncorporatedServer.setPortProperties(5); + OmniTekIncorporatedServer.messages.push("coded-intelligence.lit"); AddToAllServers(OmniTekIncorporatedServer); var FourSigmaServer = new Server(createRandomIp(), "4sigma", "FourSigma", false, false, false, 0); @@ -177,6 +182,7 @@ initForeignServers = function() { var FulcrumTechnologiesServer = new Server(createRandomIp(), "fulcrumtech", "Fulcrum Technologies", false, false, false, 64); FulcrumTechnologiesServer.setHackingParameters(getRandomInt(1000, 1200), getRandomInt(1400000000, 1800000000), getRandomInt(85, 95), getRandomInt(80, 99)); FulcrumTechnologiesServer.setPortProperties(5); + FulcrumTechnologiesServer.messages.push("simulated-reality.lit"); AddToAllServers(FulcrumTechnologiesServer); var FulcrumSecretTechnologiesServer = new Server(createRandomIp(), "fulcrumassets", "Fulcrum Technologies Assets", false, false, false, 0); @@ -203,11 +209,13 @@ initForeignServers = function() { var HeliosLabsServer = new Server(createRandomIp(), "helios", "Helios Labs", false, false, false, 0); HeliosLabsServer.setHackingParameters(getRandomInt(800, 900), getRandomInt(550000000, 750000000), getRandomInt(85, 95), getRandomInt(70, 80)); HeliosLabsServer.setPortProperties(5); + HeliosLabsServer.messages.push("beyond-man.lit"); AddToAllServers(HeliosLabsServer); var VitaLifeServer = new Server(createRandomIp(), "vitalife", "VitaLife", false, false, false, 32); VitaLifeServer.setHackingParameters(getRandomInt(775, 900), getRandomInt(700000000, 800000000), getRandomInt(80, 90), getRandomInt(60, 80)); VitaLifeServer.setPortProperties(5); + VitaLifeServer.messages.push("A-Green-Tomorrow.lit"); AddToAllServers(VitaLifeServer); var IcarusMicrosystemsServer = new Server(createRandomIp(), "icarus", "Icarus Microsystems", false, false, false, 0); @@ -223,16 +231,20 @@ initForeignServers = function() { var TitanLabsServer = new Server(createRandomIp(), "titan-labs", "Titan Laboratories", false, false, false, 32); TitanLabsServer.setHackingParameters(getRandomInt(800, 875), getRandomInt(750000000, 900000000), getRandomInt(70, 80), getRandomInt(60, 80)); TitanLabsServer.setPortProperties(5); + TitanLabsServer.messages.push("coded-intelligence.lit"); AddToAllServers(TitanLabsServer); var MicrodyneTechnologiesServer = new Server(createRandomIp(), "microdyne", "Microdyne Technologies", false, false, false, 16); MicrodyneTechnologiesServer.setHackingParameters(getRandomInt(800, 875), getRandomInt(500000000, 700000000), getRandomInt(65, 75), getRandomInt(70, 90)); MicrodyneTechnologiesServer.setPortProperties(5); + MicrodyneTechnologiesServer.messages.push("synthetic-muscles.lit"); AddToAllServers(MicrodyneTechnologiesServer); var TaiYangDigitalServer = new Server(createRandomIp(), "taiyang-digital", "Taiyang Digital", false, false, false, 0); TaiYangDigitalServer.setHackingParameters(getRandomInt(850, 950), getRandomInt(800000000, 900000000), getRandomInt(70, 80), getRandomInt(70, 80)); TaiYangDigitalServer.setPortProperties(5); + TaiYangDigitalServer.messages.push("A-Green-Tomorrow.lit"); + TaiYangDigitalServer.messages.push("brighter-than-the-sun.lit"); AddToAllServers(TaiYangDigitalServer); var GalacticCyberSystemsServer = new Server(createRandomIp(), "galactic-cyber", "Galactic Cybersystems", false, false, false, 0); @@ -244,6 +256,7 @@ initForeignServers = function() { var AeroCorpServer = new Server(createRandomIp(), "aerocorp", "AeroCorp", false, false, false, 0); AeroCorpServer.setHackingParameters(getRandomInt(850, 925), getRandomInt(1000000000, 1200000000), getRandomInt(80, 90), getRandomInt(55, 65)); AeroCorpServer.setPortProperties(5); + AeroCorpServer.messages.push("man-and-machine.lit"); AddToAllServers(AeroCorpServer); var OmniaCybersystemsServer = new Server(createRandomIp(), "omnia", "Omnia Cybersystems", false, false, false, 0); @@ -254,6 +267,7 @@ initForeignServers = function() { var ZBDefenseServer = new Server(createRandomIp(), "zb-def", "ZB Defense Industries", false, false, false, 0); ZBDefenseServer.setHackingParameters(getRandomInt(775, 825), getRandomInt(900000000, 1100000000), getRandomInt(55, 65), getRandomInt(65, 75)); ZBDefenseServer.setPortProperties(4); + ZBDefenseServer.messages.push("synthetic-muscles.lit"); AddToAllServers(ZBDefenseServer); var AppliedEnergeticsServer = new Server(createRandomIp(), "applied-energetics", "Applied Energetics", false, false, false, 0); @@ -264,6 +278,8 @@ initForeignServers = function() { var SolarisSpaceSystemsServer = new Server(createRandomIp(), "solaris", "Solaris Space Systems", false, false, false, 0); SolarisSpaceSystemsServer.setHackingParameters(getRandomInt(750, 850), getRandomInt(700000000, 900000000), getRandomInt(70, 80), getRandomInt(70, 80)); SolarisSpaceSystemsServer.setPortProperties(5); + SolarisSpaceSystemsServer.messages.push("A-Green-Tomorrow.lit"); + SolarisSpaceSystemsServer.messages.push("the-failed-frontier.lit"); AddToAllServers(SolarisSpaceSystemsServer); var DeltaOneServer = new Server(createRandomIp(), "deltaone", "Delta One", false, false, false, 0); @@ -275,6 +291,7 @@ initForeignServers = function() { var GlobalPharmaceuticalsServer = new Server(createRandomIp(), "global-pharm", "Global Pharmaceuticals", false, false, false, 16); GlobalPharmaceuticalsServer.setHackingParameters(getRandomInt(750, 850), getRandomInt(1500000000, 1750000000), getRandomInt(75, 85), getRandomInt(80, 90)); GlobalPharmaceuticalsServer.setPortProperties(4); + GlobalPharmaceuticalsServer.messages.push("A-Green-Tomorrow.lit"); AddToAllServers(GlobalPharmaceuticalsServer); var NovaMedicalServer = new Server(createRandomIp(), "nova-med", "Nova Medical", false, false, false, 0); @@ -306,9 +323,9 @@ initForeignServers = function() { var AlphaEnterprisesServer = new Server(createRandomIp(), "alpha-ent", "Alpha Enterprises", false, false, false, 0); AlphaEnterprisesServer.setHackingParameters(getRandomInt(500, 600), getRandomInt(600000000, 750000000), getRandomInt(50, 70), getRandomInt(50, 60)); AlphaEnterprisesServer.setPortProperties(4); + AlphaEnterprisesServer.messages.push("sector-12-crime.lit"); AddToAllServers(AlphaEnterprisesServer); - var AevumPoliceServer = new Server(createRandomIp(), "aevum-police", "Aevum Police Network", false, false, false, 0); AevumPoliceServer.setHackingParameters(getRandomInt(400, 450), getRandomInt(200000000, 400000000), getRandomInt(70, 80), getRandomInt(30, 50)); AevumPoliceServer.setPortProperties(4); @@ -317,6 +334,9 @@ initForeignServers = function() { var RothmanUniversityServer = new Server(createRandomIp(), "rothman-uni", "Rothman University Network", false, false, false, 4); RothmanUniversityServer.setHackingParameters(getRandomInt(370, 430), getRandomInt(175000000, 250000000), getRandomInt(45, 55), getRandomInt(35, 45)); RothmanUniversityServer.setPortProperties(3); + RothmanUniversityServer.messages.push("secret-societies.lit"); + RothmanUniversityServer.messages.push("the-failed-frontier.lit"); + RothmanUniversityServer.messages.push("tensions-in-tech-race.lit"); AddToAllServers(RothmanUniversityServer); var ZBInstituteOfTechnologyServer = new Server(createRandomIp(), "zb-institute", "ZB Institute of Technology Network", false, false, false, 4); @@ -327,6 +347,9 @@ initForeignServers = function() { var SummitUniversityServer = new Server(createRandomIp(), "summit-uni", "Summit University Network", false, false, false, 4); SummitUniversityServer.setHackingParameters(getRandomInt(425, 475), getRandomInt(200000000, 350000000), getRandomInt(45, 65), getRandomInt(40, 60)); SummitUniversityServer.setPortProperties(3); + SummitUniversityServer.messages.push("secret-societies.lit"); + SummitUniversityServer.messages.push("the-failed-frontier.lit"); + SummitUniversityServer.messages.push("synthetic-muscles.lit"); AddToAllServers(SummitUniversityServer); var SysCoreSecuritiesServer = new Server(createRandomIp(), "syscore", "SysCore Securities", false, false, false, 0); @@ -337,6 +360,7 @@ initForeignServers = function() { var CatalystVenturesServer = new Server(createRandomIp(), "catalyst", "Catalyst Ventures", false, false, false, 0); CatalystVenturesServer.setHackingParameters(getRandomInt(400, 450), getRandomInt(300000000, 550000000), getRandomInt(60, 70), getRandomInt(25, 55)); CatalystVenturesServer.setPortProperties(3); + CatalystVenturesServer.messages.push("tensions-in-tech-race.lit"); AddToAllServers(CatalystVenturesServer); var TheHubServer = new Server(createRandomIp(), "the-hub", "The Hub", false, false, false, 0); @@ -347,11 +371,13 @@ initForeignServers = function() { var CompuTekServer = new Server(createRandomIp(), "comptek", "CompuTek", false, false, false, 8); CompuTekServer.setHackingParameters(getRandomInt(300, 400), getRandomInt(220000000, 250000000), getRandomInt(55, 65), getRandomInt(45, 65)); CompuTekServer.setPortProperties(3); + CompuTekServer.messages.push("man-and-machine.lit"); AddToAllServers(CompuTekServer); var NetLinkTechnologiesServer = new Server(createRandomIp(), "netlink", "NetLink Technologies", false, false, false, 0); NetLinkTechnologiesServer.setHackingParameters(getRandomInt(375, 425), 275000000, getRandomInt(60, 80), getRandomInt(45, 75)); NetLinkTechnologiesServer.setPortProperties(3); + NetLinkTechnologiesServer.messages.push("simulated-reality.lit"); AddToAllServers(NetLinkTechnologiesServer); var JohnsonOrthopedicsServer = new Server(createRandomIp(), "johnson-ortho", "Johnson Orthopedics", false, false, false, 4); @@ -363,6 +389,7 @@ initForeignServers = function() { var FoodNStuffServer = new Server(createRandomIp(), "foodnstuff", "Food N Stuff Supermarket", false, false, false, 8); FoodNStuffServer.setHackingParameters(1, 2000000, 10, 5); FoodNStuffServer.setPortProperties(0); + FoodNStuffServer.messages.push("sector-12-crime.lit"); AddToAllServers(FoodNStuffServer); var SigmaCosmeticsServer = new Server(createRandomIp(), "sigma-cosmetics", "Sigma Cosmetics", false, false, false, 8); @@ -388,16 +415,19 @@ initForeignServers = function() { var NeoNightclubServer = new Server(createRandomIp(), "neo-net", "Neo Nightclub Network", false, false, false, 4); NeoNightclubServer.setHackingParameters(50, 5000000, 25, 25); NeoNightclubServer.setPortProperties(1); + NeoNightclubServer.messages.push("the-hidden-world.lit"); AddToAllServers(NeoNightclubServer); var SilverHelixServer = new Server(createRandomIp(), "silver-helix", "Silver Helix", false, false, false, 2); SilverHelixServer.setHackingParameters(150, 45000000, 30, 30); SilverHelixServer.setPortProperties(2); + SilverHelixServer.messages.push("new-triads.lit"); AddToAllServers(SilverHelixServer); var HongFangTeaHouseServer = new Server(createRandomIp(), "hong-fang-tea", "HongFang Teahouse", false, false, false, 8); HongFangTeaHouseServer.setHackingParameters(30, 3000000, 15, 20); HongFangTeaHouseServer.setPortProperties(0); + HongFangTeaHouseServer.messages.push("brighter-than-the-sun.lit"); AddToAllServers(HongFangTeaHouseServer); var HaraKiriSushiBarServer = new Server(createRandomIp(), "harakiri-sushi", "HaraKiri Sushi Bar Network", false, false, false, 8); @@ -418,6 +448,7 @@ initForeignServers = function() { var OmegaSoftwareServer = new Server(createRandomIp(), "omega-net", "Omega Software", false, false, false, 8); OmegaSoftwareServer.setHackingParameters(getRandomInt(180, 220), getRandomInt(60000000, 70000000), getRandomInt(25, 35), getRandomInt(30, 40)); OmegaSoftwareServer.setPortProperties(2); + OmegaSoftwareServer.messages.push("the-new-god.lit"); AddToAllServers(OmegaSoftwareServer); //Gyms @@ -450,18 +481,22 @@ initForeignServers = function() { var BitRunnersServer = new Server(createRandomIp(), "run4theh111z", "The Runners", false, false, false, 0); BitRunnersServer.setHackingParameters(getRandomInt(505, 550), 0, 0, 0); BitRunnersServer.setPortProperties(4); + BitRunnersServer.messages.push("simulated-reality.lit"); + BitRunnersServer.messages.push("the-new-god.lit"); AddToAllServers(BitRunnersServer); SpecialServerIps.addIp(SpecialServerNames.BitRunnersServer, BitRunnersServer.ip); var TheBlackHandServer = new Server(createRandomIp(), "I.I.I.I", "I.I.I.I", false, false, false, 0); TheBlackHandServer.setHackingParameters(getRandomInt(340, 365), 0, 0, 0); TheBlackHandServer.setPortProperties(3); + TheBlackHandServer.messages.push("democracy-is-dead.lit"); AddToAllServers(TheBlackHandServer); SpecialServerIps.addIp(SpecialServerNames.TheBlackHandServer, TheBlackHandServer.ip); var NiteSecServer = new Server(createRandomIp(), "avmnite-02h", "NiteSec", false, false, false, 0); NiteSecServer.setHackingParameters(getRandomInt(202, 220), 0, 0, 0); NiteSecServer.setPortProperties(2); + NiteSecServer.messages.push("democracy-is-dead.lit"); AddToAllServers(NiteSecServer); SpecialServerIps.addIp(SpecialServerNames.NiteSecServer, NiteSecServer.ip); @@ -474,12 +509,14 @@ initForeignServers = function() { var CyberSecServer = new Server(createRandomIp(), "CSEC", "CyberSec", false, false, false, 0); CyberSecServer.setHackingParameters(getRandomInt(51, 60), 0, 0, 0); CyberSecServer.setPortProperties(1); + CyberSecServer.messages.push("democracy-is-dead.lit"); AddToAllServers(CyberSecServer); SpecialServerIps.addIp(SpecialServerNames.CyberSecServer, CyberSecServer.ip); var DaedalusServer = new Server(createRandomIp(), "The-Cave", "Helios", false, false, false, 0); DaedalusServer.setHackingParameters(925, 0, 0, 0); DaedalusServer.setPortProperties(5); + DaedalusServer.messages.push("alpha-omega.lit"); AddToAllServers(DaedalusServer); SpecialServerIps.addIp(SpecialServerNames.DaedalusServer, DaedalusServer.ip); diff --git a/src/Terminal.js b/src/Terminal.js index c1bbee371..555d522f2 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -285,6 +285,18 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { } } + if (input.startsWith("scp ") && index == 0) { + //All Scripts and lit files + for (var i = 0; i < currServ.scripts.length; ++i) { + allPos.push(currServ.scripts[i].filename); + } + for (var i = 0; i < currServ.messages.length; ++i) { + if (!(currServ.messages[i] instanceof Message)) { + allPos.push(currServ.messages[i]); + } + } + } + if (input.startsWith("connect ") || input.startsWith("telnet ")) { //All network connections for (var i = 0; i < currServ.serversOnNetwork.length; ++i) { @@ -298,8 +310,7 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { if (input.startsWith("kill ") || input.startsWith("nano ") || input.startsWith("tail ") || input.startsWith("rm ") || - input.startsWith("mem ") || input.startsWith("check ") || - (input.startsWith("scp ") && index == 0)) { + input.startsWith("mem ") || input.startsWith("check ")) { //All Scripts for (var i = 0; i < currServ.scripts.length; ++i) { allPos.push(currServ.scripts[i].filename); @@ -323,7 +334,12 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { if (input.startsWith("cat ")) { for (var i = 0; i < currServ.messages.length; ++i) { - allPos.push(currServ.messages[i].filename); + if (currServ.messages[i] instanceof Message) { + allPos.push(currServ.messages[i].filename); + } else { + allPos.push(currServ.messages[i]); + } + } return allPos; } @@ -658,15 +674,18 @@ var Terminal = { break; case "cat": if (commandArray.length != 2) { - post("Incorrect usage of cat command. Usage: cat [message]"); return; + post("Incorrect usage of cat command. Usage: cat [file]"); return; } var filename = commandArray[1]; //Can only edit script files - if (filename.endsWith(".msg") == false) { - post("Error: Only .msg files are viewable with cat (filename must end with .msg)"); return; + if (!filename.endsWith(".msg") && !filename.endsWith(".lit")) { + post("Error: Only .msg and .lit files are viewable with cat (filename must end with .msg or .lit)"); return; } for (var i = 0; i < s.messages.length; ++i) { - if (s.messages[i].filename == filename) { + if (filename.endsWith(".lit") && s.messages[i] == filename) { + showLiterature(s.messages[i]); + return; + } else if (filename.endsWith(".msg") && s.messages[i].filename == filename) { showMessage(s.messages[i]); return; } @@ -962,24 +981,55 @@ var Terminal = { break; case "scp": if (commandArray.length != 2) { - post("Incorrect usage of scp command. Usage: scp [scriptname] [destination hostname/ip]"); + post("Incorrect usage of scp command. Usage: scp [file] [destination hostname/ip]"); return; } var args = commandArray[1].split(" "); if (args.length != 2) { - post("Incorrect usage of scp command. Usage: scp [scriptname] [destination hostname/ip]"); + post("Incorrect usage of scp command. Usage: scp [file] [destination hostname/ip]"); return; } var scriptname = args[0]; + if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")){ + post("Error: scp only works for .script and .lit files"); + return; + } var server = getServer(args[1]); if (server == null) { post("Invalid destination. " + args[1] + " not found"); return; } var ip = server.ip; - var currServ = Player.getCurrentServer(); + //Scp for lit files + if (scriptname.endsWith(".lit")) { + var found = false; + var curr + for (var i = 0; i < currServ.messages.length; ++i) { + if (!(currServ.messages[i] instanceof Message) && currServ.messages[i] == scriptname) { + found = true; + } + } + + if (!found) { + post("Error: no such file exists!"); + return; + } + + for (var i = 0; i < server.messages.length; ++i) { + if (server.messages[i] === scriptname) { + post(scriptname + " copied over to " + server.hostname); + return; //Already exists + } + } + server.messages.push(scriptname); + post(scriptname + " copied over to " + server.hostname); + return; + } + + + //Get the current script var sourceScript = null; for (var i = 0; i < currServ.scripts.length; ++i) { @@ -1156,7 +1206,6 @@ var Terminal = { post("Incorrect usage of ls command. Usage: ls [| grep pattern]"); return; } - //grep var filter = null; if (commandArray.length == 2) { @@ -1196,11 +1245,19 @@ var Terminal = { } for (var i = 0; i < s.messages.length; i++) { if (filter) { - if (s.messages[i].filename.includes(filter)) { - allFiles.push(s.messages[i].filename); + if (s.messages[i] instanceof Message) { + if (s.messages[i].filename.includes(filter)) { + allFiles.push(s.messages[i].filename); + } + } else if (s.messages[i].includes(filter)) { + allFiles.push(s.messages[i]); } } else { - allFiles.push(s.messages[i].filename); + if (s.messages[i] instanceof Message) { + allFiles.push(s.messages[i].filename); + } else { + allFiles.push(s.messages[i]); + } } } diff --git a/src/engine.js b/src/engine.js index 4da1fe75d..f7112545d 100644 --- a/src/engine.js +++ b/src/engine.js @@ -778,6 +778,7 @@ var Engine = { autoSaveCounter: 300, //Autosave every minute updateSkillLevelsCounter: 10, //Only update skill levels every 2 seconds. Might improve performance updateDisplays: 3, //Update displays such as Active Scripts display and character display + updateDisplaysMed: 9, updateDisplaysLong: 15, createProgramNotifications: 10, //Checks whether any programs can be created and notifies checkFactionInvitations: 100, //Check whether you qualify for any faction invitations @@ -811,9 +812,7 @@ var Engine = { if (Engine.Counters.updateDisplays <= 0) { Engine.displayCharacterOverviewInfo(); - if (Engine.currentPage == Engine.Page.ActiveScripts) { - updateActiveScriptsItems(); - } else if (Engine.currentPage == Engine.Page.CharacterInfo) { + if (Engine.currentPage == Engine.Page.CharacterInfo) { Engine.displayCharacterInfo(); } else if (Engine.currentPage == Engine.Page.HacknetNodes) { updateHacknetNodesContent(); @@ -828,6 +827,13 @@ var Engine = { Engine.Counters.updateDisplays = 3; } + if (Engine.Counters.updateDisplaysMed <= 0) { + if (Engine.currentPage == Engine.Page.ActiveScripts) { + updateActiveScriptsItems(); + } + Engine.Counters.updateDisplaysMed = 9; + } + if (Engine.Counters.updateDisplaysLong <= 0) { if (Engine.currentPage === Engine.Page.Gang) { updateGangContent(); @@ -982,6 +988,7 @@ var Engine = { if (Player.hasWseAccount) { initSymbolToStockMap(); } + initLiterature(); //Calculate the number of cycles have elapsed while offline Engine._lastUpdate = new Date().getTime(); @@ -1086,6 +1093,7 @@ var Engine = { initAugmentations(); initMessages(); initStockSymbols(); + initLiterature(); //Open main menu accordions for new game //Main menu accordions