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">
|
<li id="options-tab" class="mainmenu-accordion-panel">
|
||||||
<a id="options-menu-link"> Options </a>
|
<a id="options-menu-link"> Options </a>
|
||||||
</li>
|
</li>
|
||||||
|
<li id="dev-tab" class="mainmenu-accordion-panel">
|
||||||
|
<a id="dev-menu-link"> Dev </a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -475,6 +478,22 @@
|
|||||||
<p id="tutorial-text"> </p>
|
<p id="tutorial-text"> </p>
|
||||||
</div>
|
</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) -->
|
<!-- Location (visiting a location in World) -->
|
||||||
<div id="location-container" class="generic-menupage-container">
|
<div id="location-container" class="generic-menupage-container">
|
||||||
<a id="location-return-to-world-button" class="a-link-button"> Return to World </a>
|
<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;
|
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 */
|
/* Functions for saving and loading the Player data */
|
||||||
function loadPlayer(saveString) {
|
function loadPlayer(saveString) {
|
||||||
Player = JSON.parse(saveString, Reviver);
|
Player = JSON.parse(saveString, Reviver);
|
||||||
|
@ -12,7 +12,8 @@ import {loxBoxCreate, logBoxUpdateText,
|
|||||||
import {updateActiveScriptsItems} from "./ActiveScriptsUI.js";
|
import {updateActiveScriptsItems} from "./ActiveScriptsUI.js";
|
||||||
import {Augmentations, installAugmentations,
|
import {Augmentations, installAugmentations,
|
||||||
initAugmentations, AugmentationNames,
|
initAugmentations, AugmentationNames,
|
||||||
displayAugmentationsContent} from "./Augmentations.js";
|
displayAugmentationsContent,
|
||||||
|
PlayerOwnedAugmentation} from "./Augmentations.js";
|
||||||
import {BitNodes, initBitNodes,
|
import {BitNodes, initBitNodes,
|
||||||
initBitNodeMultipliers} from "./BitNode.js";
|
initBitNodeMultipliers} from "./BitNode.js";
|
||||||
import {Bladeburner} from "./Bladeburner.js";
|
import {Bladeburner} from "./Bladeburner.js";
|
||||||
@ -145,6 +146,7 @@ let Engine = {
|
|||||||
factionsMainMenuButton: null,
|
factionsMainMenuButton: null,
|
||||||
augmentationsMainMenuButton: null,
|
augmentationsMainMenuButton: null,
|
||||||
tutorialMainMenuButton: null,
|
tutorialMainMenuButton: null,
|
||||||
|
devMainMenuButton: null,
|
||||||
saveMainMenuButton: null,
|
saveMainMenuButton: null,
|
||||||
deleteMainMenuButton: null,
|
deleteMainMenuButton: null,
|
||||||
|
|
||||||
@ -158,6 +160,11 @@ let Engine = {
|
|||||||
tutorialFactionsButton: null,
|
tutorialFactionsButton: null,
|
||||||
tutorialAugmentationsButton: null,
|
tutorialAugmentationsButton: null,
|
||||||
tutorialBackButton: null,
|
tutorialBackButton: null,
|
||||||
|
|
||||||
|
//Dev menu
|
||||||
|
devMenuGiveMoney: null,
|
||||||
|
devMenuAugDropdown: null,
|
||||||
|
devMenuAddAug: null,
|
||||||
},
|
},
|
||||||
|
|
||||||
//Display objects
|
//Display objects
|
||||||
@ -183,6 +190,7 @@ let Engine = {
|
|||||||
factionAugmentationsContent: null,
|
factionAugmentationsContent: null,
|
||||||
augmentationsContent: null,
|
augmentationsContent: null,
|
||||||
tutorialContent: null,
|
tutorialContent: null,
|
||||||
|
devMenuContent: null,
|
||||||
infiltrationContent: null,
|
infiltrationContent: null,
|
||||||
stockMarketContent: null,
|
stockMarketContent: null,
|
||||||
locationContent: null,
|
locationContent: null,
|
||||||
@ -208,6 +216,7 @@ let Engine = {
|
|||||||
Faction: "Faction",
|
Faction: "Faction",
|
||||||
Augmentations: "Augmentations",
|
Augmentations: "Augmentations",
|
||||||
Tutorial: "Tutorial",
|
Tutorial: "Tutorial",
|
||||||
|
DevMenu: "Dev Menu",
|
||||||
Location: "Location",
|
Location: "Location",
|
||||||
workInProgress: "WorkInProgress",
|
workInProgress: "WorkInProgress",
|
||||||
RedPill: "RedPill",
|
RedPill: "RedPill",
|
||||||
@ -319,6 +328,14 @@ let Engine = {
|
|||||||
document.getElementById("tutorial-menu-link").classList.add("active");
|
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() {
|
loadLocationContent: function() {
|
||||||
Engine.hideAllContent();
|
Engine.hideAllContent();
|
||||||
Engine.Display.locationContent.style.display = "block";
|
Engine.Display.locationContent.style.display = "block";
|
||||||
@ -455,6 +472,7 @@ let Engine = {
|
|||||||
Engine.Display.factionAugmentationsContent.style.display = "none";
|
Engine.Display.factionAugmentationsContent.style.display = "none";
|
||||||
Engine.Display.augmentationsContent.style.display = "none";
|
Engine.Display.augmentationsContent.style.display = "none";
|
||||||
Engine.Display.tutorialContent.style.display = "none";
|
Engine.Display.tutorialContent.style.display = "none";
|
||||||
|
Engine.Display.devMenuContent.style.display = "none";
|
||||||
Engine.Display.locationContent.style.display = "none";
|
Engine.Display.locationContent.style.display = "none";
|
||||||
Engine.Display.workInProgressContent.style.display = "none";
|
Engine.Display.workInProgressContent.style.display = "none";
|
||||||
Engine.Display.redPillContent.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("city-menu-link").classList.remove("active");
|
||||||
document.getElementById("tutorial-menu-link").classList.remove("active");
|
document.getElementById("tutorial-menu-link").classList.remove("active");
|
||||||
document.getElementById("options-menu-link").classList.remove("active");
|
document.getElementById("options-menu-link").classList.remove("active");
|
||||||
|
document.getElementById("dev-menu-link").classList.remove("active");
|
||||||
},
|
},
|
||||||
|
|
||||||
displayCharacterOverviewInfo: function() {
|
displayCharacterOverviewInfo: function() {
|
||||||
@ -784,6 +803,12 @@ let Engine = {
|
|||||||
document.getElementById("tutorial-text").style.display = "none";
|
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
|
//Displays the text when a section of the Tutorial is opened
|
||||||
displayTutorialPage: function(text) {
|
displayTutorialPage: function(text) {
|
||||||
document.getElementById("tutorial-getting-started-link").style.display = "none";
|
document.getElementById("tutorial-getting-started-link").style.display = "none";
|
||||||
@ -1182,6 +1207,7 @@ let Engine = {
|
|||||||
var job = document.getElementById("job-tab");
|
var job = document.getElementById("job-tab");
|
||||||
var tutorial = document.getElementById("tutorial-tab");
|
var tutorial = document.getElementById("tutorial-tab");
|
||||||
var options = document.getElementById("options-tab");
|
var options = document.getElementById("options-tab");
|
||||||
|
var dev = document.getElementById("dev-tab");
|
||||||
|
|
||||||
//Load game from save or create new game
|
//Load game from save or create new game
|
||||||
if (loadGame(saveString)) {
|
if (loadGame(saveString)) {
|
||||||
@ -1258,7 +1284,7 @@ let Engine = {
|
|||||||
formatNumber(offlineProductionFromHacknetNodes, 2));
|
formatNumber(offlineProductionFromHacknetNodes, 2));
|
||||||
//Close main menu accordions for loaded game
|
//Close main menu accordions for loaded game
|
||||||
var visibleMenuTabs = [terminal, createScript, activeScripts, stats,
|
var visibleMenuTabs = [terminal, createScript, activeScripts, stats,
|
||||||
hacknetnodes, city, tutorial, options];
|
hacknetnodes, city, tutorial, options, dev];
|
||||||
if (Player.firstFacInvRecvd) {visibleMenuTabs.push(factions);}
|
if (Player.firstFacInvRecvd) {visibleMenuTabs.push(factions);}
|
||||||
else {factions.style.display = "none";}
|
else {factions.style.display = "none";}
|
||||||
if (Player.firstAugPurchased) {visibleMenuTabs.push(augmentations);}
|
if (Player.firstAugPurchased) {visibleMenuTabs.push(augmentations);}
|
||||||
@ -1312,7 +1338,7 @@ let Engine = {
|
|||||||
Engine.openMainMenuHeader(
|
Engine.openMainMenuHeader(
|
||||||
[terminal, createScript, activeScripts, stats,
|
[terminal, createScript, activeScripts, stats,
|
||||||
hacknetnodes, city,
|
hacknetnodes, city,
|
||||||
tutorial, options]
|
tutorial, options, dev]
|
||||||
);
|
);
|
||||||
|
|
||||||
//Start interactive tutorial
|
//Start interactive tutorial
|
||||||
@ -1365,6 +1391,9 @@ let Engine = {
|
|||||||
Engine.Display.tutorialContent = document.getElementById("tutorial-container");
|
Engine.Display.tutorialContent = document.getElementById("tutorial-container");
|
||||||
Engine.Display.tutorialContent.style.display = "none";
|
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 = document.getElementById("infiltration-container");
|
||||||
Engine.Display.infiltrationContent.style.display = "none";
|
Engine.Display.infiltrationContent.style.display = "none";
|
||||||
|
|
||||||
@ -1452,6 +1481,22 @@ let Engine = {
|
|||||||
Engine.displayTutorialContent();
|
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 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");
|
||||||
@ -1548,16 +1593,18 @@ let Engine = {
|
|||||||
var tutorialLink = document.getElementById("tutorial-menu-link");
|
var tutorialLink = document.getElementById("tutorial-menu-link");
|
||||||
var options = document.getElementById("options-tab");
|
var options = document.getElementById("options-tab");
|
||||||
var optionsLink = document.getElementById("options-menu-link");
|
var optionsLink = document.getElementById("options-menu-link");
|
||||||
|
var dev = document.getElementById("dev-tab");
|
||||||
|
var devLink = document.getElementById("dev-menu-link");
|
||||||
this.classList.toggle("opened");
|
this.classList.toggle("opened");
|
||||||
if (tutorial.style.maxHeight) {
|
if (tutorial.style.maxHeight) {
|
||||||
Engine.toggleMainMenuHeader(false,
|
Engine.toggleMainMenuHeader(false,
|
||||||
[tutorial, options],
|
[tutorial, options, dev],
|
||||||
[tutorialLink, optionsLink]
|
[tutorialLink, optionsLink, devLink]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Engine.toggleMainMenuHeader(true,
|
Engine.toggleMainMenuHeader(true,
|
||||||
[tutorial, options],
|
[tutorial, options, dev],
|
||||||
[tutorialLink, optionsLink]
|
[tutorialLink, optionsLink, devLink]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1636,6 +1683,12 @@ let Engine = {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Engine.Clickables.devMainMenuButton = clearEventListeners("dev-menu-link");
|
||||||
|
Engine.Clickables.devMainMenuButton.addEventListener("click", function() {
|
||||||
|
Engine.loadDevMenuContent();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
//Active scripts list
|
//Active scripts list
|
||||||
Engine.ActiveScriptsList = document.getElementById("active-scripts-list");
|
Engine.ActiveScriptsList = document.getElementById("active-scripts-list");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user