mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 20:25:45 +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 {
|
||||
display: none; /* Hidden by default */
|
||||
position: fixed; /* Stay in place */
|
||||
z-index: 1; /* Sit on top */
|
||||
z-index: 2; /* Sit on top */
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%; /* Full width */
|
||||
@ -15,6 +15,7 @@
|
||||
}
|
||||
|
||||
#dialog-box-content {
|
||||
z-index: 2;
|
||||
background-color: black;
|
||||
margin: 20% auto; /* 20% from the top and centered */
|
||||
padding: 10px;
|
||||
|
@ -635,7 +635,7 @@
|
||||
|
||||
<!-- Dialog Box, displays status text only -->
|
||||
<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>
|
||||
<p id="dialog-box-text-1" class="dialog-box-text"> </p>
|
||||
<br>
|
||||
|
@ -371,14 +371,17 @@ function evaluate(exp, workerScript) {
|
||||
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) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
setTimeout(function() {
|
||||
server.moneyAvailable += 1; //It can be grown even if it has no money
|
||||
var growthPercentage = processSingleServerGrowth(server, 450);
|
||||
resolve(growthPercentage);
|
||||
}, 120 * 1000); //grow() takes flat 2 minutes right now
|
||||
}, growTime);
|
||||
});
|
||||
|
||||
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
|
||||
function scriptCalculateHackingChance(server) {
|
||||
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 chance = skillChance * difficultyMult;
|
||||
var chance = skillChance * difficultyMult * Player.hacking_chance_mult;
|
||||
if (chance < 0) {return 0;}
|
||||
else {return chance;}
|
||||
}
|
||||
@ -1132,4 +1135,12 @@ function scriptCalculatePercentMoneyHacked(server) {
|
||||
if (percentMoneyHacked < 0) {return 0;}
|
||||
if (percentMoneyHacked > 1) {return 1;}
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
$(document).keyup(function(event) {
|
||||
//Enter
|
||||
if (event.keyCode == 13) {
|
||||
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
//Defines key commands in terminal
|
||||
$(document).keydown(function(event) {
|
||||
//Terminal
|
||||
|
@ -1,7 +1,17 @@
|
||||
/* 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() {
|
||||
var closeButton = document.getElementById("dialog-box-close-button");
|
||||
var dialogBox = document.getElementById("dialog-box-container");
|
||||
|
||||
//Close Dialog box
|
||||
closeButton.addEventListener("click", function() {
|
||||
@ -13,6 +23,7 @@ function dialogBoxInit() {
|
||||
document.addEventListener("DOMContentLoaded", dialogBoxInit, false);
|
||||
|
||||
dialogBoxClose = function() {
|
||||
dialogBoxOpened = false;
|
||||
var dialogBox = document.getElementById("dialog-box-container");
|
||||
dialogBox.style.display = "none";
|
||||
}
|
||||
@ -20,6 +31,10 @@ dialogBoxClose = function() {
|
||||
dialogBoxOpen = function() {
|
||||
var dialogBox = document.getElementById("dialog-box-container");
|
||||
dialogBox.style.display = "block";
|
||||
setTimeout(function() {
|
||||
dialogBoxOpened = true;
|
||||
}, 500);
|
||||
|
||||
}
|
||||
|
||||
dialogBoxSetText = function(txt1, txt2="", txt3="", txt4="") {
|
||||
|
Loading…
Reference in New Issue
Block a user