mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 04:35:46 +01:00
Clicking outisde popup dialog box closes it. Grow() time is now based on hacking level
This commit is contained in:
parent
f756f09dbe
commit
5c16759908
@ -4,7 +4,7 @@
|
|||||||
#dialog-box-container {
|
#dialog-box-container {
|
||||||
display: none; /* Hidden by default */
|
display: none; /* Hidden by default */
|
||||||
position: fixed; /* Stay in place */
|
position: fixed; /* Stay in place */
|
||||||
z-index: 1; /* Sit on top */
|
z-index: 2; /* Sit on top */
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%; /* Full width */
|
width: 100%; /* Full width */
|
||||||
@ -15,6 +15,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#dialog-box-content {
|
#dialog-box-content {
|
||||||
|
z-index: 2;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
margin: 20% auto; /* 20% from the top and centered */
|
margin: 20% auto; /* 20% from the top and centered */
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
@ -635,7 +635,7 @@
|
|||||||
|
|
||||||
<!-- Dialog Box, displays status text only -->
|
<!-- Dialog Box, displays status text only -->
|
||||||
<div id="dialog-box-container">
|
<div id="dialog-box-container">
|
||||||
<div id="dialog-box-content">
|
<div id="dialog-box-content" class="dialog-box">
|
||||||
<span id="dialog-box-close-button">×</span>
|
<span id="dialog-box-close-button">×</span>
|
||||||
<p id="dialog-box-text-1" class="dialog-box-text"> </p>
|
<p id="dialog-box-text-1" class="dialog-box-text"> </p>
|
||||||
<br>
|
<br>
|
||||||
|
@ -371,14 +371,17 @@ function evaluate(exp, workerScript) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
workerScript.scriptRef.log("Calling grow() on server " + server.hostname + " in 120 seconds");
|
var growTime = scriptCalculateGrowTime(server);
|
||||||
|
console.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds")
|
||||||
|
workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds");
|
||||||
|
|
||||||
var p = new Promise(function(resolve, reject) {
|
var p = new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript);}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
server.moneyAvailable += 1; //It can be grown even if it has no money
|
server.moneyAvailable += 1; //It can be grown even if it has no money
|
||||||
var growthPercentage = processSingleServerGrowth(server, 450);
|
var growthPercentage = processSingleServerGrowth(server, 450);
|
||||||
resolve(growthPercentage);
|
resolve(growthPercentage);
|
||||||
}, 120 * 1000); //grow() takes flat 2 minutes right now
|
}, growTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
p.then(function(growthPercentage) {
|
p.then(function(growthPercentage) {
|
||||||
@ -1104,9 +1107,9 @@ function isScriptErrorMessage(msg) {
|
|||||||
//The same as Player's calculateHackingChance() function but takes in the server as an argument
|
//The same as Player's calculateHackingChance() function but takes in the server as an argument
|
||||||
function scriptCalculateHackingChance(server) {
|
function scriptCalculateHackingChance(server) {
|
||||||
var difficultyMult = (100 - server.hackDifficulty) / 100;
|
var difficultyMult = (100 - server.hackDifficulty) / 100;
|
||||||
var skillMult = (2 * Player.hacking_chance_mult * Player.hacking_skill);
|
var skillMult = (2 * Player.hacking_skill);
|
||||||
var skillChance = (skillMult - server.requiredHackingSkill) / skillMult;
|
var skillChance = (skillMult - server.requiredHackingSkill) / skillMult;
|
||||||
var chance = skillChance * difficultyMult;
|
var chance = skillChance * difficultyMult * Player.hacking_chance_mult;
|
||||||
if (chance < 0) {return 0;}
|
if (chance < 0) {return 0;}
|
||||||
else {return chance;}
|
else {return chance;}
|
||||||
}
|
}
|
||||||
@ -1133,3 +1136,11 @@ function scriptCalculatePercentMoneyHacked(server) {
|
|||||||
if (percentMoneyHacked > 1) {return 1;}
|
if (percentMoneyHacked > 1) {return 1;}
|
||||||
return percentMoneyHacked;
|
return percentMoneyHacked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Amount of time to execute grow()
|
||||||
|
function scriptCalculateGrowTime(server) {
|
||||||
|
var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;
|
||||||
|
var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50);
|
||||||
|
var growTime = skillFactor * 20; //This is in seconds
|
||||||
|
return growTime * 1000;
|
||||||
|
}
|
@ -27,15 +27,6 @@ var postNetburnerText = function() {
|
|||||||
post("Bitburner v" + CONSTANTS.Version);
|
post("Bitburner v" + CONSTANTS.Version);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
$(document).keyup(function(event) {
|
|
||||||
//Enter
|
|
||||||
if (event.keyCode == 13) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
//Defines key commands in terminal
|
//Defines key commands in terminal
|
||||||
$(document).keydown(function(event) {
|
$(document).keydown(function(event) {
|
||||||
//Terminal
|
//Terminal
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
/* Pop up Dialog Box */
|
/* Pop up Dialog Box */
|
||||||
|
|
||||||
|
//Close dialog box when clicking outside
|
||||||
|
$(document).click(function(event) {
|
||||||
|
if (dialogBoxOpened) {
|
||||||
|
if ( $(event.target).closest(".dialog-box").get(0) == null ) {
|
||||||
|
dialogBoxClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var dialogBoxOpened = false;
|
||||||
function dialogBoxInit() {
|
function dialogBoxInit() {
|
||||||
var closeButton = document.getElementById("dialog-box-close-button");
|
var closeButton = document.getElementById("dialog-box-close-button");
|
||||||
var dialogBox = document.getElementById("dialog-box-container");
|
|
||||||
|
|
||||||
//Close Dialog box
|
//Close Dialog box
|
||||||
closeButton.addEventListener("click", function() {
|
closeButton.addEventListener("click", function() {
|
||||||
@ -13,6 +23,7 @@ function dialogBoxInit() {
|
|||||||
document.addEventListener("DOMContentLoaded", dialogBoxInit, false);
|
document.addEventListener("DOMContentLoaded", dialogBoxInit, false);
|
||||||
|
|
||||||
dialogBoxClose = function() {
|
dialogBoxClose = function() {
|
||||||
|
dialogBoxOpened = false;
|
||||||
var dialogBox = document.getElementById("dialog-box-container");
|
var dialogBox = document.getElementById("dialog-box-container");
|
||||||
dialogBox.style.display = "none";
|
dialogBox.style.display = "none";
|
||||||
}
|
}
|
||||||
@ -20,6 +31,10 @@ dialogBoxClose = function() {
|
|||||||
dialogBoxOpen = function() {
|
dialogBoxOpen = function() {
|
||||||
var dialogBox = document.getElementById("dialog-box-container");
|
var dialogBox = document.getElementById("dialog-box-container");
|
||||||
dialogBox.style.display = "block";
|
dialogBox.style.display = "block";
|
||||||
|
setTimeout(function() {
|
||||||
|
dialogBoxOpened = true;
|
||||||
|
}, 500);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogBoxSetText = function(txt1, txt2="", txt3="", txt4="") {
|
dialogBoxSetText = function(txt1, txt2="", txt3="", txt4="") {
|
||||||
|
Loading…
Reference in New Issue
Block a user