mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-26 19:14:32 +02:00
Color-coded BitNode selection screen and added SF information
This commit is contained in:
+53
-56
@@ -5,8 +5,9 @@ import { BitNodes } from "./BitNode/BitNode";
|
||||
import { Engine } from "./engine";
|
||||
import { Player } from "./Player";
|
||||
import { prestigeSourceFile } from "./Prestige";
|
||||
import { SourceFiles } from "./SourceFile/SourceFiles";
|
||||
import { PlayerOwnedSourceFile } from "./SourceFile/PlayerOwnedSourceFile";
|
||||
import { SourceFileFlags } from "./SourceFile/SourceFileFlags";
|
||||
import { SourceFiles } from "./SourceFile/SourceFiles";
|
||||
import { Terminal } from "./Terminal";
|
||||
import { setTimeoutRef } from "./utils/SetTimeoutRef";
|
||||
|
||||
@@ -138,15 +139,25 @@ function giveSourceFile(bitNodeNumber) {
|
||||
}
|
||||
}
|
||||
|
||||
// Keeps track of what Source-Files the player will have AFTER the current bitnode
|
||||
// is destroyed. Updated every time loadBitVerse() is called
|
||||
let nextSourceFileFlags = [];
|
||||
|
||||
function loadBitVerse(destroyedBitNodeNum, flume=false) {
|
||||
// Clear the screen
|
||||
var container = document.getElementById("red-pill-content");
|
||||
const container = document.getElementById("red-pill-content");
|
||||
removeChildrenFromElement(container);
|
||||
|
||||
// Update NextSourceFileFlags
|
||||
nextSourceFileFlags = SourceFileFlags.slice();
|
||||
if (!flume) {
|
||||
++nextSourceFileFlags[destroyedBitNodeNum];
|
||||
}
|
||||
|
||||
// Create the Bit Verse
|
||||
var bitVerseImage = document.createElement("pre");
|
||||
var bitNodes = [];
|
||||
for (var i = 1; i <= 12; ++i) {
|
||||
const bitVerseImage = document.createElement("pre");
|
||||
const bitNodes = [];
|
||||
for (let i = 1; i <= 12; ++i) {
|
||||
bitNodes.push(createBitNode(i));
|
||||
}
|
||||
|
||||
@@ -177,53 +188,29 @@ function loadBitVerse(destroyedBitNodeNum, flume=false) {
|
||||
" | | | | | | | | <br>" +
|
||||
" \\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/ <br><br><br><br>";
|
||||
|
||||
|
||||
/*
|
||||
" O <br>" +
|
||||
" | O O | O O | <br>" +
|
||||
" O | | / __| \ | | O <br>" +
|
||||
" O | O | | O / | O | | O | O <br>" +
|
||||
" | | | | |_/ |/ | \_ \_| | | | | <br>" +
|
||||
" O | | | O | | O__/ | / \__ | | O | | | O <br>" +
|
||||
" | | | | | | | / /| O / \| | | | | | | <br>" +
|
||||
"O | | | \| | O / _/ | / O | |/ | | | O<br>" +
|
||||
"| | | |O / | | O / | O O | | \ O| | | |<br>" +
|
||||
"| | |/ \/ / __| | |/ \ | \ | |__ \ \/ \| | |<br>" +
|
||||
" \| O | |_/ |\| \ O \__| \_| | O |/ <br>" +
|
||||
" | | |_/ | | \| / | \_| | | <br>" +
|
||||
" \| / \| | / / \ |/ <br>" +
|
||||
" | O | | / | O | <br>" +
|
||||
" O | | | | | | | O <br>" +
|
||||
" | | | / / \ \ | | | <br>" +
|
||||
" \| | / O / \ O \ | |/ <br>" +
|
||||
" \ | / / | | \ \ | / <br>" +
|
||||
" \ \JUMP O3R | | | | | | R3O PMUJ/ / <br>" +
|
||||
" \|| | | | | | | | | ||/ <br>" +
|
||||
" \| \_ | | | | | | _/ |/ <br>" +
|
||||
" \ \| / \ / \ |/ / <br>" +
|
||||
" O |/ O | | O \| O <br>" +
|
||||
" | | | | | | | | <br>" +
|
||||
" \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/ <br>";
|
||||
*/
|
||||
|
||||
container.appendChild(bitVerseImage);
|
||||
|
||||
// Bit node event listeners
|
||||
for (var i = 1; i <= 12; ++i) {
|
||||
// BitNode event listeners
|
||||
for (let i = 1; i <= 12; ++i) {
|
||||
(function(i) {
|
||||
var elemId = "bitnode-" + i.toString();
|
||||
var elem = clearEventListeners(elemId);
|
||||
if (elem == null) {return;}
|
||||
const elemId = "bitnode-" + i.toString();
|
||||
const elem = clearEventListeners(elemId);
|
||||
if (elem == null) { return; }
|
||||
if (i >= 1 && i <= 12) {
|
||||
elem.addEventListener("click", function() {
|
||||
var bitNodeKey = "BitNode" + i;
|
||||
var bitNode = BitNodes[bitNodeKey];
|
||||
const bitNodeKey = "BitNode" + i;
|
||||
const bitNode = BitNodes[bitNodeKey];
|
||||
if (bitNode == null) {
|
||||
console.log("ERROR: Could not find BitNode object for number: " + i);
|
||||
console.error(`Could not find BitNode object for number: ${i}`);
|
||||
return;
|
||||
}
|
||||
yesNoBoxCreate("BitNode-" + i + ": " + bitNode.name + "<br><br>" + bitNode.info);
|
||||
createBitNodeYesNoEventListeners(i, destroyedBitNodeNum, flume);
|
||||
|
||||
const maxSourceFileLevel = i === 12 ? "∞" : "3";
|
||||
const popupBoxText = `BitNode-${i}: ${bitNode.name}<br>` +
|
||||
`Source-File Level: ${nextSourceFileFlags[i]} / ${maxSourceFileLevel}<br><br>` +
|
||||
`${bitNode.info}`;
|
||||
yesNoBoxCreate(popupBoxText);
|
||||
createBitNodeYesNoEventListener(i, destroyedBitNodeNum, flume);
|
||||
});
|
||||
} else {
|
||||
elem.addEventListener("click", function() {
|
||||
@@ -284,18 +271,28 @@ function loadBitVerse(destroyedBitNodeNum, flume=false) {
|
||||
|
||||
// Returns string with DOM element for Bit Node
|
||||
function createBitNode(n) {
|
||||
var bitNodeStr = "BitNode" + n.toString();
|
||||
var bitNode = BitNodes[bitNodeStr];
|
||||
if (bitNode == null) {return "O";}
|
||||
return "<a class='bitnode tooltip' id='bitnode-" + bitNode.number.toString() + "'><strong>O</strong>" +
|
||||
"<span class='tooltiptext'>" +
|
||||
"<strong>BitNode-" + bitNode.number.toString() + "<br>" + bitNode.name+ "</strong><br>" +
|
||||
bitNode.desc + "<br>" +
|
||||
"</span></a>";
|
||||
const bitNodeStr = "BitNode" + n.toString();
|
||||
const bitNode = BitNodes[bitNodeStr];
|
||||
if (bitNode == null) { return "O"; }
|
||||
|
||||
const level = nextSourceFileFlags[n];
|
||||
let cssClass;
|
||||
if (n === 12 && level >= 2) {
|
||||
// Repeating BitNode
|
||||
cssClass = "level-2";
|
||||
} else {
|
||||
cssClass = `level-${level}`;
|
||||
}
|
||||
|
||||
return `<a class='bitnode ${cssClass} tooltip' id='bitnode-${bitNode.number}'><strong>O</strong>` +
|
||||
"<span class='tooltiptext'>" +
|
||||
`<strong>BitNode-${bitNode.number.toString()}<br>${bitNode.name}</strong><br>` +
|
||||
`${bitNode.desc}<br>` +
|
||||
"</span></a>";
|
||||
}
|
||||
|
||||
function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=false) {
|
||||
var yesBtn = yesNoBoxGetYesButton();
|
||||
function createBitNodeYesNoEventListener(newBitNode, destroyedBitNode, flume=false) {
|
||||
const yesBtn = yesNoBoxGetYesButton();
|
||||
yesBtn.innerHTML = "Enter BitNode-" + newBitNode;
|
||||
yesBtn.addEventListener("click", function() {
|
||||
if (!flume) {
|
||||
@@ -311,7 +308,7 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=fa
|
||||
|
||||
// Set new Bit Node
|
||||
Player.bitNodeN = newBitNode;
|
||||
console.log("Entering Bit Node " + Player.bitNodeN);
|
||||
console.log(`Entering Bit Node ${Player.bitNodeN}`);
|
||||
|
||||
// Reenable terminal
|
||||
$("#hack-progress-bar").attr('id', "old-hack-progress-bar");
|
||||
@@ -324,7 +321,7 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=fa
|
||||
prestigeSourceFile();
|
||||
yesNoBoxClose();
|
||||
});
|
||||
var noBtn = yesNoBoxGetNoButton();
|
||||
const noBtn = yesNoBoxGetNoButton();
|
||||
noBtn.innerHTML = "Back";
|
||||
noBtn.addEventListener("click", function() {
|
||||
yesNoBoxClose();
|
||||
|
||||
Reference in New Issue
Block a user