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) {
var aug = Augmentations[Player.queuedAugmentations[i].name];
if (aug == null) {
console.log("ERROR. Invalid augmentation");
console.error(`Invalid augmentation: ${Player.queuedAugmentations[i].name}`);
continue;
}
applyAugmentation(Player.queuedAugmentations[i]);

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

@ -495,7 +495,7 @@ Action.prototype.getSuccessChance = function(inst, params={}) {
var key = "eff" + stat.charAt(0).toUpperCase() + stat.slice(1);
var effMultiplier = inst.skillMultipliers[key];
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;
}
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) {
if (this.action.type === ActionTypes["Idle"]) {return;}
if (this.actionTimeToComplete <= 0) {
console.log("action.type: " + this.action.type);
throw new Error("Invalid actionTimeToComplete value: " + this.actionTimeToComplete);
throw new Error(`Invalid actionTimeToComplete value: ${this.actionTimeToComplete}, type; ${this.action.type}`);
}
if (!(this.action instanceof ActionIdentifier)) {
throw new Error("Bladeburner.action is not an ActionIdentifier Object");
@ -1720,7 +1719,7 @@ Bladeburner.prototype.randomEvent = function() {
Bladeburner.prototype.triggerPotentialMigration = function(sourceCityName, 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 (Math.random() < chance) {this.triggerMigration(sourceCityName);}
@ -2310,7 +2309,7 @@ Bladeburner.prototype.createSkillsContent = function() {
// TODO in the future if items are ever implemented
break;
default:
console.log("Warning: Unrecognized SkillMult Key: " + multKeys[i]);
console.warn(`Unrecognized SkillMult Key: ${multKeys[i]}`);
break;
}
}
@ -3022,7 +3021,6 @@ Bladeburner.prototype.parseCommandArguments = function(command) {
++i;
}
if (start !== i) {args.push(command.substr(start, i-start));}
console.log("Bladeburner console command parsing returned: " + args);
return args;
}
@ -3286,7 +3284,7 @@ Bladeburner.prototype.executeSkillConsoleCommand = function(args) {
// TODO if items are ever implemented
break;
default:
console.log("Warning: Unrecognized SkillMult Key: " + multKeys[i]);
console.warn(`Unrecognized SkillMult Key: ${multKeys[i]}`);
break;
}
}

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

@ -153,7 +153,6 @@ export class Product {
const opsRatio = employeeProd[EmployeePositions.Operations] / employeeProd["total"];
const busRatio = employeeProd[EmployeePositions.Business] / employeeProd["total"];
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) +
(1.5 * opsRatio) + (busRatio);
var sciMult = 1 + (Math.pow(industry.sciResearch.qty, industry.sciFac) / 800);
@ -221,7 +220,7 @@ export class Product {
calculateRating(industry: IIndustry): void {
const weights: IProductRatingWeight = ProductRatingWeights[industry.type];
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;
}
this.rat = 0;

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

@ -91,7 +91,7 @@ function parseFconfSetting(setting, value) {
setting = String(setting);
value = String(value);
if (setting == null || value == null || FconfSettings[setting] == null) {
console.log("WARNING: Invalid .fconf setting: " + setting);
console.warn(`Invalid .fconf setting: ${setting}`);
return;
}
@ -184,7 +184,7 @@ function setTheme() {
FconfSettings.THEME_FONT_COLOR == null ||
FconfSettings.THEME_BACKGROUND_COLOR == null ||
FconfSettings.THEME_PROMPT_COLOR == null) {
console.log("ERROR: Cannot find Theme Settings");
console.error("Cannot find Theme Settings");
return;
}
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
Engine.Counters.autoSaveCounter = Infinity;
console.log("Interactive Tutorial started");
ITutorial.currStep = 0;
ITutorial.isRunning = true;
@ -100,7 +99,7 @@ function iTutorialStart() {
}
function iTutorialEvaluateStep() {
if (!ITutorial.isRunning) {console.log("Interactive Tutorial not running"); return;}
if (!ITutorial.isRunning) {return;}
// Disable and clear main menu
var terminalMainMenu = clearEventListeners("terminal-menu-link");
@ -476,8 +475,6 @@ function iTutorialEnd() {
Engine.Counters.autoSaveCounter = Settings.AutosaveInterval * 5;
}
console.log("Ending interactive tutorial");
// Initialize references to main menu links
// We have to call initializeMainMenuLinks() again because the Interactive Tutorial
// re-creates Main menu links with clearEventListeners()

@ -165,7 +165,7 @@ Node.prototype.deselect = function(actionButtons) {
Node.prototype.untarget = function() {
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;
}
--this.targetedCount;
@ -214,7 +214,6 @@ function HackingMission(rep, fac) {
this.jsplumbinstance = null;
this.difficulty = rep / CONSTANTS.HackingMissionRepToDiffConversion + 1;
console.log("difficulty: " + this.difficulty);
this.reward = 250 + (rep / CONSTANTS.HackingMissionRepToRewardConversion);
}
@ -408,7 +407,7 @@ HackingMission.prototype.createPageDom = function() {
// Set Action Button event listeners
this.actionButtons[0].addEventListener("click", ()=>{
if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node");
console.error("Pressing Action button without selected node");
return;
}
if (this.selectedNode[0].type !== NodeTypes.Core) {return;}
@ -421,7 +420,7 @@ HackingMission.prototype.createPageDom = function() {
this.actionButtons[1].addEventListener("click", ()=>{
if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node");
console.error("Pressing Action button without selected node");
return;
}
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", ()=>{
if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node");
console.error("Pressing Action button without selected node");
return;
}
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", ()=>{
if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node");
console.error("Pressing Action button without selected node");
return;
}
this.setActionButtonsActive(this.selectedNode[0].type);
@ -461,7 +460,7 @@ HackingMission.prototype.createPageDom = function() {
this.actionButtons[4].addEventListener("click", ()=>{
if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node");
console.error("Pressing Action button without selected node");
return;
}
var nodeType = this.selectedNode[0].type;
@ -475,7 +474,7 @@ HackingMission.prototype.createPageDom = function() {
this.actionButtons[5].addEventListener("click", ()=>{
if (!(this.selectedNode.length > 0)) {
console.log("ERR: Pressing Action button without selected node");
console.error("Pressing Action button without selected node");
return;
}
this.selectedNode.forEach(function(node){
@ -637,18 +636,16 @@ HackingMission.prototype.removeAvailablePosition = function(x, y) {
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) {
if (!(nodeObj instanceof Node)) {
console.log("WARNING: Non-Node object passed into setNodePOsition");
console.warn("Non-Node object passed into setNodePOsition");
return;
}
if (isNaN(x) || isNaN(y)) {
console.log("ERR: Invalid values passed as x and y for setNodePosition");
console.log(x);
console.log(y);
console.error(`Invalid values (${x}, ${y}) passed as (x, y) for setNodePosition`);
return;
}
nodeObj.pos = [x, y];
@ -725,7 +722,6 @@ HackingMission.prototype.createMap = function() {
// Configure all Player CPUS
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);
}
}
@ -793,7 +789,7 @@ HackingMission.prototype.createNodeDomElement = function(nodeObj) {
HackingMission.prototype.updateNodeDomElement = function(nodeObj) {
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;
}
@ -853,12 +849,12 @@ HackingMission.prototype.getNodeFromElement = function(el) {
id = id.replace("hacking-mission-node-", "");
var res = id.split('-');
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;
}
var x = res[0], y = res[1];
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 this.map[x][y];
@ -866,7 +862,7 @@ HackingMission.prototype.getNodeFromElement = function(el) {
function selectNode(hackMissionInst, 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;}
clearAllSelectedNodes(hackMissionInst);
@ -876,7 +872,7 @@ function selectNode(hackMissionInst, el) {
function multiselectNode(hackMissionInst, 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;}
clearAllSelectedNodes(hackMissionInst);
@ -912,7 +908,7 @@ function clearAllSelectedNodes(hackMissionInst) {
*/
HackingMission.prototype.configurePlayerNodeElement = function(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
var self = this;
@ -1239,7 +1235,7 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
calcStats = true;
break;
default:
console.log("ERR: Invalid Node Action: " + nodeObj.action);
console.error(`Invalid Node Action: ${nodeObj.action}`);
break;
}
@ -1452,7 +1448,7 @@ HackingMission.prototype.enemyAISelectAction = function(nodeObj) {
targetNode = this.getNodeFromElement(nodeObj.conn.targetId);
}
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) {
@ -1529,9 +1525,6 @@ HackingMission.prototype.finishMission = function(win) {
if (win) {
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;
dialogBoxCreate("Mission won! You earned " +
formatNumber(gain, 3) + " reputation with " + this.faction.name);

@ -62,7 +62,7 @@ function Perk(name, reqRep, info) {
Perk.prototype.setCompany = function(companyName) {
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;
}
this.companyPerk = true;
@ -71,7 +71,7 @@ Perk.prototype.setCompany = function(companyName) {
Perk.prototype.setFaction = function(factionName) {
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;
}
this.factionPerk = true;
@ -145,7 +145,7 @@ applyPerk = function(perk) {
case PerkNames.InsiderKnowledgeFactionPerk:
break;
default:
console.log("WARNING: Unrecognized perk: " + perk.name);
console.warn(`Unrecognized perk: ${perk.name}`);
return;
}
}

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

@ -96,7 +96,7 @@ function hackWorldDaemon(currentNodeNumber, flume=false) {
}).then(function() {
return loadBitVerse(currentNodeNumber, flume);
}).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 sourceFile = SourceFiles[sourceFileKey];
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;
}
@ -264,7 +264,7 @@ function loadBitVerse(destroyedBitNodeNum, flume=false) {
}).then(function() {
return Promise.resolve(true);
}).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
Player.bitNodeN = newBitNode;
console.log(`Entering Bit Node ${Player.bitNodeN}`);
// Reenable terminal
$("#hack-progress-bar").attr('id', "old-hack-progress-bar");

@ -322,7 +322,7 @@ function loadImportedGame(saveObj, saveString) {
try {
tempAliases = JSON.parse(tempSaveObj.AliasesSave, Reviver);
} catch(e) {
console.log("Parsing Aliases save failed: " + e);
console.error(`Parsing Aliases save failed: ${e}`);
tempAliases = {};
}
} else {
@ -332,7 +332,7 @@ function loadImportedGame(saveObj, saveString) {
try {
tempGlobalAliases = JSON.parse(tempSaveObj.AliasesSave, Reviver);
} catch(e) {
console.log("Parsing Global Aliases save failed: " + e);
console.error(`Parsing Global Aliases save failed: ${e}`);
tempGlobalAliases = {};
}
} else {
@ -342,7 +342,7 @@ function loadImportedGame(saveObj, saveString) {
try {
tempMessages = JSON.parse(tempSaveObj.MessagesSave, Reviver);
} catch(e) {
console.log("Parsing Messages save failed: " + e);
console.error(`Parsing Messages save failed: ${e}`);
initMessages();
}
} else {
@ -352,7 +352,7 @@ function loadImportedGame(saveObj, saveString) {
try {
tempStockMarket = JSON.parse(tempSaveObj.StockMarketSave, Reviver);
} catch(e) {
console.log("Parsing StockMarket save failed: " + e);
console.error(`Parsing StockMarket save failed: ${e}`);
tempStockMarket = {};
}
} else {
@ -479,7 +479,6 @@ function loadImportedGame(saveObj, saveString) {
gameOptionsBoxClose();
// Re-start game
console.log("Importing game");
Engine.setDisplayElements(); // Sets variables for important DOM elements
Engine.init(); // Initialize buttons, work, etc.
@ -491,7 +490,6 @@ function loadImportedGame(saveObj, saveString) {
// Process offline progress
var offlineProductionFromScripts = loadAllRunningScripts(); // This also takes care of offline production for those scripts
if (Player.isWorking) {
console.log("work() called in load() for " + numCyclesOffline * Engine._idleSpeed + " milliseconds");
if (Player.workType == CONSTANTS.WorkTypeFaction) {
Player.workForFaction(numCyclesOffline);
} else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
@ -588,7 +586,7 @@ BitburnerSaveObject.prototype.deleteGame = function(db) {
console.log("Successfully deleted save from indexedDb");
}
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!");
}

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

@ -167,7 +167,6 @@ export function getCurrentEditor() {
case EditorSetting.CodeMirror:
return CodeMirrorEditor;
default:
console.log(`Invalid Editor Setting: ${Settings.Editor}`);
throw new Error(`Invalid Editor Setting: ${Settings.Editor}`);
return null;
}
@ -334,7 +333,6 @@ export function scriptCalculateOfflineProduction(runningScriptObj) {
var serv = AllServers[ip];
if (serv == null) {continue;}
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");
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");
@ -356,7 +354,6 @@ export function scriptCalculateOfflineProduction(runningScriptObj) {
totalOfflineProduction += production;
Player.gainMoney(production);
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);
serv.moneyAvailable -= production;
if (serv.moneyAvailable < 0) {serv.moneyAvailable = 0;}
@ -383,7 +380,6 @@ export function scriptCalculateOfflineProduction(runningScriptObj) {
var serv = AllServers[ip];
if (serv == null) {continue;}
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");
serv.fortify(CONSTANTS.ServerFortifyAmount * timesHacked);
}
@ -396,7 +392,6 @@ export function scriptCalculateOfflineProduction(runningScriptObj) {
var serv = AllServers[ip];
if (serv == null) {continue;}
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");
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
let serverGrowth = Math.pow(adjGrowthRate, numServerGrowthCyclesAdjusted * p.hacking_grow_mult);
if (serverGrowth < 1) {
console.log("WARN: serverGrowth calculated to be less than 1");
console.warn("serverGrowth calculated to be less than 1");
serverGrowth = 1;
}

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

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

@ -1079,7 +1079,6 @@ const Engine = {
// Process offline progress
var offlineProductionFromScripts = loadAllRunningScripts(); // This also takes care of offline production for those scripts
if (Player.isWorking) {
console.log("work() called in load() for " + numCyclesOffline * Engine._idleSpeed + " milliseconds");
if (Player.workType == CONSTANTS.WorkTypeFaction) {
Player.workForFaction(numCyclesOffline);
} else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
@ -1180,7 +1179,6 @@ const Engine = {
Engine.closeMainMenuHeader(visibleMenuTabs);
} else {
// No save found, start new game
console.log("Initializing new game");
initBitNodeMultipliers(Player);
initSpecialServerIps();
Engine.setDisplayElements(); // Sets variables for important DOM elements
@ -1525,7 +1523,6 @@ const Engine = {
// DEBUG Delete active Scripts on home
document.getElementById("debug-delete-scripts-link").addEventListener("click", function() {
console.log("Deleting running scripts on home computer");
Player.getHomeComputer().runningScripts = [];
dialogBoxCreate("Forcefully deleted all running scripts on home computer. Please save and refresh page");
gameOptionsBoxClose();