Merge pull request #35 from danielyxie/dev

Dev v0.18.2
This commit is contained in:
danielyxie 2017-05-31 23:18:16 -05:00 committed by GitHub
commit 94d145fd60
10 changed files with 145 additions and 81 deletions

@ -12,20 +12,43 @@
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
#dialog-box-content {
z-index: 1;
/*
.dialog-box-container {
display: block;
position: relative;
z-index: 2;
margin: auto;
width: 50%;
height: 100%;
vertical-align: middle;
overflow: auto;
background-color: black;
background-color: rgba(0,0,0,0.4);
}
*/
.dialog-box-container {
display: block;
position: absolute;
z-index: 2;
/*margin: auto;*/
width: 50%;
height: auto;
top: 50%;
left: 50%;
margin: -10% 0 0 -25%;
overflow: auto;
background-color: black;
background-color: rgba(0,0,0,0.4);
}
.dialog-box-content {
z-index: 2;
background-color: black;
margin: 20% auto; /* 20% from the top and centered */
padding: 10px;
border: 5px solid #FFFFFF;
width: 40%; /* Could be more or less, depending on screen size */
}
.dialog-box-text {
color: #66ff33;
}
#dialog-box-close-button {
.dialog-box-close-button {
color: #aaa;
float: right;
font-size: 20px;
@ -38,8 +61,8 @@
box-shadow: 1px 1px 3px #000;
}
#dialog-box-close-button:hover,
#dialog-box-close-button:focus {
.dialog-box-close-button:hover,
.dialog-box-close-button:focus {
color: white;
text-decoration: none;
cursor: pointer;

@ -643,20 +643,6 @@
<a id="location-slums-heist" class="a-link-button tooltip"> Heist </a>
</div>
<!-- Dialog Box, displays status text only -->
<div id="dialog-box-container" class="popup-box-container">
<div id="dialog-box-content" class="dialog-box">
<span id="dialog-box-close-button">&times;</span>
<p id="dialog-box-text-1" class="dialog-box-text"> </p>
<br>
<p id="dialog-box-text-2" class="dialog-box-text"> </p>
<br>
<p id="dialog-box-text-3" class="dialog-box-text"> </p>
<br>
<p id="dialog-box-text-4" class="dialog-box-text"> </p>
</div>
</div>
<!-- Purchase Server Pop-up Box -->
<div id="purchase-server-box-container" class="popup-box-container">
<div id="purchase-server-box-content">

@ -497,7 +497,7 @@ initAugmentations = function() {
NeuralRetentionEnhancement.setInfo("Chemical injections are used to permanently alter and strengthen the brain's neuronal " +
"circuits, strengthening its ability to retain information.<br><br>" +
"This augmentation increases the player's hacking experience gain rate by 40%.");
NeuralRetentionEnhancement.addToFactions(["CyberSec", "NiteSec"]);
NeuralRetentionEnhancement.addToFactions(["NiteSec"]);
if (augmentationExists(AugmentationNames.NeuralRetentionEnhancement)) {
NeuralRetentionEnhancement.owned = Augmentations[AugmentationNames.NeuralRetentionEnhancement].owned;
delete Augmentations[AugmentationNames.NeuralRetentionEnhancement];

@ -17,7 +17,7 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
if (!this.isQualified(company, pos)) {
var reqText = getJobRequirementText(company, pos);
dialogBoxCreate("Unforunately, you do not qualify for this position", reqText);
dialogBoxCreate("Unforunately, you do not qualify for this position<br>" + reqText);
return;
}
@ -51,7 +51,7 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
pos.positionName == currPositionName) {
var nextPos = getNextCompanyPosition(pos);
var reqText = getJobRequirementText(company, nextPos);
dialogBoxCreate("Unfortunately, you do not qualify for a promotion", reqText);
dialogBoxCreate("Unfortunately, you do not qualify for a promotion<br>" + reqText);
return; //Same job, do nothing
}
@ -77,7 +77,8 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
this.companyPosition = pos;
if (leaveCompany) {
dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!",
dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " +
pos.positionName + "!<br>" +
"You lost 1000 reputatation at your old company " + oldCompanyName + " because you left.");
} else {
dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!");
@ -126,7 +127,7 @@ PlayerObject.prototype.applyForSecurityEngineerJob = function() {
if (this.isQualified(company, CompanyPositions.SecurityEngineer)) {
this.companyName = company.companyName;
this.companyPosition = CompanyPositions.SecurityEngineer;
dialogBoxCreate("Congratulations, you were offered a position at ", this.companyName, " as a Security Engineer!" , "");
dialogBoxCreate("Congratulations, you were offered a position at ", this.companyName, " as a Security Engineer!");
Engine.loadLocationContent();
} else {
dialogBoxCreate("Unforunately, you do not qualify for this position");

@ -1,5 +1,5 @@
CONSTANTS = {
Version: "0.18.1",
Version: "0.18.2",
//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

@ -1617,7 +1617,7 @@ purchaseTorRouter = function() {
Player.getHomeComputer().serversOnNetwork.push(darkweb.ip);
darkweb.serversOnNetwork.push(Player.getHomeComputer().ip);
dialogBoxCreate("You have purchased a Tor router!", "You now have access to the dark web from your home computer", "Use the scan/netstat commands to search for the dark web connection.");
dialogBoxCreate("You have purchased a Tor router!<br>You now have access to the dark web from your home computer<br>Use the scan/netstat commands to search for the dark web connection.");
}
displayUniversityLocationContent = function(costMult) {

@ -63,7 +63,7 @@ function runScriptsLoop() {
var scriptName = errorTextArray[2];
var errorMsg = errorTextArray[3];
dialogBoxCreate("Script runtime error: ", "Server Ip: " + serverIp, "Script name: " + scriptName, errorMsg);
dialogBoxCreate("Script runtime error:<br>Server Ip: " + serverIp + "<br>Script name: " + scriptName + "<br>" + errorMsg);
//Find the corresponding workerscript and set its flags to kill it
for (var i = 0; i < workerScripts.length; ++i) {
@ -85,7 +85,7 @@ function runScriptsLoop() {
var scriptName = errorTextArray[2];
var errorMsg = errorTextArray[3];
dialogBoxCreate("Script runtime error: ", "Server Ip: " + serverIp, "Script name: " + scriptName, errorMsg);
dialogBoxCreate("Script runtime error: <br>Server Ip: " + serverIp + "<br>Script name: " + scriptName + "<br>" + errorMsg);
}
w.running = false;
w.env.stopFlag = true;
@ -100,7 +100,7 @@ function runScriptsLoop() {
var scriptName = errorTextArray[2];
var errorMsg = errorTextArray[3];
dialogBoxCreate("Script runtime error: ", "Server Ip: " + serverIp, "Script name: " + scriptName, errorMsg);
dialogBoxCreate("Script runtime error: <br>Server Ip: " + serverIp + "<br>Script name: " + scriptName + "<br>" + errorMsg);
//Find the corresponding workerscript and set its flags to kill it
for (var i = 0; i < workerScripts.length; ++i) {

@ -159,10 +159,46 @@ Script.prototype.reset = function() {
this.onlineExpGained = 0;
this.logs = [];
if (this.moneyStolenMap != null) {
try {
this.moneyStolenMap.reset();
} catch(e) {
this.moneyStolenMap = null;
}
} else {
this.moneyStolenMap = new AllServersMap();
}
if (this.numTimesHackMap != null) {
try {
this.numTimesHackMap.reset();
} catch(e) {
this.numTimesHackMap = null;
}
} else {
this.numTimesHackMap = new AllServersMap();
}
if (this.numTimesGrowMap != null) {
try {
this.numTimesGrowMap.reset();
} catch(e) {
this.numTimesGrowMap = null;
}
} else {
this.numTimesGrowMap = new AllServersMap();
}
if (this.numTimesWeakenMap != null) {
try {
this.numTimesWeakenMap.reset();
} catch(e) {
this.numTimesWeakenMap = null;
}
} else {
this.numTimesWeakenMap = new AllServersMap();
}
}
//Updates how much RAM the script uses when it is running.
@ -435,3 +471,14 @@ AllServersMap.prototype.printConsole = function() {
}
}
}
AllServersMap.prototype.toJSON = function() {
return Generic_toJSON("AllServersMap", this);
}
AllServersMap.fromJSON = function(value) {
return Generic_fromJSON(AllServersMap, value.data);
}
Reviver.constructors.AllServersMap = AllServersMap;

@ -521,6 +521,11 @@ initForeignServers = function() {
BitRunnersServer.setPortProperties(4);
AddToAllServers(BitRunnersServer);
var TheBlackHandServer = new Server();
TheBlackHandServer.init(createRandomIp(), "I.I.I.I", "I.I.I.I", true, false, false, false, false, 0);
TheBlackHandServer.setPortProperties(3);
AddToAllServers(TheBlackHandServer);
var NiteSecServer = new Server();
NiteSecServer.init(createRandomIp(), "avmnite-02h", "NiteSec", true, false, false, false, 0);
NiteSecServer.setPortProperties(2);

@ -3,52 +3,54 @@
//Close dialog box when clicking outside
$(document).click(function(event) {
if (dialogBoxOpened) {
if ( $(event.target).closest(".dialog-box").get(0) == null ) {
dialogBoxClose();
if (!$(event.target).closest('.dialog-box-container').length){
--dialogBoxCount;
$(".dialog-box-container").remove();
if (dialogBoxCount == 0) {
dialogBoxOpened = false;
}
}
}
});
//Dialog box close buttons
$(document).on('click', '.dialog-box-close-button', function( event ) {
console.log("clicked close button");
if (dialogBoxOpened) {
$(this).closest('.dialog-box-container').remove();
--dialogBoxCount;
if (dialogBoxCount == 0) {
dialogBoxOpened = false;
}
}
});
var dialogBoxOpened = false;
function dialogBoxInit() {
var closeButton = document.getElementById("dialog-box-close-button");
var dialogBoxCount = 0;
//Close Dialog box
closeButton.addEventListener("click", function() {
dialogBoxClose();
return false;
});
};
dialogBoxCreate = function(txt) {
console.log("created");
var container = document.createElement("div");
container.setAttribute("class", "dialog-box-container");
document.addEventListener("DOMContentLoaded", dialogBoxInit, false);
var content = document.createElement("div");
content.setAttribute("class", "dialog-box-content");
dialogBoxClose = function() {
dialogBoxOpened = false;
var dialogBox = document.getElementById("dialog-box-container");
dialogBox.style.display = "none";
}
var closeButton = document.createElement("span");
closeButton.setAttribute("class", "dialog-box-close-button");
closeButton.innerHTML = "&times;"
var textE = document.createElement("p");
textE.innerHTML = txt;
content.appendChild(closeButton);
content.appendChild(textE);
container.appendChild(content);
document.body.appendChild(container);
dialogBoxOpen = function() {
var dialogBox = document.getElementById("dialog-box-container");
dialogBox.style.display = "block";
setTimeout(function() {
dialogBoxOpened = true;
++dialogBoxCount;
}, 500);
}
dialogBoxSetText = function(txt1, txt2="", txt3="", txt4="") {
var dialogBoxText1 = document.getElementById("dialog-box-text-1");
var dialogBoxText2 = document.getElementById("dialog-box-text-2");
var dialogBoxText3 = document.getElementById("dialog-box-text-3");
var dialogBoxText4 = document.getElementById("dialog-box-text-4");
dialogBoxText1.innerHTML = txt1;
dialogBoxText2.innerHTML = txt2;
dialogBoxText3.innerHTML = txt3;
dialogBoxText4.innerHTML = txt4;
}
dialogBoxCreate = function(txt1, txt2="", txt3="", txt4="") {
dialogBoxSetText(txt1, txt2, txt3, txt4);
dialogBoxOpen();
}