mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 20:55:44 +01:00
Created functions to display Faction content (for a single faction) and added the corresponding html elements. Created framework for loading content for all pages (world, augmentations, etc.) in Engine.js
This commit is contained in:
parent
f38a3d1c75
commit
e89bb00155
@ -91,3 +91,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Factions */
|
/* Factions */
|
||||||
|
#faction-hack-button-div, #faction-hack-text-div {
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
#faction-fieldwork-button-div, #faction-fieldwork-text-div {
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
#faction-securitywork-button-div, #faction-securitywork-text-div {
|
||||||
|
display:inline-block;
|
||||||
|
}
|
28
index.html
28
index.html
@ -123,8 +123,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- World -->
|
<!-- World -->
|
||||||
|
<div id="world-container">
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Create a program(executable) -->
|
<!-- Create a program(executable) -->
|
||||||
|
<div id="create-program-container">
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Factions -->
|
<!-- Factions -->
|
||||||
<div id="factions-container">
|
<div id="factions-container">
|
||||||
@ -136,11 +140,29 @@
|
|||||||
<div id="faction-container">
|
<div id="faction-container">
|
||||||
<h2 id="faction-name"></h2>
|
<h2 id="faction-name"></h2>
|
||||||
<p id="faction-info"></p>
|
<p id="faction-info"></p>
|
||||||
<!-- TODO Buttons -->
|
|
||||||
|
<div id="faction-hack-div">
|
||||||
|
<div id="faction-hack-button-div"><button id="faction-hack-button"> Hacking Contracts </button></div>
|
||||||
|
<div id="faction-hack-text-div"><p id="faction-hack-text"></p></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="faction-fieldwork-div">
|
||||||
|
<div id="faction-fieldwork-button-div"><button id="faction-fieldwork-button"> Field Work </button></div>
|
||||||
|
<div id="faction-fieldwork-text-div"><p id="faction-fieldwork-text"></p></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="faction-securitywork-div" visibility>
|
||||||
|
<div id="faction-securitywork-button-div"><button id="faction-securitywork-button"> Security Work </button></div>
|
||||||
|
<div id="faction-securitywork-text-div"><p id="faction-securitywork-text"></p></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Installed augmentations -->
|
<!-- Installed augmentations -->
|
||||||
|
<div id="augmentations-container">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Tutorial content -->
|
||||||
|
<div id="tutorial-container">
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -68,7 +68,16 @@ initAugmentations = function() {
|
|||||||
var GrapheneBoneLacings = new Augmentation("Graphene Bone Lacings");
|
var GrapheneBoneLacings = new Augmentation("Graphene Bone Lacings");
|
||||||
AddToAugmentations(GrapheneBoneLacings);
|
AddToAugmentations(GrapheneBoneLacings);
|
||||||
|
|
||||||
|
var BionicSpine = new Augmentation("Bionic Spine");
|
||||||
|
AddToAugmentations(BionicSpine);
|
||||||
|
|
||||||
|
var GrapheneBionicSpine = new Augmentation("Graphene Bionic Spine");
|
||||||
|
AddToAugmentations(GrapheneBionicSpine);
|
||||||
|
|
||||||
//Labor stat augmentations
|
//Labor stat augmentations
|
||||||
|
var SpeechProcessor = new Augmentation("Speech Processor Implant");
|
||||||
|
AddToAugmentations(SpeechProcessor);
|
||||||
|
|
||||||
var CASIE = new Augmentation("Computer Assisted Social Interaction Enhancement");
|
var CASIE = new Augmentation("Computer Assisted Social Interaction Enhancement");
|
||||||
AddToAugmentations(CASIE);
|
AddToAugmentations(CASIE);
|
||||||
|
|
||||||
@ -106,6 +115,9 @@ initAugmentations = function() {
|
|||||||
var ENMDMA = new Augmentation("Embedded Netburner Module Direct Memory Access Upgrade");
|
var ENMDMA = new Augmentation("Embedded Netburner Module Direct Memory Access Upgrade");
|
||||||
AddToAugmentations(ENMDMA);
|
AddToAugmentations(ENMDMA);
|
||||||
|
|
||||||
|
var Neuralstimulator = new Augmentation("Neuralstimulator");
|
||||||
|
AddToAugmentations(Neuralstimulator);
|
||||||
|
|
||||||
//Misc augmentations
|
//Misc augmentations
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,11 +158,20 @@ applyAugmentations = function(aug) {
|
|||||||
case "Graphene Bone Lacings":
|
case "Graphene Bone Lacings":
|
||||||
//Strength defense 15%
|
//Strength defense 15%
|
||||||
break;
|
break;
|
||||||
|
case "Bionic Spine":
|
||||||
|
//Everything 3%?
|
||||||
|
break;
|
||||||
|
case "Graphene Bionic Spine":
|
||||||
|
//Everything 5%
|
||||||
|
break;
|
||||||
|
|
||||||
//Labor stats augmentations
|
//Labor stats augmentations
|
||||||
case "Computer Assisted Social Interaction Enhancement":
|
case "Computer Assisted Social Interaction Enhancement":
|
||||||
//Charisma 10%
|
//Charisma 10%
|
||||||
break;
|
break;
|
||||||
|
case "Speech Processor Implant":
|
||||||
|
//Charisma 5%
|
||||||
|
break;
|
||||||
|
|
||||||
//Hacking augmentations
|
//Hacking augmentations
|
||||||
case "Artificial Bio-neural Network Implant":
|
case "Artificial Bio-neural Network Implant":
|
||||||
@ -187,7 +208,9 @@ applyAugmentations = function(aug) {
|
|||||||
case "Embedded Netburner Module Direct Memory Access Upgrade":
|
case "Embedded Netburner Module Direct Memory Access Upgrade":
|
||||||
//Money hacked 20%
|
//Money hacked 20%
|
||||||
break;
|
break;
|
||||||
|
case "Neuralstimulator":
|
||||||
|
//Hacking speed, money gained, and exp gained 10%
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.log("No such augmentation!");
|
console.log("No such augmentation!");
|
||||||
|
146
src/Faction.js
146
src/Faction.js
@ -107,8 +107,152 @@ initFactions = function() {
|
|||||||
|
|
||||||
//Displays the HTML content for this faction
|
//Displays the HTML content for this faction
|
||||||
displayFactionContent = function(faction) {
|
displayFactionContent = function(faction) {
|
||||||
|
var hackDiv = document.getElementById("faction-hack-div");
|
||||||
|
var fieldWorkDiv = document.getElementById("faction-fieldwork-div");
|
||||||
|
var securityWorkDiv = document.getElementById("faction-securitywork-div");
|
||||||
|
|
||||||
|
var hackButton = document.getElementById("faction-hack-button");
|
||||||
|
var fieldWorkButton = document.getElementById("faction-fieldwork-button");
|
||||||
|
var securityWorkButton = document.getElementById("faction-securitywork-button");
|
||||||
|
|
||||||
|
//TODO Add event listeners for the buttons
|
||||||
|
|
||||||
if (faction.isMember) {
|
if (faction.isMember) {
|
||||||
|
switch(faction.name) {
|
||||||
|
case "Illuminati":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "hidden";
|
||||||
|
break;
|
||||||
|
case "Daedalus":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "hidden";
|
||||||
|
break;
|
||||||
|
case "The Covenant":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "hidden";
|
||||||
|
break;
|
||||||
|
case "ECorp":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "MegaCorp":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "Bachman & Associates":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "Blade Industries":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "NWO":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "Clarke Incorporated":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "OmniTek Incorporated":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "Four Sigma":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "KuaiGong International":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "BitRunners":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "hidden";
|
||||||
|
securityWorkDiv.style.visibility = "hidden";
|
||||||
|
break;
|
||||||
|
case "The Black Hand":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "hidden";
|
||||||
|
break;
|
||||||
|
case "NiteSec":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "hidden";
|
||||||
|
securityWorkDiv.style.visibility = "hidden";
|
||||||
|
break;
|
||||||
|
case "Chongqing":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "Sector-12":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "New Tokyo":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "Aevum":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "Ishima":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "Volhaven":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "Speakers for the Dead":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "The Dark Army":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "hidden";
|
||||||
|
break;
|
||||||
|
case "The Syndicate":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "visible";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "Tian Di Hui":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "hidden";
|
||||||
|
securityWorkDiv.style.visibility = "visible";
|
||||||
|
break;
|
||||||
|
case "CyberSec":
|
||||||
|
hackDiv.style.visibility = "visible";
|
||||||
|
fieldWorkDiv.style.visibility = "hidden";
|
||||||
|
securityWorkDiv.style.visibility = "hidden";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log("Faction does not exist");
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Not a member of this faction, cannot display faction information");
|
console.log("Not a member of this faction, cannot display faction information");
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
var Engine = {
|
var Engine = {
|
||||||
|
|
||||||
//Clickable objects
|
//Clickable objects
|
||||||
Clickables: {
|
Clickables: {
|
||||||
hackButton: null,
|
|
||||||
|
|
||||||
//Main menu buttons
|
//Main menu buttons
|
||||||
terminalMainMenuButton: null,
|
terminalMainMenuButton: null,
|
||||||
characterMainMenuButton: null,
|
characterMainMenuButton: null,
|
||||||
scriptEditorMainMenuButton: null,
|
scriptEditorMainMenuButton: null,
|
||||||
activeScriptsMainMenuButton: null,
|
activeScriptsMainMenuButton: null,
|
||||||
|
worldMainMenuButton: null,
|
||||||
|
createProgramMainMenuButton: null,
|
||||||
|
factionsMainMenuButton: null,
|
||||||
|
augmentationsMainMenuButton: null,
|
||||||
|
tutorialMainMenuButton: null,
|
||||||
saveMainMenuButton: null,
|
saveMainMenuButton: null,
|
||||||
deleteMainMenuButton: null,
|
deleteMainMenuButton: null,
|
||||||
},
|
},
|
||||||
@ -28,6 +31,11 @@ var Engine = {
|
|||||||
characterContent: null,
|
characterContent: null,
|
||||||
scriptEditorContent: null,
|
scriptEditorContent: null,
|
||||||
activeScriptsContent: null,
|
activeScriptsContent: null,
|
||||||
|
worldContent: null,
|
||||||
|
createProgramContent: null,
|
||||||
|
factionsContent: null,
|
||||||
|
augmentationsContent: null,
|
||||||
|
tutorialContent: null,
|
||||||
|
|
||||||
//Character info
|
//Character info
|
||||||
characterInfo: null,
|
characterInfo: null,
|
||||||
@ -42,6 +50,11 @@ var Engine = {
|
|||||||
CharacterInfo: "CharacterInfo",
|
CharacterInfo: "CharacterInfo",
|
||||||
ScriptEditor: "ScriptEditor",
|
ScriptEditor: "ScriptEditor",
|
||||||
ActiveScripts: "ActiveScripts",
|
ActiveScripts: "ActiveScripts",
|
||||||
|
World: "World",
|
||||||
|
CreateProgram: "CreateProgram",
|
||||||
|
Factions: "Factions",
|
||||||
|
Augmentations: "Augmentations",
|
||||||
|
Tutorial: "Tutorial",
|
||||||
},
|
},
|
||||||
currentPage: null,
|
currentPage: null,
|
||||||
|
|
||||||
@ -158,6 +171,11 @@ var Engine = {
|
|||||||
Engine.Display.characterContent.style.visibility = "hidden";
|
Engine.Display.characterContent.style.visibility = "hidden";
|
||||||
Engine.Display.scriptEditorContent.style.visibility = "hidden";
|
Engine.Display.scriptEditorContent.style.visibility = "hidden";
|
||||||
Engine.Display.activeScriptsContent.style.visibility = "hidden";
|
Engine.Display.activeScriptsContent.style.visibility = "hidden";
|
||||||
|
Engine.Display.worldContent.style.visiblity = "hidden";
|
||||||
|
Engine.Display.createProgramContent.style.visibility = "hidden";
|
||||||
|
Engine.Display.factionsContent.style.visibility = "hidden";
|
||||||
|
Engine.Display.augmentationsContent.style.visibility = "hidden";
|
||||||
|
Engine.Display.tutorialContent.style.visibility = "hidden";
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Display character info */
|
/* Display character info */
|
||||||
@ -428,6 +446,37 @@ var Engine = {
|
|||||||
Engine.loadActiveScriptsContent();
|
Engine.loadActiveScriptsContent();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Engine.Clickables.worldMainMenuButton = document.getElementById("world-menu-link");
|
||||||
|
Engine.Clickables.worldMainMenuButton.addEventListener("click", function() {
|
||||||
|
Engine.loadWorldContent();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
Engine.Clickables.createProgramMainMenuButton = document.getElementById("create-program-menu-link");
|
||||||
|
Engine.Clickables.createProgramMainMenuButton.addEventListener("click", function() {
|
||||||
|
Engine.loadCreateProgramContent();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
Engine.Clickables.factionsMainMenuButton = document.getElementById("factions-menu-link");
|
||||||
|
Engine.Clickables.factionsMainMenuButton.addEventListener("click", function() {
|
||||||
|
Engine.loadFactionContent();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
Engine.Clickables.augmentationsMainMenuButton = document.getElementById("augmentations-menu-link");
|
||||||
|
Engine.Clickables.augmentationsMainMenuButton.addEventListener("click", function() {
|
||||||
|
Engine.loadAugmentationsContent();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
Engine.Clickables.tutorialMainMenuButton = document.getElementById("tutorial-menu-link");
|
||||||
|
Engine.Clickables.tutorialMainMenuButton.addEventListener("click", function() {
|
||||||
|
Engine.loadTutorialContent();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//Active scripts list
|
//Active scripts list
|
||||||
Engine.ActiveScriptsList = document.getElementById("active-scripts-list");
|
Engine.ActiveScriptsList = document.getElementById("active-scripts-list");
|
||||||
|
|
||||||
@ -445,12 +494,30 @@ var Engine = {
|
|||||||
|
|
||||||
Engine.Display.terminalContent = document.getElementById("terminal-container");
|
Engine.Display.terminalContent = document.getElementById("terminal-container");
|
||||||
Engine.currentPage = Engine.Page.Terminal;
|
Engine.currentPage = Engine.Page.Terminal;
|
||||||
|
|
||||||
Engine.Display.characterContent = document.getElementById("character-container");
|
Engine.Display.characterContent = document.getElementById("character-container");
|
||||||
Engine.Display.characterContent.style.visibility = "hidden";
|
Engine.Display.characterContent.style.visibility = "hidden";
|
||||||
|
|
||||||
Engine.Display.scriptEditorContent = document.getElementById("script-editor-container");
|
Engine.Display.scriptEditorContent = document.getElementById("script-editor-container");
|
||||||
Engine.Display.scriptEditorContent.style.visibility = "hidden";
|
Engine.Display.scriptEditorContent.style.visibility = "hidden";
|
||||||
|
|
||||||
Engine.Display.activeScriptsContent = document.getElementById("active-scripts-container");
|
Engine.Display.activeScriptsContent = document.getElementById("active-scripts-container");
|
||||||
Engine.Display.activeScriptsContent.style.visibility = "hidden";
|
Engine.Display.activeScriptsContent.style.visibility = "hidden";
|
||||||
|
|
||||||
|
Engine.Display.worldContent = document.getElementById("world-container");
|
||||||
|
Engine.Display.worldContent.style.visibility = "hidden";
|
||||||
|
|
||||||
|
Engine.Display.createProgramContent = document.getElementById("create-program-container");
|
||||||
|
Engine.Display.createProgramContent.style.visibility = "hidden";
|
||||||
|
|
||||||
|
Engine.Display.factionsContent = document.getElementById("factions-container");
|
||||||
|
Engine.Display.factionsContent.style.visibility = "hidden";
|
||||||
|
|
||||||
|
Engine.Display.augmentationsContent = document.getElementById("augmentations-container");
|
||||||
|
Engine.Display.augmentationsContent.style.visiblity = "hidden";
|
||||||
|
|
||||||
|
Engine.Display.tutorialContent = document.getElementById("tutorial-container");
|
||||||
|
Engine.Display.tutorialContent.style.visiblity = "hidden";
|
||||||
|
|
||||||
//Character info
|
//Character info
|
||||||
Engine.Display.characterInfo = document.getElementById("character-info");
|
Engine.Display.characterInfo = document.getElementById("character-info");
|
||||||
|
Loading…
Reference in New Issue
Block a user