added stats related dev options

This commit is contained in:
Olivier Gagnon 2018-06-12 16:06:05 -04:00
parent bc14a6a147
commit c2f2829e75
3 changed files with 133 additions and 9 deletions

@ -492,17 +492,31 @@
<select id="dev-menu-faction-dropdown"></select> <select id="dev-menu-faction-dropdown"></select>
<a id="dev-add-faction" class="a-link-button"> Receive invite </a> <a id="dev-add-faction" class="a-link-button"> Receive invite </a>
<a id="dev-open-all" class="a-link-button"> NUKE + ports all servers </a>
<a id="dev-min-security" class="a-link-button"> minimize all servers security </a>
<a id="dev-max-money" class="a-link-button"> maximize all servers money </a>
<select id="dev-menu-connect-dropdown"></select> <select id="dev-menu-connect-dropdown"></select>
<a id="dev-connect" class="a-link-button"> Connect </a> <a id="dev-connect" class="a-link-button"> Connect </a>
<select id="dev-menu-add-program-dropdown"></select> <select id="dev-menu-add-program-dropdown"></select>
<a id="dev-add-program" class="a-link-button"> Add Program </a> <a id="dev-add-program" class="a-link-button"> Add Program </a>
<!-- modify stats (hacking, int, etc) --> <a id="dev-open-all" class="a-link-button"> NUKE + ports all servers </a>
<a id="dev-min-security" class="a-link-button"> minimize all servers security </a>
<a id="dev-max-money" class="a-link-button"> maximize all servers money </a>
<input id="dev-hacking-exp" type="number">
<a id="dev-add-hacking" class="a-link-button"> add hacking exp </a>
<input id="dev-strength-exp" type="number">
<a id="dev-add-strength" class="a-link-button"> add strength exp </a>
<input id="dev-defense-exp" type="number">
<a id="dev-add-defense" class="a-link-button"> add defense exp </a>
<input id="dev-dexterity-exp" type="number">
<a id="dev-add-dexterity" class="a-link-button"> add dexterity exp </a>
<input id="dev-agility-exp" type="number">
<a id="dev-add-agility" class="a-link-button"> add agility exp </a>
<input id="dev-charisma-exp" type="number">
<a id="dev-add-charisma" class="a-link-button"> add charisma exp </a>
<input id="dev-intelligence-exp" type="number">
<a id="dev-add-intelligence" class="a-link-button"> add intelligence exp </a>
<a id="dev-unlock-intelligence" class="a-link-button"> unlock intelligence </a>
</div> </div>
<!-- Location (visiting a location in World) --> <!-- Location (visiting a location in World) -->

@ -587,6 +587,9 @@ PlayerObject.prototype.gainHackingExp = function(exp) {
console.log("ERR: NaN passed into Player.gainHackingExp()"); return; console.log("ERR: NaN passed into Player.gainHackingExp()"); return;
} }
this.hacking_exp += exp; this.hacking_exp += exp;
if(this.hacking_exp < 0) {
this.hacking_exp = 0;
}
} }
PlayerObject.prototype.gainStrengthExp = function(exp) { PlayerObject.prototype.gainStrengthExp = function(exp) {
@ -594,6 +597,9 @@ PlayerObject.prototype.gainStrengthExp = function(exp) {
console.log("ERR: NaN passed into Player.gainStrengthExp()"); return; console.log("ERR: NaN passed into Player.gainStrengthExp()"); return;
} }
this.strength_exp += exp; this.strength_exp += exp;
if(this.strength_exp < 0) {
this.strength_exp = 0;
}
} }
PlayerObject.prototype.gainDefenseExp = function(exp) { PlayerObject.prototype.gainDefenseExp = function(exp) {
@ -601,6 +607,9 @@ PlayerObject.prototype.gainDefenseExp = function(exp) {
console.log("ERR: NaN passed into player.gainDefenseExp()"); return; console.log("ERR: NaN passed into player.gainDefenseExp()"); return;
} }
this.defense_exp += exp; this.defense_exp += exp;
if(this.defense_exp < 0) {
this.defense_exp = 0;
}
} }
PlayerObject.prototype.gainDexterityExp = function(exp) { PlayerObject.prototype.gainDexterityExp = function(exp) {
@ -608,6 +617,9 @@ PlayerObject.prototype.gainDexterityExp = function(exp) {
console.log("ERR: NaN passed into Player.gainDexterityExp()"); return; console.log("ERR: NaN passed into Player.gainDexterityExp()"); return;
} }
this.dexterity_exp += exp; this.dexterity_exp += exp;
if(this.dexterity_exp < 0) {
this.dexterity_exp = 0;
}
} }
PlayerObject.prototype.gainAgilityExp = function(exp) { PlayerObject.prototype.gainAgilityExp = function(exp) {
@ -615,6 +627,9 @@ PlayerObject.prototype.gainAgilityExp = function(exp) {
console.log("ERR: NaN passed into Player.gainAgilityExp()"); return; console.log("ERR: NaN passed into Player.gainAgilityExp()"); return;
} }
this.agility_exp += exp; this.agility_exp += exp;
if(this.agility_exp < 0) {
this.agility_exp = 0;
}
} }
PlayerObject.prototype.gainCharismaExp = function(exp) { PlayerObject.prototype.gainCharismaExp = function(exp) {
@ -622,6 +637,9 @@ PlayerObject.prototype.gainCharismaExp = function(exp) {
console.log("ERR: NaN passed into Player.gainCharismaExp()"); return; console.log("ERR: NaN passed into Player.gainCharismaExp()"); return;
} }
this.charisma_exp += exp; this.charisma_exp += exp;
if(this.charisma_exp < 0) {
this.charisma_exp = 0;
}
} }
PlayerObject.prototype.gainIntelligenceExp = function(exp) { PlayerObject.prototype.gainIntelligenceExp = function(exp) {

@ -175,6 +175,21 @@ let Engine = {
devMenuConnect: null, devMenuConnect: null,
devMenuProgramsDropdown: null, devMenuProgramsDropdown: null,
devMenuAddProgram: null, devMenuAddProgram: null,
devMenuHackingExp: null,
devMenuAddHacking: null,
devMenuStrengthExp: null,
devMenuAddStrength: null,
devMenuDefenseExp: null,
devMenuAddDefense: null,
devMenuDexterityExp: null,
devMenuAddDexterity: null,
devMenuAgilityExp: null,
devMenuAddAgility: null,
devMenuCharismaExp: null,
devMenuAddCharisma: null,
devMenuIntelligenceExp: null,
devMenuAddIntelligence: null,
devMenuUnlockIntelligence: null,
}, },
//Display objects //Display objects
@ -823,10 +838,26 @@ let Engine = {
Engine.Clickables.devMenuOpen.style.display = "block"; Engine.Clickables.devMenuOpen.style.display = "block";
Engine.Clickables.devMenuMinSecurity.style.display = "block"; Engine.Clickables.devMenuMinSecurity.style.display = "block";
Engine.Clickables.devMenuMaxMoney.style.display = "block"; Engine.Clickables.devMenuMaxMoney.style.display = "block";
Engine.Clickables.devMenuConnectDropdown = "block"; Engine.Clickables.devMenuConnectDropdown.style.display = "block";
Engine.Clickables.devMenuConnect = "block"; Engine.Clickables.devMenuConnect.style.display = "block";
Engine.Clickables.devMenuProgramsDropdown = "block"; Engine.Clickables.devMenuProgramsDropdown.style.display = "block";
Engine.Clickables.devMenuAddProgram = "block"; Engine.Clickables.devMenuAddProgram.style.display = "block";
Engine.Clickables.devMenuHackingExp.style.display = "block";
Engine.Clickables.devMenuAddHacking.style.display = "block";
Engine.Clickables.devMenuStrengthExp.style.display = "block";
Engine.Clickables.devMenuAddStrength.style.display = "block";
Engine.Clickables.devMenuDefenseExp.style.display = "block";
Engine.Clickables.devMenuAddDefense.style.display = "block";
Engine.Clickables.devMenuDexterityExp.style.display = "block";
Engine.Clickables.devMenuAddDexterity.style.display = "block";
Engine.Clickables.devMenuAgilityExp.style.display = "block";
Engine.Clickables.devMenuAddAgility.style.display = "block";
Engine.Clickables.devMenuCharismaExp.style.display = "block";
Engine.Clickables.devMenuAddCharisma.style.display = "block";
Engine.Clickables.devMenuIntelligenceExp.style.display = "block";
Engine.Clickables.devMenuAddIntelligence.style.display = "block";
Engine.Clickables.devMenuUnlockIntelligence.style.display = "block";
}, },
//Displays the text when a section of the Tutorial is opened //Displays the text when a section of the Tutorial is opened
@ -1588,6 +1619,67 @@ let Engine = {
} }
}); });
Engine.Clickables.devMenuHackingExp = document.getElementById("dev-hacking-exp");
Engine.Clickables.devMenuAddHacking = document.getElementById("dev-add-hacking");
Engine.Clickables.devMenuAddHacking.addEventListener("click", function() {
const exp = parseInt(Engine.Clickables.devMenuHackingExp.value);
Player.gainHackingExp(exp);
Player.updateSkillLevels();
});
Engine.Clickables.devMenuStrengthExp = document.getElementById("dev-strength-exp");
Engine.Clickables.devMenuAddStrength = document.getElementById("dev-add-strength");
Engine.Clickables.devMenuAddStrength.addEventListener("click", function() {
const exp = parseInt(Engine.Clickables.devMenuStrengthExp.value);
Player.gainStrengthExp(exp);
Player.updateSkillLevels();
});
Engine.Clickables.devMenuDefenseExp = document.getElementById("dev-defense-exp");
Engine.Clickables.devMenuAddDefense = document.getElementById("dev-add-defense");
Engine.Clickables.devMenuAddDefense.addEventListener("click", function() {
const exp = parseInt(Engine.Clickables.devMenuDefenseExp.value);
Player.gainDefenseExp(exp);
Player.updateSkillLevels();
});
Engine.Clickables.devMenuDexterityExp = document.getElementById("dev-dexterity-exp");
Engine.Clickables.devMenuAddDexterity = document.getElementById("dev-add-dexterity");
Engine.Clickables.devMenuAddDexterity.addEventListener("click", function() {
const exp = parseInt(Engine.Clickables.devMenuDexterityExp.value);
Player.gainDexterityExp(exp);
Player.updateSkillLevels();
});
Engine.Clickables.devMenuAgilityExp = document.getElementById("dev-agility-exp");
Engine.Clickables.devMenuAddAgility = document.getElementById("dev-add-agility");
Engine.Clickables.devMenuAddAgility.addEventListener("click", function() {
const exp = parseInt(Engine.Clickables.devMenuAgilityExp.value);
Player.gainAgilityExp(exp);
Player.updateSkillLevels();
});
Engine.Clickables.devMenuCharismaExp = document.getElementById("dev-charisma-exp");
Engine.Clickables.devMenuAddCharisma = document.getElementById("dev-add-charisma");
Engine.Clickables.devMenuAddCharisma.addEventListener("click", function() {
const exp = parseInt(Engine.Clickables.devMenuCharismaExp.value);
Player.gainCharismaExp(exp);
Player.updateSkillLevels();
});
Engine.Clickables.devMenuIntelligenceExp = document.getElementById("dev-intelligence-exp");
Engine.Clickables.devMenuAddIntelligence = document.getElementById("dev-add-intelligence");
Engine.Clickables.devMenuAddIntelligence.addEventListener("click", function() {
const exp = parseInt(Engine.Clickables.devMenuIntelligenceExp.value);
Player.gainIntelligenceExp(exp);
Player.updateSkillLevels();
});
Engine.Clickables.devMenuUnlockIntelligence = document.getElementById("dev-unlock-intelligence");
Engine.Clickables.devMenuUnlockIntelligence.addEventListener("click", function() {
Player.intelligence = 1;
});
//If DarkWeb already purchased, disable the button //If DarkWeb already purchased, disable the button
if (SpecialServerIps.hasOwnProperty("Darkweb Server")) { if (SpecialServerIps.hasOwnProperty("Darkweb Server")) {
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive"); document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");