mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-02-18 10:53:43 +01:00
Fixed comment styling for all top-level src files
This commit is contained in:
@ -51,7 +51,7 @@ const updateHeaderHtml = (server) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert it to a string, as that's how it's stored it will come out of the data attributes
|
// Convert it to a string, as that's how it's stored it will come out of the data attributes
|
||||||
const ramPercentage = '' + roundToTwo(server.ramUsed / server.maxRam);
|
const ramPercentage = '' + roundToTwo(server.ramUsed / server.maxRam);
|
||||||
if (accordion.header.dataset.ramPercentage !== ramPercentage) {
|
if (accordion.header.dataset.ramPercentage !== ramPercentage) {
|
||||||
accordion.header.dataset.ramPercentage = ramPercentage;
|
accordion.header.dataset.ramPercentage = ramPercentage;
|
||||||
@ -86,14 +86,16 @@ function createActiveScriptsServerPanel(server) {
|
|||||||
panelList: panelScriptList,
|
panelList: panelScriptList,
|
||||||
scripts: {}, // Holds references to li elements for each active script
|
scripts: {}, // Holds references to li elements for each active script
|
||||||
scriptHdrs: {}, // Holds references to header elements for each active script
|
scriptHdrs: {}, // Holds references to header elements for each active script
|
||||||
scriptStats: {} //Holds references to the p elements containing text for each active script
|
scriptStats: {}, // Holds references to the p elements containing text for each active script
|
||||||
};
|
};
|
||||||
|
|
||||||
return li;
|
return li;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Deletes the info for a particular server (Dropdown header + Panel with all info)
|
/**
|
||||||
//in the Active Scripts page if it exists
|
* Deletes the info for a particular server (Dropdown header + Panel with all info)
|
||||||
|
* in the Active Scripts page if it exists
|
||||||
|
*/
|
||||||
function deleteActiveScriptsServerPanel(server) {
|
function deleteActiveScriptsServerPanel(server) {
|
||||||
let hostname = server.hostname;
|
let hostname = server.hostname;
|
||||||
if (ActiveScriptsUI[hostname] == null) {
|
if (ActiveScriptsUI[hostname] == null) {
|
||||||
@ -103,7 +105,7 @@ function deleteActiveScriptsServerPanel(server) {
|
|||||||
|
|
||||||
// Make sure it's empty
|
// Make sure it's empty
|
||||||
if (Object.keys(ActiveScriptsUI[hostname].scripts).length > 0) {
|
if (Object.keys(ActiveScriptsUI[hostname].scripts).length > 0) {
|
||||||
console.log("WARNING: Tried to delete Active Scripts Server panel that still has scripts. Aborting");
|
console.warn("Tried to delete Active Scripts Server panel that still has scripts. Aborting");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +117,7 @@ function deleteActiveScriptsServerPanel(server) {
|
|||||||
function addActiveScriptsItem(workerscript) {
|
function addActiveScriptsItem(workerscript) {
|
||||||
var server = getServer(workerscript.serverIp);
|
var server = getServer(workerscript.serverIp);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
console.log("ERROR: Invalid server IP for workerscript in addActiveScriptsItem()");
|
console.warn("Invalid server IP for workerscript in addActiveScriptsItem()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let hostname = server.hostname;
|
let hostname = server.hostname;
|
||||||
@ -142,8 +144,10 @@ function addActiveScriptsItem(workerscript) {
|
|||||||
panel.classList.remove("accordion-panel");
|
panel.classList.remove("accordion-panel");
|
||||||
panel.classList.add("active-scripts-script-panel");
|
panel.classList.add("active-scripts-script-panel");
|
||||||
|
|
||||||
//Handle the constant elements on the panel that don't change after creation
|
/**
|
||||||
//Threads, args, kill/log button
|
* Handle the constant elements on the panel that don't change after creation:
|
||||||
|
* Threads, args, kill/log button
|
||||||
|
*/
|
||||||
panel.appendChild(createElement("p", {
|
panel.appendChild(createElement("p", {
|
||||||
innerHTML: "Threads: " + workerscript.scriptRef.threads + "<br>" +
|
innerHTML: "Threads: " + workerscript.scriptRef.threads + "<br>" +
|
||||||
"Args: " + arrayToString(workerscript.args)
|
"Args: " + arrayToString(workerscript.args)
|
||||||
@ -221,11 +225,13 @@ function deleteActiveScriptsItem(workerscript) {
|
|||||||
}.bind(null, workerscript));
|
}.bind(null, workerscript));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the ActiveScriptsItems array
|
|
||||||
function updateActiveScriptsItems(maxTasks=150) {
|
function updateActiveScriptsItems(maxTasks=150) {
|
||||||
//Run tasks that need to be done sequentially (adding items, creating/deleting server panels)
|
/**
|
||||||
//We'll limit this to 150 at a time in case someone decides to start a bunch of scripts all at once...
|
* Run tasks that need to be done sequentially (adding items, creating/deleting server panels)
|
||||||
let numTasks = Math.min(maxTasks, ActiveScriptsTasks.length);
|
* We'll limit this to 150 at a time for performance (in case someone decides to start a
|
||||||
|
* bunch of scripts all at once...)
|
||||||
|
*/
|
||||||
|
const numTasks = Math.min(maxTasks, ActiveScriptsTasks.length);
|
||||||
for (let i = 0; i < numTasks; ++i) {
|
for (let i = 0; i < numTasks; ++i) {
|
||||||
let task = ActiveScriptsTasks.shift();
|
let task = ActiveScriptsTasks.shift();
|
||||||
try {
|
try {
|
||||||
@ -237,7 +243,7 @@ function updateActiveScriptsItems(maxTasks=150) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!routing.isOn(Page.ActiveScripts)) { return; }
|
if (!routing.isOn(Page.ActiveScripts)) { return; }
|
||||||
var total = 0;
|
let total = 0;
|
||||||
for (var i = 0; i < workerScripts.length; ++i) {
|
for (var i = 0; i < workerScripts.length; ++i) {
|
||||||
try {
|
try {
|
||||||
total += updateActiveScriptsItemContent(workerScripts[i]);
|
total += updateActiveScriptsItemContent(workerScripts[i]);
|
||||||
@ -249,10 +255,10 @@ function updateActiveScriptsItems(maxTasks=150) {
|
|||||||
getElementById("active-scripts-total-production-active").innerText = numeralWrapper.formatMoney(total);
|
getElementById("active-scripts-total-production-active").innerText = numeralWrapper.formatMoney(total);
|
||||||
getElementById("active-scripts-total-prod-aug-total").innerText = numeralWrapper.formatMoney(Player.scriptProdSinceLastAug);
|
getElementById("active-scripts-total-prod-aug-total").innerText = numeralWrapper.formatMoney(Player.scriptProdSinceLastAug);
|
||||||
getElementById("active-scripts-total-prod-aug-avg").innerText = numeralWrapper.formatMoney(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug/1000));
|
getElementById("active-scripts-total-prod-aug-avg").innerText = numeralWrapper.formatMoney(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug/1000));
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Updates the content of the given item in the Active Scripts list
|
|
||||||
function updateActiveScriptsItemContent(workerscript) {
|
function updateActiveScriptsItemContent(workerscript) {
|
||||||
var server = getServer(workerscript.serverIp);
|
var server = getServer(workerscript.serverIp);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
|
10
src/Alias.ts
10
src/Alias.ts
@ -20,7 +20,7 @@ export function loadGlobalAliases(saveString: string): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Print all aliases to terminal
|
// Prints all aliases to terminal
|
||||||
export function printAliases(): void {
|
export function printAliases(): void {
|
||||||
for (var name in Aliases) {
|
for (var name in Aliases) {
|
||||||
if (Aliases.hasOwnProperty(name)) {
|
if (Aliases.hasOwnProperty(name)) {
|
||||||
@ -34,7 +34,7 @@ export function printAliases(): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//True if successful, false otherwise
|
// Returns true if successful, false otherwise
|
||||||
export function parseAliasDeclaration(dec: string, global: boolean=false) {
|
export function parseAliasDeclaration(dec: string, global: boolean=false) {
|
||||||
var re = /^([_|\w|!|%|,|@]+)="(.+)"$/;
|
var re = /^([_|\w|!|%|,|@]+)="(.+)"$/;
|
||||||
var matches = dec.match(re);
|
var matches = dec.match(re);
|
||||||
@ -90,8 +90,10 @@ export function removeAlias(name: string): boolean {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns the original string with any aliases substituted in
|
/**
|
||||||
//Aliases only applied to "whole words", one level deep
|
* Returns the original string with any aliases substituted in.
|
||||||
|
* Aliases are only applied to "whole words", one level deep
|
||||||
|
*/
|
||||||
export function substituteAliases(origCommand: string): string {
|
export function substituteAliases(origCommand: string): string {
|
||||||
const commandArray = origCommand.split(" ");
|
const commandArray = origCommand.split(" ");
|
||||||
if (commandArray.length > 0){
|
if (commandArray.length > 0){
|
||||||
|
@ -49,14 +49,18 @@ const MaxStaminaToGainFactor = 70000; //Max Stamina is divided by this to g
|
|||||||
|
|
||||||
const DifficultyToTimeFactor = 10; // Action Difficulty divided by this to get base action time
|
const DifficultyToTimeFactor = 10; // Action Difficulty divided by this to get base action time
|
||||||
|
|
||||||
//The difficulty multiplier affects stamina loss and hp loss of an action. Also affects
|
/**
|
||||||
//experience gain. Its formula is:
|
* The difficulty multiplier affects stamina loss and hp loss of an action. Also affects
|
||||||
//difficulty ^ exponentialFactor + difficulty / linearFactor
|
* experience gain. Its formula is:
|
||||||
|
* difficulty ^ exponentialFactor + difficulty / linearFactor
|
||||||
|
*/
|
||||||
const DiffMultExponentialFactor = 0.28;
|
const DiffMultExponentialFactor = 0.28;
|
||||||
const DiffMultLinearFactor = 650;
|
const DiffMultLinearFactor = 650;
|
||||||
|
|
||||||
// These factors are used to calculate action time.
|
/**
|
||||||
// They affect how much action time is reduced based on your agility and dexterity
|
* These factors are used to calculate action time.
|
||||||
|
* They affect how much action time is reduced based on your agility and dexterity
|
||||||
|
*/
|
||||||
const EffAgiLinearFactor = 10e3;
|
const EffAgiLinearFactor = 10e3;
|
||||||
const EffDexLinearFactor = 10e3;
|
const EffDexLinearFactor = 10e3;
|
||||||
const EffAgiExponentialFactor = 0.04;
|
const EffAgiExponentialFactor = 0.04;
|
||||||
@ -87,11 +91,12 @@ const HrcHpGain = 2; // HP Gained from Hyperbolic Regeneration chambe
|
|||||||
const HrcStaminaGain = 1; // Percentage Stamina gained from Hyperbolic Regeneration Chamber
|
const HrcStaminaGain = 1; // Percentage Stamina gained from Hyperbolic Regeneration Chamber
|
||||||
|
|
||||||
// DOM related variables
|
// DOM related variables
|
||||||
var ActiveActionCssClass = "bladeburner-active-action";
|
const ActiveActionCssClass = "bladeburner-active-action";
|
||||||
|
|
||||||
|
|
||||||
// Console related stuff
|
// Console related stuff
|
||||||
var consoleHistoryIndex = 0;
|
let consoleHistoryIndex = 0;
|
||||||
var consoleHelpText = {
|
const consoleHelpText = {
|
||||||
helpList:"Use 'help [command]' to get more information about a particular Bladeburner console command.<br><br>" +
|
helpList:"Use 'help [command]' to get more information about a particular Bladeburner console command.<br><br>" +
|
||||||
"automate [var] [val] [hi/low] Configure simple automation for Bladeburner tasks<br>" +
|
"automate [var] [val] [hi/low] Configure simple automation for Bladeburner tasks<br>" +
|
||||||
"clear/cls Clear the console<br>" +
|
"clear/cls Clear the console<br>" +
|
||||||
@ -163,10 +168,6 @@ var consoleHelpText = {
|
|||||||
// Keypresses for Console
|
// Keypresses for Console
|
||||||
$(document).keydown(function(event) {
|
$(document).keydown(function(event) {
|
||||||
if (routing.isOn(Page.Bladeburner)) {
|
if (routing.isOn(Page.Bladeburner)) {
|
||||||
//if (DomElems.consoleInput && !event.ctrlKey && !event.shiftKey && !event.altKey) {
|
|
||||||
// DomElems.consoleInput.focus();
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (!(Player.bladeburner instanceof Bladeburner)) { return; }
|
if (!(Player.bladeburner instanceof Bladeburner)) { return; }
|
||||||
let consoleHistory = Player.bladeburner.consoleHistory;
|
let consoleHistory = Player.bladeburner.consoleHistory;
|
||||||
|
|
||||||
@ -272,9 +273,11 @@ City.prototype.improveCommunityEstimate = function(n=1) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//@params options:
|
/**
|
||||||
// estChange(int): How much the estimate should change by
|
* @params options:
|
||||||
// estOffset(int): Add offset to estimate (offset by percentage)
|
* estChange(int): How much the estimate should change by
|
||||||
|
* estOffset(int): Add offset to estimate (offset by percentage)
|
||||||
|
*/
|
||||||
City.prototype.changePopulationByCount = function(n, params={}) {
|
City.prototype.changePopulationByCount = function(n, params={}) {
|
||||||
if (isNaN(n)) {throw new Error("NaN passed into City.changePopulationByCount()");}
|
if (isNaN(n)) {throw new Error("NaN passed into City.changePopulationByCount()");}
|
||||||
this.pop += n;
|
this.pop += n;
|
||||||
@ -285,10 +288,12 @@ City.prototype.changePopulationByCount = function(n, params={}) {
|
|||||||
this.popEst = Math.max(this.popEst, 0);
|
this.popEst = Math.max(this.popEst, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@p is the percentage, not the multiplier. e.g. pass in p = 5 for 5%
|
/**
|
||||||
//@params options:
|
* @p is the percentage, not the multiplier. e.g. pass in p = 5 for 5%
|
||||||
// changeEstEqually(bool) - Change the population estimate by an equal amount
|
* @params options:
|
||||||
// nonZero (bool) - Set to true to ensure that population always changes by at least 1
|
* changeEstEqually(bool) - Change the population estimate by an equal amount
|
||||||
|
* nonZero (bool) - Set to true to ensure that population always changes by at least 1
|
||||||
|
*/
|
||||||
City.prototype.changePopulationByPercentage = function(p, params={}) {
|
City.prototype.changePopulationByPercentage = function(p, params={}) {
|
||||||
if (isNaN(p)) {throw new Error("NaN passed into City.changePopulationByPercentage()");}
|
if (isNaN(p)) {throw new Error("NaN passed into City.changePopulationByPercentage()");}
|
||||||
if (p === 0) {return;}
|
if (p === 0) {return;}
|
||||||
@ -347,16 +352,20 @@ function Skill(params={name:"foo", desc:"foo"}) {
|
|||||||
|
|
||||||
if (params.maxLvl) {this.maxLvl = params.maxLvl;}
|
if (params.maxLvl) {this.maxLvl = params.maxLvl;}
|
||||||
|
|
||||||
//These benefits are additive. So total multiplier will be level (handled externally) times the
|
/**
|
||||||
//effects below
|
* These benefits are additive. So total multiplier will be level (handled externally) times the
|
||||||
|
* effects below
|
||||||
|
*/
|
||||||
if (params.successChanceAll) {this.successChanceAll = params.successChanceAll;}
|
if (params.successChanceAll) {this.successChanceAll = params.successChanceAll;}
|
||||||
if (params.successChanceStealth) {this.successChanceStealth = params.successChanceStealth;}
|
if (params.successChanceStealth) {this.successChanceStealth = params.successChanceStealth;}
|
||||||
if (params.successChanceKill) {this.successChanceKill = params.successChanceKill;}
|
if (params.successChanceKill) {this.successChanceKill = params.successChanceKill;}
|
||||||
if (params.successChanceContract) {this.successChanceContract = params.successChanceContract;}
|
if (params.successChanceContract) {this.successChanceContract = params.successChanceContract;}
|
||||||
if (params.successChanceOperation) {this.successChanceOperation = params.successChanceOperation;}
|
if (params.successChanceOperation) {this.successChanceOperation = params.successChanceOperation;}
|
||||||
|
|
||||||
//This multiplier affects everything that increases synthoid population/community estimate
|
/**
|
||||||
//e.g. Field analysis, Investigation Op, Undercover Op
|
* This multiplier affects everything that increases synthoid population/community estimate
|
||||||
|
* e.g. Field analysis, Investigation Op, Undercover Op
|
||||||
|
*/
|
||||||
if (params.successChanceEstimate) {this.successChanceEstimate = params.successChanceEstimate;}
|
if (params.successChanceEstimate) {this.successChanceEstimate = params.successChanceEstimate;}
|
||||||
|
|
||||||
if (params.actionTime) {this.actionTime = params.actionTime;}
|
if (params.actionTime) {this.actionTime = params.actionTime;}
|
||||||
@ -379,8 +388,8 @@ function Skill(params={name:"foo", desc:"foo"}) {
|
|||||||
Skill.prototype.calculateCost = function(currentLevel) {
|
Skill.prototype.calculateCost = function(currentLevel) {
|
||||||
return Math.floor((this.baseCost + (currentLevel * this.costInc)) * BitNodeMultipliers.BladeburnerSkillCost);
|
return Math.floor((this.baseCost + (currentLevel * this.costInc)) * BitNodeMultipliers.BladeburnerSkillCost);
|
||||||
}
|
}
|
||||||
var Skills = {};
|
const Skills = {};
|
||||||
var SkillNames = {
|
const SkillNames = {
|
||||||
BladesIntuition: "Blade's Intuition",
|
BladesIntuition: "Blade's Intuition",
|
||||||
Cloak: "Cloak",
|
Cloak: "Cloak",
|
||||||
Marksman: "Marksman",
|
Marksman: "Marksman",
|
||||||
@ -402,10 +411,7 @@ function Action(params={}) {
|
|||||||
this.name = params.name ? params.name : "";
|
this.name = params.name ? params.name : "";
|
||||||
this.desc = params.desc ? params.desc : "";
|
this.desc = params.desc ? params.desc : "";
|
||||||
|
|
||||||
//Difficulty scales with level
|
// Difficulty scales with level. See getDifficulty() method
|
||||||
//Exact formula is not set in stone
|
|
||||||
//Initial design: baseDifficulty * (difficultyFac ^ level)?
|
|
||||||
//difficulty Fac is slightly greater than 1
|
|
||||||
this.level = 1;
|
this.level = 1;
|
||||||
this.maxLevel = 1;
|
this.maxLevel = 1;
|
||||||
this.autoLevel = true;
|
this.autoLevel = true;
|
||||||
@ -430,8 +436,10 @@ function Action(params={}) {
|
|||||||
this.isStealth = params.isStealth ? true : false;
|
this.isStealth = params.isStealth ? true : false;
|
||||||
this.isKill = params.isKill ? true : false;
|
this.isKill = params.isKill ? true : false;
|
||||||
|
|
||||||
//Number of this contract remaining, and its growth rate
|
/**
|
||||||
//Growth rate is an integer and the count will increase by that integer every "cycle"
|
* Number of this contract remaining, and its growth rate
|
||||||
|
* Growth rate is an integer and the count will increase by that integer every "cycle"
|
||||||
|
*/
|
||||||
this.count = params.count ? params.count : getRandomInt(1e3, 25e3);
|
this.count = params.count ? params.count : getRandomInt(1e3, 25e3);
|
||||||
this.countGrowth = params.countGrowth ? params.countGrowth : getRandomInt(1, 5);
|
this.countGrowth = params.countGrowth ? params.countGrowth : getRandomInt(1, 5);
|
||||||
|
|
||||||
@ -440,8 +448,8 @@ function Action(params={}) {
|
|||||||
this.weights = params.weights ? params.weights : defaultWeights;
|
this.weights = params.weights ? params.weights : defaultWeights;
|
||||||
|
|
||||||
// Check to make sure weights are summed properly
|
// Check to make sure weights are summed properly
|
||||||
var sum = 0;
|
let sum = 0;
|
||||||
for (var weight in this.weights) {
|
for (const weight in this.weights) {
|
||||||
if (this.weights.hasOwnProperty(weight)) {
|
if (this.weights.hasOwnProperty(weight)) {
|
||||||
sum += this.weights[weight];
|
sum += this.weights[weight];
|
||||||
}
|
}
|
||||||
@ -452,9 +460,9 @@ function Action(params={}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Diminishing returns of stats (stat ^ decay where 0 <= decay <= 1)
|
// Diminishing returns of stats (stat ^ decay where 0 <= decay <= 1)
|
||||||
var defaultDecays = {hack:0.9,str:0.9,def:0.9,dex:0.9,agi:0.9,cha:0.9,int:0.9};
|
const defaultDecays = { hack: 0.9, str: 0.9, def: 0.9, dex: 0.9, agi: 0.9, cha: 0.9, int: 0.9 };
|
||||||
this.decays = params.decays ? params.decays : defaultDecays;
|
this.decays = params.decays ? params.decays : defaultDecays;
|
||||||
for (var decay in this.decays) {
|
for (const decay in this.decays) {
|
||||||
if (this.decays.hasOwnProperty(decay)) {
|
if (this.decays.hasOwnProperty(decay)) {
|
||||||
if (this.decays[decay] > 1) {
|
if (this.decays[decay] > 1) {
|
||||||
throw new Error("Invalid decays when constructing " +
|
throw new Error("Invalid decays when constructing " +
|
||||||
@ -471,9 +479,11 @@ Action.prototype.getDifficulty = function() {
|
|||||||
return difficulty;
|
return difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@inst - Bladeburner Object
|
/**
|
||||||
//@params - options:
|
* @inst - Bladeburner Object
|
||||||
// est (bool): Get success chance estimate instead of real success chance
|
* @params - options:
|
||||||
|
* est (bool): Get success chance estimate instead of real success chance
|
||||||
|
*/
|
||||||
Action.prototype.getSuccessChance = function(inst, params={}) {
|
Action.prototype.getSuccessChance = function(inst, params={}) {
|
||||||
if (inst == null) {throw new Error("Invalid Bladeburner instance passed into Action.getSuccessChance");}
|
if (inst == null) {throw new Error("Invalid Bladeburner instance passed into Action.getSuccessChance");}
|
||||||
var difficulty = this.getDifficulty();
|
var difficulty = this.getDifficulty();
|
||||||
@ -545,8 +555,10 @@ Action.prototype.getSuccessChance = function(inst, params={}) {
|
|||||||
return Math.min(1, competence / difficulty);
|
return Math.min(1, competence / difficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Tests for success. Should be called when an action has completed
|
/**
|
||||||
// @inst - Bladeburner Object
|
* Tests for success. Should be called when an action has completed
|
||||||
|
* @param inst {Bladeburner} - Bladeburner instance
|
||||||
|
*/
|
||||||
Action.prototype.attempt = function(inst) {
|
Action.prototype.attempt = function(inst) {
|
||||||
return (Math.random() < this.getSuccessChance(inst));
|
return (Math.random() < this.getSuccessChance(inst));
|
||||||
}
|
}
|
||||||
@ -593,9 +605,9 @@ Action.fromJSON = function(value) {
|
|||||||
return Generic_fromJSON(Action, value.data);
|
return Generic_fromJSON(Action, value.data);
|
||||||
}
|
}
|
||||||
Reviver.constructors.Action = Action;
|
Reviver.constructors.Action = Action;
|
||||||
var GeneralActions = {}; //Training, Field Analysis, Recruitment, etc.
|
const GeneralActions = {}; // Training, Field Analysis, Recruitment, etc.
|
||||||
|
|
||||||
//Action Identifier
|
// Action Identifier enum
|
||||||
const ActionTypes = Object.freeze({
|
const ActionTypes = Object.freeze({
|
||||||
"Idle": 1,
|
"Idle": 1,
|
||||||
"Contract": 2,
|
"Contract": 2,
|
||||||
@ -609,29 +621,37 @@ const ActionTypes = Object.freeze({
|
|||||||
"Diplomacy": 8,
|
"Diplomacy": 8,
|
||||||
"Hyperbolic Regeneration Chamber": 9,
|
"Hyperbolic Regeneration Chamber": 9,
|
||||||
});
|
});
|
||||||
|
|
||||||
function ActionIdentifier(params={}) {
|
function ActionIdentifier(params={}) {
|
||||||
if (params.name) {this.name = params.name;}
|
if (params.name) {this.name = params.name;}
|
||||||
if (params.type) {this.type = params.type;}
|
if (params.type) {this.type = params.type;}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionIdentifier.prototype.toJSON = function() {
|
ActionIdentifier.prototype.toJSON = function() {
|
||||||
return Generic_toJSON("ActionIdentifier", this);
|
return Generic_toJSON("ActionIdentifier", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionIdentifier.fromJSON = function(value) {
|
ActionIdentifier.fromJSON = function(value) {
|
||||||
return Generic_fromJSON(ActionIdentifier, value.data);
|
return Generic_fromJSON(ActionIdentifier, value.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
Reviver.constructors.ActionIdentifier = ActionIdentifier;
|
Reviver.constructors.ActionIdentifier = ActionIdentifier;
|
||||||
|
|
||||||
// Contracts
|
// Contracts
|
||||||
function Contract(params={}) {
|
function Contract(params={}) {
|
||||||
Action.call(this, params);
|
Action.call(this, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
Contract.prototype = Object.create(Action.prototype);
|
Contract.prototype = Object.create(Action.prototype);
|
||||||
|
|
||||||
Contract.prototype.toJSON = function() {
|
Contract.prototype.toJSON = function() {
|
||||||
return Generic_toJSON("Contract", this);
|
return Generic_toJSON("Contract", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Contract.fromJSON = function(value) {
|
Contract.fromJSON = function(value) {
|
||||||
return Generic_fromJSON(Contract, value.data);
|
return Generic_fromJSON(Contract, value.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
Reviver.constructors.Contract = Contract;
|
Reviver.constructors.Contract = Contract;
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
@ -640,13 +660,17 @@ function Operation(params={}) {
|
|||||||
this.reqdRank = params.reqdRank ? params.reqdRank : 100;
|
this.reqdRank = params.reqdRank ? params.reqdRank : 100;
|
||||||
this.teamCount = params.teamCount ? params.teamCount : 0; //# of team members to use
|
this.teamCount = params.teamCount ? params.teamCount : 0; //# of team members to use
|
||||||
}
|
}
|
||||||
|
|
||||||
Operation.prototype = Object.create(Action.prototype);
|
Operation.prototype = Object.create(Action.prototype);
|
||||||
|
|
||||||
Operation.prototype.toJSON = function() {
|
Operation.prototype.toJSON = function() {
|
||||||
return Generic_toJSON("Operation", this);
|
return Generic_toJSON("Operation", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Operation.fromJSON = function(value) {
|
Operation.fromJSON = function(value) {
|
||||||
return Generic_fromJSON(Operation, value.data);
|
return Generic_fromJSON(Operation, value.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
Reviver.constructors.Operation = Operation;
|
Reviver.constructors.Operation = Operation;
|
||||||
|
|
||||||
// Black Operations
|
// Black Operations
|
||||||
@ -657,15 +681,20 @@ function BlackOperation(params={}) {
|
|||||||
this.count = 1;
|
this.count = 1;
|
||||||
this.countGrowth = 0;
|
this.countGrowth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackOperation.prototype = Object.create(Action.prototype);
|
BlackOperation.prototype = Object.create(Action.prototype);
|
||||||
|
|
||||||
BlackOperation.prototype.toJSON = function() {
|
BlackOperation.prototype.toJSON = function() {
|
||||||
return Generic_toJSON("BlackOperation", this);
|
return Generic_toJSON("BlackOperation", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackOperation.fromJSON = function(value) {
|
BlackOperation.fromJSON = function(value) {
|
||||||
return Generic_fromJSON(BlackOperation, value.data);
|
return Generic_fromJSON(BlackOperation, value.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
Reviver.constructors.BlackOperation = BlackOperation;
|
Reviver.constructors.BlackOperation = BlackOperation;
|
||||||
var BlackOperations = {};
|
|
||||||
|
const BlackOperations = {};
|
||||||
|
|
||||||
function Bladeburner(params={}) {
|
function Bladeburner(params={}) {
|
||||||
this.numHosp = 0; // Number of hospitalizations
|
this.numHosp = 0; // Number of hospitalizations
|
||||||
@ -708,9 +737,11 @@ function Bladeburner(params={}) {
|
|||||||
this.calculateMaxStamina();
|
this.calculateMaxStamina();
|
||||||
this.stamina = this.maxStamina;
|
this.stamina = this.maxStamina;
|
||||||
|
|
||||||
//Contracts and Operations objects. These objects have unique
|
/**
|
||||||
//properties because they are randomized in each instance and have stats like
|
* Contracts and Operations objects. These objects have unique
|
||||||
//successes/failures, so they need to be saved/loaded by the game.
|
* properties because they are randomized in each instance and have stats like
|
||||||
|
* successes/failures, so they need to be saved/loaded by the game.
|
||||||
|
*/
|
||||||
this.contracts = {};
|
this.contracts = {};
|
||||||
this.operations = {};
|
this.operations = {};
|
||||||
|
|
||||||
@ -871,7 +902,7 @@ Bladeburner.prototype.storeCycles = function(numCycles=1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bladeburner.prototype.process = function() {
|
Bladeburner.prototype.process = function() {
|
||||||
//Extreme condition...if Operation Daedalus is complete trigger the BitNode
|
// Edge case condition...if Operation Daedalus is complete trigger the BitNode
|
||||||
if (redPillFlag === false && this.blackops.hasOwnProperty("Operation Daedalus")) {
|
if (redPillFlag === false && this.blackops.hasOwnProperty("Operation Daedalus")) {
|
||||||
return hackWorldDaemon(Player.bitNodeN);
|
return hackWorldDaemon(Player.bitNodeN);
|
||||||
}
|
}
|
||||||
@ -1081,8 +1112,10 @@ Bladeburner.prototype.upgradeSkill = function(skill) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bladeburner.prototype.getActionObject = function(actionId) {
|
Bladeburner.prototype.getActionObject = function(actionId) {
|
||||||
//Given an ActionIdentifier object, returns the corresponding
|
/**
|
||||||
//GeneralAction, Contract, Operation, or BlackOperation object
|
* Given an ActionIdentifier object, returns the corresponding
|
||||||
|
* GeneralAction, Contract, Operation, or BlackOperation object
|
||||||
|
*/
|
||||||
switch (actionId.type) {
|
switch (actionId.type) {
|
||||||
case ActionTypes["Contract"]:
|
case ActionTypes["Contract"]:
|
||||||
return this.contracts[actionId.name];
|
return this.contracts[actionId.name];
|
||||||
@ -1564,14 +1597,18 @@ Bladeburner.prototype.getDiplomacyEffectiveness = function() {
|
|||||||
return (100 - charismaEff) / 100;
|
return (100 - charismaEff) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Process stat gains from Contracts, Operations, and Black Operations
|
/**
|
||||||
//@action(Action obj) - Derived action class
|
* Process stat gains from Contracts, Operations, and Black Operations
|
||||||
//@success(bool) - Whether action was successful
|
* @param action(Action obj) - Derived action class
|
||||||
|
* @param success(bool) - Whether action was successful
|
||||||
|
*/
|
||||||
Bladeburner.prototype.gainActionStats = function(action, success) {
|
Bladeburner.prototype.gainActionStats = function(action, success) {
|
||||||
var difficulty = action.getDifficulty();
|
var difficulty = action.getDifficulty();
|
||||||
|
|
||||||
//Gain multiplier based on difficulty. If this changes then the
|
/**
|
||||||
//same variable calculated in completeAction() needs to change too
|
* Gain multiplier based on difficulty. If this changes then the
|
||||||
|
* same variable calculated in completeAction() needs to change too
|
||||||
|
*/
|
||||||
var difficultyMult = Math.pow(difficulty, DiffMultExponentialFactor) + difficulty / DiffMultLinearFactor;
|
var difficultyMult = Math.pow(difficulty, DiffMultExponentialFactor) + difficulty / DiffMultLinearFactor;
|
||||||
|
|
||||||
var time = this.actionTimeToComplete;
|
var time = this.actionTimeToComplete;
|
||||||
@ -1706,7 +1743,7 @@ Bladeburner.prototype.triggerMigration = function(sourceCityName) {
|
|||||||
destCity.pop += count;
|
destCity.pop += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
var DomElems = {};
|
let DomElems = {};
|
||||||
|
|
||||||
Bladeburner.prototype.initializeDomElementRefs = function() {
|
Bladeburner.prototype.initializeDomElementRefs = function() {
|
||||||
DomElems = {
|
DomElems = {
|
||||||
@ -1971,8 +2008,10 @@ Bladeburner.prototype.createOverviewContent = function() {
|
|||||||
for (var i = 0; i < CityNames.length; ++i) {
|
for (var i = 0; i < CityNames.length; ++i) {
|
||||||
(function(inst, i) {
|
(function(inst, i) {
|
||||||
popupArguments.push(createElement("div", {
|
popupArguments.push(createElement("div", {
|
||||||
//Reusing this css class...it adds a border and makes it
|
/**
|
||||||
//so that background color changes when you hover
|
* Reusing this css class...it adds a border and makes it
|
||||||
|
* so that background color changes when you hover
|
||||||
|
*/
|
||||||
class:"cmpy-mgmt-find-employee-option",
|
class:"cmpy-mgmt-find-employee-option",
|
||||||
innerText:CityNames[i],
|
innerText:CityNames[i],
|
||||||
clickListener:()=>{
|
clickListener:()=>{
|
||||||
@ -2260,10 +2299,10 @@ Bladeburner.prototype.createSkillsContent = function() {
|
|||||||
DomElems.actionsAndSkillsDesc.innerHTML += "Exp Gain: x" + mult + "<br>";
|
DomElems.actionsAndSkillsDesc.innerHTML += "Exp Gain: x" + mult + "<br>";
|
||||||
break;
|
break;
|
||||||
case "weaponAbility":
|
case "weaponAbility":
|
||||||
//DomElems.actionsAndSkillsDesc.innerHTML +=
|
// TODO in the future if items are ever implemented
|
||||||
break;
|
break;
|
||||||
case "gunAbility":
|
case "gunAbility":
|
||||||
//DomElems.actionsAndSkillsDesc.innerHTML
|
// TODO in the future if items are ever implemented
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("Warning: Unrecognized SkillMult Key: " + multKeys[i]);
|
console.log("Warning: Unrecognized SkillMult Key: " + multKeys[i]);
|
||||||
@ -2902,7 +2941,7 @@ Bladeburner.prototype.executeConsoleCommands = function(commands) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//A single command
|
// Execute a single console command
|
||||||
Bladeburner.prototype.executeConsoleCommand = function(command) {
|
Bladeburner.prototype.executeConsoleCommand = function(command) {
|
||||||
command = command.trim();
|
command = command.trim();
|
||||||
command = command.replace(/\s\s+/g, ' '); // Replace all whitespace w/ a single space
|
command = command.replace(/\s\s+/g, ' '); // Replace all whitespace w/ a single space
|
||||||
@ -2940,9 +2979,11 @@ Bladeburner.prototype.executeConsoleCommand = function(command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bladeburner.prototype.parseCommandArguments = function(command) {
|
Bladeburner.prototype.parseCommandArguments = function(command) {
|
||||||
//Returns an array with command and its arguments in each index.
|
/**
|
||||||
//e.g. skill "blade's intuition" foo returns [skill, blade's intuition, foo]
|
* Returns an array with command and its arguments in each index.
|
||||||
//The input to this fn will be trimmed and will have all whitespace replaced w/ a single space
|
* e.g. skill "blade's intuition" foo returns [skill, blade's intuition, foo]
|
||||||
|
* The input to this fn will be trimmed and will have all whitespace replaced w/ a single space
|
||||||
|
*/
|
||||||
const args = [];
|
const args = [];
|
||||||
let start = 0, i = 0;
|
let start = 0, i = 0;
|
||||||
while (i < command.length) {
|
while (i < command.length) {
|
||||||
@ -3234,10 +3275,10 @@ Bladeburner.prototype.executeSkillConsoleCommand = function(args) {
|
|||||||
this.postToConsole("Stamina: x" + mult);
|
this.postToConsole("Stamina: x" + mult);
|
||||||
break;
|
break;
|
||||||
case "weaponAbility":
|
case "weaponAbility":
|
||||||
//DomElems.actionsAndSkillsDesc.innerHTML +=
|
// TODO if items are ever implemented
|
||||||
break;
|
break;
|
||||||
case "gunAbility":
|
case "gunAbility":
|
||||||
//DomElems.actionsAndSkillsDesc.innerHTML
|
// TODO if items are ever implemented
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("Warning: Unrecognized SkillMult Key: " + multKeys[i]);
|
console.log("Warning: Unrecognized SkillMult Key: " + multKeys[i]);
|
||||||
@ -3851,10 +3892,12 @@ Bladeburner.fromJSON = function(value) {
|
|||||||
}
|
}
|
||||||
Reviver.constructors.Bladeburner = Bladeburner;
|
Reviver.constructors.Bladeburner = Bladeburner;
|
||||||
|
|
||||||
//This initialized Bladeburner-related data that is NOT saved/loaded
|
/**
|
||||||
// eg: Skill Objects, BLack Operations
|
* This initialized Bladeburner-related data that is NOT saved/loaded
|
||||||
//Any data that is saved/loaded should go in Bladeburner object
|
* eg: Skill Objects, BLack Operations
|
||||||
// eg: contracts, operations
|
* Any data that is saved/loaded should go in Bladeburner object
|
||||||
|
* eg: contracts, operations
|
||||||
|
*/
|
||||||
function initBladeburner() {
|
function initBladeburner() {
|
||||||
// Skills
|
// Skills
|
||||||
Skills[SkillNames.BladesIntuition] = new Skill({
|
Skills[SkillNames.BladesIntuition] = new Skill({
|
||||||
@ -3872,8 +3915,8 @@ function initBladeburner() {
|
|||||||
successChanceStealth:5.5
|
successChanceStealth:5.5
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO Marksman
|
// TODO Marksman - If items are ever implemented
|
||||||
//TODO Weapon Proficiency
|
// TODO Weapon Proficiency - If items are ever implemented
|
||||||
|
|
||||||
Skills[SkillNames.ShortCircuit] = new Skill({
|
Skills[SkillNames.ShortCircuit] = new Skill({
|
||||||
name:SkillNames.ShortCircuit,
|
name:SkillNames.ShortCircuit,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import { Engine } from "./engine";
|
import { Engine } from "./engine";
|
||||||
import { setTimeoutRef } from "./utils/SetTimeoutRef";
|
import { setTimeoutRef } from "./utils/SetTimeoutRef";
|
||||||
|
|
||||||
@ -8,7 +9,12 @@ import { isString } from "../utils/helpers/isString";
|
|||||||
|
|
||||||
export let cinematicTextFlag = false;
|
export let cinematicTextFlag = false;
|
||||||
|
|
||||||
// Lines must be an array of strings
|
/**
|
||||||
|
* Print a message using a hacking-style "typing" effect.
|
||||||
|
* Note that this clears the UI so that the text from this is the only thing visible.
|
||||||
|
*
|
||||||
|
* @param lines {string[]} Array of strings to print, where each element is a separate line
|
||||||
|
*/
|
||||||
export function writeCinematicText(lines) {
|
export function writeCinematicText(lines) {
|
||||||
cinematicTextFlag = true;
|
cinematicTextFlag = true;
|
||||||
|
|
||||||
|
@ -130,14 +130,15 @@ function getRandomReward() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
switch (reward.type) {
|
switch (reward.type) {
|
||||||
case CodingContractRewardType.FactionReputation:
|
case CodingContractRewardType.FactionReputation: {
|
||||||
// Get a random faction that player is a part of. That
|
// Get a random faction that player is a part of. That
|
||||||
// faction must allow hacking contracts
|
// faction must allow hacking contracts
|
||||||
var numFactions = factionsThatAllowHacking.length;
|
var numFactions = factionsThatAllowHacking.length;
|
||||||
var randFaction = factionsThatAllowHacking[getRandomInt(0, numFactions - 1)];
|
var randFaction = factionsThatAllowHacking[getRandomInt(0, numFactions - 1)];
|
||||||
reward.name = randFaction;
|
reward.name = randFaction;
|
||||||
break;
|
break;
|
||||||
case CodingContractRewardType.CompanyReputation:
|
}
|
||||||
|
case CodingContractRewardType.CompanyReputation: {
|
||||||
const allJobs = Object.keys(Player.jobs);
|
const allJobs = Object.keys(Player.jobs);
|
||||||
if (allJobs.length > 0) {
|
if (allJobs.length > 0) {
|
||||||
reward.name = allJobs[getRandomInt(0, allJobs.length - 1)];
|
reward.name = allJobs[getRandomInt(0, allJobs.length - 1)];
|
||||||
@ -145,6 +146,7 @@ function getRandomReward() {
|
|||||||
reward.type = CodingContractRewardType.Money;
|
reward.type = CodingContractRewardType.Money;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,10 @@ import { IMap } from "./types";
|
|||||||
export let CONSTANTS: IMap<any> = {
|
export let CONSTANTS: IMap<any> = {
|
||||||
Version: "0.46.1",
|
Version: "0.46.1",
|
||||||
|
|
||||||
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
/** Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
||||||
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
* and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
||||||
//the player will have this level assuming no multipliers. Multipliers can cause skills to go above this.
|
* the player will have this level assuming no multipliers. Multipliers can cause skills to go above this.
|
||||||
|
*/
|
||||||
MaxSkillLevel: 975,
|
MaxSkillLevel: 975,
|
||||||
|
|
||||||
// Milliseconds per game cycle
|
// Milliseconds per game cycle
|
||||||
@ -19,13 +20,14 @@ export let CONSTANTS: IMap<any> = {
|
|||||||
// How much reputation is needed to join a megacorporation's faction
|
// How much reputation is needed to join a megacorporation's faction
|
||||||
CorpFactionRepRequirement: 200e3,
|
CorpFactionRepRequirement: 200e3,
|
||||||
|
|
||||||
/* Base costs */
|
// Base RAM costs
|
||||||
BaseCostFor1GBOfRamHome: 32000,
|
BaseCostFor1GBOfRamHome: 32000,
|
||||||
BaseCostFor1GBOfRamServer: 55000, //1 GB of RAM
|
BaseCostFor1GBOfRamServer: 55000, //1 GB of RAM
|
||||||
|
|
||||||
|
// Cost to travel to another city
|
||||||
TravelCost: 200e3,
|
TravelCost: 200e3,
|
||||||
|
|
||||||
/* Faction and Company favor */
|
// Faction and Company favor-related things
|
||||||
BaseFavorToDonate: 150,
|
BaseFavorToDonate: 150,
|
||||||
DonateMoneyToRepDivisor: 1e6,
|
DonateMoneyToRepDivisor: 1e6,
|
||||||
FactionReputationToFavorBase: 500,
|
FactionReputationToFavorBase: 500,
|
||||||
@ -33,12 +35,10 @@ export let CONSTANTS: IMap<any> = {
|
|||||||
CompanyReputationToFavorBase: 500,
|
CompanyReputationToFavorBase: 500,
|
||||||
CompanyReputationToFavorMult: 1.02,
|
CompanyReputationToFavorMult: 1.02,
|
||||||
|
|
||||||
/* Augmentation */
|
// NeuroFlux Governor Augmentation cost multiplier
|
||||||
//NeuroFlux Governor cost multiplier as you level up
|
|
||||||
NeuroFluxGovernorLevelMult: 1.14,
|
NeuroFluxGovernorLevelMult: 1.14,
|
||||||
|
|
||||||
/* Netscript Constants */
|
// RAM Costs for Netscript functions
|
||||||
//RAM Costs for different commands
|
|
||||||
ScriptBaseRamCost: 1.6,
|
ScriptBaseRamCost: 1.6,
|
||||||
ScriptDomRamCost: 25,
|
ScriptDomRamCost: 25,
|
||||||
ScriptWhileRamCost: 0,
|
ScriptWhileRamCost: 0,
|
||||||
@ -55,15 +55,15 @@ export let CONSTANTS: IMap<any> = {
|
|||||||
ScriptExecRamCost: 1.3,
|
ScriptExecRamCost: 1.3,
|
||||||
ScriptSpawnRamCost: 2.0,
|
ScriptSpawnRamCost: 2.0,
|
||||||
ScriptScpRamCost: 0.6,
|
ScriptScpRamCost: 0.6,
|
||||||
ScriptKillRamCost: 0.5, //Kill and killall
|
ScriptKillRamCost: 0.5,
|
||||||
ScriptHasRootAccessRamCost: 0.05,
|
ScriptHasRootAccessRamCost: 0.05,
|
||||||
ScriptGetHostnameRamCost: 0.05, //getHostname() and getIp()
|
ScriptGetHostnameRamCost: 0.05,
|
||||||
ScriptGetHackingLevelRamCost: 0.05, //getHackingLevel()
|
ScriptGetHackingLevelRamCost: 0.05,
|
||||||
ScriptGetMultipliersRamCost: 4.0, //getHackingMultipliers() and getBitNodeMultipliers()
|
ScriptGetMultipliersRamCost: 4.0,
|
||||||
ScriptGetServerRamCost: 0.1,
|
ScriptGetServerRamCost: 0.1,
|
||||||
ScriptFileExistsRamCost: 0.1,
|
ScriptFileExistsRamCost: 0.1,
|
||||||
ScriptIsRunningRamCost: 0.1,
|
ScriptIsRunningRamCost: 0.1,
|
||||||
ScriptHacknetNodesRamCost: 4.0, //Base cost for accessing Hacknet Node API
|
ScriptHacknetNodesRamCost: 4.0,
|
||||||
ScriptHNUpgLevelRamCost: 0.4,
|
ScriptHNUpgLevelRamCost: 0.4,
|
||||||
ScriptHNUpgRamRamCost: 0.6,
|
ScriptHNUpgRamRamCost: 0.6,
|
||||||
ScriptHNUpgCoreRamCost: 0.8,
|
ScriptHNUpgCoreRamCost: 0.8,
|
||||||
@ -75,7 +75,7 @@ export let CONSTANTS: IMap<any> = {
|
|||||||
ScriptGetPurchasedServerMaxRam: 0.05,
|
ScriptGetPurchasedServerMaxRam: 0.05,
|
||||||
ScriptRoundRamCost: 0.05,
|
ScriptRoundRamCost: 0.05,
|
||||||
ScriptReadWriteRamCost: 1.0,
|
ScriptReadWriteRamCost: 1.0,
|
||||||
ScriptArbScriptRamCost: 1.0, // Functions that apply to all scripts regardless of args
|
ScriptArbScriptRamCost: 1.0,
|
||||||
ScriptGetScriptRamCost: 0.1,
|
ScriptGetScriptRamCost: 0.1,
|
||||||
ScriptGetHackTimeRamCost: 0.05,
|
ScriptGetHackTimeRamCost: 0.05,
|
||||||
ScriptGetFavorToDonate: 0.10,
|
ScriptGetFavorToDonate: 0.10,
|
||||||
@ -94,7 +94,7 @@ export let CONSTANTS: IMap<any> = {
|
|||||||
|
|
||||||
NumNetscriptPorts: 20,
|
NumNetscriptPorts: 20,
|
||||||
|
|
||||||
//Server constants
|
// Server-related constants
|
||||||
HomeComputerMaxRam: 1073741824, // 2 ^ 30
|
HomeComputerMaxRam: 1073741824, // 2 ^ 30
|
||||||
ServerBaseGrowthRate: 1.03, // Unadjusted Growth rate
|
ServerBaseGrowthRate: 1.03, // Unadjusted Growth rate
|
||||||
ServerMaxGrowthRate: 1.0035, // Maximum possible growth rate (max rate accounting for server security)
|
ServerMaxGrowthRate: 1.0035, // Maximum possible growth rate (max rate accounting for server security)
|
||||||
@ -109,16 +109,16 @@ export let CONSTANTS: IMap<any> = {
|
|||||||
AugmentationRepMultiplier: 2.5, // Used for balancing rep cost without having to readjust every value
|
AugmentationRepMultiplier: 2.5, // Used for balancing rep cost without having to readjust every value
|
||||||
MultipleAugMultiplier: 1.9,
|
MultipleAugMultiplier: 1.9,
|
||||||
|
|
||||||
//How much a TOR router costs
|
// TOR Router
|
||||||
TorRouterCost: 200000,
|
TorRouterCost: 200e3,
|
||||||
|
|
||||||
//Infiltration constants
|
// Infiltration
|
||||||
InfiltrationBribeBaseAmount: 100e3, //Amount per clearance level
|
InfiltrationBribeBaseAmount: 100e3, //Amount per clearance level
|
||||||
InfiltrationMoneyValue: 5e3, //Convert "secret" value to money
|
InfiltrationMoneyValue: 5e3, //Convert "secret" value to money
|
||||||
InfiltrationRepValue: 1.4, //Convert "secret" value to faction reputation
|
InfiltrationRepValue: 1.4, //Convert "secret" value to faction reputation
|
||||||
InfiltrationExpPow: 0.8,
|
InfiltrationExpPow: 0.8,
|
||||||
|
|
||||||
//Stock market constants
|
// Stock market
|
||||||
WSEAccountCost: 200e6,
|
WSEAccountCost: 200e6,
|
||||||
TIXAPICost: 5e9,
|
TIXAPICost: 5e9,
|
||||||
MarketData4SCost: 1e9,
|
MarketData4SCost: 1e9,
|
||||||
@ -139,6 +139,7 @@ export let CONSTANTS: IMap<any> = {
|
|||||||
IntelligenceHackingMissionBaseExpGain: 0.03, // Hacking Mission difficulty multiplied by this to get exp gain
|
IntelligenceHackingMissionBaseExpGain: 0.03, // Hacking Mission difficulty multiplied by this to get exp gain
|
||||||
|
|
||||||
// Hacking Missions
|
// Hacking Missions
|
||||||
|
// TODO Move this into Hacking Mission implementation
|
||||||
HackingMissionRepToDiffConversion: 10000, // Faction rep is divided by this to get mission difficulty
|
HackingMissionRepToDiffConversion: 10000, // Faction rep is divided by this to get mission difficulty
|
||||||
HackingMissionRepToRewardConversion: 7, // Faction rep divided byt his to get mission rep reward
|
HackingMissionRepToRewardConversion: 7, // Faction rep divided byt his to get mission rep reward
|
||||||
HackingMissionSpamTimeIncrease: 25000, // How much time limit increase is gained when conquering a Spam Node (ms)
|
HackingMissionSpamTimeIncrease: 25000, // How much time limit increase is gained when conquering a Spam Node (ms)
|
||||||
@ -192,7 +193,7 @@ export let CONSTANTS: IMap<any> = {
|
|||||||
"-Miscellaneous Nodes slowly raise their defense over time<br><br>" +
|
"-Miscellaneous Nodes slowly raise their defense over time<br><br>" +
|
||||||
"-Nodes slowly regenerate health over time.",
|
"-Nodes slowly regenerate health over time.",
|
||||||
|
|
||||||
/* Time Constants */
|
// Time-related constants
|
||||||
MillisecondsPer20Hours: 72000000,
|
MillisecondsPer20Hours: 72000000,
|
||||||
GameCyclesPer20Hours: 72000000 / 200,
|
GameCyclesPer20Hours: 72000000 / 200,
|
||||||
|
|
||||||
@ -220,7 +221,7 @@ export let CONSTANTS: IMap<any> = {
|
|||||||
MillisecondsPerFiveMinutes: 300000,
|
MillisecondsPerFiveMinutes: 300000,
|
||||||
GameCyclesPerFiveMinutes: 300000 / 200,
|
GameCyclesPerFiveMinutes: 300000 / 200,
|
||||||
|
|
||||||
/* Player Work / Action related Constants */
|
// Player Work & Action
|
||||||
FactionWorkHacking: "Faction Hacking Work",
|
FactionWorkHacking: "Faction Hacking Work",
|
||||||
FactionWorkField: "Faction Field Work",
|
FactionWorkField: "Faction Field Work",
|
||||||
FactionWorkSecurity: "Faction Security Work",
|
FactionWorkSecurity: "Faction Security Work",
|
||||||
@ -263,7 +264,8 @@ export let CONSTANTS: IMap<any> = {
|
|||||||
CrimeAssassination: "assassinate a high-profile target",
|
CrimeAssassination: "assassinate a high-profile target",
|
||||||
CrimeHeist: "pull off the ultimate heist",
|
CrimeHeist: "pull off the ultimate heist",
|
||||||
|
|
||||||
/* Coding Contract Constants */
|
// Coding Contract
|
||||||
|
// TODO Move this into Coding contract impelmentation?
|
||||||
CodingContractBaseFactionRepGain: 2500,
|
CodingContractBaseFactionRepGain: 2500,
|
||||||
CodingContractBaseCompanyRepGain: 4000,
|
CodingContractBaseCompanyRepGain: 4000,
|
||||||
CodingContractBaseMoneyGain: 75e6,
|
CodingContractBaseMoneyGain: 75e6,
|
||||||
|
@ -33,7 +33,12 @@ import ReactDOM from "react-dom";
|
|||||||
|
|
||||||
const Component = React.Component;
|
const Component = React.Component;
|
||||||
|
|
||||||
const validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12];
|
// Update as additional BitNodes get implemented
|
||||||
|
const validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
||||||
|
|
||||||
|
// Some dev menu buttons just add a lot of something for convenience
|
||||||
|
const tonsPP = 1e27;
|
||||||
|
const tonsP = 1e12;
|
||||||
|
|
||||||
|
|
||||||
class ValueAdjusterComponent extends Component {
|
class ValueAdjusterComponent extends Component {
|
||||||
@ -189,13 +194,13 @@ class DevMenuComponent extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tonsOfExp() {
|
tonsOfExp() {
|
||||||
Player.gainHackingExp(1e27);
|
Player.gainHackingExp(tonsPP);
|
||||||
Player.gainStrengthExp(1e27);
|
Player.gainStrengthExp(tonsPP);
|
||||||
Player.gainDefenseExp(1e27);
|
Player.gainDefenseExp(tonsPP);
|
||||||
Player.gainDexterityExp(1e27);
|
Player.gainDexterityExp(tonsPP);
|
||||||
Player.gainAgilityExp(1e27);
|
Player.gainAgilityExp(tonsPP);
|
||||||
Player.gainCharismaExp(1e27);
|
Player.gainCharismaExp(tonsPP);
|
||||||
Player.gainIntelligenceExp(1e27);
|
Player.gainIntelligenceExp(tonsPP);
|
||||||
Player.updateSkillLevels();
|
Player.updateSkillLevels();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +303,7 @@ class DevMenuComponent extends Component {
|
|||||||
|
|
||||||
tonsOfRep() {
|
tonsOfRep() {
|
||||||
for (const i in Factions) {
|
for (const i in Factions) {
|
||||||
Factions[i].playerReputation = 1e27;
|
Factions[i].playerReputation = tonsPP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +315,7 @@ class DevMenuComponent extends Component {
|
|||||||
|
|
||||||
tonsOfFactionFavor() {
|
tonsOfFactionFavor() {
|
||||||
for (const i in Factions) {
|
for (const i in Factions) {
|
||||||
Factions[i].favor = 1e27;
|
Factions[i].favor = tonsPP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,7 +461,7 @@ class DevMenuComponent extends Component {
|
|||||||
|
|
||||||
tonsOfRepCompanies() {
|
tonsOfRepCompanies() {
|
||||||
for (const c in Companies) {
|
for (const c in Companies) {
|
||||||
Companies[c].playerReputation = 1e12;
|
Companies[c].playerReputation = tonsP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,7 +473,7 @@ class DevMenuComponent extends Component {
|
|||||||
|
|
||||||
tonsOfFavorCompanies() {
|
tonsOfFavorCompanies() {
|
||||||
for (const c in Companies) {
|
for (const c in Companies) {
|
||||||
Companies[c].favor = 1e12;
|
Companies[c].favor = tonsP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +498,7 @@ class DevMenuComponent extends Component {
|
|||||||
|
|
||||||
addTonsBladeburnerRank() {
|
addTonsBladeburnerRank() {
|
||||||
if (!!Player.bladeburner) {
|
if (!!Player.bladeburner) {
|
||||||
Player.bladeburner.changeRank(1e12);
|
Player.bladeburner.changeRank(tonsP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,13 +518,13 @@ class DevMenuComponent extends Component {
|
|||||||
|
|
||||||
addTonsBladeburnerCycles() {
|
addTonsBladeburnerCycles() {
|
||||||
if (!!Player.bladeburner) {
|
if (!!Player.bladeburner) {
|
||||||
Player.bladeburner.storedCycles += 1e12;
|
Player.bladeburner.storedCycles += tonsP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addTonsGangCycles() {
|
addTonsGangCycles() {
|
||||||
if (!!Player.gang) {
|
if (!!Player.gang) {
|
||||||
Player.gang.storedCycles = 1e12;
|
Player.gang.storedCycles = tonsP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,7 +544,7 @@ class DevMenuComponent extends Component {
|
|||||||
|
|
||||||
addTonsCorporationCycles() {
|
addTonsCorporationCycles() {
|
||||||
if (!!Player.corporation) {
|
if (!!Player.corporation) {
|
||||||
Player.corporation.storedCycles = 1e12;
|
Player.corporation.storedCycles = tonsP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1187,7 +1192,6 @@ class DevMenuComponent extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const devMenuContainerId = "dev-menu-container";
|
const devMenuContainerId = "dev-menu-container";
|
||||||
|
|
||||||
export function createDevMenu() {
|
export function createDevMenu() {
|
||||||
|
28
src/Gang.js
28
src/Gang.js
@ -1,6 +1,7 @@
|
|||||||
/*
|
/**
|
||||||
Also add police clashes
|
* TODO
|
||||||
balance point to keep them from running out of control
|
* Add police clashes
|
||||||
|
* balance point to keep them from running out of control
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { gangMemberTasksMetadata } from "./data/gangmembertasks";
|
import { gangMemberTasksMetadata } from "./data/gangmembertasks";
|
||||||
@ -144,12 +145,12 @@ export function loadAllGangs(saveString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param facName - Name of corresponding faction
|
* @param facName {string} Name of corresponding faction
|
||||||
* @param hacking - Boolean indicating whether or not its a hacking gang
|
* @param hacking {bollean} Whether or not its a hacking gang
|
||||||
*/
|
*/
|
||||||
export function Gang(facName, hacking=false) {
|
export function Gang(facName, hacking=false) {
|
||||||
this.facName = facName;
|
this.facName = facName;
|
||||||
this.members = []; //Array of GangMembers
|
this.members = [];
|
||||||
this.wanted = 1;
|
this.wanted = 1;
|
||||||
this.respect = 1;
|
this.respect = 1;
|
||||||
|
|
||||||
@ -569,10 +570,9 @@ Gang.fromJSON = function(value) {
|
|||||||
|
|
||||||
Reviver.constructors.Gang = Gang;
|
Reviver.constructors.Gang = Gang;
|
||||||
|
|
||||||
/*** Gang Member object ***/
|
|
||||||
function GangMember(name) {
|
function GangMember(name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.task = "Unassigned"; //GangMemberTask object
|
this.task = "Unassigned";
|
||||||
|
|
||||||
this.earnedRespect = 0;
|
this.earnedRespect = 0;
|
||||||
|
|
||||||
@ -605,10 +605,10 @@ function GangMember(name) {
|
|||||||
this.cha_asc_mult = 1;
|
this.cha_asc_mult = 1;
|
||||||
|
|
||||||
this.upgrades = []; // Names of upgrades
|
this.upgrades = []; // Names of upgrades
|
||||||
this.augmentations = []; //Names only
|
this.augmentations = []; // Names of augmentations only
|
||||||
}
|
}
|
||||||
|
|
||||||
//Same formula for Player
|
// Same skill calculation formula as Player
|
||||||
GangMember.prototype.calculateSkill = function(exp, mult=1) {
|
GangMember.prototype.calculateSkill = function(exp, mult=1) {
|
||||||
return Math.max(Math.floor(mult * (32 * Math.log(exp + 534.5) - 200)), 1);
|
return Math.max(Math.floor(mult * (32 * Math.log(exp + 534.5) - 200)), 1);
|
||||||
}
|
}
|
||||||
@ -777,9 +777,11 @@ GangMember.prototype.ascend = function() {
|
|||||||
|
|
||||||
// Returns the multipliers that would be gained from ascension
|
// Returns the multipliers that would be gained from ascension
|
||||||
GangMember.prototype.getAscensionResults = function() {
|
GangMember.prototype.getAscensionResults = function() {
|
||||||
// Calculate ascension bonus to stat multipliers.
|
/**
|
||||||
// This is based on the current number of multipliers from Non-Augmentation upgrades
|
* Calculate ascension bonus to stat multipliers.
|
||||||
// + Ascension Bonus = N% of current bonus from Augmentations
|
* This is based on the current number of multipliers from Non-Augmentation upgrades
|
||||||
|
* + Ascension Bonus = N% of current bonus from Augmentations
|
||||||
|
*/
|
||||||
let hack = 1;
|
let hack = 1;
|
||||||
let str = 1;
|
let str = 1;
|
||||||
let def = 1;
|
let def = 1;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Lore / world building literature files that can be found on servers.
|
||||||
|
* These files can be read by the player
|
||||||
|
*/
|
||||||
import { dialogBoxCreate } from "../utils/DialogBox";
|
import { dialogBoxCreate } from "../utils/DialogBox";
|
||||||
|
|
||||||
/* Literature.js
|
|
||||||
* Lore / world building literature that can be found on servers
|
|
||||||
*/
|
|
||||||
function Literature(title, filename, txt) {
|
function Literature(title, filename, txt) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.fn = filename;
|
this.fn = filename;
|
||||||
@ -10,10 +11,9 @@ function Literature(title, filename, txt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showLiterature(fn) {
|
function showLiterature(fn) {
|
||||||
var litObj = Literatures[fn];
|
const litObj = Literatures[fn];
|
||||||
if (litObj == null) { return; }
|
if (litObj == null) { return; }
|
||||||
var txt = "<i>" + litObj.title + "</i><br><br>" +
|
const txt = `<i>${litObj.title}</i><br><br>${litObj.txt}`;
|
||||||
litObj.txt;
|
|
||||||
dialogBoxCreate(txt);
|
dialogBoxCreate(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +430,10 @@ function initLiterature() {
|
|||||||
fn = "the-secret-war.lit";
|
fn = "the-secret-war.lit";
|
||||||
txt = ""
|
txt = ""
|
||||||
Literatures[fn] = new Literature(title, fn, txt);
|
Literatures[fn] = new Literature(title, fn, txt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export {Literatures, initLiterature, showLiterature};
|
export {
|
||||||
|
Literatures,
|
||||||
|
initLiterature,
|
||||||
|
showLiterature
|
||||||
|
};
|
||||||
|
@ -84,9 +84,10 @@ function Node(type, stats) {
|
|||||||
this.action = null;
|
this.action = null;
|
||||||
this.targetedCount = 0; // Count of how many connections this node is the target of
|
this.targetedCount = 0; // Count of how many connections this node is the target of
|
||||||
|
|
||||||
//Holds the JsPlumb Connection object for this Node,
|
/**
|
||||||
//where this Node is the Source (since each Node
|
* Holds the JsPlumb Connection object for this Node, where this Node is the Source (since each Node
|
||||||
//can only have 1 outgoing Connection)
|
* can only have 1 outgoing Connection)
|
||||||
|
*/
|
||||||
this.conn = null;
|
this.conn = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,9 +171,11 @@ Node.prototype.untarget = function() {
|
|||||||
--this.targetedCount;
|
--this.targetedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Hacking mission instance
|
/**
|
||||||
//Takes in the reputation of the Faction for which the mission is
|
* Hacking mission instance
|
||||||
//being conducted
|
* @param rep {number} How much reputation the player has for the faction
|
||||||
|
* @param fac {Faction} Faction for which this mission is being conducted
|
||||||
|
*/
|
||||||
function HackingMission(rep, fac) {
|
function HackingMission(rep, fac) {
|
||||||
this.faction = fac;
|
this.faction = fac;
|
||||||
|
|
||||||
@ -482,11 +485,7 @@ HackingMission.prototype.createPageDom = function() {
|
|||||||
}
|
}
|
||||||
node.action = NodeActions.Fortify;
|
node.action = NodeActions.Fortify;
|
||||||
});
|
});
|
||||||
// if (this.selectedNode.conn) {
|
});
|
||||||
// var endpoints = this.selectedNode.conn.endpoints;
|
|
||||||
// endpoints[0].detachFrom(endpoints[1]);
|
|
||||||
// }
|
|
||||||
})
|
|
||||||
|
|
||||||
var timeDisplay = document.createElement("p");
|
var timeDisplay = document.createElement("p");
|
||||||
|
|
||||||
@ -513,8 +512,10 @@ HackingMission.prototype.setActionButtonsActive = function(nodeType=null) {
|
|||||||
this.actionButtons[i].classList.remove("a-link-button-inactive");
|
this.actionButtons[i].classList.remove("a-link-button-inactive");
|
||||||
}
|
}
|
||||||
|
|
||||||
//For Transfer, FireWall and Shield Nodes, certain buttons should always be disabled
|
/**
|
||||||
//0 = Attack, 1 = Scan, 2 = Weaken, 3 = Fortify, 4 = overflow, 5 = Drop conn
|
* For Transfer, FireWall and Shield Nodes, certain buttons should always be disabled
|
||||||
|
* 0 = Attack, 1 = Scan, 2 = Weaken, 3 = Fortify, 4 = overflow, 5 = Drop conn
|
||||||
|
*/
|
||||||
if (nodeType) {
|
if (nodeType) {
|
||||||
switch (nodeType) {
|
switch (nodeType) {
|
||||||
case NodeTypes.Firewall:
|
case NodeTypes.Firewall:
|
||||||
@ -837,9 +838,11 @@ HackingMission.prototype.updateNodeDomElement = function(nodeObj) {
|
|||||||
txtEl.innerHTML = txt;
|
txtEl.innerHTML = txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Gets a Node DOM element's corresponding Node object using its
|
/**
|
||||||
//element id. Function accepts either the DOM element object or the ID as
|
* Gets a Node DOM element's corresponding Node object using its
|
||||||
//an argument
|
* element id. Function accepts either the DOM element object or the ID as
|
||||||
|
* an argument
|
||||||
|
*/
|
||||||
HackingMission.prototype.getNodeFromElement = function(el) {
|
HackingMission.prototype.getNodeFromElement = function(el) {
|
||||||
var id;
|
var id;
|
||||||
if (isString(el)) {
|
if (isString(el)) {
|
||||||
@ -902,9 +905,11 @@ function clearAllSelectedNodes(hackMissionInst) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Configures a DOM element representing a player-owned node to
|
/**
|
||||||
//be selectable and actionable
|
* Configures a DOM element representing a player-owned node to
|
||||||
//Note: Does NOT change its css class. This is handled by Node.setControlledBy...
|
* be selectable and actionable.
|
||||||
|
* Note: Does NOT change its css class. This is handled by Node.setControlledBy...
|
||||||
|
*/
|
||||||
HackingMission.prototype.configurePlayerNodeElement = function(el) {
|
HackingMission.prototype.configurePlayerNodeElement = function(el) {
|
||||||
var nodeObj = this.getNodeFromElement(el);
|
var nodeObj = this.getNodeFromElement(el);
|
||||||
if (nodeObj == null) {console.log("Error getting Node object");}
|
if (nodeObj == null) {console.log("Error getting Node object");}
|
||||||
@ -927,8 +932,10 @@ HackingMission.prototype.configurePlayerNodeElement = function(el) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Configures a DOM element representing an enemy-node by removing
|
/**
|
||||||
//any event listeners
|
* Configures a DOM element representing an enemy-node by removing
|
||||||
|
* any event listeners
|
||||||
|
*/
|
||||||
HackingMission.prototype.configureEnemyNodeElement = function(el) {
|
HackingMission.prototype.configureEnemyNodeElement = function(el) {
|
||||||
// Deselect node if it was the selected node
|
// Deselect node if it was the selected node
|
||||||
var nodeObj = this.getNodeFromElement(el);
|
var nodeObj = this.getNodeFromElement(el);
|
||||||
@ -941,8 +948,10 @@ HackingMission.prototype.configureEnemyNodeElement = function(el) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns bool indicating whether a node is reachable by player
|
/**
|
||||||
//by checking if any of the adjacent nodes are owned by the player
|
* Returns bool indicating whether a node is reachable by player
|
||||||
|
* by checking if any of the adjacent nodes are owned by the player
|
||||||
|
*/
|
||||||
HackingMission.prototype.nodeReachable = function(node) {
|
HackingMission.prototype.nodeReachable = function(node) {
|
||||||
var x = node.pos[0], y = node.pos[1];
|
var x = node.pos[0], y = node.pos[1];
|
||||||
if (x > 0 && this.map[x-1][y].plyrCtrl) {return true;}
|
if (x > 0 && this.map[x-1][y].plyrCtrl) {return true;}
|
||||||
@ -1379,9 +1388,11 @@ HackingMission.prototype.enemyAISelectAction = function(nodeObj) {
|
|||||||
if (nodeObj == null) {return;}
|
if (nodeObj == null) {return;}
|
||||||
switch(nodeObj.type) {
|
switch(nodeObj.type) {
|
||||||
case NodeTypes.Core:
|
case NodeTypes.Core:
|
||||||
//Select a single RANDOM target from miscNodes and player's Nodes
|
/**
|
||||||
//If it is reachable, it will target it. If not, no target will
|
* Select a single RANDOM target from miscNodes and player's Nodes
|
||||||
//be selected for now, and the next time process() gets called this will repeat
|
* If it is reachable, it will target it. If not, no target will
|
||||||
|
* be selected for now, and the next time process() gets called this will repeat
|
||||||
|
*/
|
||||||
if (nodeObj.conn == null) {
|
if (nodeObj.conn == null) {
|
||||||
if (this.miscNodes.length === 0) {
|
if (this.miscNodes.length === 0) {
|
||||||
// Randomly pick a player node and attack it if its reachable
|
// Randomly pick a player node and attack it if its reachable
|
||||||
|
@ -479,8 +479,7 @@ function NetscriptFunctions(workerScript) {
|
|||||||
const percentHacked = calculatePercentMoneyHacked(server);
|
const percentHacked = calculatePercentMoneyHacked(server);
|
||||||
let maxThreadNeeded = Math.ceil(1/percentHacked*(server.moneyAvailable/server.moneyMax));
|
let maxThreadNeeded = Math.ceil(1/percentHacked*(server.moneyAvailable/server.moneyMax));
|
||||||
if (isNaN(maxThreadNeeded)) {
|
if (isNaN(maxThreadNeeded)) {
|
||||||
//Server has a 'max money' of 0 (probably).
|
// Server has a 'max money' of 0 (probably). We'll set this to an arbitrarily large value
|
||||||
//We'll set this to an arbitrarily large value
|
|
||||||
maxThreadNeeded = 1e6;
|
maxThreadNeeded = 1e6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Implementation for what happens when you destroy a BitNode
|
||||||
|
*/
|
||||||
import { BitNodes } from "./BitNode/BitNode";
|
import { BitNodes } from "./BitNode/BitNode";
|
||||||
import { Engine } from "./engine";
|
import { Engine } from "./engine";
|
||||||
import { Player } from "./Player";
|
import { Player } from "./Player";
|
||||||
@ -18,8 +21,7 @@ import { clearEventListeners } from "../utils/uiHelpers/clearEventListeners";
|
|||||||
import { removeChildrenFromElement } from "../utils/uiHelpers/removeChildrenFromElement";
|
import { removeChildrenFromElement } from "../utils/uiHelpers/removeChildrenFromElement";
|
||||||
|
|
||||||
|
|
||||||
/* RedPill.js
|
|
||||||
* Implements what happens when you have Red Pill augmentation and then hack the world daemon */
|
|
||||||
|
|
||||||
// Returns promise
|
// Returns promise
|
||||||
function writeRedPillLine(line) {
|
function writeRedPillLine(line) {
|
||||||
@ -100,8 +102,6 @@ function hackWorldDaemon(currentNodeNumber, flume=false) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//The bitNode name passed in will have a hyphen between number (e.g. BitNode-1)
|
|
||||||
//This needs to be removed
|
|
||||||
function giveSourceFile(bitNodeNumber) {
|
function giveSourceFile(bitNodeNumber) {
|
||||||
var sourceFileKey = "SourceFile"+ bitNodeNumber.toString();
|
var sourceFileKey = "SourceFile"+ bitNodeNumber.toString();
|
||||||
var sourceFile = SourceFiles[sourceFileKey];
|
var sourceFile = SourceFiles[sourceFileKey];
|
||||||
|
@ -115,12 +115,11 @@ BitburnerSaveObject.prototype.saveGame = function(db) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request.onsuccess = function(e) {
|
request.onsuccess = function(e) {
|
||||||
//console.log("Saved game to IndexedDB!");
|
// TODO anything here?
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
window.localStorage.setItem("bitburnerSave", saveString);
|
window.localStorage.setItem("bitburnerSave", saveString);
|
||||||
//console.log("Saved game to LocalStorage!");
|
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
if (e.code == 22) {
|
if (e.code == 22) {
|
||||||
createStatusText("Save failed for localStorage! Check console(F12)");
|
createStatusText("Save failed for localStorage! Check console(F12)");
|
||||||
@ -482,7 +481,7 @@ function loadImportedGame(saveObj, saveString) {
|
|||||||
var lastUpdate = Player.lastUpdate;
|
var lastUpdate = Player.lastUpdate;
|
||||||
var numCyclesOffline = Math.floor((Engine._lastUpdate - lastUpdate) / Engine._idleSpeed);
|
var numCyclesOffline = Math.floor((Engine._lastUpdate - lastUpdate) / Engine._idleSpeed);
|
||||||
|
|
||||||
/* Process offline progress */
|
// Process offline progress
|
||||||
var offlineProductionFromScripts = loadAllRunningScripts(); // This also takes care of offline production for those scripts
|
var offlineProductionFromScripts = loadAllRunningScripts(); // This also takes care of offline production for those scripts
|
||||||
if (Player.isWorking) {
|
if (Player.isWorking) {
|
||||||
console.log("work() called in load() for " + numCyclesOffline * Engine._idleSpeed + " milliseconds");
|
console.log("work() called in load() for " + numCyclesOffline * Engine._idleSpeed + " milliseconds");
|
||||||
@ -624,8 +623,6 @@ BitburnerSaveObject.fromJSON = function(value) {
|
|||||||
|
|
||||||
Reviver.constructors.BitburnerSaveObject = BitburnerSaveObject;
|
Reviver.constructors.BitburnerSaveObject = BitburnerSaveObject;
|
||||||
|
|
||||||
//Import game
|
|
||||||
|
|
||||||
function openImportFileHandler(evt) {
|
function openImportFileHandler(evt) {
|
||||||
var file = evt.target.files[0];
|
var file = evt.target.files[0];
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { Player } from "./Player";
|
import { Player } from "./Player";
|
||||||
import { BitNodes } from "./BitNode/BitNode";
|
import { BitNodes } from "./BitNode/BitNode";
|
||||||
|
|
||||||
/* SourceFile.js */
|
|
||||||
// Each SourceFile corresponds to a BitNode with the same number
|
// Each SourceFile corresponds to a BitNode with the same number
|
||||||
function SourceFile(number, info="") {
|
function SourceFile(number, info="") {
|
||||||
var bitnodeKey = "BitNode" + number;
|
var bitnodeKey = "BitNode" + number;
|
||||||
|
@ -279,7 +279,6 @@ $(document).keydown(function(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO AFTER THIS:
|
// TODO AFTER THIS:
|
||||||
|
|
||||||
// alt + d deletes word after cursor
|
// alt + d deletes word after cursor
|
||||||
// ^w deletes word before cursor
|
// ^w deletes word before cursor
|
||||||
// ^k clears line after cursor
|
// ^k clears line after cursor
|
||||||
@ -1809,7 +1808,6 @@ let Terminal = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dashes = titleDashes + "--";
|
var dashes = titleDashes + "--";
|
||||||
//var dashes = Array(d * 2 + 1).join("-");
|
|
||||||
var c = "NO";
|
var c = "NO";
|
||||||
if (s.hasAdminRights) {c = "YES";}
|
if (s.hasAdminRights) {c = "YES";}
|
||||||
post(`${dashes}Root Access: ${c}${!isHacknet ? ", Required hacking skill: " + s.requiredHackingSkill : ""}`);
|
post(`${dashes}Root Access: ${c}${!isHacknet ? ", Required hacking skill: " + s.requiredHackingSkill : ""}`);
|
||||||
|
124
src/engine.jsx
124
src/engine.jsx
@ -155,7 +155,8 @@ import "../css/grid.min.css";
|
|||||||
import "../css/dev-menu.css";
|
import "../css/dev-menu.css";
|
||||||
|
|
||||||
|
|
||||||
/* Shortcuts to navigate through the game
|
/**
|
||||||
|
* Shortcuts to navigate through the game
|
||||||
* Alt-t - Terminal
|
* Alt-t - Terminal
|
||||||
* Alt-c - Character
|
* Alt-c - Character
|
||||||
* Alt-e - Script editor
|
* Alt-e - Script editor
|
||||||
@ -242,6 +243,7 @@ const Engine = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Display objects
|
// Display objects
|
||||||
|
// TODO-Refactor this into its own component
|
||||||
Display: {
|
Display: {
|
||||||
// Progress bar
|
// Progress bar
|
||||||
progress: null,
|
progress: null,
|
||||||
@ -279,7 +281,6 @@ const Engine = {
|
|||||||
_lastUpdate: new Date().getTime(),
|
_lastUpdate: new Date().getTime(),
|
||||||
_idleSpeed: 200, // Speed (in ms) at which the main loop is updated
|
_idleSpeed: 200, // Speed (in ms) at which the main loop is updated
|
||||||
|
|
||||||
/* Load content when a main menu button is clicked */
|
|
||||||
loadTerminalContent: function() {
|
loadTerminalContent: function() {
|
||||||
Engine.hideAllContent();
|
Engine.hideAllContent();
|
||||||
Engine.Display.terminalContent.style.display = "block";
|
Engine.Display.terminalContent.style.display = "block";
|
||||||
@ -425,7 +426,6 @@ const Engine = {
|
|||||||
loadWorkInProgressContent: function() {
|
loadWorkInProgressContent: function() {
|
||||||
Engine.hideAllContent();
|
Engine.hideAllContent();
|
||||||
var mainMenu = document.getElementById("mainmenu-container");
|
var mainMenu = document.getElementById("mainmenu-container");
|
||||||
//mainMenu.style.visibility = "hidden";
|
|
||||||
mainMenu.style.visibility = "hidden";
|
mainMenu.style.visibility = "hidden";
|
||||||
Engine.Display.workInProgressContent.style.display = "block";
|
Engine.Display.workInProgressContent.style.display = "block";
|
||||||
routing.navigateTo(Page.WorkInProgress);
|
routing.navigateTo(Page.WorkInProgress);
|
||||||
@ -602,11 +602,12 @@ const Engine = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Display character info */
|
/// Display character info
|
||||||
updateCharacterInfo: function() {
|
updateCharacterInfo: function() {
|
||||||
displayCharacterInfo(Engine.Display.characterInfo, Player);
|
displayCharacterInfo(Engine.Display.characterInfo, Player);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// TODO Refactor this into Faction implementation
|
||||||
displayFactionsInfo: function() {
|
displayFactionsInfo: function() {
|
||||||
removeChildrenFromElement(Engine.Display.factionsContent);
|
removeChildrenFromElement(Engine.Display.factionsContent);
|
||||||
|
|
||||||
@ -685,7 +686,7 @@ const Engine = {
|
|||||||
Engine.Display.factionsContent.appendChild(invitationsList);
|
Engine.Display.factionsContent.appendChild(invitationsList);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Main Event Loop */
|
// Main Game Loop
|
||||||
idleTimer: function() {
|
idleTimer: function() {
|
||||||
// Get time difference
|
// Get time difference
|
||||||
var _thisUpdate = new Date().getTime();
|
var _thisUpdate = new Date().getTime();
|
||||||
@ -760,7 +761,6 @@ const Engine = {
|
|||||||
// Corporation
|
// Corporation
|
||||||
if (Player.corporation instanceof Corporation) {
|
if (Player.corporation instanceof Corporation) {
|
||||||
// Stores cycles in a "buffer". Processed separately using Engine Counters
|
// Stores cycles in a "buffer". Processed separately using Engine Counters
|
||||||
//This is to avoid constant DOM redraws when Corporation is catching up
|
|
||||||
Player.corporation.storeCycles(numCycles);
|
Player.corporation.storeCycles(numCycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,22 +798,25 @@ const Engine = {
|
|||||||
processHacknetEarnings(numCycles);
|
processHacknetEarnings(numCycles);
|
||||||
},
|
},
|
||||||
|
|
||||||
//Counters for the main event loop. Represent the number of game cycles are required
|
/**
|
||||||
//for something to happen.
|
* Counters for the main event loop. Represent the number of game cycles that
|
||||||
|
* are required for something to happen. These counters are in game cycles,
|
||||||
|
* which is once every 200ms
|
||||||
|
*/
|
||||||
Counters: {
|
Counters: {
|
||||||
autoSaveCounter: 300, //Autosave every minute
|
autoSaveCounter: 300,
|
||||||
updateSkillLevelsCounter: 10, //Only update skill levels every 2 seconds. Might improve performance
|
updateSkillLevelsCounter: 10,
|
||||||
updateDisplays: 3,
|
updateDisplays: 3,
|
||||||
updateDisplaysMed: 9,
|
updateDisplaysMed: 9,
|
||||||
updateDisplaysLong: 15,
|
updateDisplaysLong: 15,
|
||||||
updateActiveScriptsDisplay: 5,
|
updateActiveScriptsDisplay: 5,
|
||||||
createProgramNotifications: 10, //Checks whether any programs can be created and notifies
|
createProgramNotifications: 10,
|
||||||
checkFactionInvitations: 100, //Check whether you qualify for any faction invitations
|
checkFactionInvitations: 100,
|
||||||
passiveFactionGrowth: 600,
|
passiveFactionGrowth: 600,
|
||||||
messages: 150,
|
messages: 150,
|
||||||
sCr: 1500,
|
sCr: 1500,
|
||||||
mechanicProcess: 5, // Processes certain mechanics (Corporation, Bladeburner)
|
mechanicProcess: 5, // Processes certain mechanics (Corporation, Bladeburner)
|
||||||
contractGeneration: 3000 //Generate Coding Contracts
|
contractGeneration: 3000, // Generate Coding Contracts
|
||||||
},
|
},
|
||||||
|
|
||||||
decrementAllCounters: function(numCycles = 1) {
|
decrementAllCounters: function(numCycles = 1) {
|
||||||
@ -824,8 +827,10 @@ const Engine = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Checks if any counters are 0 and if they are, executes whatever
|
/**
|
||||||
//is necessary and then resets the counter
|
* Checks if any counters are 0. If they are, executes whatever
|
||||||
|
* is necessary and then resets the counter
|
||||||
|
*/
|
||||||
checkCounters: function() {
|
checkCounters: function() {
|
||||||
if (Engine.Counters.autoSaveCounter <= 0) {
|
if (Engine.Counters.autoSaveCounter <= 0) {
|
||||||
if (Settings.AutosaveInterval == null) {
|
if (Settings.AutosaveInterval == null) {
|
||||||
@ -962,7 +967,8 @@ const Engine = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly */
|
// Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly
|
||||||
|
// TODO Refactor this into Terminal module
|
||||||
_totalActionTime: 0,
|
_totalActionTime: 0,
|
||||||
_actionTimeLeft: 0,
|
_actionTimeLeft: 0,
|
||||||
_actionTimeStr: "Time left: ",
|
_actionTimeStr: "Time left: ",
|
||||||
@ -997,8 +1003,10 @@ const Engine = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Used when initializing a game
|
/**
|
||||||
//elems should be an array of all DOM elements under the header
|
* Collapses a main menu header. Used when initializing the game.
|
||||||
|
* @param elems {HTMLElement[]} Elements under header
|
||||||
|
*/
|
||||||
closeMainMenuHeader: function(elems) {
|
closeMainMenuHeader: function(elems) {
|
||||||
for (var i = 0; i < elems.length; ++i) {
|
for (var i = 0; i < elems.length; ++i) {
|
||||||
elems[i].style.maxHeight = null;
|
elems[i].style.maxHeight = null;
|
||||||
@ -1007,8 +1015,10 @@ const Engine = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Used when initializing the game
|
/**
|
||||||
//elems should be an array of all DOM elements under the header
|
* Expands a main menu header. Used when initializing the game.
|
||||||
|
* @param elems {HTMLElement[]} Elements under header
|
||||||
|
*/
|
||||||
openMainMenuHeader: function(elems) {
|
openMainMenuHeader: function(elems) {
|
||||||
for (var i = 0; i < elems.length; ++i) {
|
for (var i = 0; i < elems.length; ++i) {
|
||||||
elems[i].style.maxHeight = elems[i].scrollHeight + "px";
|
elems[i].style.maxHeight = elems[i].scrollHeight + "px";
|
||||||
@ -1016,10 +1026,12 @@ const Engine = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Used in game when clicking on a main menu header (NOT FOR INITIALIZATION)
|
/**
|
||||||
//open is a boolean specifying whether its being opened or closed
|
* Used in game when clicking on a main menu header (NOT used for initialization)
|
||||||
//elems is an array of DOM elements for main menu tabs (li)
|
* @param open {boolean} Whether header is being opened or closed
|
||||||
//links is an array of DOM elements for main menu links (a)
|
* @param elems {HTMLElement[]} li Elements under header
|
||||||
|
* @param links {HTMLElement[]} a elements under header
|
||||||
|
*/
|
||||||
toggleMainMenuHeader: function(open, elems, links) {
|
toggleMainMenuHeader: function(open, elems, links) {
|
||||||
for (var i = 0; i < elems.length; ++i) {
|
for (var i = 0; i < elems.length; ++i) {
|
||||||
if (open) {
|
if (open) {
|
||||||
@ -1046,28 +1058,27 @@ const Engine = {
|
|||||||
|
|
||||||
load: function(saveString) {
|
load: function(saveString) {
|
||||||
// Initialize main menu accordion panels to all start as "open"
|
// Initialize main menu accordion panels to all start as "open"
|
||||||
var terminal = document.getElementById("terminal-tab");
|
const terminal = document.getElementById("terminal-tab");
|
||||||
var createScript = document.getElementById("create-script-tab");
|
const createScript = document.getElementById("create-script-tab");
|
||||||
var activeScripts = document.getElementById("active-scripts-tab");
|
const activeScripts = document.getElementById("active-scripts-tab");
|
||||||
var createProgram = document.getElementById("create-program-tab");
|
const createProgram = document.getElementById("create-program-tab");
|
||||||
var stats = document.getElementById("stats-tab");
|
const stats = document.getElementById("stats-tab");
|
||||||
var factions = document.getElementById("factions-tab");
|
const factions = document.getElementById("factions-tab");
|
||||||
var augmentations = document.getElementById("augmentations-tab");
|
const augmentations = document.getElementById("augmentations-tab");
|
||||||
var hacknetnodes = document.getElementById("hacknet-nodes-tab");
|
const hacknetnodes = document.getElementById("hacknet-nodes-tab");
|
||||||
var city = document.getElementById("city-tab");
|
const city = document.getElementById("city-tab");
|
||||||
var travel = document.getElementById("travel-tab");
|
const travel = document.getElementById("travel-tab");
|
||||||
var job = document.getElementById("job-tab");
|
const job = document.getElementById("job-tab");
|
||||||
var stockmarket = document.getElementById("stock-market-tab");
|
const stockmarket = document.getElementById("stock-market-tab");
|
||||||
var bladeburner = document.getElementById("bladeburner-tab");
|
const bladeburner = document.getElementById("bladeburner-tab");
|
||||||
var corp = document.getElementById("corporation-tab");
|
const corp = document.getElementById("corporation-tab");
|
||||||
var gang = document.getElementById("gang-tab");
|
const gang = document.getElementById("gang-tab");
|
||||||
var tutorial = document.getElementById("tutorial-tab");
|
const tutorial = document.getElementById("tutorial-tab");
|
||||||
var options = document.getElementById("options-tab");
|
const options = document.getElementById("options-tab");
|
||||||
var dev = document.getElementById("dev-tab");
|
const 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)) {
|
||||||
console.log("Loaded game from save");
|
|
||||||
initBitNodes();
|
initBitNodes();
|
||||||
initBitNodeMultipliers(Player);
|
initBitNodeMultipliers(Player);
|
||||||
initSourceFiles();
|
initSourceFiles();
|
||||||
@ -1088,7 +1099,7 @@ const Engine = {
|
|||||||
var lastUpdate = Player.lastUpdate;
|
var lastUpdate = Player.lastUpdate;
|
||||||
var numCyclesOffline = Math.floor((Engine._lastUpdate - lastUpdate) / Engine._idleSpeed);
|
var numCyclesOffline = Math.floor((Engine._lastUpdate - lastUpdate) / Engine._idleSpeed);
|
||||||
|
|
||||||
/* Process offline progress */
|
// Process offline progress
|
||||||
var offlineProductionFromScripts = loadAllRunningScripts(); // This also takes care of offline production for those scripts
|
var offlineProductionFromScripts = loadAllRunningScripts(); // This also takes care of offline production for those scripts
|
||||||
if (Player.isWorking) {
|
if (Player.isWorking) {
|
||||||
console.log("work() called in load() for " + numCyclesOffline * Engine._idleSpeed + " milliseconds");
|
console.log("work() called in load() for " + numCyclesOffline * Engine._idleSpeed + " milliseconds");
|
||||||
@ -1210,14 +1221,13 @@ const Engine = {
|
|||||||
initSingularitySFFlags();
|
initSingularitySFFlags();
|
||||||
|
|
||||||
// Open main menu accordions for new game
|
// Open main menu accordions for new game
|
||||||
//Main menu accordions
|
const hackingHdr = document.getElementById("hacking-menu-header");
|
||||||
var hackingHdr = document.getElementById("hacking-menu-header");
|
|
||||||
hackingHdr.classList.toggle("opened");
|
hackingHdr.classList.toggle("opened");
|
||||||
var characterHdr = document.getElementById("character-menu-header");
|
const characterHdr = document.getElementById("character-menu-header");
|
||||||
characterHdr.classList.toggle("opened");
|
characterHdr.classList.toggle("opened");
|
||||||
var worldHdr = document.getElementById("world-menu-header");
|
const worldHdr = document.getElementById("world-menu-header");
|
||||||
worldHdr.classList.toggle("opened");
|
worldHdr.classList.toggle("opened");
|
||||||
var helpHdr = document.getElementById("help-menu-header");
|
const helpHdr = document.getElementById("help-menu-header");
|
||||||
helpHdr.classList.toggle("opened");
|
helpHdr.classList.toggle("opened");
|
||||||
|
|
||||||
// Hide tabs that wont be revealed until later
|
// Hide tabs that wont be revealed until later
|
||||||
@ -1323,7 +1333,7 @@ const Engine = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Initialization */
|
// Initialization
|
||||||
init: function() {
|
init: function() {
|
||||||
// Import game link
|
// Import game link
|
||||||
document.getElementById("import-game-link").onclick = function() {
|
document.getElementById("import-game-link").onclick = function() {
|
||||||
@ -1494,7 +1504,7 @@ const Engine = {
|
|||||||
Engine.loadWorkInProgressContent();
|
Engine.loadWorkInProgressContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
//character overview screen
|
// Character overview screen
|
||||||
document.getElementById("character-overview-container").style.display = "block";
|
document.getElementById("character-overview-container").style.display = "block";
|
||||||
|
|
||||||
// Remove classes from links (they might be set from tutorial)
|
// Remove classes from links (they might be set from tutorial)
|
||||||
@ -1565,7 +1575,7 @@ const Engine = {
|
|||||||
// Run main loop
|
// Run main loop
|
||||||
Engine.idleTimer();
|
Engine.idleTimer();
|
||||||
|
|
||||||
//Scripts
|
// Script-processing loop
|
||||||
runScriptsLoop();
|
runScriptsLoop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1576,9 +1586,11 @@ window.onload = function() {
|
|||||||
return Engine.load(null); // Will try to load from localstorage
|
return Engine.load(null); // Will try to load from localstorage
|
||||||
}
|
}
|
||||||
|
|
||||||
//DB is called bitburnerSave
|
/**
|
||||||
//Object store is called savestring
|
* DB is called bitburnerSave
|
||||||
//key for the Object store is called save
|
* Object store is called savestring
|
||||||
|
* key for the Object store is called save
|
||||||
|
*/
|
||||||
indexedDbRequest = window.indexedDB.open("bitburnerSave", 1);
|
indexedDbRequest = window.indexedDB.open("bitburnerSave", 1);
|
||||||
|
|
||||||
indexedDbRequest.onerror = function(e) {
|
indexedDbRequest.onerror = function(e) {
|
||||||
@ -1599,7 +1611,7 @@ window.onload = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request.onsuccess = function(e) {
|
request.onsuccess = function(e) {
|
||||||
Engine.load(request.result); //Is this right?
|
Engine.load(request.result);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user