mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 21:53:50 +01:00
getBitnodeM takes 2 arg
This commit is contained in:
parent
ae5fc168bf
commit
8ff840edfa
@ -1,7 +1,7 @@
|
||||
import $ from "jquery";
|
||||
import { vsprintf, sprintf } from "sprintf-js";
|
||||
import { WorkerScriptStartStopEventEmitter } from "./Netscript/WorkerScriptStartStopEventEmitter";
|
||||
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
|
||||
import { BitNodeMultipliers, IBitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
|
||||
import { CONSTANTS } from "./Constants";
|
||||
import {
|
||||
calculateHackingChance,
|
||||
@ -82,6 +82,7 @@ import { recentScripts } from "./Netscript/RecentScripts";
|
||||
import { InternalAPI, wrapAPI } from "./Netscript/APIWrapper";
|
||||
import { INetscriptExtra } from "./NetscriptFunctions/Extra";
|
||||
import { ScriptDeath } from "./Netscript/ScriptDeath";
|
||||
import { getBitNodeMultipliers } from "./BitNode/BitNode";
|
||||
|
||||
// "Enums" as object
|
||||
export const enums = {
|
||||
@ -1017,7 +1018,6 @@ const base: InternalAPI<NS> = {
|
||||
},
|
||||
hasRootAccess: (ctx) => (_hostname) => {
|
||||
const hostname = helpers.string(ctx, "hostname", _hostname);
|
||||
|
||||
const server = helpers.getServer(ctx, hostname);
|
||||
return server.hasAdminRights;
|
||||
},
|
||||
@ -1044,12 +1044,17 @@ const base: InternalAPI<NS> = {
|
||||
levelCost: Player.mults.hacknet_node_level_cost,
|
||||
};
|
||||
},
|
||||
getBitNodeMultipliers: (ctx) => () => {
|
||||
if (Player.sourceFileLvl(5) <= 0 && Player.bitNodeN !== 5) {
|
||||
getBitNodeMultipliers:
|
||||
(ctx) =>
|
||||
(_n = Player.bitNodeN, _lvl = Player.sourceFileLvl(Player.bitNodeN) + 1): IBitNodeMultipliers => {
|
||||
if (Player.sourceFileLvl(5) <= 0 && Player.bitNodeN !== 5)
|
||||
throw helpers.makeRuntimeErrorMsg(ctx, "Requires Source-File 5 to run.");
|
||||
}
|
||||
const copy = Object.assign({}, BitNodeMultipliers);
|
||||
return copy;
|
||||
const n = Math.round(helpers.number(ctx, "n", _n));
|
||||
const lvl = Math.round(helpers.number(ctx, "lvl", _lvl));
|
||||
if (n < 1 || n > 13) throw new Error("n must be between 1 and 13");
|
||||
if (lvl < 1) throw new Error("lvl must be >= 1");
|
||||
|
||||
return Object.assign({}, getBitNodeMultipliers(n, lvl));
|
||||
},
|
||||
getServer:
|
||||
(ctx) =>
|
||||
|
4
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
4
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -6682,7 +6682,7 @@ export interface NS {
|
||||
* @remarks
|
||||
* RAM cost: 4 GB
|
||||
*
|
||||
* Returns an object containing the current BitNode multipliers.
|
||||
* Returns an object containing the current (or supplied) BitNode multipliers.
|
||||
* This function requires you to be in Bitnode 5 or have Source-File 5 in order to run.
|
||||
* The multipliers are returned in decimal forms (e.g. 1.5 instead of 150%).
|
||||
* The multipliers represent the difference between the current BitNode and
|
||||
@ -6708,7 +6708,7 @@ export interface NS {
|
||||
* ```
|
||||
* @returns Object containing the current BitNode multipliers.
|
||||
*/
|
||||
getBitNodeMultipliers(): BitNodeMultipliers;
|
||||
getBitNodeMultipliers(n?: number, lvl?: number): BitNodeMultipliers;
|
||||
|
||||
/**
|
||||
* Get information about the player.
|
||||
|
Loading…
Reference in New Issue
Block a user