This commit is contained in:
Olivier Gagnon 2022-01-18 14:02:12 -05:00
parent c5089ab82a
commit 05cbc25a8f
36 changed files with 355 additions and 178 deletions

63
dist/bitburner.d.ts vendored

@ -1093,6 +1093,16 @@ export declare interface Fragment {
limit: number;
}
/**
* Game Information
* @internal
*/
export declare interface GameInfo {
version: string;
commit: string;
platform: string;
}
/**
* Gang API
* @remarks
@ -3442,9 +3452,9 @@ export declare interface NS extends Singularity {
* @remarks
* RAM cost: 0.1 GB
*
* Returns the servers instrinsic growth parameter. This growth
* parameter is a number between 0 and 100 that represents how
* quickly the servers money grows. This parameter affects the
* Returns the servers intrinsic growth parameter. This growth
* parameter is a number typically between 0 and 100 that represents
* how quickly the servers money grows. This parameter affects the
* percentage by which the servers money is increased when using the
* grow function. A higher growth parameter will result in a
* higher percentage increase from grow.
@ -4333,6 +4343,20 @@ export declare interface NS extends Singularity {
* ```
*/
flags(schema: [string, string | number | boolean | string[]][]): any;
/**
* Share your computer with your factions. Increasing your rep gain for a short duration.
* @remarks
* RAM cost: 2.4 GB
*/
share(): Promise<void>;
/**
* Calculate your share power.
* @remarks
* RAM cost: 0.2 GB
*/
getSharePower(): number;
}
/**
@ -5827,7 +5851,7 @@ export declare interface Stanek {
/**
* List possible fragments.
* @remarks
* RAM cost: cost: 0 GB
* RAM cost: 0 GB
*
* @returns List of possible fragments.
*/
@ -5836,7 +5860,7 @@ export declare interface Stanek {
/**
* List of fragments in Stanek's Gift.
* @remarks
* RAM cost: cost: 5 GB
* RAM cost: 5 GB
*
* @returns List of active fragments placed on Stanek's Gift.
*/
@ -5845,14 +5869,14 @@ export declare interface Stanek {
/**
* Clear the board of all fragments.
* @remarks
* RAM cost: cost: 0 GB
* RAM cost: 0 GB
*/
clear(): void;
/**
* Check if fragment can be placed at specified location.
* @remarks
* RAM cost: cost: 0.5 GB
* RAM cost: 0.5 GB
*
* @param rootX - rootX Root X against which to align the top left of the fragment.
* @param rootY - rootY Root Y against which to align the top left of the fragment.
@ -5864,7 +5888,7 @@ export declare interface Stanek {
/**
* Place fragment on Stanek's Gift.
* @remarks
* RAM cost: cost: 5 GB
* RAM cost: 5 GB
*
* @param rootX - X against which to align the top left of the fragment.
* @param rootY - Y against which to align the top left of the fragment.
@ -5876,7 +5900,7 @@ export declare interface Stanek {
/**
* Get placed fragment at location.
* @remarks
* RAM cost: cost: 5 GB
* RAM cost: 5 GB
*
* @param rootX - X against which to align the top left of the fragment.
* @param rootY - Y against which to align the top left of the fragment.
@ -5887,7 +5911,7 @@ export declare interface Stanek {
/**
* Remove fragment at location.
* @remarks
* RAM cost: cost: 0.15 GB
* RAM cost: 0.15 GB
*
* @param rootX - X against which to align the top left of the fragment.
* @param rootY - Y against which to align the top left of the fragment.
@ -6292,7 +6316,7 @@ export declare interface UserInterface {
/**
* Get the current theme
* @remarks
* RAM cost: cost: 0 GB
* RAM cost: 0 GB
*
* @returns An object containing the theme's colors
*/
@ -6301,7 +6325,7 @@ export declare interface UserInterface {
/**
* Sets the current theme
* @remarks
* RAM cost: cost: 0 GB
* RAM cost: 0 GB
* @example
* Usage example (NS2)
* ```ts
@ -6315,14 +6339,14 @@ export declare interface UserInterface {
/**
* Resets the player's theme to the default values
* @remarks
* RAM cost: cost: 0 GB
* RAM cost: 0 GB
*/
resetTheme(): void;
/**
* Get the current styles
* @remarks
* RAM cost: cost: 0 GB
* RAM cost: 0 GB
*
* @returns An object containing the player's styles
*/
@ -6331,7 +6355,7 @@ export declare interface UserInterface {
/**
* Sets the current styles
* @remarks
* RAM cost: cost: 0 GB
* RAM cost: 0 GB
* @example
* Usage example (NS2)
* ```ts
@ -6345,9 +6369,16 @@ export declare interface UserInterface {
/**
* Resets the player's styles to the default values
* @remarks
* RAM cost: cost: 0 GB
* RAM cost: 0 GB
*/
resetStyles(): void;
/**
* Gets the current game information (version, commit, ...)
* @remarks
* RAM cost: 0 GB
*/
getGameInfo(): GameInfo;
}
/**

36
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -17315,7 +17315,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!NS#getServerGrowth:member(1)",
"docComment": "/**\n * Get a server growth parameter.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Returns the servers instrinsic “growth parameter”. This growth parameter is a number between 0 and 100 that represents how quickly the servers money grows. This parameter affects the percentage by which the servers money is increased when using the grow function. A higher growth parameter will result in a higher percentage increase from grow.\n *\n * @param host - Host of target server.\n *\n * @returns Parameter that affects the percentage by which the servers money is increased when using the grow function.\n */\n",
"docComment": "/**\n * Get a server growth parameter.\n *\n * @remarks\n *\n * RAM cost: 0.1 GB\n *\n * Returns the servers intrinsic “growth parameter”. This growth parameter is a number typically between 0 and 100 that represents how quickly the servers money grows. This parameter affects the percentage by which the servers money is increased when using the grow function. A higher growth parameter will result in a higher percentage increase from grow.\n *\n * @param host - Host of target server.\n *\n * @returns Parameter that affects the percentage by which the servers money is increased when using the grow function.\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -17752,6 +17752,34 @@
],
"name": "getServerUsedRam"
},
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!NS#getSharePower:member(1)",
"docComment": "/**\n * Calculate your share power.\n *\n * @remarks\n *\n * RAM cost: 0.2 GB\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "getSharePower(): "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ";"
}
],
"isOptional": false,
"returnTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [],
"name": "getSharePower"
},
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!NS#getTimeSinceLastAug:member(1)",
@ -19759,6 +19787,39 @@
],
"name": "serverExists"
},
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!NS#share:member(1)",
"docComment": "/**\n * Share your computer with your factions. Increasing your rep gain for a short duration.\n *\n * @remarks\n *\n * RAM cost: 2.4 GB\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "share(): "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<void>"
},
{
"kind": "Content",
"text": ";"
}
],
"isOptional": false,
"returnTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [],
"name": "share"
},
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!NS#sleep:member(1)",
@ -29586,7 +29647,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!Stanek#activeFragments:member(1)",
"docComment": "/**\n * List of fragments in Stanek's Gift.\n *\n * @remarks\n *\n * RAM cost: cost: 5 GB\n *\n * @returns List of active fragments placed on Stanek's Gift.\n */\n",
"docComment": "/**\n * List of fragments in Stanek's Gift.\n *\n * @remarks\n *\n * RAM cost: 5 GB\n *\n * @returns List of active fragments placed on Stanek's Gift.\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -29619,7 +29680,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!Stanek#canPlace:member(1)",
"docComment": "/**\n * Check if fragment can be placed at specified location.\n *\n * @remarks\n *\n * RAM cost: cost: 0.5 GB\n *\n * @param rootX - rootX Root X against which to align the top left of the fragment.\n *\n * @param rootY - rootY Root Y against which to align the top left of the fragment.\n *\n * @param rotation - rotation A number from 0 to 3, the mount of 90 degree turn to take.\n *\n * @param fragmentId - fragmentId ID of the fragment to place.\n *\n * @returns true if the fragment can be placed at that position. false otherwise.\n */\n",
"docComment": "/**\n * Check if fragment can be placed at specified location.\n *\n * @remarks\n *\n * RAM cost: 0.5 GB\n *\n * @param rootX - rootX Root X against which to align the top left of the fragment.\n *\n * @param rootY - rootY Root Y against which to align the top left of the fragment.\n *\n * @param rotation - rotation A number from 0 to 3, the mount of 90 degree turn to take.\n *\n * @param fragmentId - fragmentId ID of the fragment to place.\n *\n * @returns true if the fragment can be placed at that position. false otherwise.\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -29772,7 +29833,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!Stanek#clear:member(1)",
"docComment": "/**\n * Clear the board of all fragments.\n *\n * @remarks\n *\n * RAM cost: cost: 0 GB\n */\n",
"docComment": "/**\n * Clear the board of all fragments.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -29800,7 +29861,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!Stanek#fragmentDefinitions:member(1)",
"docComment": "/**\n * List possible fragments.\n *\n * @remarks\n *\n * RAM cost: cost: 0 GB\n *\n * @returns List of possible fragments.\n */\n",
"docComment": "/**\n * List possible fragments.\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @returns List of possible fragments.\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -29833,7 +29894,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!Stanek#get:member(1)",
"docComment": "/**\n * Get placed fragment at location.\n *\n * @remarks\n *\n * RAM cost: cost: 5 GB\n *\n * @param rootX - X against which to align the top left of the fragment.\n *\n * @param rootY - Y against which to align the top left of the fragment.\n *\n * @returns The fragment at [rootX, rootY], if any.\n */\n",
"docComment": "/**\n * Get placed fragment at location.\n *\n * @remarks\n *\n * RAM cost: 5 GB\n *\n * @param rootX - X against which to align the top left of the fragment.\n *\n * @param rootY - Y against which to align the top left of the fragment.\n *\n * @returns The fragment at [rootX, rootY], if any.\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -29925,7 +29986,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!Stanek#place:member(1)",
"docComment": "/**\n * Place fragment on Stanek's Gift.\n *\n * @remarks\n *\n * RAM cost: cost: 5 GB\n *\n * @param rootX - X against which to align the top left of the fragment.\n *\n * @param rootY - Y against which to align the top left of the fragment.\n *\n * @param rotation - A number from 0 to 3, the mount of 90 degree turn to take.\n *\n * @param fragmentId - ID of the fragment to place.\n *\n * @returns true if the fragment can be placed at that position. false otherwise.\n */\n",
"docComment": "/**\n * Place fragment on Stanek's Gift.\n *\n * @remarks\n *\n * RAM cost: 5 GB\n *\n * @param rootX - X against which to align the top left of the fragment.\n *\n * @param rootY - Y against which to align the top left of the fragment.\n *\n * @param rotation - A number from 0 to 3, the mount of 90 degree turn to take.\n *\n * @param fragmentId - ID of the fragment to place.\n *\n * @returns true if the fragment can be placed at that position. false otherwise.\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -30014,7 +30075,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!Stanek#remove:member(1)",
"docComment": "/**\n * Remove fragment at location.\n *\n * @remarks\n *\n * RAM cost: cost: 0.15 GB\n *\n * @param rootX - X against which to align the top left of the fragment.\n *\n * @param rootY - Y against which to align the top left of the fragment.\n *\n * @returns The fragment at [rootX, rootY], if any.\n */\n",
"docComment": "/**\n * Remove fragment at location.\n *\n * @remarks\n *\n * RAM cost: 0.15 GB\n *\n * @param rootX - X against which to align the top left of the fragment.\n *\n * @param rootY - Y against which to align the top left of the fragment.\n *\n * @returns The fragment at [rootX, rootY], if any.\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -31328,10 +31389,39 @@
"releaseTag": "Public",
"name": "UserInterface",
"members": [
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!UserInterface#getGameInfo:member(1)",
"docComment": "/**\n * Gets the current game information (version, commit, ...)\n *\n * @remarks\n *\n * RAM cost: 0 GB\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "getGameInfo(): "
},
{
"kind": "Reference",
"text": "GameInfo",
"canonicalReference": "bitburner!GameInfo:interface"
},
{
"kind": "Content",
"text": ";"
}
],
"isOptional": false,
"returnTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [],
"name": "getGameInfo"
},
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!UserInterface#getStyles:member(1)",
"docComment": "/**\n * Get the current styles\n *\n * @remarks\n *\n * RAM cost: cost: 0 GB\n *\n * @returns An object containing the player's styles\n */\n",
"docComment": "/**\n * Get the current styles\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @returns An object containing the player's styles\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -31360,7 +31450,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!UserInterface#getTheme:member(1)",
"docComment": "/**\n * Get the current theme\n *\n * @remarks\n *\n * RAM cost: cost: 0 GB\n *\n * @returns An object containing the theme's colors\n */\n",
"docComment": "/**\n * Get the current theme\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @returns An object containing the theme's colors\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -31389,7 +31479,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!UserInterface#resetStyles:member(1)",
"docComment": "/**\n * Resets the player's styles to the default values\n *\n * @remarks\n *\n * RAM cost: cost: 0 GB\n */\n",
"docComment": "/**\n * Resets the player's styles to the default values\n *\n * @remarks\n *\n * RAM cost: 0 GB\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -31417,7 +31507,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!UserInterface#resetTheme:member(1)",
"docComment": "/**\n * Resets the player's theme to the default values\n *\n * @remarks\n *\n * RAM cost: cost: 0 GB\n */\n",
"docComment": "/**\n * Resets the player's theme to the default values\n *\n * @remarks\n *\n * RAM cost: 0 GB\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -31445,7 +31535,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!UserInterface#setStyles:member(1)",
"docComment": "/**\n * Sets the current styles\n *\n * @remarks\n *\n * RAM cost: cost: 0 GB\n *\n * @example\n *\n * Usage example (NS2)\n * ```ts\n * const styles = ns.ui.getStyles();\n * styles.fontFamily = 'Comic Sans Ms';\n * ns.ui.setStyles(styles);\n * ```\n *\n */\n",
"docComment": "/**\n * Sets the current styles\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @example\n *\n * Usage example (NS2)\n * ```ts\n * const styles = ns.ui.getStyles();\n * styles.fontFamily = 'Comic Sans Ms';\n * ns.ui.setStyles(styles);\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Content",
@ -31490,7 +31580,7 @@
{
"kind": "MethodSignature",
"canonicalReference": "bitburner!UserInterface#setTheme:member(1)",
"docComment": "/**\n * Sets the current theme\n *\n * @remarks\n *\n * RAM cost: cost: 0 GB\n *\n * @example\n *\n * Usage example (NS2)\n * ```ts\n * const theme = ns.ui.getTheme();\n * theme.primary = '#ff5500';\n * ns.ui.setTheme(theme);\n * ```\n *\n */\n",
"docComment": "/**\n * Sets the current theme\n *\n * @remarks\n *\n * RAM cost: 0 GB\n *\n * @example\n *\n * Usage example (NS2)\n * ```ts\n * const theme = ns.ui.getTheme();\n * theme.primary = '#ff5500';\n * ns.ui.setTheme(theme);\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Content",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -28,5 +28,5 @@ Parameter that affects the percentage by which the servers money is increased
RAM cost: 0.1 GB
Returns the servers instrinsic “growth parameter”. This growth parameter is a number between 0 and 100 that represents how quickly the servers money grows. This parameter affects the percentage by which the servers money is increased when using the grow function. A higher growth parameter will result in a higher percentage increase from grow.
Returns the servers intrinsic “growth parameter”. This growth parameter is a number typically between 0 and 100 that represents how quickly the servers money grows. This parameter affects the percentage by which the servers money is increased when using the grow function. A higher growth parameter will result in a higher percentage increase from grow.

@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [getSharePower](./bitburner.ns.getsharepower.md)
## NS.getSharePower() method
Calculate your share power.
<b>Signature:</b>
```typescript
getSharePower(): number;
```
<b>Returns:</b>
number
## Remarks
RAM cost: 0.2 GB

@ -107,6 +107,7 @@ export async function main(ns) {
| [getServerRequiredHackingLevel(host)](./bitburner.ns.getserverrequiredhackinglevel.md) | Returns the required hacking level of the target server. |
| [getServerSecurityLevel(host)](./bitburner.ns.getserversecuritylevel.md) | Get server security level. |
| [getServerUsedRam(host)](./bitburner.ns.getserverusedram.md) | Get the used RAM on a server. |
| [getSharePower()](./bitburner.ns.getsharepower.md) | Calculate your share power. |
| [getTimeSinceLastAug()](./bitburner.ns.gettimesincelastaug.md) | Returns the amount of time in milliseconds that have passed since you last installed Augmentations. |
| [getWeakenTime(host)](./bitburner.ns.getweakentime.md) | Get the execution time of a weaken() call. |
| [grow(host, opts)](./bitburner.ns.grow.md) | Spoof money in a servers bank account, increasing the amount available. |
@ -144,6 +145,7 @@ export async function main(ns) {
| [scriptKill(script, host)](./bitburner.ns.scriptkill.md) | Kill all scripts with a filename. |
| [scriptRunning(script, host)](./bitburner.ns.scriptrunning.md) | Check if any script with a filename is running. |
| [serverExists(host)](./bitburner.ns.serverexists.md) | Returns a boolean denoting whether or not the specified server exists. |
| [share()](./bitburner.ns.share.md) | Share your computer with your factions. Increasing your rep gain for a short duration. |
| [sleep(millis)](./bitburner.ns.sleep.md) | Suspends the script for n milliseconds. |
| [spawn(script, numThreads, args)](./bitburner.ns.spawn.md) | Terminate current script and start another in 10s. |
| [sprintf(format, args)](./bitburner.ns.sprintf.md) | Format a string. |

@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [share](./bitburner.ns.share.md)
## NS.share() method
Share your computer with your factions. Increasing your rep gain for a short duration.
<b>Signature:</b>
```typescript
share(): Promise<void>;
```
<b>Returns:</b>
Promise&lt;void&gt;
## Remarks
RAM cost: 2.4 GB

@ -19,5 +19,5 @@ List of active fragments placed on Stanek's Gift.
## Remarks
RAM cost: cost: 5 GB
RAM cost: 5 GB

@ -29,5 +29,5 @@ true if the fragment can be placed at that position. false otherwise.
## Remarks
RAM cost: cost: 0.5 GB
RAM cost: 0.5 GB

@ -17,5 +17,5 @@ void
## Remarks
RAM cost: cost: 0 GB
RAM cost: 0 GB

@ -19,5 +19,5 @@ List of possible fragments.
## Remarks
RAM cost: cost: 0 GB
RAM cost: 0 GB

@ -27,5 +27,5 @@ The fragment at \[rootX, rootY\], if any.
## Remarks
RAM cost: cost: 5 GB
RAM cost: 5 GB

@ -29,5 +29,5 @@ true if the fragment can be placed at that position. false otherwise.
## Remarks
RAM cost: cost: 5 GB
RAM cost: 5 GB

@ -27,5 +27,5 @@ The fragment at \[rootX, rootY\], if any.
## Remarks
RAM cost: cost: 0.15 GB
RAM cost: 0.15 GB

@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [UserInterface](./bitburner.userinterface.md) &gt; [getGameInfo](./bitburner.userinterface.getgameinfo.md)
## UserInterface.getGameInfo() method
Gets the current game information (version, commit, ...)
<b>Signature:</b>
```typescript
getGameInfo(): GameInfo;
```
<b>Returns:</b>
GameInfo
## Remarks
RAM cost: 0 GB

@ -19,5 +19,5 @@ An object containing the player's styles
## Remarks
RAM cost: cost: 0 GB
RAM cost: 0 GB

@ -19,5 +19,5 @@ An object containing the theme's colors
## Remarks
RAM cost: cost: 0 GB
RAM cost: 0 GB

@ -16,6 +16,7 @@ interface UserInterface
| Method | Description |
| --- | --- |
| [getGameInfo()](./bitburner.userinterface.getgameinfo.md) | Gets the current game information (version, commit, ...) |
| [getStyles()](./bitburner.userinterface.getstyles.md) | Get the current styles |
| [getTheme()](./bitburner.userinterface.gettheme.md) | Get the current theme |
| [resetStyles()](./bitburner.userinterface.resetstyles.md) | Resets the player's styles to the default values |

@ -17,5 +17,5 @@ void
## Remarks
RAM cost: cost: 0 GB
RAM cost: 0 GB

@ -17,5 +17,5 @@ void
## Remarks
RAM cost: cost: 0 GB
RAM cost: 0 GB

@ -24,7 +24,7 @@ void
## Remarks
RAM cost: cost: 0 GB
RAM cost: 0 GB
## Example

@ -24,7 +24,7 @@ void
## Remarks
RAM cost: cost: 0 GB
RAM cost: 0 GB
## Example

@ -111,8 +111,8 @@ export const CONSTANTS: {
TotalNumBitNodes: number;
LatestUpdate: string;
} = {
VersionString: "1.3.0",
VersionNumber: 9,
VersionString: "1.4.0",
VersionNumber: 10,
// Speed (in ms) at which the main loop is updated
_idleSpeed: 200,
@ -273,89 +273,22 @@ export const CONSTANTS: {
TotalNumBitNodes: 24,
LatestUpdate: `
v1.3.0 - 2022-01-04 Cleaning up
-------------------------------
v1.4.0 - 2022-01-18 Sharing is caring
-------------------------------------
** External IDE integration **
** Computer sharing **
* The Steam version has a webserver that allows integration with external IDEs.
A VSCode extension is available on the market place. (The documentation for the ext. isn't
written yet)
* A new mechanic has been added, it's is invoked by calling the new function 'share'.
This mechanic helps you farm reputation faster.
** Source-Files **
* SF4 has been reworked.
* New SF -1.
** gang **
** UI **
* Installing augs means losing a little bit of ascension multipliers.
* Fix some edge case with skill bat tooltips (@MartinFournier)
* Made some background match theme color (@Kejikus)
* Fix problem with script editor height not adjusting correctly (@billyvg)
* Fix some formatting issues with Bladeburner (@MartinFournier, @nickofolas)
* Fix some functions like 'alert' format messages better (@MageKing17)
* Many community themes added.
* New script editor theme (@Hedrauta, @Dexalt142)
* Improvements to tail windows (@theit8514)
* Training is more consise (@mikomyazaki)
* Fix Investopedia not displaying properly (@JotaroS)
* Remove alpha from theme editor (@MartinFournier)
* Fix corporation tooltip not displaying properly (@MartinFournier)
* Add tooltip on backdoored location names (@MartinFournier)
* Allow toasts to be dismissed by clicking them (@nickofolas)
* Darkweb item listing now shows what you own. (@hexnaught)
** Bug fix **
* Fix unit tests (@MartinFournier)
* Fixed issue with 'cat' and 'read' not finding foldered files (@Nick-Colclasure)
* Buying on the dark web will remove incomplete exe (@hexnaught)
* Fix bug that would cause the game to crash trying to go to a job without a job (@hexnaught)
* purchaseServer validation (@nickofolas)
* Script Editor focuses code when changing tab (@MartinFournier)
* Fix script editor for .txt files (@65-7a)
* Fix 'buy' command not displaying correctly. (@hexnaught)
* Fix hackAnalyzeThread returning NaN (@mikomyazaki)
* Electron handles exceptions better (@MageKing17)
* Electron will handle 'unresponsive' event and present the opportunity to reload the game with no scripts (@MartinFournier)
* Fix 'cp' between folders (@theit8514)
* Fix throwing null/undefined errors (@nickofolas)
* Allow shortcuts to work when unfocused (@MageKing17)
* Fix some dependency issue (@locriacyber)
* Fix corporation state returning an object instead of a string (@antonvmironov)
* Fix 'mv' overwriting files (@theit8514)
* Fix joesguns not being influenced by hack/grow (@dou867, @MartinFournier)
* Added warning when opening external links. (@MartinFournier)
* Prevent applying for positions that aren't offered (@TheMas3212)
* Import has validation (@MartinFournier)
** There's more but I'm going to write it later. **
** Misc. **
* Added vim mode to script editor (@billyvg)
* Clean up script editor code (@Rez855)
* 'cat' works on scripts (@65-7a)
* Add wordWrap for Monaco (@MartinFournier)
* Include map bundles in electron for easier debugging (@MartinFournier)
* Fix importing very large files (@MartinFournier)
* Cache program blob, reducing ram usage of the game (@theit8514)
* Dev menu can set server to $0 (@mikomyazaki)
* 'backdoor' allows direct connect (@mikomyazaki)
* Github workflow work (@MartinFournier)
* workForFaction / workForCompany have a new parameter (@theit8514)
* Alias accept single quotes (@sporkwitch, @FaintSpeaker)
* Add grep options to 'ps' (@maxtimum)
* Added buy all option to 'buy' (@anthonydroberts)
* Added more shortcuts to terminal input (@Frank-py)
* Refactor some port code (@ErzengelLichtes)
* Settings to control GiB vs GB (@ErzengelLichtes)
* Add electron option to export save game (@MartinFournier)
* Electron improvements (@MartinFournier)
* Expose some notifications functions to electron (@MartinFournier)
* Documentation (@MartinFournier, @cyn, @millennIumAMbiguity, @2PacIsAlive,
@TheCoderJT, @hexnaught, @sschmidTU, @FOLLGAD, @Hedrauta, @Xynrati,
@mikomyazaki, @Icehawk78, @aaronransley, @TheMas3212, @Hedrauta, @alkemann,
@ReeseJones, @amclark42, @thadguidry, @jasonhaxstuff, @pan-kuleczka, @jhollowe,
@ApatheticsAnonymous, @erplsf, @daanflore, @nickofolas, @Kebap, @smolgumball,
@woody-lam-cwl)
* Nerf noodle bar.
`,
};

@ -106,6 +106,8 @@ export const RamCosts: IMap<any> = {
hackAnalyzeSecurity: RamCostConstants.ScriptHackAnalyzeRamCost,
hackAnalyzeChance: RamCostConstants.ScriptHackAnalyzeRamCost,
sleep: 0,
share: 2.4,
getSharePower: 0.2,
grow: RamCostConstants.ScriptGrowRamCost,
growthAnalyze: RamCostConstants.ScriptGrowthAnalyzeRamCost,
growthAnalyzeSecurity: RamCostConstants.ScriptGrowthAnalyzeRamCost,

@ -3,24 +3,20 @@ import { GetServer } from "./Server/AllServers";
import { WorkerScript } from "./Netscript/WorkerScript";
export function netscriptDelay(time: number, workerScript: WorkerScript): Promise<void> {
if (workerScript.delayReject) workerScript.delayReject();
return new Promise(function (resolve, reject) {
workerScript.delay = window.setTimeout(() => {
workerScript.delay = null;
workerScript.delayReject = undefined;
if (workerScript.env.stopFlag)
reject(workerScript);
else
resolve();
if (workerScript.env.stopFlag) reject(workerScript);
else resolve();
}, time);
workerScript.delayReject = reject;
});
}
export function makeRuntimeRejectMsg(workerScript: WorkerScript, msg: string): string {
if ((msg as any) instanceof WorkerScript) {
console.error("HERE");
}
const server = GetServer(workerScript.hostname);
if (server == null) {
throw new Error(`WorkerScript constructed with invalid server ip: ${workerScript.hostname}`);

@ -88,6 +88,8 @@ import { dialogBoxCreate } from "./ui/React/DialogBox";
import { SnackbarEvents } from "./ui/React/Snackbar";
import { Flags } from "./NetscriptFunctions/Flags";
import { calculateIntelligenceBonus } from "./PersonObjects/formulas/intelligence";
import { CalculateShareMult, StartSharing } from "./NetworkShare/Share";
interface NS extends INS {
[key: string]: any;
@ -172,7 +174,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
throw makeRuntimeRejectMsg(
workerScript,
`Invalid scriptArgs argument passed into getRunningScript() from ${callingFnName}(). ` +
`This is probably a bug. Please report to game developer`,
`This is probably a bug. Please report to game developer`,
);
}
@ -692,7 +694,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
workerScript.log(
"weaken",
() =>
`'${server.hostname}' security level weakened to ${server.hackDifficulty
`'${server.hostname}' security level weakened to ${
server.hackDifficulty
}. Gained ${numeralWrapper.formatExp(expGain)} hacking exp (t=${numeralWrapper.formatThreads(threads)})`,
);
workerScript.scriptRef.onlineExpGained += expGain;
@ -704,6 +707,17 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
const coreBonus = 1 + (cores - 1) / 16;
return CONSTANTS.ServerWeakenAmount * threads * coreBonus;
},
share: function (): Promise<void> {
workerScript.log("share", () => "Sharing this computer.");
const end = StartSharing(workerScript.scriptRef.threads * calculateIntelligenceBonus(Player.intelligence, 2));
return netscriptDelay(10000, workerScript).finally(function () {
workerScript.log("share", () => "Finished sharing this computer.");
end();
});
},
getSharePower: function(): number {
return CalculateShareMult();
},
print: function (...args: any[]): void {
if (args.length === 0) {
throw makeRuntimeErrorMsg("print", "Takes at least 1 argument.");
@ -2268,8 +2282,10 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
const source_is_txt = source.endsWith(".txt");
const dest_is_txt = destination.endsWith(".txt");
if (!isScriptFilename(source) && !source_is_txt) throw makeRuntimeErrorMsg("mv", `'mv' can only be used on scripts and text files (.txt)`);
if (source_is_txt != dest_is_txt) throw makeRuntimeErrorMsg("mv", `Source and destination files must have the same type`);
if (!isScriptFilename(source) && !source_is_txt)
throw makeRuntimeErrorMsg("mv", `'mv' can only be used on scripts and text files (.txt)`);
if (source_is_txt != dest_is_txt)
throw makeRuntimeErrorMsg("mv", `Source and destination files must have the same type`);
if (source === destination) {
return;
@ -2278,7 +2294,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
// This will throw if the server is not found, we do not need to validate result.
const destServer: BaseServer | null = safeGetServer(host, "mv");
if (!source_is_txt && destServer.isRunning(source)) throw makeRuntimeErrorMsg("mv", `Cannot use 'mv' on a script that is running`)
if (!source_is_txt && destServer.isRunning(source))
throw makeRuntimeErrorMsg("mv", `Cannot use 'mv' on a script that is running`);
interface File {
filename: string;
@ -2297,7 +2314,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
}
}
if (source_file == null) throw makeRuntimeErrorMsg("mv", `Source file ${source} does not exist`)
if (source_file == null) throw makeRuntimeErrorMsg("mv", `Source file ${source} does not exist`);
if (dest_file != null) {
if (dest_file instanceof TextFile && source_file instanceof TextFile) {

@ -264,7 +264,7 @@ export function NetscriptSingularity(
return false;
}
Router.toLocation(location);
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 500);
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 50000);
return true;
},
universityCourse: function (universityName: any, className: any, focus = true): any {
@ -479,7 +479,7 @@ export function NetscriptSingularity(
player.loseMoney(CONSTANTS.TravelCost, "other");
player.city = cityname;
workerScript.log("travelToCity", () => `Traveled to ${cityname}`);
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 50);
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 50000);
return true;
default:
workerScript.log("travelToCity", () => `Invalid city name: '${cityname}'.`);
@ -515,7 +515,7 @@ export function NetscriptSingularity(
player.getHomeComputer().serversOnNetwork.push(darkweb.hostname);
darkweb.serversOnNetwork.push(player.getHomeComputer().hostname);
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 50);
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 500);
workerScript.log("purchaseTor", () => "You have purchased a Tor router!");
return true;
},
@ -555,7 +555,7 @@ export function NetscriptSingularity(
"purchaseProgram",
() => `You have purchased the '${item.program}' program. The new program can be found on your home computer.`,
);
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 50);
player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain / 5000);
return true;
},
getCurrentServer: function (): any {

@ -127,7 +127,7 @@ function _getScriptUrls(script: Script, scripts: Script[], seen: Script[]): Scri
const urlStack: ScriptUrl[] = [];
// Seen contains the dependents of the current script. Make sure we include that in the script dependents.
for (const dependent of seen) {
if (!script.dependents.some(s => s.server === dependent.server && s.filename == dependent.filename)) {
if (!script.dependents.some((s) => s.server === dependent.server && s.filename == dependent.filename)) {
script.dependents.push({ server: dependent.server, filename: dependent.filename });
}
}
@ -155,7 +155,7 @@ function _getScriptUrls(script: Script, scripts: Script[], seen: Script[]): Scri
importNodes.push({
filename: node.source.value,
start: node.source.range[0] + 1,
end: node.source.range[1] - 1
end: node.source.range[1] - 1,
});
},
ExportNamedDeclaration(node: any) {
@ -163,7 +163,7 @@ function _getScriptUrls(script: Script, scripts: Script[], seen: Script[]): Scri
importNodes.push({
filename: node.source.value,
start: node.source.range[0] + 1,
end: node.source.range[1] - 1
end: node.source.range[1] - 1,
});
}
},
@ -172,10 +172,10 @@ function _getScriptUrls(script: Script, scripts: Script[], seen: Script[]): Scri
importNodes.push({
filename: node.source.value,
start: node.source.range[0] + 1,
end: node.source.range[1] - 1
end: node.source.range[1] - 1,
});
}
}
},
});
// Sort the nodes from last start index to first. This replaces the last import with a blob first,
// preventing the ranges for other imports from being shifted.
@ -194,17 +194,17 @@ function _getScriptUrls(script: Script, scripts: Script[], seen: Script[]): Scri
let urls = ImportCache.get(importedScript.hash());
// If we don't have it in the cache, then we need to generate the urls for it.
if (urls) {
// Verify that these urls are valid and have not been updated.
for(const url of urls) {
if (isDependencyOutOfDate(url.filename, scripts, url.moduleSequenceNumber)) {
// Revoke these URLs from the browser. We will be unable to use them again.
for (const url of urls) URL.revokeObjectURL(url.url);
// Clear the cache and prepare for new blobs.
urls = null;
ImportCache.remove(importedScript.hash());
break;
}
// Verify that these urls are valid and have not been updated.
for (const url of urls) {
if (isDependencyOutOfDate(url.filename, scripts, url.moduleSequenceNumber)) {
// Revoke these URLs from the browser. We will be unable to use them again.
for (const url of urls) URL.revokeObjectURL(url.url);
// Clear the cache and prepare for new blobs.
urls = null;
ImportCache.remove(importedScript.hash());
break;
}
}
}
if (!urls) {
// Try to get a URL for the requested script and its dependencies.

@ -120,7 +120,7 @@ function startNetscript2Script(player: IPlayer, workerScript: WorkerScript): Pro
if (typeof workerScript.env.vars[prop] !== "function") continue;
workerScript.env.vars[prop] = wrap(prop, workerScript.env.vars[prop]);
}
workerScript.env.vars.stanek.charge = wrap("stanek.prop", workerScript.env.vars.stanek.charge);
workerScript.env.vars.stanek.charge = wrap("stanek.charge", workerScript.env.vars.stanek.charge);
// Note: the environment that we pass to the JS script only needs to contain the functions visible
// to that script, which env.vars does at this point.
@ -131,7 +131,6 @@ function startNetscript2Script(player: IPlayer, workerScript: WorkerScript): Pro
})
.catch((e) => reject(e));
}).catch((e) => {
console.log(e);
if (e instanceof Error) {
if (e instanceof SyntaxError) {
workerScript.errorMessage = makeRuntimeRejectMsg(workerScript, e.message + " (sorry we can't be more helpful)");

@ -0,0 +1,13 @@
import { CalculateShareMult as CSM } from "./formulas/share";
export let sharePower = 1;
export function StartSharing(threads: number): () => void {
sharePower += threads;
return () => (sharePower -= threads);
}
export function CalculateShareMult(): number {
console.log(`${sharePower} => ${CSM(sharePower)}`);
return CSM(sharePower);
}

@ -0,0 +1,5 @@
export function CalculateShareMult(power: number): number {
const x = 1 + Math.log(power) / (8 * Math.log(1000));
if (isNaN(x) || !isFinite(x)) return 1;
return x;
}

@ -2,6 +2,7 @@ import { IPlayer } from "../IPlayer";
import { Faction } from "../../Faction/Faction";
import { CONSTANTS } from "../../Constants";
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
import { CalculateShareMult } from "../../NetworkShare/Share";
function mult(f: Faction): number {
let favorMult = 1 + f.favor / 100;
@ -16,7 +17,8 @@ export function getHackingWorkRepGain(p: IPlayer, f: Faction): number {
((p.hacking + p.intelligence / 3) / CONSTANTS.MaxSkillLevel) *
p.faction_rep_mult *
p.getIntelligenceBonus(1) *
mult(f)
mult(f) *
CalculateShareMult()
);
}

@ -113,6 +113,15 @@ export function prestigeAugmentation(): void {
if (faction instanceof Faction) {
joinFaction(faction);
}
const penalty = 0.95;
for (const m of gang.members) {
m.hack_asc_points *= penalty;
m.str_asc_points *= penalty;
m.def_asc_points *= penalty;
m.dex_asc_points *= penalty;
m.agi_asc_points *= penalty;
m.cha_asc_points *= penalty;
}
}
// BitNode 3: Corporatocracy

@ -6073,6 +6073,20 @@ export interface NS extends Singularity {
* ```
*/
flags(schema: [string, string | number | boolean | string[]][]): any;
/**
* Share your computer with your factions. Increasing your rep gain for a short duration.
* @remarks
* RAM cost: 2.4 GB
*/
share(): Promise<void>;
/**
* Calculate your share power.
* @remarks
* RAM cost: 0.2 GB
*/
getSharePower(): number;
}
/**