mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-03-11 04:42:34 +01:00
UI Improvements
This commit is contained in:
@ -9,14 +9,10 @@
|
||||
padding-left: 10px;
|
||||
margin-left: 10%;
|
||||
width: 99%;
|
||||
overflow-y: scroll;
|
||||
overflow: auto;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#character-info {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
|
||||
/* Script Editor */
|
||||
/* This temp element is used for auto adjusting filename field */
|
||||
.tmp-element {
|
||||
@ -340,13 +336,19 @@ div.faction-clear {
|
||||
|
||||
/* Tutorial */
|
||||
#tutorial-container {
|
||||
color: #66ff33;
|
||||
position: fixed;
|
||||
height: 100%;
|
||||
padding-top: 10px;
|
||||
padding-left: 10px;
|
||||
height: 100%;
|
||||
margin-left: 10%;
|
||||
width: 85%;
|
||||
width: 99%;
|
||||
overflow: auto;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#tutorial-text {
|
||||
width: 80%;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
/* Location */
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#work-in-progress-cancel-button {
|
||||
color: #aaa;
|
||||
float: right;
|
||||
float: left;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
-webkit-border-radius: 12px;
|
||||
|
@ -130,7 +130,9 @@
|
||||
|
||||
<!-- Character Info page -->
|
||||
<div id="character-container">
|
||||
<p id="character-info"> </p>
|
||||
<div id="character-content">
|
||||
<p id="character-info"> </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Script editor -->
|
||||
@ -473,6 +475,7 @@
|
||||
<a href="#" id="tutorial-networking-link" class="a-link-button"> Networking </a>
|
||||
<a href="#" id="tutorial-hacking-link" class="a-link-button"> Hacking </a>
|
||||
<a href="#" id="tutorial-scripts-link" class="a-link-button"> Scripts </a>
|
||||
<a href="#" id="tutorial-netscript-link" class="a-link-button"> Netscript Programming Language </a>
|
||||
<a href="#" id="tutorial-traveling-link" class="a-link-button"> Traveling </a>
|
||||
<a href="#" id="tutorial-jobs-link" class="a-link-button"> Jobs </a>
|
||||
<a href="#" id="tutorial-factions-link" class="a-link-button"> Factions </a>
|
||||
@ -530,7 +533,7 @@
|
||||
<a href="#" id="location-purchase-256gb" class="a-link-button"> Purchase 256GB Server - $100,000,000</a>
|
||||
<a href="#" id="location-purchase-512gb" class="a-link-button"> Purchase 512GB Server - $250,000,000</a>
|
||||
<a href="#" id="location-purchase-1tb" class="a-link-button"> Purchase 1TB Server - $750,000,000</a>
|
||||
<a href="#" id="location-purchase-tor" class="a-link-button"> Purchase TOaR Router - $100,000</a>
|
||||
<a href="#" id="location-purchase-tor" class="a-link-button"> Purchase TOR Router - $100,000</a>
|
||||
<a href="#" id="location-purchase-home-ram" class="a-link-button"> Purchase RAM for Home computer </a>
|
||||
|
||||
<!-- Travel agency -->
|
||||
|
@ -156,10 +156,11 @@ CONSTANTS = {
|
||||
"encounter diminishing returns in your hacking (since you are only hacking a certain percentage). A server " +
|
||||
"will regain money at a slow rate over time. ",
|
||||
|
||||
TutorialScriptsText: "Scripts can be used to automate the hacking process. Scripts must be written in the Netscript language " +
|
||||
"and are saved as a file. Running a script requires RAM. The more complex a script is, the more RAM " +
|
||||
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' " +
|
||||
"section of the 'Tutorial' tab. Running a script requires RAM. The more complex a script is, the more RAM " +
|
||||
"it requires to run. Scripts can be run on any server you have root access to. <br><br>" +
|
||||
"Here are some commands that are useful when working with scripts: <br>" +
|
||||
"Here are some Terminal commands that are useful when working with scripts: <br>" +
|
||||
"free - Shows the current server's RAM usage <br>" +
|
||||
"kill [script] - Stops a script that is running <br>" +
|
||||
"nano [script] - Edit a script <br>" +
|
||||
@ -167,13 +168,64 @@ CONSTANTS = {
|
||||
"run [script] - Run a script <br>" +
|
||||
"tail [script] - Displays a script's logs<br>" +
|
||||
"top - Displays all active scripts and their RAM usage <br><br>",
|
||||
TutorialTravelingText:"There are six major cities in the world that you are able to travel to: <br> " +
|
||||
TutorialNetscriptText: "Netscript is a very simple programming language implemented for this game. The language has " +
|
||||
"your basic programming constructs and several built-in commands that are used to hack. <br><br>" +
|
||||
"<strong> Variables and data types </strong><br>" +
|
||||
"The following data types are supported by Netscript: <br>" +
|
||||
"numeric - Integers and floats (6, 10.4999)<br>" +
|
||||
"string - Encapsulated by single or double quotes ('this is a string')<br>" +
|
||||
"boolean - True or False<br><br>" +
|
||||
"To create a variable, use the assign (=) operator. The language is not strongly typed. Examples: <br>" +
|
||||
"i = 5;<br>" +
|
||||
"s = 'this game is awesome!';<br><br>" +
|
||||
"In the first example above, we are creating the variable i and assigning it a value of 5. In the second, " +
|
||||
"we are creating the variable s and assigning it the value of a string. Note that all expressions must be " +
|
||||
"ended with a semicolon. <br><br>" +
|
||||
"<strong> Operators </strong> <br>" +
|
||||
"The following operators are supported by Netscript: <br>" +
|
||||
" +<br>" +
|
||||
" -<br>" +
|
||||
" *<br>" +
|
||||
" /<br>" +
|
||||
" %<br>" +
|
||||
" &&<br>" +
|
||||
" ||<br>" +
|
||||
" <<br>" +
|
||||
" ><br>" +
|
||||
" <=<br>" +
|
||||
" >=<br>" +
|
||||
" ==<br>" +
|
||||
" !=<br><br>" +
|
||||
"<strong> Functions </strong><br>" +
|
||||
"You can NOT define you own functions in Netscript (yet), but there are several built in functions that " +
|
||||
"you may use: <br><br> " +
|
||||
"<i>hack(hostname/ip)</i><br>Core function that is used to hack servers to steal money and gain hacking experience. The argument passed in must be a string with " +
|
||||
"either the IP or hostname of the server you want to hack. <br>Examples: hack('foodnstuff'); or hack('148.192.0.12');<br><br>" +
|
||||
"<i>sleep(n)</i><br>Suspends the script for n milliseconds. <br>Example: sleep(5000);<br><br>" +
|
||||
"<i>grow(hostname/ip)</i><br>Use your hacking skills to increase the amount of money available on a server. The argument passed in " +
|
||||
"must be a string with either the IP or hostname of the target server. <br> Example: grow('foodnstuff');<br><br>" +
|
||||
"<strong>While loop </strong><br>" +
|
||||
"A while loop is a control flow statement that repeatedly executes code as long as a condition is met. <br><br> " +
|
||||
"while (<i>[cond]</i>) {<br> <i>[code]</i><br>}<br><br>" +
|
||||
"As long as <i>[cond]</i> remains true, the code block <i>[code]</i> will continuously execute. Example: <br><br>" +
|
||||
"i = 0; <br> while (i < 10) { <br> hack('foodnstuff');<br> i = i + 1;<br> }; <br><br>" +
|
||||
"Note that a semicolon is needed at closing bracket of the while loop, UNLESS it is at the end of the code<br><br> " +
|
||||
"<strong>For loop</strong><br>" +
|
||||
"A for loop is another control flow statement that allows code to by repeated by iterations. The structure is: <br><br> " +
|
||||
"for (<i>[init]</i>; <i>[cond]</i>; <i>[post]</i>) {<br> <i>code</i> <br> }<br><br>" +
|
||||
"The <i>[init]</i> expression evaluates before the for loop begins. The for loop will continue to execute " +
|
||||
"as long as <i>[cond]</i> is met. The <i>[post]</i> expression will evaluate at the end of every iteration " +
|
||||
"of the for loop. The following example shows code that will do the same thing as the while loop example above, " +
|
||||
"except using a for loop instead: <br><br>" +
|
||||
"for (i = 0; i < 10; i = i+1) { <br> hack('foodnstuff');<br>}; <br><br><br>",
|
||||
|
||||
TutorialTravelingText:"There are six major cities in the world that you are able to travel to: <br><br> " +
|
||||
" Aevum<br>" +
|
||||
" Chongqing<br>" +
|
||||
" Sector-12<br>" +
|
||||
" New Tokyo<br>" +
|
||||
" Ishima<br>" +
|
||||
" Volhaven<br>" +
|
||||
" Volhaven<br><br>" +
|
||||
"To travel between cities, visit your current city's travel agency through the 'World' page. " +
|
||||
"From the travel agency you can travel to any other city. Doing so costs money. <br>" +
|
||||
"Each city has its own set of companies and unique locations. ",
|
||||
|
@ -55,7 +55,7 @@ function evaluate(exp, workerScript) {
|
||||
} catch (e) {
|
||||
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "|" + e.toString());
|
||||
}
|
||||
resolve("assignFinished");
|
||||
resolve(false);
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
});
|
||||
@ -244,6 +244,7 @@ function evaluate(exp, workerScript) {
|
||||
var expGainedOnSuccess = scriptCalculateExpGain(server);
|
||||
var expGainedOnFailure = (expGainedOnSuccess / 4);
|
||||
if (rand < hackChance) { //Success!
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
var moneyGained = scriptCalculatePercentMoneyHacked(server);
|
||||
moneyGained = Math.floor(server.moneyAvailable * moneyGained);
|
||||
|
||||
@ -259,7 +260,8 @@ function evaluate(exp, workerScript) {
|
||||
console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
|
||||
workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
|
||||
resolve("Hack success");
|
||||
} else {
|
||||
} else {
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
//Player only gains 25% exp for failure? TODO Can change this later to balance
|
||||
Player.gainHackingExp(expGainedOnFailure);
|
||||
workerScript.scriptRef.onlineExpGained += expGainedOnFailure;
|
||||
@ -359,7 +361,6 @@ function evaluate(exp, workerScript) {
|
||||
workerScript.scriptRef.log("Calling grow() on server " + server.hostname + " in 120 seconds");
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
console.log("Executing grow on " + server.hostname + " in 2 minutes ");
|
||||
setTimeout(function() {
|
||||
var growthPercentage = processSingleServerGrowth(server, 450);
|
||||
resolve(growthPercentage);
|
||||
|
@ -641,7 +641,7 @@ PlayerObject.prototype.workForFaction = function(numCycles) {
|
||||
|
||||
var txt = document.getElementById("work-in-progress-text");
|
||||
txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name + "." +
|
||||
"You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
|
||||
" You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
|
||||
"You have earned: <br><br>" +
|
||||
"$" + formatNumber(this.workMoneyGained, 2) + " (" + formatNumber(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec) <br><br>" +
|
||||
formatNumber(this.workRepGained, 4) + " (" + formatNumber(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this faction <br><br>" +
|
||||
|
@ -53,7 +53,7 @@ function prestigeAugmentation() {
|
||||
Player.agility_exp = 0;
|
||||
Player.charisma_exp = 0;
|
||||
|
||||
Player.money = 0;
|
||||
Player.money = 1000;
|
||||
|
||||
Player.homeComputer = "";
|
||||
|
||||
|
@ -22,6 +22,7 @@ var Engine = {
|
||||
tutorialNetworkingButton: null,
|
||||
tutorialHackingButton: null,
|
||||
tutorialScriptsButton: null,
|
||||
tutorialNetscriptButton: null,
|
||||
tutorialTravelingButton: null,
|
||||
tutorialJobsButton: null,
|
||||
tutorialFactionsButton: null,
|
||||
@ -270,7 +271,7 @@ var Engine = {
|
||||
'Salary multiplier: ' + formatNumber(Player.work_money_mult * 100, 2) + '%<br><br><br>' +
|
||||
'<b>Misc</b><br><br>' +
|
||||
'Servers owned: ' + Player.purchasedServers.length + '<br>' +
|
||||
'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '<br>').replace( / /g, " " );
|
||||
'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '<br><br> ').replace( / /g, " " );
|
||||
|
||||
},
|
||||
|
||||
@ -470,6 +471,7 @@ var Engine = {
|
||||
Engine.Clickables.tutorialNetworkingButton.style.display = "block";
|
||||
Engine.Clickables.tutorialHackingButton.style.display = "block";
|
||||
Engine.Clickables.tutorialScriptsButton.style.display = "block";
|
||||
Engine.Clickables.tutorialNetscriptButton.style.display = "block";
|
||||
Engine.Clickables.tutorialTravelingButton.style.display = "block";
|
||||
Engine.Clickables.tutorialJobsButton.style.display = "block";
|
||||
Engine.Clickables.tutorialFactionsButton.style.display = "block";
|
||||
@ -485,6 +487,7 @@ var Engine = {
|
||||
Engine.Clickables.tutorialNetworkingButton.style.display = "none";
|
||||
Engine.Clickables.tutorialHackingButton.style.display = "none";
|
||||
Engine.Clickables.tutorialScriptsButton.style.display = "none";
|
||||
Engine.Clickables.tutorialNetscriptButton.style.display = "none";
|
||||
Engine.Clickables.tutorialTravelingButton.style.display = "none";
|
||||
Engine.Clickables.tutorialJobsButton.style.display = "none";
|
||||
Engine.Clickables.tutorialFactionsButton.style.display = "none";
|
||||
@ -810,6 +813,11 @@ var Engine = {
|
||||
Engine.displayTutorialPage(CONSTANTS.TutorialScriptsText);
|
||||
});
|
||||
|
||||
Engine.Clickables.tutorialNetscriptButton = document.getElementById("tutorial-netscript-link");
|
||||
Engine.Clickables.tutorialNetscriptButton.addEventListener("click", function() {
|
||||
Engine.displayTutorialPage(CONSTANTS.TutorialNetscriptText);
|
||||
});
|
||||
|
||||
Engine.Clickables.tutorialTravelingButton = document.getElementById("tutorial-traveling-link");
|
||||
Engine.Clickables.tutorialTravelingButton.addEventListener("click", function() {
|
||||
Engine.displayTutorialPage(CONSTANTS.TutorialTravelingText);
|
||||
|
Reference in New Issue
Block a user