mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 12:45:45 +01:00
commit
05c3d614cb
91
css/missions.css
Normal file
91
css/missions.css
Normal file
@ -0,0 +1,91 @@
|
||||
/* css for Missions */
|
||||
|
||||
/* Hacking missions */
|
||||
|
||||
.hack-mission-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 10% 10% 10% 10% 10% 10% 10% 10%;
|
||||
grid-template-rows: 8% 8% 8% 8% 8% 8% 8% 8%;
|
||||
grid-gap: 2.5%;
|
||||
height: 100%;
|
||||
position:fixed;
|
||||
width: 100%;
|
||||
overflow-y:auto;
|
||||
}
|
||||
|
||||
.hack-mission-node {
|
||||
color:gray;
|
||||
z-index:5;
|
||||
background-color:gray;
|
||||
align-self: center;
|
||||
justify-self: center;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
.hack-mission-node p {
|
||||
color:white;
|
||||
font-size:12px;
|
||||
margin-top: 8px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.hack-mission-player-node {
|
||||
color:white;
|
||||
background-color:blue;
|
||||
}
|
||||
|
||||
.hack-mission-player-node-active {
|
||||
border: 2px solid white;
|
||||
color: #6666ff;
|
||||
background-color: #6666ff;
|
||||
}
|
||||
|
||||
.hack-mission-enemy-node {
|
||||
color:red;
|
||||
background-color:red;
|
||||
}
|
||||
|
||||
.hack-mission-cpu-node {
|
||||
width:100%;
|
||||
height:100%;
|
||||
-moz-border-radius: 50%;
|
||||
-webkit-border-radius: 50%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.hack-mission-firewall-node {
|
||||
width:90%;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
.hack-mission-database-node {
|
||||
width: 100%;
|
||||
height: 90%;
|
||||
-webkit-transform: skew(20deg);
|
||||
-moz-transform: skew(20deg);
|
||||
-o-transform: skew(20deg);
|
||||
}
|
||||
|
||||
.hack-mission-database-node p {
|
||||
-webkit-transform: skew(-20deg);
|
||||
-moz-transform: skew(-20deg);
|
||||
-o-transform: skew(-20deg);
|
||||
}
|
||||
|
||||
.hack-mission-spam-node,
|
||||
.hack-mission-transfer-node,
|
||||
.hack-mission-shield-node {
|
||||
height:100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Non-map related DOM elements */
|
||||
|
||||
/* Element at the top of the Hacking Mission page (intro page, start button, guide buttons, etc.) */
|
||||
.hack-mission-header-element {
|
||||
margin: 6px;
|
||||
}
|
||||
|
||||
.hack-mission-action-buttons-container {
|
||||
border: 2px solid white;
|
||||
}
|
@ -144,6 +144,12 @@ a:link, a:visited {
|
||||
background-color: #666;
|
||||
}
|
||||
|
||||
.a-link-button:active {
|
||||
-webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
|
||||
-moz-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
|
||||
box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
/* Make anchor tags ("a" elements) inactive (not clickable) */
|
||||
.a-link-button-inactive {
|
||||
text-decoration: none;
|
||||
@ -200,7 +206,7 @@ a:link, a:visited {
|
||||
left: 101%;
|
||||
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.tooltip:hover .tooltiptext {
|
||||
|
@ -1,10 +1,6 @@
|
||||
/* Both Work in progress and BitNode stuff */
|
||||
#generic-fullscreen-container {
|
||||
.generic-fullscreen-container {
|
||||
color: var(--my-font-color);
|
||||
padding-top: 10px;
|
||||
padding-left: 10px;
|
||||
margin: 10px;
|
||||
height: 100%;
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
|
17990
dist/bundle.js
vendored
17990
dist/bundle.js
vendored
File diff suppressed because one or more lines are too long
12
index.html
12
index.html
@ -10,6 +10,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="css/popupboxes.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/interactivetutorial.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/loader.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/missions.css" />
|
||||
|
||||
<!-- Google Analytics -->
|
||||
<script>
|
||||
@ -509,6 +510,17 @@
|
||||
use your terminal or create scripts when you are performing a task! <br><br><br><br>
|
||||
</p>
|
||||
|
||||
<div id="faction-hack-mission-div" class="faction-work-div">
|
||||
<div id="faction-hack-mission-div-wrapper" class="faction-work-div-wrapper">
|
||||
<a id="faction-hack-mission-button" class="a-link-button">Hacking Mission</a>
|
||||
<p id="faction-hack-mission-text">
|
||||
Attempt a hacking mission for your faction.
|
||||
A mission is a mini game that, if won, earns you significant reputation with this faction.
|
||||
</p>
|
||||
</div>
|
||||
<div class="faction-clear"></div>
|
||||
</div>
|
||||
|
||||
<div id="faction-hack-div" class="faction-work-div">
|
||||
<div id="faction-hack-div-wrapper" class="faction-work-div-wrapper">
|
||||
<a id="faction-hack-button" class="a-link-button">Hacking Contracts</a>
|
||||
|
@ -1,10 +1,12 @@
|
||||
import {workerScripts,
|
||||
addWorkerScript,
|
||||
killWorkerScript} from "./NetscriptWorker.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {getServer} from "./Server.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {printArray} from "../utils/HelperFunctions.js";
|
||||
import {logBoxCreate} from "../utils/LogBox.js";
|
||||
import numeral from "../utils/numeral.min.js";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
||||
|
||||
|
||||
@ -182,7 +184,10 @@ function updateActiveScriptsItems() {
|
||||
total += updateActiveScriptsItemContent(workerScripts[i]);
|
||||
}
|
||||
document.getElementById("active-scripts-total-prod").innerHTML =
|
||||
"Total online production rate: $" + formatNumber(total, 2) + " / second";
|
||||
"Total online production of Active Scripts: " + numeral(total).format('$0.000a') + " / sec<br>" +
|
||||
"Total online production since last Aug installation: " +
|
||||
numeral(Player.scriptProdSinceLastAug).format('$0.000a') + " (" +
|
||||
numeral(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug/1000)).format('$0.000a') + " / sec)";
|
||||
return total;
|
||||
}
|
||||
|
||||
@ -200,45 +205,26 @@ function updateActiveScriptsItemContent(workerscript) {
|
||||
var itemName = itemNameArray.join("-");
|
||||
var itemContent = document.getElementById(itemName + "-content")
|
||||
|
||||
//Clear the item
|
||||
while (itemContent.firstChild) {
|
||||
itemContent.removeChild(itemContent.firstChild);
|
||||
}
|
||||
|
||||
//Add the updated text back. Returns the total online production rate
|
||||
return createActiveScriptsText(workerscript, itemContent);
|
||||
return updateActiveScriptsText(workerscript, itemContent);
|
||||
}
|
||||
|
||||
function createActiveScriptsText(workerscript, item) {
|
||||
var itemText = document.createElement("p");
|
||||
var itemTextHeader = document.createElement("p");
|
||||
var itemTextStats = document.createElement("p");
|
||||
var itemId = item.id;
|
||||
itemTextStats.setAttribute("id", itemId + "-stats");
|
||||
|
||||
//Server ip/hostname
|
||||
var threads = "Threads: " + workerscript.scriptRef.threads;
|
||||
var args = "Args: " + printArray(workerscript.args);
|
||||
|
||||
//Online
|
||||
var onlineTotalMoneyMade = "Total online production: $" + formatNumber(workerscript.scriptRef.onlineMoneyMade, 2);
|
||||
var onlineTotalExpEarned = (Array(26).join(" ") + formatNumber(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, " ");
|
||||
itemTextHeader.innerHTML = threads + "<br>" + args + "<br>";
|
||||
|
||||
var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
|
||||
var onlineMpsText = "Online production rate: $" + formatNumber(onlineMps, 2) + "/second";
|
||||
var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
|
||||
var onlineEpsText = (Array(25).join(" ") + formatNumber(onlineEps, 4) + " hacking exp/second").replace( / /g, " ");
|
||||
item.appendChild(itemTextHeader);
|
||||
item.appendChild(itemTextStats);
|
||||
|
||||
//Offline
|
||||
var offlineTotalMoneyMade = "Total offline production: $" + formatNumber(workerscript.scriptRef.offlineMoneyMade, 2);
|
||||
var offlineTotalExpEarned = (Array(27).join(" ") + formatNumber(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, " ");
|
||||
|
||||
var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
|
||||
var offlineMpsText = "Offline production rate: $" + formatNumber(offlineMps, 2) + "/second";
|
||||
var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
|
||||
var offlineEpsText = (Array(26).join(" ") + formatNumber(offlineEps, 4) + " hacking exp/second").replace( / /g, " ");
|
||||
|
||||
itemText.innerHTML = threads + "<br>" + args + "<br>" + onlineTotalMoneyMade + "<br>" + onlineTotalExpEarned + "<br>" +
|
||||
onlineMpsText + "<br>" + onlineEpsText + "<br>" + offlineTotalMoneyMade + "<br>" + offlineTotalExpEarned + "<br>" +
|
||||
offlineMpsText + "<br>" + offlineEpsText + "<br>";
|
||||
|
||||
item.appendChild(itemText);
|
||||
var onlineMps = updateActiveScriptsText(workerscript, item, itemTextStats);
|
||||
|
||||
var logButton = document.createElement("span");
|
||||
logButton.innerHTML = "Log";
|
||||
@ -262,4 +248,36 @@ function createActiveScriptsText(workerscript, item) {
|
||||
return onlineMps;
|
||||
}
|
||||
|
||||
function updateActiveScriptsText(workerscript, item, statsEl=null) {
|
||||
var itemId = item.id
|
||||
var itemTextStats = document.getElementById(itemId + "-stats");
|
||||
if (itemTextStats === null || itemTextStats === undefined) {
|
||||
itemTextStats = statsEl;
|
||||
}
|
||||
|
||||
//Updates statistics only
|
||||
//Online
|
||||
var onlineTotalMoneyMade = "Total online production: $" + formatNumber(workerscript.scriptRef.onlineMoneyMade, 2);
|
||||
var onlineTotalExpEarned = (Array(26).join(" ") + formatNumber(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, " ");
|
||||
|
||||
var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
|
||||
var onlineMpsText = "Online production rate: $" + formatNumber(onlineMps, 2) + "/second";
|
||||
var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
|
||||
var onlineEpsText = (Array(25).join(" ") + formatNumber(onlineEps, 4) + " hacking exp/second").replace( / /g, " ");
|
||||
|
||||
//Offline
|
||||
var offlineTotalMoneyMade = "Total offline production: $" + formatNumber(workerscript.scriptRef.offlineMoneyMade, 2);
|
||||
var offlineTotalExpEarned = (Array(27).join(" ") + formatNumber(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, " ");
|
||||
|
||||
var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
|
||||
var offlineMpsText = "Offline production rate: $" + formatNumber(offlineMps, 2) + "/second";
|
||||
var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
|
||||
var offlineEpsText = (Array(26).join(" ") + formatNumber(offlineEps, 4) + " hacking exp/second").replace( / /g, " ");
|
||||
|
||||
itemTextStats.innerHTML = onlineTotalMoneyMade + "<br>" + onlineTotalExpEarned + "<br>" +
|
||||
onlineMpsText + "<br>" + onlineEpsText + "<br>" + offlineTotalMoneyMade + "<br>" + offlineTotalExpEarned + "<br>" +
|
||||
offlineMpsText + "<br>" + offlineEpsText + "<br>";
|
||||
return onlineMps;
|
||||
}
|
||||
|
||||
export {setActiveScriptsClickHandlers, addActiveScriptsItem, deleteActiveScriptsItem, updateActiveScriptsItems};
|
||||
|
132
src/Constants.js
132
src/Constants.js
@ -1,5 +1,5 @@
|
||||
let CONSTANTS = {
|
||||
Version: "0.29.0",
|
||||
Version: "0.29.1",
|
||||
|
||||
//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
|
||||
@ -120,10 +120,53 @@ let CONSTANTS = {
|
||||
IntelligenceProgramBaseExpGain: 1000, //Program required hack level divided by this to determine int exp gain
|
||||
IntelligenceTerminalHackBaseExpGain: 200, //Hacking exp divided by this to determine int exp gain
|
||||
IntelligenceSingFnBaseExpGain: 0.0005,
|
||||
IntelligenceClassBaseExpGain: 0.0000001,
|
||||
|
||||
//Hacking Missions
|
||||
HackingMissionRepToDiffConversion: 5000, //Faction rep is divided by this to get mission difficulty
|
||||
HackingMissionRepToRewardConversion: 20, //Faction rep divided byt his to get mission rep reward
|
||||
HackingMissionRepToRewardConversion: 12, //Faction rep divided byt his to get mission rep reward
|
||||
HackingMissionSpamTimeIncrease: 20000, //How much time limit increase is gained when conquering a Spam Node (ms)
|
||||
HackingMissionTransferAttackIncrease: 1.05, //Multiplier by which the attack for all Core Nodes is increased when conquering a Transfer Node
|
||||
HackingMissionHowToPlay: "Hacking missions are a minigame that, if won, will reward you with faction reputation.<br><br>" +
|
||||
"In this game you control a set of Nodes and use them to try and defeat an enemy. Your Nodes " +
|
||||
"are colored blue, while the enemy's are red. There are also other nodes on the map colored gray " +
|
||||
"that initially belong to neither you nor the enemy. The goal of the game is " +
|
||||
"to capture all of the enemy's database nodes, which are the parallelogram-shaped ones, within the time limit. " +
|
||||
"If you cannot capture all of the enemy's database nodes in the time limit, you will lose.<br><br>" +
|
||||
"Each Node has three stats: Attack, Defense, and HP. There are five different actions that " +
|
||||
"a Node can take:<br><br> " +
|
||||
"Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the owner's Attack, the Player's " +
|
||||
"hacking level, and the enemy's defense.<br>" +
|
||||
"Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the " +
|
||||
"enemy's defense.<br>" +
|
||||
"Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the enemy's " +
|
||||
"defense.<br>" +
|
||||
"Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.<br>" +
|
||||
"Overflow - Raises the Node's Attack but lowers its Defense. The effectiveness is determined by your hacking level.<br><br>" +
|
||||
"Note that when determining the effectiveness of the above actions, the TOTAL Attack or Defense of the team is used, not just the " +
|
||||
"Attack/Defense of the individual Node that is performing the action.<br><br." +
|
||||
"To capture a Node, you must lower its HP down to 0.<br><br>" +
|
||||
"There are six different types of Nodes:<br><br>" +
|
||||
"CPU Core - These are your main Nodes that are used to perform actions. Capable of performing every action<br>" +
|
||||
"Firewall - Nodes with high defense. These Nodes cannot perform any actions<br>" +
|
||||
"Database - A special type of Node. The player's objective is to conquer all of the enemy's Database Nodes within " +
|
||||
"the time limit. These Nodes cannot perform any actions<br>" +
|
||||
"Spam - Conquering one of these Nodes will slow the enemy's trace, giving the player additional time to complete " +
|
||||
"the mission. These Nodes cannot perform any actions<br>" +
|
||||
"Transfer - Conquering one of these nodes will increase the Attack of all of your CPU Cores by a small fixed percentage. " +
|
||||
"These Nodes are capable of performing every action except the 'Attack' action<br>" +
|
||||
"Shield - Nodes with high defense. These Nodes cannot perform any actions<br><br>" +
|
||||
"To assign an action to a Node, you must first select one of your Nodes. This can be done by simply clicking on it. Only " +
|
||||
"one Node can be selected at a time, and it will be denoted with a white highlight. After selecting the Node, " +
|
||||
"select its action using the Action Buttons near the top of the screen. Every action also has a corresponding keyboard " +
|
||||
"shortcut that can be used as well.<br><br>" +
|
||||
"For certain actions such as attacking, scanning, and weakening, the Node performing the action must have a target. To target " +
|
||||
"another node, simply click-and-drag from the 'source' Node to a target. A Node can only have one target, and you can only target " +
|
||||
"Nodes that are adjacent to one of your Nodes (immediately above, below, or to the side. NOT diagonal). Furthermore, only CPU Cores and Transfer Nodes " +
|
||||
"can target, since they are the only ones that can perform actions. To remove a target, you can simply click on the line that represents " +
|
||||
"the connection between one of your Nodes and its target. Alternatively, you can select the 'source' Node and click the 'Drop Connection' button, " +
|
||||
"or press 'd',",
|
||||
|
||||
|
||||
//Gang constants
|
||||
GangRespectToReputationRatio: 2, //Respect is divided by this to get rep gain
|
||||
@ -380,6 +423,9 @@ let CONSTANTS = {
|
||||
"args.length<br><br>" +
|
||||
"Note that none of the other functions that typically work with arrays, such as remove(), insert(), clear(), etc., will work on the " +
|
||||
"args array.<br><br>" +
|
||||
"<u><h1>Javascript Modules</h1></u><br>" +
|
||||
"Netscript supports the following Javascript Modules:<br><br>" +
|
||||
"Math<br>Date (static functions only)<br><br>" +
|
||||
"<u><h1> Functions </h1></u><br>" +
|
||||
"You can NOT define you own functions in Netscript (yet), but there are several built in functions that " +
|
||||
"you may use: <br><br> " +
|
||||
@ -418,18 +464,18 @@ let CONSTANTS = {
|
||||
"the hostnames or IPs of the scanned servers should be output. If it is true then hostnames will be returned, and if false then IP addresses will. " +
|
||||
"This second argument is optional and, if ommitted, the function will output " +
|
||||
"the hostnames of the scanned servers. The hostnames/IPs in the returned array are strings.<br><br>" +
|
||||
"<i>nuke(hostname/ip)</i><br>Run NUKE.exe on the target server. NUKE.exe must exist on your home computer. Does NOT work while offline <br> Example: nuke('foodnstuff'); <br><br>" +
|
||||
"<i>brutessh(hostname/ip)</i><br>Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer. Does NOT work while offline <br> Example: brutessh('foodnstuff');<br><br>" +
|
||||
"<i>ftpcrack(hostname/ip)</i><br>Run FTPCrack.exe on the target server. FTPCrack.exe must exist on your home computer. Does NOT work while offline <br> Example: ftpcrack('foodnstuff');<br><br>" +
|
||||
"<i>relaysmtp(hostname/ip)</i><br>Run relaySMTP.exe on the target server. relaySMTP.exe must exist on your home computer. Does NOT work while offline <br> Example: relaysmtp('foodnstuff');<br><br>" +
|
||||
"<i>httpworm(hostname/ip)</i><br>Run HTTPWorm.exe on the target server. HTTPWorm.exe must exist on your home computer. Does NOT work while offline <br> Example: httpworm('foodnstuff');<br><br>" +
|
||||
"<i>sqlinject(hostname/ip)</i><br>Run SQLInject.exe on the target server. SQLInject.exe must exist on your home computer. Does NOT work while offline <br> Example: sqlinject('foodnstuff');<br><br>" +
|
||||
"<i>nuke(hostname/ip)</i><br>Run NUKE.exe on the target server. NUKE.exe must exist on your home computer.<br> Example: nuke('foodnstuff'); <br><br>" +
|
||||
"<i>brutessh(hostname/ip)</i><br>Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer.<br> Example: brutessh('foodnstuff');<br><br>" +
|
||||
"<i>ftpcrack(hostname/ip)</i><br>Run FTPCrack.exe on the target server. FTPCrack.exe must exist on your home computer.<br> Example: ftpcrack('foodnstuff');<br><br>" +
|
||||
"<i>relaysmtp(hostname/ip)</i><br>Run relaySMTP.exe on the target server. relaySMTP.exe must exist on your home computer.<br> Example: relaysmtp('foodnstuff');<br><br>" +
|
||||
"<i>httpworm(hostname/ip)</i><br>Run HTTPWorm.exe on the target server. HTTPWorm.exe must exist on your home computer.<br> Example: httpworm('foodnstuff');<br><br>" +
|
||||
"<i>sqlinject(hostname/ip)</i><br>Run SQLInject.exe on the target server. SQLInject.exe must exist on your home computer.<br> Example: sqlinject('foodnstuff');<br><br>" +
|
||||
"<i>run(script, [numThreads], [args...])</i> <br> Run a script as a separate process. The first argument that is passed in is the name of the script as a string. This function can only " +
|
||||
"be used to run scripts located on the current server (the server running the script that calls this function). The second argument " +
|
||||
"is optional, and it specifies how many threads to run the script with. This argument must be a number greater than 0. If it is omitted, then the script will be run single-threaded. Any additional arguments will specify " +
|
||||
"arguments to pass into the new script that is being run. If arguments are specified for the new script, then the second argument numThreads argument must be filled in with a value.<br><br>" +
|
||||
"Returns true if the script is successfully started, and false otherwise. Requires a significant amount " +
|
||||
"of RAM to run this command. Does NOT work while offline <br><br>" +
|
||||
"of RAM to run this command.<br><br>" +
|
||||
"The simplest way to use the run command is to call it with just the script name. The following example will run 'foo.script' single-threaded with no arguments:<br><br>" +
|
||||
"run('foo.script');<br><br>" +
|
||||
"The following example will run 'foo.script' but with 5 threads instead of single-threaded:<br><br>" +
|
||||
@ -441,7 +487,7 @@ let CONSTANTS = {
|
||||
"The third argument is optional, and it specifies how many threads to run the script with. If it is omitted, then the script will be run single-threaded. " +
|
||||
"This argument must be a number that is greater than 0. Any additional arguments will specify arguments to pass into the new script that is being run. If " +
|
||||
"arguments are specified for the new script, then the third argument numThreads must be filled in with a value.<br><br>Returns " +
|
||||
"true if the script is successfully started, and false otherwise. Does NOT work while offline<br><br> " +
|
||||
"true if the script is successfully started, and false otherwise.<br><br> " +
|
||||
"The simplest way to use the exec command is to call it with just the script name and the target server. The following example will try to run 'generic-hack.script' " +
|
||||
"on the 'foodnstuff' server:<br><br>" +
|
||||
"exec('generic-hack.script', 'foodnstuff');<br><br>" +
|
||||
@ -479,11 +525,11 @@ let CONSTANTS = {
|
||||
"<i>ls(hostname/ip)</i><br>Returns an array containing the names of all files on the specified server. The argument must be a " +
|
||||
"string with the hostname or IP of the target server.<br><br>" +
|
||||
"<i>hasRootAccess(hostname/ip)</i><br> Returns a boolean (true or false) indicating whether or not the Player has root access to 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.<br> " +
|
||||
"The argument passed in must be a string with either the hostname or IP of the target server.<br> " +
|
||||
"Example:<br>if (hasRootAccess('foodnstuff') == false) {<br> nuke('foodnstuff');<br>}<br><br>" +
|
||||
"<i>getIp()</i><br>Returns a string with the IP Address of the server that the script is running on <br><br>" +
|
||||
"<i>getHostname()</i><br>Returns a string with the hostname of the server that the script is running on<br><br>" +
|
||||
"<i>getHackingLevel()</i><br>Returns the Player's current hacking level. Does NOT work while offline<br><br> " +
|
||||
"<i>getHackingLevel()</i><br>Returns the Player's current hacking level.<br><br> " +
|
||||
"<i>getIntelligence()</i><br>Returns the Player's current intelligence level. Requires Source-File 5 to run<br><br>" +
|
||||
"<i>getHackingMultipliers()</i><br>Returns an object containing the Player's hacking related multipliers. " +
|
||||
"These multipliers are returned in integer forms, not percentages (e.g. 1.5 instead of 150%). " +
|
||||
@ -528,32 +574,34 @@ let CONSTANTS = {
|
||||
"print(mults.ServerMaxMoney);<br>" +
|
||||
"print(mults.HackExpGain);<br><br>" +
|
||||
"<i>getServerMoneyAvailable(hostname/ip)</i><br> Returns the amount of money available 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 <br> Example: getServerMoneyAvailable('foodnstuff');<br><br>" +
|
||||
"hostname or IP of the target server.<br> Example: getServerMoneyAvailable('foodnstuff');<br><br>" +
|
||||
"<i>getServerMaxMoney(hostname/ip)</i><br>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<br>Example: getServerMaxMoney('foodnstuff');<br><br>" +
|
||||
"the hostname or IP of the target server.<br>Example: getServerMaxMoney('foodnstuff');<br><br>" +
|
||||
"<i>getServerGrowth(hostname/ip)</i><br>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().<br><br>" +
|
||||
"The argument passed in must be a string with the hostname or IP of the target server.<br><br>" +
|
||||
"<i>getServerSecurityLevel(hostname/ip)</i><br>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.<br><br>" +
|
||||
"<i>getServerBaseSecurityLevel(hostname/ip)</i><br> Returns the base security level of a server. This is the security level that the server starts out with. " +
|
||||
"hostname or IP of the target server. A server's security is denoted by a number, typically between 1 and 100.<br><br>" +
|
||||
"<i>getServerBaseSecurityLevel(hostname/ip)</i><br>Returns the base security level of a server. This is the security level that the server starts out with. " +
|
||||
"This is different than getServerSecurityLevel() because getServerSecurityLevel() returns the current security level of a server, which can constantly change " +
|
||||
"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. <br><br>" +
|
||||
"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.<br><br>" +
|
||||
"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, typically between 1 and 100. " +
|
||||
"<br><br>" +
|
||||
"<i>getServerMinSecurityLevel(hostname/ip)</i>Returns the minimum security level of a server. The argument passed in must be a string with " +
|
||||
"either the hostname or IP of the target server.<br><br>" +
|
||||
"<i>getServerRequiredHackingLevel(hostname/ip)</i><br>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 <br><br>" +
|
||||
"hostname or IP or the target server.<br><br>" +
|
||||
"<i>getServerNumPortsRequired(hostname/ip)</i><br>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<br><br>" +
|
||||
"passed in must be a string with either the hostname or IP of the target server.<br><br>" +
|
||||
"<i>getServerRam(hostname/ip)</i><br>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.<br><br>" +
|
||||
"<i>serverExists(hostname/ip)</i><br>Returns a boolean denoting whether or not the specified server exists. The argument " +
|
||||
"must be a string with the hostname or IP of the target server.<br><br>" +
|
||||
"<i>fileExists(filename, [hostname/ip])</i><br> 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. <br><br> " +
|
||||
"The first argument must be a string with the name of the file. A file can either be a script, program, or literature file. A script name is case-sensitive, but a " +
|
||||
"program/literature file is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe. <br><br> " +
|
||||
"The second argument is a string with the hostname or IP of the server on which to search for the program. This second argument is optional. " +
|
||||
"If it is omitted, then the function will search through the current server (the server running the script that calls this function) for the file. <br> " +
|
||||
"Example: fileExists('foo.script', 'foodnstuff');<br>" +
|
||||
@ -609,8 +657,9 @@ let CONSTANTS = {
|
||||
"on the server specified by the hostname/ip. The argument must be a string with the hostname/ip of the target server.<br><br>" +
|
||||
"<i>getScriptIncome([scriptname], [hostname/ip], [args...])</i><br>" +
|
||||
"Returns the amount of income the specified script generates while online (when the game is open, does not apply for " +
|
||||
"offline income). This function can also return the total income of all of your active scripts by running the function " +
|
||||
"with no arguments.<br><br>" +
|
||||
"offline income). This function can also be called with no arguments. If called with no arguments, then this function " +
|
||||
"will return an array of two values. The first value is the total income ($/sec) of all of your active scripts (currently running). " +
|
||||
"The second value is the total income ($/sec) from scripts since you last installed Augmentations (or destroyed a BitNode).<br><br>" +
|
||||
"Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script " +
|
||||
"with the arguments 'foodnstuff' and '5' then in order to use this function to get that script's income you must " +
|
||||
"specify those arguments in this function call.<br><br>" +
|
||||
@ -629,6 +678,8 @@ let CONSTANTS = {
|
||||
"The second argument must be a string with the hostname/IP of the target server. If the first argument is specified " +
|
||||
"then the second argument must be specified as well. Any additional arguments passed to the function will specify " +
|
||||
"the arguments passed into the target script.<br><br>" +
|
||||
"<i>getTimeSinceLastAug()</i><br>" +
|
||||
"Returns the amount of time in milliseconds that have passed since you last installed Augmentations (or destroyed a BitNode).<br><br>" +
|
||||
"<u><h1>Hacknet Nodes API</h1></u><br>" +
|
||||
"Netscript provides the following API for accessing and upgrading your Hacknet Nodes through scripts. This API does NOT work offline.<br><br>" +
|
||||
"<i>hacknetnodes</i><br> A special variable. This is an array that maps to the Player's Hacknet Nodes. The Hacknet Nodes are accessed through " +
|
||||
@ -957,20 +1008,25 @@ let CONSTANTS = {
|
||||
"World Stock Exchange account and TIX API Access<br>",
|
||||
|
||||
LatestUpdate:
|
||||
"v0.29.0<br>" +
|
||||
"-Added BitNode-5: Artificial Intelligence<br>" +
|
||||
"-Added getIp(), getIntelligence(), getHackingMultipliers(), and getBitNodeMultipliers() Netscript functions (requires Source-File 5)<br>" +
|
||||
"-Updated scan() Netscript function so that you can choose to have it print IPs rather than hostnames<br>" +
|
||||
"-Refactored scp() Netscript function so that it takes an optional 'source server' argument<br>" +
|
||||
"-For Infiltration, decreased the percentage by which the security level increases by " +
|
||||
"about 10% for every location<br>" +
|
||||
"-Using :w in the script editor's Vim keybinding mode should now save and quit to Terminal<br>" +
|
||||
"-Some minor optimizations that should reduce the size of the save file<br>" +
|
||||
"-scan-analyze Terminal command will no longer show your purchased servers, unless you pass a '-a' flag into the command<br>" +
|
||||
"-After installing the Red Pill augmentation from Daedalus, the message telling you to find 'The-Cave' " +
|
||||
"will now repeatedly pop up regardless of whether or not you have messages suppressed<br>" +
|
||||
"-Various bugfixes",
|
||||
|
||||
"v0.29.1<br>" +
|
||||
"-New gameplay feature that is currently in BETA: Hacking Missions. Hacking Missions is an active gameplay mechanic (its a minigame) " +
|
||||
"that is meant to be used to earn faction reputation. However, since this is currently in beta, hacking missions will NOT grant reputation " +
|
||||
"for the time being, since the feature likely has many bugs, balance problems, and other issues. If you have any feedback " +
|
||||
"regarding the new feature, feel free to let me know<br>" +
|
||||
"-CHANGED THE RETURN VALUE OF getScriptIncome() WHEN RAN WITH NO ARGUMENTS. It will now return an array of " +
|
||||
"two values rather than a single value. This may break your scripts, so make sure to update them!<br>" +
|
||||
"-Added continue statement for for/while loops<br>" +
|
||||
"-Added getServerMinSecurityLevel(), getPurchasedServers(), and getTimeSinceLastAug() Netscript functions<br>" +
|
||||
"-Netscript scp() function can now take an array as the first argument, and will try to copy " +
|
||||
"every file specified in the array (it will just call scp() normally for every element in the array). " +
|
||||
"If an array is passed in, then the scp() function returns true if at least one element from the array is successfully copied<br>" +
|
||||
"-Added Javascript's Date module to Netscript. Since 'new' is not supported in Netscript yet, only the Date module's " +
|
||||
"static methods will work (now(), UTC(), parse(), etc.).<br>" +
|
||||
"-Failing a crime now gives half the experience it did before<br>" +
|
||||
"-The forced repeated 'Find The-Cave' message after installing The Red Pill Augmentation now only happens " +
|
||||
"if you've never destroyed a BitNode before, and will only popup every 15 minutes. If you have already destroyed a BitNode, " +
|
||||
"the message will not pop up if you have messages suppressed (if you don't have messages suppressed it WILL still repeatedly popup)<br>" +
|
||||
"-fileExists() function now works on literature files<br><br>",
|
||||
}
|
||||
|
||||
export {CONSTANTS};
|
||||
|
@ -5,6 +5,7 @@ import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {FactionInfo} from "./FactionInfo.js";
|
||||
import {Locations} from "./Location.js";
|
||||
import {HackingMission, setInMission} from "./Missions.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {Settings} from "./Settings.js";
|
||||
|
||||
@ -455,16 +456,26 @@ function displayFactionContent(factionName) {
|
||||
"is gained whenever you reset after installing an Augmentation. The amount of " +
|
||||
"favor you gain depends on how much reputation you have with the faction</span>";
|
||||
|
||||
var hackMissionDiv = document.getElementById("faction-hack-mission-div");
|
||||
var hackDiv = document.getElementById("faction-hack-div");
|
||||
var fieldWorkDiv = document.getElementById("faction-fieldwork-div");
|
||||
var securityWorkDiv = document.getElementById("faction-securitywork-div");
|
||||
var donateDiv = document.getElementById("faction-donate-div");
|
||||
var gangDiv = document.getElementById("faction-gang-div");
|
||||
|
||||
var newHackMissionButton = clearEventListeners("faction-hack-mission-button");
|
||||
var newHackButton = clearEventListeners("faction-hack-button");
|
||||
var newFieldWorkButton = clearEventListeners("faction-fieldwork-button");
|
||||
var newSecurityWorkButton = clearEventListeners("faction-securitywork-button");
|
||||
var newDonateWorkButton = clearEventListeners("faction-donate-button");
|
||||
newHackMissionButton.addEventListener("click", function() {
|
||||
Engine.loadMissionContent();
|
||||
var mission = new HackingMission(faction.playerReputation, faction);
|
||||
setInMission(true, mission); //Sets inMission flag to true
|
||||
mission.init();
|
||||
return false;
|
||||
});
|
||||
|
||||
newHackButton.addEventListener("click", function() {
|
||||
Player.startFactionHackWork(faction);
|
||||
return false;
|
||||
@ -602,156 +613,187 @@ function displayFactionContent(factionName) {
|
||||
|
||||
switch(faction.name) {
|
||||
case "Illuminati":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "none";
|
||||
break;
|
||||
case "Daedalus":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "none";
|
||||
break;
|
||||
case "The Covenant":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "none";
|
||||
break;
|
||||
case "ECorp":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "MegaCorp":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Bachman & Associates":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Blade Industries":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "NWO":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Clarke Incorporated":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "OmniTek Incorporated":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Four Sigma":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "KuaiGong International":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Fulcrum Secret Technologies":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "none";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "BitRunners":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "none";
|
||||
securityWorkDiv.style.display = "none";
|
||||
break;
|
||||
case "The Black Hand":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "none";
|
||||
break;
|
||||
case "NiteSec":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "none";
|
||||
securityWorkDiv.style.display = "none";
|
||||
break;
|
||||
case "Chongqing":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Sector-12":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "New Tokyo":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Aevum":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Ishima":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Volhaven":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Speakers for the Dead":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "The Dark Army":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "none";
|
||||
break;
|
||||
case "The Syndicate":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Silhouette":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "none";
|
||||
break;
|
||||
case "Tetrads":
|
||||
hackMissionDiv.style.display = "none";
|
||||
hackDiv.style.display = "none";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Slum Snakes":
|
||||
hackMissionDiv.style.display = "none";
|
||||
hackDiv.style.display = "none";
|
||||
fieldWorkDiv.style.display = "inline";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "Netburners":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "none";
|
||||
securityWorkDiv.style.display = "none";
|
||||
break;
|
||||
case "Tian Di Hui":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "none";
|
||||
securityWorkDiv.style.display = "inline";
|
||||
break;
|
||||
case "CyberSec":
|
||||
hackMissionDiv.style.display = "inline";
|
||||
hackDiv.style.display = "inline";
|
||||
fieldWorkDiv.style.display = "none";
|
||||
securityWorkDiv.style.display = "none";
|
||||
|
@ -1,7 +1,9 @@
|
||||
import {Augmentations, Augmentation,
|
||||
AugmentationNames} from "./Augmentations.js";
|
||||
import {Programs} from "./CreateProgram.js";
|
||||
import {inMission} from "./Missions.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {redPillFlag} from "./RedPill.js";
|
||||
import {GetServerByHostname} from "./Server.js";
|
||||
import {Settings} from "./Settings.js";
|
||||
import {dialogBoxCreate, dialogBoxOpened} from "../utils/DialogBox.js";
|
||||
@ -75,10 +77,15 @@ function checkForMessagesToSend() {
|
||||
redpillOwned = true;
|
||||
}
|
||||
|
||||
if (redpill && redpillOwned && Player.sourceFiles.length === 0) {
|
||||
if (redpill && redpillOwned && Player.sourceFiles.length === 0 && !redPillFlag && !inMission) {
|
||||
if (!dialogBoxOpened) {
|
||||
sendMessage(redpill, true);
|
||||
}
|
||||
} else if (redpill && redpillOwned) {
|
||||
//If player has already destroyed a BitNode, message is not forced
|
||||
if (!redPillFlag && !inMission && !dialogBoxOpened) {
|
||||
sendMessage(redpill);
|
||||
}
|
||||
} else if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) {
|
||||
sendMessage(jumper0);
|
||||
Player.getHomeComputer().programs.push(Programs.Flight);
|
||||
@ -96,8 +103,6 @@ function checkForMessagesToSend() {
|
||||
sendMessage(jumper4);
|
||||
} else if (bitrunnersTest && !bitrunnersTest.recvd && Player.hacking_skill >= 500) {
|
||||
sendMessage(bitrunnersTest);
|
||||
} else if (redpill && redpillOwned) {
|
||||
sendMessage(redpill);
|
||||
}
|
||||
}
|
||||
|
||||
|
1235
src/Missions.js
Normal file
1235
src/Missions.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -201,6 +201,9 @@ function evaluate(exp, workerScript) {
|
||||
case "BreakStatement":
|
||||
reject("BREAKSTATEMENT");
|
||||
break;
|
||||
case "ContinueStatement":
|
||||
reject("CONTINUESTATEMENT");
|
||||
break;
|
||||
case "IfStatement":
|
||||
evaluateIf(exp, workerScript).then(function(forLoopRes) {
|
||||
resolve("forLoopDone");
|
||||
@ -524,7 +527,23 @@ function evaluateFor(exp, workerScript) {
|
||||
reject(e);
|
||||
});
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
if (e == "CONTINUESTATEMENT" ||
|
||||
(e instanceof WorkerScript && e.errorMessage == "CONTINUESTATEMENT")) {
|
||||
//Continue statement, recurse to next iteration
|
||||
var pUpdate = evaluate(exp.update, workerScript);
|
||||
pUpdate.then(function(resPostloop) {
|
||||
var recursiveCall = evaluateFor(exp, workerScript);
|
||||
recursiveCall.then(function(foo) {
|
||||
resolve("endForLoop");
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
});
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
});
|
||||
} else {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
resolve("endForLoop"); //Doesn't need to resolve to any particular value
|
||||
@ -561,7 +580,18 @@ function evaluateWhile(exp, workerScript) {
|
||||
evaluatePromise.then(function(resCode) {
|
||||
resolve(resCode);
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
if (e == "CONTINUESTATEMENT" ||
|
||||
(e instanceof WorkerScript && e.errorMessage == "CONTINUESTATEMENT")) {
|
||||
//Continue statement, recurse
|
||||
var recursiveCall = evaluateWhile(exp, workerScript);
|
||||
recursiveCall.then(function(foo) {
|
||||
resolve("endWhileLoop");
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
});
|
||||
} else {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
}, CONSTANTS.CodeInstructionRunTime);
|
||||
});
|
||||
|
@ -64,6 +64,7 @@ function initSingularitySFFlags() {
|
||||
function NetscriptFunctions(workerScript) {
|
||||
return {
|
||||
Math : Math,
|
||||
Date : Date,
|
||||
hacknetnodes : Player.hacknetNodes,
|
||||
scan : function(ip=workerScript.serverIp, hostnames=true){
|
||||
var server = getServer(ip);
|
||||
@ -135,6 +136,7 @@ function NetscriptFunctions(workerScript) {
|
||||
|
||||
Player.gainMoney(moneyGained);
|
||||
workerScript.scriptRef.onlineMoneyMade += moneyGained;
|
||||
Player.scriptProdSinceLastAug += moneyGained;
|
||||
workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);
|
||||
Player.gainHackingExp(expGainedOnSuccess);
|
||||
workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
|
||||
@ -467,6 +469,16 @@ function NetscriptFunctions(workerScript) {
|
||||
if (arguments.length !== 2 && arguments.length !== 3) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
|
||||
}
|
||||
if (scriptname && scriptname.constructor === Array) {
|
||||
//Recursively call scp on all elements of array
|
||||
var res = false;
|
||||
scriptname.forEach(function(script) {
|
||||
if (NetscriptFunctions(workerScript).scp(script, ip1, ip2)) {
|
||||
res = true;
|
||||
};
|
||||
});
|
||||
return res;
|
||||
}
|
||||
if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "Error: scp() only works for .script and .lit files");
|
||||
}
|
||||
@ -703,6 +715,15 @@ function NetscriptFunctions(workerScript) {
|
||||
workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + formatNumber(server.baseDifficulty, 3) + " for " + server.hostname);
|
||||
return server.baseDifficulty;
|
||||
},
|
||||
getServerMinSecurityLevel : function(ip) {
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
workerScript.scriptRef.log("getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
|
||||
throw makeRuntimeRejectMsg(workerScript, "getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
|
||||
}
|
||||
workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + formatNumber(server.minDifficulty, 3) + " for " + server.hostname);
|
||||
return server.minDifficulty;
|
||||
},
|
||||
getServerRequiredHackingLevel : function(ip){
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
@ -770,6 +791,12 @@ function NetscriptFunctions(workerScript) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < server.messages.length; ++i) {
|
||||
if (!(server.messages[i] instanceof Message) &&
|
||||
filename.toLowerCase() === server.messages[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isRunning : function(filename,ip){
|
||||
@ -866,6 +893,7 @@ function NetscriptFunctions(workerScript) {
|
||||
var netProfit = ((stock.price - stock.playerAvgPx) * shares) - CONSTANTS.StockMarketCommission;
|
||||
if (isNaN(netProfit)) {netProfit = 0;}
|
||||
workerScript.scriptRef.onlineMoneyMade += netProfit;
|
||||
Player.scriptProdSinceLastAug += netProfit;
|
||||
|
||||
stock.playerShares -= shares;
|
||||
if (stock.playerShares == 0) {
|
||||
@ -978,6 +1006,21 @@ function NetscriptFunctions(workerScript) {
|
||||
"as a purchased server. This is likely a bug please contact game dev");
|
||||
return false;
|
||||
},
|
||||
getPurchasedServers : function(hostname=true) {
|
||||
var res = [];
|
||||
Player.purchasedServers.forEach(function(ip) {
|
||||
if (hostname) {
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "ERR: Could not find server in getPurchasedServers(). This is a bug please report to game dev");
|
||||
}
|
||||
res.push(server.hostname);
|
||||
} else {
|
||||
res.push(ip);
|
||||
}
|
||||
});
|
||||
return res;
|
||||
},
|
||||
round : function(n) {
|
||||
if (isNaN(n)) {return 0;}
|
||||
return Math.round(n);
|
||||
@ -1091,7 +1134,10 @@ function NetscriptFunctions(workerScript) {
|
||||
getScriptIncome : function(scriptname, ip) {
|
||||
if (arguments.length === 0) {
|
||||
//Get total script income
|
||||
return updateActiveScriptsItems();
|
||||
var res = [];
|
||||
res.push(updateActiveScriptsItems());
|
||||
res.push(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug/1000));
|
||||
return res;
|
||||
} else {
|
||||
//Get income for a particular script
|
||||
var server = getServer(ip);
|
||||
@ -1137,6 +1183,9 @@ function NetscriptFunctions(workerScript) {
|
||||
return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime;
|
||||
}
|
||||
},
|
||||
getTimeSinceLastAug : function() {
|
||||
return Player.playtimeSinceLastAug;
|
||||
},
|
||||
|
||||
/* Singularity Functions */
|
||||
universityCourse(universityName, className) {
|
||||
|
@ -94,8 +94,7 @@ function PlayerObject() {
|
||||
|
||||
//Servers
|
||||
this.currentServer = ""; //IP address of Server currently being accessed through terminal
|
||||
this.discoveredServers = []; //IP addresses of secret servers not in the network that you have discovered
|
||||
this.purchasedServers = [];
|
||||
this.purchasedServers = []; //IP Addresses of purchased servers
|
||||
this.hacknetNodes = [];
|
||||
this.totalHacknetNodeProduction = 0;
|
||||
|
||||
@ -188,6 +187,9 @@ function PlayerObject() {
|
||||
this.lastUpdate = 0;
|
||||
this.totalPlaytime = 0;
|
||||
this.playtimeSinceLastAug = 0;
|
||||
|
||||
//Script production since last Aug installation
|
||||
this.scriptProdSinceLastAug = 0;
|
||||
};
|
||||
|
||||
PlayerObject.prototype.init = function() {
|
||||
@ -233,7 +235,6 @@ PlayerObject.prototype.prestigeAugmentation = function() {
|
||||
this.companyName = "";
|
||||
this.companyPosition = "";
|
||||
|
||||
this.discoveredServers = [];
|
||||
this.purchasedServers = [];
|
||||
|
||||
this.factions = [];
|
||||
@ -274,6 +275,7 @@ PlayerObject.prototype.prestigeAugmentation = function() {
|
||||
this.lastUpdate = new Date().getTime();
|
||||
|
||||
this.playtimeSinceLastAug = 0;
|
||||
this.scriptProdSinceLastAug = 0;
|
||||
|
||||
this.hacknetNodes.length = 0;
|
||||
this.totalHacknetNodeProduction = 0;
|
||||
@ -312,7 +314,6 @@ PlayerObject.prototype.prestigeSourceFile = function() {
|
||||
this.companyName = "";
|
||||
this.companyPosition = "";
|
||||
|
||||
this.discoveredServers = [];
|
||||
this.purchasedServers = [];
|
||||
|
||||
this.factions = [];
|
||||
@ -365,6 +366,7 @@ PlayerObject.prototype.prestigeSourceFile = function() {
|
||||
this.hasTixApiAccess = false;
|
||||
|
||||
this.playtimeSinceLastAug = 0;
|
||||
this.scriptProdSinceLastAug = 0;
|
||||
}
|
||||
|
||||
PlayerObject.prototype.getCurrentServer = function() {
|
||||
@ -1225,7 +1227,9 @@ PlayerObject.prototype.finishCreateProgramWork = function(cancelled, sing=false)
|
||||
this.getHomeComputer().programs.push(incompleteName);
|
||||
}
|
||||
|
||||
this.gainIntelligenceExp(this.createProgramReqLvl / CONSTANTS.IntelligenceProgramBaseExpGain);
|
||||
if (!cancelled) {
|
||||
this.gainIntelligenceExp(this.createProgramReqLvl / CONSTANTS.IntelligenceProgramBaseExpGain);
|
||||
}
|
||||
|
||||
var mainMenu = document.getElementById("mainmenu-container");
|
||||
mainMenu.style.visibility = "visible";
|
||||
@ -1362,6 +1366,7 @@ PlayerObject.prototype.takeClass = function(numCycles) {
|
||||
//through a Singularity Netscript function
|
||||
PlayerObject.prototype.finishClass = function(sing=false) {
|
||||
this.gainWorkExp();
|
||||
this.gainIntelligenceExp(CONSTANTS.IntelligenceClassBaseExpGain * Math.round(this.timeWorked / 1000));
|
||||
|
||||
if (this.workMoneyGained > 0) {
|
||||
throw new Error("ERR: Somehow gained money while taking class");
|
||||
@ -1512,6 +1517,14 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
|
||||
formatNumber(this.workAgiExpGained, 4) + " agility experience<br>" +
|
||||
formatNumber(this.workChaExpGained, 4) + " charisma experience");
|
||||
} else {
|
||||
//Exp halved on failure
|
||||
this.workHackExpGained /= 2;
|
||||
this.workStrExpGained /= 2;
|
||||
this.workDefExpGained /= 2;
|
||||
this.workDexExpGained /= 2;
|
||||
this.workAgiExpGained /= 2;
|
||||
this.workChaExpGained /= 2;
|
||||
|
||||
dialogBoxCreate("Crime failed! <br><br>" +
|
||||
"You gained:<br>"+
|
||||
formatNumber(this.workHackExpGained, 4) + " hacking experience <br>" +
|
||||
@ -1525,8 +1538,6 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
|
||||
this.gainWorkExp();
|
||||
}
|
||||
|
||||
|
||||
|
||||
var mainMenu = document.getElementById("mainmenu-container");
|
||||
mainMenu.style.visibility = "visible";
|
||||
this.isWorking = false;
|
||||
|
@ -12,8 +12,6 @@ require('brace/theme/xcode');
|
||||
require("brace/keybinding/vim");
|
||||
require("brace/keybinding/emacs");
|
||||
|
||||
|
||||
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {iTutorialSteps, iTutorialNextStep,
|
||||
|
@ -80,7 +80,7 @@ Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvai
|
||||
this.moneyMax = 25 * this.moneyAvailable * BitNodeMultipliers.ServerMaxMoney;
|
||||
this.hackDifficulty = hackDifficulty * BitNodeMultipliers.ServerStartingSecurity;
|
||||
this.baseDifficulty = hackDifficulty * BitNodeMultipliers.ServerStartingSecurity;
|
||||
this.minDifficulty = Math.max(1, Math.round(hackDifficulty / 3));
|
||||
this.minDifficulty = Math.max(1, Math.round(this.hackDifficulty / 3));
|
||||
this.serverGrowth = serverGrowth;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ import {displayHacknetNodesContent, processAllHacknetNodeEarnings,
|
||||
import {iTutorialStart} from "./InteractiveTutorial.js";
|
||||
import {initLiterature} from "./Literature.js";
|
||||
import {checkForMessagesToSend, initMessages} from "./Message.js";
|
||||
import {inMission, currMission} from "./Missions.js";
|
||||
import {initSingularitySFFlags,
|
||||
hasSingularitySF} from "./NetscriptFunctions.js";
|
||||
import {updateOnlineScriptTimes,
|
||||
@ -70,7 +71,7 @@ import {Terminal, postNetburnerText, post} from "./Terminal.js";
|
||||
* Alt-o - Options
|
||||
*/
|
||||
$(document).keydown(function(e) {
|
||||
if (!Player.isWorking && !redPillFlag) {
|
||||
if (!Player.isWorking && !redPillFlag && !inMission) {
|
||||
if (e.keyCode == 84 && e.altKey) {
|
||||
e.preventDefault();
|
||||
Engine.loadTerminalContent();
|
||||
@ -178,6 +179,7 @@ let Engine = {
|
||||
locationContent: null,
|
||||
workInProgressContent: null,
|
||||
redPillContent: null,
|
||||
missionContent: null,
|
||||
|
||||
//Character info
|
||||
characterInfo: null,
|
||||
@ -202,6 +204,7 @@ let Engine = {
|
||||
Infiltration: "Infiltration",
|
||||
StockMarket: "StockMarket",
|
||||
Gang: "Gang",
|
||||
Mission: "Mission",
|
||||
},
|
||||
currentPage: null,
|
||||
|
||||
@ -245,6 +248,7 @@ let Engine = {
|
||||
Engine.hideAllContent();
|
||||
Engine.Display.activeScriptsContent.style.visibility = "visible";
|
||||
setActiveScriptsClickHandlers();
|
||||
updateActiveScriptsItems();
|
||||
Engine.currentPage = Engine.Page.ActiveScripts;
|
||||
document.getElementById("active-scripts-menu-link").classList.add("active");
|
||||
},
|
||||
@ -385,7 +389,14 @@ let Engine = {
|
||||
Engine.loadTerminalContent();
|
||||
Engine.currentPage = Engine.Page.Terminal;
|
||||
}
|
||||
},
|
||||
|
||||
loadMissionContent: function() {
|
||||
Engine.hideAllContent();
|
||||
document.getElementById("mainmenu-container").style.visibility = "hidden";
|
||||
document.getElementById("character-overview-wrapper").style.visibility = "hidden";
|
||||
Engine.Display.missionContent.style.visibility = "visible";
|
||||
Engine.currentPage = Engine.Page.Mission;
|
||||
},
|
||||
|
||||
//Helper function that hides all content
|
||||
@ -407,6 +418,7 @@ let Engine = {
|
||||
Engine.Display.redPillContent.style.visibility = "hidden";
|
||||
Engine.Display.infiltrationContent.style.visibility = "hidden";
|
||||
Engine.Display.stockMarketContent.style.visibility = "hidden";
|
||||
Engine.Display.missionContent.style.visibility = "hidden";
|
||||
if (document.getElementById("gang-container")) {
|
||||
document.getElementById("gang-container").style.visibility = "hidden";
|
||||
}
|
||||
@ -467,6 +479,11 @@ let Engine = {
|
||||
if (Player.companyPosition != "") {
|
||||
companyPosition = Player.companyPosition.positionName;
|
||||
}
|
||||
|
||||
var bnText = "";
|
||||
if (Player.sourceFiles.length !== 0) {
|
||||
bnText = "<br>Current BitNode: " + Player.bitNodeN;
|
||||
}
|
||||
Engine.Display.characterInfo.innerHTML =
|
||||
('<b>General</b><br><br>' +
|
||||
'Current City: ' + Player.city + '<br><br>' +
|
||||
@ -518,7 +535,8 @@ let Engine = {
|
||||
'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '<br>' +
|
||||
'Augmentations installed: ' + Player.augmentations.length + '<br>' +
|
||||
'Time played since last Augmentation: ' + convertTimeMsToTimeElapsedString(Player.playtimeSinceLastAug) + '<br>' +
|
||||
'Time played: ' + convertTimeMsToTimeElapsedString(Player.totalPlaytime) + '<br><br><br>').replace( / /g, " " );
|
||||
'Time played: ' + convertTimeMsToTimeElapsedString(Player.totalPlaytime) +
|
||||
bnText + '<br><br><br>').replace( / /g, " " );
|
||||
},
|
||||
|
||||
/* Display locations in the world*/
|
||||
@ -822,6 +840,11 @@ let Engine = {
|
||||
Player.gang.process(numCycles);
|
||||
}
|
||||
|
||||
//Mission
|
||||
if (inMission && currMission) {
|
||||
currMission.process(numCycles);
|
||||
}
|
||||
|
||||
//Counters
|
||||
Engine.decrementAllCounters(numCycles);
|
||||
Engine.checkCounters();
|
||||
@ -945,7 +968,7 @@ let Engine = {
|
||||
if (Engine.Counters.messages <= 0) {
|
||||
checkForMessagesToSend();
|
||||
if (Augmentations[AugmentationNames.TheRedPill].owned) {
|
||||
Engine.Counters.messages = 600; //2 minutes for Red pill message
|
||||
Engine.Counters.messages = 4500; //15 minutes for Red pill message
|
||||
} else {
|
||||
Engine.Counters.messages = 150;
|
||||
}
|
||||
@ -1278,6 +1301,8 @@ let Engine = {
|
||||
Engine.Display.stockMarketContent = document.getElementById("stock-market-container");
|
||||
Engine.Display.stockMarketContent.style.visibility = "hidden";
|
||||
|
||||
Engine.Display.missionContent = document.getElementById("mission-container");
|
||||
Engine.Display.missionContent.style.visibility = "hidden";
|
||||
|
||||
//Character info
|
||||
Engine.Display.characterInfo = document.getElementById("character-info");
|
||||
|
@ -30,6 +30,14 @@ function clearEventListeners(elemId) {
|
||||
return newElem;
|
||||
}
|
||||
|
||||
//Same as clearEventListeners except it takes a DOM element object rather than an ID
|
||||
function clearEventListenersEl(el) {
|
||||
if (el == null) {console.log("ERR: element passed into clearEventListenersEl is null"); return null;}
|
||||
var newElem = el.cloneNode(true);
|
||||
el.parentNode.replaceChild(newElem, el);
|
||||
return newElem;
|
||||
}
|
||||
|
||||
function getRandomInt(min, max) {
|
||||
if (min > max) {return getRandomInt(max, min);}
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
@ -59,4 +67,4 @@ function powerOfTwo(n) {
|
||||
}
|
||||
|
||||
export {sizeOfObject, addOffset, clearEventListeners, getRandomInt,
|
||||
compareArrays, printArray, powerOfTwo};
|
||||
compareArrays, printArray, powerOfTwo, clearEventListenersEl};
|
||||
|
7
utils/jsplumb.min.js
vendored
Normal file
7
utils/jsplumb.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user