Merge branch 'uptodate' of https://github.com/Mughur/bitburner-src into docupdate

This commit is contained in:
Mughur 2023-02-08 03:23:22 +02:00
commit e7588de19c
13 changed files with 239 additions and 167 deletions

@ -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

@ -35,51 +35,30 @@ jobs:
- name: Warn when bundle files were changed
id: warn-bundles-changed
if: steps.changed-bundle-files.outputs.any_changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "One or more files in the bundle files were changed." >> warnings.txt
echo "Creating label (if it does not exist)"
LABEL="validation: bundle files modified"
gh --repo "${{ github.repository }}" \
label create "$LABEL" --description "Modifications to this pull request are suggested" --color D93F0B || true
- 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"
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 "$LABEL" || true
else
echo "::set-output name=has_warnings::false"
touch warnings.txt
echo "Forbidden files included, generating warning"
touch comment.txt
echo "## Generated build or documentation files were included. PRs should not normally contain any generated files." >> comment.txt
echo "" >> comment.txt
echo "Review the changes and ensure that including built files was necessary." >> 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: 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

@ -1,7 +1,7 @@
name: CI Pull Request
on:
# Triggers the workflow on pull request events but only for the dev branch, checking only diffs
# Triggers the workflow on pull request events but only for the dev branch
pull_request:
branches: [dev]
@ -38,7 +38,7 @@ jobs:
- name: Install npm dependencies
run: npm ci
- name: Run linter
run: npm run lint:report-diff
run: npm run lint:report
prettier:
name: Prettier
runs-on: ubuntu-latest
@ -54,7 +54,7 @@ jobs:
- name: Install npm dependencies
run: npm ci
- name: Run prettier check
run: npm run format:report-diff
run: npm run format:report
test:
name: Test
runs-on: ubuntu-latest

@ -1,10 +1,11 @@
node_modules
package.json
dist
doc/build/
doc/build
doc/source
.build
.package
.app
editor.main.js
main.bundle.js

@ -102,14 +102,12 @@
"doc": "npx api-extractor run && npx api-documenter markdown && rm input/bitburner.api.json && rm -r input",
"format": "prettier --write .",
"format:report": "prettier -c .",
"format:report-diff": "bash -c 'if [[ $(git diff --name-only --diff-filter=ACMRTUXB origin/dev | grep -E \"(.js$|.jsx$|.ts$|.tsx$)\" | wc -c) -ne 0 ]]; then prettier -c $(git diff --name-only --diff-filter=ACMRTUXB origin/dev | grep -E \"(.js$|.jsx$|.ts$|.tsx$)\" | xargs); fi'",
"start": "http-server -p 8000",
"start:dev": "webpack serve --progress --env devServer --mode development",
"build": "bash ./tools/build.sh",
"build:dev": "webpack --mode development",
"build": "bash ./tools/build.sh production",
"build:dev": "bash ./tools/build.sh development",
"lint": "eslint --fix --ext js,jsx,ts,tsx --max-warnings 0 src",
"lint:report": "eslint --ext js,jsx,ts,tsx --max-warnings 0 src",
"lint:report-diff": "eslint --max-warnings 0 $(git diff --name-only --diff-filter=ACMRTUXB origin/dev | grep -E \"(.js$|.jsx$|.ts$|.tsx$)\" | xargs)",
"preinstall": "node ./tools/engines-check/engines-check.js",
"postinstall": "cd electron && npm install",
"test": "jest",
@ -117,11 +115,6 @@
"watch": "webpack --watch --mode production",
"watch:dev": "webpack --watch --mode development",
"electron": "bash ./tools/package-electron.sh",
"electron:packager": "electron-packager .package bitburner --platform all --arch x64,armv7l,arm64,mips64el --out .build --overwrite --icon .package/icon.png --no-prune",
"electron:packager-all": "electron-packager .package bitburner --platform all --arch x64,armv7l,arm64,mips64el --out .build --overwrite --icon .package/icon.png",
"electron:packager-win": "electron-packager .package bitburner --platform win32 --arch x64 --out .build --overwrite --icon .package/icon.png",
"electron:packager-mac": "electron-packager .package bitburner --platform darwin --arch x64 --out .build --overwrite --icon .package/icon.png",
"electron:packager-linux": "electron-packager .package bitburner --platform linux --arch x64 --out .build --overwrite --icon .package/icon.png",
"allbuild": "npm run build && npm run electron && git add --all && git commit -m \"allbuild commit $(git rev-parse --short HEAD)\" && git push -u origin dev",
"preversion": "npm install && npm run test",
"version": "sh ./tools/build-release.sh && git add --all",

@ -15,7 +15,7 @@ import { IndustryType, EmployeePositions } from "./Enums";
// This structure + import * as corpConstants allows easier type definitions for individual properties.
/** Names of all corporation game states */
export const stateNames: CorpStateName[] = ["START", "PURCHASE", "PRODUCTION", "SALE", "EXPORT"],
export const stateNames: CorpStateName[] = ["START", "PURCHASE", "PRODUCTION", "EXPORT", "SALE"],
// TODO: remove IndustryType and EmployeePositions enums and just use the typed strings.
/** Names of all corporation employee positions */
employeePositions: CorpEmployeePosition[] = Object.values(EmployeePositions),

@ -1,54 +1,52 @@
import React from "react";
import Typography from "@mui/material/Typography";
import Accordion from "@mui/material/Accordion";
import AccordionSummary from "@mui/material/AccordionSummary";
import AccordionDetails from "@mui/material/AccordionDetails";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import Button from "@mui/material/Button";
import { Adjuster } from "./Adjuster";
import { Player } from "@player";
import { CityName } from "../../Enums";
const bigNumber = 1e27;
export function Bladeburner(): React.ReactElement {
if (!Player.bladeburner) return <></>;
const bladeburner = Player.bladeburner;
if (bladeburner === null) return <></>;
function modifyBladeburnerRank(modify: number): (x: number) => void {
return function (rank: number): void {
if (!bladeburner) return;
bladeburner.changeRank(Player, rank * modify);
};
}
function resetBladeburnerRank(): void {
if (!bladeburner) return;
// Rank functions
const modifyBladeburnerRank = (modify: number) => (rank: number) => bladeburner.changeRank(Player, rank * modify);
const resetBladeburnerRank = () => {
bladeburner.rank = 0;
bladeburner.maxRank = 0;
}
};
const addTonsBladeburnerRank = () => bladeburner.changeRank(Player, bigNumber);
function addTonsBladeburnerRank(): void {
if (!bladeburner) return;
// Skill point functions
const modifyBladeburnerSP = (modify: number) => (skillPoints: number) => {
bladeburner.skillPoints += skillPoints * modify;
};
const resetBladeburnerSP = () => {
bladeburner.skillPoints = 0;
bladeburner.totalSkillPoints = 0;
};
const addTonsBladeburnerSP = () => (bladeburner.skillPoints = bigNumber);
bladeburner.changeRank(Player, bigNumber);
}
// Cycles functions
const modifyBladeburnerCycles = (modify: number) => (cycles: number) => (bladeburner.storedCycles += cycles * modify);
const resetBladeburnerCycles = () => (bladeburner.storedCycles = 0);
const addTonsBladeburnerCycles = () => (bladeburner.storedCycles += bigNumber);
function modifyBladeburnerCycles(modify: number): (x: number) => void {
return function (cycles: number): void {
if (!bladeburner) return;
bladeburner.storedCycles += cycles * modify;
};
}
function resetBladeburnerCycles(): void {
if (!bladeburner) return;
bladeburner.storedCycles = 0;
}
function addTonsBladeburnerCycles(): void {
if (!bladeburner) return;
bladeburner.storedCycles += bigNumber;
}
// Chaos functions
const wipeAllChaos = () => Object.values(CityName).forEach((city) => (bladeburner.cities[city].chaos = 0));
const wipeActiveCityChaos = () => (bladeburner.cities[bladeburner.city].chaos = 0);
const addAllChaos = (modify: number) => (chaos: number) => {
Object.values(CityName).forEach((city) => (bladeburner.cities[city].chaos += chaos * modify));
};
const addTonsAllChaos = () => {
Object.values(CityName).forEach((city) => (bladeburner.cities[city].chaos += bigNumber));
};
return (
<Accordion TransitionProps={{ unmountOnExit: true }}>
@ -75,7 +73,22 @@ export function Bladeburner(): React.ReactElement {
</tr>
<tr>
<td>
<Typography>Cycles:</Typography>
<Typography>SP:</Typography>
</td>
<td>
<Adjuster
label="skill points"
placeholder="amt"
tons={addTonsBladeburnerSP}
add={modifyBladeburnerSP(1)}
subtract={modifyBladeburnerSP(-1)}
reset={resetBladeburnerSP}
/>
</td>
</tr>
<tr>
<td>
<Typography>Cycles: </Typography>
</td>
<td>
<Adjuster
@ -88,9 +101,25 @@ export function Bladeburner(): React.ReactElement {
/>
</td>
</tr>
<tr>
<td>
<Typography title="This is for ALL cities">Chaos:</Typography>
</td>
<td>
<Adjuster
label="chaos in all cities"
placeholder="amt"
tons={addTonsAllChaos}
add={addAllChaos(1)}
subtract={addAllChaos(-1)}
reset={wipeAllChaos}
/>
</td>
</tr>
</tbody>
</table>
</AccordionDetails>
<Button onClick={wipeActiveCityChaos}>Clear Active City's Chaos</Button>
</Accordion>
);
}

@ -1,10 +1,8 @@
import React, { useEffect, useState } from "react";
import Accordion from "@mui/material/Accordion";
import AccordionSummary from "@mui/material/AccordionSummary";
import AccordionDetails from "@mui/material/AccordionDetails";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import { Money } from "../../ui/React/Money";
@ -15,59 +13,68 @@ import { Bladeburner } from "../../Bladeburner/Bladeburner";
import { GangConstants } from "../../Gang/data/Constants";
import { FactionNames } from "../../Faction/data/FactionNames";
import { checkForMessagesToSend } from "../../Message/MessageHelpers";
import { ThemeEvents } from "../../Themes/ui/Theme";
export function General(): React.ReactElement {
const [error, setError] = useState(false);
const [corporationName, setCorporationName] = useState("");
const [gangFaction, setGangFaction] = useState("");
const [gangFaction, setGangFaction] = useState("Slum Snakes");
const [devMoney, setDevMoney] = useState(0);
function addMoney(n: number) {
return function () {
Player.gainMoney(n, "other");
};
}
// Money functions
const addCustomMoney = () => !Number.isNaN(devMoney) && Player.gainMoney(devMoney, "other");
const addMoney = (n: number) => () => Player.gainMoney(n, "other");
const setMoney = (n: number) => () => (Player.money = Number(n));
function upgradeRam(): void {
Player.getHomeComputer().maxRam *= 2;
}
// Ram functions
const upgradeRam = () => (Player.getHomeComputer().maxRam *= 2);
function quickB1tFlum3(): void {
Router.toBitVerse(true, true);
}
// Node-clearing functions
const quickB1tFlum3 = () => Router.toBitVerse(true, true);
const b1tflum3 = () => Router.toBitVerse(true, false);
const quickHackW0r1dD43m0n = () => Router.toBitVerse(false, true);
const hackW0r1dD43m0n = () => Router.toBitVerse(false, false);
function b1tflum3(): void {
Router.toBitVerse(true, false);
}
function quickHackW0r1dD43m0n(): void {
Router.toBitVerse(false, true);
}
function hackW0r1dD43m0n(): void {
Router.toBitVerse(false, false);
}
function createCorporation(): void {
// Corp functions
const createCorporation = () => {
Player.startCorporation(corporationName);
}
// Rerender so the corp menu option will show up immediately on the devmenu page selection
ThemeEvents.emit();
};
const destroyCorporation = () => {
Player.corporation = null;
// Rerender so the corp menu option will be removed immediately on the devmenu page selection
ThemeEvents.emit();
};
function joinBladeburner(): void {
// Blade functions
const joinBladeburner = () => {
Player.bladeburner = new Bladeburner();
}
// Rerender so the blade menu option will show up immediately on the devmenu page selection
ThemeEvents.emit();
};
const leaveBladeburner = () => {
Player.bladeburner = null;
// Rerender so the blade menu option will be removed immediately on the devmenu page selection
ThemeEvents.emit();
};
function startGang(): void {
// Gang functions
const startGang = () => {
const isHacking = gangFaction === FactionNames.NiteSec || gangFaction === FactionNames.TheBlackHand;
Player.startGang(gangFaction, isHacking);
}
function setGangFactionDropdown(event: SelectChangeEvent<string>): void {
setGangFaction(event.target.value);
}
function checkMessages(): void {
checkForMessagesToSend();
}
// Rerender so the gang menu option will show up immediately on the devmenu page selection
ThemeEvents.emit();
};
const stopGang = () => {
Player.gang = null;
// Rerender so the gang menu option will be removed immediately on the devmenu page selection
ThemeEvents.emit();
};
const setGangFactionDropdown = (event: SelectChangeEvent<string>) => setGangFaction(event.target.value);
// Misc functions
const checkMessages = () => checkForMessagesToSend();
useEffect(() => {
if (error) throw new ReferenceError("Manually thrown error");
}, [error]);
@ -78,6 +85,14 @@ export function General(): React.ReactElement {
<Typography>General</Typography>
</AccordionSummary>
<AccordionDetails>
<Button
onClick={setMoney(0)}
title="This sets your money to $0, this means the money you had will just vanish without being accounted for where it went and may offset some metrics."
>
<pre>
= <Money money={0} />
</pre>
</Button>
<Button onClick={addMoney(1e6)}>
<pre>
+ <Money money={1e6} />
@ -105,23 +120,42 @@ export function General(): React.ReactElement {
</Button>
<Button onClick={upgradeRam}>+ RAM</Button>
<br />
<Typography>Corporation Name:</Typography>
<TextField value={corporationName} onChange={(x) => setCorporationName(x.target.value)} />
<Button onClick={createCorporation}>Create Corporation</Button>
<Typography>Add Custom Money</Typography>
<TextField onChange={(x) => setDevMoney(parseFloat(x.target.value))} />
<Button onClick={addCustomMoney}>Give Money</Button>
<br />
<Typography>Gang Faction:</Typography>
<Select value={gangFaction} onChange={setGangFactionDropdown}>
{GangConstants.Names.map((factionName) => (
<MenuItem key={factionName} value={factionName}>
{factionName}
</MenuItem>
))}
</Select>
<Button onClick={startGang}>Start Gang</Button>
{Player.corporation ? (
<Button onClick={destroyCorporation}>Destroy Corporation</Button>
) : (
<>
<Typography>Corporation Name:</Typography>
<TextField value={corporationName} onChange={(x) => setCorporationName(x.target.value)} />
<Button onClick={createCorporation}>Create Corporation</Button>
</>
)}
<br />
<Button onClick={joinBladeburner}>Join BladeBurner</Button>
{Player.gang ? (
<Button onClick={stopGang}>Stop Gang</Button>
) : (
<>
<Typography>Gang Faction:</Typography>
<Select value={gangFaction} onChange={setGangFactionDropdown}>
{GangConstants.Names.map((factionName) => (
<MenuItem key={factionName} value={factionName}>
{factionName}
</MenuItem>
))}
</Select>
<Button onClick={startGang}>Start Gang</Button>
</>
)}
<br />
{Player.bladeburner ? (
<Button onClick={leaveBladeburner}>Leave BladeBurner</Button>
) : (
<Button onClick={joinBladeburner}>Join BladeBurner</Button>
)}
<br />
<Button onClick={quickB1tFlum3}>Quick b1t_flum3.exe</Button>
<Button onClick={b1tflum3}>Run b1t_flum3.exe</Button>
<Button onClick={quickHackW0r1dD43m0n}>Quick w0rld_d34m0n</Button>

@ -7604,7 +7604,7 @@ interface CorporationInfo {
dividendTax: number;
/** Your earnings as a shareholder per second this cycle */
dividendEarnings: number;
/** State of the corporation. Possible states are START, PURCHASE, PRODUCTION, SALE, EXPORT. */
/** State of the corporation. Possible states are START, PURCHASE, PRODUCTION, EXPORT, SALE. */
state: string;
/** Array of all division names */
divisions: string[];
@ -7662,7 +7662,7 @@ interface CorpConstants {
minEmployeeDecay: number;
}
/** @public */
type CorpStateName = "START" | "PURCHASE" | "PRODUCTION" | "SALE" | "EXPORT";
type CorpStateName = "START" | "PURCHASE" | "PRODUCTION" | "EXPORT" | "SALE";
/** @public */
type CorpMaterialName =

@ -12,3 +12,4 @@ export { Theme as DiscordLike } from "./discord-like";
export { Theme as OneDark } from "./one-dark";
export { Theme as MutedGoldBlue } from "./muted-gold-blue";
export { Theme as Light } from "./light";
export { Theme as IronMan } from "./iron-man";

@ -0,0 +1,45 @@
import { IPredefinedTheme } from "../../Themes";
import img1 from "./screenshot.png";
export const Theme: IPredefinedTheme = {
name: "Iron Man",
credit: "Matti#2942",
description: "Mark 42. Threw a little hot rod red in there.",
reference: "https://discord.com/channels/415207508303544321/921991895230611466/1069233364927787089",
screenshot: img1,
colors: {
primarylight: "#FFFEFC",
primary: "#FFA95E",
primarydark: "#E8BC71",
successlight: "#00FF00",
success: "#0c0",
successdark: "#090",
errorlight: "#FF0B0B",
error: "#FF0000",
errordark: "#770000",
secondarylight: "#FFC596",
secondary: "#DA3F3F",
secondarydark: "#6E1D1D",
warninglight: "#ff0",
warning: "#cc0",
warningdark: "#990",
infolight: "#FFFFFF",
info: "#B6E9FF",
infodark: "#5596CF",
welllight: "#8A2121",
well: "#350000",
white: "#fff",
black: "#000",
hp: "#FF4E4E",
money: "#C2F26F",
hack: "#D5FFB2",
combat: "#E39C5A",
cha: "#CA4444",
int: "#6495ed",
rep: "#E39C5A",
disabled: "#3C0C0C",
backgroundprimary: "#2C0707",
backgroundsecondary: "#551212",
button: "#8A2121",
},
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

@ -1,7 +1,7 @@
#!/bin/bash
# builds the game in the root folder
webpack --mode production
webpack --mode $1
# Clear out any files remaining from old builds and recreate folder
rm -rf .app