mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 15:12:27 +01:00
Merge branch 'dev' into contracts_encryption
This commit is contained in:
commit
ec95730a81
@ -7,7 +7,7 @@ module.exports = {
|
|||||||
extends: [
|
extends: [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
"plugin:@typescript-eslint/recommended",
|
"plugin:@typescript-eslint/recommended",
|
||||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
// "plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||||
],
|
],
|
||||||
parser: "@typescript-eslint/parser",
|
parser: "@typescript-eslint/parser",
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
|
4
dist/main.bundle.js
vendored
4
dist/main.bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/main.bundle.js.map
vendored
2
dist/main.bundle.js.map
vendored
File diff suppressed because one or more lines are too long
64
dist/vendor.bundle.js
vendored
64
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/vendor.bundle.js.map
vendored
2
dist/vendor.bundle.js.map
vendored
File diff suppressed because one or more lines are too long
@ -54,8 +54,8 @@ export const CurrentOptionsPage = (props: IProps): React.ReactElement => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleLocaleChange(event: SelectChangeEvent<string>): void {
|
function handleLocaleChange(event: SelectChangeEvent<string>): void {
|
||||||
setLocale(event.target.value );
|
setLocale(event.target.value);
|
||||||
Settings.Locale = event.target.value ;
|
Settings.Locale = event.target.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleTimestampFormatChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
function handleTimestampFormatChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||||
@ -179,12 +179,6 @@ export const CurrentOptionsPage = (props: IProps): React.ReactElement => {
|
|||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<OptionSwitch
|
|
||||||
checked={Settings.InfinityLoopSafety}
|
|
||||||
onChange={(newValue) => (Settings.InfinityLoopSafety = newValue)}
|
|
||||||
text="Script infinite loop safety net"
|
|
||||||
tooltip={<>If this is set the game will attempt to automatically kill scripts stuck in infinite loops.</>}
|
|
||||||
/>
|
|
||||||
</GameOptionsPage>
|
</GameOptionsPage>
|
||||||
),
|
),
|
||||||
[GameOptionsTab.INTERFACE]: (
|
[GameOptionsTab.INTERFACE]: (
|
||||||
|
@ -277,14 +277,6 @@ export const GameOptionsSidebar = (props: IProps): React.ReactElement => {
|
|||||||
>
|
>
|
||||||
Reddit
|
Reddit
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
|
||||||
startIcon={<Public />}
|
|
||||||
href="https://plaza.dsolver.ca/games/bitburner"
|
|
||||||
target="_blank"
|
|
||||||
sx={{ gridArea: "plaza" }}
|
|
||||||
>
|
|
||||||
Incremental game plaza
|
|
||||||
</Button>
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{!location.href.startsWith("file://") && (
|
{!location.href.startsWith("file://") && (
|
||||||
|
@ -95,22 +95,12 @@ function wrapFunction(
|
|||||||
boolean: helpers.boolean,
|
boolean: helpers.boolean,
|
||||||
getServer: (hostname: string) => helpers.getServer(hostname, ctx),
|
getServer: (hostname: string) => helpers.getServer(hostname, ctx),
|
||||||
checkSingularityAccess: () => helpers.checkSingularityAccess(functionName),
|
checkSingularityAccess: () => helpers.checkSingularityAccess(functionName),
|
||||||
hack: helpers.hack,
|
hack: (hostname: any, manual: any, extra?: any) => helpers.hack(ctx, hostname, manual, extra),
|
||||||
getValidPort: (port: any) => helpers.getValidPort(functionPath, port),
|
getValidPort: (port: any) => helpers.getValidPort(functionPath, port),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const safetyEnabled = Settings.InfinityLoopSafety;
|
|
||||||
function wrappedFunction(...args: unknown[]): unknown {
|
function wrappedFunction(...args: unknown[]): unknown {
|
||||||
helpers.updateDynamicRam(ctx.function, getRamCost(Player, ...tree, ctx.function));
|
helpers.updateDynamicRam(ctx.function, getRamCost(Player, ...tree, ctx.function));
|
||||||
if (safetyEnabled) {
|
|
||||||
const now = performance.now();
|
|
||||||
if (now - workerScript.infiniteLoopSafety > CONSTANTS.InfiniteLoopLimit) {
|
|
||||||
throw new Error(
|
|
||||||
`Potential infinite loop without sleep detected. The game spent ${CONSTANTS.InfiniteLoopLimit}ms stuck in this script. (Are you using 'asleep' by mistake?)`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return func(ctx)(...args);
|
return func(ctx)(...args);
|
||||||
}
|
}
|
||||||
const parent = getNestedProperty(wrappedAPI, ...tree);
|
const parent = getNestedProperty(wrappedAPI, ...tree);
|
||||||
|
@ -112,11 +112,6 @@ export class WorkerScript {
|
|||||||
*/
|
*/
|
||||||
atExit: any;
|
atExit: any;
|
||||||
|
|
||||||
/**
|
|
||||||
* Once this counter reaches it's limit the script crashes. It is reset when a promise completes.
|
|
||||||
*/
|
|
||||||
infiniteLoopSafety = performance.now();
|
|
||||||
|
|
||||||
constructor(runningScriptObj: RunningScript, pid: number, nsFuncsGenerator?: (ws: WorkerScript) => NS) {
|
constructor(runningScriptObj: RunningScript, pid: number, nsFuncsGenerator?: (ws: WorkerScript) => NS) {
|
||||||
this.name = runningScriptObj.filename;
|
this.name = runningScriptObj.filename;
|
||||||
this.hostname = runningScriptObj.server;
|
this.hostname = runningScriptObj.server;
|
||||||
|
@ -14,8 +14,6 @@ export function netscriptDelay(time: number, workerScript: WorkerScript): Promis
|
|||||||
workerScript.delay = window.setTimeout(() => {
|
workerScript.delay = window.setTimeout(() => {
|
||||||
workerScript.delay = null;
|
workerScript.delay = null;
|
||||||
workerScript.delayReject = undefined;
|
workerScript.delayReject = undefined;
|
||||||
|
|
||||||
workerScript.infiniteLoopSafety = performance.now();
|
|
||||||
if (workerScript.env.stopFlag) reject(new ScriptDeath(workerScript));
|
if (workerScript.env.stopFlag) reject(new ScriptDeath(workerScript));
|
||||||
else resolve();
|
else resolve();
|
||||||
}, time);
|
}, time);
|
||||||
|
@ -539,8 +539,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
stock: NetscriptStockMarket(Player, workerScript),
|
stock: NetscriptStockMarket(Player, workerScript),
|
||||||
grafting: NetscriptGrafting(Player),
|
grafting: NetscriptGrafting(Player),
|
||||||
hacknet: NetscriptHacknet(Player, workerScript),
|
hacknet: NetscriptHacknet(Player, workerScript),
|
||||||
sprintf: sprintf,
|
sprintf: () => sprintf,
|
||||||
vsprintf: vsprintf,
|
vsprintf: () => vsprintf,
|
||||||
scan:
|
scan:
|
||||||
(ctx: NetscriptContext) =>
|
(ctx: NetscriptContext) =>
|
||||||
(_hostname: unknown = workerScript.hostname): string[] => {
|
(_hostname: unknown = workerScript.hostname): string[] => {
|
||||||
|
@ -725,7 +725,7 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
|||||||
const employeeName = ctx.helper.string("employeeName", _employeeName);
|
const employeeName = ctx.helper.string("employeeName", _employeeName);
|
||||||
const job = ctx.helper.string("job", _job);
|
const job = ctx.helper.string("job", _job);
|
||||||
const employee = getEmployee(divisionName, cityName, employeeName);
|
const employee = getEmployee(divisionName, cityName, employeeName);
|
||||||
return netscriptDelay(1000, workerScript).then(function () {
|
return netscriptDelay(["Training", "Unassigned"].includes(employee.pos) ? 0 : 1000, workerScript).then(function () {
|
||||||
return Promise.resolve(AssignJob(employee, job));
|
return Promise.resolve(AssignJob(employee, job));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -598,15 +598,14 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
|||||||
const server = player.getCurrentServer();
|
const server = player.getCurrentServer();
|
||||||
return _ctx.helper.hack(server.hostname, true);
|
return _ctx.helper.hack(server.hostname, true);
|
||||||
},
|
},
|
||||||
installBackdoor: (_ctx: NetscriptContext) =>
|
installBackdoor: (_ctx: NetscriptContext) => async (): Promise<void> => {
|
||||||
function (): Promise<void> {
|
|
||||||
_ctx.helper.checkSingularityAccess();
|
_ctx.helper.checkSingularityAccess();
|
||||||
const baseserver = player.getCurrentServer();
|
const baseserver = player.getCurrentServer();
|
||||||
if (!(baseserver instanceof Server)) {
|
if (!(baseserver instanceof Server)) {
|
||||||
_ctx.log(() => "cannot backdoor this kind of server");
|
_ctx.log(() => "cannot backdoor this kind of server");
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
const server = baseserver ;
|
const server = baseserver;
|
||||||
const installTime = (calculateHackingTime(server, player) / 4) * 1000;
|
const installTime = (calculateHackingTime(server, player) / 4) * 1000;
|
||||||
|
|
||||||
// No root access or skill level too low
|
// No root access or skill level too low
|
||||||
|
@ -2287,7 +2287,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
|
|||||||
!fulcrumsecrettechonologiesFac.isMember &&
|
!fulcrumsecrettechonologiesFac.isMember &&
|
||||||
!fulcrumsecrettechonologiesFac.alreadyInvited &&
|
!fulcrumsecrettechonologiesFac.alreadyInvited &&
|
||||||
fulcrumSecretServer.backdoorInstalled &&
|
fulcrumSecretServer.backdoorInstalled &&
|
||||||
checkMegacorpRequirements(LocationName.AevumFulcrumTechnologies, 250e3)
|
checkMegacorpRequirements(LocationName.AevumFulcrumTechnologies)
|
||||||
) {
|
) {
|
||||||
invitedFactions.push(fulcrumsecrettechonologiesFac);
|
invitedFactions.push(fulcrumsecrettechonologiesFac);
|
||||||
}
|
}
|
||||||
|
@ -54,11 +54,6 @@ interface IDefaultSettings {
|
|||||||
*/
|
*/
|
||||||
EnableBashHotkeys: boolean;
|
EnableBashHotkeys: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* Infinite loop safety net
|
|
||||||
*/
|
|
||||||
InfinityLoopSafety: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timestamps format
|
* Timestamps format
|
||||||
*/
|
*/
|
||||||
@ -206,7 +201,6 @@ export const defaultSettings: IDefaultSettings = {
|
|||||||
DisableOverviewProgressBars: false,
|
DisableOverviewProgressBars: false,
|
||||||
EnableBashHotkeys: false,
|
EnableBashHotkeys: false,
|
||||||
TimestampsFormat: "",
|
TimestampsFormat: "",
|
||||||
InfinityLoopSafety: true,
|
|
||||||
Locale: "en",
|
Locale: "en",
|
||||||
MaxRecentScriptsCapacity: 50,
|
MaxRecentScriptsCapacity: 50,
|
||||||
MaxLogCapacity: 50,
|
MaxLogCapacity: 50,
|
||||||
@ -247,7 +241,6 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
|
|||||||
DisableOverviewProgressBars: defaultSettings.DisableOverviewProgressBars,
|
DisableOverviewProgressBars: defaultSettings.DisableOverviewProgressBars,
|
||||||
EnableBashHotkeys: defaultSettings.EnableBashHotkeys,
|
EnableBashHotkeys: defaultSettings.EnableBashHotkeys,
|
||||||
TimestampsFormat: defaultSettings.TimestampsFormat,
|
TimestampsFormat: defaultSettings.TimestampsFormat,
|
||||||
InfinityLoopSafety: defaultSettings.InfinityLoopSafety,
|
|
||||||
Locale: "en",
|
Locale: "en",
|
||||||
MaxRecentScriptsCapacity: defaultSettings.MaxRecentScriptsCapacity,
|
MaxRecentScriptsCapacity: defaultSettings.MaxRecentScriptsCapacity,
|
||||||
MaxLogCapacity: defaultSettings.MaxLogCapacity,
|
MaxLogCapacity: defaultSettings.MaxLogCapacity,
|
||||||
|
@ -272,6 +272,7 @@ const Engine: {
|
|||||||
const numCyclesOffline = Math.floor(timeOffline / CONSTANTS._idleSpeed);
|
const numCyclesOffline = Math.floor(timeOffline / CONSTANTS._idleSpeed);
|
||||||
|
|
||||||
// Generate coding contracts
|
// Generate coding contracts
|
||||||
|
if (Player.sourceFiles.length > 0) {
|
||||||
let numContracts = 0;
|
let numContracts = 0;
|
||||||
if (numCyclesOffline < 3000 * 100) {
|
if (numCyclesOffline < 3000 * 100) {
|
||||||
// if we have less than 100 rolls, just roll them exactly.
|
// if we have less than 100 rolls, just roll them exactly.
|
||||||
@ -285,6 +286,7 @@ const Engine: {
|
|||||||
for (let i = 0; i < numContracts; i++) {
|
for (let i = 0; i < numContracts; i++) {
|
||||||
generateRandomContract();
|
generateRandomContract();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let offlineReputation = 0;
|
let offlineReputation = 0;
|
||||||
const offlineHackingIncome = (Player.moneySourceA.hacking / Player.playtimeSinceLastAug) * timeOffline * 0.75;
|
const offlineHackingIncome = (Player.moneySourceA.hacking / Player.playtimeSinceLastAug) * timeOffline * 0.75;
|
||||||
|
Loading…
Reference in New Issue
Block a user