mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 07:02:26 +01:00
Create Program refactoring, added a notification for it when it comes up
This commit is contained in:
parent
66e4fa26a2
commit
acc3b8cf89
@ -104,6 +104,12 @@
|
|||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#active-scripts-text {
|
||||||
|
width: 80%;
|
||||||
|
margin: 6px;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.active-scripts-list > li {
|
.active-scripts-list > li {
|
||||||
margin: 6px;
|
margin: 6px;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
@ -115,3 +115,29 @@ tr:focus {
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Notification icon (for create program right now only) */
|
||||||
|
.create-program-tab {
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
#create-program-notification {
|
||||||
|
font-size: 10px;
|
||||||
|
|
||||||
|
position: absolute; /* Position the badge within the relatively positioned button */
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification-on {
|
||||||
|
background-color: #fa3e3e;
|
||||||
|
color: white;
|
||||||
|
border-radius: 2px;
|
||||||
|
padding: 1px 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification-off {
|
||||||
|
background-color: #333;
|
||||||
|
color: #333;
|
||||||
|
border-radius: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
@ -9,8 +9,7 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="css/workinprogress.css" />
|
<link rel="stylesheet" type="text/css" href="css/workinprogress.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="css/popupboxes.css" />
|
<link rel="stylesheet" type="text/css" href="css/popupboxes.css" />
|
||||||
|
|
||||||
<!-- We'll add in the jQuery library here - direct from
|
<!--jQuery library-->
|
||||||
the Google CDN (Content Delivery Network). -->
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||||
|
|
||||||
<!-- Utils -->
|
<!-- Utils -->
|
||||||
@ -53,6 +52,7 @@
|
|||||||
<script src="src/Crimes.js"></script>
|
<script src="src/Crimes.js"></script>
|
||||||
<script src="src/Prestige.js"></script>
|
<script src="src/Prestige.js"></script>
|
||||||
<script src="src/SaveObject.js"></script>
|
<script src="src/SaveObject.js"></script>
|
||||||
|
<script src="src/DarkWeb.js"></script>
|
||||||
|
|
||||||
<script src="src/engine.js"></script>
|
<script src="src/engine.js"></script>
|
||||||
|
|
||||||
@ -88,6 +88,7 @@
|
|||||||
|
|
||||||
<li class="create-program-tab">
|
<li class="create-program-tab">
|
||||||
<a href="#" id="create-program-menu-link"> Create Program </a>
|
<a href="#" id="create-program-menu-link"> Create Program </a>
|
||||||
|
<span id="create-program-notification" class="notification-off"> </span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="factions-tab">
|
<li class="factions-tab">
|
||||||
@ -145,6 +146,8 @@
|
|||||||
|
|
||||||
<!-- Active scripts info page -->
|
<!-- Active scripts info page -->
|
||||||
<div id="active-scripts-container">
|
<div id="active-scripts-container">
|
||||||
|
<p id="active-scripts-text"> This page displays a list of all scripts that are currently running across every machine. It also gives
|
||||||
|
information about their production </p>
|
||||||
<ul class="active-scripts-list" id="active-scripts-list" style="list-style: none;">
|
<ul class="active-scripts-list" id="active-scripts-list" style="list-style: none;">
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,53 +30,78 @@ function displayCreateProgramContent() {
|
|||||||
//PortHack.exe (in case you delete it lol)
|
//PortHack.exe (in case you delete it lol)
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {
|
if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {
|
||||||
portHackALink.style.display = "block";
|
portHackALink.style.display = "block";
|
||||||
portHackALink.addEventListener("click", function() {
|
|
||||||
createProgram(Programs.PortHackProgram, CONSTANTS.MillisecondsPerQuarterHour);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//BruteSSH
|
//BruteSSH
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.BruteSSHProgram) == -1 &&
|
if (Player.getHomeComputer().programs.indexOf(Programs.BruteSSHProgram) == -1 &&
|
||||||
Player.hacking_skill >= 50) {
|
Player.hacking_skill >= 50) {
|
||||||
bruteSshALink.style.display = "block";
|
bruteSshALink.style.display = "block";
|
||||||
bruteSshALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerQuarterHour);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//FTPCrack
|
//FTPCrack
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.FTPCrackProgram) == -1 &&
|
if (Player.getHomeComputer().programs.indexOf(Programs.FTPCrackProgram) == -1 &&
|
||||||
Player.hacking_skill >= 100) {
|
Player.hacking_skill >= 100) {
|
||||||
ftpCrackALink.style.display = "block";
|
ftpCrackALink.style.display = "block";
|
||||||
ftpCrackALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPerHalfHour);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//relaySMTP
|
//relaySMTP
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.RelaySMTPProgram) == -1 &&
|
if (Player.getHomeComputer().programs.indexOf(Programs.RelaySMTPProgram) == -1 &&
|
||||||
Player.hacking_skill >= 250) {
|
Player.hacking_skill >= 250) {
|
||||||
relaySmtpALink.style.display = "block";
|
relaySmtpALink.style.display = "block";
|
||||||
relaySmtpAlink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.RelaySMTPProgram. CONSTANTS.MillisecondsPer2Hours);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//HTTPWorm
|
//HTTPWorm
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.HTTPWormProgram) == -1 &&
|
if (Player.getHomeComputer().programs.indexOf(Programs.HTTPWormProgram) == -1 &&
|
||||||
Player.hacking_skill >= 500) {
|
Player.hacking_skill >= 500) {
|
||||||
httpWormALink.style.display = "block";
|
httpWormALink.style.display = "block";
|
||||||
httpWormALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer4Hours);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//SQLInject
|
//SQLInject
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.SQLInjectProgram) == -1 &&
|
if (Player.getHomeComputer().programs.indexOf(Programs.SQLInjectProgram) == -1 &&
|
||||||
Player.hacking_skill >= 750) {
|
Player.hacking_skill >= 750) {
|
||||||
sqlInjectALink.style.display = "block";
|
sqlInjectALink.style.display = "block";
|
||||||
sqlInjectALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer8Hours);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Returns the number of programs that are currently available to be created
|
||||||
|
function getNumAvailableCreateProgram() {
|
||||||
|
var count = 0;
|
||||||
|
|
||||||
|
//PortHack.exe (in case you delete it lol)
|
||||||
|
if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
|
||||||
|
//BruteSSH
|
||||||
|
if (Player.getHomeComputer().programs.indexOf(Programs.BruteSSHProgram) == -1 &&
|
||||||
|
Player.hacking_skill >= 50) {
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
|
||||||
|
//FTPCrack
|
||||||
|
if (Player.getHomeComputer().programs.indexOf(Programs.FTPCrackProgram) == -1 &&
|
||||||
|
Player.hacking_skill >= 100) {
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
|
||||||
|
//relaySMTP
|
||||||
|
if (Player.getHomeComputer().programs.indexOf(Programs.RelaySMTPProgram) == -1 &&
|
||||||
|
Player.hacking_skill >= 250) {
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HTTPWorm
|
||||||
|
if (Player.getHomeComputer().programs.indexOf(Programs.HTTPWormProgram) == -1 &&
|
||||||
|
Player.hacking_skill >= 500) {
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
|
||||||
|
//SQLInject
|
||||||
|
if (Player.getHomeComputer().programs.indexOf(Programs.SQLInjectProgram) == -1 &&
|
||||||
|
Player.hacking_skill >= 750) {
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
/* DarkWeb.js */
|
/* DarkWeb.js */
|
||||||
//Posts a "help" message if connected to DarkWeb
|
//Posts a "help" message if connected to DarkWeb
|
||||||
checkIfConnectedToDarkweb() {
|
checkIfConnectedToDarkweb = function() {
|
||||||
if (SpecialServerIps.hasOwnProperty("Darkweb Server")) {
|
if (SpecialServerIps.hasOwnProperty("Darkweb Server")) {
|
||||||
var darkwebIp = SpecialServerIps["Darkweb Server"];
|
var darkwebIp = SpecialServerIps["Darkweb Server"];
|
||||||
if (!isValidIPAddress(darkwebIp) {return;}
|
if (!isValidIPAddress(darkwebIp)) {return;}
|
||||||
if (darkwebIp == Player.getCurrentServer().ip) {
|
if (darkwebIp == Player.getCurrentServer().ip) {
|
||||||
post("You are now connected to the dark web. From the dark web you can purchase illegal items. " +
|
post("You are now connected to the dark web. From the dark web you can purchase illegal items. " +
|
||||||
"Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] " +
|
"Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] " +
|
||||||
|
@ -1496,7 +1496,7 @@ purchaseTorRouter = function() {
|
|||||||
dialogBoxCreate("You cannot afford to purchase the Tor router");
|
dialogBoxCreate("You cannot afford to purchase the Tor router");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player.money -= CONSTANTS.TorRouterCost;
|
Player.loseMoney(CONSTANTS.TorRouterCost);
|
||||||
|
|
||||||
var darkweb = new Server();
|
var darkweb = new Server();
|
||||||
darkweb.init(createRandomIp(), "darkweb", "", true, false, false, false, 1);
|
darkweb.init(createRandomIp(), "darkweb", "", true, false, false, false, 1);
|
||||||
|
@ -557,6 +557,7 @@ var Engine = {
|
|||||||
autoSaveCounter: 300, //Autosave every minute
|
autoSaveCounter: 300, //Autosave every minute
|
||||||
updateSkillLevelsCounter: 10, //Only update skill levels every 2 seconds. Might improve performance
|
updateSkillLevelsCounter: 10, //Only update skill levels every 2 seconds. Might improve performance
|
||||||
updateDisplays: 3, //Update displays such as Active Scripts display and character display
|
updateDisplays: 3, //Update displays such as Active Scripts display and character display
|
||||||
|
createProgramNotifications: 10, //Checks whether any programs can be created and notifies
|
||||||
serverGrowth: 450, //Process server growth every minute and a half
|
serverGrowth: 450, //Process server growth every minute and a half
|
||||||
checkFactionInvitations: 1500, //Check whether you qualify for any faction invitations every 5 minutes
|
checkFactionInvitations: 1500, //Check whether you qualify for any faction invitations every 5 minutes
|
||||||
passiveFactionGrowth: 600,
|
passiveFactionGrowth: 600,
|
||||||
@ -595,6 +596,19 @@ var Engine = {
|
|||||||
Engine.Counters.updateDisplays = 3;
|
Engine.Counters.updateDisplays = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Engine.Counters.createProgramNotifications <= 0) {
|
||||||
|
var num = getNumAvailableCreateProgram();
|
||||||
|
var elem = document.getElementById("create-program-notification");
|
||||||
|
if (num > 0) {
|
||||||
|
elem.innerHTML = num;
|
||||||
|
elem.setAttribute("class", "notification-on");
|
||||||
|
} else {
|
||||||
|
elem.innerHTML = "";
|
||||||
|
elem.setAttribute("class", "notification-off");
|
||||||
|
}
|
||||||
|
Engine.Counters.createProgramNotifications = 10;
|
||||||
|
}
|
||||||
|
|
||||||
if (Engine.Counters.serverGrowth <= 0) {
|
if (Engine.Counters.serverGrowth <= 0) {
|
||||||
var numCycles = Math.floor((450 - Engine.Counters.serverGrowth));
|
var numCycles = Math.floor((450 - Engine.Counters.serverGrowth));
|
||||||
processServerGrowth(numCycles);
|
processServerGrowth(numCycles);
|
||||||
@ -718,6 +732,7 @@ var Engine = {
|
|||||||
//Active scripts list
|
//Active scripts list
|
||||||
Engine.ActiveScriptsList = document.getElementById("active-scripts-list");
|
Engine.ActiveScriptsList = document.getElementById("active-scripts-list");
|
||||||
|
|
||||||
|
//Save and Delete buttons
|
||||||
Engine.Clickables.saveMainMenuButton = document.getElementById("save-game-link");
|
Engine.Clickables.saveMainMenuButton = document.getElementById("save-game-link");
|
||||||
Engine.Clickables.saveMainMenuButton.addEventListener("click", function() {
|
Engine.Clickables.saveMainMenuButton.addEventListener("click", function() {
|
||||||
saveObject.saveGame();
|
saveObject.saveGame();
|
||||||
@ -818,6 +833,33 @@ var Engine = {
|
|||||||
//Character info
|
//Character info
|
||||||
Engine.Display.characterInfo = document.getElementById("character-info");
|
Engine.Display.characterInfo = document.getElementById("character-info");
|
||||||
|
|
||||||
|
//Create Program buttons
|
||||||
|
var portHackALink = document.getElementById("create-program-porthack");
|
||||||
|
var bruteSshALink = document.getElementById("create-program-brutessh");
|
||||||
|
var ftpCrackALink = document.getElementById("create-program-ftpcrack");
|
||||||
|
var relaySmtpALink = document.getElementById("create-program-relaysmtp");
|
||||||
|
var httpWormALink = document.getElementById("create-program-httpworm");
|
||||||
|
var sqlInjectALink = document.getElementById("create-program-sqlinject");
|
||||||
|
portHackALink.addEventListener("click", function() {
|
||||||
|
createProgram(Programs.PortHackProgram, CONSTANTS.MillisecondsPerQuarterHour);
|
||||||
|
});
|
||||||
|
bruteSshALink.addEventListener("click", function() {
|
||||||
|
Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerQuarterHour);
|
||||||
|
});
|
||||||
|
ftpCrackALink.addEventListener("click", function() {
|
||||||
|
Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPerHalfHour);
|
||||||
|
});
|
||||||
|
relaySmtpALink.addEventListener("click", function() {
|
||||||
|
Player.startCreateProgramWork(Programs.RelaySMTPProgram. CONSTANTS.MillisecondsPer2Hours);
|
||||||
|
});
|
||||||
|
httpWormALink.addEventListener("click", function() {
|
||||||
|
Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer4Hours);
|
||||||
|
});
|
||||||
|
sqlInjectALink.addEventListener("click", function() {
|
||||||
|
Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer8Hours);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//Location lists
|
//Location lists
|
||||||
Engine.aevumLocationsList = document.getElementById("aevum-locations-list");
|
Engine.aevumLocationsList = document.getElementById("aevum-locations-list");
|
||||||
Engine.chongqingLocationsList = document.getElementById("chongqing-locations-list");
|
Engine.chongqingLocationsList = document.getElementById("chongqing-locations-list");
|
||||||
|
Loading…
Reference in New Issue
Block a user