Removed some console.log statements. Fixed bug with displaying Factions Content

This commit is contained in:
Daniel Xie 2017-05-04 14:29:50 -05:00
parent 219373e48e
commit 8917284f27
5 changed files with 22 additions and 31 deletions

@ -172,7 +172,7 @@
#purchase-augmentation-box-content {
background-color: black;
margin: 15% auto; /* 15% from the top and centered */
padding: 1px;
padding: 8px;
border: 5px solid #FFFFFF;
width: 80%; /* Could be more or less, depending on screen size */
color: #66ff33;
@ -184,7 +184,7 @@
float: right;
font-size: 16px;
font-weight: bold;
padding: 2px;
padding: 4px;
margin: 6px;
border: 1px solid white;
}

@ -613,7 +613,7 @@
<div id="purchase-augmentation-box-container">
<div id="purchase-augmentation-box-content">
<p id="purchase-augmentation-box-text"> </p>
<p> WARNING: Purchasing an Augmentation resets most of your progress, including: <br>
<p> <br> WARNING: Purchasing an Augmentation resets most of your progress, including: <br>
Stats/Skill levels and Experience <br>
Money <br>
Scripts <br>

@ -387,7 +387,6 @@ function evaluate(exp, workerScript) {
//Evaluate the looping part of a for loop (Initialization block is NOT done in here)
function evaluateFor(exp, workerScript) {
var env = workerScript.env;
console.log("evaluateFor() called");
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
@ -395,7 +394,6 @@ function evaluateFor(exp, workerScript) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.cond, workerScript);
evaluatePromise.then(function(resCond) {
console.log("Conditional evaluated to: " + resCond);
resolve(resCond);
}, function(e) {
reject(e);
@ -405,13 +403,11 @@ function evaluateFor(exp, workerScript) {
pCond.then(function(resCond) {
if (resCond) {
console.log("About to evaluate an iteration of for loop code");
//Run the for loop code
var pCode = new Promise(function(resolve, reject) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.code, workerScript);
evaluatePromise.then(function(resCode) {
console.log("Evaluated an iteration of for loop code");
resolve(resCode);
}, function(e) {
reject(e);
@ -425,7 +421,6 @@ function evaluateFor(exp, workerScript) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.postloop, workerScript);
evaluatePromise.then(function(foo) {
console.log("Evaluated for loop postloop");
resolve("postLoopFinished");
}, function(e) {
reject(e);
@ -448,7 +443,6 @@ function evaluateFor(exp, workerScript) {
reject(e);
});
} else {
console.log("Cond is false, stopping for loop");
resolve("endForLoop"); //Doesn't need to resolve to any particular value
}
}, function(e) {
@ -460,7 +454,6 @@ function evaluateFor(exp, workerScript) {
function evaluateWhile(exp, workerScript) {
var env = workerScript.env;
console.log("evaluateWhile() called");
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
@ -468,7 +461,6 @@ function evaluateWhile(exp, workerScript) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.cond, workerScript);
evaluatePromise.then(function(resCond) {
console.log("Conditional evaluated to: " + resCond);
resolve(resCond);
}, function(e) {
reject(e);
@ -513,12 +505,10 @@ function evaluateWhile(exp, workerScript) {
function evaluateProg(exp, workerScript, index) {
var env = workerScript.env;
console.log("evaluateProg() called");
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
if (index >= exp.prog.length) {
console.log("Prog done. Resolving recursively");
resolve("progFinished");
} else {
//Evaluate this line of code in the prog
@ -617,7 +607,6 @@ function scriptCalculatePercentMoneyHacked(server) {
var difficultyMult = (100 - server.hackDifficulty) / 100;
var skillMult = (Player.hacking_skill - (server.requiredHackingSkill - 1)) / Player.hacking_skill;
var percentMoneyHacked = difficultyMult * skillMult * Player.hacking_money_mult;
console.log("Percent money hacked calculated to be: " + percentMoneyHacked);
if (percentMoneyHacked < 0) {return 0;}
if (percentMoneyHacked > 1) {return 1;}
return percentMoneyHacked;

@ -470,22 +470,25 @@ var Engine = {
//Re-add a link for each faction you are a member of
for (var i = 0; i < Player.factions.length; ++i) {
var factionName = Player.factions[i];
//Add the faction to the Factions page content
var item = document.createElement("li");
var aElem = document.createElement("a");
aElem.setAttribute("href", "#");
aElem.setAttribute("class", "a-link-button");
aElem.innerHTML = factionName;
aElem.addEventListener("click", function() {
Engine.loadFactionContent();
displayFactionContent(factionName);
return false;
});
item.appendChild(aElem);
factionsList.appendChild(item);
(function () {
var factionName = Player.factions[i];
//Add the faction to the Factions page content
var item = document.createElement("li");
var aElem = document.createElement("a");
aElem.setAttribute("href", "#");
aElem.setAttribute("class", "a-link-button");
aElem.innerHTML = factionName;
aElem.addEventListener("click", function() {
console.log("factionName:" + factionName)
Engine.loadFactionContent();
displayFactionContent(factionName);
return false;
});
item.appendChild(aElem);
factionsList.appendChild(item);
}()); //Immediate invocation
}
},

@ -36,6 +36,5 @@ isValidIPAddress = function(ipaddress) {
{
return true;
}
console.log("Invalid IP address");
return false ;
}