added home ram upgrade button, enable+disable intelligence, source file modifications

This commit is contained in:
Olivier Gagnon 2018-06-12 16:44:21 -04:00
parent c2f2829e75
commit ad90a0bb6f
3 changed files with 67 additions and 8 deletions

@ -481,27 +481,37 @@
<!-- dev menu -->
<div id="dev-menu-container" class="generic-menupage-container">
<p id='dev-menu-text'>If you see this menu you can pretty much break the game. It's recommended that you use this menu only to setup a save file appropriate to test a new feature or bug fix.</p>
<a id="dev-need-money" class="a-link-button"> Add $1000t </a>
<a id="dev-need-money" class="a-link-button"> Add $1000t </a>
<a id="dev-need-ram" class="a-link-button"> More home RAM </a>
<p id='dev-menu-text'>Augmentation related: </p>
<!-- gets populated with the list of all augments -->
<select id="dev-menu-aug-dropdown"></select>
<a id="dev-add-aug" class="a-link-button"> Add Augmentation </a>
<a id="dev-bit-flume" class="a-link-button"> Trigger BitFlume</a>
<input id="dev-sf-n" type="number" placeholder="SourceFile-N"><input id="dev-sf-lvl" type="number" placeholder="SourceFile-Lvl"><a id="dev-add-source-file" class="a-link-button"> Add/Remove source file </a>
<p id='dev-menu-text'>Faction related: </p>
<select id="dev-menu-faction-dropdown"></select>
<a id="dev-add-faction" class="a-link-button"> Receive invite </a>
<p id='dev-menu-text'>Program related: </p>
<select id="dev-menu-connect-dropdown"></select>
<a id="dev-connect" class="a-link-button"> Connect </a>
<select id="dev-menu-add-program-dropdown"></select>
<a id="dev-add-program" class="a-link-button"> Add Program </a>
<a id="dev-bit-flume" class="a-link-button"> Trigger BitFlume</a>
<p id='dev-menu-text'>Server related: </p>
<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>
<p id='dev-menu-text'>Exp/stats related: </p>
<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">
@ -516,7 +526,8 @@
<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>
<a id="dev-enable-intelligence" class="a-link-button"> enable intelligence </a>
<a id="dev-disable-intelligence" class="a-link-button"> disable intelligence </a>
</div>
<!-- Location (visiting a location in World) -->

@ -2356,6 +2356,7 @@ PlayerObject.prototype.queueAugmentation = function(name) {
}
}
this.firstAugPurchased = true;
this.queuedAugmentations.push(new PlayerOwnedAugmentation(name));
}

@ -51,7 +51,8 @@ import {loadAllRunningScripts, scriptEditorInit,
updateScriptEditorContent} from "./Script.js";
import {AllServers, Server, initForeignServers} from "./Server.js";
import {Settings, setSettingsLabels} from "./Settings.js";
import {initSourceFiles, SourceFiles} from "./SourceFile.js";
import {initSourceFiles, SourceFiles,
PlayerOwnedSourceFile} from "./SourceFile.js";
import {SpecialServerIps, initSpecialServerIps} from "./SpecialServerIps.js";
import {StockMarket, StockSymbols,
SymbolToStockMap, initStockSymbols,
@ -163,6 +164,7 @@ let Engine = {
//Dev menu
devMenuGiveMoney: null,
devMenuGiveRam: null,
devMenuAugDropdown: null,
devMenuAddAug: null,
devMenuTriggerBitFlume: null,
@ -189,7 +191,11 @@ let Engine = {
devMenuAddCharisma: null,
devMenuIntelligenceExp: null,
devMenuAddIntelligence: null,
devMenuUnlockIntelligence: null,
devMenuEnableIntelligence: null,
devMenuDisableIntelligence: null,
devMenuSFN: null,
devMenuSFLvl: null,
devMenuAddSF: null,
},
//Display objects
@ -830,6 +836,7 @@ let Engine = {
displayDevMenuContent: function() {
Engine.Clickables.devMenuGiveMoney.style.display = "block";
Engine.Clickables.devMenuGiveRam.style.display = "block";
Engine.Clickables.devMenuAugDropdown.style.display = "block";
Engine.Clickables.devMenuAddAug.style.display = "block";
Engine.Clickables.devMenuTriggerBitFlume.style.display = "block";
@ -857,7 +864,11 @@ let Engine = {
Engine.Clickables.devMenuAddCharisma.style.display = "block";
Engine.Clickables.devMenuIntelligenceExp.style.display = "block";
Engine.Clickables.devMenuAddIntelligence.style.display = "block";
Engine.Clickables.devMenuUnlockIntelligence.style.display = "block";
Engine.Clickables.devMenuEnableIntelligence.style.display = "block";
Engine.Clickables.devMenuDisableIntelligence.style.display = "block";
Engine.Clickables.devMenuSFN.style.display = "block";
Engine.Clickables.devMenuSFLvl.style.display = "block";
Engine.Clickables.devMenuAddSF.style.display = "block";
},
//Displays the text when a section of the Tutorial is opened
@ -1538,6 +1549,11 @@ let Engine = {
Player.gainMoney(1e15);
});
Engine.Clickables.devMenuGiveRam = document.getElementById("dev-need-ram");
Engine.Clickables.devMenuGiveRam.addEventListener("click", function() {
Player.getHomeComputer().maxRam *= 2;
});
Engine.Clickables.devMenuAugDropdown = document.getElementById("dev-menu-aug-dropdown");
const augDD = Engine.Clickables.devMenuAugDropdown;
for(const i in AugmentationNames) {
@ -1675,11 +1691,42 @@ let Engine = {
Player.updateSkillLevels();
});
Engine.Clickables.devMenuUnlockIntelligence = document.getElementById("dev-unlock-intelligence");
Engine.Clickables.devMenuUnlockIntelligence.addEventListener("click", function() {
Engine.Clickables.devMenuEnableIntelligence = document.getElementById("dev-enable-intelligence");
Engine.Clickables.devMenuEnableIntelligence.addEventListener("click", function() {
Player.intelligence = 1;
});
Engine.Clickables.devMenuDisableIntelligence = document.getElementById("dev-disable-intelligence");
Engine.Clickables.devMenuDisableIntelligence.addEventListener("click", function() {
Player.intelligence = 0;
});
Engine.Clickables.devMenuSFN = document.getElementById("dev-sf-n");
Engine.Clickables.devMenuSFLvl = document.getElementById("dev-sf-lvl");
Engine.Clickables.devMenuAddSF = document.getElementById("dev-add-source-file");
Engine.Clickables.devMenuAddSF.addEventListener("click", function() {
const sfN = parseInt(Engine.Clickables.devMenuSFN.value);
const sfLvl = parseInt(Engine.Clickables.devMenuSFLvl.value);
let sfIndex = -1;
for(const i in Player.sourceFiles) {
if(Player.sourceFiles[i].n === sfN) {
sfIndex = i;
break;
}
}
if(sfIndex === -1) { // add fresh source file
Player.sourceFiles.push(new PlayerOwnedSourceFile(sfN, sfLvl));
} else if(sfLvl === 0) { // remove a source file.
if(sfIndex === -1) { // doesn't have it anyway.
return;
}
Player.sourceFiles.splice(sfIndex, 1);
} else { // set source file level
Player.sourceFiles[sfIndex].lvl=sfLvl;
}
});
//If DarkWeb already purchased, disable the button
if (SpecialServerIps.hasOwnProperty("Darkweb Server")) {
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");