Most console.log have been changed to console.warn or removed if they were debug

This commit is contained in:
Olivier Gagnon 2021-03-07 22:46:50 -05:00
parent 56a3660d38
commit 316a1aa475
19 changed files with 64 additions and 95 deletions

@ -2063,7 +2063,7 @@ function installAugmentations(cbScript=null) {
for (var i = 0; i < Player.queuedAugmentations.length; ++i) { for (var i = 0; i < Player.queuedAugmentations.length; ++i) {
var aug = Augmentations[Player.queuedAugmentations[i].name]; var aug = Augmentations[Player.queuedAugmentations[i].name];
if (aug == null) { if (aug == null) {
console.log("ERROR. Invalid augmentation"); console.error(`Invalid augmentation: ${Player.queuedAugmentations[i].name}`);
continue; continue;
} }
applyAugmentation(Player.queuedAugmentations[i]); applyAugmentation(Player.queuedAugmentations[i]);

@ -492,7 +492,7 @@ export function initBitNodeMultipliers(p: IPlayer) {
BitNodeMultipliers.BladeburnerSkillCost = inc; BitNodeMultipliers.BladeburnerSkillCost = inc;
break; break;
default: default:
console.log("WARNING: Player.bitNodeN invalid"); console.warn("Player.bitNodeN invalid");
break; break;
} }
} }

@ -495,7 +495,7 @@ Action.prototype.getSuccessChance = function(inst, params={}) {
var key = "eff" + stat.charAt(0).toUpperCase() + stat.slice(1); var key = "eff" + stat.charAt(0).toUpperCase() + stat.slice(1);
var effMultiplier = inst.skillMultipliers[key]; var effMultiplier = inst.skillMultipliers[key];
if (effMultiplier == null) { if (effMultiplier == null) {
console.log("ERROR: Failed to find Bladeburner Skill multiplier for: " + stat); console.error(`Failed to find Bladeburner Skill multiplier for: ${stat}`);
effMultiplier = 1; effMultiplier = 1;
} }
competence += (this.weights[stat] * Math.pow(effMultiplier*playerStatLvl, this.decays[stat])); competence += (this.weights[stat] * Math.pow(effMultiplier*playerStatLvl, this.decays[stat]));
@ -1218,8 +1218,7 @@ Bladeburner.prototype.startAction = function(actionId) {
Bladeburner.prototype.processAction = function(seconds) { Bladeburner.prototype.processAction = function(seconds) {
if (this.action.type === ActionTypes["Idle"]) {return;} if (this.action.type === ActionTypes["Idle"]) {return;}
if (this.actionTimeToComplete <= 0) { if (this.actionTimeToComplete <= 0) {
console.log("action.type: " + this.action.type); throw new Error(`Invalid actionTimeToComplete value: ${this.actionTimeToComplete}, type; ${this.action.type}`);
throw new Error("Invalid actionTimeToComplete value: " + this.actionTimeToComplete);
} }
if (!(this.action instanceof ActionIdentifier)) { if (!(this.action instanceof ActionIdentifier)) {
throw new Error("Bladeburner.action is not an ActionIdentifier Object"); throw new Error("Bladeburner.action is not an ActionIdentifier Object");
@ -1720,7 +1719,7 @@ Bladeburner.prototype.randomEvent = function() {
Bladeburner.prototype.triggerPotentialMigration = function(sourceCityName, chance) { Bladeburner.prototype.triggerPotentialMigration = function(sourceCityName, chance) {
if (chance == null || isNaN(chance)) { if (chance == null || isNaN(chance)) {
console.log("ERROR: Invalid 'chance' parameter passed into Bladeburner.triggerPotentialMigration()"); console.error("Invalid 'chance' parameter passed into Bladeburner.triggerPotentialMigration()");
} }
if (chance > 1) {chance /= 100;} if (chance > 1) {chance /= 100;}
if (Math.random() < chance) {this.triggerMigration(sourceCityName);} if (Math.random() < chance) {this.triggerMigration(sourceCityName);}
@ -2310,7 +2309,7 @@ Bladeburner.prototype.createSkillsContent = function() {
// TODO in the future if items are ever implemented // TODO in the future if items are ever implemented
break; break;
default: default:
console.log("Warning: Unrecognized SkillMult Key: " + multKeys[i]); console.warn(`Unrecognized SkillMult Key: ${multKeys[i]}`);
break; break;
} }
} }
@ -3022,7 +3021,6 @@ Bladeburner.prototype.parseCommandArguments = function(command) {
++i; ++i;
} }
if (start !== i) {args.push(command.substr(start, i-start));} if (start !== i) {args.push(command.substr(start, i-start));}
console.log("Bladeburner console command parsing returned: " + args);
return args; return args;
} }
@ -3286,7 +3284,7 @@ Bladeburner.prototype.executeSkillConsoleCommand = function(args) {
// TODO if items are ever implemented // TODO if items are ever implemented
break; break;
default: default:
console.log("Warning: Unrecognized SkillMult Key: " + multKeys[i]); console.warn(`Unrecognized SkillMult Key: ${multKeys[i]}`);
break; break;
} }
} }

@ -383,7 +383,7 @@ Industry.prototype.init = function() {
this.makesProducts = true; this.makesProducts = true;
break; break;
default: default:
console.log("ERR: Invalid Industry Type passed into Industry.init(): " + this.type); console.error(`Invalid Industry Type passed into Industry.init(): ${this.type}`);
return; return;
} }
} }
@ -409,7 +409,7 @@ Industry.prototype.getProductDescriptionText = function() {
case Industries.RealEstate: case Industries.RealEstate:
return "develop and manage real estate properties"; return "develop and manage real estate properties";
default: default:
console.log("ERROR: Invalid industry type in Industry.getProductDescriptionText"); console.error("Invalid industry type in Industry.getProductDescriptionText");
return ""; return "";
} }
} }
@ -477,9 +477,7 @@ Industry.prototype.process = function(marketCycles=1, state, company) {
//Then calculate salaries and processs the markets //Then calculate salaries and processs the markets
if (state === "START") { if (state === "START") {
if (isNaN(this.thisCycleRevenue) || isNaN(this.thisCycleExpenses)) { if (isNaN(this.thisCycleRevenue) || isNaN(this.thisCycleExpenses)) {
console.log("ERROR: NaN in Corporation's computed revenue/expenses"); console.error("NaN in Corporation's computed revenue/expenses");
console.log(this.thisCycleRevenue.toString());
console.log(this.thisCycleExpenses.toString());
dialogBoxCreate("Something went wrong when compting Corporation's revenue/expenses. This is a bug. Please report to game developer"); dialogBoxCreate("Something went wrong when compting Corporation's revenue/expenses. This is a bug. Please report to game developer");
this.thisCycleRevenue = new Decimal(0); this.thisCycleRevenue = new Decimal(0);
this.thisCycleExpenses = new Decimal(0); this.thisCycleExpenses = new Decimal(0);
@ -898,7 +896,7 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
var expIndustry = company.divisions[foo]; var expIndustry = company.divisions[foo];
var expWarehouse = expIndustry.warehouses[exp.city]; var expWarehouse = expIndustry.warehouses[exp.city];
if (!(expWarehouse instanceof Warehouse)) { if (!(expWarehouse instanceof Warehouse)) {
console.log("ERROR: Invalid export! " + expIndustry.name + " " + exp.city); console.error(`Invalid export! ${expIndustry.name} ${exp.city}`);
break; break;
} }
@ -931,7 +929,7 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
case "START": case "START":
break; break;
default: default:
console.log("ERROR: Invalid state: " + this.state); console.error(`Invalid state: ${this.state}`);
break; break;
} //End switch(this.state) } //End switch(this.state)
this.updateWarehouseSizeUsed(warehouse); this.updateWarehouseSizeUsed(warehouse);
@ -1181,7 +1179,7 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio
case "EXPORT": case "EXPORT":
break; break;
default: default:
console.log("ERROR: Invalid State: " + this.state); console.error(`Invalid State: ${this.state}`);
break; break;
} //End switch(this.state) } //End switch(this.state)
} }
@ -1221,7 +1219,7 @@ Industry.prototype.upgrade = function(upgrade, refs) {
this.popularity *= ((1 + getRandomInt(1, 3) / 100) * advMult); this.popularity *= ((1 + getRandomInt(1, 3) / 100) * advMult);
break; break;
default: default:
console.log("ERROR: Un-implemented function index: " + upgN); console.error(`Un-implemented function index: ${upgN}`);
break; break;
} }
} }
@ -1287,7 +1285,6 @@ Industry.prototype.updateResearchTree = function() {
// Since ResearchTree data isnt saved, we'll update the Research Tree data // Since ResearchTree data isnt saved, we'll update the Research Tree data
// based on the stored 'researched' property in the Industry object // based on the stored 'researched' property in the Industry object
if (Object.keys(researchTree.researched).length !== Object.keys(this.researched).length) { if (Object.keys(researchTree.researched).length !== Object.keys(this.researched).length) {
console.log("Updating Corporation Research Tree Data");
for (let research in this.researched) { for (let research in this.researched) {
researchTree.research(research); researchTree.research(research);
} }
@ -1547,7 +1544,7 @@ Employee.prototype.calculateProductivity = function(corporation, industry) {
prodMult = 0; prodMult = 0;
break; break;
default: default:
console.log("ERROR: Invalid employee position: " + this.pos); console.error(`Invalid employee position: ${this.pos}`);
break; break;
} }
return prodBase * prodMult; return prodBase * prodMult;

@ -153,7 +153,6 @@ export class Product {
const opsRatio = employeeProd[EmployeePositions.Operations] / employeeProd["total"]; const opsRatio = employeeProd[EmployeePositions.Operations] / employeeProd["total"];
const busRatio = employeeProd[EmployeePositions.Business] / employeeProd["total"]; const busRatio = employeeProd[EmployeePositions.Business] / employeeProd["total"];
var designMult = 1 + (Math.pow(this.designCost, 0.1) / 100); var designMult = 1 + (Math.pow(this.designCost, 0.1) / 100);
console.log("designMult: " + designMult);
var balanceMult = (1.2 * engrRatio) + (0.9 * mgmtRatio) + (1.3 * rndRatio) + var balanceMult = (1.2 * engrRatio) + (0.9 * mgmtRatio) + (1.3 * rndRatio) +
(1.5 * opsRatio) + (busRatio); (1.5 * opsRatio) + (busRatio);
var sciMult = 1 + (Math.pow(industry.sciResearch.qty, industry.sciFac) / 800); var sciMult = 1 + (Math.pow(industry.sciResearch.qty, industry.sciFac) / 800);
@ -221,7 +220,7 @@ export class Product {
calculateRating(industry: IIndustry): void { calculateRating(industry: IIndustry): void {
const weights: IProductRatingWeight = ProductRatingWeights[industry.type]; const weights: IProductRatingWeight = ProductRatingWeights[industry.type];
if (weights == null) { if (weights == null) {
console.log("ERROR: Could not find product rating weights for: " + industry); console.error(`Could not find product rating weights for: ${industry}`);
return; return;
} }
this.rat = 0; this.rat = 0;

@ -110,7 +110,6 @@ export class CorporationEventHandler {
} else { } else {
var totalAmount = money + (stockShares * stockPrice); var totalAmount = money + (stockShares * stockPrice);
var repGain = totalAmount / BribeToRepRatio; var repGain = totalAmount / BribeToRepRatio;
console.log("repGain: " + repGain);
repGainText.innerText = "You will gain " + numeralWrapper.format(repGain, "0,0") + repGainText.innerText = "You will gain " + numeralWrapper.format(repGain, "0,0") +
" reputation with " + " reputation with " +
factionSelector.options[factionSelector.selectedIndex].value + factionSelector.options[factionSelector.selectedIndex].value +
@ -1539,8 +1538,7 @@ export class CorporationEventHandler {
this.corp.numShares -= shares; this.corp.numShares -= shares;
if (isNaN(this.corp.issuedShares)) { if (isNaN(this.corp.issuedShares)) {
console.log("ERROR: Corporation issuedShares is NaN: " + this.corp.issuedShares); console.error(`Corporation issuedShares is NaN: ${this.corp.issuedShares}`);
console.log("Converting to number now");
var res = parseInt(this.corp.issuedShares); var res = parseInt(this.corp.issuedShares);
if (isNaN(res)) { if (isNaN(res)) {
this.corp.issuedShares = 0; this.corp.issuedShares = 0;

@ -91,7 +91,7 @@ function parseFconfSetting(setting, value) {
setting = String(setting); setting = String(setting);
value = String(value); value = String(value);
if (setting == null || value == null || FconfSettings[setting] == null) { if (setting == null || value == null || FconfSettings[setting] == null) {
console.log("WARNING: Invalid .fconf setting: " + setting); console.warn(`Invalid .fconf setting: ${setting}`);
return; return;
} }
@ -184,7 +184,7 @@ function setTheme() {
FconfSettings.THEME_FONT_COLOR == null || FconfSettings.THEME_FONT_COLOR == null ||
FconfSettings.THEME_BACKGROUND_COLOR == null || FconfSettings.THEME_BACKGROUND_COLOR == null ||
FconfSettings.THEME_PROMPT_COLOR == null) { FconfSettings.THEME_PROMPT_COLOR == null) {
console.log("ERROR: Cannot find Theme Settings"); console.error("Cannot find Theme Settings");
return; return;
} }
if (/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(FconfSettings.THEME_HIGHLIGHT_COLOR) && if (/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(FconfSettings.THEME_HIGHLIGHT_COLOR) &&

@ -69,7 +69,6 @@ function iTutorialStart() {
// Don't autosave during this interactive tutorial // Don't autosave during this interactive tutorial
Engine.Counters.autoSaveCounter = Infinity; Engine.Counters.autoSaveCounter = Infinity;
console.log("Interactive Tutorial started");
ITutorial.currStep = 0; ITutorial.currStep = 0;
ITutorial.isRunning = true; ITutorial.isRunning = true;
@ -100,7 +99,7 @@ function iTutorialStart() {
} }
function iTutorialEvaluateStep() { function iTutorialEvaluateStep() {
if (!ITutorial.isRunning) {console.log("Interactive Tutorial not running"); return;} if (!ITutorial.isRunning) {return;}
// Disable and clear main menu // Disable and clear main menu
var terminalMainMenu = clearEventListeners("terminal-menu-link"); var terminalMainMenu = clearEventListeners("terminal-menu-link");
@ -476,8 +475,6 @@ function iTutorialEnd() {
Engine.Counters.autoSaveCounter = Settings.AutosaveInterval * 5; Engine.Counters.autoSaveCounter = Settings.AutosaveInterval * 5;
} }
console.log("Ending interactive tutorial");
// Initialize references to main menu links // Initialize references to main menu links
// We have to call initializeMainMenuLinks() again because the Interactive Tutorial // We have to call initializeMainMenuLinks() again because the Interactive Tutorial
// re-creates Main menu links with clearEventListeners() // re-creates Main menu links with clearEventListeners()

@ -165,7 +165,7 @@ Node.prototype.deselect = function(actionButtons) {
Node.prototype.untarget = function() { Node.prototype.untarget = function() {
if (this.targetedCount === 0) { if (this.targetedCount === 0) {
console.log("WARN: Node " + this.el.id + " is being 'untargeted' when it has no target count"); console.warn(`Node ${this.el.id} is being 'untargeted' when it has no target count`);
return; return;
} }
--this.targetedCount; --this.targetedCount;
@ -214,7 +214,6 @@ function HackingMission(rep, fac) {
this.jsplumbinstance = null; this.jsplumbinstance = null;
this.difficulty = rep / CONSTANTS.HackingMissionRepToDiffConversion + 1; this.difficulty = rep / CONSTANTS.HackingMissionRepToDiffConversion + 1;
console.log("difficulty: " + this.difficulty);
this.reward = 250 + (rep / CONSTANTS.HackingMissionRepToRewardConversion); this.reward = 250 + (rep / CONSTANTS.HackingMissionRepToRewardConversion);
} }
@ -408,7 +407,7 @@ HackingMission.prototype.createPageDom = function() {
// Set Action Button event listeners // Set Action Button event listeners
this.actionButtons[0].addEventListener("click", ()=>{ this.actionButtons[0].addEventListener("click", ()=>{
if (!(this.selectedNode.length > 0)) { if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node"); console.error("Pressing Action button without selected node");
return; return;
} }
if (this.selectedNode[0].type !== NodeTypes.Core) {return;} if (this.selectedNode[0].type !== NodeTypes.Core) {return;}
@ -421,7 +420,7 @@ HackingMission.prototype.createPageDom = function() {
this.actionButtons[1].addEventListener("click", ()=>{ this.actionButtons[1].addEventListener("click", ()=>{
if (!(this.selectedNode.length > 0)) { if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node"); console.error("Pressing Action button without selected node");
return; return;
} }
var nodeType = this.selectedNode[0].type; // In a multiselect, every Node will have the same type var nodeType = this.selectedNode[0].type; // In a multiselect, every Node will have the same type
@ -435,7 +434,7 @@ HackingMission.prototype.createPageDom = function() {
this.actionButtons[2].addEventListener("click", ()=>{ this.actionButtons[2].addEventListener("click", ()=>{
if (!(this.selectedNode.length > 0)) { if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node"); console.error("Pressing Action button without selected node");
return; return;
} }
var nodeType = this.selectedNode[0].type; // In a multiselect, every Node will have the same type var nodeType = this.selectedNode[0].type; // In a multiselect, every Node will have the same type
@ -449,7 +448,7 @@ HackingMission.prototype.createPageDom = function() {
this.actionButtons[3].addEventListener("click", ()=>{ this.actionButtons[3].addEventListener("click", ()=>{
if (!(this.selectedNode.length > 0)) { if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node"); console.error("Pressing Action button without selected node");
return; return;
} }
this.setActionButtonsActive(this.selectedNode[0].type); this.setActionButtonsActive(this.selectedNode[0].type);
@ -461,7 +460,7 @@ HackingMission.prototype.createPageDom = function() {
this.actionButtons[4].addEventListener("click", ()=>{ this.actionButtons[4].addEventListener("click", ()=>{
if (!(this.selectedNode.length > 0)) { if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node"); console.error("Pressing Action button without selected node");
return; return;
} }
var nodeType = this.selectedNode[0].type; var nodeType = this.selectedNode[0].type;
@ -475,7 +474,7 @@ HackingMission.prototype.createPageDom = function() {
this.actionButtons[5].addEventListener("click", ()=>{ this.actionButtons[5].addEventListener("click", ()=>{
if (!(this.selectedNode.length > 0)) { if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node"); console.error("Pressing Action button without selected node");
return; return;
} }
this.selectedNode.forEach(function(node){ this.selectedNode.forEach(function(node){
@ -637,18 +636,16 @@ HackingMission.prototype.removeAvailablePosition = function(x, y) {
return; return;
} }
} }
console.log("WARNING: removeAvailablePosition() did not remove " + x + ", " + y); console.warn(`removeAvailablePosition() did not remove ${x}, ${y}`);
} }
HackingMission.prototype.setNodePosition = function(nodeObj, x, y) { HackingMission.prototype.setNodePosition = function(nodeObj, x, y) {
if (!(nodeObj instanceof Node)) { if (!(nodeObj instanceof Node)) {
console.log("WARNING: Non-Node object passed into setNodePOsition"); console.warn("Non-Node object passed into setNodePOsition");
return; return;
} }
if (isNaN(x) || isNaN(y)) { if (isNaN(x) || isNaN(y)) {
console.log("ERR: Invalid values passed as x and y for setNodePosition"); console.error(`Invalid values (${x}, ${y}) passed as (x, y) for setNodePosition`);
console.log(x);
console.log(y);
return; return;
} }
nodeObj.pos = [x, y]; nodeObj.pos = [x, y];
@ -725,7 +722,6 @@ HackingMission.prototype.createMap = function() {
// Configure all Player CPUS // Configure all Player CPUS
for (var i = 0; i < this.playerCores.length; ++i) { for (var i = 0; i < this.playerCores.length; ++i) {
console.log("Configuring Player Node: " + this.playerCores[i].el.id);
this.configurePlayerNodeElement(this.playerCores[i].el); this.configurePlayerNodeElement(this.playerCores[i].el);
} }
} }
@ -793,7 +789,7 @@ HackingMission.prototype.createNodeDomElement = function(nodeObj) {
HackingMission.prototype.updateNodeDomElement = function(nodeObj) { HackingMission.prototype.updateNodeDomElement = function(nodeObj) {
if (nodeObj.el == null) { if (nodeObj.el == null) {
console.log("ERR: Calling updateNodeDomElement on a Node without an element"); console.error("Calling updateNodeDomElement on a Node without an element");
return; return;
} }
@ -853,12 +849,12 @@ HackingMission.prototype.getNodeFromElement = function(el) {
id = id.replace("hacking-mission-node-", ""); id = id.replace("hacking-mission-node-", "");
var res = id.split('-'); var res = id.split('-');
if (res.length != 2) { if (res.length != 2) {
console.log("ERROR Parsing Hacking Mission Node Id. Could not find coordinates"); console.error("Parsing hacking mission node id. could not find coordinates");
return null; return null;
} }
var x = res[0], y = res[1]; var x = res[0], y = res[1];
if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) { if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) {
console.log("ERROR: Unexpected values for x and y: " + x + ", " + y); console.error(`Unexpected values (${x}, ${y}) for (x, y)`);
return null; return null;
} }
return this.map[x][y]; return this.map[x][y];
@ -866,7 +862,7 @@ HackingMission.prototype.getNodeFromElement = function(el) {
function selectNode(hackMissionInst, el) { function selectNode(hackMissionInst, el) {
var nodeObj = hackMissionInst.getNodeFromElement(el); var nodeObj = hackMissionInst.getNodeFromElement(el);
if (nodeObj == null) {console.log("Error getting Node object");} if (nodeObj == null) {console.error("Failed getting Node object");}
if (!nodeObj.plyrCtrl) {return;} if (!nodeObj.plyrCtrl) {return;}
clearAllSelectedNodes(hackMissionInst); clearAllSelectedNodes(hackMissionInst);
@ -876,7 +872,7 @@ function selectNode(hackMissionInst, el) {
function multiselectNode(hackMissionInst, el) { function multiselectNode(hackMissionInst, el) {
var nodeObj = hackMissionInst.getNodeFromElement(el); var nodeObj = hackMissionInst.getNodeFromElement(el);
if (nodeObj == null) {console.log("ERROR: Getting Node Object in multiselectNode()");} if (nodeObj == null) {console.error("Failed getting Node Object in multiselectNode()");}
if (!nodeObj.plyrCtrl) {return;} if (!nodeObj.plyrCtrl) {return;}
clearAllSelectedNodes(hackMissionInst); clearAllSelectedNodes(hackMissionInst);
@ -912,7 +908,7 @@ function clearAllSelectedNodes(hackMissionInst) {
*/ */
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.error("Failed getting Node object");}
// Add event listener // Add event listener
var self = this; var self = this;
@ -1239,7 +1235,7 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
calcStats = true; calcStats = true;
break; break;
default: default:
console.log("ERR: Invalid Node Action: " + nodeObj.action); console.error(`Invalid Node Action: ${nodeObj.action}`);
break; break;
} }
@ -1452,7 +1448,7 @@ HackingMission.prototype.enemyAISelectAction = function(nodeObj) {
targetNode = this.getNodeFromElement(nodeObj.conn.targetId); targetNode = this.getNodeFromElement(nodeObj.conn.targetId);
} }
if (targetNode == null) { if (targetNode == null) {
console.log("Error getting Target node Object in enemyAISelectAction()"); console.error("Error getting Target node Object in enemyAISelectAction()");
} }
if (targetNode.def > this.enemyAtk + 15) { if (targetNode.def > this.enemyAtk + 15) {
@ -1529,9 +1525,6 @@ HackingMission.prototype.finishMission = function(win) {
if (win) { if (win) {
var favorMult = 1 + (this.faction.favor / 100); var favorMult = 1 + (this.faction.favor / 100);
console.log("Hacking mission base reward: " + this.reward);
console.log("favorMult: " + favorMult);
console.log("rep mult: " + Player.faction_rep_mult);
var gain = this.reward * Player.faction_rep_mult * favorMult; var gain = this.reward * Player.faction_rep_mult * favorMult;
dialogBoxCreate("Mission won! You earned " + dialogBoxCreate("Mission won! You earned " +
formatNumber(gain, 3) + " reputation with " + this.faction.name); formatNumber(gain, 3) + " reputation with " + this.faction.name);

@ -62,7 +62,7 @@ function Perk(name, reqRep, info) {
Perk.prototype.setCompany = function(companyName) { Perk.prototype.setCompany = function(companyName) {
if (this.factionPerk) { if (this.factionPerk) {
console.log("ERR: Perk cannot be both faction and company perk"); console.error("Perk cannot be both faction and company perk");
return; return;
} }
this.companyPerk = true; this.companyPerk = true;
@ -71,7 +71,7 @@ Perk.prototype.setCompany = function(companyName) {
Perk.prototype.setFaction = function(factionName) { Perk.prototype.setFaction = function(factionName) {
if (this.companyPerk) { if (this.companyPerk) {
console.log("ERR: Perk cannot be both faction and company perk"); console.error("Perk cannot be both faction and company perk");
return; return;
} }
this.factionPerk = true; this.factionPerk = true;
@ -145,7 +145,7 @@ applyPerk = function(perk) {
case PerkNames.InsiderKnowledgeFactionPerk: case PerkNames.InsiderKnowledgeFactionPerk:
break; break;
default: default:
console.log("WARNING: Unrecognized perk: " + perk.name); console.warn(`Unrecognized perk: ${perk.name}`);
return; return;
} }
} }

@ -726,7 +726,7 @@ export function workPartTime(numCycles) {
var comp = Companies[this.companyName], companyRep = "0"; var comp = Companies[this.companyName], companyRep = "0";
if (comp == null || !(comp instanceof Company)) { if (comp == null || !(comp instanceof Company)) {
console.log("ERROR: Could not find Company: " + this.companyName); console.error(`Could not find Company: ${this.companyName}`);
} else { } else {
companyRep = comp.playerReputation; companyRep = comp.playerReputation;
} }
@ -1417,8 +1417,7 @@ export function finishCrime(cancelled) {
} }
} }
if(crime == null) { if(crime == null) {
console.log(this.crimeType); dialogBoxCreate(`ERR: Unrecognized crime type (${this.crimeType}). This is probably a bug please contact the developer`);
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
} }
this.gainMoney(this.workMoneyGained); this.gainMoney(this.workMoneyGained);
this.recordMoneySource(this.workMoneyGained, "crime"); this.recordMoneySource(this.workMoneyGained, "crime");
@ -1529,7 +1528,7 @@ export function singularityStopWork() {
res = this.finishCrime(true); res = this.finishCrime(true);
break; break;
default: default:
console.log("ERROR: Unrecognized work type"); console.error(`Unrecognized work type (${this.workType})`);
return ""; return "";
} }
return res; return res;
@ -1840,7 +1839,7 @@ export function reapplyAllAugmentations(resetMultipliers=true) {
const augName = this.augmentations[i].name; const augName = this.augmentations[i].name;
var aug = Augmentations[augName]; var aug = Augmentations[augName];
if (aug == null) { if (aug == null) {
console.log(`WARNING: Invalid augmentation name in Player.reapplyAllAugmentations(). Aug ${augName} will be skipped`); console.warn(`Invalid augmentation name in Player.reapplyAllAugmentations(). Aug ${augName} will be skipped`);
continue; continue;
} }
aug.owned = true; aug.owned = true;
@ -1862,7 +1861,7 @@ export function reapplyAllSourceFiles() {
var srcFileKey = "SourceFile" + this.sourceFiles[i].n; var srcFileKey = "SourceFile" + this.sourceFiles[i].n;
var sourceFileObject = SourceFiles[srcFileKey]; var sourceFileObject = SourceFiles[srcFileKey];
if (sourceFileObject == null) { if (sourceFileObject == null) {
console.log("ERROR: Invalid source file number: " + this.sourceFiles[i].n); console.error(`Invalid source file number: ${this.sourceFiles[i].n}`);
continue; continue;
} }
applySourceFile(this.sourceFiles[i]); applySourceFile(this.sourceFiles[i]);
@ -2003,7 +2002,7 @@ export function checkForFactionInvitations() {
var fulcrumsecrettechonologiesFac = Factions["Fulcrum Secret Technologies"]; var fulcrumsecrettechonologiesFac = Factions["Fulcrum Secret Technologies"];
var fulcrumSecretServer = AllServers[SpecialServerIps[SpecialServerNames.FulcrumSecretTechnologies]]; var fulcrumSecretServer = AllServers[SpecialServerIps[SpecialServerNames.FulcrumSecretTechnologies]];
if (fulcrumSecretServer == null) { if (fulcrumSecretServer == null) {
console.log("ERROR: Could not find Fulcrum Secret Technologies Server"); console.error("Could not find Fulcrum Secret Technologies Server");
} else { } else {
if (!fulcrumsecrettechonologiesFac.isBanned && !fulcrumsecrettechonologiesFac.isMember && if (!fulcrumsecrettechonologiesFac.isBanned && !fulcrumsecrettechonologiesFac.isMember &&
!fulcrumsecrettechonologiesFac.alreadyInvited && !fulcrumsecrettechonologiesFac.alreadyInvited &&
@ -2018,7 +2017,7 @@ export function checkForFactionInvitations() {
var homeComp = this.getHomeComputer(); var homeComp = this.getHomeComputer();
var bitrunnersServer = AllServers[SpecialServerIps[SpecialServerNames.BitRunnersServer]]; var bitrunnersServer = AllServers[SpecialServerIps[SpecialServerNames.BitRunnersServer]];
if (bitrunnersServer == null) { if (bitrunnersServer == null) {
console.log("ERROR: Could not find BitRunners Server"); console.error("Could not find BitRunners Server");
} else if (!bitrunnersFac.isBanned && !bitrunnersFac.isMember && bitrunnersServer.manuallyHacked && } else if (!bitrunnersFac.isBanned && !bitrunnersFac.isMember && bitrunnersServer.manuallyHacked &&
!bitrunnersFac.alreadyInvited && this.hacking_skill >= 500 && homeComp.maxRam >= 128) { !bitrunnersFac.alreadyInvited && this.hacking_skill >= 500 && homeComp.maxRam >= 128) {
invitedFactions.push(bitrunnersFac); invitedFactions.push(bitrunnersFac);
@ -2028,7 +2027,7 @@ export function checkForFactionInvitations() {
var theblackhandFac = Factions["The Black Hand"]; var theblackhandFac = Factions["The Black Hand"];
var blackhandServer = AllServers[SpecialServerIps[SpecialServerNames.TheBlackHandServer]]; var blackhandServer = AllServers[SpecialServerIps[SpecialServerNames.TheBlackHandServer]];
if (blackhandServer == null) { if (blackhandServer == null) {
console.log("ERROR: Could not find The Black Hand Server"); console.error("Could not find The Black Hand Server");
} else if (!theblackhandFac.isBanned && !theblackhandFac.isMember && blackhandServer.manuallyHacked && } else if (!theblackhandFac.isBanned && !theblackhandFac.isMember && blackhandServer.manuallyHacked &&
!theblackhandFac.alreadyInvited && this.hacking_skill >= 350 && homeComp.maxRam >= 64) { !theblackhandFac.alreadyInvited && this.hacking_skill >= 350 && homeComp.maxRam >= 64) {
invitedFactions.push(theblackhandFac); invitedFactions.push(theblackhandFac);
@ -2038,7 +2037,7 @@ export function checkForFactionInvitations() {
var nitesecFac = Factions["NiteSec"]; var nitesecFac = Factions["NiteSec"];
var nitesecServer = AllServers[SpecialServerIps[SpecialServerNames.NiteSecServer]]; var nitesecServer = AllServers[SpecialServerIps[SpecialServerNames.NiteSecServer]];
if (nitesecServer == null) { if (nitesecServer == null) {
console.log("ERROR: Could not find NiteSec Server"); console.error("Could not find NiteSec Server");
} else if (!nitesecFac.isBanned && !nitesecFac.isMember && nitesecServer.manuallyHacked && } else if (!nitesecFac.isBanned && !nitesecFac.isMember && nitesecServer.manuallyHacked &&
!nitesecFac.alreadyInvited && this.hacking_skill >= 200 && homeComp.maxRam >= 32) { !nitesecFac.alreadyInvited && this.hacking_skill >= 200 && homeComp.maxRam >= 32) {
invitedFactions.push(nitesecFac); invitedFactions.push(nitesecFac);
@ -2182,7 +2181,7 @@ export function checkForFactionInvitations() {
var cybersecFac = Factions["CyberSec"]; var cybersecFac = Factions["CyberSec"];
var cybersecServer = AllServers[SpecialServerIps[SpecialServerNames.CyberSecServer]]; var cybersecServer = AllServers[SpecialServerIps[SpecialServerNames.CyberSecServer]];
if (cybersecServer == null) { if (cybersecServer == null) {
console.log("ERROR: Could not find CyberSec Server"); console.error("Could not find CyberSec Server");
} else if (!cybersecFac.isBanned && !cybersecFac.isMember && cybersecServer.manuallyHacked && } else if (!cybersecFac.isBanned && !cybersecFac.isMember && cybersecServer.manuallyHacked &&
!cybersecFac.alreadyInvited && this.hacking_skill >= 50) { !cybersecFac.alreadyInvited && this.hacking_skill >= 50) {
invitedFactions.push(cybersecFac); invitedFactions.push(cybersecFac);
@ -2199,14 +2198,14 @@ export function setBitNodeNumber(n) {
export function queueAugmentation(name) { export function queueAugmentation(name) {
for(const i in this.queuedAugmentations) { for(const i in this.queuedAugmentations) {
if(this.queuedAugmentations[i].name == name) { if(this.queuedAugmentations[i].name == name) {
console.log('tried to queue '+name+' twice, this may be a bug'); console.warn(`tried to queue ${name} twice, this may be a bug`);
return; return;
} }
} }
for(const i in this.augmentations) { for(const i in this.augmentations) {
if(this.augmentations[i].name == name) { if(this.augmentations[i].name == name) {
console.log('tried to queue '+name+' but we already have that aug'); console.warn(`tried to queue ${name} twice, this may be a bug`);
return; return;
} }
} }

@ -96,7 +96,7 @@ function hackWorldDaemon(currentNodeNumber, flume=false) {
}).then(function() { }).then(function() {
return loadBitVerse(currentNodeNumber, flume); return loadBitVerse(currentNodeNumber, flume);
}).catch(function(e){ }).catch(function(e){
console.log("ERROR: " + e.toString()); console.error(e.toString());
}); });
} }
@ -104,7 +104,7 @@ function giveSourceFile(bitNodeNumber) {
var sourceFileKey = "SourceFile"+ bitNodeNumber.toString(); var sourceFileKey = "SourceFile"+ bitNodeNumber.toString();
var sourceFile = SourceFiles[sourceFileKey]; var sourceFile = SourceFiles[sourceFileKey];
if (sourceFile == null) { if (sourceFile == null) {
console.log("ERROR: could not find source file for Bit node: " + bitNodeNumber); console.error(`Could not find source file for Bit node: ${bitNodeNumber}`);
return; return;
} }
@ -264,7 +264,7 @@ function loadBitVerse(destroyedBitNodeNum, flume=false) {
}).then(function() { }).then(function() {
return Promise.resolve(true); return Promise.resolve(true);
}).catch(function(e){ }).catch(function(e){
console.log("ERROR: " + e.toString()); console.error(e.toString());
}); });
} }
@ -308,7 +308,6 @@ function createBitNodeYesNoEventListener(newBitNode, destroyedBitNode, flume=fal
// Set new Bit Node // Set new Bit Node
Player.bitNodeN = newBitNode; Player.bitNodeN = newBitNode;
console.log(`Entering Bit Node ${Player.bitNodeN}`);
// Reenable terminal // Reenable terminal
$("#hack-progress-bar").attr('id', "old-hack-progress-bar"); $("#hack-progress-bar").attr('id', "old-hack-progress-bar");

@ -322,7 +322,7 @@ function loadImportedGame(saveObj, saveString) {
try { try {
tempAliases = JSON.parse(tempSaveObj.AliasesSave, Reviver); tempAliases = JSON.parse(tempSaveObj.AliasesSave, Reviver);
} catch(e) { } catch(e) {
console.log("Parsing Aliases save failed: " + e); console.error(`Parsing Aliases save failed: ${e}`);
tempAliases = {}; tempAliases = {};
} }
} else { } else {
@ -332,7 +332,7 @@ function loadImportedGame(saveObj, saveString) {
try { try {
tempGlobalAliases = JSON.parse(tempSaveObj.AliasesSave, Reviver); tempGlobalAliases = JSON.parse(tempSaveObj.AliasesSave, Reviver);
} catch(e) { } catch(e) {
console.log("Parsing Global Aliases save failed: " + e); console.error(`Parsing Global Aliases save failed: ${e}`);
tempGlobalAliases = {}; tempGlobalAliases = {};
} }
} else { } else {
@ -342,7 +342,7 @@ function loadImportedGame(saveObj, saveString) {
try { try {
tempMessages = JSON.parse(tempSaveObj.MessagesSave, Reviver); tempMessages = JSON.parse(tempSaveObj.MessagesSave, Reviver);
} catch(e) { } catch(e) {
console.log("Parsing Messages save failed: " + e); console.error(`Parsing Messages save failed: ${e}`);
initMessages(); initMessages();
} }
} else { } else {
@ -352,7 +352,7 @@ function loadImportedGame(saveObj, saveString) {
try { try {
tempStockMarket = JSON.parse(tempSaveObj.StockMarketSave, Reviver); tempStockMarket = JSON.parse(tempSaveObj.StockMarketSave, Reviver);
} catch(e) { } catch(e) {
console.log("Parsing StockMarket save failed: " + e); console.error(`Parsing StockMarket save failed: ${e}`);
tempStockMarket = {}; tempStockMarket = {};
} }
} else { } else {
@ -479,7 +479,6 @@ function loadImportedGame(saveObj, saveString) {
gameOptionsBoxClose(); gameOptionsBoxClose();
// Re-start game // Re-start game
console.log("Importing game");
Engine.setDisplayElements(); // Sets variables for important DOM elements Engine.setDisplayElements(); // Sets variables for important DOM elements
Engine.init(); // Initialize buttons, work, etc. Engine.init(); // Initialize buttons, work, etc.
@ -491,7 +490,6 @@ function loadImportedGame(saveObj, saveString) {
// 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");
if (Player.workType == CONSTANTS.WorkTypeFaction) { if (Player.workType == CONSTANTS.WorkTypeFaction) {
Player.workForFaction(numCyclesOffline); Player.workForFaction(numCyclesOffline);
} else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) { } else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
@ -588,7 +586,7 @@ BitburnerSaveObject.prototype.deleteGame = function(db) {
console.log("Successfully deleted save from indexedDb"); console.log("Successfully deleted save from indexedDb");
} }
request.onerror = function(e) { request.onerror = function(e) {
console.log("Failed to delete save from indexedDb: " + e); console.error(`Failed to delete save from indexedDb: ${e}`);
} }
createStatusText("Game deleted!"); createStatusText("Game deleted!");
} }

@ -167,7 +167,7 @@ async function parseOnlyRamCalculate(otherScripts, code, workerScript) {
} }
return 0; return 0;
} catch(e) { } catch(e) {
console.log("ERROR applying function: " + e); console.error(`Error applying function: ${e}`);
return 0; return 0;
} }
} else { } else {

@ -167,7 +167,6 @@ export function getCurrentEditor() {
case EditorSetting.CodeMirror: case EditorSetting.CodeMirror:
return CodeMirrorEditor; return CodeMirrorEditor;
default: default:
console.log(`Invalid Editor Setting: ${Settings.Editor}`);
throw new Error(`Invalid Editor Setting: ${Settings.Editor}`); throw new Error(`Invalid Editor Setting: ${Settings.Editor}`);
return null; return null;
} }
@ -334,7 +333,6 @@ export function scriptCalculateOfflineProduction(runningScriptObj) {
var serv = AllServers[ip]; var serv = AllServers[ip];
if (serv == null) {continue;} if (serv == null) {continue;}
var timesGrown = Math.round(0.5 * runningScriptObj.dataMap[ip][2] / runningScriptObj.onlineRunningTime * timePassed); var timesGrown = Math.round(0.5 * runningScriptObj.dataMap[ip][2] / runningScriptObj.onlineRunningTime * timePassed);
console.log(runningScriptObj.filename + " called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
runningScriptObj.log("Called grow() on " + serv.hostname + " " + timesGrown + " times while offline"); runningScriptObj.log("Called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
var growth = processSingleServerGrowth(serv, timesGrown * 450, Player); var growth = processSingleServerGrowth(serv, timesGrown * 450, Player);
runningScriptObj.log(serv.hostname + " grown by " + numeralWrapper.format(growth * 100 - 100, '0.000000%') + " from grow() calls made while offline"); runningScriptObj.log(serv.hostname + " grown by " + numeralWrapper.format(growth * 100 - 100, '0.000000%') + " from grow() calls made while offline");
@ -356,7 +354,6 @@ export function scriptCalculateOfflineProduction(runningScriptObj) {
totalOfflineProduction += production; totalOfflineProduction += production;
Player.gainMoney(production); Player.gainMoney(production);
Player.recordMoneySource(production, "hacking"); Player.recordMoneySource(production, "hacking");
console.log(runningScriptObj.filename + " generated $" + production + " while offline by hacking " + serv.hostname);
runningScriptObj.log(runningScriptObj.filename + " generated $" + production + " while offline by hacking " + serv.hostname); runningScriptObj.log(runningScriptObj.filename + " generated $" + production + " while offline by hacking " + serv.hostname);
serv.moneyAvailable -= production; serv.moneyAvailable -= production;
if (serv.moneyAvailable < 0) {serv.moneyAvailable = 0;} if (serv.moneyAvailable < 0) {serv.moneyAvailable = 0;}
@ -383,7 +380,6 @@ export function scriptCalculateOfflineProduction(runningScriptObj) {
var serv = AllServers[ip]; var serv = AllServers[ip];
if (serv == null) {continue;} if (serv == null) {continue;}
var timesHacked = Math.round(0.5 * runningScriptObj.dataMap[ip][1] / runningScriptObj.onlineRunningTime * timePassed); var timesHacked = Math.round(0.5 * runningScriptObj.dataMap[ip][1] / runningScriptObj.onlineRunningTime * timePassed);
console.log(runningScriptObj.filename + " hacked " + serv.hostname + " " + timesHacked + " times while offline");
runningScriptObj.log("Hacked " + serv.hostname + " " + timesHacked + " times while offline"); runningScriptObj.log("Hacked " + serv.hostname + " " + timesHacked + " times while offline");
serv.fortify(CONSTANTS.ServerFortifyAmount * timesHacked); serv.fortify(CONSTANTS.ServerFortifyAmount * timesHacked);
} }
@ -396,7 +392,6 @@ export function scriptCalculateOfflineProduction(runningScriptObj) {
var serv = AllServers[ip]; var serv = AllServers[ip];
if (serv == null) {continue;} if (serv == null) {continue;}
var timesWeakened = Math.round(0.5 * runningScriptObj.dataMap[ip][3] / runningScriptObj.onlineRunningTime * timePassed); var timesWeakened = Math.round(0.5 * runningScriptObj.dataMap[ip][3] / runningScriptObj.onlineRunningTime * timePassed);
console.log(runningScriptObj.filename + " called weaken() on " + serv.hostname + " " + timesWeakened + " times while offline");
runningScriptObj.log("Called weaken() on " + serv.hostname + " " + timesWeakened + " times while offline"); runningScriptObj.log("Called weaken() on " + serv.hostname + " " + timesWeakened + " times while offline");
serv.weaken(CONSTANTS.ServerWeakenAmount * timesWeakened); serv.weaken(CONSTANTS.ServerWeakenAmount * timesWeakened);
} }

@ -74,7 +74,7 @@ export function processSingleServerGrowth(server: Server, numCycles: number, p:
//Apply serverGrowth for the calculated number of growth cycles //Apply serverGrowth for the calculated number of growth cycles
let serverGrowth = Math.pow(adjGrowthRate, numServerGrowthCyclesAdjusted * p.hacking_grow_mult); let serverGrowth = Math.pow(adjGrowthRate, numServerGrowthCyclesAdjusted * p.hacking_grow_mult);
if (serverGrowth < 1) { if (serverGrowth < 1) {
console.log("WARN: serverGrowth calculated to be less than 1"); console.warn("serverGrowth calculated to be less than 1");
serverGrowth = 1; serverGrowth = 1;
} }

@ -168,7 +168,7 @@ export function applySourceFile(srcFile: PlayerOwnedSourceFile) {
Player.work_money_mult *= inc; Player.work_money_mult *= inc;
break; break;
default: default:
console.log("ERROR: Invalid source file number: " + srcFile.n); console.error(`Invalid source file number: ${srcFile.n}`);
break; break;
} }

@ -1766,7 +1766,6 @@ let Terminal = {
}`; }`;
} }
console.log('default code');
Engine.loadScriptEditorContent(filepath, code); Engine.loadScriptEditorContent(filepath, code);
} else { } else {
Engine.loadScriptEditorContent(filepath, script.code); Engine.loadScriptEditorContent(filepath, script.code);

@ -1079,7 +1079,6 @@ const Engine = {
// 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");
if (Player.workType == CONSTANTS.WorkTypeFaction) { if (Player.workType == CONSTANTS.WorkTypeFaction) {
Player.workForFaction(numCyclesOffline); Player.workForFaction(numCyclesOffline);
} else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) { } else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
@ -1180,7 +1179,6 @@ const Engine = {
Engine.closeMainMenuHeader(visibleMenuTabs); Engine.closeMainMenuHeader(visibleMenuTabs);
} else { } else {
// No save found, start new game // No save found, start new game
console.log("Initializing new game");
initBitNodeMultipliers(Player); initBitNodeMultipliers(Player);
initSpecialServerIps(); initSpecialServerIps();
Engine.setDisplayElements(); // Sets variables for important DOM elements Engine.setDisplayElements(); // Sets variables for important DOM elements
@ -1525,7 +1523,6 @@ const Engine = {
// DEBUG Delete active Scripts on home // DEBUG Delete active Scripts on home
document.getElementById("debug-delete-scripts-link").addEventListener("click", function() { document.getElementById("debug-delete-scripts-link").addEventListener("click", function() {
console.log("Deleting running scripts on home computer");
Player.getHomeComputer().runningScripts = []; Player.getHomeComputer().runningScripts = [];
dialogBoxCreate("Forcefully deleted all running scripts on home computer. Please save and refresh page"); dialogBoxCreate("Forcefully deleted all running scripts on home computer. Please save and refresh page");
gameOptionsBoxClose(); gameOptionsBoxClose();