mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-21 21:52:30 +01:00
some work on dev menu
This commit is contained in:
parent
71cf3cac35
commit
2e3254877f
19
index.html
19
index.html
@ -88,6 +88,9 @@
|
||||
<li id="options-tab" class="mainmenu-accordion-panel">
|
||||
<a id="options-menu-link"> Options </a>
|
||||
</li>
|
||||
<li id="dev-tab" class="mainmenu-accordion-panel">
|
||||
<a id="dev-menu-link"> Dev </a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -475,6 +478,22 @@
|
||||
<p id="tutorial-text"> </p>
|
||||
</div>
|
||||
|
||||
<!-- dev menu -->
|
||||
<div id="dev-menu-container" class="generic-menupage-container">
|
||||
<p>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>
|
||||
|
||||
<!-- gets populated with the list of all augments -->
|
||||
<select id="dev-menu-aug-dropdown" display="none"></select><br>
|
||||
<a id="dev-add-aug" class="a-link-button"> Add Augmentation </a><br>
|
||||
|
||||
<!-- modify stats (hacking, int, etc) -->
|
||||
<!-- join faction -->
|
||||
<!-- nuke everything -->
|
||||
<!-- connect to specific server everything -->
|
||||
<!-- teleport to bitnode -->
|
||||
</div>
|
||||
|
||||
<!-- Location (visiting a location in World) -->
|
||||
<div id="location-container" class="generic-menupage-container">
|
||||
<a id="location-return-to-world-button" class="a-link-button"> Return to World </a>
|
||||
|
@ -2315,6 +2315,24 @@ PlayerObject.prototype.setBitNodeNumber = function(n) {
|
||||
this.bitNodeN = n;
|
||||
}
|
||||
|
||||
PlayerObject.prototype.queueAugmentation = function(name) {
|
||||
for(const i in this.queuedAugmentations) {
|
||||
if(this.queuedAugmentations[i].name == name) {
|
||||
console.log('tried to queue '+name+' twice, this may be a bug');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for(const i in this.augmentations) {
|
||||
if(this.augmentations[i].name == name) {
|
||||
console.log('tried to queue '+name+' but we already have that aug');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.queuedAugmentations.push(new PlayerOwnedAugmentation(name));
|
||||
}
|
||||
|
||||
/* Functions for saving and loading the Player data */
|
||||
function loadPlayer(saveString) {
|
||||
Player = JSON.parse(saveString, Reviver);
|
||||
|
@ -12,7 +12,8 @@ import {loxBoxCreate, logBoxUpdateText,
|
||||
import {updateActiveScriptsItems} from "./ActiveScriptsUI.js";
|
||||
import {Augmentations, installAugmentations,
|
||||
initAugmentations, AugmentationNames,
|
||||
displayAugmentationsContent} from "./Augmentations.js";
|
||||
displayAugmentationsContent,
|
||||
PlayerOwnedAugmentation} from "./Augmentations.js";
|
||||
import {BitNodes, initBitNodes,
|
||||
initBitNodeMultipliers} from "./BitNode.js";
|
||||
import {Bladeburner} from "./Bladeburner.js";
|
||||
@ -145,6 +146,7 @@ let Engine = {
|
||||
factionsMainMenuButton: null,
|
||||
augmentationsMainMenuButton: null,
|
||||
tutorialMainMenuButton: null,
|
||||
devMainMenuButton: null,
|
||||
saveMainMenuButton: null,
|
||||
deleteMainMenuButton: null,
|
||||
|
||||
@ -158,6 +160,11 @@ let Engine = {
|
||||
tutorialFactionsButton: null,
|
||||
tutorialAugmentationsButton: null,
|
||||
tutorialBackButton: null,
|
||||
|
||||
//Dev menu
|
||||
devMenuGiveMoney: null,
|
||||
devMenuAugDropdown: null,
|
||||
devMenuAddAug: null,
|
||||
},
|
||||
|
||||
//Display objects
|
||||
@ -183,6 +190,7 @@ let Engine = {
|
||||
factionAugmentationsContent: null,
|
||||
augmentationsContent: null,
|
||||
tutorialContent: null,
|
||||
devMenuContent: null,
|
||||
infiltrationContent: null,
|
||||
stockMarketContent: null,
|
||||
locationContent: null,
|
||||
@ -208,6 +216,7 @@ let Engine = {
|
||||
Faction: "Faction",
|
||||
Augmentations: "Augmentations",
|
||||
Tutorial: "Tutorial",
|
||||
DevMenu: "Dev Menu",
|
||||
Location: "Location",
|
||||
workInProgress: "WorkInProgress",
|
||||
RedPill: "RedPill",
|
||||
@ -319,6 +328,14 @@ let Engine = {
|
||||
document.getElementById("tutorial-menu-link").classList.add("active");
|
||||
},
|
||||
|
||||
loadDevMenuContent: function() {
|
||||
Engine.hideAllContent();
|
||||
Engine.Display.devMenuContent.style.display = "block";
|
||||
Engine.displayDevMenuContent();
|
||||
Engine.currentPage = Engine.Page.DevMenu;
|
||||
document.getElementById("dev-menu-link").classList.add("active");
|
||||
},
|
||||
|
||||
loadLocationContent: function() {
|
||||
Engine.hideAllContent();
|
||||
Engine.Display.locationContent.style.display = "block";
|
||||
@ -455,6 +472,7 @@ let Engine = {
|
||||
Engine.Display.factionAugmentationsContent.style.display = "none";
|
||||
Engine.Display.augmentationsContent.style.display = "none";
|
||||
Engine.Display.tutorialContent.style.display = "none";
|
||||
Engine.Display.devMenuContent.style.display = "none";
|
||||
Engine.Display.locationContent.style.display = "none";
|
||||
Engine.Display.workInProgressContent.style.display = "none";
|
||||
Engine.Display.redPillContent.style.display = "none";
|
||||
@ -494,6 +512,7 @@ let Engine = {
|
||||
document.getElementById("city-menu-link").classList.remove("active");
|
||||
document.getElementById("tutorial-menu-link").classList.remove("active");
|
||||
document.getElementById("options-menu-link").classList.remove("active");
|
||||
document.getElementById("dev-menu-link").classList.remove("active");
|
||||
},
|
||||
|
||||
displayCharacterOverviewInfo: function() {
|
||||
@ -784,6 +803,12 @@ let Engine = {
|
||||
document.getElementById("tutorial-text").style.display = "none";
|
||||
},
|
||||
|
||||
displayDevMenuContent: function() {
|
||||
Engine.Clickables.devMenuGiveMoney.style.display = "block";
|
||||
Engine.Clickables.devMenuAugDropdown.style.display = "block";
|
||||
Engine.Clickables.devMenuAddAug.style.display = "block";
|
||||
},
|
||||
|
||||
//Displays the text when a section of the Tutorial is opened
|
||||
displayTutorialPage: function(text) {
|
||||
document.getElementById("tutorial-getting-started-link").style.display = "none";
|
||||
@ -1182,6 +1207,7 @@ let Engine = {
|
||||
var job = document.getElementById("job-tab");
|
||||
var tutorial = document.getElementById("tutorial-tab");
|
||||
var options = document.getElementById("options-tab");
|
||||
var dev = document.getElementById("dev-tab");
|
||||
|
||||
//Load game from save or create new game
|
||||
if (loadGame(saveString)) {
|
||||
@ -1258,7 +1284,7 @@ let Engine = {
|
||||
formatNumber(offlineProductionFromHacknetNodes, 2));
|
||||
//Close main menu accordions for loaded game
|
||||
var visibleMenuTabs = [terminal, createScript, activeScripts, stats,
|
||||
hacknetnodes, city, tutorial, options];
|
||||
hacknetnodes, city, tutorial, options, dev];
|
||||
if (Player.firstFacInvRecvd) {visibleMenuTabs.push(factions);}
|
||||
else {factions.style.display = "none";}
|
||||
if (Player.firstAugPurchased) {visibleMenuTabs.push(augmentations);}
|
||||
@ -1312,7 +1338,7 @@ let Engine = {
|
||||
Engine.openMainMenuHeader(
|
||||
[terminal, createScript, activeScripts, stats,
|
||||
hacknetnodes, city,
|
||||
tutorial, options]
|
||||
tutorial, options, dev]
|
||||
);
|
||||
|
||||
//Start interactive tutorial
|
||||
@ -1365,6 +1391,9 @@ let Engine = {
|
||||
Engine.Display.tutorialContent = document.getElementById("tutorial-container");
|
||||
Engine.Display.tutorialContent.style.display = "none";
|
||||
|
||||
Engine.Display.devMenuContent = document.getElementById("dev-menu-container");
|
||||
Engine.Display.devMenuContent.style.display = "none";
|
||||
|
||||
Engine.Display.infiltrationContent = document.getElementById("infiltration-container");
|
||||
Engine.Display.infiltrationContent.style.display = "none";
|
||||
|
||||
@ -1452,6 +1481,22 @@ let Engine = {
|
||||
Engine.displayTutorialContent();
|
||||
});
|
||||
|
||||
Engine.Clickables.devMenuGiveMoney = document.getElementById("dev-need-money");
|
||||
Engine.Clickables.devMenuGiveMoney.addEventListener("click", function() {
|
||||
Player.gainMoney(1e15);
|
||||
});
|
||||
|
||||
Engine.Clickables.devMenuAugDropdown = document.getElementById("dev-menu-aug-dropdown");
|
||||
const augDD = Engine.Clickables.devMenuAugDropdown;
|
||||
for(const i in AugmentationNames) {
|
||||
augDD.options[augDD.options.length] = new Option(AugmentationNames[i], AugmentationNames[i]);
|
||||
}
|
||||
|
||||
Engine.Clickables.devMenuAddAug = document.getElementById("dev-add-aug");
|
||||
Engine.Clickables.devMenuAddAug.addEventListener("click", function() {
|
||||
Player.queueAugmentation(augDD.options[augDD.selectedIndex].value);
|
||||
});
|
||||
|
||||
//If DarkWeb already purchased, disable the button
|
||||
if (SpecialServerIps.hasOwnProperty("Darkweb Server")) {
|
||||
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");
|
||||
@ -1548,16 +1593,18 @@ let Engine = {
|
||||
var tutorialLink = document.getElementById("tutorial-menu-link");
|
||||
var options = document.getElementById("options-tab");
|
||||
var optionsLink = document.getElementById("options-menu-link");
|
||||
var dev = document.getElementById("dev-tab");
|
||||
var devLink = document.getElementById("dev-menu-link");
|
||||
this.classList.toggle("opened");
|
||||
if (tutorial.style.maxHeight) {
|
||||
Engine.toggleMainMenuHeader(false,
|
||||
[tutorial, options],
|
||||
[tutorialLink, optionsLink]
|
||||
[tutorial, options, dev],
|
||||
[tutorialLink, optionsLink, devLink]
|
||||
);
|
||||
} else {
|
||||
Engine.toggleMainMenuHeader(true,
|
||||
[tutorial, options],
|
||||
[tutorialLink, optionsLink]
|
||||
[tutorial, options, dev],
|
||||
[tutorialLink, optionsLink, devLink]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1636,6 +1683,12 @@ let Engine = {
|
||||
return false;
|
||||
});
|
||||
|
||||
Engine.Clickables.devMainMenuButton = clearEventListeners("dev-menu-link");
|
||||
Engine.Clickables.devMainMenuButton.addEventListener("click", function() {
|
||||
Engine.loadDevMenuContent();
|
||||
return false;
|
||||
});
|
||||
|
||||
//Active scripts list
|
||||
Engine.ActiveScriptsList = document.getElementById("active-scripts-list");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user