Compare commits
85 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3f9554a6e | ||
|
|
bba6b26ac1 | ||
|
|
6b8ae1b351 | ||
|
|
2bd5741b22 | ||
|
|
79eca93ade | ||
|
|
028199aa7d | ||
|
|
bd4fe19fde | ||
|
|
d55395491c | ||
|
|
dc9b1050bf | ||
|
|
53755dd573 | ||
|
|
af0ed1dbb0 | ||
|
|
07397874c0 | ||
|
|
56ce1df0c8 | ||
|
|
ed59f4bfe7 | ||
|
|
b9a2953fa6 | ||
|
|
08e71c732b | ||
|
|
b0bdf0c7ad | ||
|
|
571f1eb8ef | ||
|
|
f16a4f1a4e | ||
|
|
f916007f2d | ||
|
|
4dd093606c | ||
|
|
af8528c777 | ||
|
|
dba6773375 | ||
|
|
e9bdc29c8c | ||
|
|
6a6043c509 | ||
|
|
b4074328ec | ||
|
|
1f5546b721 | ||
|
|
07b1eefe33 | ||
|
|
814e837983 | ||
|
|
88eb85da00 | ||
|
|
67fde6167b | ||
|
|
e7588de19c | ||
|
|
6590fa1c97 | ||
|
|
6459b1ab48 | ||
|
|
37f41c89bc | ||
|
|
35d590b25d | ||
|
|
e8e107254d | ||
|
|
a141431e08 | ||
|
|
d5707931c6 | ||
|
|
741f4a0d1e | ||
|
|
6d7fba4930 | ||
|
|
23199ee705 | ||
|
|
0c7b6a8ad8 | ||
|
|
6369ab434b | ||
|
|
867236e153 | ||
|
|
f8f8c8c517 | ||
|
|
caf65c4d63 | ||
|
|
d7439aae52 | ||
|
|
c1d3664955 | ||
|
|
707508a8cc | ||
|
|
c42303c1f5 | ||
|
|
9c365d0da5 | ||
|
|
d6a0d5fcaa | ||
|
|
ac8ea6b5ef | ||
|
|
80061b1f81 | ||
|
|
5f923a348c | ||
|
|
6f0b3d07b8 | ||
|
|
41451280ab | ||
|
|
f266906f6f | ||
|
|
bb3a248b34 | ||
|
|
8f2014ea6f | ||
|
|
0c2d402f0b | ||
|
|
54e8875dd0 | ||
|
|
dc85850435 | ||
|
|
65f22e7931 | ||
|
|
c593d3bce3 | ||
|
|
20f405a32c | ||
|
|
b4743a9841 | ||
|
|
593b860241 | ||
|
|
4a5cf623fa | ||
|
|
f47a588419 | ||
|
|
018c344554 | ||
|
|
7e183c4e4a | ||
|
|
b5297a0b7b | ||
|
|
fd3655a2fa | ||
|
|
53018341aa | ||
|
|
4eef9eec03 | ||
|
|
3281b785ce | ||
|
|
aa32e235fa | ||
|
|
7b5080a42b | ||
|
|
c42fde9379 | ||
|
|
a76e281349 | ||
|
|
237f9037bf | ||
|
|
494bc25794 | ||
|
|
31bf0c43d1 |
@@ -1,26 +1,16 @@
|
||||
node_modules/
|
||||
|
||||
.dist
|
||||
.tmp
|
||||
.package
|
||||
.build
|
||||
.cypress/
|
||||
.app
|
||||
|
||||
dist/
|
||||
input/
|
||||
assets/
|
||||
doc/
|
||||
markdown/
|
||||
dist
|
||||
input
|
||||
assets
|
||||
doc
|
||||
markdown
|
||||
electron
|
||||
tools
|
||||
src/ThirdParty
|
||||
|
||||
|
||||
test/netscript/
|
||||
|
||||
electron/lib
|
||||
electron/greenworks.js
|
||||
src/ThirdParty/*
|
||||
src/JSInterpreter.js
|
||||
tools/engines-check/
|
||||
|
||||
editor.main.js
|
||||
main.bundle.js
|
||||
webpack.config.js
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = {
|
||||
ecmaFeatures: {
|
||||
experimentalObjectRestSpread: true,
|
||||
},
|
||||
project: ["./tsconfig.json", "./test/tsconfig.json", "./tools/tsconfig.json", "./test/cypress/tsconfig.json"],
|
||||
project: ["./tsconfig.json", "./test/tsconfig.json", "./tools/tsconfig.json"],
|
||||
},
|
||||
plugins: ["@typescript-eslint"],
|
||||
extends: ["plugin:@typescript-eslint/recommended"],
|
||||
|
||||
12
.github/PULL_REQUEST_TEMPLATE
vendored
@@ -1,5 +1,3 @@
|
||||
# Only bugfix are accepted
|
||||
|
||||
# DELETE THIS AFTER READING
|
||||
|
||||
# READ CONTRIBUTING.md
|
||||
@@ -7,10 +5,10 @@
|
||||
# PR title
|
||||
|
||||
Formatted as such:
|
||||
SECTION: PLAYER DESCRIPTION
|
||||
CATEGORY: Change Description
|
||||
|
||||
SECTION is something like "API", "UI", "MISC", "STANEK", "CORPORATION"
|
||||
PLAYER DESCRIPTION is what you'd tell a non-contributor to convey what is changed.
|
||||
CATEGORY is something like "API", "UI", "MISC", "STANEK", etc, and must be uppercase.
|
||||
Change Description is what you'd tell a non-contributor to convey what is changed.
|
||||
|
||||
# Linked issues
|
||||
|
||||
@@ -24,8 +22,8 @@ It'll automate the process.
|
||||
|
||||
# Documentation
|
||||
|
||||
- DO NOT CHANGE any markdown/\*.md, these files are autogenerated from NetscriptDefinitions.d.ts and will be overwritten
|
||||
- DO NOT re-generate the documentation, makes it harder to review.
|
||||
- If your PR includes ns API function changes, do not manually modify markdown files.
|
||||
- Instead, you can run `npm run doc` to autogenerate new markdown files that reflect your submitted API changes.
|
||||
|
||||
# Bug fix
|
||||
|
||||
|
||||
85
.github/workflows/build.yml
vendored
@@ -1,85 +0,0 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
buildApp:
|
||||
description: "Include Application Build"
|
||||
type: boolean
|
||||
default: "true"
|
||||
required: true
|
||||
buildDoc:
|
||||
description: "Include Documentation Build"
|
||||
type: boolean
|
||||
default: "true"
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js 16.13.1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.13.1
|
||||
cache: "npm"
|
||||
|
||||
- name: Install NPM dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build Production App
|
||||
if: ${{ github.event.inputs.buildApp == 'true' }}
|
||||
run: npm run build
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ github.event.inputs.buildApp == 'true' }}
|
||||
with:
|
||||
name: app
|
||||
path: |
|
||||
dist/main.bundle.js
|
||||
dist/main.bundle.js.map
|
||||
dist/vendor.bundle.js
|
||||
dist/vendor.bundle.js.map
|
||||
index.html
|
||||
expire-on: never
|
||||
|
||||
- name: Build Documentation
|
||||
if: ${{ github.event.inputs.buildDoc == 'true' }}
|
||||
run: npm run doc
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ github.event.inputs.buildDoc == 'true' }}
|
||||
with:
|
||||
name: markdown
|
||||
path: markdown/
|
||||
expire-on: never
|
||||
deploy:
|
||||
needs: build
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v2
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v1
|
||||
with:
|
||||
artifact_name: app
|
||||
85
.github/workflows/check-for-generated-files.yml
vendored
@@ -1,85 +0,0 @@
|
||||
name: Check for Generated Files
|
||||
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the dev branch
|
||||
pull_request:
|
||||
branches: [dev]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
checkFiles:
|
||||
name: Check Files
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout files
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Check bundle files
|
||||
id: changed-bundle-files
|
||||
uses: tj-actions/changed-files@v18.4
|
||||
with:
|
||||
files: |
|
||||
dist/*
|
||||
index.html
|
||||
main.bundle.js
|
||||
main.bundle.js.map
|
||||
|
||||
- name: Check documentation changes
|
||||
id: changed-markdown-doc-files
|
||||
uses: tj-actions/changed-files@v18.4
|
||||
with:
|
||||
files: |
|
||||
markdown/*.md
|
||||
|
||||
- name: Warn when bundle files were changed
|
||||
id: warn-bundles-changed
|
||||
if: steps.changed-bundle-files.outputs.any_changed == 'true'
|
||||
run: |
|
||||
echo "One or more files in the bundle files were changed." >> warnings.txt
|
||||
|
||||
- name: Warn when documentation markdown files were changed
|
||||
id: warn-markdown-changed
|
||||
if: steps.changed-markdown-doc-files.outputs.any_changed == 'true'
|
||||
run: |
|
||||
echo "One or more files in the markdown documentation were changed." >> warnings.txt
|
||||
|
||||
- name: Print Warnings
|
||||
id: get-warnings
|
||||
run: |
|
||||
if [ -f warnings.txt ]
|
||||
then
|
||||
echo "::set-output name=has_warnings::true"
|
||||
else
|
||||
echo "::set-output name=has_warnings::false"
|
||||
touch warnings.txt
|
||||
fi
|
||||
|
||||
- name: Get Comment Body
|
||||
id: get-comment-body
|
||||
if: steps.get-warnings.outputs.has_warnings == 'true'
|
||||
run: |
|
||||
cat warnings.txt > comment.txt
|
||||
echo "" >> comment.txt
|
||||
echo "Please do not commit files generated by webpack or generated markdown" >> comment.txt
|
||||
echo "" >> comment.txt
|
||||
echo "See [CONTRIBUTING.md](https://github.com/bitburner-official/bitburner-src/blob/dev/doc/CONTRIBUTING.md) for details." >> comment.txt
|
||||
|
||||
body=$(cat comment.txt)
|
||||
body="${body//'%'/'%25'}"
|
||||
body="${body//$'\n'/'%0A'}"
|
||||
body="${body//$'\r'/'%0D'}"
|
||||
|
||||
echo ::set-output name=body::$body
|
||||
- name: Add github comment on problem
|
||||
if: steps.get-warnings.outputs.has_warnings == 'true'
|
||||
uses: peter-evans/commit-comment@v1
|
||||
with:
|
||||
body: ${{ steps.get-comment-body.outputs.body }}
|
||||
- name: Flag as error
|
||||
if: steps.get-warnings.outputs.has_warnings == 'true'
|
||||
run: |
|
||||
COMMIT_WARNINGS=$(cat warnings.txt)
|
||||
echo "::warning:: $COMMIT_WARNINGS"
|
||||
exit 1
|
||||
71
.github/workflows/ci-pr.yml
vendored
@@ -1,71 +0,0 @@
|
||||
name: CI Pull Request
|
||||
|
||||
on:
|
||||
# Triggers the workflow on pull request events but only for the dev branch, checking only diffs
|
||||
pull_request:
|
||||
branches: [dev]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js 16.13.1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.13.1
|
||||
cache: "npm"
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
- name: Build the production app
|
||||
run: npm run build
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Use Node.js 16.13.1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.13.1
|
||||
cache: "npm"
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
- name: Run linter
|
||||
run: npm run lint:report-diff
|
||||
prettier:
|
||||
name: Prettier
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Use Node.js 16.13.1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.13.1
|
||||
cache: "npm"
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
- name: Run prettier check
|
||||
run: npm run format:report-diff
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js 16.13.1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.13.1
|
||||
cache: "npm"
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
- name: Run tests
|
||||
run: npm run test
|
||||
12
.github/workflows/ci.yml
vendored
@@ -1,9 +1,11 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
# Triggers the workflow on push events but only for the dev branch
|
||||
# Triggers the workflow on push events and pull requests but only for the dev branch
|
||||
push:
|
||||
branches: [dev]
|
||||
pull_request:
|
||||
branches: [dev]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
@@ -13,7 +15,7 @@ jobs:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js 16.13.1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
@@ -27,7 +29,7 @@ jobs:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js 16.13.1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
@@ -41,7 +43,7 @@ jobs:
|
||||
name: Prettier
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js 16.13.1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
@@ -55,7 +57,7 @@ jobs:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js 16.13.1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
|
||||
6
.github/workflows/deploy-dev.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: "Deploy new dev build"
|
||||
name: "Deploy new pages build"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -20,8 +20,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
@@ -29,7 +27,7 @@ jobs:
|
||||
- run: npm run build
|
||||
- uses: actions/upload-pages-artifact@v1
|
||||
with:
|
||||
path: "."
|
||||
path: ".app"
|
||||
- name: Deploy to gh pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v1
|
||||
|
||||
70
.github/workflows/title-and-dist-checks.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
name: Validate Title and Check for Dist Changes
|
||||
|
||||
on:
|
||||
# Triggers the workflow on a few types of pull request events but only for the dev branch
|
||||
pull_request:
|
||||
branches: [dev]
|
||||
types: [opened, edited, synchronize, reopened]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
checkFiles:
|
||||
name: Check Files and Title
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout files
|
||||
uses: actions/checkout@v3
|
||||
- name: Check bundle files
|
||||
id: changed-bundle-files
|
||||
uses: tj-actions/changed-files@v18.4
|
||||
with:
|
||||
files: |
|
||||
dist/*
|
||||
|
||||
- name: Warn when dist was changed or title is invalid
|
||||
id: warn-bundles-changed
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
echo "Creating labels for dist modification and for invalid title"
|
||||
LABELDIST="warning: includes dist changes"
|
||||
LABELTITLE="error: invalid title"
|
||||
gh --repo "${{ github.repository }}" label create "$LABELDIST" --description "Dist changes should not normally be included" --color EBAE34 || true
|
||||
gh --repo "${{ github.repository }}" label create "$LABELTITLE" --description "PR title must follow specific format" --color D93F0B || true
|
||||
|
||||
echo "Determine dist portion of comment text, and add/remove dist label as appropriate"
|
||||
if [ "${{ steps.changed-bundle-files.outputs.any_changed }}" == "false" ]; then
|
||||
echo "No forbidden files included, removing warning"
|
||||
gh --repo "${{ github.repository }}" pr edit "${{ github.event.number }}" --remove-label "$LABELDIST" || true
|
||||
distText="### No dist changes are detected."
|
||||
else
|
||||
echo "Forbidden files included, generating warning"
|
||||
gh --repo "${{ github.repository }}" pr edit "${{ github.event.number }}" --add-label "$LABELDIST"
|
||||
distText="## Dist changes were included. PRs should not normally contain any changes in the dist folder.\n\nReview the changes and ensure that the included dist changes were necessary."
|
||||
fi
|
||||
|
||||
echo "Validate title"
|
||||
PR_TITLE=$(gh --repo "${{ github.repository }}" pr view "${{ github.event.number }}" --json title --jq .title)
|
||||
TITLE_REGEX="^[0-9A-Z\-]*: .*$"
|
||||
PR_TITLE_VALID=$(echo "$PR_TITLE" | grep -Eq "$TITLE_REGEX" && echo "true" || echo "false")
|
||||
|
||||
echo "Determine title portion of comment text, and add/remove title label as appropriate"
|
||||
if [ "$PR_TITLE_VALID" == "true" ]; then
|
||||
gh --repo "${{ github.repository }}" pr edit "${{ github.event.number }}" --remove-label "$LABELTITLE" || true
|
||||
commentText="$distText \n\n### Title is valid."
|
||||
makeNewComment="${{ steps.changed-bundle-files.outputs.any_changed }}"
|
||||
else
|
||||
gh --repo "${{ github.repository }}" pr edit "${{ github.event.number }}" --add-label "$LABELTITLE" || true
|
||||
commentText="$distText \n\n## The title \`$PR_TITLE\` should match \`$TITLE_REGEX\`\n\nCATEGORY: Change Description\n\nCATEGORY is something like 'API', 'UI', 'MISC', 'STANEK', etc.\n\nChange Description is what you'd tell a non-contributor to convey what is changed."
|
||||
makeNewComment="true"
|
||||
fi
|
||||
|
||||
echo "Edit existing comment or make a new one (if no comment present and one of the tests failed)"
|
||||
if [ "$makeNewComment" == "true" ]; then
|
||||
gh --repo "${{ github.repository }}" pr comment "${{ github.event.number }}" --body "$(echo -e $commentText)" --edit-last || gh --repo "${{ github.repository }}" pr comment "${{ github.event.number }}" --body "$(echo -e $commentText)"
|
||||
exit 1
|
||||
else
|
||||
gh --repo "${{ github.repository }}" pr comment "${{ github.event.number }}" --body "$(echo -e $commentText)" --edit-last || true
|
||||
fi
|
||||
64
.github/workflows/validate-pr.yml
vendored
@@ -1,64 +0,0 @@
|
||||
name: Validate PR
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [dev]
|
||||
types: [opened, edited, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
checkTitle:
|
||||
name: Check Title
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'pull_request'
|
||||
steps:
|
||||
- name: Validate Title
|
||||
id: validate-pr-title
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
echo "Creating label (if it does not exist)"
|
||||
LABEL="validation: invalid title"
|
||||
gh --repo "${{ github.repository }}" \
|
||||
label create "$LABEL" --description "Modifications to this pull request are requested" --color D93F0B || true
|
||||
|
||||
PR_TITLE=$(\
|
||||
gh --repo "${{ github.repository }}" \
|
||||
pr view "${{ github.event.number }}" --json title --jq .title)
|
||||
echo "::set-output name=title::$PR_TITLE"
|
||||
echo "PR Title: $PR_TITLE"
|
||||
|
||||
TITLE_REGEX="^[0-9A-Z\-]*: .*$"
|
||||
PR_TITLE_VALID=$(echo "$PR_TITLE" | grep -Eq "$TITLE_REGEX" && echo "true" || echo "false")
|
||||
|
||||
if [ "$PR_TITLE_VALID" == "true" ]; then
|
||||
echo "Title is valid, removing label"
|
||||
gh --repo "${{ github.repository }}" \
|
||||
pr edit "${{ github.event.number }}" --remove-label "$LABEL" || true
|
||||
else
|
||||
echo "Invalid Title"
|
||||
ERROR_MSG="$PR_TITLE -> should match -> $TITLE_REGEX"
|
||||
echo "$ERROR_MSG"
|
||||
echo "::set-output name=invalid::true"
|
||||
echo "::set-output name=errorMessage::$ERROR_MSG"
|
||||
|
||||
touch comment.txt
|
||||
echo "## The title \`$PR_TITLE\` should match \`$TITLE_REGEX\`" >> comment.txt
|
||||
echo "" >> comment.txt
|
||||
echo "SECTION: FIX #xzyw PLAYER DESCRIPTION" >> comment.txt
|
||||
echo "" >> comment.txt
|
||||
echo 'SECTION is something like "API", "UI", "MISC", "STANEK", "CORPORATION"' >> comment.txt
|
||||
echo 'FIX #xyzw is the issue number, if any' >> comment.txt
|
||||
echo "PLAYER DESCRIPTION is what you'd tell a non-contributor to convey what is changed." >> comment.txt
|
||||
|
||||
echo "Add pr label"
|
||||
gh --repo "${{ github.repository }}" \
|
||||
pr edit "${{ github.event.number }}" --add-label "$LABEL"
|
||||
echo "And comment on the pr"
|
||||
gh --repo "${{ github.repository }}" \
|
||||
pr comment "${{ github.event.number }}" --body-file comment.txt
|
||||
fi
|
||||
- name: Flag workflow error
|
||||
if: steps.validate-pr-title.outputs.invalid == 'true'
|
||||
run: |
|
||||
echo "${{ steps.validate-pr-title.outputs.errorMessage }}"
|
||||
exit 1
|
||||
5
.gitignore
vendored
@@ -10,9 +10,12 @@ Netburner.txt
|
||||
/test/*.bundle.*
|
||||
/test/*.css
|
||||
/input/bitburner.api.json
|
||||
dist/bitburner.d.ts
|
||||
dist/images
|
||||
.cypress
|
||||
|
||||
# tmp folder for electron
|
||||
# tmp folder for build and electron
|
||||
.app
|
||||
.package
|
||||
.build
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
node_modules
|
||||
package.json
|
||||
dist
|
||||
doc/build/
|
||||
doc/build
|
||||
doc/source
|
||||
.build
|
||||
.package
|
||||
.app
|
||||
|
||||
editor.main.js
|
||||
main.bundle.js
|
||||
|
||||
@@ -14,7 +14,7 @@ See the [frequently asked questions](./doc/FAQ.md) for more information . To dis
|
||||
# Documentation
|
||||
|
||||
The game's official documentation can be found on [Read The
|
||||
Docs](http://bitburner.readthedocs.io/). Please note that this is still a work-in-progress.
|
||||
Docs](http://bitburner-official.readthedocs.io/). Please note that this is still a work-in-progress.
|
||||
|
||||
The [in-game documentation](./markdown/bitburner.md) is generated from the [TypeScript definitions](./src/ScriptEditor/NetscriptDefinitions.d.ts).
|
||||
|
||||
|
||||
14
cypress.json
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"baseUrl": "http://localhost:8000",
|
||||
"trashAssetsBeforeRuns": true,
|
||||
"videoUploadOnPasses": false,
|
||||
"viewportWidth": 1980,
|
||||
"viewportHeight": 1080,
|
||||
"fixturesFolder": "test/cypress/fixtures",
|
||||
"integrationFolder": "test/cypress/integration",
|
||||
"pluginsFile": "test/cypress/plugins/index.js",
|
||||
"supportFile": "test/cypress/support/index.js",
|
||||
"screenshotsFolder": ".cypress/screenshots",
|
||||
"videosFolder": ".cypress/videos",
|
||||
"downloadsFolder": ".cypress/downloads"
|
||||
}
|
||||
7984
dist/bitburner.d.ts
vendored
BIN
dist/images/297df8c0e47764ea113951318b2acf55.png
vendored
|
Before Width: | Height: | Size: 118 KiB |
BIN
dist/images/447bc31e61f55e7eff875be3e9a81f1a.png
vendored
|
Before Width: | Height: | Size: 120 KiB |
BIN
dist/images/4e0e750f2f09de58219773edd46cbbf5.png
vendored
|
Before Width: | Height: | Size: 118 KiB |
BIN
dist/images/5aa87b7de67a77c914088783b055e1cf.png
vendored
|
Before Width: | Height: | Size: 119 KiB |
BIN
dist/images/66f4b86d86164fc117bd6d648e4eaa6f.png
vendored
|
Before Width: | Height: | Size: 116 KiB |
BIN
dist/images/6caf35202b10b52e1fc2743f674c33e8.png
vendored
|
Before Width: | Height: | Size: 111 KiB |
BIN
dist/images/83b2443ab7e7d346766c8f6bc5afc7a7.png
vendored
|
Before Width: | Height: | Size: 112 KiB |
BIN
dist/images/85a7b2896acb62be76f3ea7100fe9012.png
vendored
|
Before Width: | Height: | Size: 121 KiB |
BIN
dist/images/9f96a5084f4e5f1a6c0041b41b34d62d.png
vendored
|
Before Width: | Height: | Size: 118 KiB |
BIN
dist/images/a1110d6c8d16a14c4570411750248399.png
vendored
|
Before Width: | Height: | Size: 120 KiB |
BIN
dist/images/c7164b072d62c91c27c6d607b5207e7b.png
vendored
|
Before Width: | Height: | Size: 121 KiB |
BIN
dist/images/cb88977ea837bccb9cceb727adc78302.png
vendored
|
Before Width: | Height: | Size: 118 KiB |
BIN
dist/images/e66b0c327f97d08e4253f52234d659eb.png
vendored
|
Before Width: | Height: | Size: 120 KiB |
BIN
dist/images/e97de4daa946331c7e99dee9c05d629c.png
vendored
|
Before Width: | Height: | Size: 117 KiB |
@@ -1,5 +1,3 @@
|
||||
# Only bugfix are accepted
|
||||
|
||||
# Contributing to Bitburner
|
||||
|
||||
## In General
|
||||
@@ -156,7 +154,6 @@ upstream/master
|
||||
- Work in a new branch forked from the `dev` branch to isolate your new code.
|
||||
- Keep code-changes on a branch as small as possible. This makes it easier for code review. Each branch should be its own independent feature.
|
||||
- Regularly rebase your branch against `dev` to make sure you have the latest updates pulled.
|
||||
- When merging, always merge your branch into `dev`. When releasing a new update, merge `dev` into `master`.
|
||||
|
||||
## Running locally
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ The general logic goes like this:
|
||||
|
||||
loop forever {
|
||||
if security is not minimum {
|
||||
weaken(target)
|
||||
await ns.weaken(target)
|
||||
} else if money is not maximum {
|
||||
grow(target)
|
||||
await ns.grow(target)
|
||||
} else {
|
||||
hack(target)
|
||||
await ns.hack(target)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ By splitting our hack, weaken, and grow functions into three separate scripts, w
|
||||
.. code-block:: javascript
|
||||
|
||||
loop forever {
|
||||
hack(target) // or grow, or weaken
|
||||
await ns.hack(target) // or grow, or weaken
|
||||
}
|
||||
|
||||
Now we can take the total amount of threads available and split it and allocate, for example:
|
||||
@@ -95,8 +95,8 @@ The scripts used to execute the hacking functions are even simpler than the prev
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
sleep(a bit)
|
||||
hack(target) // or grow, or weaken
|
||||
await ns.sleep(a bit)
|
||||
await ns.hack(target) // or grow, or weaken
|
||||
|
||||
A few things need to be known before this algorithm can be implemented:
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ than 'sleeves' for the human consciousness. This technology thus became known as
|
||||
Sleeve technology unlocks two different gameplay features:
|
||||
|
||||
* Duplicate Sleeves
|
||||
* Re-sleeving
|
||||
* Grafting
|
||||
|
||||
Sleeve technology is unlocked in :ref:`BitNode-10 <gameplay_bitnodes>`.
|
||||
|
||||
@@ -48,11 +48,6 @@ Synchronization is a measure of how aligned your consciousness is with that of y
|
||||
Duplicate Sleeves. It is a numerical value between 1 and 100, and it affects how much experience
|
||||
is earned when the sleeve is performing a task.
|
||||
|
||||
Let N be the sleeve's synchronization. When the sleeve earns experience by performing
|
||||
a task, both the sleeve and the player's original host consciousness gain N% of the
|
||||
amount of experience normally earned by the task. All of the player's other sleeves
|
||||
earn ((N/100)^2 * 100)% of the experience.
|
||||
|
||||
Synchronization can be increased by assigning sleeves to the 'Synchronize' task.
|
||||
|
||||
Sleeve Shock
|
||||
@@ -64,6 +59,10 @@ no shock. Shock affects the amount of experience earned by the sleeve.
|
||||
Sleeve shock slowly decreases over time. You can further increase the rate at which
|
||||
it decreases by assigning sleeves to the 'Shock Recovery' task.
|
||||
|
||||
Let X be the sleeve's shock and Y be the sleeve's synchronization. When the sleeve earns experience by performing
|
||||
a task, the sleeve gains X% of the amount of experience normally earned by the task. player’s original host consciousness and all of the player's other sleeves
|
||||
earn Y% of the experience that the sleeve gained, or X*Y % of the normal experience amount.
|
||||
|
||||
Augmentations
|
||||
~~~~~~~~~~~~~
|
||||
You can purchase :ref:`Augmentations <gameplay_augmentations>` for your Duplicate
|
||||
@@ -90,3 +89,6 @@ the ability to purchase additional sleeves, this is only available in BitNode-10
|
||||
|
||||
Memory is a persistent stat, meaning it never gets reset back to 1.
|
||||
The maximum possible value for a sleeve's memory is 100.
|
||||
|
||||
Buying memory has no instant affect on synchronization,
|
||||
memory affects only the starting synchronization upon entering a BitNode.
|
||||
@@ -10,61 +10,53 @@ in the game and each BitNode will grant a different Source-File when it is destr
|
||||
|
||||
A Source-File can be upgraded by destroying its corresponding BitNode a second or
|
||||
third time (AKA playing through that BitNode again). It can be upgraded to a maximum
|
||||
of level 3.
|
||||
of level 3, with the exception of source-file 12, which has no hard limit.
|
||||
|
||||
List of all Source-Files
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-1: Source Genesis || * Let the player start with 32 GB of RAM on the home computer. |
|
||||
|| || * Increases all of the player's multipliers by 16%/24%/28%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-2: Rise of the Underworld || * Let the player create Gangs in other BitNodes (although some |
|
||||
|| || BitNodes will disable this mechanic). |
|
||||
|| || * Increases the player's crime success rate, crime money, and |
|
||||
|| || charisma multipliers by 24%/36%/42%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-3: Corporatocracy || * Let the player create Corporations in other BitNodes (although some |
|
||||
|| || BitNodes will disable this mechanic). |
|
||||
|| || * 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. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-5: Artificial Intelligence || * Unlocks :ref:`gameplay_intelligence`. |
|
||||
|| || * Unlocks :js:func:`getBitNodeMultipliers` and start with Formulas.exe. |
|
||||
|| || * Increases all of the player's hacking-related multipliers by 8%/12%/14%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-6: Bladeburners || * Unlocks the Bladeburner feature in other BitNodes. |
|
||||
|| || * Increases all of the player's level and experience gain rate multipliers for |
|
||||
|| || combat stats by 8%/12%/14%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-7: Bladeburners 2079 || * Allows the player to access the `Bladeburner API <https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.bladeburner.md>`_ in other BitNodes. |
|
||||
|| || * Increases all of the player's Bladeburner multipliers by 8%/12%/14%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-8: Ghost of Wall Street || * Increases the player's hacking growth multiplier by 12%/18%/21%. |
|
||||
|| || * Level 1 grants permanent access to :ref:`WSE <gameplay_stock_market>` and the `TIX API <https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.tix.md>`_ |
|
||||
|| || * Level 2 grants permanent access to shorting stocks. |
|
||||
|| || * Level 3 grants permanent access to use limit/stop orders. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-9: Hacktocracy || * Level 1 permanently unlocks the Hacknet Server in other BitNodes. |
|
||||
|| || * Level 2 lets the player start with 128 GB of RAM on the home computer. |
|
||||
|| || * Level 3 grants a highly-upgraded Hacknet Server when entering a new BitNode (it |
|
||||
|| || will be lost after installing augments). |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-10: Digital Carbon || * Each level of this grants a Duplicate Sleeve. |
|
||||
|| || * Allows the player to access the `Sleeve API <https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.sleeve.md>`_ in other BitNodes. |
|
||||
|| || * Grants the player access to the VitaLife secret laboratory in other BitNodes. Also grants access to the Grafting API. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-11: The Big Crash || * Company favor increases both the player's salary and reputation gain at that |
|
||||
|| || company by 1% per favor (rather than just the reputation gain). |
|
||||
|| || * Increases the player's company salary and reputation gain multipliers by |
|
||||
|| || 32%/48%/56%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-12: The Recursion || * There is no maximum level for this Source-File. |
|
||||
|| || * Let the player start with Neuroflux Governor equal to the level of this |
|
||||
|| || Source-File. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|| BitNode-13: They're lunatics || * This Source-File lets the Church of the Machine God appear in other BitNodes. |
|
||||
|| || * Each level of this Source-File increases the size of Stanek's Gift. |
|
||||
|| || |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-1: Source Genesis | * Let the player start with 32 GB of RAM on the home computer. |
|
||||
| | * Increases all of the player's multipliers by 16%/24%/28%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-2: Rise of the Underworld | * Let the player create Gangs in other BitNodes (although some BitNodes will disable this mechanic). |
|
||||
| | * Increases the player's crime success rate, crime money, and charisma multipliers by 24%/36%/42%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-3: Corporatocracy | * Let the player create Corporations in other BitNodes (although some BitNodes will disable this mechanic). |
|
||||
| | * 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. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-5: Artificial Intelligence | * Unlocks :ref:`gameplay_intelligence`. |
|
||||
| | * Unlocks :js:func:`getBitNodeMultipliers` and grants permanent access to Formulas.exe. |
|
||||
| | * Increases all of the player's hacking-related multipliers by 8%/12%/14%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-6: Bladeburners | * Unlocks the Bladeburner feature in other BitNodes. |
|
||||
| | * Increases all of the player's level and experience gain rate multipliers for combat stats by 8%/12%/14%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-7: Bladeburners 2079 | * Allows the player to access the `Bladeburner API <https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.bladeburner.md>`_ in other BitNodes. |
|
||||
| | * Increases all of the player's Bladeburner multipliers by 8%/12%/14%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-8: Ghost of Wall Street | * Increases the player's hacking growth multiplier by 12%/18%/21%. |
|
||||
| | * Level 1 grants permanent access to :ref:`WSE <gameplay_stock_market>` and the `TIX <https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.tix.md>`_ API. |
|
||||
| | * Level 2 grants permanent access to shorting stocks. |
|
||||
| | * Level 3 grants permanent access to use limit/stop orders. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-9: Hacktocracy | * Level 1 permanently unlocks the Hacknet Server in other BitNodes. |
|
||||
| | * Level 2 lets the player start with 128 GB of RAM on the home computer. |
|
||||
| | * Level 3 grants a highly-upgraded Hacknet Server when entering a new BitNode (it will be lost after installing augments). |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-10: Digital Carbon | * Each level of this grants a Duplicate Sleeve. |
|
||||
| | * Allows the player to access the `Sleeve API <https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.sleeve.md>`_ in other BitNodes. |
|
||||
| | * Grants the player access to the VitaLife secret laboratory in other BitNodes. Also grants access to the Grafting API. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-11: The Big Crash | * Company favor increases both the player's salary and reputation gain at that company by 1% per favor (rather than just the reputation gain). |
|
||||
| | * Increases the player's company salary and reputation gain multipliers by 32%/48%/56%. |
|
||||
| | * This Source-File reduces the price increase for every aug bought by 4%/5%/7%. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-12: The Recursion | * There is no maximum level for this Source-File. |
|
||||
| | * Let the player start with Neuroflux Governor equal to the level of this Source-File. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BitNode-13: They're lunatics | * This Source-File lets the Church of the Machine God appear in other BitNodes. |
|
||||
| | * Each level of this Source-File increases the size of Stanek's Gift. |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
@@ -59,6 +59,7 @@ Here is everything you will KEEP when you install an Augmentation:
|
||||
* Scripts on your home computer
|
||||
* RAM/Core Upgrades on your home computer
|
||||
* World Stock Exchange account and TIX API Access
|
||||
* Previously installed Augmentations
|
||||
|
||||
.. _gameplay_augmentations_purchasingmultiple:
|
||||
|
||||
|
||||
@@ -11,3 +11,7 @@ While working for a company, you can click "Do something else simultaneously" to
|
||||
to do things while you continue to work in the background. There is a 20% penalty to the
|
||||
related gains. Clicking the "Focus" button under the overview will return you to the
|
||||
current work.
|
||||
|
||||
If you've been hired to do a job you can click that "Apply for X Job" button again to get a
|
||||
promotion if you meet the requirements. You can see the requirements by hovering your cursor
|
||||
over the button. Higher positions give increased rewards.
|
||||
@@ -24,7 +24,7 @@ Crimes are not always successful. Your rate of success is determined by your
|
||||
stats (and Augmentation multipliers) and can be seen on the crime-selection
|
||||
page. If you are unsuccessful at committing a crime you will gain EXP,
|
||||
but you will not earn money. If you are successful at committing the crime
|
||||
you will gain extra EXP (double of what an unsuccessful attempt would give)
|
||||
you will gain extra EXP (4x of what an unsuccessful attempt would give)
|
||||
and earn money.
|
||||
|
||||
Harder crimes are typically more profitable, and also give more EXP.
|
||||
|
||||
@@ -207,12 +207,12 @@ List of Factions and their Requirements
|
||||
.. raw:: html
|
||||
|
||||
</details>
|
||||
<details><summary><a>Endgame Factions</a></summary>
|
||||
<details><summary><a>Midgame Factions</a></summary>
|
||||
|
||||
.. _gameplay_factions::
|
||||
|
||||
+---------------------+----------------+-----------------------------------------+-------------------------------+
|
||||
| Endgame | Faction Name | Requirements | Joining this Faction prevents |
|
||||
| Midgame | Faction Name | Requirements | Joining this Faction prevents |
|
||||
| Factions | | | you from joining: |
|
||||
+ +----------------+-----------------------------------------+-------------------------------+
|
||||
| | The Covenant | * 20 Augmentations | |
|
||||
@@ -230,6 +230,26 @@ List of Factions and their Requirements
|
||||
| | | * Hacking Level of 1500 | |
|
||||
| | | * All Combat Stats of 1200 | |
|
||||
+---------------------+----------------+-----------------------------------------+-------------------------------+
|
||||
.. raw:: html
|
||||
|
||||
</details>
|
||||
<details><summary><a>Endgame Factions</a></summary>
|
||||
|
||||
.. _gameplay_factions::
|
||||
|
||||
+---------------------+----------------+--------------------------------------------------------------+-------------------------------+
|
||||
| Endgame | Faction Name | Requirements | Joining this Faction prevents |
|
||||
| Factions | | | you from joining: |
|
||||
+ +----------------+--------------------------------------------------------------+-------------------------------+
|
||||
| | Bladeburners | * Join Bladeburner Division | |
|
||||
| | | * Have 25 Rank | |
|
||||
| | | * Be in BitNode 6 or 7 | |
|
||||
| | | * or have Source-File 6 or 7 | |
|
||||
+ +----------------+--------------------------------------------------------------+-------------------------------+
|
||||
| | Church of the | * Have not installed any augmentations in the current BitNode| |
|
||||
| | Machine God | * Be in BitNode 13 | |
|
||||
| | | * or have Source-File 13 | |
|
||||
+---------------------+----------------+--------------------------------------------------------------+-------------------------------+
|
||||
.. raw:: html
|
||||
|
||||
</details><br>
|
||||
|
||||
@@ -33,11 +33,11 @@ infiltration will immediately end.
|
||||
|
||||
** Slash when his guard is down! **
|
||||
|
||||
Press space when the guard is attacking you.
|
||||
There's 3 phase
|
||||
Press space when the guard is preparing to attack you.
|
||||
There's 3 phases
|
||||
The first is guarding, where attacking back will result in failure.
|
||||
The 2nd is preparing, this informs you that in 250ms there will be an opening window to attack.
|
||||
The 3rd is attack, during this phase you can press space to slash and kill the enemy.
|
||||
The 2nd is preparing, where attacking will result in a victory.
|
||||
The 3rd is attack, where the guard will attack you resulting in failure.
|
||||
|
||||
** Close the brackets **
|
||||
|
||||
|
||||
@@ -78,11 +78,11 @@ with scripts:
|
||||
Prints the logs of the script specified by the name and arguments to
|
||||
Terminal. Arguments should be separated by a space. Remember that scripts
|
||||
are uniquely identified by their arguments as well as their name. For
|
||||
example, if you ran a script `foo.script` with the argument `foodnstuff`
|
||||
example, if you ran a script `foo.hs` with the argument `foodnstuff`
|
||||
then in order to 'check' it you must also add the `foodnstuff` argument
|
||||
to the check command::
|
||||
|
||||
$ check foo.script foodnstuff
|
||||
$ check foo.js foodnstuff
|
||||
|
||||
**free**
|
||||
|
||||
@@ -93,11 +93,11 @@ Shows the current server's RAM usage and availability
|
||||
Stops a script that is running with the specified script name and
|
||||
arguments. Arguments should be separated by a space. Remember that
|
||||
scripts are uniquely identified by their arguments as well as
|
||||
their name. For example, if you ran a script `foo.script` with
|
||||
the argument 1 and 2, then just typing "`kill foo.script`" will
|
||||
their name. For example, if you ran a script `foo.js` with
|
||||
the argument 1 and 2, then just typing "`kill foo.js`" will
|
||||
not work. You have to use::
|
||||
|
||||
$ kill foo.script 1 2
|
||||
$ kill foo.js 1 2
|
||||
|
||||
**mem [script] [-t] [n]**
|
||||
|
||||
@@ -125,26 +125,30 @@ with no arguments.
|
||||
|
||||
Examples:
|
||||
|
||||
Run 'foo.script' single-threaded with no arguments::
|
||||
Run 'foo.js' single-threaded with no arguments::
|
||||
|
||||
$ run foo.script
|
||||
$ run foo.js
|
||||
|
||||
Run 'foo.script' with 10 threads and no arguments::
|
||||
Run 'foo.js' with 10 threads and no arguments::
|
||||
|
||||
$ run foo.script -t 10
|
||||
$ run foo.js -t 10
|
||||
|
||||
Run 'foo.script' single-threaded with three arguments: [foodnstuff, sigma-cosmetics, 10]::
|
||||
Run 'foo.js' single-threaded with three arguments: [foodnstuff, sigma-cosmetics, 10]::
|
||||
|
||||
$ run foo.script foodnstuff sigma-cosmetics 10
|
||||
$ run foo.js foodnstuff sigma-cosmetics 10
|
||||
|
||||
Run 'foo.script' with 50 threads and a single argument: [foodnstuff]::
|
||||
Run 'foo.js' with 50 threads and a single argument: [foodnstuff]::
|
||||
|
||||
$ run foo.script -t 50 foodnstuff
|
||||
$ run foo.js -t 50 foodnstuff
|
||||
|
||||
|
||||
**tail [script] [args...]**
|
||||
|
||||
Displays the logs of the script specified by the name and arguments. Note that scripts are uniquely identified by their arguments as well as their name. For example, if you ran a script 'foo.script' with the argument 'foodnstuff' then in order to 'tail' it you must also add the 'foodnstuff' argument to the tail command as so: tail foo.script foodnstuff
|
||||
Displays the logs of the script specified by the name and arguments. Note that scripts
|
||||
are uniquely identified by their arguments as well as their name. For example, if you
|
||||
ran a script 'foo.js' with the argument 'foodnstuff' then in order to 'tail' it you
|
||||
must also add the 'foodnstuff' argument to the tail command as so: tail foo.js
|
||||
foodnstuff
|
||||
|
||||
**top**
|
||||
|
||||
|
||||
@@ -8,8 +8,11 @@ game are connected to each other to form a large, global network.
|
||||
To learn about how to navigate this network and connect to other
|
||||
servers, see the :ref:`Terminal` page.
|
||||
|
||||
Server RAM
|
||||
^^^^^^^^^^
|
||||
Server Statistics
|
||||
^^^^^^^^^^^^^^^^^
|
||||
Each server has it's own statistics, such as RAM, required hacking level and number of
|
||||
ports required to successfully NUKE it.
|
||||
|
||||
Perhaps the most important property of a server to make note of is its RAM,
|
||||
which refers to how much memory is available on that machine. RAM is
|
||||
important because it is required to run Scripts. More RAM allows
|
||||
@@ -19,6 +22,9 @@ a script with :ref:`more threads <gameplay_scripts_multithreadingscripts>`.
|
||||
The `free`, `scan-analyze`, and `analyze` Terminal commands
|
||||
can be used to check how much RAM a server has.
|
||||
|
||||
Some servers have some randomized statistics, such as RAM, max Money or
|
||||
required hacking level. These statistics are randomly genererated from a range of values.
|
||||
|
||||
Identifying Servers
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
A server is identified by its hostname.
|
||||
@@ -64,3 +70,10 @@ and exp. See the :ref:`gameplay_hacking` page for more details.
|
||||
|
||||
Different servers have different levels of security, but also offer
|
||||
different rewards when being hacked.
|
||||
|
||||
Server Connections
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
The servers are in a randomly organized tree-structure. The distance from
|
||||
the home computer to each server is fixed, but the exact route to them is
|
||||
randomized when you install :ref:`gameplay_augmentations`. In general the
|
||||
further away from home computer a server is the higher it's statistics are.
|
||||
@@ -33,7 +33,7 @@ In order to create a directory, simply name a file using a full absolute Linux-s
|
||||
This will automatically create a "directory" called :code:`scripts`. This will also work
|
||||
for subdirectories::
|
||||
|
||||
/scripts/hacking/helpers/myHelperScripts.script
|
||||
/scripts/hacking/helpers/myHelperScripts.js
|
||||
|
||||
Files in the root directory do not need to begin with a forward slash::
|
||||
|
||||
@@ -72,9 +72,9 @@ Note that in order to reference a file, :ref:`netscript` functions require the
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
run("/scripts/hacking/helpers.myHelperScripts.script");
|
||||
rm("/logs/myHackingLogs.txt");
|
||||
rm("thisIsAFileInTheRootDirectory.txt");
|
||||
ns.run("/scripts/hacking/helpers.myHelperScripts.js");
|
||||
ns.rm("/logs/myHackingLogs.txt");
|
||||
ns.rm("thisIsAFileInTheRootDirectory.txt");
|
||||
|
||||
.. note:: A full file path **must** begin with a forward slash (/) if that file
|
||||
is not in the root directory.
|
||||
@@ -150,13 +150,17 @@ This can pass faction tests or give bonsues such as discounts from companies.
|
||||
buy
|
||||
^^^
|
||||
|
||||
$ buy [-l/program]
|
||||
$ buy [-l/-a/program]
|
||||
|
||||
Purchase a program through the Dark Web. Requires a TOR Router to use.
|
||||
|
||||
If this command is ran with the '-l' flag, it will display a list of all programs
|
||||
that can be purchased through the Dark Web, as well as their costs.
|
||||
|
||||
If this command is ran with the '-a' flag, it will attempt to buy all programs
|
||||
that can be purchased through the Dark Web and if the player can't afford all of them
|
||||
none will be bought.
|
||||
|
||||
Otherwise, the name of the program must be passed in as a parameter. This name
|
||||
is NOT case-sensitive::
|
||||
|
||||
@@ -205,11 +209,11 @@ Each argument must be separated by a space.
|
||||
**Remember that a running script is uniquely identified both by its name and the arguments that are used to start it**. So,
|
||||
if a script was ran with the following arguments::
|
||||
|
||||
$ run foo.script 1 2 foodnstuff
|
||||
$ run foo.js 1 2 foodnstuff
|
||||
|
||||
Then to run the 'check' command on this script you would have to pass the same arguments in::
|
||||
|
||||
$ check foo.script 1 2 foodnstuff
|
||||
$ check foo.js 1 2 foodnstuff
|
||||
|
||||
clear/cls
|
||||
^^^^^^^^^
|
||||
@@ -275,7 +279,7 @@ hack
|
||||
|
||||
Attempt to hack the current server. Requires root access in order to be run.
|
||||
|
||||
Related: Hacking Mechanics (TODO Add link here when page gets made)
|
||||
Related: Hacking Mechanics :ref:`hacking`
|
||||
|
||||
help
|
||||
^^^^
|
||||
@@ -302,29 +306,27 @@ hostname
|
||||
|
||||
Prints the hostname of the server you are currently connected to.
|
||||
|
||||
ifconfig
|
||||
^^^^^^^^
|
||||
|
||||
Prints the IP address of the server you are currently connected to.
|
||||
|
||||
kill
|
||||
^^^^
|
||||
|
||||
$ kill [script name] [args...]
|
||||
$ kill [pid]
|
||||
|
||||
Kill the script specified by the script filename and arguments OR by its PID.
|
||||
Kill the script specified by the script filename and arguments OR by its PID. If
|
||||
filename and arguments are used the kill is server-specific, so if you're connected
|
||||
to home and want to kill a script running on n00dles, you have to either use it's PID
|
||||
or :code:`connect` to n00dles first and then use the the kill command.
|
||||
|
||||
If you are killing the script using its filename and arguments, then each argument
|
||||
must be separated by a space. Remember that a running script is uniquely identified
|
||||
by both its name and the arguments that are used to start it. So, if a script
|
||||
was ran with the following arguments::
|
||||
|
||||
$ run foo.script 50e3 sigma-cosmetics
|
||||
$ run foo.js 50e3 sigma-cosmetics
|
||||
|
||||
Then to kill this script the same arguments would have to be used::
|
||||
|
||||
$ kill foo.script 50e3 sigma-cosmetics
|
||||
$ kill foo.js 50e3 sigma-cosmetics
|
||||
|
||||
If you are killing the script using its PID, then the PID argument must be numeric.
|
||||
|
||||
@@ -362,7 +364,7 @@ Examples::
|
||||
// List files/directories with the '.js' extension in the root directory
|
||||
$ ls / -l --grep .js
|
||||
|
||||
// List files/directories with the word 'purchase' in the name, in the :code:`scripts` directory
|
||||
// List files/directories with the word 'purchase' in the name, in the 'scripts' directory
|
||||
$ ls scripts -l --grep purchase
|
||||
|
||||
|
||||
@@ -384,12 +386,12 @@ a script with multiple threads using the '-t' flag. If the '-t' flag is
|
||||
specified, then an argument for the number of threads must be passed in
|
||||
afterwards. Examples::
|
||||
|
||||
$ mem foo.script
|
||||
$ mem foo.script -t 50
|
||||
$ mem foo.js
|
||||
$ mem foo.js -t 50
|
||||
|
||||
The first example above will print the amount of RAM needed to run 'foo.script'
|
||||
The first example above will print the amount of RAM needed to run 'foo.js'
|
||||
with a single thread. The second example above will print the amount of RAM needed
|
||||
to run 'foo.script' with 50 threads.
|
||||
to run 'foo.js' with 50 threads.
|
||||
|
||||
.. _mv_terminal_command:
|
||||
|
||||
@@ -452,7 +454,7 @@ Execute a program, script, or :ref:`codingcontracts`.
|
||||
|
||||
The '[-t]', '[num threads]', and '[args...]' arguments are only valid when
|
||||
running a script. The '-t' flag is used to indicate that the script should
|
||||
be run with the specified number of threads. If the flag is omitted, then
|
||||
be run with the specified integer number of threads. If the flag is omitted,
|
||||
the script will be run with a single thread by default. If the '-t' flag is
|
||||
used, then it MUST come immediately after the script name, and the
|
||||
[num threads] argument MUST come immediately afterwards.
|
||||
@@ -467,9 +469,9 @@ Run a program::
|
||||
|
||||
$ run BruteSSH.exe
|
||||
|
||||
Run *foo.script* with 50 threads and the arguments [1e3, 0.5, foodnstuff]::
|
||||
Run *foo.js* with 50 threads and the arguments [1e3, 0.5, foodnstuff]::
|
||||
|
||||
$ run foo.script -t 50 1e3 0.5 foodnstuff
|
||||
$ run foo.js -t 50 1e3 0.5 foodnstuff
|
||||
|
||||
Run a Coding Contract::
|
||||
|
||||
@@ -500,7 +502,26 @@ execute 'scan-analyze' with a depth up to 5 and 10, respectively.
|
||||
|
||||
The information 'scan-analyze' displays about each server includes whether or
|
||||
not you have root access to it, its required hacking level, the number of open
|
||||
ports required to run NUKE.exe on it, and how much RAM it has.
|
||||
ports required to run NUKE.exe on it, and how much RAM it has. When used the
|
||||
information is structured like:
|
||||
|
||||
n00dles
|
||||
--Root Access: YES, Required hacking skill: 1
|
||||
--Number of open ports required to NUKE: 0
|
||||
--RAM: 4.00GB
|
||||
|
||||
----zer0
|
||||
------Root Access: NO, Required hacking skill: 75
|
||||
------Number of open ports required to NUKE: 1
|
||||
------RAM: 32.00GB
|
||||
|
||||
foodnstuff
|
||||
--Root Access: NO, Required hacking skill: 1
|
||||
--Number of open ports required to NUKE: 0
|
||||
--RAM: 16.00GB
|
||||
|
||||
In this case :code:`n00dles` and :code:`foodnstuff` are connected to the current server
|
||||
and :code:`zer0` is connected to :code:`n00dles`.
|
||||
|
||||
.. _scp_terminal_command:
|
||||
|
||||
@@ -529,11 +550,11 @@ Each argument must be separated by a space. Remember that a running script is
|
||||
uniquely identified by both its name and the arguments that were used to run
|
||||
it. So, if a script was ran with the following arguments::
|
||||
|
||||
$ run foo.script 10 50000
|
||||
$ run foo.js 10 50000
|
||||
|
||||
Then in order to check its logs with 'tail' the same arguments must be used::
|
||||
|
||||
$ tail foo.script 10 50000
|
||||
$ tail foo.js 10 50000
|
||||
|
||||
top
|
||||
^^^
|
||||
@@ -590,26 +611,28 @@ There are two main points:
|
||||
2. Anything that can represent a number is automatically cast to a number, unless its
|
||||
surrounded by quotation marks.
|
||||
|
||||
Here's an example to show how these rules work. Consider the following script `argType.script`::
|
||||
|
||||
tprint("Number of args: " + args.length);
|
||||
for (var i = 0; i < args.length; ++i) {
|
||||
tprint(typeof args[i]);
|
||||
Here's an example to show how these rules work. Consider the following script `argType.js`::
|
||||
|
||||
export async function main(ns) {
|
||||
ns.tprint("Number of args: " + args.length);
|
||||
for (var i = 0; i < ns.args.length; ++i) {
|
||||
ns.tprint(typeof ns.args[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Then if we run the following terminal command::
|
||||
|
||||
$ run argType.script 123 1e3 "5" "this is a single argument"
|
||||
$ run argType.js 123 1e3 "5" "this is a single argument"
|
||||
|
||||
We'll see the following in the Terminal::
|
||||
|
||||
Running script with 1 thread(s) and args: [123, 1000, "5", "this is a single argument"].
|
||||
May take a few seconds to start up the process...
|
||||
argType.script: Number of args: 4
|
||||
argType.script: number
|
||||
argType.script: number
|
||||
argType.script: string
|
||||
argType.script: string
|
||||
argType.js: Number of args: 4
|
||||
argType.js: number
|
||||
argType.js: number
|
||||
argType.js: string
|
||||
argType.js: string
|
||||
|
||||
Chaining Commands
|
||||
-----------------
|
||||
@@ -618,4 +641,4 @@ with a semicolon (;).
|
||||
|
||||
Example::
|
||||
|
||||
$ run foo.script; tail foo.script
|
||||
$ run foo.js; tail foo.js
|
||||
|
||||
@@ -10,3 +10,7 @@ In Bitburner, the world consists of six different cities:
|
||||
* New Tokyo
|
||||
* Chongqing
|
||||
* Volhaven
|
||||
|
||||
Each city has it's own map and :ref:`faction`. Each city also
|
||||
offers different services, such as gyms, universities, hardware
|
||||
stores and places of work.
|
||||
@@ -3,6 +3,91 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
|
||||
v2.2.2 - 21 Feb 2022
|
||||
--------------------
|
||||
|
||||
PLANNED 2.3 BREAKING CHANGES:
|
||||
|
||||
* 2.3 will include a large planned rework to corporation. This may cause api breaks for any corporation scripts, and there will be large changes in how the corporation mechanic functions.
|
||||
|
||||
NETSCRIPT API:
|
||||
|
||||
* Added ns.formatNumber, ns.formatRam, and ns.formatPercent, which allow formatting these types of numbers the same way the game does (@Snarling, See UI section).
|
||||
* Deprecated ns.nFormat. Likely to be removed in 2.3. Now just directly wraps numeral.format (@Snarling)
|
||||
* EXPERIMENTAL CHANGE (may be reverted next patch): BasicHGWOptions now allows specifying a number of additionalMsec. This should allow easier and more reliable coordination
|
||||
of completion times for hack, grow, and weaken. Since this is an experimental change, be prepared for a possible API break next patch if you use this functionality. (@d0sboots)
|
||||
|
||||
* Corporation API:
|
||||
|
||||
* Fix bugs with ns.corporation.setAutoJobAssignment. (@zerbosh and @croy)
|
||||
|
||||
* Formulas API:
|
||||
|
||||
* Added ns.formulas.hacking.growThreads function (@d0sboots)
|
||||
|
||||
* Sleeve API:
|
||||
|
||||
* ns.sleeve.getTask now also includes cyclesWorked for the task types where this applies. (@Zelow79)
|
||||
* Added ns.sleeve.setToIdle function (@Zelow79)
|
||||
|
||||
* Unsupported API:
|
||||
|
||||
* Added ns.printRaw - allows printing custom React content to script logs. Use at your own risk, misuse is very likely to cause a crash. (@d0sboots)
|
||||
|
||||
ELECTRON (STEAM) VERSION:
|
||||
|
||||
* Fix security issue where player scripts were allowed to access any part of the player's filesystem. Now access is limited to the game's 'dist' folder. (@Snarling)
|
||||
|
||||
SCRIPTS:
|
||||
|
||||
* Fix an issue where multiple copies of the same script could be launched with same args/same server (@Mughur)
|
||||
* Followup changes to API wrapping from 2.2.1 changes. (@d0sboots)
|
||||
|
||||
UI:
|
||||
|
||||
* Add new number formatting code to replace internal use of unmaintained package numeral.js. Added several Numeric Display options. (@Snarling)
|
||||
* Removed ingame donation section. (@hydroflame)
|
||||
* Improve some bladeburner number formatting (@Zelow79)
|
||||
* Added IronMan theme (@MattiYT)
|
||||
* Factions that have not been joined yet will show how many unowned augments they have available. (@Zelow79)
|
||||
* Added more features to dev menu (@Zelow79 and @Snarling)
|
||||
|
||||
CORPORATION:
|
||||
|
||||
* Reverted previous change to employee needs. Now they will trend up on their own again. (@d0sboots)
|
||||
* Improvements to how Market TA II works (@d0sboots)
|
||||
* ns.corporation.getOffice return value now includes a totalExperience property. (@Snarling)
|
||||
|
||||
HACKNET:
|
||||
|
||||
* Hacknet servers are now named hacknet-server-# instead of hacknet-node-#. (@Tyasuh)
|
||||
* Fix bug related to renaming hacknet servers (@Mughur)
|
||||
|
||||
GRAFTING:
|
||||
|
||||
* Bladeburner augs can be grafted if player is in Bladeburner faction (@Tyasuh)
|
||||
|
||||
DOCUMENTATION
|
||||
|
||||
* Many documentation updates (@Mughur, @d0sboots, @Snarling, @teauxfu).
|
||||
* Official non-markdown docs are at http://bitburner-official.readthedocs.io/
|
||||
* Official dev version markdown docs are at https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.ns.md
|
||||
* Official stable version markdown docs are at https://github.com/bitburner-official/bitburner-src/blob/stable/markdown/bitburner.ns.md
|
||||
* Dev version documentation is now kept up to date as changes are made. (@Snarling)
|
||||
|
||||
CODEBASE:
|
||||
|
||||
* Updated many dependencies (@d0sboots)
|
||||
* Updated lots of the build processes and GitHub workflows. (@Snarling)
|
||||
* Internal refactoring of how BitNode multipliers are stored (@d0sboots)
|
||||
* Added some extra helper function (useRerender hook, positiveInteger ns argument validator). (@Snarling)
|
||||
|
||||
MISC:
|
||||
|
||||
* Nerf noodle bar
|
||||
|
||||
|
||||
v2.2.1 Hotfixes
|
||||
---------------
|
||||
|
||||
@@ -16,6 +101,7 @@ Hotfix / bugfix:
|
||||
* There was an issue with Corporations decaying their employees to 0 stats, even though the minimum was supposed to be 5. Moved the variable storing the min decay value to corporation constants, and raised it to 10.
|
||||
* Regenerated documentation at https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.ns.md due to corporation changes related to min decay stats.
|
||||
* Faction XP was unintentionally providing 20x the experience gain as it did prior to v2.0. This caused faction work to exceed gym/university as the optimal way to gain experience. Values have been reduced to only about 2x what they were prior to v2.0, and they are no longer better than gym/university.
|
||||
* Fixed an issue where the overview skill bars could be displayed inaccurately based on player multipliers.
|
||||
|
||||
|
||||
v2.2.0 - Jan 2 2023 Development Reboot
|
||||
|
||||
@@ -66,7 +66,7 @@ documentation_title = '{0} Documentation'.format(project)
|
||||
# The short X.Y version.
|
||||
version = '2.2'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '2.2.0'
|
||||
release = '2.2.2'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
@@ -8,7 +8,7 @@ If your game is frozen or stuck in any way, then the most likely culprit is an
|
||||
infinitely running loop in :ref:`netscriptjs`. To get past the freezing, run the game with
|
||||
`?noScripts` in the URL:
|
||||
|
||||
`https://danielyxie.github.io/bitburner/?noScripts <https://danielyxie.github.io/bitburner/?noScripts>`_
|
||||
`https://bitburner-official.github.io/bitburner/?noScripts <https://bitburner-official.github.io/bitburner/?noScripts>`_
|
||||
|
||||
Then, to fix your script, make sure you have a sleep or any other timed function like `hack()` or
|
||||
`grow()` in any infinite loops::
|
||||
|
||||
@@ -34,7 +34,7 @@ to do this:
|
||||
|
||||
1. You can go to the Terminal and enter::
|
||||
|
||||
$ kill n00dles.script
|
||||
$ kill n00dles.js
|
||||
|
||||
2. You can go to the :code:`Active Scripts` page (|Keyboard shortcut| Alt + s) and
|
||||
press the "Kill Script" button for :code:`n00dles.js`.
|
||||
@@ -80,6 +80,7 @@ Specifically, you'll want to take a look at :ref:`netscriptfunctions`.
|
||||
Enter the following code in the script editor:
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
/** @param {NS} ns */
|
||||
export async function main(ns) {
|
||||
// Defines the "target server", which is the server
|
||||
@@ -413,6 +414,7 @@ Create the script by going to |Terminal| and typing::
|
||||
Paste the following code into the script editor:
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
/** @param {NS} ns */
|
||||
export async function main(ns) {
|
||||
// How much RAM each purchased server will have. In this case, it'll
|
||||
@@ -433,8 +435,8 @@ Paste the following code into the script editor:
|
||||
// 3. Run our hacking script on the newly-purchased server with 3 threads
|
||||
// 4. Increment our iterator to indicate that we've bought a new server
|
||||
let hostname = ns.purchaseServer("pserv-" + i, ram);
|
||||
ns.scp("early-hack-template.script", hostname);
|
||||
ns.exec("early-hack-template.script", hostname, 3);
|
||||
ns.scp("early-hack-template.js", hostname);
|
||||
ns.exec("early-hack-template.js", hostname, 3);
|
||||
++i;
|
||||
}
|
||||
//Make the script wait for a second before looping again.
|
||||
@@ -815,6 +817,7 @@ so you should write a script to automate the process. Here's a simple example fo
|
||||
startup script. Feel free to adjust it to your liking.
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
/** @param {NS} ns */
|
||||
export async function main(ns) {
|
||||
// Array of all servers that don't need any ports opened
|
||||
@@ -838,9 +841,9 @@ startup script. Feel free to adjust it to your liking.
|
||||
for (let i = 0; i < servers0Port.length; ++i) {
|
||||
const serv = servers0Port[i];
|
||||
|
||||
ns.scp("early-hack-template.script", serv);
|
||||
ns.scp("early-hack-template.js", serv);
|
||||
ns.nuke(serv);
|
||||
ns.exec("early-hack-template.script", serv, 6);
|
||||
ns.exec("early-hack-template.js", serv, 6);
|
||||
}
|
||||
|
||||
// Wait until we acquire the "BruteSSH.exe" program
|
||||
@@ -854,12 +857,13 @@ startup script. Feel free to adjust it to your liking.
|
||||
for (let i = 0; i < servers1Port.length; ++i) {
|
||||
const serv = servers1Port[i];
|
||||
|
||||
ns.scp("early-hack-template.script", serv);
|
||||
ns.scp("early-hack-template.js", serv);
|
||||
ns.brutessh(serv);
|
||||
ns.nuke(serv);
|
||||
ns.exec("early-hack-template.script", serv, 12);
|
||||
ns.exec("early-hack-template.sj", serv, 12);
|
||||
}
|
||||
}
|
||||
|
||||
Random Tips
|
||||
-----------
|
||||
* Early on in the game, it's better to spend your money on upgrading RAM and purchasing
|
||||
|
||||
@@ -7,7 +7,7 @@ Welcome to Bitburner's documentation!
|
||||
=====================================
|
||||
Bitburner is a programming-based `incremental game <https://en.wikipedia.org/wiki/Incremental_game>`_
|
||||
that revolves around hacking and cyberpunk themes. The game is currently in the
|
||||
early beta stage of development. It `can be played here <https://danielyxie.github.io/bitburner/>`_.
|
||||
early beta stage of development. It `can be played here <https://bitburner-official.github.io/bitburner/>`_.
|
||||
|
||||
What is Bitburner?
|
||||
------------------
|
||||
@@ -33,7 +33,6 @@ secrets that you've been searching for.
|
||||
v1.0.0 script migration guide <v1.0.0_migration.rst>
|
||||
v2.0.0 script migration guide <v2.0.0_migration.rst>
|
||||
404 <404.rst>
|
||||
Donate <https://paypal.me/danielyxie>
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
@@ -14,4 +14,4 @@ brutessh() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
brutessh("foodnstuff");
|
||||
ns.brutessh("foodnstuff");
|
||||
|
||||
15
doc/source/netscript/basicfunctions/clearLog.rst
Normal file
@@ -0,0 +1,15 @@
|
||||
clearLog() Netscript Function
|
||||
===============================
|
||||
|
||||
.. js:function:: clearLog()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Clears the script’s logs.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
//Opens the logs, clears it of whatever may have been there before and prevents non-print() functions from printing to log
|
||||
ns.tail();ns.clearLog();ns.disableLog("ALL");
|
||||
19
doc/source/netscript/basicfunctions/closeTail.rst
Normal file
@@ -0,0 +1,19 @@
|
||||
closeTail() Netscript Function
|
||||
===============================
|
||||
|
||||
.. js:function:: closeTail([scriptPid])
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param number scriptPid: PID of the script of which to open the logs.
|
||||
|
||||
Closes a script’s logs.
|
||||
|
||||
If the function is called with no arguments, it will open the current script’s logs.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
ns.closeTail(12);
|
||||
ns.closeTail();
|
||||
@@ -12,3 +12,10 @@ deleteServer() Netscript Function
|
||||
The ``hostname`` argument can be any data type, but it will be converted to
|
||||
a string. Whitespace is automatically removed from the string. This function
|
||||
will not delete a server that still has scripts running on it.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
ns.killall("dummyServer");
|
||||
ns.deleteServer("dummyServer"); //returns: true if purhcased server 'dummyServer'existed
|
||||
|
||||
@@ -8,4 +8,11 @@ disableLog() Netscript Function
|
||||
:param string functionName: Name of function for which to disable logging.
|
||||
|
||||
Disables logging for the given function. Logging can be disabled for
|
||||
all functions by passing 'ALL' as the argument.
|
||||
all functions by passing 'ALL' as the argument. Print() can always print to log.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
//Opens the logs, clears it of whatever may have been there before and prevents non-print() functions from logging
|
||||
ns.tail();ns.clearLog();ns.disableLog("ALL");
|
||||
@@ -10,3 +10,12 @@ enableLog() Netscript Function
|
||||
Re-enables logging for the given function. If 'ALL' is passed into this
|
||||
function as an argument, then it will revert the effects of
|
||||
``disableLog('ALL')``
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
//Opens the logs, clears it of whatever may have been there before and prevents non-print() functions from printing to log
|
||||
ns.tail();ns.clearLog();ns.disableLog("ALL");
|
||||
//let hack() log normally
|
||||
ns.enableLog("hack");
|
||||
@@ -24,17 +24,17 @@ exec() Netscript Function
|
||||
|
||||
The simplest way to use the :doc:`exec<exec>` command is to call it with
|
||||
just the script name and the target server. The following example will try
|
||||
to run ``generic-hack.script`` on the ``foodnstuff`` server::
|
||||
to run ``generic-hack.js`` on the ``foodnstuff`` server::
|
||||
|
||||
exec("generic-hack.script", "foodnstuff");
|
||||
ns.exec("generic-hack.js", "foodnstuff");
|
||||
|
||||
The following example will try to run the script ``generic-hack.script`` on
|
||||
The following example will try to run the script ``generic-hack.js`` on
|
||||
the ``joesguns`` server with 10 threads::
|
||||
|
||||
exec("generic-hack.script", "joesguns", 10);
|
||||
ns.exec("generic-hack.js", "joesguns", 10);
|
||||
|
||||
This last example will try to run the script ``foo.script`` on the
|
||||
This last example will try to run the script ``foo.js`` on the
|
||||
``foodnstuff`` server with 5 threads. It will also pass the number 1 and the
|
||||
string "test" in as arguments to the script::
|
||||
|
||||
exec("foo.script", "foodnstuff", 5, 1, "test");
|
||||
ns.exec("foo.js", "foodnstuff", 5, 1, "test");
|
||||
|
||||
@@ -22,8 +22,8 @@ fileExists() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
fileExists("foo.script", "foodnstuff"); // returns: false
|
||||
fileExists("ftpcrack.exe"); // returns: true
|
||||
ns.fileExists("foo.js", "foodnstuff"); // returns: false
|
||||
ns.fileExists("ftpcrack.exe"); // returns: true
|
||||
|
||||
The first example above will return true if the script named ``foo.script`` exists on the ``foodnstuff`` server, and false otherwise.
|
||||
The first example above will return true if the script named ``foo.js`` exists on the ``foodnstuff`` server, and false otherwise.
|
||||
The second example above will return true if the current server contains the ``FTPCrack.exe`` program, and false otherwise.
|
||||
|
||||
@@ -14,4 +14,4 @@ ftpcrack() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
ftpcrack("foodnstuff");
|
||||
ns.ftpcrack("foodnstuff");
|
||||
|
||||
@@ -10,4 +10,4 @@ getHackingLevel() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getHackingLevel(); // returns: 124
|
||||
ns.getHackingLevel(); // returns: 124
|
||||
|
||||
@@ -3,7 +3,7 @@ getHackingMultipliers() Netscript Function
|
||||
|
||||
.. js:function:: getHackingMultipliers()
|
||||
|
||||
:RAM cost: 4 GB
|
||||
:RAM cost: 0.25 GB
|
||||
:returns: object containing the player's hacking multipliers. These
|
||||
multipliers are returned in decimal forms, not percentages (e.g. 1.5
|
||||
instead of 150%).
|
||||
@@ -21,6 +21,6 @@ getHackingMultipliers() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
mults = getHackingMultipliers();
|
||||
print(mults.chance);
|
||||
print(mults.growth);
|
||||
const mults = ns.getHackingMultipliers();
|
||||
ns.print(mults.chance);
|
||||
ns.print(mults.growth);
|
||||
|
||||
@@ -3,7 +3,7 @@ getHacknetMultipliers() Netscript Function
|
||||
|
||||
.. js:function:: getHacknetMultipliers()
|
||||
|
||||
:RAM cost: 4 GB
|
||||
:RAM cost: 0.25 GB
|
||||
:returns: object containing the player's hacknet multipliers. These
|
||||
multipliers are returned in decimal forms, not percentages (e.g. 1.5
|
||||
instead of 150%).
|
||||
@@ -22,6 +22,6 @@ getHacknetMultipliers() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
mults = getHacknetMultipliers();
|
||||
print(mults.production);
|
||||
print(mults.purchaseCost);
|
||||
const mults = ns.getHacknetMultipliers();
|
||||
ns.print(mults.production);
|
||||
ns.print(mults.purchaseCost);
|
||||
|
||||
14
doc/source/netscript/basicfunctions/getHostname.rst
Normal file
@@ -0,0 +1,14 @@
|
||||
getHostname() Netscript Function
|
||||
==============================
|
||||
|
||||
.. js:function:: getHostname()
|
||||
|
||||
:RAM cost: 0.05 GB
|
||||
|
||||
Returns a string with the hostname of the server that the script is running on.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
ns.tprint(ns.getHostname())
|
||||
@@ -5,11 +5,13 @@ getPurchasedServerCost() Netscript Function
|
||||
|
||||
:RAM cost: 0.25 GB
|
||||
|
||||
:param number ram: Amount of RAM of a potential purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20)
|
||||
:param number ram: Amount of RAM of a potential purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of :doc:`getPurchasedServerMaxRam<getPurchasedServerMaxRam>`
|
||||
:returns: Cost to purchase a server with the specified amount of ``ram``.
|
||||
|
||||
Giving any non-power-of-2 as an argument results in the function returning `Infinity`
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getPurchasedServerCost(8192); // returns: 450560000
|
||||
ns.getPurchasedServerCost(8192); // returns: 450560000
|
||||
|
||||
@@ -10,4 +10,4 @@ getPurchasedServerLimit() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getPurchasedServerLimit() // returns: 25
|
||||
ns.getPurchasedServerLimit() // returns: 25
|
||||
|
||||
@@ -10,4 +10,4 @@ getPurchasedServerMaxRam() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getPurchasedServerMaxRam(); // returns: 1048576
|
||||
ns.getPurchasedServerMaxRam(); // returns: 1048576
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
getPurchasedServerUpgradeCost() Netscript Function
|
||||
===========================================
|
||||
|
||||
.. js:function:: getPurchasedServerUpgradeCost(hostname, ram)
|
||||
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
:param string hostname: Hostname of target purchased server.
|
||||
:param number ram: Target amount of RAM for purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of :doc:`getPurchasedServerMaxRam<getPurchasedServerMaxRam>`
|
||||
:returns: Cost to purchase a server with the specified amount of ``ram``.
|
||||
|
||||
Giving any non-power-of-2 as an argument results in the function returning `-1`
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
ns.purchaseServer("smallServer",2) //costs 110000
|
||||
ns.getPurchasedServerUpgradeCost("smallServer",8); // returns: 330000
|
||||
@@ -10,4 +10,4 @@ getPurchasedServers() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getPurchasedServers(); // returns: ['grow-server-0', 'grow-server-1', 'weaken-server-0']
|
||||
ns.getPurchasedServers(); // returns: ['grow-server-0', 'grow-server-1', 'weaken-server-0']
|
||||
|
||||
@@ -13,4 +13,4 @@ getScriptRam() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getScriptRam("grow.script"); // returns: 1.75
|
||||
ns.getScriptRam("grow.js"); // returns: 1.75
|
||||
|
||||
@@ -11,4 +11,4 @@ getServerMaxMoney() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getServerMaxMoney('foodnstuff'); // returns: 50000000
|
||||
ns.getServerMaxMoney('foodnstuff'); // returns: 50000000
|
||||
|
||||
@@ -11,5 +11,5 @@ getServerMaxRam() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
maxRam = getServerMaxRam("helios"); // returns: 16
|
||||
print("helios has "+maxRam + "GB");
|
||||
const maxRam = ns.getServerMaxRam("helios"); // returns: 16
|
||||
ns.print("helios has "+maxRam + "GB");
|
||||
|
||||
@@ -11,4 +11,4 @@ getServerMinSecurityLevel() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getServerMinSecurityLevel('foodnstuff'); // returns: 3
|
||||
ns.getServerMinSecurityLevel('foodnstuff'); // returns: 3
|
||||
|
||||
@@ -15,5 +15,5 @@ getServerMoneyAvailable() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getServerMoneyAvailable("foodnstuff"); // returns: 120000
|
||||
getServerMoneyAvailable("home"); // returns: 1000
|
||||
ns.getServerMoneyAvailable("foodnstuff"); // returns: 120000
|
||||
ns.getServerMoneyAvailable("home"); // returns: 1000
|
||||
|
||||
@@ -12,4 +12,4 @@ getServerNumPortsRequired() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getServerNumPortsRequired("unitalife"); // returns: 4
|
||||
ns.getServerNumPortsRequired("unitalife"); // returns: 4
|
||||
|
||||
@@ -11,4 +11,4 @@ getServerRequiredHackingLevel() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getServerRequiredHackingLevel("foodnstuff"); // returns: 5
|
||||
ns.getServerRequiredHackingLevel("foodnstuff"); // returns: 5
|
||||
|
||||
@@ -11,4 +11,4 @@ getServerSecurityLevel() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getServerSecurityLevel("foodnstuff"); // returns: 3.45
|
||||
ns.getServerSecurityLevel("foodnstuff"); // returns: 3.45
|
||||
|
||||
@@ -11,5 +11,5 @@ getServerUsedRam() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
usedRam = getServerUsedRam("harakiri-sushi"); // returns: 5.6
|
||||
print("harakiri-sushi uses "+usedRam + "GB");
|
||||
const usedRam = ns.getServerUsedRam("harakiri-sushi"); // returns: 5.6
|
||||
ns.print("harakiri-sushi uses "+ usedRam + "GB"); // prints: "harakiri-sushi uses 5.6GB"
|
||||
|
||||
15
doc/source/netscript/basicfunctions/getSharePower.rst
Normal file
@@ -0,0 +1,15 @@
|
||||
getSharePower() Netscript Function
|
||||
==============================
|
||||
|
||||
.. js:function:: getSharePower()
|
||||
|
||||
:RAM cost: 0.2 GB
|
||||
|
||||
Calculate your share power. Based on all the active share calls.
|
||||
Returns the reputation gain rate multiplier, i.e. 1.5 means +50% rep gain rate.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
ns.tprint(ns.getSharePower())
|
||||
@@ -17,8 +17,8 @@ grow() Netscript Function
|
||||
Increase the amount of money available on a server. The time it takes to
|
||||
execute depends on your hacking level and the target server's security
|
||||
level. When :doc:`grow<grow>` completes, the money available on a target
|
||||
server will be increased by a certain, fixed percentage. This percentage is
|
||||
determined by the target server's growth rate (which varies between servers)
|
||||
server will be increased by the number of threads used and a certain, fixed percentage.
|
||||
The percentage is determined by the target server's growth rate (which varies between servers)
|
||||
and security level. Generally, higher-level servers have higher growth
|
||||
rates.
|
||||
|
||||
@@ -34,5 +34,5 @@ grow() Netscript Function
|
||||
.. code-block:: javascript
|
||||
|
||||
while(true) {
|
||||
grow("foodnstuff");
|
||||
await ns.grow("foodnstuff");
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ hack() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
hack("foodnstuff");
|
||||
hack("10.1.2.3");
|
||||
hack("foodnstuff", { threads: 5 }); // Only use 5 threads to hack
|
||||
await ns.hack("foodnstuff");
|
||||
await ns.hack("10.1.2.3");
|
||||
await ns.hack("foodnstuff", { threads: 5 }); // Only use 5 threads to hack
|
||||
|
||||
@@ -11,6 +11,12 @@ hasRootAccess() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
if (hasRootAccess("foodnstuff") == false) {
|
||||
nuke("foodnstuff");
|
||||
if (ns.hasRootAccess("foodnstuff") == false) {
|
||||
ns.nuke("foodnstuff");
|
||||
}
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
if (ns.hasRootAccess("foodnstuff")) {
|
||||
ns.exec("foo.js", 1, "foodnstuff");
|
||||
}
|
||||
|
||||
@@ -13,4 +13,4 @@ httpworm() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
httpworm("foodnstuff");
|
||||
ns.httpworm("foodnstuff");
|
||||
|
||||
@@ -11,4 +11,4 @@ isLogEnabled() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
isLogEnabled('hack'); // returns: true
|
||||
ns.isLogEnabled('hack'); // returns: true
|
||||
|
||||
@@ -2,6 +2,7 @@ isRunning() Netscript Function
|
||||
==============================
|
||||
|
||||
.. js:function:: isRunning(filename[, hostname=current hostname[, args...]])
|
||||
.. js:function:: isRunning(PID)
|
||||
|
||||
:RAM cost: 0.1 GB
|
||||
:param string filename: Filename of script to check. case-sensitive.
|
||||
@@ -16,20 +17,20 @@ isRunning() Netscript Function
|
||||
**Examples:**
|
||||
|
||||
In this first example below, the function call will return true if there is
|
||||
a script named ``foo.script`` with no arguments running on the
|
||||
a script named ``foo.js`` with no arguments running on the
|
||||
``foodnstuff`` server, and false otherwise:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
isRunning("foo.script", "foodnstuff");
|
||||
ns.isRunning("foo.js", "foodnstuff");
|
||||
|
||||
In this second example below, the function call will return true if there is
|
||||
a script named ``foo.script`` with no arguments running on the current
|
||||
a script named ``foo.js`` with no arguments running on the current
|
||||
server, and false otherwise:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
isRunning("foo.script", getHostname());
|
||||
ns.isRunning("foo.js", ns.getHostname());
|
||||
|
||||
In this next example below, the function call will return true if there is a
|
||||
script named ``foo.script`` running with the arguments 1, 5, and "test" (in
|
||||
@@ -37,7 +38,7 @@ isRunning() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
isRunning("foo.script", "joesguns", 1, 5, "test");
|
||||
ns.isRunning("foo.js", "joesguns", 1, 5, "test");
|
||||
|
||||
|
||||
.. js:function:: isRunning(scriptPid)
|
||||
@@ -51,4 +52,4 @@ isRunning() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
isRunning(39);
|
||||
ns.isRunning(39);
|
||||
|
||||
@@ -1,42 +1,43 @@
|
||||
kill() Netscript Function
|
||||
=========================
|
||||
|
||||
.. js:function:: kill(script, hostname, [args...])
|
||||
.. js:function:: kill(script, [hostname=current hostname, [args...]])
|
||||
.. js:function:: kill(PID)
|
||||
|
||||
:RAM cost: 0.5 GB
|
||||
:param string script: Filename of the script to kill.
|
||||
:param string hostname: Hostname of the server on which to kill the script.
|
||||
:param string hostname: Hostname of the server on which to kill the script.
|
||||
:param args...: Arguments to identify which script to kill.
|
||||
:returns: ``true`` is that script was killed.
|
||||
|
||||
Kills the script on the target server specified by the script's name and
|
||||
arguments. Remember that scripts are uniquely identified by both their name
|
||||
and arguments. For example, if ``foo.script`` is run with the argument 1,
|
||||
then this is not the same as ``foo.script`` run with the argument 2, even
|
||||
and arguments. For example, if ``foo.js`` is run with the argument 1,
|
||||
then this is not the same as ``foo.js`` run with the argument 2, even
|
||||
though they have the same code.
|
||||
|
||||
Examples:
|
||||
|
||||
The following example will try to kill a script named ``foo.script`` on the
|
||||
The following example will try to kill a script named ``foo.js`` on the
|
||||
``foodnstuff`` server that was ran with no arguments:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
kill("foo.script", "foodnstuff");
|
||||
ns.kill("foo.js", "foodnstuff");
|
||||
|
||||
The following will try to kill a script named ``foo.script`` on the current
|
||||
The following will try to kill a script named ``foo.js`` on the current
|
||||
server that was ran with no arguments:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
kill("foo.script", getHostname());
|
||||
ns.kill("foo.js");
|
||||
|
||||
The following will try to kill a script named ``foo.script`` on the current
|
||||
The following will try to kill a script named ``foo.js`` on the current
|
||||
server that was ran with the arguments 1 and "foodnstuff":
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
kill("foo.script", getHostname(), 1, "foodnstuff");
|
||||
ns.kill("foo.js", ns.getHostname(), 1, "foodnstuff");
|
||||
|
||||
.. js:function:: kill(scriptPid)
|
||||
|
||||
@@ -53,6 +54,6 @@ kill() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
if (kill(10)) {
|
||||
print("Killed script with PID 10!");
|
||||
if (ns.kill(10)) {
|
||||
ns.print("Killed script with PID 10!");
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
killall() Netscript Function
|
||||
============================
|
||||
|
||||
.. js:function:: killall(hostname)
|
||||
.. js:function:: killall([hostname = current hostname,[safetyguard = true]])
|
||||
|
||||
:RAM cost: 0.5 GB
|
||||
:param string hostname: Hostname of the server on which to kill all scripts.
|
||||
:param boolean safetyguard: Whether the function will safeguard the current script or not.
|
||||
:returns: ``true`` if scripts were killed on target server.
|
||||
|
||||
Kills all running scripts on the specified server.
|
||||
@@ -14,4 +15,10 @@ killall() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
killall('foodnstuff'); // returns: true
|
||||
ns.killall('foodnstuff'); // returns: true
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
ns.killall(); // returns: true, kills all scripts on the current server, except the current script
|
||||
ns.killall(); // returns: false, because all no available scripts are running anymore
|
||||
ns.killall(ns.getHostname(),false) // returns: true, but also kills the current script
|
||||
|
||||
@@ -12,4 +12,6 @@ ls() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
ls("home"); // returns: ["demo.script", "msg1.txt"]
|
||||
ns.ls("home"); // returns: ["demo.js", "msg1.txt"]
|
||||
ns.ls("home", ".txt"); // returns: ["msg1.txt"]
|
||||
ns.ls("home", ".script"); // returns: []
|
||||
|
||||
28
doc/source/netscript/basicfunctions/moveTail.rst
Normal file
@@ -0,0 +1,28 @@
|
||||
moveTail() Netscript Function
|
||||
===============================
|
||||
|
||||
.. js:function:: moveTail(x , y[, pid])
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param number x: X coordinate to move the tail window to.
|
||||
:param number y: Y coordinate to move the tail window to.
|
||||
:param number pid: PID of the script of which tail window to move. Defaults to current script.
|
||||
|
||||
Moves the tail window to the specified coordinates. The top left corner is (0,0).
|
||||
|
||||
.. note::
|
||||
|
||||
Due to inner workings, something has to be awaited between opening a tail window and moving or resizing it.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
//open tail
|
||||
ns.tail();
|
||||
await ns.sleep(0);
|
||||
|
||||
//move the tail close to top left corner and make it big
|
||||
ns.moveTail(10, 10);
|
||||
ns.resizeTail(780, 510)
|
||||
18
doc/source/netscript/basicfunctions/mv.rst
Normal file
@@ -0,0 +1,18 @@
|
||||
mv() Netscript Function
|
||||
==============================
|
||||
|
||||
.. js:function:: mv(serverName, sourceFile, targetFile)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Move the source file to target file on the given server.
|
||||
|
||||
This command only works for scripts and text files (.txt). It cannot, however, be used to convert from script to text file, or vice versa.
|
||||
|
||||
This function can also be used to rename files.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
ns.mv("home", "foo.js", "old_foo.txt")
|
||||
20
doc/source/netscript/basicfunctions/nFormat.rst
Normal file
@@ -0,0 +1,20 @@
|
||||
nFormat() Netscript Function
|
||||
==============================
|
||||
|
||||
.. js:function:: nFormat(number, format)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param number number: Number to format.
|
||||
:param string format: Formatting to use. Read http://numeraljs.com/#format for specifics.
|
||||
|
||||
onverts a number into a string with the specified formatter.
|
||||
This uses the numeral.js library, so the formatters must be compatible with that.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
ns.print(ns.nFormat(123456789.1,"0,0")) //logs "123,456,789"
|
||||
ns.print(ns.nFormat(123456789.1,"0.00a")) //logs "123.46m"
|
||||
ns.print(ns.nFormat(200000,"$0.00a")) //logs "$200.00k"
|
||||
@@ -7,11 +7,12 @@ nuke() Netscript Function
|
||||
:param string hostname: Hostname of the target server.
|
||||
|
||||
Runs the ``NUKE.exe`` program on the target server. ``NUKE.exe`` must exist
|
||||
on your home computer.
|
||||
on your home computer. Requires the targeted server to have enough ports opened,
|
||||
otherwise will throw an error.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
nuke("foodnstuff");
|
||||
ns.nuke("foodnstuff");
|
||||
|
||||
@@ -12,5 +12,7 @@ print() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
print("Hello world!"); // Prints "Hello world!" in the logs.
|
||||
print({a:5}); // Prints '{"a":5}' in the logs.
|
||||
ns.print("Hello world!"); // Prints "Hello world!" in the logs.
|
||||
ns.print({a:5}); // Prints '{"a":5}' in the logs.
|
||||
const text = "can"
|
||||
ns.print("I "+ text +" use variables :)") // Prints "I can use variables :)"
|
||||
@@ -23,9 +23,9 @@ ps() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
processes = ps("home");
|
||||
for (let i = 0; i < processes.length; ++i) {
|
||||
tprint(processes[i].filename + ' ' + processes[i].threads);
|
||||
tprint(processes[i].args);
|
||||
tprint(processes[i].pid);
|
||||
const processes = ns.ps("home");
|
||||
for (const i = 0; i < processes.length; ++i) {
|
||||
ns.tprint(processes[i].filename + ' ' + processes[i].threads);
|
||||
ns.tprint(processes[i].args);
|
||||
ns.tprint(processes[i].pid);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ purchaseServer() Netscript Function
|
||||
2. Maximum value of :doc:`getPurchasedServerMaxRam<getPurchasedServerMaxRam>`
|
||||
:returns: The hostname of the newly purchased server. Empty string on failure.
|
||||
|
||||
Purchased a server with the specified hostname and amount of RAM.
|
||||
Purchases a server with the specified hostname and amount of RAM.
|
||||
|
||||
The ``hostname`` argument can be any data type, but it will be converted to
|
||||
a string and have whitespace removed. Anything that resolves to an empty
|
||||
@@ -27,8 +27,8 @@ purchaseServer() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
ram = 64;
|
||||
hn = "pserv-";
|
||||
for (i = 0; i < 5; ++i) {
|
||||
purchaseServer(hn + i, ram);
|
||||
const ram = 64;
|
||||
const name = "pserv-";
|
||||
for (const i = 0; i < 5; ++i) {
|
||||
ns.purchaseServer(name + i, ram);
|
||||
}
|
||||
|
||||
@@ -13,4 +13,4 @@ relaysmtp() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
relaysmtp("foodnstuff");
|
||||
ns.relaysmtp("foodnstuff");
|
||||
|
||||
28
doc/source/netscript/basicfunctions/resizeTail.rst
Normal file
@@ -0,0 +1,28 @@
|
||||
resizeTail() Netscript Function
|
||||
===============================
|
||||
|
||||
.. js:function:: resizeTail(width, heigth[, pid])
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
:param number width: Width of the window.
|
||||
:param number heigth: Heigth of the window.
|
||||
:param number pid: PID of the script of which tail window to resize. Defaults to current script.
|
||||
|
||||
resizes the tail window to the specified size.
|
||||
|
||||
.. note::
|
||||
|
||||
Due to inner workings, something has to be awaited between opening a tail window and moving or resizing it.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
//open tail
|
||||
ns.tail();
|
||||
await ns.sleep(0);
|
||||
|
||||
//move the tail close to top left corner and make it big
|
||||
ns.moveTail(10, 10);
|
||||
ns.resizeTail(780, 510)
|
||||
@@ -21,23 +21,23 @@ run() Netscript Function
|
||||
less will cause a runtime error.
|
||||
|
||||
The simplest way to use the :doc:`run<run>` command is to call it with just
|
||||
the script name. The following example will run ``foo.script``
|
||||
the script name. The following example will run ``foo.js``
|
||||
single-threaded with no arguments:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
run("foo.script");
|
||||
ns.run("foo.js");
|
||||
|
||||
The following example will run 'foo.script' but with 5 threads instead of
|
||||
The following example will run 'foo.js' but with 5 threads instead of
|
||||
single-threaded:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
run("foo.script", 5);
|
||||
ns.run("foo.js", 5);
|
||||
|
||||
This next example will run ``foo.script`` single-threaded, and will pass the
|
||||
This next example will run ``foo.js`` single-threaded, and will pass the
|
||||
string ``foodnstuff`` into the script as an argument:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
run("foo.script", 1, 'foodnstuff');
|
||||
ns.run("foo.sj", 1, 'foodnstuff');
|
||||
|
||||
@@ -12,4 +12,4 @@ scan() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
scan("home"); // returns: ["foodnstuff", "sigma-cosmetics", "joesguns", "hong-fang-tea", "harakiri-sushi", "iron-gym"]
|
||||
ns.scan("home"); // returns: ["foodnstuff", "sigma-cosmetics", "joesguns", "hong-fang-tea", "harakiri-sushi", "iron-gym"]
|
||||
|
||||
@@ -23,11 +23,11 @@ scp() Netscript Function
|
||||
.. code-block:: javascript
|
||||
|
||||
//Copies "hack-template.script" from the current server to "foodnstuff"
|
||||
scp("hack-template.script", "foodnstuff"); // returns: true
|
||||
ns.scp("hack-template.script", "foodnstuff"); // returns: true
|
||||
|
||||
//Copies "foo.lit" from the helios server to the "home" computer
|
||||
scp("foo.lit", "home", "helios"); // returns: true
|
||||
ns.scp("foo.lit", "home", "helios"); // returns: true
|
||||
|
||||
//Tries to copy three files from "rothman-uni" to "home" computer
|
||||
files = ["foo1.lit", "foo2.script", "foo3.script"];
|
||||
scp(files, "home", "rothman-uni"); // returns: true
|
||||
const files = ["foo1.lit", "foo2.script", "foo3.script"];
|
||||
ns.scp(files, "home", "rothman-uni"); // returns: true
|
||||
|
||||
@@ -15,4 +15,4 @@ scriptKill() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
scriptKill("demo.script", "home"); // returns: true
|
||||
ns.scriptKill("demo.js", "home"); // returns: true
|
||||
|
||||
@@ -16,15 +16,15 @@ scriptRunning() Netscript Function
|
||||
Examples:
|
||||
|
||||
The example below will return true if there is any script named
|
||||
``foo.script`` running on the ``foodnstuff`` server, and false otherwise:
|
||||
``foo.js`` running on the ``foodnstuff`` server, and false otherwise:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
scriptRunning("foo.script", "foodnstuff");
|
||||
ns.scriptRunning("foo.js", "foodnstuff");
|
||||
|
||||
The example below will return true if there is any script named
|
||||
``foo.script`` running on the current server, and false otherwise:
|
||||
``foo.js`` running on the current server, and false otherwise:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
scriptRunning("foo.script", getHostname());
|
||||
ns.scriptRunning("foo.js", ns.getHostname());
|
||||
|
||||
@@ -11,4 +11,4 @@ serverExists() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
serverExists("foodnstuff"); // returns: true
|
||||
ns.serverExists("foodnstuff"); // returns: true
|
||||
|
||||
14
doc/source/netscript/basicfunctions/share.rst
Normal file
@@ -0,0 +1,14 @@
|
||||
share() Netscript Function
|
||||
==============================
|
||||
|
||||
.. js:function:: share()
|
||||
|
||||
:RAM cost: 2.4 GB
|
||||
|
||||
Increases your rep gain of all faction work types while share is called. Scales with thread count.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
while(true) await ns.share();
|
||||