From d3f9554a6eee229e66d3712eeecd3b941f43fdb7 Mon Sep 17 00:00:00 2001 From: Snarling <84951833+Snarling@users.noreply.github.com> Date: Tue, 21 Feb 2023 09:44:18 -0500 Subject: [PATCH] 2.2.2 Release (#378) --- doc/source/changelog.rst | 85 +++++++++++++++++++ doc/source/conf.py | 2 +- ...itburner.basichgwoptions.additionalmsec.md | 2 +- markdown/bitburner.basichgwoptions.md | 2 +- ...bitburner.ns.getserverbasesecuritylevel.md | 7 +- markdown/bitburner.ns.md | 2 +- markdown/bitburner.ns.nformat.md | 5 ++ package-lock.json | 4 +- package.json | 2 +- src/Constants.ts | 75 +++++++++++++--- src/CotMG/StaneksGift.ts | 2 +- src/CotMG/ui/StaneksGiftRoot.tsx | 2 +- src/Gang/Gang.ts | 2 +- src/Gang/ui/BonusTime.tsx | 2 +- src/NetscriptWorker.ts | 2 +- .../Sleeve/Work/SleeveBladeburnerWork.ts | 2 +- .../Sleeve/Work/SleeveCrimeWork.ts | 2 +- .../Sleeve/Work/SleeveInfiltrateWork.ts | 2 +- src/ScriptEditor/NetscriptDefinitions.d.ts | 19 ++--- src/Terminal/Terminal.ts | 2 +- src/Work/ClassWork.tsx | 2 +- src/Work/CreateProgramWork.ts | 4 +- src/Work/CrimeWork.ts | 2 +- src/Work/Formulas.ts | 2 +- src/Work/GraftingWork.tsx | 4 +- src/engine.tsx | 10 +-- src/ui/React/CharacterOverview.tsx | 6 +- src/ui/WorkInProgressRoot.tsx | 10 +-- 28 files changed, 196 insertions(+), 67 deletions(-) diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index d7076e088..92e95e3c4 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -3,6 +3,91 @@ Changelog ========= + +v2.2.2 - 21 Feb 2022 +-------------------- + +PLANNED 2.3 BREAKING CHANGES: + +* 2.3 will include a large planned rework to corporation. This may cause api breaks for any corporation scripts, and there will be large changes in how the corporation mechanic functions. + +NETSCRIPT API: + +* Added ns.formatNumber, ns.formatRam, and ns.formatPercent, which allow formatting these types of numbers the same way the game does (@Snarling, See UI section). +* Deprecated ns.nFormat. Likely to be removed in 2.3. Now just directly wraps numeral.format (@Snarling) +* EXPERIMENTAL CHANGE (may be reverted next patch): BasicHGWOptions now allows specifying a number of additionalMsec. This should allow easier and more reliable coordination + of completion times for hack, grow, and weaken. Since this is an experimental change, be prepared for a possible API break next patch if you use this functionality. (@d0sboots) + +* Corporation API: + + * Fix bugs with ns.corporation.setAutoJobAssignment. (@zerbosh and @croy) + +* Formulas API: + + * Added ns.formulas.hacking.growThreads function (@d0sboots) + +* Sleeve API: + + * ns.sleeve.getTask now also includes cyclesWorked for the task types where this applies. (@Zelow79) + * Added ns.sleeve.setToIdle function (@Zelow79) + +* Unsupported API: + + * Added ns.printRaw - allows printing custom React content to script logs. Use at your own risk, misuse is very likely to cause a crash. (@d0sboots) + +ELECTRON (STEAM) VERSION: + +* Fix security issue where player scripts were allowed to access any part of the player's filesystem. Now access is limited to the game's 'dist' folder. (@Snarling) + +SCRIPTS: + +* Fix an issue where multiple copies of the same script could be launched with same args/same server (@Mughur) +* Followup changes to API wrapping from 2.2.1 changes. (@d0sboots) + +UI: + +* Add new number formatting code to replace internal use of unmaintained package numeral.js. Added several Numeric Display options. (@Snarling) +* Removed ingame donation section. (@hydroflame) +* Improve some bladeburner number formatting (@Zelow79) +* Added IronMan theme (@MattiYT) +* Factions that have not been joined yet will show how many unowned augments they have available. (@Zelow79) +* Added more features to dev menu (@Zelow79 and @Snarling) + +CORPORATION: + +* Reverted previous change to employee needs. Now they will trend up on their own again. (@d0sboots) +* Improvements to how Market TA II works (@d0sboots) +* ns.corporation.getOffice return value now includes a totalExperience property. (@Snarling) + +HACKNET: + +* Hacknet servers are now named hacknet-server-# instead of hacknet-node-#. (@Tyasuh) +* Fix bug related to renaming hacknet servers (@Mughur) + +GRAFTING: + +* Bladeburner augs can be grafted if player is in Bladeburner faction (@Tyasuh) + +DOCUMENTATION + +* Many documentation updates (@Mughur, @d0sboots, @Snarling, @teauxfu). +* Official non-markdown docs are at http://bitburner-official.readthedocs.io/ +* Official dev version markdown docs are at https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.ns.md +* Official stable version markdown docs are at https://github.com/bitburner-official/bitburner-src/blob/stable/markdown/bitburner.ns.md +* Dev version documentation is now kept up to date as changes are made. (@Snarling) + +CODEBASE: + +* Updated many dependencies (@d0sboots) +* Updated lots of the build processes and GitHub workflows. (@Snarling) +* Internal refactoring of how BitNode multipliers are stored (@d0sboots) +* Added some extra helper function (useRerender hook, positiveInteger ns argument validator). (@Snarling) + +MISC: + +* Nerf noodle bar + + v2.2.1 Hotfixes --------------- diff --git a/doc/source/conf.py b/doc/source/conf.py index 81b44b3e1..eaa186e90 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -66,7 +66,7 @@ documentation_title = '{0} Documentation'.format(project) # The short X.Y version. version = '2.2' # The full version, including alpha/beta/rc tags. -release = '2.2.0' +release = '2.2.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/markdown/bitburner.basichgwoptions.additionalmsec.md b/markdown/bitburner.basichgwoptions.additionalmsec.md index 9e299188c..498c72d31 100644 --- a/markdown/bitburner.basichgwoptions.additionalmsec.md +++ b/markdown/bitburner.basichgwoptions.additionalmsec.md @@ -4,7 +4,7 @@ ## BasicHGWOptions.additionalMsec property -Number of additional milliseconds that will be spent waiting between the start of the function and when it completes. There will only be one, contiguous wait, which is relevant because stats such as server security level are computed at the \*start\* of the function. Must be non-negative. +Number of additional milliseconds that will be spent waiting between the start of the function and when it completes. Experimental in 2.2.2, may be removed in 2.3. **Signature:** diff --git a/markdown/bitburner.basichgwoptions.md b/markdown/bitburner.basichgwoptions.md index e25984a48..eb29d67ef 100644 --- a/markdown/bitburner.basichgwoptions.md +++ b/markdown/bitburner.basichgwoptions.md @@ -16,7 +16,7 @@ interface BasicHGWOptions | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [additionalMsec?](./bitburner.basichgwoptions.additionalmsec.md) | | number | _(Optional)_ Number of additional milliseconds that will be spent waiting between the start of the function and when it completes. There will only be one, contiguous wait, which is relevant because stats such as server security level are computed at the \*start\* of the function. Must be non-negative. | +| [additionalMsec?](./bitburner.basichgwoptions.additionalmsec.md) | | number | _(Optional)_ Number of additional milliseconds that will be spent waiting between the start of the function and when it completes. Experimental in 2.2.2, may be removed in 2.3. | | [stock?](./bitburner.basichgwoptions.stock.md) | | boolean | _(Optional)_ Set to true this action will affect the stock market. | | [threads?](./bitburner.basichgwoptions.threads.md) | | number | _(Optional)_ Number of threads to use for this function. Must be less than or equal to the number of threads the script is running with. | diff --git a/markdown/bitburner.ns.getserverbasesecuritylevel.md b/markdown/bitburner.ns.getserverbasesecuritylevel.md index b565079ed..c7ee44f15 100644 --- a/markdown/bitburner.ns.getserverbasesecuritylevel.md +++ b/markdown/bitburner.ns.getserverbasesecuritylevel.md @@ -4,10 +4,7 @@ ## NS.getServerBaseSecurityLevel() method -> Warning: This API is now obsolete. -> -> useless -> +Get the base security level of a server. **Signature:** @@ -29,5 +26,5 @@ Base security level of the target server. ## Remarks -RAM cost: 0.1 GB Returns the base security level of the target server. This is the security level that the server starts out with. This is different than getServerSecurityLevel because getServerSecurityLevel returns the current security level of a server, which can constantly change due to hack, grow, and weaken, calls on that server. The base security level will stay the same until you reset by installing an Augmentation(s). +RAM cost: 0.1 GB Returns the base security level of the target server. For the server's actual security level, use [ns.getServerSecurityLevel](./bitburner.ns.getserversecuritylevel.md). diff --git a/markdown/bitburner.ns.md b/markdown/bitburner.ns.md index 6bcda23f3..48d5eee77 100644 --- a/markdown/bitburner.ns.md +++ b/markdown/bitburner.ns.md @@ -104,7 +104,7 @@ export async function main(ns) { | [getScriptName()](./bitburner.ns.getscriptname.md) | Returns the current script name. | | [getScriptRam(script, host)](./bitburner.ns.getscriptram.md) | Get the ram cost of a script. | | [getServer(host)](./bitburner.ns.getserver.md) | Returns a server object for the given server. Defaults to the running script's server if host is not specified. | -| [getServerBaseSecurityLevel(host)](./bitburner.ns.getserverbasesecuritylevel.md) | | +| [getServerBaseSecurityLevel(host)](./bitburner.ns.getserverbasesecuritylevel.md) | Get the base security level of a server. | | [getServerGrowth(host)](./bitburner.ns.getservergrowth.md) | Get a server growth parameter. | | [getServerMaxMoney(host)](./bitburner.ns.getservermaxmoney.md) | Get the maximum money available on a server. | | [getServerMaxRam(host)](./bitburner.ns.getservermaxram.md) | Get the maximum amount of RAM on a server. | diff --git a/markdown/bitburner.ns.nformat.md b/markdown/bitburner.ns.nformat.md index ef7bb6fb4..46634dcbf 100644 --- a/markdown/bitburner.ns.nformat.md +++ b/markdown/bitburner.ns.nformat.md @@ -4,6 +4,11 @@ ## NS.nFormat() method +> Warning: This API is now obsolete. +> +> Use ns.formatNumber, formatRam, or formatPercent instead. Will be removed in 2.3. +> + Format a number using the numeral library. This function is deprecated and will be removed in 2.3. **Signature:** diff --git a/package-lock.json b/package-lock.json index a6b87f672..3075ddaf0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bitburner", - "version": "2.2.2dev", + "version": "2.2.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bitburner", - "version": "2.2.2dev", + "version": "2.2.2", "hasInstallScript": true, "license": "SEE LICENSE IN license.txt", "dependencies": { diff --git a/package.json b/package.json index 8f7714f25..dc6179e8e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bitburner", "license": "SEE LICENSE IN license.txt", - "version": "2.2.2dev", + "version": "2.2.2", "main": "electron-main.js", "author": { "name": "Daniel Xie, Olivier Gagnon, et al." diff --git a/src/Constants.ts b/src/Constants.ts index 8d9ca6d83..4154d3d20 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -6,7 +6,6 @@ export const CONSTANTS: { VersionString: string; VersionNumber: number; - _idleSpeed: number; MaxSkillLevel: number; MilliPerCycle: number; CorpFactionRepRequirement: number; @@ -88,11 +87,8 @@ export const CONSTANTS: { Donations: number; // number of blood/plasma/palette donation the dev have verified., boosts NFG LatestUpdate: string; } = { - VersionString: "2.2.2dev", - VersionNumber: 29, - - // Speed (in ms) at which the main loop is updated - _idleSpeed: 200, + VersionString: "2.2.2", + VersionNumber: 30, /** Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience * and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then @@ -232,18 +228,71 @@ export const CONSTANTS: { Donations: 41, LatestUpdate: ` -v2.2.2 in progress development patch notes +v2.2.2 - 21 Feb 2022 -NETSCRIPT: +PLANNED 2.3 BREAKING CHANGES: +* 2.3 will include a large planned rework to corporation. This may cause api breaks for any corporation scripts, and there will be large changes in how the corporation mechanic functions. -* Add unsupported ns.printRaw function, which allows printing rich content to script logs using React. (@d0sboots) +NETSCRIPT API: +* Added ns.formatNumber, ns.formatRam, and ns.formatPercent, which allow formatting these types of numbers the same way the game does (@Snarling, See UI section). +* Deprecated ns.nFormat. Likely to be removed in 2.3. Now just directly wraps numeral.format (@Snarling) +* EXPERIMENTAL CHANGE (may be reverted next patch): BasicHGWOptions now allows specifying a number of additionalMsec. This should allow easier and more reliable coordination + of completion times for hack, grow, and weaken. Since this is an experimental change, be prepared for a possible API break next patch if you use this functionality. (@d0sboots) + +- Corporation API +* Fix bugs with ns.corporation.setAutoJobAssignment. (@zerbosh and @croy) + +- Formulas API +* Added ns.formulas.hacking.growThreads function (@d0sboots) + +- Sleeve API +* ns.sleeve.getTask now also includes cyclesWorked for the task types where this applies. (@Zelow79) +* Added ns.sleeve.setToIdle function (@Zelow79) + +- Unsupported API +* Added ns.printRaw - allows printing custom React content to script logs. Use at your own risk, misuse is very likely to cause a crash. (@d0sboots) + +ELECTRON (STEAM) VERSION: +* Fix security issue where player scripts were allowed to access any part of the player's filesystem. Now access is limited to the game's 'dist' folder. (@Snarling) + +SCRIPTS: * Fix an issue where multiple copies of the same script could be launched with same args/same server (@Mughur) -* Internal changes to API wrapping. (@d0sboots) +* Followup changes to API wrapping from 2.2.1 changes. (@d0sboots) + +UI: +* Add new number formatting code to replace internal use of unmaintained package numeral.js. Added several Numeric Display options. (@Snarling) +* Removed ingame donation section. (@hydroflame) +* Improve some bladeburner number formatting (@Zelow79) +* Added IronMan theme (@MattiYT) +* Factions that have not been joined yet will show how many unowned augments they have available. (@Zelow79) +* Added more features to dev menu (@Zelow79 and @Snarling) + +CORPORATION: +* Reverted previous change to employee needs. Now they will trend up on their own again. (@d0sboots) +* Improvements to how Market TA II works (@d0sboots) +* ns.corporation.getOffice return value now includes a totalExperience property. (@Snarling) + +HACKNET: +* Hacknet servers are now named hacknet-server-# instead of hacknet-node-#. (@Tyasuh) +* Fix bug related to renaming hacknet servers (@Mughur) + +GRAFTING: +* Bladeburner augs can be grafted if player is in Bladeburner faction (@Tyasuh) + +DOCUMENTATION +* Many documentation updates (@Mughur, @d0sboots, @Snarling, @teauxfu). +* Official non-markdown docs are at http://bitburner-official.readthedocs.io/ +* Official dev version markdown docs are at https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.ns.md +* Official stable version markdown docs are at https://github.com/bitburner-official/bitburner-src/blob/stable/markdown/bitburner.ns.md +* Dev version documentation is now kept up to date as changes are made. (@Snarling) + +CODEBASE: +* Updated many dependencies (@d0sboots) +* Updated lots of the build processes and GitHub workflows. (@Snarling) +* Internal refactoring of how BitNode multipliers are stored (@d0sboots) +* Added some extra helper function (useRerender hook, positiveInteger ns argument validator). (@Snarling) MISC: - -* Updated large number of dependency packages (@d0sboots) -* Refactored how bitnode multipliers for max / starting money work. (@d0sboots) * Nerf noodle bar `, }; diff --git a/src/CotMG/StaneksGift.ts b/src/CotMG/StaneksGift.ts index 5d6fbd25b..f5b916a8b 100644 --- a/src/CotMG/StaneksGift.ts +++ b/src/CotMG/StaneksGift.ts @@ -45,7 +45,7 @@ export class StaneksGift extends BaseGift { } inBonus(): boolean { - return (this.storedCycles * CONSTANTS._idleSpeed) / 1000 > 1; + return (this.storedCycles * CONSTANTS.MilliPerCycle) / 1000 > 1; } process(numCycles = 1): void { diff --git a/src/CotMG/ui/StaneksGiftRoot.tsx b/src/CotMG/ui/StaneksGiftRoot.tsx index 8057b9045..bfda3fbbb 100644 --- a/src/CotMG/ui/StaneksGiftRoot.tsx +++ b/src/CotMG/ui/StaneksGiftRoot.tsx @@ -191,7 +191,7 @@ export function StaneksGiftRoot({ staneksGift }: IProps): React.ReactElement { {staneksGift.storedCycles > 5 && ( - Bonus time: {convertTimeMsToTimeElapsedString(CONSTANTS._idleSpeed * staneksGift.storedCycles)} + Bonus time: {convertTimeMsToTimeElapsedString(CONSTANTS.MilliPerCycle * staneksGift.storedCycles)} )} diff --git a/src/Gang/Gang.ts b/src/Gang/Gang.ts index 9a09c068b..c76acdf14 100644 --- a/src/Gang/Gang.ts +++ b/src/Gang/Gang.ts @@ -82,7 +82,7 @@ export class Gang { process(numCycles = 1): void { // Run every cycle - const CyclesPerSecond = 1000 / CONSTANTS._idleSpeed; + const CyclesPerSecond = 1000 / CONSTANTS.MilliPerCycle; if (isNaN(numCycles)) { console.error(`NaN passed into Gang.process(): ${numCycles}`); diff --git a/src/Gang/ui/BonusTime.tsx b/src/Gang/ui/BonusTime.tsx index bfbd1481d..45143eeff 100644 --- a/src/Gang/ui/BonusTime.tsx +++ b/src/Gang/ui/BonusTime.tsx @@ -12,7 +12,7 @@ interface IProps { /** React Component for displaying the bonus time remaining. */ export function BonusTime(props: IProps): React.ReactElement { - const CyclerPerSecond = 1000 / CONSTANTS._idleSpeed; + const CyclerPerSecond = 1000 / CONSTANTS.MilliPerCycle; if ((props.gang.storedCycles / CyclerPerSecond) * 1000 <= 5000) return <>; const bonusMillis = (props.gang.storedCycles / CyclerPerSecond) * 1000; return ( diff --git a/src/NetscriptWorker.ts b/src/NetscriptWorker.ts index aaa38fe94..477725a24 100644 --- a/src/NetscriptWorker.ts +++ b/src/NetscriptWorker.ts @@ -356,7 +356,7 @@ function createAndAddWorkerScript(runningScriptObj: RunningScript, server: BaseS /** Updates the online running time stat of all running scripts */ export function updateOnlineScriptTimes(numCycles = 1): void { - const time = (numCycles * CONSTANTS._idleSpeed) / 1000; //seconds + const time = (numCycles * CONSTANTS.MilliPerCycle) / 1000; //seconds for (const ws of workerScripts.values()) { ws.scriptRef.onlineRunningTime += time; } diff --git a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts index 5d555c92b..cfcd3555b 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts @@ -28,7 +28,7 @@ export class SleeveBladeburnerWork extends Work { cyclesNeeded(sleeve: Sleeve): number { const ret = Player.bladeburner?.getActionTimeNetscriptFn(sleeve, this.actionType, this.actionName); if (!ret || typeof ret === "string") throw new Error(`Error querying ${this.actionName} time`); - return ret / CONSTANTS._idleSpeed; + return ret / CONSTANTS.MilliPerCycle; } process(sleeve: Sleeve, cycles: number) { diff --git a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts index 95ac4f5d1..9987910e1 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts @@ -31,7 +31,7 @@ export class SleeveCrimeWork extends Work { } cyclesNeeded(): number { - return this.getCrime().time / CONSTANTS._idleSpeed; + return this.getCrime().time / CONSTANTS.MilliPerCycle; } process(sleeve: Sleeve, cycles: number) { diff --git a/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts b/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts index a2272d93e..6a9396e81 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts @@ -4,7 +4,7 @@ import { Sleeve } from "../Sleeve"; import { Work, WorkType } from "./Work"; import { CONSTANTS } from "../../../Constants"; -const infiltrateCycles = 60000 / CONSTANTS._idleSpeed; +const infiltrateCycles = 60000 / CONSTANTS.MilliPerCycle; export const isSleeveInfiltrateWork = (w: Work | null): w is SleeveInfiltrateWork => w !== null && w.type === WorkType.INFILTRATE; diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 04696451c..d96520b9c 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -256,11 +256,8 @@ interface BasicHGWOptions { threads?: number; /** Set to true this action will affect the stock market. */ stock?: boolean; - /** Number of additional milliseconds that will be spent waiting between the - * start of the function and when it completes. There will only be one, - * contiguous wait, which is relevant because stats such as server security - * level are computed at the *start* of the function. - * Must be non-negative. */ + /** Number of additional milliseconds that will be spent waiting between the start of the function and when it + * completes. Experimental in 2.2.2, may be removed in 2.3. */ additionalMsec?: number; } @@ -5814,16 +5811,11 @@ export interface NS { getServerMinSecurityLevel(host: string): number; /** - * @deprecated useless + * Get the base security level of a server. * @remarks * RAM cost: 0.1 GB - * Returns the base security level of the target server. This is the security - * level that the server starts out with. This is different than - * getServerSecurityLevel because getServerSecurityLevel returns - * the current security level of a server, which can constantly change due to - * hack, grow, and weaken, calls on that server. - * The base security level will stay the same until you reset by - * installing an Augmentation(s). + * Returns the base security level of the target server. + * For the server's actual security level, use {@link NS.getServerSecurityLevel | ns.getServerSecurityLevel}. * * @param host - Host of target server. * @returns Base security level of the target server. @@ -6478,6 +6470,7 @@ export interface NS { /** * Format a number using the numeral library. This function is deprecated and will be removed in 2.3. + * @deprecated Use ns.formatNumber, formatRam, or formatPercent instead. Will be removed in 2.3. * @remarks * RAM cost: 0 GB * diff --git a/src/Terminal/Terminal.ts b/src/Terminal/Terminal.ts index 3bfa67b03..0a071b99b 100644 --- a/src/Terminal/Terminal.ts +++ b/src/Terminal/Terminal.ts @@ -97,7 +97,7 @@ export class Terminal { process(cycles: number): void { if (this.action === null) return; - this.action.timeLeft -= (CONSTANTS._idleSpeed * cycles) / 1000; + this.action.timeLeft -= (CONSTANTS.MilliPerCycle * cycles) / 1000; if (this.action.timeLeft < 0.01) this.finishAction(false); TerminalEvents.emit(); } diff --git a/src/Work/ClassWork.tsx b/src/Work/ClassWork.tsx index 23d603c78..8d282604c 100644 --- a/src/Work/ClassWork.tsx +++ b/src/Work/ClassWork.tsx @@ -118,7 +118,7 @@ export class ClassWork extends Work { dialogBoxCreate( <> After {this.getClass().youAreCurrently} for{" "} - {convertTimeMsToTimeElapsedString(this.cyclesWorked * CONSTANTS._idleSpeed)},
+ {convertTimeMsToTimeElapsedString(this.cyclesWorked * CONSTANTS.MilliPerCycle)},
you spent a total of .

You earned a total of:
diff --git a/src/Work/CreateProgramWork.ts b/src/Work/CreateProgramWork.ts index dd18b686e..4fc4d090d 100644 --- a/src/Work/CreateProgramWork.ts +++ b/src/Work/CreateProgramWork.ts @@ -67,7 +67,7 @@ export class CreateProgramWork extends Work { skillMult *= focusBonus; //Skill multiplier directly applied to "time worked" this.cyclesWorked += cycles; - this.unitCompleted += CONSTANTS._idleSpeed * cycles * skillMult; + this.unitCompleted += CONSTANTS.MilliPerCycle * cycles * skillMult; if (this.unitCompleted >= this.unitNeeded()) { return true; @@ -79,7 +79,7 @@ export class CreateProgramWork extends Work { if (!cancelled) { //Complete case Player.gainIntelligenceExp( - (CONSTANTS.IntelligenceProgramBaseExpGain * this.cyclesWorked * CONSTANTS._idleSpeed) / 1000, + (CONSTANTS.IntelligenceProgramBaseExpGain * this.cyclesWorked * CONSTANTS.MilliPerCycle) / 1000, ); if (!this.singularity) { const lines = [ diff --git a/src/Work/CrimeWork.ts b/src/Work/CrimeWork.ts index 8f8bf6141..301e5bff1 100644 --- a/src/Work/CrimeWork.ts +++ b/src/Work/CrimeWork.ts @@ -38,7 +38,7 @@ export class CrimeWork extends Work { process(cycles = 1): boolean { this.cyclesWorked += cycles; const time = Object.values(Crimes).find((c) => c.type === this.crimeType)?.time ?? 0; - this.unitCompleted += CONSTANTS._idleSpeed * cycles; + this.unitCompleted += CONSTANTS.MilliPerCycle * cycles; while (this.unitCompleted >= time) { this.commit(); this.unitCompleted -= time; diff --git a/src/Work/Formulas.ts b/src/Work/Formulas.ts index c355d8f1a..54bef44c3 100644 --- a/src/Work/Formulas.ts +++ b/src/Work/Formulas.ts @@ -21,7 +21,7 @@ import { Company } from "../Company/Company"; import { CompanyPosition } from "../Company/CompanyPosition"; import { checkEnum } from "../utils/helpers/enum"; -const gameCPS = 1000 / CONSTANTS._idleSpeed; // 5 cycles per second +const gameCPS = 1000 / CONSTANTS.MilliPerCycle; // 5 cycles per second export const FactionWorkStats: Record = { [FactionWorkType.hacking]: newWorkStats({ hackExp: 2 }), [FactionWorkType.field]: newWorkStats({ diff --git a/src/Work/GraftingWork.tsx b/src/Work/GraftingWork.tsx index 96f8cfc15..2ef2e91c3 100644 --- a/src/Work/GraftingWork.tsx +++ b/src/Work/GraftingWork.tsx @@ -41,7 +41,7 @@ export class GraftingWork extends Work { } this.cyclesWorked += cycles; - this.unitCompleted += CONSTANTS._idleSpeed * cycles * graftingIntBonus() * focusBonus; + this.unitCompleted += CONSTANTS.MilliPerCycle * cycles * graftingIntBonus() * focusBonus; return this.unitCompleted >= this.unitNeeded(); } @@ -78,7 +78,7 @@ export class GraftingWork extends Work { // Intelligence gain if (!cancelled) { Player.gainIntelligenceExp( - (CONSTANTS.IntelligenceGraftBaseExpGain * this.cyclesWorked * CONSTANTS._idleSpeed) / 10000, + (CONSTANTS.IntelligenceGraftBaseExpGain * this.cyclesWorked * CONSTANTS.MilliPerCycle) / 10000, ); } } diff --git a/src/engine.tsx b/src/engine.tsx index d5692dbcd..e050a370e 100644 --- a/src/engine.tsx +++ b/src/engine.tsx @@ -74,7 +74,7 @@ const Engine: { _lastUpdate: new Date().getTime(), updateGame: function (numCycles = 1) { - const time = numCycles * CONSTANTS._idleSpeed; + const time = numCycles * CONSTANTS.MilliPerCycle; if (Player.totalPlaytime == null) { Player.totalPlaytime = 0; } @@ -242,7 +242,7 @@ const Engine: { Engine._lastUpdate = new Date().getTime(); const lastUpdate = Player.lastUpdate; const timeOffline = Engine._lastUpdate - lastUpdate; - const numCyclesOffline = Math.floor(timeOffline / CONSTANTS._idleSpeed); + const numCyclesOffline = Math.floor(timeOffline / CONSTANTS.MilliPerCycle); // Calculate the number of chances for a contract the player had whilst offline const contractChancesWhileOffline = Math.floor(timeOffline / (1000 * 60 * 10)); @@ -332,7 +332,7 @@ const Engine: { Player.sleeves.forEach((sleeve) => sleeve.process(numCyclesOffline)); // Update total playtime - const time = numCyclesOffline * CONSTANTS._idleSpeed; + const time = numCyclesOffline * CONSTANTS.MilliPerCycle; Player.totalPlaytime ??= 0; Player.playtimeSinceLastAug ??= 0; Player.playtimeSinceLastBitnode ??= 0; @@ -390,10 +390,10 @@ const Engine: { // Get time difference const _thisUpdate = new Date().getTime(); let diff = _thisUpdate - Engine._lastUpdate; - const offset = diff % CONSTANTS._idleSpeed; + const offset = diff % CONSTANTS.MilliPerCycle; // Divide this by cycle time to determine how many cycles have elapsed since last update - diff = Math.floor(diff / CONSTANTS._idleSpeed); + diff = Math.floor(diff / CONSTANTS.MilliPerCycle); if (diff > 0) { // Update the game engine by the calculated number of cycles diff --git a/src/ui/React/CharacterOverview.tsx b/src/ui/React/CharacterOverview.tsx index ebd7f7f0b..c5dc94e69 100644 --- a/src/ui/React/CharacterOverview.tsx +++ b/src/ui/React/CharacterOverview.tsx @@ -348,7 +348,7 @@ function Work(): React.ReactElement { if (isClassWork(Player.currentWork)) { details = <>{Player.currentWork.getClass().youAreCurrently}; header = <>You are {Player.currentWork.getClass().youAreCurrently}; - innerText = <>{convertTimeMsToTimeElapsedString(Player.currentWork.cyclesWorked * CONSTANTS._idleSpeed)}; + innerText = <>{convertTimeMsToTimeElapsedString(Player.currentWork.cyclesWorked * CONSTANTS.MilliPerCycle)}; } if (isCreateProgramWork(Player.currentWork)) { const create = Player.currentWork; @@ -382,7 +382,7 @@ function Work(): React.ReactElement { <> rep
( - ) + ) ); } @@ -402,7 +402,7 @@ function Work(): React.ReactElement { <> rep
( - ) + ) ); } diff --git a/src/ui/WorkInProgressRoot.tsx b/src/ui/WorkInProgressRoot.tsx index cdc4e8b11..141519f12 100644 --- a/src/ui/WorkInProgressRoot.tsx +++ b/src/ui/WorkInProgressRoot.tsx @@ -286,7 +286,7 @@ export function WorkInProgressRoot(): React.ReactElement { ...ExpRows(rates), ], progress: { - elapsed: classWork.cyclesWorked * CONSTANTS._idleSpeed, + elapsed: classWork.cyclesWorked * CONSTANTS.MilliPerCycle, }, stopText: stopText, @@ -318,7 +318,7 @@ export function WorkInProgressRoot(): React.ReactElement { ), progress: { - elapsed: create.cyclesWorked * CONSTANTS._idleSpeed, + elapsed: create.cyclesWorked * CONSTANTS.MilliPerCycle, percentage: completion, }, @@ -350,7 +350,7 @@ export function WorkInProgressRoot(): React.ReactElement { ), progress: { - elapsed: graft.cyclesWorked * CONSTANTS._idleSpeed, + elapsed: graft.cyclesWorked * CONSTANTS.MilliPerCycle, percentage: (graft.unitCompleted / graft.unitNeeded()) * 100, }, @@ -414,7 +414,7 @@ export function WorkInProgressRoot(): React.ReactElement { ), gains: ExpRows(exp), progress: { - elapsed: Player.currentWork.cyclesWorked * CONSTANTS._idleSpeed, + elapsed: Player.currentWork.cyclesWorked * CONSTANTS.MilliPerCycle, }, stopText: "Stop Faction work", @@ -479,7 +479,7 @@ export function WorkInProgressRoot(): React.ReactElement { ...ExpRows(gains), ], progress: { - elapsed: Player.currentWork.cyclesWorked * CONSTANTS._idleSpeed, + elapsed: Player.currentWork.cyclesWorked * CONSTANTS.MilliPerCycle, }, stopText: "Stop working",