diff --git a/src/Augmentation/AugmentationHelpers.tsx b/src/Augmentation/AugmentationHelpers.tsx index 27d19ab76..ba8f03024 100644 --- a/src/Augmentation/AugmentationHelpers.tsx +++ b/src/Augmentation/AugmentationHelpers.tsx @@ -2598,12 +2598,7 @@ function augmentationExists(name: string): boolean { export function isRepeatableAug(aug: Augmentation): boolean { const augName = aug instanceof Augmentation ? aug.name : aug; - - if (augName === AugmentationNames.NeuroFluxGovernor) { - return true; - } - - return false; + return augName === AugmentationNames.NeuroFluxGovernor; } export { installAugmentations, initAugmentations, applyAugmentation, augmentationExists }; diff --git a/src/BitNode/ui/BitverseRoot.tsx b/src/BitNode/ui/BitverseRoot.tsx index 2f2205cec..5fa970442 100644 --- a/src/BitNode/ui/BitverseRoot.tsx +++ b/src/BitNode/ui/BitverseRoot.tsx @@ -132,7 +132,7 @@ export function BitverseRoot(props: IProps): React.ReactElement { const player = use.Player(); const enter = enterBitNode; const destroyed = player.bitNodeN; - const [destroySequence, setDestroySequence] = useState(true && !props.quick); + const [destroySequence, setDestroySequence] = useState(!props.quick); // Update NextSourceFileFlags const nextSourceFileFlags = SourceFileFlags.slice(); diff --git a/src/Corporation/OfficeSpace.ts b/src/Corporation/OfficeSpace.ts index 1572ee945..87af22971 100644 --- a/src/Corporation/OfficeSpace.ts +++ b/src/Corporation/OfficeSpace.ts @@ -186,8 +186,7 @@ export class OfficeSpace { jobCount--; } } - if (jobCount !== amount) return false; - return true; + return jobCount === amount; } toJSON(): any { diff --git a/src/Crime/CrimeHelpers.ts b/src/Crime/CrimeHelpers.ts index 113c3632a..8689645fc 100644 --- a/src/Crime/CrimeHelpers.ts +++ b/src/Crime/CrimeHelpers.ts @@ -20,14 +20,7 @@ export function determineCrimeSuccess(p: IPlayer, type: string): boolean { dialogBoxCreate(`ERR: Unrecognized crime type: ${type} This is probably a bug please contact the developer`); return false; } - - if (Math.random() <= chance) { - //Success - return true; - } else { - //Failure - return false; - } + return Math.random() <= chance; } export function findCrime(roughName: string): Crime | null { diff --git a/src/ExportBonus.tsx b/src/ExportBonus.tsx index c9a245cf0..c75bce683 100644 --- a/src/ExportBonus.tsx +++ b/src/ExportBonus.tsx @@ -6,8 +6,7 @@ export let LastExportBonus = 0; const bonusTimer = 24 * 60 * 60 * 1000; // 24h export function canGetBonus(): boolean { const now = new Date().getTime(); - if (now - LastExportBonus > bonusTimer) return true; - return false; + return now - LastExportBonus > bonusTimer; } export function onExport(p: IPlayer): void { diff --git a/src/NetscriptEvaluator.ts b/src/NetscriptEvaluator.ts index c32edf7d5..11f960b23 100644 --- a/src/NetscriptEvaluator.ts +++ b/src/NetscriptEvaluator.ts @@ -60,8 +60,5 @@ export function isScriptErrorMessage(msg: string): boolean { return false; } const splitMsg = msg.split("|DELIMITER|"); - if (splitMsg.length != 4) { - return false; - } - return true; + return splitMsg.length == 4; } diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 2a6efef8e..30307bdf9 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -807,7 +807,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { if (possibleLogs[fn] === undefined) { throw makeRuntimeErrorMsg("isLogEnabled", `Invalid argument: ${fn}.`); } - return workerScript.disableLogs[fn] ? false : true; + return !workerScript.disableLogs[fn]; }, getScriptLogs: function (fn: any, hostname: any, ...scriptArgs: any): any { const runningScriptObj = getRunningScript(fn, hostname, "getScriptLogs", scriptArgs); @@ -1590,10 +1590,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } } const txtFile = getTextFile(filename, server); - if (txtFile != null) { - return true; - } - return false; + return txtFile != null; }, isRunning: function (fn: any, hostname: any = workerScript.hostname, ...scriptArgs: any): any { updateDynamicRam("isRunning", getRamCost(Player, "isRunning")); @@ -1655,7 +1652,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { }else{ workerScript.log("purchaseServer", () => `Invalid argument: ram='${ram}' must be a positive power of 2`); } - + return ""; } diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index f57392831..566f9819c 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -2002,18 +2002,13 @@ export function isQualified(this: IPlayer, company: Company, position: CompanyPo const reqAgility = position.requiredDexterity > 0 ? position.requiredDexterity + offset : 0; const reqCharisma = position.requiredCharisma > 0 ? position.requiredCharisma + offset : 0; - if ( - this.hacking >= reqHacking && + return this.hacking >= reqHacking && this.strength >= reqStrength && this.defense >= reqDefense && this.dexterity >= reqDexterity && this.agility >= reqAgility && this.charisma >= reqCharisma && - company.playerReputation >= position.requiredReputation - ) { - return true; - } - return false; + company.playerReputation >= position.requiredReputation; } /********** Reapplying Augmentations and Source File ***********/ @@ -2571,7 +2566,7 @@ export function queueAugmentation(this: IPlayer, name: string): void { /************* Coding Contracts **************/ export function gainCodingContractReward(this: IPlayer, reward: ICodingContractReward, difficulty = 1): string { - if (reward == null || reward.type == null || reward == null) { + if (reward == null || reward.type == null) { return `No reward for this contract`; } diff --git a/src/SaveObject.tsx b/src/SaveObject.tsx index 2d15b89dd..f6ee3b1f7 100755 --- a/src/SaveObject.tsx +++ b/src/SaveObject.tsx @@ -161,7 +161,7 @@ class BitburnerSaveObject { return reject(new Error("Error importing file")); } const result = target.result; - if (typeof result !== "string" || result === null) { + if (typeof result !== "string") { return reject(new Error("FileReader event was not type string")); } const contents = result; diff --git a/src/data/codingcontracttypes.ts b/src/data/codingcontracttypes.ts index 599179a7a..f2b6124ee 100644 --- a/src/data/codingcontracttypes.ts +++ b/src/data/codingcontracttypes.ts @@ -307,15 +307,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [ reach = Math.max(i + data[i], reach); } const solution: boolean = i === n; - - if (ans === "1" && solution) { - return true; - } - if (ans === "0" && !solution) { - return true; - } - - return false; + return (ans === "1" && solution) || (ans === "0" && !solution); }, }, { @@ -921,7 +913,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [ "The provided answer should be an array of strings containing the valid expressions.", "The data provided by this problem is an array with two elements. The first element", "is the string of digits, while the second element is the target number:\n\n", - `["${digits}", ${target}]\n\n`, + `["${digits}", ${target}]\n\n`, "NOTE: The order of evaluation expects script operator precedence", "NOTE: Numbers in the expression cannot have leading 0's. In other words,", `"1+01" is not a valid expression`,