Playtesting - Small UI improvements. Bug in evaluator that needs fixing

This commit is contained in:
Daniel Xie 2017-04-27 17:01:26 -05:00
parent a94a2ad1f4
commit 53273596e2
2 changed files with 29 additions and 4 deletions

@ -16,7 +16,25 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
var pos = entryPosType; var pos = entryPosType;
if (!this.isQualified(company, pos)) { if (!this.isQualified(company, pos)) {
dialogBoxCreate("Unforunately, you do not qualify for this position"); var offset = company.jobStatReqOffset;
var reqHacking = pos.requiredHacking > 0 ? pos.requiredHacking+offset : 0;
var reqStrength = pos.requiredStrength > 0 ? pos.requiredStrength+offset : 0;
var reqDefense = pos.requiredDefense > 0 ? pos.requiredDefense+offset : 0;
var reqDexterity = pos.requiredDexterity > 0 ? pos.requiredDexterity+offset : 0;
var reqAgility = pos.requiredDexterity > 0 ? pos.requiredDexterity+offset : 0;
var reqCharisma = pos.requiredCharisma > 0 ? pos.requiredCharisma+offset : 0;
var reqRep = pos.requiredReputation;
var reqText = "(Requires ";
if (reqHacking > 0) {reqText += (reqHacking + " hacking, ");}
if (reqStrength > 0) {reqText += (reqStrength + " strength, ");}
if (reqDefense > 0) {reqText += (reqDefense + " defense, ");}
if (reqDexterity > 0) {reqText += (reqDexterity + " dexterity, ");}
if (reqAgility > 0) {reqText += (reqAgility + " agility, ");}
if (reqCharisma > 0) {reqText += (reqCharisma + " charisma, ");}
if (reqRep > 1) {reqText += (reqRep + " reputation, ");}
reqText = reqText.substring(0, reqText.length - 2);
reqText += ")";
dialogBoxCreate("Unforunately, you do not qualify for this position", reqText);
return; return;
} }
@ -56,6 +74,7 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
var reqDexterity = nextPos.requiredDexterity > 0 ? nextPos.requiredDexterity+offset : 0; var reqDexterity = nextPos.requiredDexterity > 0 ? nextPos.requiredDexterity+offset : 0;
var reqAgility = nextPos.requiredDexterity > 0 ? nextPos.requiredDexterity+offset : 0; var reqAgility = nextPos.requiredDexterity > 0 ? nextPos.requiredDexterity+offset : 0;
var reqCharisma = nextPos.requiredCharisma > 0 ? nextPos.requiredCharisma+offset : 0; var reqCharisma = nextPos.requiredCharisma > 0 ? nextPos.requiredCharisma+offset : 0;
var reqRep = nextPos.requiredReputation;
var reqText = "(Requires "; var reqText = "(Requires ";
if (reqHacking > 0) {reqText += (reqHacking + " hacking, ");} if (reqHacking > 0) {reqText += (reqHacking + " hacking, ");}
if (reqStrength > 0) {reqText += (reqStrength + " strength, ");} if (reqStrength > 0) {reqText += (reqStrength + " strength, ");}
@ -63,6 +82,7 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
if (reqDexterity > 0) {reqText += (reqDexterity + " dexterity, ");} if (reqDexterity > 0) {reqText += (reqDexterity + " dexterity, ");}
if (reqAgility > 0) {reqText += (reqAgility + " agility, ");} if (reqAgility > 0) {reqText += (reqAgility + " agility, ");}
if (reqCharisma > 0) {reqText += (reqCharisma + " charisma, ");} if (reqCharisma > 0) {reqText += (reqCharisma + " charisma, ");}
if (reqRep > 1) {reqText += (reqRep + " reputation, ");}
reqText = reqText.substring(0, reqText.length - 2); reqText = reqText.substring(0, reqText.length - 2);
reqText += ")"; reqText += ")";
dialogBoxCreate("Unfortunately, you do not qualify for a promotion", reqText); dialogBoxCreate("Unfortunately, you do not qualify for a promotion", reqText);

@ -212,10 +212,15 @@ function evaluate(exp, workerScript) {
//Calculate the hacking time //Calculate the hacking time
var hackingTime = scriptCalculateHackingTime(server); //This is in seconds var hackingTime = scriptCalculateHackingTime(server); //This is in seconds
//No root access or skill level too low
if (server.hasAdminRights == false) { if (server.hasAdminRights == false) {
console.log("Cannot hack server " + server.hostname); workerScript.scriptRef.log("Cannot hack this server (" + server.hostname + ") because user does not have root access");
resolve("Cannot hack, no admin rights"); throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "|Script crashed because it did not have root access to " + server.hostname);
workerScript.scriptRef.log("Cannot hack this server because user does not have root access"); }
if (server.requiredHackingSkill > Player.hacking_skill) {
workerScript.scriptRef.log("Cannot hack this server (" + server.hostaname + ") because user does not have root access");
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "|Script crashed because player's hacking skill is not high enough to hack " + server.hostname);
} }
workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime + " seconds"); workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime + " seconds");