mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 14:12:27 +01:00
commit
b636b07416
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -51,5 +51,5 @@ jobs:
|
||||
cache: 'npm'
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
- name: Run linter
|
||||
- name: Run tests
|
||||
run: npm run test
|
||||
|
63
dist/bitburner.d.ts
vendored
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 server’s instrinsic “growth parameter”. This growth
|
||||
* parameter is a number between 0 and 100 that represents how
|
||||
* quickly the server’s money grows. This parameter affects the
|
||||
* Returns the server’s intrinsic “growth parameter”. This growth
|
||||
* parameter is a number typically between 0 and 100 that represents
|
||||
* how quickly the server’s money grows. This parameter affects the
|
||||
* percentage by which the server’s 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
36
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -28,7 +28,7 @@ List of all Source-Files
|
||||
|| || * Increases the player's charisma and company salary multipliers by 8%/12%/14%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-4: The Singularity || * Let the player access and use Netscript Singularity Functions in other BitNodes. |
|
||||
|| || * Each level of this Source-File reduces the RAM cost of singularity functions. |
|
||||
|| || * Each level of this Source-File reduces the RAM cost of singularity functions. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-5: Artificial Intelligence || * Unlocks :ref:`gameplay_intelligence`. |
|
||||
|| || * Unlocks :js:func:`getBitNodeMultipliers` and start with Formulas.exe. |
|
||||
|
@ -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 server’s instrinsic “growth parameter”. This growth parameter is a number between 0 and 100 that represents how quickly the server’s money grows. This parameter affects the percentage by which the server’s 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 server’s 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 server’s intrinsic “growth parameter”. This growth parameter is a number typically between 0 and 100 that represents how quickly the server’s money grows. This parameter affects the percentage by which the server’s 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 server’s 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 server’s money is increased
|
||||
|
||||
RAM cost: 0.1 GB
|
||||
|
||||
Returns the server’s instrinsic “growth parameter”. This growth parameter is a number between 0 and 100 that represents how quickly the server’s money grows. This parameter affects the percentage by which the server’s money is increased when using the grow function. A higher growth parameter will result in a higher percentage increase from grow.
|
||||
Returns the server’s intrinsic “growth parameter”. This growth parameter is a number typically between 0 and 100 that represents how quickly the server’s money grows. This parameter affects the percentage by which the server’s money is increased when using the grow function. A higher growth parameter will result in a higher percentage increase from grow.
|
||||
|
||||
|
21
markdown/bitburner.ns.getsharepower.md
Normal file
21
markdown/bitburner.ns.getsharepower.md
Normal file
@ -0,0 +1,21 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [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. |
|
||||
|
21
markdown/bitburner.ns.share.md
Normal file
21
markdown/bitburner.ns.share.md
Normal file
@ -0,0 +1,21 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [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<void>
|
||||
|
||||
## 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
|
||||
|
||||
|
21
markdown/bitburner.userinterface.getgameinfo.md
Normal file
21
markdown/bitburner.userinterface.getgameinfo.md
Normal file
@ -0,0 +1,21 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [UserInterface](./bitburner.userinterface.md) > [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
|
||||
|
||||
|
@ -380,7 +380,7 @@ export const achievements: IMap<Achievement> = {
|
||||
},
|
||||
TRAVEL: {
|
||||
...achievementData["TRAVEL"],
|
||||
Icon: "travel",
|
||||
Icon: "TRAVEL",
|
||||
Condition: () => Player.city !== CityName.Sector12,
|
||||
},
|
||||
WORKOUT: {
|
||||
@ -553,7 +553,9 @@ export const achievements: IMap<Achievement> = {
|
||||
...achievementData["MAX_CACHE"],
|
||||
Icon: "HASHNETCAP",
|
||||
Visible: () => hasAccessToSF(Player, 9),
|
||||
Condition: () => hasHacknetServers(Player) && Player.hashManager.hashes === Player.hashManager.capacity,
|
||||
Condition: () => hasHacknetServers(Player) &&
|
||||
Player.hashManager.hashes === Player.hashManager.capacity &&
|
||||
Player.hashManager.capacity > 0,
|
||||
},
|
||||
SLEEVE_8: {
|
||||
...achievementData["SLEEVE_8"],
|
||||
|
@ -22,12 +22,12 @@ export function loadGlobalAliases(saveString: string): void {
|
||||
|
||||
// Prints all aliases to terminal
|
||||
export function printAliases(): void {
|
||||
for (const name in Aliases) {
|
||||
for (const name of Object.keys(Aliases)) {
|
||||
if (Aliases.hasOwnProperty(name)) {
|
||||
Terminal.print("alias " + name + "=" + Aliases[name]);
|
||||
}
|
||||
}
|
||||
for (const name in GlobalAliases) {
|
||||
for (const name of Object.keys(GlobalAliases)) {
|
||||
if (GlobalAliases.hasOwnProperty(name)) {
|
||||
Terminal.print("global alias " + name + "=" + GlobalAliases[name]);
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ export class Augmentation {
|
||||
|
||||
// Adds this Augmentation to all Factions
|
||||
addToAllFactions(): void {
|
||||
for (const fac in Factions) {
|
||||
for (const fac of Object.keys(Factions)) {
|
||||
if (Factions.hasOwnProperty(fac)) {
|
||||
const facObj: Faction | null = Factions[fac];
|
||||
if (facObj == null) {
|
||||
|
@ -112,7 +112,7 @@ function getRandomBonus(): any {
|
||||
}
|
||||
|
||||
function initAugmentations(): void {
|
||||
for (const name in Factions) {
|
||||
for (const name of Object.keys(Factions)) {
|
||||
if (Factions.hasOwnProperty(name)) {
|
||||
Factions[name].augmentations = [];
|
||||
}
|
||||
@ -2498,7 +2498,7 @@ function initAugmentations(): void {
|
||||
CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]],
|
||||
Player.queuedAugmentations.length,
|
||||
);
|
||||
for (const name in Augmentations) {
|
||||
for (const name of Object.keys(Augmentations)) {
|
||||
if (Augmentations.hasOwnProperty(name)) {
|
||||
Augmentations[name].baseCost *= mult;
|
||||
}
|
||||
@ -2525,7 +2525,7 @@ function applyAugmentation(aug: IPlayerOwnedAugmentation, reapply = false): void
|
||||
const augObj = Augmentations[aug.name];
|
||||
|
||||
// Apply multipliers
|
||||
for (const mult in augObj.mults) {
|
||||
for (const mult of Object.keys(augObj.mults)) {
|
||||
const v = Player.getMult(mult) * augObj.mults[mult];
|
||||
Player.setMult(mult, v);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ function calculateAugmentedStats(): any {
|
||||
const augP: any = {};
|
||||
for (const aug of Player.queuedAugmentations) {
|
||||
const augObj = Augmentations[aug.name];
|
||||
for (const mult in augObj.mults) {
|
||||
for (const mult of Object.keys(augObj.mults)) {
|
||||
const v = augP[mult] ? augP[mult] : 1;
|
||||
augP[mult] = v * augObj.mults[mult];
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ export function initBitNodeMultipliers(p: IPlayer): void {
|
||||
if (p.bitNodeN == null) {
|
||||
p.bitNodeN = 1;
|
||||
}
|
||||
for (const mult in BitNodeMultipliers) {
|
||||
for (const mult of Object.keys(BitNodeMultipliers)) {
|
||||
if (BitNodeMultipliers.hasOwnProperty(mult)) {
|
||||
BitNodeMultipliers[mult] = 1;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ export class Action implements IAction {
|
||||
|
||||
// Check to make sure weights are summed properly
|
||||
let sum = 0;
|
||||
for (const weight in this.weights) {
|
||||
for (const weight of Object.keys(this.weights)) {
|
||||
if (this.weights.hasOwnProperty(weight)) {
|
||||
sum += this.weights[weight];
|
||||
}
|
||||
@ -131,7 +131,7 @@ export class Action implements IAction {
|
||||
);
|
||||
}
|
||||
|
||||
for (const decay in this.decays) {
|
||||
for (const decay of Object.keys(this.decays)) {
|
||||
if (this.decays.hasOwnProperty(decay)) {
|
||||
if (this.decays[decay] > 1) {
|
||||
throw new Error(
|
||||
@ -240,7 +240,7 @@ export class Action implements IAction {
|
||||
}
|
||||
let difficulty = this.getDifficulty();
|
||||
let competence = 0;
|
||||
for (const stat in this.weights) {
|
||||
for (const stat of Object.keys(this.weights)) {
|
||||
if (this.weights.hasOwnProperty(stat)) {
|
||||
const playerStatLvl = Player.queryStatFromString(stat);
|
||||
const key = "eff" + stat.charAt(0).toUpperCase() + stat.slice(1);
|
||||
|
@ -135,7 +135,7 @@ export class Bladeburner implements IBladeburner {
|
||||
|
||||
// Can't start a BlackOp if you haven't done the one before it
|
||||
const blackops = [];
|
||||
for (const nm in BlackOperations) {
|
||||
for (const nm of Object.keys(BlackOperations)) {
|
||||
if (BlackOperations.hasOwnProperty(nm)) {
|
||||
blackops.push(nm);
|
||||
}
|
||||
@ -1074,7 +1074,7 @@ export class Bladeburner implements IBladeburner {
|
||||
|
||||
updateSkillMultipliers(): void {
|
||||
this.resetSkillMultipliers();
|
||||
for (const skillName in this.skills) {
|
||||
for (const skillName of Object.keys(this.skills)) {
|
||||
if (this.skills.hasOwnProperty(skillName)) {
|
||||
const skill = Skills[skillName];
|
||||
if (skill == null) {
|
||||
|
@ -12,7 +12,7 @@ interface IProps {
|
||||
|
||||
export function BlackOpList(props: IProps): React.ReactElement {
|
||||
let blackops: BlackOperation[] = [];
|
||||
for (const blackopName in BlackOperations) {
|
||||
for (const blackopName of Object.keys(BlackOperations)) {
|
||||
if (BlackOperations.hasOwnProperty(blackopName)) {
|
||||
blackops.push(BlackOperations[blackopName]);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ interface IProps {
|
||||
|
||||
export function GeneralActionList(props: IProps): React.ReactElement {
|
||||
const actions: Action[] = [];
|
||||
for (const name in GeneralActions) {
|
||||
for (const name of Object.keys(GeneralActions)) {
|
||||
if (GeneralActions.hasOwnProperty(name)) {
|
||||
actions.push(GeneralActions[name]);
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ export function SlotMachine(props: IProps): React.ReactElement {
|
||||
function step(): void {
|
||||
let stoppedOne = false;
|
||||
const copy = index.slice();
|
||||
for (const i in copy) {
|
||||
for (let i = 0; i < copy.length; i++) {
|
||||
if (copy[i] === locks[i] && !stoppedOne) continue;
|
||||
copy[i] = (copy[i] + 1) % symbols.length;
|
||||
stoppedOne = true;
|
||||
|
@ -26,7 +26,7 @@ export function initCompanies(): void {
|
||||
});
|
||||
|
||||
// Reset data
|
||||
for (const companyName in Companies) {
|
||||
for (const companyName of Object.keys(Companies)) {
|
||||
const company = Companies[companyName];
|
||||
const oldCompany = oldCompanies[companyName];
|
||||
if (!(oldCompany instanceof Company)) {
|
||||
|
@ -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.
|
||||
`,
|
||||
};
|
||||
|
@ -307,7 +307,7 @@ export class Corporation {
|
||||
if (upgN === 1) {
|
||||
for (let i = 0; i < this.divisions.length; ++i) {
|
||||
const industry = this.divisions[i];
|
||||
for (const city in industry.warehouses) {
|
||||
for (const city of Object.keys(industry.warehouses)) {
|
||||
const warehouse = industry.warehouses[city];
|
||||
if (warehouse === 0) continue;
|
||||
if (industry.warehouses.hasOwnProperty(city) && warehouse instanceof Warehouse) {
|
||||
|
@ -378,7 +378,7 @@ export class Industry implements IIndustry {
|
||||
updateWarehouseSizeUsed(warehouse: Warehouse): void {
|
||||
warehouse.updateMaterialSizeUsed();
|
||||
|
||||
for (const prodName in this.products) {
|
||||
for (const prodName of Object.keys(this.products)) {
|
||||
if (this.products.hasOwnProperty(prodName)) {
|
||||
const prod = this.products[prodName];
|
||||
if (prod === undefined) continue;
|
||||
@ -414,7 +414,7 @@ export class Industry implements IIndustry {
|
||||
|
||||
// Process offices (and the employees in them)
|
||||
let employeeSalary = 0;
|
||||
for (const officeLoc in this.offices) {
|
||||
for (const officeLoc of Object.keys(this.offices)) {
|
||||
const office = this.offices[officeLoc];
|
||||
if (office === 0) continue;
|
||||
if (office instanceof OfficeSpace) {
|
||||
@ -470,7 +470,7 @@ export class Industry implements IIndustry {
|
||||
if (this.warehouses[CorporationConstants.Cities[i]] instanceof Warehouse) {
|
||||
const wh = this.warehouses[CorporationConstants.Cities[i]];
|
||||
if (wh === 0) continue;
|
||||
for (const name in reqMats) {
|
||||
for (const name of Object.keys(reqMats)) {
|
||||
if (reqMats.hasOwnProperty(name)) {
|
||||
wh.materials[name].processMarket();
|
||||
}
|
||||
@ -493,7 +493,7 @@ export class Industry implements IIndustry {
|
||||
// Process change in demand and competition for this industry's products
|
||||
processProductMarket(marketCycles = 1): void {
|
||||
// Demand gradually decreases, and competition gradually increases
|
||||
for (const name in this.products) {
|
||||
for (const name of Object.keys(this.products)) {
|
||||
if (this.products.hasOwnProperty(name)) {
|
||||
const product = this.products[name];
|
||||
if (product === undefined) continue;
|
||||
@ -531,7 +531,7 @@ export class Industry implements IIndustry {
|
||||
}
|
||||
const warehouse = this.warehouses[city];
|
||||
if (warehouse === 0) continue;
|
||||
for (const matName in warehouse.materials) {
|
||||
for (const matName of Object.keys(warehouse.materials)) {
|
||||
if (warehouse.materials.hasOwnProperty(matName)) {
|
||||
const mat = warehouse.materials[matName];
|
||||
mat.imp = 0;
|
||||
@ -552,7 +552,7 @@ export class Industry implements IIndustry {
|
||||
switch (this.state) {
|
||||
case "PURCHASE": {
|
||||
/* Process purchase of materials */
|
||||
for (const matName in warehouse.materials) {
|
||||
for (const matName of Object.keys(warehouse.materials)) {
|
||||
if (!warehouse.materials.hasOwnProperty(matName)) continue;
|
||||
const mat = warehouse.materials[matName];
|
||||
let buyAmt = 0;
|
||||
@ -574,7 +574,7 @@ export class Industry implements IIndustry {
|
||||
|
||||
// smart supply
|
||||
const smartBuy: { [key: string]: number | undefined } = {};
|
||||
for (const matName in warehouse.materials) {
|
||||
for (const matName of Object.keys(warehouse.materials)) {
|
||||
if (!warehouse.materials.hasOwnProperty(matName)) continue;
|
||||
if (!warehouse.smartSupplyEnabled || !Object.keys(this.reqMats).includes(matName)) continue;
|
||||
const mat = warehouse.materials[matName];
|
||||
@ -591,7 +591,7 @@ export class Industry implements IIndustry {
|
||||
|
||||
// Find which material were trying to create the least amount of product with.
|
||||
let worseAmt = 1e99;
|
||||
for (const matName in smartBuy) {
|
||||
for (const matName of Object.keys(smartBuy)) {
|
||||
const buyAmt = smartBuy[matName];
|
||||
if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);
|
||||
const reqMat = this.reqMats[matName];
|
||||
@ -601,7 +601,7 @@ export class Industry implements IIndustry {
|
||||
}
|
||||
|
||||
// Align all the materials to the smallest amount.
|
||||
for (const matName in smartBuy) {
|
||||
for (const matName of Object.keys(smartBuy)) {
|
||||
const reqMat = this.reqMats[matName];
|
||||
if (reqMat === undefined) throw new Error(`reqMat "${matName}" is undefined`);
|
||||
smartBuy[matName] = worseAmt * reqMat;
|
||||
@ -609,7 +609,7 @@ export class Industry implements IIndustry {
|
||||
|
||||
// Calculate the total size of all things were trying to buy
|
||||
let totalSize = 0;
|
||||
for (const matName in smartBuy) {
|
||||
for (const matName of Object.keys(smartBuy)) {
|
||||
const buyAmt = smartBuy[matName];
|
||||
if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);
|
||||
totalSize += buyAmt * MaterialSizes[matName];
|
||||
@ -618,7 +618,7 @@ export class Industry implements IIndustry {
|
||||
// Shrink to the size of available space.
|
||||
const freeSpace = warehouse.size - warehouse.sizeUsed;
|
||||
if (totalSize > freeSpace) {
|
||||
for (const matName in smartBuy) {
|
||||
for (const matName of Object.keys(smartBuy)) {
|
||||
const buyAmt = smartBuy[matName];
|
||||
if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);
|
||||
smartBuy[matName] = Math.floor((buyAmt * freeSpace) / totalSize);
|
||||
@ -626,7 +626,7 @@ export class Industry implements IIndustry {
|
||||
}
|
||||
|
||||
// Use the materials already in the warehouse if the option is on.
|
||||
for (const matName in smartBuy) {
|
||||
for (const matName of Object.keys(smartBuy)) {
|
||||
if (!warehouse.smartSupplyUseLeftovers[matName]) continue;
|
||||
const mat = warehouse.materials[matName];
|
||||
const buyAmt = smartBuy[matName];
|
||||
@ -635,7 +635,7 @@ export class Industry implements IIndustry {
|
||||
}
|
||||
|
||||
// buy them
|
||||
for (const matName in smartBuy) {
|
||||
for (const matName of Object.keys(smartBuy)) {
|
||||
const mat = warehouse.materials[matName];
|
||||
const buyAmt = smartBuy[matName];
|
||||
if (buyAmt === undefined) throw new Error(`Somehow smartbuy matname is undefined`);
|
||||
@ -672,7 +672,7 @@ export class Industry implements IIndustry {
|
||||
for (let tmp = 0; tmp < this.prodMats.length; ++tmp) {
|
||||
totalMatSize += MaterialSizes[this.prodMats[tmp]];
|
||||
}
|
||||
for (const reqMatName in this.reqMats) {
|
||||
for (const reqMatName of Object.keys(this.reqMats)) {
|
||||
const normQty = this.reqMats[reqMatName];
|
||||
if (normQty === undefined) continue;
|
||||
totalMatSize -= MaterialSizes[reqMatName] * normQty;
|
||||
@ -692,7 +692,7 @@ export class Industry implements IIndustry {
|
||||
|
||||
// Make sure we have enough resource to make our materials
|
||||
let producableFrac = 1;
|
||||
for (const reqMatName in this.reqMats) {
|
||||
for (const reqMatName of Object.keys(this.reqMats)) {
|
||||
if (this.reqMats.hasOwnProperty(reqMatName)) {
|
||||
const reqMat = this.reqMats[reqMatName];
|
||||
if (reqMat === undefined) continue;
|
||||
@ -709,7 +709,7 @@ export class Industry implements IIndustry {
|
||||
|
||||
// Make our materials if they are producable
|
||||
if (producableFrac > 0 && prod > 0) {
|
||||
for (const reqMatName in this.reqMats) {
|
||||
for (const reqMatName of Object.keys(this.reqMats)) {
|
||||
const reqMat = this.reqMats[reqMatName];
|
||||
if (reqMat === undefined) continue;
|
||||
const reqMatQtyNeeded = reqMat * prod * producableFrac;
|
||||
@ -726,7 +726,7 @@ export class Industry implements IIndustry {
|
||||
Math.pow(warehouse.materials["AICores"].qty, this.aiFac) / 10e3;
|
||||
}
|
||||
} else {
|
||||
for (const reqMatName in this.reqMats) {
|
||||
for (const reqMatName of Object.keys(this.reqMats)) {
|
||||
if (this.reqMats.hasOwnProperty(reqMatName)) {
|
||||
warehouse.materials[reqMatName].prd = 0;
|
||||
}
|
||||
@ -742,7 +742,7 @@ export class Industry implements IIndustry {
|
||||
//If this doesn't produce any materials, then it only creates
|
||||
//Products. Creating products will consume materials. The
|
||||
//Production of all consumed materials must be set to 0
|
||||
for (const reqMatName in this.reqMats) {
|
||||
for (const reqMatName of Object.keys(this.reqMats)) {
|
||||
warehouse.materials[reqMatName].prd = 0;
|
||||
}
|
||||
}
|
||||
@ -750,7 +750,7 @@ export class Industry implements IIndustry {
|
||||
|
||||
case "SALE":
|
||||
/* Process sale of materials */
|
||||
for (const matName in warehouse.materials) {
|
||||
for (const matName of Object.keys(warehouse.materials)) {
|
||||
if (warehouse.materials.hasOwnProperty(matName)) {
|
||||
const mat = warehouse.materials[matName];
|
||||
if (mat.sCost < 0 || mat.sllman[0] === false) {
|
||||
@ -881,7 +881,7 @@ export class Industry implements IIndustry {
|
||||
break;
|
||||
|
||||
case "EXPORT":
|
||||
for (const matName in warehouse.materials) {
|
||||
for (const matName of Object.keys(warehouse.materials)) {
|
||||
if (warehouse.materials.hasOwnProperty(matName)) {
|
||||
const mat = warehouse.materials[matName];
|
||||
mat.totalExp = 0; //Reset export
|
||||
@ -993,7 +993,7 @@ export class Industry implements IIndustry {
|
||||
|
||||
//Create products
|
||||
if (this.state === "PRODUCTION") {
|
||||
for (const prodName in this.products) {
|
||||
for (const prodName of Object.keys(this.products)) {
|
||||
const prod = this.products[prodName];
|
||||
if (prod === undefined) continue;
|
||||
if (!prod.fin) {
|
||||
@ -1025,7 +1025,7 @@ export class Industry implements IIndustry {
|
||||
}
|
||||
|
||||
//Produce Products
|
||||
for (const prodName in this.products) {
|
||||
for (const prodName of Object.keys(this.products)) {
|
||||
if (this.products.hasOwnProperty(prodName)) {
|
||||
const prod = this.products[prodName];
|
||||
if (prod instanceof Product && prod.fin) {
|
||||
@ -1067,7 +1067,7 @@ export class Industry implements IIndustry {
|
||||
|
||||
//Calculate net change in warehouse storage making the Products will cost
|
||||
let netStorageSize = product.siz;
|
||||
for (const reqMatName in product.reqMats) {
|
||||
for (const reqMatName of Object.keys(product.reqMats)) {
|
||||
if (product.reqMats.hasOwnProperty(reqMatName)) {
|
||||
const normQty = product.reqMats[reqMatName];
|
||||
netStorageSize -= MaterialSizes[reqMatName] * normQty;
|
||||
@ -1084,7 +1084,7 @@ export class Industry implements IIndustry {
|
||||
|
||||
//Make sure we have enough resources to make our Products
|
||||
let producableFrac = 1;
|
||||
for (const reqMatName in product.reqMats) {
|
||||
for (const reqMatName of Object.keys(product.reqMats)) {
|
||||
if (product.reqMats.hasOwnProperty(reqMatName)) {
|
||||
const req = product.reqMats[reqMatName] * prod;
|
||||
if (warehouse.materials[reqMatName].qty < req) {
|
||||
@ -1095,7 +1095,7 @@ export class Industry implements IIndustry {
|
||||
|
||||
//Make our Products if they are producable
|
||||
if (producableFrac > 0 && prod > 0) {
|
||||
for (const reqMatName in product.reqMats) {
|
||||
for (const reqMatName of Object.keys(product.reqMats)) {
|
||||
if (product.reqMats.hasOwnProperty(reqMatName)) {
|
||||
const reqMatQtyNeeded = product.reqMats[reqMatName] * prod * producableFrac;
|
||||
warehouse.materials[reqMatName].qty -= reqMatQtyNeeded;
|
||||
@ -1114,7 +1114,7 @@ export class Industry implements IIndustry {
|
||||
case "SALE": {
|
||||
//Process sale of Products
|
||||
product.pCost = 0; //Estimated production cost
|
||||
for (const reqMatName in product.reqMats) {
|
||||
for (const reqMatName of Object.keys(product.reqMats)) {
|
||||
if (product.reqMats.hasOwnProperty(reqMatName)) {
|
||||
product.pCost += product.reqMats[reqMatName] * warehouse.materials[reqMatName].bCost;
|
||||
}
|
||||
@ -1250,7 +1250,7 @@ export class Industry implements IIndustry {
|
||||
}
|
||||
|
||||
discontinueProduct(product: Product): void {
|
||||
for (const productName in this.products) {
|
||||
for (const productName of Object.keys(this.products)) {
|
||||
if (this.products.hasOwnProperty(productName)) {
|
||||
if (product === this.products[productName]) {
|
||||
delete this.products[productName];
|
||||
@ -1354,7 +1354,7 @@ export class Industry implements IIndustry {
|
||||
// Since ResearchTree data isnt saved, we'll update the Research Tree data
|
||||
// based on the stored 'researched' property in the Industry object
|
||||
if (Object.keys(researchTree.researched).length !== Object.keys(this.researched).length) {
|
||||
for (const research in this.researched) {
|
||||
for (const research of Object.keys(this.researched)) {
|
||||
researchTree.research(research);
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ export class OfficeSpace {
|
||||
|
||||
calculateEmployeeProductivity(corporation: ICorporation, industry: IIndustry): void {
|
||||
//Reset
|
||||
for (const name in this.employeeProd) {
|
||||
for (const name of Object.keys(this.employeeProd)) {
|
||||
this.employeeProd[name] = 0;
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ export class Product {
|
||||
|
||||
//Calculate the product's required materials
|
||||
//For now, just set it to be the same as the requirements to make materials
|
||||
for (const matName in industry.reqMats) {
|
||||
for (const matName of Object.keys(industry.reqMats)) {
|
||||
if (industry.reqMats.hasOwnProperty(matName)) {
|
||||
const reqMat = industry.reqMats[matName];
|
||||
if (reqMat === undefined) continue;
|
||||
@ -209,7 +209,7 @@ export class Product {
|
||||
//Calculate the product's size
|
||||
//For now, just set it to be the same size as the requirements to make materials
|
||||
this.siz = 0;
|
||||
for (const matName in industry.reqMats) {
|
||||
for (const matName of Object.keys(industry.reqMats)) {
|
||||
const reqMat = industry.reqMats[matName];
|
||||
if (reqMat === undefined) continue;
|
||||
this.siz += MaterialSizes[matName] * reqMat;
|
||||
|
@ -85,7 +85,7 @@ export class Warehouse {
|
||||
// Re-calculate how much space is being used by this Warehouse
|
||||
updateMaterialSizeUsed(): void {
|
||||
this.sizeUsed = 0;
|
||||
for (const matName in this.materials) {
|
||||
for (const matName of Object.keys(this.materials)) {
|
||||
const mat = this.materials[matName];
|
||||
if (MaterialSizes.hasOwnProperty(matName)) {
|
||||
this.sizeUsed += mat.qty * MaterialSizes[matName];
|
||||
|
@ -215,7 +215,7 @@ function Upgrades(props: { office: OfficeSpace; rerender: () => void }): React.R
|
||||
const corp = useCorporation();
|
||||
const division = useDivision();
|
||||
const upgrades = [];
|
||||
for (const index in IndustryUpgrades) {
|
||||
for (const index of Object.keys(IndustryUpgrades)) {
|
||||
const upgrade = IndustryUpgrades[index];
|
||||
|
||||
// AutoBrew research disables the Coffee upgrade
|
||||
|
@ -81,7 +81,7 @@ function WarehouseRoot(props: IProps): React.ReactElement {
|
||||
|
||||
// Create React components for materials
|
||||
const mats = [];
|
||||
for (const matName in props.warehouse.materials) {
|
||||
for (const matName of Object.keys(props.warehouse.materials)) {
|
||||
if (!(props.warehouse.materials[matName] instanceof Material)) continue;
|
||||
// Only create UI for materials that are relevant for the industry
|
||||
if (!isRelevantMaterial(matName, division)) continue;
|
||||
@ -99,7 +99,7 @@ function WarehouseRoot(props: IProps): React.ReactElement {
|
||||
// Create React components for products
|
||||
const products = [];
|
||||
if (division.makesProducts && Object.keys(division.products).length > 0) {
|
||||
for (const productName in division.products) {
|
||||
for (const productName of Object.keys(division.products)) {
|
||||
const product = division.products[productName];
|
||||
if (!(product instanceof Product)) continue;
|
||||
products.push(
|
||||
@ -109,14 +109,14 @@ function WarehouseRoot(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
const breakdownItems: JSX.Element[] = [];
|
||||
for (const matName in props.warehouse.materials) {
|
||||
for (const matName of Object.keys(props.warehouse.materials)) {
|
||||
const mat = props.warehouse.materials[matName];
|
||||
if (!MaterialSizes.hasOwnProperty(matName)) continue;
|
||||
if (mat.qty === 0) continue;
|
||||
breakdownItems.push(<>{matName}: {numeralWrapper.format(mat.qty * MaterialSizes[matName], "0,0.0")}</>);
|
||||
}
|
||||
|
||||
for (const prodName in division.products) {
|
||||
for (const prodName of Object.keys(division.products)) {
|
||||
const prod = division.products[prodName];
|
||||
if (prod === undefined) continue;
|
||||
breakdownItems.push(<>{prodName}: {numeralWrapper.format(prod.data[props.warehouse.loc][0] * prod.siz, "0,0.0")}</>);
|
||||
|
@ -60,7 +60,7 @@ export function SmartSupplyModal(props: IProps): React.ReactElement {
|
||||
|
||||
// Create React components for materials
|
||||
const mats = [];
|
||||
for (const matName in props.warehouse.materials) {
|
||||
for (const matName of Object.keys(props.warehouse.materials)) {
|
||||
if (!(props.warehouse.materials[matName] instanceof Material)) continue;
|
||||
if (!Object.keys(division.reqMats).includes(matName)) continue;
|
||||
mats.push(<Leftover key={matName} warehouse={props.warehouse} matName={matName} />);
|
||||
|
@ -7,7 +7,7 @@ import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||
export function determineCrimeSuccess(p: IPlayer, type: string): boolean {
|
||||
let chance = 0;
|
||||
let found = false;
|
||||
for (const i in Crimes) {
|
||||
for (const i of Object.keys(Crimes)) {
|
||||
const crime = Crimes[i];
|
||||
if (crime.type == type) {
|
||||
chance = crime.successRate(p);
|
||||
|
@ -21,7 +21,7 @@ export function checkIfConnectedToDarkweb(): void {
|
||||
}
|
||||
|
||||
export function listAllDarkwebItems(): void {
|
||||
for (const key in DarkWebItems) {
|
||||
for (const key of Object.keys(DarkWebItems)) {
|
||||
const item = DarkWebItems[key];
|
||||
|
||||
const cost = Player.getHomeComputer().programs.includes(item.program) ? (
|
||||
@ -44,7 +44,7 @@ export function buyDarkwebItem(itemName: string): void {
|
||||
// find the program that matches, if any
|
||||
let item: DarkWebItem | null = null;
|
||||
|
||||
for (const key in DarkWebItems) {
|
||||
for (const key of Object.keys(DarkWebItems)) {
|
||||
const i = DarkWebItems[key];
|
||||
if (i.program.toLowerCase() == itemName) {
|
||||
item = i;
|
||||
@ -93,7 +93,7 @@ export function buyAllDarkwebItems(): void {
|
||||
const itemsToBuy: DarkWebItem[] = [];
|
||||
let cost = 0;
|
||||
|
||||
for (const key in DarkWebItems) {
|
||||
for (const key of Object.keys(DarkWebItems)) {
|
||||
const item = DarkWebItems[key];
|
||||
if (!Player.hasProgram(item.program)) {
|
||||
itemsToBuy.push(item);
|
||||
|
@ -46,25 +46,25 @@ export function Companies(): React.ReactElement {
|
||||
}
|
||||
|
||||
function tonsOfRepCompanies(): void {
|
||||
for (const c in AllCompanies) {
|
||||
for (const c of Object.keys(AllCompanies)) {
|
||||
AllCompanies[c].playerReputation = bigNumber;
|
||||
}
|
||||
}
|
||||
|
||||
function resetAllRepCompanies(): void {
|
||||
for (const c in AllCompanies) {
|
||||
for (const c of Object.keys(AllCompanies)) {
|
||||
AllCompanies[c].playerReputation = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function tonsOfFavorCompanies(): void {
|
||||
for (const c in AllCompanies) {
|
||||
for (const c of Object.keys(AllCompanies)) {
|
||||
AllCompanies[c].favor = bigNumber;
|
||||
}
|
||||
}
|
||||
|
||||
function resetAllFavorCompanies(): void {
|
||||
for (const c in AllCompanies) {
|
||||
for (const c of Object.keys(AllCompanies)) {
|
||||
AllCompanies[c].favor = 0;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ export function Factions(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
function receiveAllInvites(): void {
|
||||
for (const i in AllFaction) {
|
||||
for (const i of Object.keys(AllFaction)) {
|
||||
props.player.receiveInvite(AllFaction[i].name);
|
||||
}
|
||||
}
|
||||
@ -74,25 +74,25 @@ export function Factions(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
function tonsOfRep(): void {
|
||||
for (const i in AllFaction) {
|
||||
for (const i of Object.keys(AllFaction)) {
|
||||
AllFaction[i].playerReputation = bigNumber;
|
||||
}
|
||||
}
|
||||
|
||||
function resetAllRep(): void {
|
||||
for (const i in AllFaction) {
|
||||
for (const i of Object.keys(AllFaction)) {
|
||||
AllFaction[i].playerReputation = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function tonsOfFactionFavor(): void {
|
||||
for (const i in AllFaction) {
|
||||
for (const i of Object.keys(AllFaction)) {
|
||||
AllFaction[i].favor = bigNumber;
|
||||
}
|
||||
}
|
||||
|
||||
function resetAllFactionFavor(): void {
|
||||
for (const i in AllFaction) {
|
||||
for (const i of Object.keys(AllFaction)) {
|
||||
AllFaction[i].favor = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
import Accordion from "@mui/material/Accordion";
|
||||
import AccordionSummary from "@mui/material/AccordionSummary";
|
||||
@ -17,6 +17,8 @@ interface IProps {
|
||||
}
|
||||
|
||||
export function General(props: IProps): React.ReactElement {
|
||||
const [error, setError] = useState(false);
|
||||
|
||||
function addMoney(n: number) {
|
||||
return function () {
|
||||
props.player.gainMoney(n, "other");
|
||||
@ -43,6 +45,10 @@ export function General(props: IProps): React.ReactElement {
|
||||
props.router.toBitVerse(false, false);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (error) throw new ReferenceError('Manually thrown error');
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<Accordion TransitionProps={{ unmountOnExit: true }}>
|
||||
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
|
||||
@ -81,6 +87,7 @@ export function General(props: IProps): React.ReactElement {
|
||||
<Button onClick={b1tflum3}>Run b1t_flum3.exe</Button>
|
||||
<Button onClick={quickHackW0r1dD43m0n}>Quick w0rld_d34m0n</Button>
|
||||
<Button onClick={hackW0r1dD43m0n}>Hack w0rld_d34m0n</Button>
|
||||
<Button onClick={() => setError(true)}>Throw Error</Button>
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
);
|
||||
|
@ -28,7 +28,7 @@ export function Programs(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
function addAllPrograms(): void {
|
||||
for (const i in AllPrograms) {
|
||||
for (const i of Object.keys(AllPrograms)) {
|
||||
if (!props.player.hasProgram(AllPrograms[i].name)) {
|
||||
props.player.getHomeComputer().programs.push(AllPrograms[i].name);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ export function StockMarket(): React.ReactElement {
|
||||
};
|
||||
}
|
||||
|
||||
for (const name in SM) {
|
||||
for (const name of Object.keys(SM)) {
|
||||
if (SM.hasOwnProperty(name)) {
|
||||
const stock = SM[name];
|
||||
if (stock instanceof Stock && match(stock.symbol)) {
|
||||
|
@ -34,8 +34,7 @@ export function joinFaction(faction: Faction): void {
|
||||
const factionInfo = faction.getInfo();
|
||||
|
||||
//Determine what factions you are banned from now that you have joined this faction
|
||||
for (const i in factionInfo.enemies) {
|
||||
const enemy = factionInfo.enemies[i];
|
||||
for (const enemy of factionInfo.enemies) {
|
||||
if (Factions[enemy] instanceof Faction) {
|
||||
Factions[enemy].isBanned = true;
|
||||
}
|
||||
@ -121,7 +120,7 @@ export function purchaseAugmentation(aug: Augmentation, fac: Faction, sing = fal
|
||||
}
|
||||
}
|
||||
|
||||
for (const name in Augmentations) {
|
||||
for (const name of Object.keys(Augmentations)) {
|
||||
if (Augmentations.hasOwnProperty(name)) {
|
||||
Augmentations[name].baseCost *= CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]];
|
||||
}
|
||||
@ -170,7 +169,7 @@ export function getNextNeurofluxLevel(): number {
|
||||
}
|
||||
|
||||
export function processPassiveFactionRepGain(numCycles: number): void {
|
||||
for (const name in Factions) {
|
||||
for (const name of Object.keys(Factions)) {
|
||||
if (name === Player.currentWorkFactionName) continue;
|
||||
if (!Factions.hasOwnProperty(name)) continue;
|
||||
const faction = Factions[name];
|
||||
|
@ -34,7 +34,7 @@ export function factionExists(name: string): boolean {
|
||||
}
|
||||
|
||||
export function initFactions(): void {
|
||||
for (const name in FactionInfos) {
|
||||
for (const name of Object.keys(FactionInfos)) {
|
||||
resetFaction(new Faction(name));
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ export function AugmentationsPage(props: IProps): React.ReactElement {
|
||||
function getAugs(): string[] {
|
||||
if (isPlayersGang) {
|
||||
const augs: string[] = [];
|
||||
for (const augName in Augmentations) {
|
||||
for (const augName of Object.keys(Augmentations)) {
|
||||
if (augName === AugmentationNames.NeuroFluxGovernor) continue;
|
||||
if (augName === AugmentationNames.TheRedPill && player.bitNodeN !== 2) continue;
|
||||
const aug = Augmentations[augName];
|
||||
|
@ -158,7 +158,7 @@ export class Gang implements IGang {
|
||||
|
||||
// Process power first
|
||||
const gangName = this.facName;
|
||||
for (const name in AllGangs) {
|
||||
for (const name of Object.keys(AllGangs)) {
|
||||
if (AllGangs.hasOwnProperty(name)) {
|
||||
if (name == gangName) {
|
||||
AllGangs[name].power += this.calculatePower();
|
||||
|
@ -4,7 +4,7 @@
|
||||
import React, { useState } from "react";
|
||||
import { RecruitModal } from "./RecruitModal";
|
||||
import { GangConstants } from "../data/Constants";
|
||||
import { formatNumber } from "../../utils/StringHelperFunctions";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { useGang } from "./Context";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Button from "@mui/material/Button";
|
||||
@ -28,7 +28,7 @@ export function RecruitButton(props: IProps): React.ReactElement {
|
||||
<Button sx={{ mx: 1 }} disabled>
|
||||
Recruit Gang Member
|
||||
</Button>
|
||||
<Typography>{formatNumber(respect, 2)} respect needed to recruit next member</Typography>
|
||||
<Typography>{numeralWrapper.formatRespect(respect)} respect needed to recruit next member</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ export class HashManager {
|
||||
upgrades: IMap<number> = {};
|
||||
|
||||
constructor() {
|
||||
for (const name in HashUpgrades) {
|
||||
for (const name of Object.keys(HashUpgrades)) {
|
||||
this.upgrades[name] = 0;
|
||||
}
|
||||
}
|
||||
@ -85,7 +85,7 @@ export class HashManager {
|
||||
}
|
||||
|
||||
prestige(): void {
|
||||
for (const name in HashUpgrades) {
|
||||
for (const name of Object.keys(HashUpgrades)) {
|
||||
this.upgrades[name] = 0;
|
||||
}
|
||||
this.hashes = 0;
|
||||
|
@ -220,7 +220,7 @@ for (const metadata of LocationsMetadata) {
|
||||
const cityName = loc.city;
|
||||
if (cityName === null) {
|
||||
// Generic location, add to all cities
|
||||
for (const city in Cities) {
|
||||
for (const city of Object.keys(Cities)) {
|
||||
Cities[city].addLocation(loc.name);
|
||||
}
|
||||
} else {
|
||||
|
@ -39,7 +39,6 @@ export function ApplyToJobButton(props: IProps): React.ReactElement {
|
||||
<Tooltip title={<span dangerouslySetInnerHTML={{ __html: getJobRequirementTooltip() }}></span>}>
|
||||
<Button onClick={props.onClick}>{props.text}</Button>
|
||||
</Tooltip>
|
||||
<br />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -132,10 +132,10 @@ function ASCIICity(props: IProps): React.ReactElement {
|
||||
|
||||
const elems: JSX.Element[] = [];
|
||||
const lines = props.city.asciiArt.split("\n");
|
||||
for (const i in lines) {
|
||||
for (const line of lines) {
|
||||
elems.push(
|
||||
<Typography key={i} sx={{ lineHeight: "1em", whiteSpace: "pre" }}>
|
||||
{lineElems(lines[i])}
|
||||
<Typography key={line} sx={{ lineHeight: "1em", whiteSpace: "pre" }}>
|
||||
{lineElems(line)}
|
||||
</Typography>,
|
||||
);
|
||||
}
|
||||
|
@ -61,15 +61,12 @@ export function GymLocation(props: IProps): React.ReactElement {
|
||||
<Button onClick={trainStrength}>
|
||||
Train Strength (<Money money={cost} player={props.p} /> / sec)
|
||||
</Button>
|
||||
<br />
|
||||
<Button onClick={trainDefense}>
|
||||
Train Defense (<Money money={cost} player={props.p} /> / sec)
|
||||
</Button>
|
||||
<br />
|
||||
<Button onClick={trainDexterity}>
|
||||
Train Dexterity (<Money money={cost} player={props.p} /> / sec)
|
||||
</Button>
|
||||
<br />
|
||||
<Button onClick={trainAgility}>
|
||||
Train Agility (<Money money={cost} player={props.p} /> / sec)
|
||||
</Button>
|
||||
|
@ -42,7 +42,6 @@ function ServerButton(props: IServerProps): React.ReactElement {
|
||||
cost={cost}
|
||||
rerender={props.rerender}
|
||||
/>
|
||||
<br />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -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,
|
||||
@ -368,6 +370,7 @@ export const RamCosts: IMap<any> = {
|
||||
getStyles: 0,
|
||||
setStyles: 0,
|
||||
resetStyles: 0,
|
||||
getGameInfo: 0,
|
||||
},
|
||||
|
||||
heart: {
|
||||
|
@ -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.");
|
||||
@ -762,7 +776,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
},
|
||||
disableLog: function (fn: any): any {
|
||||
if (fn === "ALL") {
|
||||
for (fn in possibleLogs) {
|
||||
for (fn of Object.keys(possibleLogs)) {
|
||||
workerScript.disableLogs[fn] = true;
|
||||
}
|
||||
workerScript.log("disableLog", () => `Disabled logging for all functions`);
|
||||
@ -775,7 +789,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
},
|
||||
enableLog: function (fn: any): any {
|
||||
if (fn === "ALL") {
|
||||
for (fn in possibleLogs) {
|
||||
for (fn of Object.keys(possibleLogs)) {
|
||||
delete workerScript.disableLogs[fn];
|
||||
}
|
||||
workerScript.log("enableLog", () => `Enabled logging for all functions`);
|
||||
@ -1302,8 +1316,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
updateDynamicRam("ps", getRamCost(Player, "ps"));
|
||||
const server = safeGetServer(hostname, "ps");
|
||||
const processes = [];
|
||||
for (const i in server.runningScripts) {
|
||||
const script = server.runningScripts[i];
|
||||
for (const script of server.runningScripts) {
|
||||
processes.push({
|
||||
filename: script.filename,
|
||||
threads: script.threads,
|
||||
@ -2269,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;
|
||||
@ -2279,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;
|
||||
@ -2298,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) {
|
||||
|
@ -101,7 +101,7 @@ export function NetscriptGang(player: IPlayer, workerScript: WorkerScript, helpe
|
||||
helper.updateDynamicRam("getOtherGangInformation", getRamCost(player, "gang", "getOtherGangInformation"));
|
||||
checkGangApiAccess("getOtherGangInformation");
|
||||
const cpy: any = {};
|
||||
for (const gang in AllGangs) {
|
||||
for (const gang of Object.keys(AllGangs)) {
|
||||
cpy[gang] = Object.assign({}, AllGangs[gang]);
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ export function NetscriptSingularity(
|
||||
// If player has a gang with this faction, return all augmentations.
|
||||
if (player.hasGangWith(facname)) {
|
||||
const res = [];
|
||||
for (const augName in Augmentations) {
|
||||
for (const augName of Object.keys(Augmentations)) {
|
||||
if (augName === AugmentationNames.NeuroFluxGovernor) continue;
|
||||
if (augName === AugmentationNames.TheRedPill && player.bitNodeN !== 2) continue;
|
||||
const aug = Augmentations[augName];
|
||||
@ -165,7 +165,7 @@ export function NetscriptSingularity(
|
||||
|
||||
let augs = [];
|
||||
if (player.hasGangWith(faction)) {
|
||||
for (const augName in Augmentations) {
|
||||
for (const augName of Object.keys(Augmentations)) {
|
||||
if (augName === AugmentationNames.NeuroFluxGovernor) continue;
|
||||
if (augName === AugmentationNames.TheRedPill && player.bitNodeN !== 2) continue;
|
||||
const tempAug = Augmentations[augName];
|
||||
@ -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 {
|
||||
|
@ -273,7 +273,7 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
||||
const orders: any = {};
|
||||
|
||||
const stockMarketOrders = StockMarket["Orders"];
|
||||
for (const symbol in stockMarketOrders) {
|
||||
for (const symbol of Object.keys(stockMarketOrders)) {
|
||||
const orderBook = stockMarketOrders[symbol];
|
||||
if (orderBook.constructor === Array && orderBook.length > 0) {
|
||||
orders[symbol] = [];
|
||||
|
@ -2,11 +2,13 @@ import { INetscriptHelper } from "./INetscriptHelper";
|
||||
import { WorkerScript } from "../Netscript/WorkerScript";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
import { getRamCost } from "../Netscript/RamCostGenerator";
|
||||
import { IStyleSettings, UserInterface as IUserInterface, UserInterfaceTheme } from "../ScriptEditor/NetscriptDefinitions";
|
||||
import { GameInfo, IStyleSettings, UserInterface as IUserInterface, UserInterfaceTheme } from "../ScriptEditor/NetscriptDefinitions";
|
||||
import { Settings } from "../Settings/Settings";
|
||||
import { ThemeEvents } from "../ui/React/Theme";
|
||||
import { defaultTheme } from "../Settings/Themes";
|
||||
import { defaultStyles } from "../Settings/Styles";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { hash } from "../hash/hash";
|
||||
|
||||
export function NetscriptUserInterface(
|
||||
player: IPlayer,
|
||||
@ -84,6 +86,19 @@ export function NetscriptUserInterface(
|
||||
Settings.styles = { ...defaultStyles };
|
||||
ThemeEvents.emit();
|
||||
workerScript.log("ui.resetStyles", () => `Reinitialized styles to default`);
|
||||
},
|
||||
|
||||
getGameInfo: function (): GameInfo {
|
||||
helper.updateDynamicRam("getGameInfo", getRamCost(player, "ui", "getGameInfo"));
|
||||
const version = CONSTANTS.VersionString;
|
||||
const commit = hash();
|
||||
const platform = (navigator.userAgent.toLowerCase().indexOf(" electron/") > -1) ? 'Steam' : 'Browser';
|
||||
|
||||
const gameInfo = {
|
||||
version, commit, platform,
|
||||
}
|
||||
|
||||
return gameInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export function toNative(pseudoObj: any): any {
|
||||
} else {
|
||||
// Object.
|
||||
nativeObj = {};
|
||||
for (const key in pseudoObj.properties) {
|
||||
for (const key of Object.keys(pseudoObj.properties)) {
|
||||
const val = pseudoObj.properties[key];
|
||||
nativeObj[key] = toNative(val);
|
||||
}
|
||||
|
@ -82,6 +82,16 @@ export async function executeJSScript(
|
||||
return loadedModule.main(ns);
|
||||
}
|
||||
|
||||
function isDependencyOutOfDate(filename: string, scripts: Script[], scriptModuleSequenceNumber: number): boolean {
|
||||
const depScript = scripts.find((s) => s.filename == filename);
|
||||
|
||||
// If the script is not present on the server, we should recompile, if only to get any necessary
|
||||
// compilation errors.
|
||||
if (!depScript) return true;
|
||||
|
||||
const depIsMoreRecent = depScript.moduleSequenceNumber > scriptModuleSequenceNumber;
|
||||
return depIsMoreRecent;
|
||||
}
|
||||
/** Returns whether we should compile the script parameter.
|
||||
*
|
||||
* @param {Script} script
|
||||
@ -89,16 +99,7 @@ export async function executeJSScript(
|
||||
*/
|
||||
function shouldCompile(script: Script, scripts: Script[]): boolean {
|
||||
if (script.module === "") return true;
|
||||
return script.dependencies.some((dep) => {
|
||||
const depScript = scripts.find((s) => s.filename == dep.filename);
|
||||
|
||||
// If the script is not present on the server, we should recompile, if only to get any necessary
|
||||
// compilation errors.
|
||||
if (!depScript) return true;
|
||||
|
||||
const depIsMoreRecent = depScript.moduleSequenceNumber > script.moduleSequenceNumber;
|
||||
return depIsMoreRecent;
|
||||
});
|
||||
return script.dependencies.some((dep) => isDependencyOutOfDate(dep.filename, scripts, script.moduleSequenceNumber));
|
||||
}
|
||||
|
||||
// Gets a stack of blob urls, the top/right-most element being
|
||||
@ -123,8 +124,13 @@ function shouldCompile(script: Script, scripts: Script[]): boolean {
|
||||
// BUG: apparently seen is never consulted. Oops.
|
||||
function _getScriptUrls(script: Script, scripts: Script[], seen: Script[]): ScriptUrl[] {
|
||||
// Inspired by: https://stackoverflow.com/a/43834063/91401
|
||||
/** @type {ScriptUrl[]} */
|
||||
const urlStack = [];
|
||||
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)) {
|
||||
script.dependents.push({ server: dependent.server, filename: dependent.filename });
|
||||
}
|
||||
}
|
||||
seen.push(script);
|
||||
try {
|
||||
// Replace every import statement with an import to a blob url containing
|
||||
@ -149,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) {
|
||||
@ -157,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,
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -166,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.
|
||||
@ -187,6 +193,19 @@ function _getScriptUrls(script: Script, scripts: Script[], seen: Script[]): Scri
|
||||
// Check to see if the urls for this script are stored in the cache by the hash value.
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!urls) {
|
||||
// Try to get a URL for the requested script and its dependencies.
|
||||
urls = _getScriptUrls(importedScript, scripts, seen);
|
||||
@ -217,11 +236,11 @@ function _getScriptUrls(script: Script, scripts: Script[], seen: Script[]): Scri
|
||||
// (e.g. same scripts on server, same hash value, etc) can use this blob url.
|
||||
BlobCache.store(transformedHash, blob);
|
||||
// Push the blob URL onto the top of the stack.
|
||||
urlStack.push(new ScriptUrl(script.filename, blob));
|
||||
urlStack.push(new ScriptUrl(script.filename, blob, script.moduleSequenceNumber));
|
||||
return urlStack;
|
||||
} catch (err) {
|
||||
// If there is an error, we need to clean up the URLs.
|
||||
for (const url in urlStack) URL.revokeObjectURL(url);
|
||||
for (const url of urlStack) URL.revokeObjectURL(url.url);
|
||||
throw err;
|
||||
} finally {
|
||||
seen.pop();
|
||||
|
@ -116,11 +116,11 @@ function startNetscript2Script(player: IPlayer, workerScript: WorkerScript): Pro
|
||||
};
|
||||
}
|
||||
|
||||
for (const prop in workerScript.env.vars) {
|
||||
for (const prop of Object.keys(workerScript.env.vars)) {
|
||||
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)");
|
||||
@ -175,7 +174,7 @@ function startNetscript1Script(workerScript: WorkerScript): Promise<WorkerScript
|
||||
const interpreterInitialization = function (int: any, scope: any): void {
|
||||
//Add the Netscript environment
|
||||
const ns = NetscriptFunctions(workerScript);
|
||||
for (const name in ns) {
|
||||
for (const name of Object.keys(ns)) {
|
||||
const entry = ns[name];
|
||||
if (typeof entry === "function") {
|
||||
//Async functions need to be wrapped. See JS-Interpreter documentation
|
||||
|
13
src/NetworkShare/Share.tsx
Normal file
13
src/NetworkShare/Share.tsx
Normal file
@ -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);
|
||||
}
|
5
src/NetworkShare/formulas/share.tsx
Normal file
5
src/NetworkShare/formulas/share.tsx
Normal file
@ -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;
|
||||
}
|
@ -112,7 +112,7 @@ export abstract class Person {
|
||||
* Updates this object's multipliers for the given augmentation
|
||||
*/
|
||||
applyAugmentation(aug: Augmentation): void {
|
||||
for (const mult in aug.mults) {
|
||||
for (const mult of Object.keys(aug.mults)) {
|
||||
if ((this as any)[mult] == null) {
|
||||
console.warn(`Augmentation has unrecognized multiplier property: ${mult}`);
|
||||
} else {
|
||||
|
@ -1485,7 +1485,7 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string {
|
||||
if (determineCrimeSuccess(this, this.crimeType)) {
|
||||
//Handle Karma and crime statistics
|
||||
let crime = null;
|
||||
for (const i in Crimes) {
|
||||
for (const i of Object.keys(Crimes)) {
|
||||
if (Crimes[i].type == this.crimeType) {
|
||||
crime = Crimes[i];
|
||||
break;
|
||||
@ -2557,15 +2557,15 @@ export function setBitNodeNumber(this: IPlayer, n: number): void {
|
||||
}
|
||||
|
||||
export function queueAugmentation(this: IPlayer, name: string): void {
|
||||
for (const i in this.queuedAugmentations) {
|
||||
if (this.queuedAugmentations[i].name == name) {
|
||||
for (const aug of this.queuedAugmentations) {
|
||||
if (aug.name == name) {
|
||||
console.warn(`tried to queue ${name} twice, this may be a bug`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (const i in this.augmentations) {
|
||||
if (this.augmentations[i].name == name) {
|
||||
for (const aug of this.augmentations) {
|
||||
if (aug.name == name) {
|
||||
console.warn(`tried to queue ${name} twice, this may be a bug`);
|
||||
return;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ export function purchaseResleeve(r: Resleeve, p: IPlayer): boolean {
|
||||
p.charisma_exp = r.charisma_exp;
|
||||
|
||||
// Reset Augmentation "owned" data
|
||||
for (const augKey in Augmentations) {
|
||||
for (const augKey of Object.keys(Augmentations)) {
|
||||
Augmentations[augKey].owned = false;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ export function findSleevePurchasableAugs(sleeve: Sleeve, p: IPlayer): Augmentat
|
||||
if (p.inGang()) {
|
||||
const fac = p.getGangFaction();
|
||||
|
||||
for (const augName in Augmentations) {
|
||||
for (const augName of Object.keys(Augmentations)) {
|
||||
const aug = Augmentations[augName];
|
||||
if (!isAvailableForSleeve(aug)) {
|
||||
continue;
|
||||
|
@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -75,14 +75,14 @@ export function prestigeAugmentation(): void {
|
||||
initForeignServers(Player.getHomeComputer());
|
||||
|
||||
// Gain favor for Companies
|
||||
for (const member in Companies) {
|
||||
for (const member of Object.keys(Companies)) {
|
||||
if (Companies.hasOwnProperty(member)) {
|
||||
Companies[member].gainFavor();
|
||||
}
|
||||
}
|
||||
|
||||
// Gain favor for factions
|
||||
for (const member in Factions) {
|
||||
for (const member of Object.keys(Factions)) {
|
||||
if (Factions.hasOwnProperty(member)) {
|
||||
Factions[member].gainFavor();
|
||||
}
|
||||
@ -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
|
||||
@ -200,14 +209,14 @@ export function prestigeSourceFile(flume: boolean): void {
|
||||
homeComp.cpuCores = 1;
|
||||
|
||||
// Reset favor for Companies
|
||||
for (const member in Companies) {
|
||||
for (const member of Object.keys(Companies)) {
|
||||
if (Companies.hasOwnProperty(member)) {
|
||||
Companies[member].favor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset favor for factions
|
||||
for (const member in Factions) {
|
||||
for (const member of Object.keys(Factions)) {
|
||||
if (Factions.hasOwnProperty(member)) {
|
||||
Factions[member].favor = 0;
|
||||
}
|
||||
@ -219,7 +228,7 @@ export function prestigeSourceFile(flume: boolean): void {
|
||||
}
|
||||
|
||||
// Delete all Augmentations
|
||||
for (const name in Augmentations) {
|
||||
for (const name of Object.keys(Augmentations)) {
|
||||
if (Augmentations.hasOwnProperty(name)) {
|
||||
delete Augmentations[name];
|
||||
}
|
||||
@ -242,7 +251,7 @@ export function prestigeSourceFile(flume: boolean): void {
|
||||
// Messages
|
||||
initMessages();
|
||||
|
||||
if (Player.sourceFileLvl(5) > 0) {
|
||||
if (Player.sourceFileLvl(5) > 0 || Player.bitNodeN === 5) {
|
||||
homeComp.programs.push(Programs.Formulas.name);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
//Returns the programs this player can create.
|
||||
export function getAvailableCreatePrograms(player: IPlayer): Program[] {
|
||||
const programs: Program[] = [];
|
||||
for (const key in Programs) {
|
||||
for (const key of Object.keys(Programs)) {
|
||||
// Non-creatable program
|
||||
const create = Programs[key].create;
|
||||
if (create == null) continue;
|
||||
|
@ -115,7 +115,7 @@ function evaluateVersionCompatibility(ver: string | number): void {
|
||||
}
|
||||
|
||||
// The "companyName" property of all Companies is renamed to "name"
|
||||
for (const companyName in Companies) {
|
||||
for (const companyName of Object.keys(Companies)) {
|
||||
const company: any = Companies[companyName];
|
||||
if (company.name == 0 && company.companyName != null) {
|
||||
company.name = company.companyName;
|
||||
|
@ -388,7 +388,8 @@ function parseOnlyCalculateDeps(code: string, currentModule: string): any {
|
||||
}
|
||||
},
|
||||
FunctionDeclaration: (node: any) => {
|
||||
const key = currentModule + "." + node.id.name;
|
||||
// node.id will be null when using 'export default'. Add a module name indicating the default export.
|
||||
const key = currentModule + "." + (node.id === null ? "__SPECIAL_DEFAULT_EXPORT__" : node.id.name);
|
||||
walk.recursive(node, { key: key }, commonVisitors());
|
||||
},
|
||||
},
|
||||
|
@ -10,10 +10,13 @@ import { ScriptUrl } from "./ScriptUrl";
|
||||
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver";
|
||||
import { roundToTwo } from "../utils/helpers/roundToTwo";
|
||||
import { computeHash } from "../utils/helpers/computeHash";
|
||||
import { ImportCache } from "../utils/ImportCache";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
|
||||
let globalModuleSequenceNumber = 0;
|
||||
|
||||
interface ScriptReference { filename: string; server: string }
|
||||
|
||||
export class Script {
|
||||
// Code for this script
|
||||
code = "";
|
||||
@ -35,6 +38,7 @@ export class Script {
|
||||
// whenever the script is first evaluated, and therefore may be out of date if the script
|
||||
// has been updated since it was last run.
|
||||
dependencies: ScriptUrl[] = [];
|
||||
dependents: ScriptReference[] = [];
|
||||
|
||||
// Amount of RAM this Script requres to run
|
||||
ramUsage = 0;
|
||||
@ -99,7 +103,11 @@ export class Script {
|
||||
* Force update of the computed hash based on the source code.
|
||||
*/
|
||||
rehash(): void {
|
||||
const oldHash = this._hash;
|
||||
this._hash = computeHash(this.code);
|
||||
if (oldHash !== this._hash) {
|
||||
ImportCache.remove(oldHash);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,6 +132,10 @@ export class Script {
|
||||
this.server = hostname;
|
||||
this.updateRamUsage(player, otherScripts);
|
||||
this.markUpdated();
|
||||
for (const dependent of this.dependents) {
|
||||
const [dependentScript] = otherScripts.filter(s => s.filename === dependent.filename && s.server == dependent.server);
|
||||
if (dependentScript !== null) dependentScript.markUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,6 +168,7 @@ export class Script {
|
||||
s.url = "";
|
||||
// Rehash the code to ensure that hash is set properly.
|
||||
s.rehash();
|
||||
s.dependents = [];
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ export function scriptCalculateOfflineProduction(runningScript: RunningScript):
|
||||
//Data map: [MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
|
||||
|
||||
// Grow
|
||||
for (const hostname in runningScript.dataMap) {
|
||||
for (const hostname of Object.keys(runningScript.dataMap)) {
|
||||
if (runningScript.dataMap.hasOwnProperty(hostname)) {
|
||||
if (runningScript.dataMap[hostname][2] == 0 || runningScript.dataMap[hostname][2] == null) {
|
||||
continue;
|
||||
@ -60,7 +60,7 @@ export function scriptCalculateOfflineProduction(runningScript: RunningScript):
|
||||
runningScript.offlineExpGained += expGain;
|
||||
|
||||
// Weaken
|
||||
for (const hostname in runningScript.dataMap) {
|
||||
for (const hostname of Object.keys(runningScript.dataMap)) {
|
||||
if (runningScript.dataMap.hasOwnProperty(hostname)) {
|
||||
if (runningScript.dataMap[hostname][3] == 0 || runningScript.dataMap[hostname][3] == null) {
|
||||
continue;
|
||||
|
@ -1,9 +1,11 @@
|
||||
export class ScriptUrl {
|
||||
filename: string;
|
||||
url: string;
|
||||
moduleSequenceNumber: number;
|
||||
|
||||
constructor(filename: string, url: string) {
|
||||
constructor(filename: string, url: string, moduleSequenceNumber: number) {
|
||||
this.filename = filename;
|
||||
this.url = url;
|
||||
this.moduleSequenceNumber = moduleSequenceNumber;
|
||||
}
|
||||
}
|
||||
|
63
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
63
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -3932,7 +3932,7 @@ interface Stanek {
|
||||
/**
|
||||
* List possible fragments.
|
||||
* @remarks
|
||||
* RAM cost: cost: 0 GB
|
||||
* RAM cost: 0 GB
|
||||
*
|
||||
* @returns List of possible fragments.
|
||||
*/
|
||||
@ -3941,7 +3941,7 @@ 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.
|
||||
*/
|
||||
@ -3950,14 +3950,14 @@ 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.
|
||||
@ -3969,7 +3969,7 @@ 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.
|
||||
@ -3981,7 +3981,7 @@ 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.
|
||||
@ -3992,7 +3992,7 @@ 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.
|
||||
@ -4009,7 +4009,7 @@ interface UserInterface {
|
||||
/**
|
||||
* Get the current theme
|
||||
* @remarks
|
||||
* RAM cost: cost: 0 GB
|
||||
* RAM cost: 0 GB
|
||||
*
|
||||
* @returns An object containing the theme's colors
|
||||
*/
|
||||
@ -4018,7 +4018,7 @@ interface UserInterface {
|
||||
/**
|
||||
* Sets the current theme
|
||||
* @remarks
|
||||
* RAM cost: cost: 0 GB
|
||||
* RAM cost: 0 GB
|
||||
* @example
|
||||
* Usage example (NS2)
|
||||
* ```ts
|
||||
@ -4032,14 +4032,14 @@ 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
|
||||
*/
|
||||
@ -4048,7 +4048,7 @@ interface UserInterface {
|
||||
/**
|
||||
* Sets the current styles
|
||||
* @remarks
|
||||
* RAM cost: cost: 0 GB
|
||||
* RAM cost: 0 GB
|
||||
* @example
|
||||
* Usage example (NS2)
|
||||
* ```ts
|
||||
@ -4062,9 +4062,16 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5175,9 +5182,9 @@ export interface NS extends Singularity {
|
||||
* @remarks
|
||||
* RAM cost: 0.1 GB
|
||||
*
|
||||
* Returns the server’s instrinsic “growth parameter”. This growth
|
||||
* parameter is a number between 0 and 100 that represents how
|
||||
* quickly the server’s money grows. This parameter affects the
|
||||
* Returns the server’s intrinsic “growth parameter”. This growth
|
||||
* parameter is a number typically between 0 and 100 that represents
|
||||
* how quickly the server’s money grows. This parameter affects the
|
||||
* percentage by which the server’s money is increased when using the
|
||||
* grow function. A higher growth parameter will result in a
|
||||
* higher percentage increase from grow.
|
||||
@ -6066,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -6573,3 +6594,13 @@ interface IStyleSettings {
|
||||
fontFamily: string;
|
||||
lineHeight: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Game Information
|
||||
* @internal
|
||||
*/
|
||||
interface GameInfo {
|
||||
version: string;
|
||||
commit: string;
|
||||
platform: string;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||
let AllServers: IMap<Server | HacknetServer> = {};
|
||||
|
||||
function GetServerByIP(ip: string): BaseServer | undefined {
|
||||
for (const key in AllServers) {
|
||||
for (const key of Object.keys(AllServers)) {
|
||||
const server = AllServers[key];
|
||||
if (server.ip !== ip) continue;
|
||||
return server;
|
||||
@ -30,7 +30,7 @@ function GetServerByIP(ip: string): BaseServer | undefined {
|
||||
//Returns server object with corresponding hostname
|
||||
// Relatively slow, would rather not use this a lot
|
||||
function GetServerByHostname(hostname: string): BaseServer | null {
|
||||
for (const key in AllServers) {
|
||||
for (const key of Object.keys(AllServers)) {
|
||||
const server = AllServers[key];
|
||||
if (server.hostname == hostname) {
|
||||
return server;
|
||||
@ -58,14 +58,14 @@ export function GetServer(s: string): BaseServer | null {
|
||||
|
||||
export function GetAllServers(): BaseServer[] {
|
||||
const servers: BaseServer[] = [];
|
||||
for (const key in AllServers) {
|
||||
for (const key of Object.keys(AllServers)) {
|
||||
servers.push(AllServers[key]);
|
||||
}
|
||||
return servers;
|
||||
}
|
||||
|
||||
export function DeleteServer(serverkey: string): void {
|
||||
for (const key in AllServers) {
|
||||
for (const key of Object.keys(AllServers)) {
|
||||
const server = AllServers[key];
|
||||
if (server.ip !== serverkey && server.hostname !== serverkey) continue;
|
||||
delete AllServers[key];
|
||||
@ -194,7 +194,7 @@ export function initForeignServers(homeComputer: Server): void {
|
||||
}
|
||||
|
||||
export function prestigeAllServers(): void {
|
||||
for (const member in AllServers) {
|
||||
for (const member of Object.keys(AllServers)) {
|
||||
delete AllServers[member];
|
||||
}
|
||||
AllServers = {};
|
||||
@ -206,7 +206,7 @@ export function loadAllServers(saveString: string): void {
|
||||
|
||||
export function saveAllServers(excludeRunningScripts = false): string {
|
||||
const TempAllServers = JSON.parse(JSON.stringify(AllServers), Reviver);
|
||||
for (const key in TempAllServers) {
|
||||
for (const key of Object.keys(TempAllServers)) {
|
||||
const server = TempAllServers[key];
|
||||
if (excludeRunningScripts) {
|
||||
server.runningScripts = [];
|
||||
|
@ -142,6 +142,11 @@ interface IDefaultSettings {
|
||||
* Character overview settings
|
||||
*/
|
||||
overview: OverviewSettings;
|
||||
|
||||
/**
|
||||
* If the game's sidebar is opened
|
||||
*/
|
||||
IsSidebarOpened: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -194,6 +199,7 @@ export const defaultSettings: IDefaultSettings = {
|
||||
SuppressSavedGameToast: false,
|
||||
UseIEC60027_2: false,
|
||||
ExcludeRunningScriptsFromSave: false,
|
||||
IsSidebarOpened: true,
|
||||
|
||||
theme: defaultTheme,
|
||||
styles: defaultStyles,
|
||||
@ -231,6 +237,8 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
|
||||
SuppressSavedGameToast: defaultSettings.SuppressSavedGameToast,
|
||||
UseIEC60027_2: defaultSettings.UseIEC60027_2,
|
||||
ExcludeRunningScriptsFromSave: defaultSettings.ExcludeRunningScriptsFromSave,
|
||||
IsSidebarOpened: defaultSettings.IsSidebarOpened,
|
||||
|
||||
MonacoTheme: "monokai",
|
||||
MonacoInsertSpaces: false,
|
||||
MonacoFontSize: 20,
|
||||
|
@ -106,6 +106,8 @@ interface IProps {
|
||||
player: IPlayer;
|
||||
router: IRouter;
|
||||
page: Page;
|
||||
opened: boolean;
|
||||
onToggled: (newValue: boolean) => void;
|
||||
}
|
||||
|
||||
export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
@ -297,7 +299,7 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
} else if (event.keyCode === KEY.W && event.altKey) {
|
||||
event.preventDefault();
|
||||
clickCity();
|
||||
} else if (event.keyCode === KEY.J && event.altKey && !event.ctrlKey && !event.metaKey && props.player.hasJob()) {
|
||||
} else if (event.keyCode === KEY.J && event.altKey && !event.ctrlKey && !event.metaKey && canJob) {
|
||||
// ctrl/cmd + alt + j is shortcut to open Chrome dev tools
|
||||
event.preventDefault();
|
||||
clickJob();
|
||||
@ -319,10 +321,10 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
} else if (event.keyCode === KEY.U && event.altKey) {
|
||||
event.preventDefault();
|
||||
clickTutorial();
|
||||
} else if (event.keyCode === KEY.B && event.altKey) {
|
||||
} else if (event.keyCode === KEY.B && event.altKey && props.player.bladeburner) {
|
||||
event.preventDefault();
|
||||
clickBladeburner();
|
||||
} else if (event.keyCode === KEY.G && event.altKey) {
|
||||
} else if (event.keyCode === KEY.G && event.altKey && props.player.gang) {
|
||||
event.preventDefault();
|
||||
clickGang();
|
||||
}
|
||||
@ -337,8 +339,13 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
}, []);
|
||||
|
||||
const classes = useStyles();
|
||||
const [open, setOpen] = useState(true);
|
||||
const [open, setOpen] = useState(props.opened);
|
||||
const toggleDrawer = (): void => setOpen((old) => !old);
|
||||
|
||||
useEffect(() => {
|
||||
props.onToggled(open);
|
||||
}, [open]);
|
||||
|
||||
return (
|
||||
<Drawer open={open} anchor="left" variant="permanent">
|
||||
<ListItem classes={{ root: classes.listitem }} button onClick={toggleDrawer}>
|
||||
@ -357,7 +364,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
<List>
|
||||
<ListItem classes={{ root: classes.listitem }} button onClick={() => setHackingOpen((old) => !old)}>
|
||||
<ListItemIcon>
|
||||
<ComputerIcon color="primary" />
|
||||
<Tooltip title={!open ? "Hacking" : ""}>
|
||||
<ComputerIcon color="primary" />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={<Typography>Hacking</Typography>} />
|
||||
{hackingOpen ? <ExpandLessIcon color="primary" /> : <ExpandMoreIcon color="primary" />}
|
||||
@ -374,9 +383,11 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickTerminal}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<LastPageIcon
|
||||
color={flashTerminal ? "error" : props.page !== Page.Terminal ? "secondary" : "primary"}
|
||||
/>
|
||||
<Tooltip title={!open ? "Terminal" : ""}>
|
||||
<LastPageIcon
|
||||
color={flashTerminal ? "error" : props.page !== Page.Terminal ? "secondary" : "primary"}
|
||||
/>
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={flashTerminal ? "error" : props.page !== Page.Terminal ? "secondary" : "primary"}>
|
||||
@ -394,7 +405,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickScriptEditor}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<CreateIcon color={props.page !== Page.ScriptEditor ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Script Editor" : ""}>
|
||||
<CreateIcon color={props.page !== Page.ScriptEditor ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.ScriptEditor ? "secondary" : "primary"}>
|
||||
@ -412,9 +425,11 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickActiveScripts}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<StorageIcon
|
||||
color={flashActiveScripts ? "error" : props.page !== Page.ActiveScripts ? "secondary" : "primary"}
|
||||
/>
|
||||
<Tooltip title={!open ? "Active Scripts" : ""}>
|
||||
<StorageIcon
|
||||
color={flashActiveScripts ? "error" : props.page !== Page.ActiveScripts ? "secondary" : "primary"}
|
||||
/>
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography
|
||||
@ -435,7 +450,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
>
|
||||
<ListItemIcon>
|
||||
<Badge badgeContent={programCount > 0 ? programCount : undefined} color="error">
|
||||
<BugReportIcon color={props.page !== Page.CreateProgram ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Create Program" : ""}>
|
||||
<BugReportIcon color={props.page !== Page.CreateProgram ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</Badge>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
@ -455,7 +472,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickStaneksGift}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<DeveloperBoardIcon color={props.page !== Page.StaneksGift ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Stanek's Gift" : ""}>
|
||||
<DeveloperBoardIcon color={props.page !== Page.StaneksGift ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.StaneksGift ? "secondary" : "primary"}>
|
||||
@ -470,7 +489,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
<Divider />
|
||||
<ListItem classes={{ root: classes.listitem }} button onClick={() => setCharacterOpen((old) => !old)}>
|
||||
<ListItemIcon>
|
||||
<AccountBoxIcon color="primary" />
|
||||
<Tooltip title={!open ? "Character" : ""}>
|
||||
<AccountBoxIcon color="primary" />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={<Typography>Character</Typography>} />
|
||||
{characterOpen ? <ExpandLessIcon color="primary" /> : <ExpandMoreIcon color="primary" />}
|
||||
@ -485,7 +506,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickStats}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<EqualizerIcon color={flashStats ? "error" : props.page !== Page.Stats ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Stats" : ""}>
|
||||
<EqualizerIcon color={flashStats ? "error" : props.page !== Page.Stats ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={flashStats ? "error" : props.page !== Page.Stats ? "secondary" : "primary"}>
|
||||
@ -505,7 +528,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
>
|
||||
<ListItemIcon>
|
||||
<Badge badgeContent={invitationsCount !== 0 ? invitationsCount : undefined} color="error">
|
||||
<ContactsIcon color={![Page.Factions, Page.Faction].includes(props.page) ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Factions" : ""}>
|
||||
<ContactsIcon color={![Page.Factions, Page.Faction].includes(props.page) ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</Badge>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
@ -527,10 +552,12 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
>
|
||||
<ListItemIcon>
|
||||
<Badge badgeContent={augmentationCount !== 0 ? augmentationCount : undefined} color="error">
|
||||
<DoubleArrowIcon
|
||||
style={{ transform: "rotate(-90deg)" }}
|
||||
color={props.page !== Page.Augmentations ? "secondary" : "primary"}
|
||||
/>
|
||||
<Tooltip title={!open ? "Augmentations" : ""}>
|
||||
<DoubleArrowIcon
|
||||
style={{ transform: "rotate(-90deg)" }}
|
||||
color={props.page !== Page.Augmentations ? "secondary" : "primary"}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Badge>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
@ -549,7 +576,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickHacknet}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<AccountTreeIcon color={flashHacknet ? "error" : props.page !== Page.Hacknet ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Hacknet" : ""}>
|
||||
<AccountTreeIcon color={flashHacknet ? "error" : props.page !== Page.Hacknet ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={flashHacknet ? "error" : props.page !== Page.Hacknet ? "secondary" : "primary"}>
|
||||
@ -568,7 +597,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickSleeves}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<PeopleAltIcon color={props.page !== Page.Sleeves ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Sleeves" : ""}>
|
||||
<PeopleAltIcon color={props.page !== Page.Sleeves ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.Sleeves ? "secondary" : "primary"}>Sleeves</Typography>
|
||||
@ -580,7 +611,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
<Divider />
|
||||
<ListItem classes={{ root: classes.listitem }} button onClick={() => setWorldOpen((old) => !old)}>
|
||||
<ListItemIcon>
|
||||
<PublicIcon color="primary" />
|
||||
<Tooltip title={!open ? "World" : ""}>
|
||||
<PublicIcon color="primary" />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={<Typography>World</Typography>} />
|
||||
{worldOpen ? <ExpandLessIcon color="primary" /> : <ExpandMoreIcon color="primary" />}
|
||||
@ -596,7 +629,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickCity}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<LocationCityIcon color={flashCity ? "error" : props.page !== Page.City ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "City" : ""}>
|
||||
<LocationCityIcon color={flashCity ? "error" : props.page !== Page.City ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={flashCity ? "error" : props.page !== Page.City ? "secondary" : "primary"}>
|
||||
@ -613,7 +648,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickTravel}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<AirplanemodeActiveIcon color={props.page !== Page.Travel ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Travel" : ""}>
|
||||
<AirplanemodeActiveIcon color={props.page !== Page.Travel ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.Travel ? "secondary" : "primary"}>Travel</Typography>
|
||||
@ -630,7 +667,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickJob}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<WorkIcon color={props.page !== Page.Job ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Job" : ""}>
|
||||
<WorkIcon color={props.page !== Page.Job ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.Job ? "secondary" : "primary"}>Job</Typography>
|
||||
@ -648,7 +687,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickStockMarket}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<TrendingUpIcon color={props.page !== Page.StockMarket ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Stock Market" : ""}>
|
||||
<TrendingUpIcon color={props.page !== Page.StockMarket ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.StockMarket ? "secondary" : "primary"}>Stock Market</Typography>
|
||||
@ -666,7 +707,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickBladeburner}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<FormatBoldIcon color={props.page !== Page.Bladeburner ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Bladeburner" : ""}>
|
||||
<FormatBoldIcon color={props.page !== Page.Bladeburner ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.Bladeburner ? "secondary" : "primary"}>Bladeburner</Typography>
|
||||
@ -684,7 +727,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickCorp}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<BusinessIcon color={props.page !== Page.Corporation ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Corp" : ""}>
|
||||
<BusinessIcon color={props.page !== Page.Corporation ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.Corporation ? "secondary" : "primary"}>Corp</Typography>
|
||||
@ -702,7 +747,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickGang}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<SportsMmaIcon color={props.page !== Page.Gang ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Gang" : ""}>
|
||||
<SportsMmaIcon color={props.page !== Page.Gang ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.Gang ? "secondary" : "primary"}>Gang</Typography>
|
||||
@ -714,7 +761,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
<Divider />
|
||||
<ListItem classes={{ root: classes.listitem }} button onClick={() => setHelpOpen((old) => !old)}>
|
||||
<ListItemIcon>
|
||||
<LiveHelpIcon color="primary" />
|
||||
<Tooltip title={!open ? "Help" : ""}>
|
||||
<LiveHelpIcon color="primary" />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={<Typography>Help</Typography>} />
|
||||
{helpOpen ? <ExpandLessIcon color="primary" /> : <ExpandMoreIcon color="primary" />}
|
||||
@ -729,7 +778,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickMilestones}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<CheckIcon color={props.page !== Page.Milestones ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Milestones" : ""}>
|
||||
<CheckIcon color={props.page !== Page.Milestones ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.Milestones ? "secondary" : "primary"}>Milestones</Typography>
|
||||
@ -744,7 +795,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickTutorial}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<HelpIcon color={flashTutorial ? "error" : props.page !== Page.Tutorial ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Tutorial" : ""}>
|
||||
<HelpIcon color={flashTutorial ? "error" : props.page !== Page.Tutorial ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={flashTutorial ? "error" : props.page !== Page.Tutorial ? "secondary" : "primary"}>
|
||||
@ -761,7 +814,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickAchievements}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<EmojiEventsIcon color={props.page !== Page.Achievements ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Achievements" : ""}>
|
||||
<EmojiEventsIcon color={props.page !== Page.Achievements ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.Achievements ? "secondary" : "primary"}>Achievements</Typography>
|
||||
@ -776,7 +831,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickOptions}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<SettingsIcon color={props.page !== Page.Options ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Options" : ""}>
|
||||
<SettingsIcon color={props.page !== Page.Options ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.Options ? "secondary" : "primary"}>Options</Typography>
|
||||
@ -793,7 +850,9 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
onClick={clickDev}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<DeveloperBoardIcon color={props.page !== Page.DevMenu ? "secondary" : "primary"} />
|
||||
<Tooltip title={!open ? "Dev" : ""}>
|
||||
<DeveloperBoardIcon color={props.page !== Page.DevMenu ? "secondary" : "primary"} />
|
||||
</Tooltip>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
<Typography color={props.page !== Page.DevMenu ? "secondary" : "primary"}>Dev</Typography>
|
||||
|
@ -42,7 +42,7 @@ export function processOrders(
|
||||
const orderBook = refs.stockMarket["Orders"];
|
||||
if (orderBook == null) {
|
||||
const orders: IOrderBook = {};
|
||||
for (const name in refs.stockMarket) {
|
||||
for (const name of Object.keys(refs.stockMarket)) {
|
||||
const stock = refs.stockMarket[name];
|
||||
if (!(stock instanceof Stock)) {
|
||||
continue;
|
||||
|
@ -55,7 +55,7 @@ export function placeOrder(
|
||||
const order = new Order(stock.symbol, shares, price, type, position);
|
||||
if (StockMarket["Orders"] == null) {
|
||||
const orders: IOrderBook = {};
|
||||
for (const name in StockMarket) {
|
||||
for (const name of Object.keys(StockMarket)) {
|
||||
const stk = StockMarket[name];
|
||||
if (!(stk instanceof Stock)) {
|
||||
continue;
|
||||
@ -157,7 +157,7 @@ export function deleteStockMarket(): void {
|
||||
}
|
||||
|
||||
export function initStockMarket(): void {
|
||||
for (const stk in StockMarket) {
|
||||
for (const stk of Object.keys(StockMarket)) {
|
||||
if (StockMarket.hasOwnProperty(stk)) {
|
||||
delete StockMarket[stk];
|
||||
}
|
||||
@ -169,7 +169,7 @@ export function initStockMarket(): void {
|
||||
}
|
||||
|
||||
const orders: IOrderBook = {};
|
||||
for (const name in StockMarket) {
|
||||
for (const name of Object.keys(StockMarket)) {
|
||||
const stock = StockMarket[name];
|
||||
if (!(stock instanceof Stock)) {
|
||||
continue;
|
||||
@ -184,7 +184,7 @@ export function initStockMarket(): void {
|
||||
}
|
||||
|
||||
export function initSymbolToStockMap(): void {
|
||||
for (const name in StockSymbols) {
|
||||
for (const name of Object.keys(StockSymbols)) {
|
||||
if (StockSymbols.hasOwnProperty(name)) {
|
||||
const stock = StockMarket[name];
|
||||
if (stock == null) {
|
||||
@ -198,7 +198,7 @@ export function initSymbolToStockMap(): void {
|
||||
}
|
||||
|
||||
function stockMarketCycle(): void {
|
||||
for (const name in StockMarket) {
|
||||
for (const name of Object.keys(StockMarket)) {
|
||||
const stock = StockMarket[name];
|
||||
if (!(stock instanceof Stock)) {
|
||||
continue;
|
||||
@ -247,7 +247,7 @@ export function processStockPrices(numCycles = 1): void {
|
||||
}
|
||||
|
||||
const v = Math.random();
|
||||
for (const name in StockMarket) {
|
||||
for (const name of Object.keys(StockMarket)) {
|
||||
const stock = StockMarket[name];
|
||||
if (!(stock instanceof Stock)) {
|
||||
continue;
|
||||
|
@ -5,7 +5,7 @@ export const TickerHeaderFormatData = {
|
||||
longestSymbol: 0,
|
||||
};
|
||||
|
||||
for (const key in StockSymbols) {
|
||||
for (const key of Object.keys(StockSymbols)) {
|
||||
TickerHeaderFormatData.longestName = Math.max(key.length, TickerHeaderFormatData.longestName);
|
||||
TickerHeaderFormatData.longestSymbol = Math.max(StockSymbols[key].length, TickerHeaderFormatData.longestSymbol);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ export function StockTickers(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
const tickers: React.ReactElement[] = [];
|
||||
for (const stockMarketProp in props.stockMarket) {
|
||||
for (const stockMarketProp of Object.keys(props.stockMarket)) {
|
||||
const val = props.stockMarket[stockMarketProp];
|
||||
if (val instanceof Stock) {
|
||||
// Skip if there's a filter and the stock isnt in that filter
|
||||
|
@ -3,52 +3,53 @@ import { IMap } from "../types";
|
||||
|
||||
export const TerminalHelpText: string[] = [
|
||||
"Type 'help name' to learn more about the command ",
|
||||
"",
|
||||
'alias [-g] [name="value"] Create or display Terminal aliases',
|
||||
"analyze Get information about the current machine ",
|
||||
"backdoor Install a backdoor on the current machine ",
|
||||
"buy [-l/program] Purchase a program through the Dark Web",
|
||||
"cat [file] Display a .msg, .lit, or .txt file",
|
||||
"cd [dir] Change to a new directory",
|
||||
"check [script] [args...] Print a script's logs to Terminal",
|
||||
"clear Clear all text on the terminal ",
|
||||
"cls See 'clear' command ",
|
||||
"connect [hostname] Connects to a remote server",
|
||||
"cp [src] [dst] Copy a file",
|
||||
"download [script/text file] Downloads scripts or text files to your computer",
|
||||
"expr [math expression] Evaluate a mathematical expression",
|
||||
"free Check the machine's memory (RAM) usage",
|
||||
"grow Spoof money in a servers bank account, increasing the amount available.",
|
||||
"hack Hack the current machine",
|
||||
"help [command] Display this help text, or the help text for a command",
|
||||
"home Connect to home computer",
|
||||
"hostname Displays the hostname of the machine",
|
||||
"kill [script/pid] [args...] Stops the specified script on the current server ",
|
||||
"killall Stops all running scripts on the current machine",
|
||||
"ls [dir] [| grep pattern] Displays all files on the machine",
|
||||
"lscpu Displays the number of CPU cores on the machine",
|
||||
"mem [script] [-t n] Displays the amount of RAM required to run the script",
|
||||
"mv [src] [dest] Move/rename a text or script file",
|
||||
"nano [file ...] | [glob] Text editor - Open up and edit one or more scripts or text files",
|
||||
"ps Display all scripts that are currently running",
|
||||
"rm [file] Delete a file from the server",
|
||||
"run [name] [-t n] [--tail] [args...] Execute a program or script",
|
||||
"scan Prints all immediately-available network connections",
|
||||
"scan-analyze [d] [-a] Prints info for all servers up to <i>d</i> nodes away",
|
||||
"scp [file ...] [server] Copies a file to a destination server",
|
||||
"sudov Shows whether you have root access on this computer",
|
||||
"tail [script] [args...] Displays dynamic logs for the specified script",
|
||||
"top Displays all running scripts and their RAM usage",
|
||||
"unalias [alias name] Deletes the specified alias",
|
||||
"vim [file ...] | [glob] Text editor - Open up and edit one or more scripts or text files in vim mode",
|
||||
"weaken Reduce the security of the current machine",
|
||||
"wget [url] [target file] Retrieves code/text from a web server",
|
||||
" ",
|
||||
' alias [-g] [name="value"] Create or display Terminal aliases',
|
||||
" analyze Get information about the current machine ",
|
||||
" backdoor Install a backdoor on the current machine ",
|
||||
" buy [-l/-a/program] Purchase a program through the Dark Web",
|
||||
" cat [file] Display a .msg, .lit, or .txt file",
|
||||
" cd [dir] Change to a new directory",
|
||||
" check [script] [args...] Print a script's logs to Terminal",
|
||||
" clear Clear all text on the terminal ",
|
||||
" cls See 'clear' command ",
|
||||
" connect [hostname] Connects to a remote server",
|
||||
" cp [src] [dst] Copy a file",
|
||||
" download [script/text file] Downloads scripts or text files to your computer",
|
||||
" expr [math expression] Evaluate a mathematical expression",
|
||||
" free Check the machine's memory (RAM) usage",
|
||||
" grow Spoof money in a servers bank account, increasing the amount available.",
|
||||
" hack Hack the current machine",
|
||||
" help [command] Display this help text, or the help text for a command",
|
||||
" home Connect to home computer",
|
||||
" hostname Displays the hostname of the machine",
|
||||
" kill [script/pid] [args...] Stops the specified script on the current server ",
|
||||
" killall Stops all running scripts on the current machine",
|
||||
" ls [dir] [| grep pattern] Displays all files on the machine",
|
||||
" lscpu Displays the number of CPU cores on the machine",
|
||||
" mem [script] [-t n] Displays the amount of RAM required to run the script",
|
||||
" mv [src] [dest] Move/rename a text or script file",
|
||||
" nano [file ...] Text editor - Open up and edit one or more scripts or text files",
|
||||
" ps Display all scripts that are currently running",
|
||||
" rm [file] Delete a file from the server",
|
||||
" run [name] [-t n] [--tail] [args...] Execute a program or script",
|
||||
" scan Prints all immediately-available network connections",
|
||||
" scan-analyze [d] [-a] Prints info for all servers up to <i>d</i> nodes away",
|
||||
" scp [file ...] [server] Copies a file to a destination server",
|
||||
" sudov Shows whether you have root access on this computer",
|
||||
" tail [script] [args...] Displays dynamic logs for the specified script",
|
||||
" top Displays all running scripts and their RAM usage",
|
||||
" unalias [alias name] Deletes the specified alias",
|
||||
" vim [file ...] Text editor - Open up and edit one or more scripts or text files in vim mode",
|
||||
" weaken Reduce the security of the current machine",
|
||||
" wget [url] [target file] Retrieves code/text from a web server",
|
||||
" ",
|
||||
];
|
||||
|
||||
const TemplatedHelpTexts: IMap<(command: string) => string[]> = {
|
||||
scriptEditor: (command) => {
|
||||
return [
|
||||
`${command} [file ...] | [glob]`,
|
||||
`Usage: ${command} [file ...] | [glob]`,
|
||||
` `,
|
||||
`Opens up the specified file(s) in the Script Editor. Only scripts (.js, .ns, .script) or text files (.txt) `,
|
||||
`can be edited using the Script Editor. If a file does not exist a new one will be created`,
|
||||
@ -58,11 +59,12 @@ const TemplatedHelpTexts: IMap<(command: string) => string[]> = {
|
||||
` `,
|
||||
`Examples:`,
|
||||
` `,
|
||||
`${command} test.js`,
|
||||
`${command} test.js test2.js`,
|
||||
` ${command} test.js`,
|
||||
` ${command} test.js test2.js`,
|
||||
` `,
|
||||
`${command} test.*`,
|
||||
`${command} /my-dir/*.js`,
|
||||
` ${command} test.*`,
|
||||
` ${command} /my-dir/*.js`,
|
||||
` `
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ export function ls(
|
||||
const classes = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
scriptLinksWrap: {
|
||||
display: "flex",
|
||||
display: "inline-flex",
|
||||
color: theme.palette.warning.main,
|
||||
},
|
||||
scriptLink: {
|
||||
|
@ -204,7 +204,7 @@ export async function determineAllPossibilitiesForTabCompletion(
|
||||
|
||||
if (isCommand("buy")) {
|
||||
const options = [];
|
||||
for (const i in DarkWebItems) {
|
||||
for (const i of Object.keys(DarkWebItems)) {
|
||||
const item = DarkWebItems[i];
|
||||
options.push(item.program);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user