mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-08 16:53:54 +01:00
2.2.2 Release (#378)
This commit is contained in:
parent
bba6b26ac1
commit
d3f9554a6e
@ -3,6 +3,91 @@
|
|||||||
Changelog
|
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
|
v2.2.1 Hotfixes
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ documentation_title = '{0} Documentation'.format(project)
|
|||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '2.2'
|
version = '2.2'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# 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
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## BasicHGWOptions.additionalMsec property
|
## 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:**
|
**Signature:**
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ interface BasicHGWOptions
|
|||||||
|
|
||||||
| Property | Modifiers | Type | Description |
|
| 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. |
|
| [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. |
|
| [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. |
|
||||||
|
|
||||||
|
@ -4,10 +4,7 @@
|
|||||||
|
|
||||||
## NS.getServerBaseSecurityLevel() method
|
## NS.getServerBaseSecurityLevel() method
|
||||||
|
|
||||||
> Warning: This API is now obsolete.
|
Get the base security level of a server.
|
||||||
>
|
|
||||||
> useless
|
|
||||||
>
|
|
||||||
|
|
||||||
**Signature:**
|
**Signature:**
|
||||||
|
|
||||||
@ -29,5 +26,5 @@ Base security level of the target server.
|
|||||||
|
|
||||||
## Remarks
|
## 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)<!-- -->.
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ export async function main(ns) {
|
|||||||
| [getScriptName()](./bitburner.ns.getscriptname.md) | Returns the current script name. |
|
| [getScriptName()](./bitburner.ns.getscriptname.md) | Returns the current script name. |
|
||||||
| [getScriptRam(script, host)](./bitburner.ns.getscriptram.md) | Get the ram cost of a script. |
|
| [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. |
|
| [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. |
|
| [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. |
|
| [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. |
|
| [getServerMaxRam(host)](./bitburner.ns.getservermaxram.md) | Get the maximum amount of RAM on a server. |
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
|
|
||||||
## NS.nFormat() method
|
## 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.
|
Format a number using the numeral library. This function is deprecated and will be removed in 2.3.
|
||||||
|
|
||||||
**Signature:**
|
**Signature:**
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "bitburner",
|
"name": "bitburner",
|
||||||
"version": "2.2.2dev",
|
"version": "2.2.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "bitburner",
|
"name": "bitburner",
|
||||||
"version": "2.2.2dev",
|
"version": "2.2.2",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "SEE LICENSE IN license.txt",
|
"license": "SEE LICENSE IN license.txt",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "bitburner",
|
"name": "bitburner",
|
||||||
"license": "SEE LICENSE IN license.txt",
|
"license": "SEE LICENSE IN license.txt",
|
||||||
"version": "2.2.2dev",
|
"version": "2.2.2",
|
||||||
"main": "electron-main.js",
|
"main": "electron-main.js",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Daniel Xie, Olivier Gagnon, et al."
|
"name": "Daniel Xie, Olivier Gagnon, et al."
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
export const CONSTANTS: {
|
export const CONSTANTS: {
|
||||||
VersionString: string;
|
VersionString: string;
|
||||||
VersionNumber: number;
|
VersionNumber: number;
|
||||||
_idleSpeed: number;
|
|
||||||
MaxSkillLevel: number;
|
MaxSkillLevel: number;
|
||||||
MilliPerCycle: number;
|
MilliPerCycle: number;
|
||||||
CorpFactionRepRequirement: number;
|
CorpFactionRepRequirement: number;
|
||||||
@ -88,11 +87,8 @@ export const CONSTANTS: {
|
|||||||
Donations: number; // number of blood/plasma/palette donation the dev have verified., boosts NFG
|
Donations: number; // number of blood/plasma/palette donation the dev have verified., boosts NFG
|
||||||
LatestUpdate: string;
|
LatestUpdate: string;
|
||||||
} = {
|
} = {
|
||||||
VersionString: "2.2.2dev",
|
VersionString: "2.2.2",
|
||||||
VersionNumber: 29,
|
VersionNumber: 30,
|
||||||
|
|
||||||
// Speed (in ms) at which the main loop is updated
|
|
||||||
_idleSpeed: 200,
|
|
||||||
|
|
||||||
/** Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
/** 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
|
* 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,
|
Donations: 41,
|
||||||
|
|
||||||
LatestUpdate: `
|
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)
|
* 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:
|
MISC:
|
||||||
|
|
||||||
* Updated large number of dependency packages (@d0sboots)
|
|
||||||
* Refactored how bitnode multipliers for max / starting money work. (@d0sboots)
|
|
||||||
* Nerf noodle bar
|
* Nerf noodle bar
|
||||||
`,
|
`,
|
||||||
};
|
};
|
||||||
|
@ -45,7 +45,7 @@ export class StaneksGift extends BaseGift {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inBonus(): boolean {
|
inBonus(): boolean {
|
||||||
return (this.storedCycles * CONSTANTS._idleSpeed) / 1000 > 1;
|
return (this.storedCycles * CONSTANTS.MilliPerCycle) / 1000 > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
process(numCycles = 1): void {
|
process(numCycles = 1): void {
|
||||||
|
@ -191,7 +191,7 @@ export function StaneksGiftRoot({ staneksGift }: IProps): React.ReactElement {
|
|||||||
</Typography>
|
</Typography>
|
||||||
{staneksGift.storedCycles > 5 && (
|
{staneksGift.storedCycles > 5 && (
|
||||||
<Typography sx={{ mb: 1 }}>
|
<Typography sx={{ mb: 1 }}>
|
||||||
Bonus time: {convertTimeMsToTimeElapsedString(CONSTANTS._idleSpeed * staneksGift.storedCycles)}
|
Bonus time: {convertTimeMsToTimeElapsedString(CONSTANTS.MilliPerCycle * staneksGift.storedCycles)}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
<MainBoard gift={staneksGift} />
|
<MainBoard gift={staneksGift} />
|
||||||
|
@ -82,7 +82,7 @@ export class Gang {
|
|||||||
|
|
||||||
process(numCycles = 1): void {
|
process(numCycles = 1): void {
|
||||||
// Run every cycle
|
// Run every cycle
|
||||||
const CyclesPerSecond = 1000 / CONSTANTS._idleSpeed;
|
const CyclesPerSecond = 1000 / CONSTANTS.MilliPerCycle;
|
||||||
|
|
||||||
if (isNaN(numCycles)) {
|
if (isNaN(numCycles)) {
|
||||||
console.error(`NaN passed into Gang.process(): ${numCycles}`);
|
console.error(`NaN passed into Gang.process(): ${numCycles}`);
|
||||||
|
@ -12,7 +12,7 @@ interface IProps {
|
|||||||
|
|
||||||
/** React Component for displaying the bonus time remaining. */
|
/** React Component for displaying the bonus time remaining. */
|
||||||
export function BonusTime(props: IProps): React.ReactElement {
|
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 <></>;
|
if ((props.gang.storedCycles / CyclerPerSecond) * 1000 <= 5000) return <></>;
|
||||||
const bonusMillis = (props.gang.storedCycles / CyclerPerSecond) * 1000;
|
const bonusMillis = (props.gang.storedCycles / CyclerPerSecond) * 1000;
|
||||||
return (
|
return (
|
||||||
|
@ -356,7 +356,7 @@ function createAndAddWorkerScript(runningScriptObj: RunningScript, server: BaseS
|
|||||||
|
|
||||||
/** Updates the online running time stat of all running scripts */
|
/** Updates the online running time stat of all running scripts */
|
||||||
export function updateOnlineScriptTimes(numCycles = 1): void {
|
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()) {
|
for (const ws of workerScripts.values()) {
|
||||||
ws.scriptRef.onlineRunningTime += time;
|
ws.scriptRef.onlineRunningTime += time;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ export class SleeveBladeburnerWork extends Work {
|
|||||||
cyclesNeeded(sleeve: Sleeve): number {
|
cyclesNeeded(sleeve: Sleeve): number {
|
||||||
const ret = Player.bladeburner?.getActionTimeNetscriptFn(sleeve, this.actionType, this.actionName);
|
const ret = Player.bladeburner?.getActionTimeNetscriptFn(sleeve, this.actionType, this.actionName);
|
||||||
if (!ret || typeof ret === "string") throw new Error(`Error querying ${this.actionName} time`);
|
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) {
|
process(sleeve: Sleeve, cycles: number) {
|
||||||
|
@ -31,7 +31,7 @@ export class SleeveCrimeWork extends Work {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cyclesNeeded(): number {
|
cyclesNeeded(): number {
|
||||||
return this.getCrime().time / CONSTANTS._idleSpeed;
|
return this.getCrime().time / CONSTANTS.MilliPerCycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
process(sleeve: Sleeve, cycles: number) {
|
process(sleeve: Sleeve, cycles: number) {
|
||||||
|
@ -4,7 +4,7 @@ import { Sleeve } from "../Sleeve";
|
|||||||
import { Work, WorkType } from "./Work";
|
import { Work, WorkType } from "./Work";
|
||||||
import { CONSTANTS } from "../../../Constants";
|
import { CONSTANTS } from "../../../Constants";
|
||||||
|
|
||||||
const infiltrateCycles = 60000 / CONSTANTS._idleSpeed;
|
const infiltrateCycles = 60000 / CONSTANTS.MilliPerCycle;
|
||||||
|
|
||||||
export const isSleeveInfiltrateWork = (w: Work | null): w is SleeveInfiltrateWork =>
|
export const isSleeveInfiltrateWork = (w: Work | null): w is SleeveInfiltrateWork =>
|
||||||
w !== null && w.type === WorkType.INFILTRATE;
|
w !== null && w.type === WorkType.INFILTRATE;
|
||||||
|
19
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
19
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -256,11 +256,8 @@ interface BasicHGWOptions {
|
|||||||
threads?: number;
|
threads?: number;
|
||||||
/** Set to true this action will affect the stock market. */
|
/** Set to true this action will affect the stock market. */
|
||||||
stock?: boolean;
|
stock?: boolean;
|
||||||
/** Number of additional milliseconds that will be spent waiting between the
|
/** Number of additional milliseconds that will be spent waiting between the start of the function and when it
|
||||||
* start of the function and when it completes. There will only be one,
|
* completes. Experimental in 2.2.2, may be removed in 2.3. */
|
||||||
* 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?: number;
|
additionalMsec?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5814,16 +5811,11 @@ export interface NS {
|
|||||||
getServerMinSecurityLevel(host: string): number;
|
getServerMinSecurityLevel(host: string): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated useless
|
* Get the base security level of a server.
|
||||||
* @remarks
|
* @remarks
|
||||||
* RAM cost: 0.1 GB
|
* RAM cost: 0.1 GB
|
||||||
* Returns the base security level of the target server. This is the security
|
* Returns the base security level of the target server.
|
||||||
* level that the server starts out with. This is different than
|
* For the server's actual security level, use {@link NS.getServerSecurityLevel | ns.getServerSecurityLevel}.
|
||||||
* 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).
|
|
||||||
*
|
*
|
||||||
* @param host - Host of target server.
|
* @param host - Host of target server.
|
||||||
* @returns Base security level of the 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.
|
* 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
|
* @remarks
|
||||||
* RAM cost: 0 GB
|
* RAM cost: 0 GB
|
||||||
*
|
*
|
||||||
|
@ -97,7 +97,7 @@ export class Terminal {
|
|||||||
|
|
||||||
process(cycles: number): void {
|
process(cycles: number): void {
|
||||||
if (this.action === null) return;
|
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);
|
if (this.action.timeLeft < 0.01) this.finishAction(false);
|
||||||
TerminalEvents.emit();
|
TerminalEvents.emit();
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ export class ClassWork extends Work {
|
|||||||
dialogBoxCreate(
|
dialogBoxCreate(
|
||||||
<>
|
<>
|
||||||
After {this.getClass().youAreCurrently} for{" "}
|
After {this.getClass().youAreCurrently} for{" "}
|
||||||
{convertTimeMsToTimeElapsedString(this.cyclesWorked * CONSTANTS._idleSpeed)}, <br />
|
{convertTimeMsToTimeElapsedString(this.cyclesWorked * CONSTANTS.MilliPerCycle)}, <br />
|
||||||
you spent a total of <Money money={-this.earnings.money} />. <br />
|
you spent a total of <Money money={-this.earnings.money} />. <br />
|
||||||
<br />
|
<br />
|
||||||
You earned a total of: <br />
|
You earned a total of: <br />
|
||||||
|
@ -67,7 +67,7 @@ export class CreateProgramWork extends Work {
|
|||||||
skillMult *= focusBonus;
|
skillMult *= focusBonus;
|
||||||
//Skill multiplier directly applied to "time worked"
|
//Skill multiplier directly applied to "time worked"
|
||||||
this.cyclesWorked += cycles;
|
this.cyclesWorked += cycles;
|
||||||
this.unitCompleted += CONSTANTS._idleSpeed * cycles * skillMult;
|
this.unitCompleted += CONSTANTS.MilliPerCycle * cycles * skillMult;
|
||||||
|
|
||||||
if (this.unitCompleted >= this.unitNeeded()) {
|
if (this.unitCompleted >= this.unitNeeded()) {
|
||||||
return true;
|
return true;
|
||||||
@ -79,7 +79,7 @@ export class CreateProgramWork extends Work {
|
|||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
//Complete case
|
//Complete case
|
||||||
Player.gainIntelligenceExp(
|
Player.gainIntelligenceExp(
|
||||||
(CONSTANTS.IntelligenceProgramBaseExpGain * this.cyclesWorked * CONSTANTS._idleSpeed) / 1000,
|
(CONSTANTS.IntelligenceProgramBaseExpGain * this.cyclesWorked * CONSTANTS.MilliPerCycle) / 1000,
|
||||||
);
|
);
|
||||||
if (!this.singularity) {
|
if (!this.singularity) {
|
||||||
const lines = [
|
const lines = [
|
||||||
|
@ -38,7 +38,7 @@ export class CrimeWork extends Work {
|
|||||||
process(cycles = 1): boolean {
|
process(cycles = 1): boolean {
|
||||||
this.cyclesWorked += cycles;
|
this.cyclesWorked += cycles;
|
||||||
const time = Object.values(Crimes).find((c) => c.type === this.crimeType)?.time ?? 0;
|
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) {
|
while (this.unitCompleted >= time) {
|
||||||
this.commit();
|
this.commit();
|
||||||
this.unitCompleted -= time;
|
this.unitCompleted -= time;
|
||||||
|
@ -21,7 +21,7 @@ import { Company } from "../Company/Company";
|
|||||||
import { CompanyPosition } from "../Company/CompanyPosition";
|
import { CompanyPosition } from "../Company/CompanyPosition";
|
||||||
import { checkEnum } from "../utils/helpers/enum";
|
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, WorkStats> = {
|
export const FactionWorkStats: Record<FactionWorkType, WorkStats> = {
|
||||||
[FactionWorkType.hacking]: newWorkStats({ hackExp: 2 }),
|
[FactionWorkType.hacking]: newWorkStats({ hackExp: 2 }),
|
||||||
[FactionWorkType.field]: newWorkStats({
|
[FactionWorkType.field]: newWorkStats({
|
||||||
|
@ -41,7 +41,7 @@ export class GraftingWork extends Work {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.cyclesWorked += cycles;
|
this.cyclesWorked += cycles;
|
||||||
this.unitCompleted += CONSTANTS._idleSpeed * cycles * graftingIntBonus() * focusBonus;
|
this.unitCompleted += CONSTANTS.MilliPerCycle * cycles * graftingIntBonus() * focusBonus;
|
||||||
|
|
||||||
return this.unitCompleted >= this.unitNeeded();
|
return this.unitCompleted >= this.unitNeeded();
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ export class GraftingWork extends Work {
|
|||||||
// Intelligence gain
|
// Intelligence gain
|
||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
Player.gainIntelligenceExp(
|
Player.gainIntelligenceExp(
|
||||||
(CONSTANTS.IntelligenceGraftBaseExpGain * this.cyclesWorked * CONSTANTS._idleSpeed) / 10000,
|
(CONSTANTS.IntelligenceGraftBaseExpGain * this.cyclesWorked * CONSTANTS.MilliPerCycle) / 10000,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ const Engine: {
|
|||||||
_lastUpdate: new Date().getTime(),
|
_lastUpdate: new Date().getTime(),
|
||||||
|
|
||||||
updateGame: function (numCycles = 1) {
|
updateGame: function (numCycles = 1) {
|
||||||
const time = numCycles * CONSTANTS._idleSpeed;
|
const time = numCycles * CONSTANTS.MilliPerCycle;
|
||||||
if (Player.totalPlaytime == null) {
|
if (Player.totalPlaytime == null) {
|
||||||
Player.totalPlaytime = 0;
|
Player.totalPlaytime = 0;
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ const Engine: {
|
|||||||
Engine._lastUpdate = new Date().getTime();
|
Engine._lastUpdate = new Date().getTime();
|
||||||
const lastUpdate = Player.lastUpdate;
|
const lastUpdate = Player.lastUpdate;
|
||||||
const timeOffline = Engine._lastUpdate - 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
|
// Calculate the number of chances for a contract the player had whilst offline
|
||||||
const contractChancesWhileOffline = Math.floor(timeOffline / (1000 * 60 * 10));
|
const contractChancesWhileOffline = Math.floor(timeOffline / (1000 * 60 * 10));
|
||||||
@ -332,7 +332,7 @@ const Engine: {
|
|||||||
Player.sleeves.forEach((sleeve) => sleeve.process(numCyclesOffline));
|
Player.sleeves.forEach((sleeve) => sleeve.process(numCyclesOffline));
|
||||||
|
|
||||||
// Update total playtime
|
// Update total playtime
|
||||||
const time = numCyclesOffline * CONSTANTS._idleSpeed;
|
const time = numCyclesOffline * CONSTANTS.MilliPerCycle;
|
||||||
Player.totalPlaytime ??= 0;
|
Player.totalPlaytime ??= 0;
|
||||||
Player.playtimeSinceLastAug ??= 0;
|
Player.playtimeSinceLastAug ??= 0;
|
||||||
Player.playtimeSinceLastBitnode ??= 0;
|
Player.playtimeSinceLastBitnode ??= 0;
|
||||||
@ -390,10 +390,10 @@ const Engine: {
|
|||||||
// Get time difference
|
// Get time difference
|
||||||
const _thisUpdate = new Date().getTime();
|
const _thisUpdate = new Date().getTime();
|
||||||
let diff = _thisUpdate - Engine._lastUpdate;
|
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
|
// 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) {
|
if (diff > 0) {
|
||||||
// Update the game engine by the calculated number of cycles
|
// Update the game engine by the calculated number of cycles
|
||||||
|
@ -348,7 +348,7 @@ function Work(): React.ReactElement {
|
|||||||
if (isClassWork(Player.currentWork)) {
|
if (isClassWork(Player.currentWork)) {
|
||||||
details = <>{Player.currentWork.getClass().youAreCurrently}</>;
|
details = <>{Player.currentWork.getClass().youAreCurrently}</>;
|
||||||
header = <>You are {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)) {
|
if (isCreateProgramWork(Player.currentWork)) {
|
||||||
const create = Player.currentWork;
|
const create = Player.currentWork;
|
||||||
@ -382,7 +382,7 @@ function Work(): React.ReactElement {
|
|||||||
<>
|
<>
|
||||||
<Reputation reputation={factionWork.getFaction().playerReputation} /> rep
|
<Reputation reputation={factionWork.getFaction().playerReputation} /> rep
|
||||||
<br />(
|
<br />(
|
||||||
<ReputationRate reputation={factionWork.getReputationRate() * (1000 / CONSTANTS._idleSpeed)} />)
|
<ReputationRate reputation={factionWork.getReputationRate() * (1000 / CONSTANTS.MilliPerCycle)} />)
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ function Work(): React.ReactElement {
|
|||||||
<>
|
<>
|
||||||
<Reputation reputation={companyWork.getCompany().playerReputation} /> rep
|
<Reputation reputation={companyWork.getCompany().playerReputation} /> rep
|
||||||
<br />(
|
<br />(
|
||||||
<ReputationRate reputation={companyWork.getGainRates().reputation * (1000 / CONSTANTS._idleSpeed)} />)
|
<ReputationRate reputation={companyWork.getGainRates().reputation * (1000 / CONSTANTS.MilliPerCycle)} />)
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
|||||||
...ExpRows(rates),
|
...ExpRows(rates),
|
||||||
],
|
],
|
||||||
progress: {
|
progress: {
|
||||||
elapsed: classWork.cyclesWorked * CONSTANTS._idleSpeed,
|
elapsed: classWork.cyclesWorked * CONSTANTS.MilliPerCycle,
|
||||||
},
|
},
|
||||||
|
|
||||||
stopText: stopText,
|
stopText: stopText,
|
||||||
@ -318,7 +318,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
|||||||
),
|
),
|
||||||
|
|
||||||
progress: {
|
progress: {
|
||||||
elapsed: create.cyclesWorked * CONSTANTS._idleSpeed,
|
elapsed: create.cyclesWorked * CONSTANTS.MilliPerCycle,
|
||||||
percentage: completion,
|
percentage: completion,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -350,7 +350,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
|||||||
),
|
),
|
||||||
|
|
||||||
progress: {
|
progress: {
|
||||||
elapsed: graft.cyclesWorked * CONSTANTS._idleSpeed,
|
elapsed: graft.cyclesWorked * CONSTANTS.MilliPerCycle,
|
||||||
percentage: (graft.unitCompleted / graft.unitNeeded()) * 100,
|
percentage: (graft.unitCompleted / graft.unitNeeded()) * 100,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
|||||||
),
|
),
|
||||||
gains: ExpRows(exp),
|
gains: ExpRows(exp),
|
||||||
progress: {
|
progress: {
|
||||||
elapsed: Player.currentWork.cyclesWorked * CONSTANTS._idleSpeed,
|
elapsed: Player.currentWork.cyclesWorked * CONSTANTS.MilliPerCycle,
|
||||||
},
|
},
|
||||||
|
|
||||||
stopText: "Stop Faction work",
|
stopText: "Stop Faction work",
|
||||||
@ -479,7 +479,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
|||||||
...ExpRows(gains),
|
...ExpRows(gains),
|
||||||
],
|
],
|
||||||
progress: {
|
progress: {
|
||||||
elapsed: Player.currentWork.cyclesWorked * CONSTANTS._idleSpeed,
|
elapsed: Player.currentWork.cyclesWorked * CONSTANTS.MilliPerCycle,
|
||||||
},
|
},
|
||||||
|
|
||||||
stopText: "Stop working",
|
stopText: "Stop working",
|
||||||
|
Loading…
Reference in New Issue
Block a user