mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
Replaced strict equality comparisons for null with loose eq comparisons
This commit is contained in:
parent
7614c62507
commit
7c4ac00f5a
76
dist/bundle.js
vendored
76
dist/bundle.js
vendored
@ -21805,7 +21805,7 @@ function NetscriptFunctions(workerScript) {
|
||||
workerScript.scriptRef.log(args.toString());
|
||||
},
|
||||
tprint : function(args) {
|
||||
if (args === undefined || args === null) {
|
||||
if (args === undefined || args == null) {
|
||||
throw Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "tprint() call has incorrect number of arguments. Takes 1 argument");
|
||||
}
|
||||
var x = args.toString();
|
||||
@ -22140,7 +22140,7 @@ function NetscriptFunctions(workerScript) {
|
||||
throw Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "ls() failed because of invalid arguments. Usage: ls(ip/hostname, [grep filter])");
|
||||
}
|
||||
var server = Object(__WEBPACK_IMPORTED_MODULE_15__Server_js__["e" /* getServer */])(ip);
|
||||
if (server === null) {
|
||||
if (server == null) {
|
||||
workerScript.scriptRef.log("ls() failed. Invalid IP or hostname passed in: " + ip);
|
||||
throw Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "ls() failed. Invalid IP or hostname passed in: " + ip);
|
||||
}
|
||||
@ -22714,11 +22714,11 @@ function NetscriptFunctions(workerScript) {
|
||||
} else if (Object(__WEBPACK_IMPORTED_MODULE_28__utils_StringHelperFunctions_js__["f" /* isString */])(port)) { //Write to text file
|
||||
var fn = port;
|
||||
var server = Object(__WEBPACK_IMPORTED_MODULE_15__Server_js__["e" /* getServer */])(workerScript.serverIp);
|
||||
if (server === null) {
|
||||
if (server == null) {
|
||||
throw Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error getting Server for this script in write(). This is a bug please contact game dev");
|
||||
}
|
||||
var txtFile = Object(__WEBPACK_IMPORTED_MODULE_20__TextFile_js__["b" /* getTextFile */])(fn, server);
|
||||
if (txtFile === null) {
|
||||
if (txtFile == null) {
|
||||
txtFile = Object(__WEBPACK_IMPORTED_MODULE_20__TextFile_js__["a" /* createTextFile */])(fn, data, server);
|
||||
return true;
|
||||
}
|
||||
@ -22751,7 +22751,7 @@ function NetscriptFunctions(workerScript) {
|
||||
} else if (Object(__WEBPACK_IMPORTED_MODULE_28__utils_StringHelperFunctions_js__["f" /* isString */])(port)) { //Read from text file
|
||||
var fn = port;
|
||||
var server = Object(__WEBPACK_IMPORTED_MODULE_15__Server_js__["e" /* getServer */])(workerScript.serverIp);
|
||||
if (server === null) {
|
||||
if (server == null) {
|
||||
throw Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error getting Server for this script in read(). This is a bug please contact game dev");
|
||||
}
|
||||
var txtFile = Object(__WEBPACK_IMPORTED_MODULE_20__TextFile_js__["b" /* getTextFile */])(fn, server);
|
||||
@ -22839,7 +22839,7 @@ function NetscriptFunctions(workerScript) {
|
||||
} else {
|
||||
//Get income for a particular script
|
||||
var server = Object(__WEBPACK_IMPORTED_MODULE_15__Server_js__["e" /* getServer */])(ip);
|
||||
if (server === null) {
|
||||
if (server == null) {
|
||||
workerScript.scriptRef.log("getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip);
|
||||
throw Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip);
|
||||
}
|
||||
@ -22865,7 +22865,7 @@ function NetscriptFunctions(workerScript) {
|
||||
} else {
|
||||
//Get income for a particular script
|
||||
var server = Object(__WEBPACK_IMPORTED_MODULE_15__Server_js__["e" /* getServer */])(ip);
|
||||
if (server === null) {
|
||||
if (server == null) {
|
||||
workerScript.scriptRef.log("getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip);
|
||||
throw Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip);
|
||||
}
|
||||
@ -23393,7 +23393,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
|
||||
var company = __WEBPACK_IMPORTED_MODULE_4__Company_js__["a" /* Companies */][companyName];
|
||||
if (company === null || !(company instanceof __WEBPACK_IMPORTED_MODULE_4__Company_js__["b" /* Company */])) {
|
||||
if (company == null || !(company instanceof __WEBPACK_IMPORTED_MODULE_4__Company_js__["b" /* Company */])) {
|
||||
workerScript.scriptRef.log("ERROR: Invalid companyName passed into getCompanyRep(): " + companyName);
|
||||
return -1;
|
||||
}
|
||||
@ -23801,7 +23801,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
|
||||
var fac = __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][faction];
|
||||
if (fac === null || !(fac instanceof __WEBPACK_IMPORTED_MODULE_9__Faction_js__["a" /* Faction */])) {
|
||||
if (fac == null || !(fac instanceof __WEBPACK_IMPORTED_MODULE_9__Faction_js__["a" /* Faction */])) {
|
||||
workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid faction name: " + faction);
|
||||
return false;
|
||||
}
|
||||
@ -23812,7 +23812,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
|
||||
var aug = __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][name];
|
||||
if (aug === null || !(aug instanceof __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["a" /* Augmentation */])) {
|
||||
if (aug == null || !(aug instanceof __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["a" /* Augmentation */])) {
|
||||
workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid augmentation name: " + name);
|
||||
return false;
|
||||
}
|
||||
@ -29389,7 +29389,7 @@ function createActiveScriptsText(workerscript, item) {
|
||||
function updateActiveScriptsText(workerscript, item, statsEl=null) {
|
||||
var itemId = item.id
|
||||
var itemTextStats = document.getElementById(itemId + "-stats");
|
||||
if (itemTextStats === null || itemTextStats === undefined) {
|
||||
if (itemTextStats == null || itemTextStats === undefined) {
|
||||
itemTextStats = statsEl;
|
||||
}
|
||||
|
||||
@ -35020,7 +35020,7 @@ function placeOrder(stock, shares, price, type, position, workerScript=null) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (StockMarket["Orders"] === null) {
|
||||
if (StockMarket["Orders"] == null) {
|
||||
var orders = {};
|
||||
for (var name in StockMarket) {
|
||||
if (StockMarket.hasOwnProperty(name)) {
|
||||
@ -35041,7 +35041,7 @@ function placeOrder(stock, shares, price, type, position, workerScript=null) {
|
||||
//Returns true if successfully cancels an order, false otherwise
|
||||
function cancelOrder(params, workerScript=null) {
|
||||
var tixApi = (workerScript instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]);
|
||||
if (StockMarket["Orders"] === null) {return false;}
|
||||
if (StockMarket["Orders"] == null) {return false;}
|
||||
if (params.order && params.order instanceof Order) {
|
||||
var order = params.order;
|
||||
//An 'Order' object is passed in
|
||||
@ -35424,7 +35424,7 @@ function sellStock(stock, shares) {
|
||||
//Returns true if successful and false otherwise
|
||||
function shortStock(stock, shares, workerScript=null) {
|
||||
var tixApi = (workerScript instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]);
|
||||
if (stock === null || isNaN(shares) || shares < 0) {
|
||||
if (stock == null || isNaN(shares) || shares < 0) {
|
||||
if (tixApi) {
|
||||
workerScript.scriptRef.log("ERROR: shortStock() failed because of invalid arguments.");
|
||||
} else {
|
||||
@ -35473,7 +35473,7 @@ function shortStock(stock, shares, workerScript=null) {
|
||||
//Returns true if successful and false otherwise
|
||||
function sellShort(stock, shares, workerScript=null) {
|
||||
var tixApi = (workerScript instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]);
|
||||
if (stock === null || isNaN(shares) || shares < 0) {
|
||||
if (stock == null || isNaN(shares) || shares < 0) {
|
||||
if (tixApi) {
|
||||
workerScript.scriptRef.log("ERROR: sellShort() failed because of invalid arguments.");
|
||||
} else {
|
||||
@ -35575,7 +35575,7 @@ function updateStockPrices() {
|
||||
//Checks and triggers any orders for the specified stock
|
||||
function processOrders(stock, orderType, posType) {
|
||||
var orderBook = StockMarket["Orders"];
|
||||
if (orderBook === null) {
|
||||
if (orderBook == null) {
|
||||
var orders = {};
|
||||
for (var name in StockMarket) {
|
||||
if (StockMarket.hasOwnProperty(name)) {
|
||||
@ -35588,7 +35588,7 @@ function processOrders(stock, orderType, posType) {
|
||||
return; //Newly created, so no orders to process
|
||||
}
|
||||
var stockOrders = orderBook[stock.symbol];
|
||||
if (stockOrders === null || !(stockOrders.constructor === Array)) {
|
||||
if (stockOrders == null || !(stockOrders.constructor === Array)) {
|
||||
console.log("ERROR: Invalid Order book for " + stock.symbol + " in processOrders()");
|
||||
stockOrders = [];
|
||||
return;
|
||||
@ -35931,7 +35931,7 @@ function createStockTicker(stock) {
|
||||
function setStockTickerClickHandlers() {
|
||||
var stockList = document.getElementById("stock-market-list");
|
||||
var tickerHdrs = stockList.getElementsByClassName("accordion-header");
|
||||
if (tickerHdrs === null) {
|
||||
if (tickerHdrs == null) {
|
||||
console.log("ERROR: Could not find header elements for stock tickers");
|
||||
return;
|
||||
}
|
||||
@ -35960,7 +35960,7 @@ function updateStockTicker(stock, increase) {
|
||||
var tickerId = "stock-market-ticker-" + stock.symbol;
|
||||
var hdr = document.getElementById(tickerId + "-hdr");
|
||||
|
||||
if (hdr === null) {
|
||||
if (hdr == null) {
|
||||
console.log("ERROR: Couldn't find ticker element for stock: " + stock.symbol);
|
||||
return;
|
||||
}
|
||||
@ -35985,7 +35985,7 @@ function updateStockPlayerPosition(stock) {
|
||||
if (!(stock.posTxtEl instanceof Element)) {
|
||||
stock.posTxtEl = document.getElementById(tickerId + "-position-text");
|
||||
}
|
||||
if (stock.posTxtEl === null) {
|
||||
if (stock.posTxtEl == null) {
|
||||
console.log("ERROR: Could not find stock position element for: " + stock.symbol);
|
||||
return;
|
||||
}
|
||||
@ -37321,7 +37321,7 @@ HackingMission.prototype.createNodeDomElement = 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");
|
||||
return;
|
||||
}
|
||||
@ -37393,7 +37393,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.log("Error getting Node object");}
|
||||
if (!nodeObj.plyrCtrl) {return;}
|
||||
|
||||
if (hackMissionInst.selectedNode instanceof Node) {
|
||||
@ -37409,7 +37409,7 @@ function selectNode(hackMissionInst, el) {
|
||||
//Note: Does NOT change its css class. This is handled by Node.setControlledBy...
|
||||
HackingMission.prototype.configurePlayerNodeElement = function(el) {
|
||||
var nodeObj = this.getNodeFromElement(el);
|
||||
if (nodeObj === null) {console.log("Error getting Node object");}
|
||||
if (nodeObj == null) {console.log("Error getting Node object");}
|
||||
|
||||
//Add event listener
|
||||
var self = this;
|
||||
@ -37445,7 +37445,7 @@ HackingMission.prototype.nodeReachable = function(node) {
|
||||
}
|
||||
|
||||
HackingMission.prototype.nodeReachableByEnemy = function(node) {
|
||||
if (node === null) {return false;}
|
||||
if (node == null) {return false;}
|
||||
var x = node.pos[0], y = node.pos[1];
|
||||
if (x > 0 && this.map[x-1][y].enmyCtrl) {return true;}
|
||||
if (x < 7 && this.map[x+1][y].enmyCtrl) {return true;}
|
||||
@ -37650,7 +37650,7 @@ HackingMission.prototype.process = function(numCycles=1) {
|
||||
|
||||
//Returns a bool representing whether defenses need to be re-calculated
|
||||
HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
|
||||
if (nodeObj.action === null) {
|
||||
if (nodeObj.action == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -37680,18 +37680,18 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
|
||||
var enmyHacking = this.difficulty * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionDifficultyToHacking;
|
||||
switch(nodeObj.action) {
|
||||
case NodeActions.Attack:
|
||||
if (nodeObj.conn === null) {break;}
|
||||
if (nodeObj.conn == null) {break;}
|
||||
var dmg = this.calculateAttackDamage(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
|
||||
targetNode.hp -= (dmg/5 * numCycles);
|
||||
break;
|
||||
case NodeActions.Scan:
|
||||
if (nodeObj.conn === null) {break;}
|
||||
if (nodeObj.conn == null) {break;}
|
||||
var eff = this.calculateScanEffect(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
|
||||
targetNode.def -= (eff/5 * numCycles);
|
||||
calcStats = true;
|
||||
break;
|
||||
case NodeActions.Weaken:
|
||||
if (nodeObj.conn === null) {break;}
|
||||
if (nodeObj.conn == null) {break;}
|
||||
var eff = this.calculateWeakenEffect(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
|
||||
targetNode.atk -= (eff/5 * numCycles);
|
||||
calcStats = true;
|
||||
@ -37852,13 +37852,13 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
|
||||
|
||||
//Enemy "AI" for CPU Core and Transfer Nodes
|
||||
HackingMission.prototype.enemyAISelectAction = function(nodeObj) {
|
||||
if (nodeObj === null) {return;}
|
||||
if (nodeObj == null) {return;}
|
||||
switch(nodeObj.type) {
|
||||
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
|
||||
//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) {
|
||||
//Randomly pick a player node and attack it if its reachable
|
||||
var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.playerNodes.length-1);
|
||||
@ -37916,7 +37916,7 @@ HackingMission.prototype.enemyAISelectAction = function(nodeObj) {
|
||||
} else {
|
||||
targetNode = this.getNodeFromElement(nodeObj.conn.targetId);
|
||||
}
|
||||
if (targetNode === null) {
|
||||
if (targetNode == null) {
|
||||
console.log("Error getting Target node Object in enemyAISelectAction()");
|
||||
}
|
||||
|
||||
@ -38386,7 +38386,7 @@ GangMember.prototype.assignToTask = function(taskName) {
|
||||
//Gains are per cycle
|
||||
GangMember.prototype.calculateRespectGain = function() {
|
||||
var task = this.task;
|
||||
if (task === null || !(task instanceof GangMemberTask) || task.baseRespect === 0) {return 0;}
|
||||
if (task == null || !(task instanceof GangMemberTask) || task.baseRespect === 0) {return 0;}
|
||||
var statWeight = (task.hackWeight/100) * this.hack +
|
||||
(task.strWeight/100) * this.str +
|
||||
(task.defWeight/100) * this.def +
|
||||
@ -38403,7 +38403,7 @@ GangMember.prototype.calculateRespectGain = function() {
|
||||
|
||||
GangMember.prototype.calculateWantedLevelGain = function() {
|
||||
var task = this.task;
|
||||
if (task === null || !(task instanceof GangMemberTask) || task.baseWanted === 0) {return 0;}
|
||||
if (task == null || !(task instanceof GangMemberTask) || task.baseWanted === 0) {return 0;}
|
||||
var statWeight = (task.hackWeight/100) * this.hack +
|
||||
(task.strWeight/100) * this.str +
|
||||
(task.defWeight/100) * this.def +
|
||||
@ -38423,7 +38423,7 @@ GangMember.prototype.calculateWantedLevelGain = function() {
|
||||
|
||||
GangMember.prototype.calculateMoneyGain = function() {
|
||||
var task = this.task;
|
||||
if (task === null || !(task instanceof GangMemberTask) || task.baseMoney === 0) {return 0;}
|
||||
if (task == null || !(task instanceof GangMemberTask) || task.baseMoney === 0) {return 0;}
|
||||
var statWeight = (task.hackWeight/100) * this.hack +
|
||||
(task.strWeight/100) * this.str +
|
||||
(task.defWeight/100) * this.def +
|
||||
@ -38440,7 +38440,7 @@ GangMember.prototype.calculateMoneyGain = function() {
|
||||
|
||||
GangMember.prototype.gainExperience = function(numCycles=1) {
|
||||
var task = this.task;
|
||||
if (task === null || !(task instanceof GangMemberTask)) {return;}
|
||||
if (task == null || !(task instanceof GangMemberTask)) {return;}
|
||||
this.hack_exp += (task.hackWeight / 1500) * task.difficulty * numCycles;
|
||||
this.str_exp += (task.strWeight / 1500) * task.difficulty * numCycles;
|
||||
this.def_exp += (task.defWeight / 1500) * task.difficulty * numCycles;
|
||||
@ -39140,7 +39140,7 @@ function updateGangContent() {
|
||||
var repCost = Math.pow(__WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].GangRecruitCostMultiplier, numMembers);
|
||||
}
|
||||
var faction = __WEBPACK_IMPORTED_MODULE_2__Faction_js__["b" /* Factions */][__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.facName];
|
||||
if (faction === null) {
|
||||
if (faction == null) {
|
||||
Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Could not find your gang's faction. This is probably a bug please report to dev");
|
||||
return;
|
||||
}
|
||||
@ -92806,7 +92806,7 @@ BitburnerSaveObject.prototype.saveGame = function(db) {
|
||||
}
|
||||
|
||||
function loadGame(saveString) {
|
||||
if (saveString === "" || saveString === null || saveString === undefined) {
|
||||
if (saveString === "" || saveString == null || saveString === undefined) {
|
||||
if (!window.localStorage.getItem("bitburnerSave")) {
|
||||
console.log("No save file to load");
|
||||
return false;
|
||||
@ -92875,7 +92875,7 @@ function loadGame(saveString) {
|
||||
if (saveObj.hasOwnProperty("VersionSave")) {
|
||||
try {
|
||||
var ver = JSON.parse(saveObj.VersionSave, __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__["c" /* Reviver */]);
|
||||
if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN === null || __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN === 0) {
|
||||
if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN == null || __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN === 0) {
|
||||
__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].setBitNodeNumber(1);
|
||||
}
|
||||
if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
|
||||
|
@ -251,7 +251,7 @@ function createActiveScriptsText(workerscript, item) {
|
||||
function updateActiveScriptsText(workerscript, item, statsEl=null) {
|
||||
var itemId = item.id
|
||||
var itemTextStats = document.getElementById(itemId + "-stats");
|
||||
if (itemTextStats === null || itemTextStats === undefined) {
|
||||
if (itemTextStats == null || itemTextStats === undefined) {
|
||||
itemTextStats = statsEl;
|
||||
}
|
||||
|
||||
|
@ -140,12 +140,17 @@ Industries:
|
||||
|
||||
Employees:
|
||||
Has morale, happiness, and energy that must be managed to maintain productivity
|
||||
Has a city property
|
||||
Stats:
|
||||
Age, Intelligence, Charisma, Experience, Creativity, Efficiency
|
||||
|
||||
Assigned to different positions. The productivity at each position is determined by
|
||||
stats. I.e. each employe should be assigned to positions based on stats to optimize production
|
||||
|
||||
Hiring Employees:
|
||||
When you choose to hire employees you are given a randomly generated list of employees to hire
|
||||
They will demand a certain salary and maybe stock shares
|
||||
|
||||
Employee Position
|
||||
Operations -
|
||||
Engineer -
|
||||
@ -166,12 +171,36 @@ Industries:
|
||||
Earnings Per Share(EPS): Net Income (Profit) / Number of Oustanding Shares
|
||||
Price to Earnings: P/E Ratio = Price per Share / EPS
|
||||
|
||||
Awareness:
|
||||
Awareness: A number indicating how many people are aware of your company
|
||||
Popularity: A number indicating how many people like your company
|
||||
Warehouse Space: How many materials it can stock
|
||||
Office Space:
|
||||
Costs $/s in upkeep
|
||||
You can open one office space in each city
|
||||
Size - increased by upgrades, increases max # employees in the city
|
||||
However if your # employees is near the max this affects employee happiness
|
||||
Comfort - Increased by upgrades, affects employees in that office
|
||||
Beauty - Increased by upgrades, affects employees in that office
|
||||
Tiers of Office Space:
|
||||
Basic
|
||||
Enhanced
|
||||
Luxurious
|
||||
Extravagant
|
||||
Upgrades
|
||||
Things that increase comfort/beauty. Some may cost upkeep and some might not
|
||||
|
||||
Office Space - Increases max employees
|
||||
- However if # employees is near the max, then employee happiness decreases
|
||||
|
||||
Company Upgrades:
|
||||
Can upgrade Warehouse Space and Office Space
|
||||
Can throw 'events' (company picnic, outing, party, etc.) for one time expenses and temporary boosts
|
||||
Advertising, Increases Company Awareness and Popularity
|
||||
|
||||
Investors
|
||||
When you start a company you have 1 billion shares (subject to change)
|
||||
Four rounds of investing: Seed, Series A, Series B, Series C
|
||||
In each round, you can give up certain shares to receive money
|
||||
These are optional
|
||||
|
||||
You can choose to go public at any time, at which point your stock price
|
||||
will fluctuate based on company performance. Then you can sell whatever
|
||||
shares you have left on the stock market.
|
||||
*/
|
||||
|
10
src/Gang.js
10
src/Gang.js
@ -347,7 +347,7 @@ GangMember.prototype.assignToTask = function(taskName) {
|
||||
//Gains are per cycle
|
||||
GangMember.prototype.calculateRespectGain = function() {
|
||||
var task = this.task;
|
||||
if (task === null || !(task instanceof GangMemberTask) || task.baseRespect === 0) {return 0;}
|
||||
if (task == null || !(task instanceof GangMemberTask) || task.baseRespect === 0) {return 0;}
|
||||
var statWeight = (task.hackWeight/100) * this.hack +
|
||||
(task.strWeight/100) * this.str +
|
||||
(task.defWeight/100) * this.def +
|
||||
@ -364,7 +364,7 @@ GangMember.prototype.calculateRespectGain = function() {
|
||||
|
||||
GangMember.prototype.calculateWantedLevelGain = function() {
|
||||
var task = this.task;
|
||||
if (task === null || !(task instanceof GangMemberTask) || task.baseWanted === 0) {return 0;}
|
||||
if (task == null || !(task instanceof GangMemberTask) || task.baseWanted === 0) {return 0;}
|
||||
var statWeight = (task.hackWeight/100) * this.hack +
|
||||
(task.strWeight/100) * this.str +
|
||||
(task.defWeight/100) * this.def +
|
||||
@ -384,7 +384,7 @@ GangMember.prototype.calculateWantedLevelGain = function() {
|
||||
|
||||
GangMember.prototype.calculateMoneyGain = function() {
|
||||
var task = this.task;
|
||||
if (task === null || !(task instanceof GangMemberTask) || task.baseMoney === 0) {return 0;}
|
||||
if (task == null || !(task instanceof GangMemberTask) || task.baseMoney === 0) {return 0;}
|
||||
var statWeight = (task.hackWeight/100) * this.hack +
|
||||
(task.strWeight/100) * this.str +
|
||||
(task.defWeight/100) * this.def +
|
||||
@ -401,7 +401,7 @@ GangMember.prototype.calculateMoneyGain = function() {
|
||||
|
||||
GangMember.prototype.gainExperience = function(numCycles=1) {
|
||||
var task = this.task;
|
||||
if (task === null || !(task instanceof GangMemberTask)) {return;}
|
||||
if (task == null || !(task instanceof GangMemberTask)) {return;}
|
||||
this.hack_exp += (task.hackWeight / 1500) * task.difficulty * numCycles;
|
||||
this.str_exp += (task.strWeight / 1500) * task.difficulty * numCycles;
|
||||
this.def_exp += (task.defWeight / 1500) * task.difficulty * numCycles;
|
||||
@ -1101,7 +1101,7 @@ function updateGangContent() {
|
||||
var repCost = Math.pow(CONSTANTS.GangRecruitCostMultiplier, numMembers);
|
||||
}
|
||||
var faction = Factions[Player.gang.facName];
|
||||
if (faction === null) {
|
||||
if (faction == null) {
|
||||
dialogBoxCreate("Could not find your gang's faction. This is probably a bug please report to dev");
|
||||
return;
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ HackingMission.prototype.createNodeDomElement = 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");
|
||||
return;
|
||||
}
|
||||
@ -808,7 +808,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.log("Error getting Node object");}
|
||||
if (!nodeObj.plyrCtrl) {return;}
|
||||
|
||||
if (hackMissionInst.selectedNode instanceof Node) {
|
||||
@ -824,7 +824,7 @@ function selectNode(hackMissionInst, el) {
|
||||
//Note: Does NOT change its css class. This is handled by Node.setControlledBy...
|
||||
HackingMission.prototype.configurePlayerNodeElement = function(el) {
|
||||
var nodeObj = this.getNodeFromElement(el);
|
||||
if (nodeObj === null) {console.log("Error getting Node object");}
|
||||
if (nodeObj == null) {console.log("Error getting Node object");}
|
||||
|
||||
//Add event listener
|
||||
var self = this;
|
||||
@ -860,7 +860,7 @@ HackingMission.prototype.nodeReachable = function(node) {
|
||||
}
|
||||
|
||||
HackingMission.prototype.nodeReachableByEnemy = function(node) {
|
||||
if (node === null) {return false;}
|
||||
if (node == null) {return false;}
|
||||
var x = node.pos[0], y = node.pos[1];
|
||||
if (x > 0 && this.map[x-1][y].enmyCtrl) {return true;}
|
||||
if (x < 7 && this.map[x+1][y].enmyCtrl) {return true;}
|
||||
@ -1065,7 +1065,7 @@ HackingMission.prototype.process = function(numCycles=1) {
|
||||
|
||||
//Returns a bool representing whether defenses need to be re-calculated
|
||||
HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
|
||||
if (nodeObj.action === null) {
|
||||
if (nodeObj.action == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1095,18 +1095,18 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
|
||||
var enmyHacking = this.difficulty * CONSTANTS.HackingMissionDifficultyToHacking;
|
||||
switch(nodeObj.action) {
|
||||
case NodeActions.Attack:
|
||||
if (nodeObj.conn === null) {break;}
|
||||
if (nodeObj.conn == null) {break;}
|
||||
var dmg = this.calculateAttackDamage(atk, def, plyr ? Player.hacking_skill : enmyHacking);
|
||||
targetNode.hp -= (dmg/5 * numCycles);
|
||||
break;
|
||||
case NodeActions.Scan:
|
||||
if (nodeObj.conn === null) {break;}
|
||||
if (nodeObj.conn == null) {break;}
|
||||
var eff = this.calculateScanEffect(atk, def, plyr ? Player.hacking_skill : enmyHacking);
|
||||
targetNode.def -= (eff/5 * numCycles);
|
||||
calcStats = true;
|
||||
break;
|
||||
case NodeActions.Weaken:
|
||||
if (nodeObj.conn === null) {break;}
|
||||
if (nodeObj.conn == null) {break;}
|
||||
var eff = this.calculateWeakenEffect(atk, def, plyr ? Player.hacking_skill : enmyHacking);
|
||||
targetNode.atk -= (eff/5 * numCycles);
|
||||
calcStats = true;
|
||||
@ -1267,13 +1267,13 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
|
||||
|
||||
//Enemy "AI" for CPU Core and Transfer Nodes
|
||||
HackingMission.prototype.enemyAISelectAction = function(nodeObj) {
|
||||
if (nodeObj === null) {return;}
|
||||
if (nodeObj == null) {return;}
|
||||
switch(nodeObj.type) {
|
||||
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
|
||||
//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) {
|
||||
//Randomly pick a player node and attack it if its reachable
|
||||
var rand = getRandomInt(0, this.playerNodes.length-1);
|
||||
@ -1331,7 +1331,7 @@ HackingMission.prototype.enemyAISelectAction = function(nodeObj) {
|
||||
} else {
|
||||
targetNode = this.getNodeFromElement(nodeObj.conn.targetId);
|
||||
}
|
||||
if (targetNode === null) {
|
||||
if (targetNode == null) {
|
||||
console.log("Error getting Target node Object in enemyAISelectAction()");
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ function NetscriptFunctions(workerScript) {
|
||||
workerScript.scriptRef.log(args.toString());
|
||||
},
|
||||
tprint : function(args) {
|
||||
if (args === undefined || args === null) {
|
||||
if (args === undefined || args == null) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "tprint() call has incorrect number of arguments. Takes 1 argument");
|
||||
}
|
||||
var x = args.toString();
|
||||
@ -602,7 +602,7 @@ function NetscriptFunctions(workerScript) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "ls() failed because of invalid arguments. Usage: ls(ip/hostname, [grep filter])");
|
||||
}
|
||||
var server = getServer(ip);
|
||||
if (server === null) {
|
||||
if (server == null) {
|
||||
workerScript.scriptRef.log("ls() failed. Invalid IP or hostname passed in: " + ip);
|
||||
throw makeRuntimeRejectMsg(workerScript, "ls() failed. Invalid IP or hostname passed in: " + ip);
|
||||
}
|
||||
@ -1176,11 +1176,11 @@ function NetscriptFunctions(workerScript) {
|
||||
} else if (isString(port)) { //Write to text file
|
||||
var fn = port;
|
||||
var server = getServer(workerScript.serverIp);
|
||||
if (server === null) {
|
||||
if (server == null) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "Error getting Server for this script in write(). This is a bug please contact game dev");
|
||||
}
|
||||
var txtFile = getTextFile(fn, server);
|
||||
if (txtFile === null) {
|
||||
if (txtFile == null) {
|
||||
txtFile = createTextFile(fn, data, server);
|
||||
return true;
|
||||
}
|
||||
@ -1213,7 +1213,7 @@ function NetscriptFunctions(workerScript) {
|
||||
} else if (isString(port)) { //Read from text file
|
||||
var fn = port;
|
||||
var server = getServer(workerScript.serverIp);
|
||||
if (server === null) {
|
||||
if (server == null) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "Error getting Server for this script in read(). This is a bug please contact game dev");
|
||||
}
|
||||
var txtFile = getTextFile(fn, server);
|
||||
@ -1301,7 +1301,7 @@ function NetscriptFunctions(workerScript) {
|
||||
} else {
|
||||
//Get income for a particular script
|
||||
var server = getServer(ip);
|
||||
if (server === null) {
|
||||
if (server == null) {
|
||||
workerScript.scriptRef.log("getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip);
|
||||
throw makeRuntimeRejectMsg(workerScript, "getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip);
|
||||
}
|
||||
@ -1327,7 +1327,7 @@ function NetscriptFunctions(workerScript) {
|
||||
} else {
|
||||
//Get income for a particular script
|
||||
var server = getServer(ip);
|
||||
if (server === null) {
|
||||
if (server == null) {
|
||||
workerScript.scriptRef.log("getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip);
|
||||
throw makeRuntimeRejectMsg(workerScript, "getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip);
|
||||
}
|
||||
@ -1855,7 +1855,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
|
||||
var company = Companies[companyName];
|
||||
if (company === null || !(company instanceof Company)) {
|
||||
if (company == null || !(company instanceof Company)) {
|
||||
workerScript.scriptRef.log("ERROR: Invalid companyName passed into getCompanyRep(): " + companyName);
|
||||
return -1;
|
||||
}
|
||||
@ -2263,7 +2263,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
|
||||
var fac = Factions[faction];
|
||||
if (fac === null || !(fac instanceof Faction)) {
|
||||
if (fac == null || !(fac instanceof Faction)) {
|
||||
workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid faction name: " + faction);
|
||||
return false;
|
||||
}
|
||||
@ -2274,7 +2274,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
|
||||
var aug = Augmentations[name];
|
||||
if (aug === null || !(aug instanceof Augmentation)) {
|
||||
if (aug == null || !(aug instanceof Augmentation)) {
|
||||
workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid augmentation name: " + name);
|
||||
return false;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ BitburnerSaveObject.prototype.saveGame = function(db) {
|
||||
}
|
||||
|
||||
function loadGame(saveString) {
|
||||
if (saveString === "" || saveString === null || saveString === undefined) {
|
||||
if (saveString === "" || saveString == null || saveString === undefined) {
|
||||
if (!window.localStorage.getItem("bitburnerSave")) {
|
||||
console.log("No save file to load");
|
||||
return false;
|
||||
@ -172,7 +172,7 @@ function loadGame(saveString) {
|
||||
if (saveObj.hasOwnProperty("VersionSave")) {
|
||||
try {
|
||||
var ver = JSON.parse(saveObj.VersionSave, Reviver);
|
||||
if (Player.bitNodeN === null || Player.bitNodeN === 0) {
|
||||
if (Player.bitNodeN == null || Player.bitNodeN === 0) {
|
||||
Player.setBitNodeNumber(1);
|
||||
}
|
||||
if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
|
||||
|
@ -67,7 +67,7 @@ function placeOrder(stock, shares, price, type, position, workerScript=null) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (StockMarket["Orders"] === null) {
|
||||
if (StockMarket["Orders"] == null) {
|
||||
var orders = {};
|
||||
for (var name in StockMarket) {
|
||||
if (StockMarket.hasOwnProperty(name)) {
|
||||
@ -88,7 +88,7 @@ function placeOrder(stock, shares, price, type, position, workerScript=null) {
|
||||
//Returns true if successfully cancels an order, false otherwise
|
||||
function cancelOrder(params, workerScript=null) {
|
||||
var tixApi = (workerScript instanceof WorkerScript);
|
||||
if (StockMarket["Orders"] === null) {return false;}
|
||||
if (StockMarket["Orders"] == null) {return false;}
|
||||
if (params.order && params.order instanceof Order) {
|
||||
var order = params.order;
|
||||
//An 'Order' object is passed in
|
||||
@ -471,7 +471,7 @@ function sellStock(stock, shares) {
|
||||
//Returns true if successful and false otherwise
|
||||
function shortStock(stock, shares, workerScript=null) {
|
||||
var tixApi = (workerScript instanceof WorkerScript);
|
||||
if (stock === null || isNaN(shares) || shares < 0) {
|
||||
if (stock == null || isNaN(shares) || shares < 0) {
|
||||
if (tixApi) {
|
||||
workerScript.scriptRef.log("ERROR: shortStock() failed because of invalid arguments.");
|
||||
} else {
|
||||
@ -520,7 +520,7 @@ function shortStock(stock, shares, workerScript=null) {
|
||||
//Returns true if successful and false otherwise
|
||||
function sellShort(stock, shares, workerScript=null) {
|
||||
var tixApi = (workerScript instanceof WorkerScript);
|
||||
if (stock === null || isNaN(shares) || shares < 0) {
|
||||
if (stock == null || isNaN(shares) || shares < 0) {
|
||||
if (tixApi) {
|
||||
workerScript.scriptRef.log("ERROR: sellShort() failed because of invalid arguments.");
|
||||
} else {
|
||||
@ -622,7 +622,7 @@ function updateStockPrices() {
|
||||
//Checks and triggers any orders for the specified stock
|
||||
function processOrders(stock, orderType, posType) {
|
||||
var orderBook = StockMarket["Orders"];
|
||||
if (orderBook === null) {
|
||||
if (orderBook == null) {
|
||||
var orders = {};
|
||||
for (var name in StockMarket) {
|
||||
if (StockMarket.hasOwnProperty(name)) {
|
||||
@ -635,7 +635,7 @@ function processOrders(stock, orderType, posType) {
|
||||
return; //Newly created, so no orders to process
|
||||
}
|
||||
var stockOrders = orderBook[stock.symbol];
|
||||
if (stockOrders === null || !(stockOrders.constructor === Array)) {
|
||||
if (stockOrders == null || !(stockOrders.constructor === Array)) {
|
||||
console.log("ERROR: Invalid Order book for " + stock.symbol + " in processOrders()");
|
||||
stockOrders = [];
|
||||
return;
|
||||
@ -978,7 +978,7 @@ function createStockTicker(stock) {
|
||||
function setStockTickerClickHandlers() {
|
||||
var stockList = document.getElementById("stock-market-list");
|
||||
var tickerHdrs = stockList.getElementsByClassName("accordion-header");
|
||||
if (tickerHdrs === null) {
|
||||
if (tickerHdrs == null) {
|
||||
console.log("ERROR: Could not find header elements for stock tickers");
|
||||
return;
|
||||
}
|
||||
@ -1007,7 +1007,7 @@ function updateStockTicker(stock, increase) {
|
||||
var tickerId = "stock-market-ticker-" + stock.symbol;
|
||||
var hdr = document.getElementById(tickerId + "-hdr");
|
||||
|
||||
if (hdr === null) {
|
||||
if (hdr == null) {
|
||||
console.log("ERROR: Couldn't find ticker element for stock: " + stock.symbol);
|
||||
return;
|
||||
}
|
||||
@ -1032,7 +1032,7 @@ function updateStockPlayerPosition(stock) {
|
||||
if (!(stock.posTxtEl instanceof Element)) {
|
||||
stock.posTxtEl = document.getElementById(tickerId + "-position-text");
|
||||
}
|
||||
if (stock.posTxtEl === null) {
|
||||
if (stock.posTxtEl == null) {
|
||||
console.log("ERROR: Could not find stock position element for: " + stock.symbol);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user