From bfa19eb7bacbaaf8557164fa26f884fcb810d68c Mon Sep 17 00:00:00 2001 From: Chris380 Date: Thu, 14 Apr 2022 16:23:45 +0200 Subject: [PATCH 01/17] Make .lit and .msg files clickable --- src/Terminal/commands/ls.tsx | 115 ++++++++++++++++++++++++++++------- 1 file changed, 94 insertions(+), 21 deletions(-) diff --git a/src/Terminal/commands/ls.tsx b/src/Terminal/commands/ls.tsx index f784f217f..1fddc05e8 100644 --- a/src/Terminal/commands/ls.tsx +++ b/src/Terminal/commands/ls.tsx @@ -9,6 +9,8 @@ import { evaluateDirectoryPath, getFirstParentDirectory, isValidDirectoryPath } import { IRouter } from "../../ui/Router"; import { ITerminal } from "../ITerminal"; import * as libarg from "arg"; +import { showLiterature } from "../../Literature/LiteratureHelpers"; +import { MessageFilenames, showMessage } from "../../Message/MessageHelpers"; export function ls( terminal: ITerminal, @@ -121,13 +123,13 @@ export function ls( allMessages.sort(); folders.sort(); - interface ClickableScriptRowProps { + interface ClickableRowProps { row: string; prefix: string; hostname: string; } - function ClickableScriptRow({ row, prefix, hostname }: ClickableScriptRowProps): React.ReactElement { + function ClickableScriptRow({ row, prefix, hostname }: ClickableRowProps): React.ReactElement { const classes = makeStyles((theme: Theme) => createStyles({ scriptLinksWrap: { @@ -160,18 +162,82 @@ export function ls( return ( {rowSplitArray.map((rowItem) => ( - - onScriptLinkClick(rowItem[0])}> + + onScriptLinkClick(rowItem[0])}> {rowItem[0]} - {rowItem[1]} + {rowItem[1]} ))} ); } - function postSegments(segments: string[], flags: any, style?: any, linked?: boolean): void { + function ClickableMessageRow({ row, prefix, hostname }: ClickableRowProps): React.ReactElement { + const classes = makeStyles((theme: Theme) => + createStyles({ + linksWrap: { + display: "inline-flex", + color: theme.palette.primary.main, + }, + link: { + cursor: "pointer", + textDecorationLine: "underline", + paddingRight: "1.15em", + "&:last-child": { padding: 0 }, + }, + }), + )(); + + const rowSplit = row.split("~"); + let rowSplitArray = rowSplit.map((x) => [x.trim(), x.replace(x.trim(), "")]); + rowSplitArray = rowSplitArray.filter((x) => !!x[0]); + + function onMessageLinkClick(filename: string): void { + if (player.getCurrentServer().hostname !== hostname) { + return terminal.error(`File is not on this server, connect to ${hostname} and try again`); + } + if (filename.startsWith("/")) filename = filename.slice(1); + const filepath = terminal.getFilepath(`${prefix}${filename}`); + + if (filepath.endsWith(".lit")) { + showLiterature(filepath); + } else if (filepath.endsWith(".msg")) { + showMessage(filepath as MessageFilenames); + } + } + + return ( + + {rowSplitArray.map((rowItem) => ( + + onMessageLinkClick(rowItem[0])}> + {rowItem[0]} + + {rowItem[1]} + + ))} + + ); + } + + enum FileType { + Folder, + Message, + TextFile, + Program, + Contract, + Script, + } + + interface FileGroup { + type: FileType; + segments: string[]; + } + + function postSegments(group: FileGroup, flags: any): void { + const segments = group.segments; + const linked = group.type === FileType.Script || group.type === FileType.Message; const maxLength = Math.max(...segments.map((s) => s.length)) + 1; const filesPerRow = flags["-l"] === true ? 1 : Math.ceil(80 / maxLength); for (let i = 0; i < segments.length; i++) { @@ -186,25 +252,32 @@ export function ls( i++; } i--; - if (!style) { - terminal.print(row); - } else if (linked) { - terminal.printRaw(); - } else { - terminal.printRaw({row}); + + switch (group.type) { + case FileType.Folder: + terminal.printRaw({row}); + break; + case FileType.Script: + terminal.printRaw(); + break; + case FileType.Message: + terminal.printRaw(); + break; + default: + terminal.print(row); } } } - const groups = [ - { segments: folders, style: { color: "cyan" } }, - { segments: allMessages }, - { segments: allTextFiles }, - { segments: allPrograms }, - { segments: allContracts }, - { segments: allScripts, style: { color: "yellow", fontStyle: "bold" }, linked: true }, + const groups: FileGroup[] = [ + { type: FileType.Folder, segments: folders }, + { type: FileType.Message, segments: allMessages }, + { type: FileType.TextFile, segments: allTextFiles }, + { type: FileType.Program, segments: allPrograms }, + { type: FileType.Contract, segments: allContracts }, + { type: FileType.Script, segments: allScripts }, ].filter((g) => g.segments.length > 0); - for (let i = 0; i < groups.length; i++) { - postSegments(groups[i].segments, flags, groups[i].style, groups[i].linked); + for (const group of groups) { + postSegments(group, flags); } } From a0cab9a16317c31e9bbb67b3748f0279663bfe7b Mon Sep 17 00:00:00 2001 From: TheMas3212 Date: Fri, 15 Apr 2022 00:35:51 +1000 Subject: [PATCH 02/17] Fix inconsistancy with trying to work for gang factions while running a gang --- src/NetscriptFunctions/Singularity.ts | 43 +++++++++++++++------------ 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index 0124e1e90..c4a89022a 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -23,7 +23,6 @@ import { findCrime } from "../Crime/CrimeHelpers"; import { CompanyPosition } from "../Company/CompanyPosition"; import { CompanyPositions } from "../Company/CompanyPositions"; import { DarkWebItems } from "../DarkWeb/DarkWebItems"; -import { AllGangs } from "../Gang/AllGangs"; import { CityName } from "../Locations/data/CityNames"; import { LocationName } from "../Locations/data/LocationNames"; import { Router } from "../ui/GameRoot"; @@ -1047,11 +1046,14 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript const facName = _ctx.helper.string("facName", _facName); const type = _ctx.helper.string("type", _type); const focus = _ctx.helper.boolean(_focus); - getFaction(_ctx, facName); + const faction = getFaction(_ctx, facName); // if the player is in a gang and the target faction is any of the gang faction, fail - if (player.inGang() && AllGangs[facName] !== undefined) { - workerScript.log("workForFaction", () => `Faction '${facName}' does not offer work at the moment.`); + if (player.inGang() && faction.name === player.getGangFaction().name) { + workerScript.log( + "workForFaction", + () => `You can't work for '${facName}' because youre managing a gang for it`, + ); return false; } @@ -1066,21 +1068,18 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript workerScript.log("workForFaction", () => txt); } - const fac = Factions[facName]; - // Arrays listing factions that allow each time of work - switch (type.toLowerCase()) { case "hacking": case "hacking contracts": case "hackingcontracts": - if (!FactionInfos[fac.name].offerHackingWork) { + if (!FactionInfos[faction.name].offerHackingWork) { workerScript.log( "workForFaction", - () => `Faction '${fac.name}' do not need help with hacking contracts.`, + () => `Faction '${faction.name}' do not need help with hacking contracts.`, ); return false; } - player.startFactionHackWork(fac); + player.startFactionHackWork(faction); if (focus) { player.startFocusing(); Router.toWork(); @@ -1088,16 +1087,19 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript player.stopFocusing(); Router.toTerminal(); } - workerScript.log("workForFaction", () => `Started carrying out hacking contracts for '${fac.name}'`); + workerScript.log("workForFaction", () => `Started carrying out hacking contracts for '${faction.name}'`); return true; case "field": case "fieldwork": case "field work": - if (!FactionInfos[fac.name].offerFieldWork) { - workerScript.log("workForFaction", () => `Faction '${fac.name}' do not need help with field missions.`); + if (!FactionInfos[faction.name].offerFieldWork) { + workerScript.log( + "workForFaction", + () => `Faction '${faction.name}' do not need help with field missions.`, + ); return false; } - player.startFactionFieldWork(fac); + player.startFactionFieldWork(faction); if (focus) { player.startFocusing(); Router.toWork(); @@ -1105,16 +1107,19 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript player.stopFocusing(); Router.toTerminal(); } - workerScript.log("workForFaction", () => `Started carrying out field missions for '${fac.name}'`); + workerScript.log("workForFaction", () => `Started carrying out field missions for '${faction.name}'`); return true; case "security": case "securitywork": case "security work": - if (!FactionInfos[fac.name].offerSecurityWork) { - workerScript.log("workForFaction", () => `Faction '${fac.name}' do not need help with security work.`); + if (!FactionInfos[faction.name].offerSecurityWork) { + workerScript.log( + "workForFaction", + () => `Faction '${faction.name}' do not need help with security work.`, + ); return false; } - player.startFactionSecurityWork(fac); + player.startFactionSecurityWork(faction); if (focus) { player.startFocusing(); Router.toWork(); @@ -1122,7 +1127,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript player.stopFocusing(); Router.toTerminal(); } - workerScript.log("workForFaction", () => `Started carrying out security work for '${fac.name}'`); + workerScript.log("workForFaction", () => `Started carrying out security work for '${faction.name}'`); return true; default: workerScript.log("workForFaction", () => `Invalid work type: '${type}`); From 68ddf1d588950048878216ad027783dc0ef90770 Mon Sep 17 00:00:00 2001 From: TheMas3212 Date: Fri, 15 Apr 2022 01:12:05 +1000 Subject: [PATCH 03/17] Fix test/jest/Netscript/DynamicRamCalculation.test.js --- test/jest/Netscript/DynamicRamCalculation.test.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/jest/Netscript/DynamicRamCalculation.test.js b/test/jest/Netscript/DynamicRamCalculation.test.js index 4170f9ebd..b08e09ba8 100644 --- a/test/jest/Netscript/DynamicRamCalculation.test.js +++ b/test/jest/Netscript/DynamicRamCalculation.test.js @@ -6,7 +6,6 @@ import { getRamCost, RamCostConstants } from "../../../src/Netscript/RamCostGene import { Environment } from "../../../src/Netscript/Environment"; import { RunningScript } from "../../../src/Script/RunningScript"; import { Script } from "../../../src/Script/Script"; -import { SourceFileFlags } from "../../../src/SourceFile/SourceFileFlags"; jest.mock(`!!raw-loader!../NetscriptDefinitions.d.ts`, () => "", { virtual: true, @@ -169,12 +168,6 @@ describe("Netscript Dynamic RAM Calculation/Generation Tests", function () { testEquality(workerScript.dynamicRamUsage, runningScript.ramUsage); } - beforeEach(function () { - for (let i = 0; i < SourceFileFlags.length; ++i) { - SourceFileFlags[i] = 3; - } - }); - describe("Basic Functions", function () { it("hack()", async function () { const f = ["hack"]; From 89baba2e240d49800d7eba56d1f6bf1baf89f401 Mon Sep 17 00:00:00 2001 From: TheMas3212 Date: Fri, 15 Apr 2022 01:32:18 +1000 Subject: [PATCH 04/17] fix #3395 donating to special factions possible via singularity --- src/NetscriptFunctions/Singularity.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index 0124e1e90..bfdb646a3 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -49,6 +49,7 @@ import { FactionInfos } from "../Faction/FactionInfo"; import { InternalAPI, NetscriptContext } from "src/Netscript/APIWrapper"; import { BlackOperationNames } from "../Bladeburner/data/BlackOperationNames"; import { enterBitNode } from "../RedPill"; +import { FactionNames } from "../Faction/data/FactionNames"; export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript): InternalAPI { const getAugmentation = function (_ctx: NetscriptContext, name: string): Augmentation { @@ -1168,6 +1169,13 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript ); return false; } + if (faction.name === FactionNames.ChurchOfTheMachineGod || faction.name === FactionNames.Bladeburners) { + workerScript.log( + "donateToFaction", + () => `You can't donate to '${facName}' because they do not accept donations`, + ); + return false; + } if (typeof amt !== "number" || amt <= 0 || isNaN(amt)) { workerScript.log("donateToFaction", () => `Invalid donation amount: '${amt}'.`); return false; From e07b92a408cb65363aed2d7c35eec5938b09da2f Mon Sep 17 00:00:00 2001 From: TheMas3212 Date: Fri, 15 Apr 2022 02:00:34 +1000 Subject: [PATCH 05/17] fix 2993 sleeve.travel with invalid city names --- src/NetscriptFunctions/Sleeve.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/NetscriptFunctions/Sleeve.ts b/src/NetscriptFunctions/Sleeve.ts index 6b7751001..214f9e55c 100644 --- a/src/NetscriptFunctions/Sleeve.ts +++ b/src/NetscriptFunctions/Sleeve.ts @@ -99,7 +99,17 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel const cityName = helper.string("travel", "cityName", _cityName); checkSleeveAPIAccess("travel"); checkSleeveNumber("travel", sleeveNumber); - return player.sleeves[sleeveNumber].travel(player, cityName as CityName); + switch (cityName) { + case CityName.Aevum: + case CityName.Chongqing: + case CityName.Sector12: + case CityName.NewTokyo: + case CityName.Ishima: + case CityName.Volhaven: + return player.sleeves[sleeveNumber].travel(player, cityName as CityName); + default: + throw helper.makeRuntimeErrorMsg("sleeve.setToCompanyWork", `Invalid city name: '${cityName}'.`); + } }, setToCompanyWork: function (_sleeveNumber: unknown, acompanyName: unknown): boolean { updateRam("setToCompanyWork"); From de3359dfade26f1f9e6805927497b6277c263ef5 Mon Sep 17 00:00:00 2001 From: TheMas3212 Date: Fri, 15 Apr 2022 02:07:47 +1000 Subject: [PATCH 06/17] switch to checkEnum --- src/NetscriptFunctions/Sleeve.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/NetscriptFunctions/Sleeve.ts b/src/NetscriptFunctions/Sleeve.ts index 214f9e55c..42ca7bac0 100644 --- a/src/NetscriptFunctions/Sleeve.ts +++ b/src/NetscriptFunctions/Sleeve.ts @@ -16,6 +16,7 @@ import { SleeveSkills, SleeveTask, } from "../ScriptEditor/NetscriptDefinitions"; +import { checkEnum } from "../utils/helpers/checkEnum"; export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): ISleeve { const checkSleeveAPIAccess = function (func: string): void { @@ -99,16 +100,10 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel const cityName = helper.string("travel", "cityName", _cityName); checkSleeveAPIAccess("travel"); checkSleeveNumber("travel", sleeveNumber); - switch (cityName) { - case CityName.Aevum: - case CityName.Chongqing: - case CityName.Sector12: - case CityName.NewTokyo: - case CityName.Ishima: - case CityName.Volhaven: - return player.sleeves[sleeveNumber].travel(player, cityName as CityName); - default: - throw helper.makeRuntimeErrorMsg("sleeve.setToCompanyWork", `Invalid city name: '${cityName}'.`); + if (checkEnum(CityName, cityName)) { + return player.sleeves[sleeveNumber].travel(player, cityName as CityName); + } else { + throw helper.makeRuntimeErrorMsg("sleeve.setToCompanyWork", `Invalid city name: '${cityName}'.`); } }, setToCompanyWork: function (_sleeveNumber: unknown, acompanyName: unknown): boolean { From 69c5e42e30dd36c2dc4508a3427321fd2c8e97e4 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Thu, 14 Apr 2022 12:13:01 -0400 Subject: [PATCH 07/17] remove redundant naming scheme --- src/NetscriptFunctions/Sleeve.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NetscriptFunctions/Sleeve.ts b/src/NetscriptFunctions/Sleeve.ts index 42ca7bac0..ed58bbfdc 100644 --- a/src/NetscriptFunctions/Sleeve.ts +++ b/src/NetscriptFunctions/Sleeve.ts @@ -101,7 +101,7 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel checkSleeveAPIAccess("travel"); checkSleeveNumber("travel", sleeveNumber); if (checkEnum(CityName, cityName)) { - return player.sleeves[sleeveNumber].travel(player, cityName as CityName); + return player.sleeves[sleeveNumber].travel(player, cityName); } else { throw helper.makeRuntimeErrorMsg("sleeve.setToCompanyWork", `Invalid city name: '${cityName}'.`); } From 749b93608b9697fa0edc181a1f8ecfec6eb250b7 Mon Sep 17 00:00:00 2001 From: Undeemiss Date: Thu, 14 Apr 2022 11:13:50 -0500 Subject: [PATCH 08/17] Fixed Stanek fragment collision detection Relaxed some overzealous short-circuiting to ensure fragments on the Stanek's Gift board properly check for collisions. --- src/CotMG/ActiveFragment.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CotMG/ActiveFragment.ts b/src/CotMG/ActiveFragment.ts index ac46d40e3..0a7d7e44b 100644 --- a/src/CotMG/ActiveFragment.ts +++ b/src/CotMG/ActiveFragment.ts @@ -40,8 +40,9 @@ export class ActiveFragment { // These 2 variables converts 'this' local coordinates to world to other local. const dx: number = other.x - this.x; const dy: number = other.y - this.y; - for (let j = 0; j < thisFragment.shape.length; j++) { - for (let i = 0; i < thisFragment.shape[j].length; i++) { + const fragSize = Math.max(thisFragment.shape.length, thisFragment.shape[0].length); + for (let j = 0; j < fragSize; j++) { + for (let i = 0; i < fragSize; i++) { if (thisFragment.fullAt(i, j, this.rotation) && otherFragment.fullAt(i - dx, j - dy, other.rotation)) return true; } From f2d8d11d32bfb8005067c4f3cb8e1fec40519cd7 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Thu, 14 Apr 2022 12:16:03 -0400 Subject: [PATCH 09/17] tempalte --- .github/PULL_REQUEST_TEMPLATE | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE b/.github/PULL_REQUEST_TEMPLATE index 96f22093b..bf3cf78d5 100644 --- a/.github/PULL_REQUEST_TEMPLATE +++ b/.github/PULL_REQUEST_TEMPLATE @@ -1,5 +1,14 @@ # DELETE THIS AFTER READING +# PR title + +Formatted as such: +SECTION: FIX #xzyw PLAYER DESCRIPTION + +SECTION is something like "API", "UI", "MISC", "STANEK", "CORPORATION" +FIX #xyzw is the issue number, if any +PLAYER DESCRIPTION is what you'd tell a non-contributor to convey what is changed. + # Documentation - DO NOT CHANGE any markdown/\*.md, these files are autogenerated from NetscriptDefinitions.d.ts and will be overwritten @@ -10,5 +19,4 @@ - Include how it was tested - Include screenshot / gif (if possible) - Make sure you run `npm run format` and `npm run lint` before pushing. From accb9f7e23a02375859583d88854e75d862bcdaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB=20Hoekstra?= Date: Thu, 14 Apr 2022 20:01:31 +0200 Subject: [PATCH 10/17] Add repFromDonation formula to the API --- src/NetscriptFunctions/Formulas.ts | 6 ++++++ src/ScriptEditor/NetscriptDefinitions.d.ts | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/NetscriptFunctions/Formulas.ts b/src/NetscriptFunctions/Formulas.ts index e0d70a200..fb6c4cd56 100644 --- a/src/NetscriptFunctions/Formulas.ts +++ b/src/NetscriptFunctions/Formulas.ts @@ -38,6 +38,7 @@ import { calculateAscensionPointsGain, } from "../Gang/formulas/formulas"; import { favorToRep as calculateFavorToRep, repToFavor as calculateRepToFavor } from "../Faction/formulas/favor"; +import { repFromDonation } from "../Faction/formulas/donation"; export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): IFormulas { const checkFormulasAccess = function (func: string): void { @@ -57,6 +58,11 @@ export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, h checkFormulasAccess("reputation.calculateRepToFavor"); return calculateRepToFavor(rep); }, + repFromDonation: function (_amount: unknown, player: any): number { + const amount = helper.number("repFromDonation", "amount", _amount); + checkFormulasAccess("reputation.repFromDonation"); + return repFromDonation(amount, player); + }, }, skills: { calculateSkill: function (_exp: unknown, _mult: unknown = 1): number { diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 569bb8478..2c770fb40 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -3837,6 +3837,13 @@ interface ReputationFormulas { * @returns The calculated faction favor. */ calculateRepToFavor(rep: number): number; + + /** + * Calculate how much rep would be gained. + * @param amount - Amount of money donated + * @param player - Player info from {@link NS.getPlayer | getPlayer} + */ + repFromDonation(amount: number, player: Player): number; } /** From 48d7385ac3978c164767043cfde1e5f82222c732 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Thu, 14 Apr 2022 15:01:43 -0400 Subject: [PATCH 11/17] widget --- README.md | 1 + package.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0401f18f6..d946387b5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Bitburner + [![Build Status](https://github.com/danielyxie/bitburner/actions/workflows/ci.yml/badge.svg?branch=dev)](https://github.com/danielyxie/bitburner/actions/workflows/ci.yml) Bitburner is a programming-based [incremental game](https://en.wikipedia.org/wiki/Incremental_game) diff --git a/package.json b/package.json index 60be198f8..a5778a54b 100644 --- a/package.json +++ b/package.json @@ -134,6 +134,7 @@ "allbuild": "npm run build && npm run electron && git add --all && git commit -m \"allbuild commit $(git rev-parse --short HEAD)\" && git push -f -u origin dev", "preversion": "npm install && npm run test", "version": "sh ./tools/build-release.sh && git add --all", - "postversion": "git push -u origin dev && git push --tags" + "postversion": "git push -u origin dev && git push --tags", + "changelog": "node tools/fetch-changelog/index.js --from=$(cat last_changelog_hash) > changelog.md" } } From afbfb46775cbaeb4251445d1fae3829335a75d2c Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Thu, 14 Apr 2022 15:02:13 -0400 Subject: [PATCH 12/17] rm widget --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d946387b5..0401f18f6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # Bitburner - [![Build Status](https://github.com/danielyxie/bitburner/actions/workflows/ci.yml/badge.svg?branch=dev)](https://github.com/danielyxie/bitburner/actions/workflows/ci.yml) Bitburner is a programming-based [incremental game](https://en.wikipedia.org/wiki/Incremental_game) From 4b2230cdc5c8a98dc8b8c00c27d7eb55b06ef365 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Apr 2022 19:02:46 +0000 Subject: [PATCH 13/17] Bump async from 2.6.3 to 2.6.4 Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4. - [Release notes](https://github.com/caolan/async/releases) - [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md) - [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4) --- updated-dependencies: - dependency-name: async dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index a7fa8f271..77b1d9de3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5046,9 +5046,9 @@ } }, "node_modules/async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, "dependencies": { "lodash": "^4.17.14" @@ -10199,9 +10199,9 @@ } }, "node_modules/getos/node_modules/async": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.1.tgz", - "integrity": "sha512-XdD5lRO/87udXCMC9meWdYiR+Nq6ZjUfXidViUZGu2F1MO4T3XwZ1et0hb2++BgLfhyJwy44BGB/yx80ABx8hg==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", "dev": true }, "node_modules/getpass": { @@ -26245,9 +26245,9 @@ "dev": true }, "async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, "requires": { "lodash": "^4.17.14" @@ -30405,9 +30405,9 @@ }, "dependencies": { "async": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.1.tgz", - "integrity": "sha512-XdD5lRO/87udXCMC9meWdYiR+Nq6ZjUfXidViUZGu2F1MO4T3XwZ1et0hb2++BgLfhyJwy44BGB/yx80ABx8hg==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", "dev": true } } From 52e27e317e7fb53c7842414481275f6a749f52fc Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Thu, 14 Apr 2022 15:17:46 -0400 Subject: [PATCH 14/17] Added blood donation bonus --- README.md | 2 + src/Augmentation/AugmentationCreator.tsx | 57 ++++++++++--------- src/Constants.ts | 3 + src/PersonObjects/Player/PlayerObject.ts | 3 +- .../Player/PlayerObjectGeneralMethods.tsx | 2 +- 5 files changed, 38 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 0401f18f6..8a9ee34c0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Bitburner +[![Join Discord](https://img.shields.io/discord/415207508303544321)](https://discord.gg/TFc3hKD) + [![Build Status](https://github.com/danielyxie/bitburner/actions/workflows/ci.yml/badge.svg?branch=dev)](https://github.com/danielyxie/bitburner/actions/workflows/ci.yml) Bitburner is a programming-based [incremental game](https://en.wikipedia.org/wiki/Incremental_game) diff --git a/src/Augmentation/AugmentationCreator.tsx b/src/Augmentation/AugmentationCreator.tsx index 9ca692801..7a3ab23d8 100644 --- a/src/Augmentation/AugmentationCreator.tsx +++ b/src/Augmentation/AugmentationCreator.tsx @@ -5,6 +5,7 @@ import { Programs } from "../Programs/Programs"; import { WHRNG } from "../Casino/RNG"; import React from "react"; import { FactionNames } from "../Faction/data/FactionNames"; +import { CONSTANTS } from "../Constants"; function getRandomBonus(): any { const bonuses = [ @@ -1892,6 +1893,8 @@ export const initChurchOfTheMachineGodAugmentations = (): Augmentation[] => [ ]; export function initNeuroFluxGovernor(): Augmentation { + const donationBonus = CONSTANTS.Donations / 1e6 / 100; // 1 millionth of a percent per donation + console.log(donationBonus * 100); return new Augmentation({ name: AugmentationNames.NeuroFluxGovernor, repCost: 500, @@ -1904,35 +1907,35 @@ export function initNeuroFluxGovernor(): Augmentation { stats: ( <> This special augmentation can be leveled up infinitely. Each level of this augmentation increases MOST - multipliers by 1%, stacking multiplicatively. + multipliers by 1% (+{donationBonus * 100}% boosted by real life blood donations), stacking multiplicatively. ), - hacking_chance_mult: 1.01, - hacking_speed_mult: 1.01, - hacking_money_mult: 1.01, - hacking_grow_mult: 1.01, - hacking_mult: 1.01, - strength_mult: 1.01, - defense_mult: 1.01, - dexterity_mult: 1.01, - agility_mult: 1.01, - charisma_mult: 1.01, - hacking_exp_mult: 1.01, - strength_exp_mult: 1.01, - defense_exp_mult: 1.01, - dexterity_exp_mult: 1.01, - agility_exp_mult: 1.01, - charisma_exp_mult: 1.01, - company_rep_mult: 1.01, - faction_rep_mult: 1.01, - crime_money_mult: 1.01, - crime_success_mult: 1.01, - hacknet_node_money_mult: 1.01, - hacknet_node_purchase_cost_mult: 0.99, - hacknet_node_ram_cost_mult: 0.99, - hacknet_node_core_cost_mult: 0.99, - hacknet_node_level_cost_mult: 0.99, - work_money_mult: 1.01, + hacking_chance_mult: 1.01 + donationBonus, + hacking_speed_mult: 1.01 + donationBonus, + hacking_money_mult: 1.01 + donationBonus, + hacking_grow_mult: 1.01 + donationBonus, + hacking_mult: 1.01 + donationBonus, + strength_mult: 1.01 + donationBonus, + defense_mult: 1.01 + donationBonus, + dexterity_mult: 1.01 + donationBonus, + agility_mult: 1.01 + donationBonus, + charisma_mult: 1.01 + donationBonus, + hacking_exp_mult: 1.01 + donationBonus, + strength_exp_mult: 1.01 + donationBonus, + defense_exp_mult: 1.01 + donationBonus, + dexterity_exp_mult: 1.01 + donationBonus, + agility_exp_mult: 1.01 + donationBonus, + charisma_exp_mult: 1.01 + donationBonus, + company_rep_mult: 1.01 + donationBonus, + faction_rep_mult: 1.01 + donationBonus, + crime_money_mult: 1.01 + donationBonus, + crime_success_mult: 1.01 + donationBonus, + hacknet_node_money_mult: 1.01 + donationBonus, + hacknet_node_purchase_cost_mult: 1 / (1.01 + donationBonus), + hacknet_node_ram_cost_mult: 1 / (1.01 + donationBonus), + hacknet_node_core_cost_mult: 1 / (1.01 + donationBonus), + hacknet_node_level_cost_mult: 1 / (1.01 + donationBonus), + work_money_mult: 1.01 + donationBonus, factions: Object.values(FactionNames), }); } diff --git a/src/Constants.ts b/src/Constants.ts index 46bf33f2d..e145b95b1 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -114,6 +114,7 @@ export const CONSTANTS: { AugmentationGraftingTimeBase: number; EntropyEffect: number; TotalNumBitNodes: number; + Donations: number; // number of blood/plasma/palette donation the dev have verified., boosts NFG LatestUpdate: string; } = { VersionString: "1.6.4", @@ -286,6 +287,8 @@ export const CONSTANTS: { // BitNode/Source-File related stuff TotalNumBitNodes: 24, + Donations: 2, + LatestUpdate: ` v1.6.3 - 2022-04-01 Few stanek fixes ---------------------------- diff --git a/src/PersonObjects/Player/PlayerObject.ts b/src/PersonObjects/Player/PlayerObject.ts index 943598b60..d52e5b0f1 100644 --- a/src/PersonObjects/Player/PlayerObject.ts +++ b/src/PersonObjects/Player/PlayerObject.ts @@ -37,6 +37,7 @@ import { ISkillProgress } from "../formulas/skill"; import { PlayerAchievement } from "../../Achievements/Achievements"; import { cyrb53 } from "../../utils/StringHelperFunctions"; import { getRandomInt } from "../../utils/helpers/getRandomInt"; +import { CONSTANTS } from "src/Constants"; export class PlayerObject implements IPlayer { // Class members @@ -354,7 +355,7 @@ export class PlayerObject implements IPlayer { this.faction_rep_mult = 1; //Money - this.money = 1000; + this.money = 1000 + CONSTANTS.Donations; //Location information this.city = CityName.Sector12; diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index ae8d1bb27..3619562e2 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -105,7 +105,7 @@ export function prestigeAugmentation(this: PlayerObject): void { this.agility_exp = 0; this.charisma_exp = 0; - this.money = 1000; + this.money = 1000 + CONSTANTS.Donations; this.city = CityName.Sector12; this.location = LocationName.TravelAgency; From 7685f52f8e8fa00626ff232dc7b0964a312c57d3 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Thu, 14 Apr 2022 15:23:49 -0400 Subject: [PATCH 15/17] fix import and make rainbow return the answer. --- src/NetscriptFunctions/Extra.ts | 11 +++++++---- src/PersonObjects/Player/PlayerObject.ts | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/NetscriptFunctions/Extra.ts b/src/NetscriptFunctions/Extra.ts index deeb65c04..4fc5a888a 100644 --- a/src/NetscriptFunctions/Extra.ts +++ b/src/NetscriptFunctions/Extra.ts @@ -59,17 +59,20 @@ export function NetscriptExtra(player: IPlayer, workerScript: WorkerScript, help player.giveExploit(Exploit.RealityAlteration); } }, - rainbow: function (guess: unknown): void { - async function tryGuess(): Promise { - const verified = await bcrypt.compare( + rainbow: function (guess: unknown): boolean { + function tryGuess(): boolean { + // eslint-disable-next-line no-sync + const verified = bcrypt.compareSync( helper.string("rainbow", "guess", guess), "$2a$10$aertxDEkgor8baVtQDZsLuMwwGYmkRM/ohcA6FjmmzIHQeTCsrCcO", ); if (verified) { player.giveExploit(Exploit.INeedARainbow); + return true; } + return false; } - tryGuess(); + return tryGuess(); }, }; } diff --git a/src/PersonObjects/Player/PlayerObject.ts b/src/PersonObjects/Player/PlayerObject.ts index d52e5b0f1..72d15e3c1 100644 --- a/src/PersonObjects/Player/PlayerObject.ts +++ b/src/PersonObjects/Player/PlayerObject.ts @@ -37,7 +37,7 @@ import { ISkillProgress } from "../formulas/skill"; import { PlayerAchievement } from "../../Achievements/Achievements"; import { cyrb53 } from "../../utils/StringHelperFunctions"; import { getRandomInt } from "../../utils/helpers/getRandomInt"; -import { CONSTANTS } from "src/Constants"; +import { CONSTANTS } from "../../Constants"; export class PlayerObject implements IPlayer { // Class members From 7d4c10544eb616c073b0dbe0f95a276ec606ec05 Mon Sep 17 00:00:00 2001 From: Undeemiss Date: Thu, 14 Apr 2022 16:08:26 -0500 Subject: [PATCH 16/17] Started collecting lore so that additions to it are simpler For now, a brief description of enders and the general concept of bitnodes --- lore/bitnodes-general.txt | 11 +++++++++++ lore/enders.txt | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 lore/bitnodes-general.txt create mode 100644 lore/enders.txt diff --git a/lore/bitnodes-general.txt b/lore/bitnodes-general.txt new file mode 100644 index 000000000..0068f7646 --- /dev/null +++ b/lore/bitnodes-general.txt @@ -0,0 +1,11 @@ +BitNodes are advanced simulations used to contain humanity by the Enders. It is +unknown how or why they operate, but what is clear is that the World Daemon is +extremely important to the operation of a BitNode. It is possible for the daemon +to be hacked, which results in the entire simulation going offline and the +failure of automatic attempts to reboot the node. The Daemon has a physical +presence, as indicated by the Bladeburners' ability to destroy it via force. +Also, hydroflame (irl) has stated that the glitch in Ishima is the physical +location of the World Daemon in a node. When the player destroys a BitNode, it is +currently unknown what becomes of it, or the people trapped within. However, based +on the way jump3r and Deadalus help the player to destroy it, doing so is somehow +aligned with their goals. \ No newline at end of file diff --git a/lore/enders.txt b/lore/enders.txt new file mode 100644 index 000000000..c00015843 --- /dev/null +++ b/lore/enders.txt @@ -0,0 +1,5 @@ +The "Enders", as dubbed by the humans who know of them, are a humanoid alien race +with extremely advanced technology. "Many decades ago", they invaded Earth, leading +to war between the humans and enders, but the enders were far too powerful for the +humans to win against. When the enders had won, they, for reasons unknown, kept some +number of humans alive, and in some way contained the humans within BitNodes. \ No newline at end of file From 3dfb2afb5836652af79985eced4abe2d16fd8b9b Mon Sep 17 00:00:00 2001 From: Undeemiss Date: Thu, 14 Apr 2022 18:14:15 -0500 Subject: [PATCH 17/17] Added the name of NiteSec's server to their .msg --- src/Message/MessageHelpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Message/MessageHelpers.ts b/src/Message/MessageHelpers.ts index 9236b8664..cf36f15ad 100644 --- a/src/Message/MessageHelpers.ts +++ b/src/Message/MessageHelpers.ts @@ -183,7 +183,7 @@ const Messages: Record = { "like us. Because they can't hide from us. Because they can't fight shadows " + "and ideas with bullets.

" + "Join us, and people will fear you, too.

" + - "Find and install the backdoor on our server. Then, we will contact you again." + + "Find and install the backdoor on our server, avmnite-02h. Then, we will contact you again." + `

-${FactionNames.NiteSec}`, ),