mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 06:48:42 +02:00
DARKNET: Improve documentation; remove requirement that getBlockedRam and getDepth be called on a darknet server (#2472)
This commit is contained in:
committed by
GitHub
parent
a16706a33b
commit
0eae02adcf
@@ -19,9 +19,6 @@ import { isLabyrinthServer } from "./labyrinth";
|
||||
export const handleRamBlockRemoved = (ctx: NetscriptContext, server: DarknetServer) => {
|
||||
const threads = ctx.workerScript.scriptRef.threads;
|
||||
const difficulty = server.difficulty + 1;
|
||||
const xpGained =
|
||||
Player.mults.charisma_exp * threads * 10 * 1.1 ** difficulty * ((200 + Player.skills.charisma) / 200);
|
||||
Player.gainCharismaExp(xpGained);
|
||||
|
||||
const ramBlockRemoved = getRamBlockRemoved(server, threads);
|
||||
server.blockedRam -= ramBlockRemoved;
|
||||
@@ -30,6 +27,9 @@ export const handleRamBlockRemoved = (ctx: NetscriptContext, server: DarknetServ
|
||||
if (server.blockedRam <= 0) {
|
||||
handleRamBlockClearedRewards(server);
|
||||
}
|
||||
const xpGained =
|
||||
Player.mults.charisma_exp * threads * 10 * 1.1 ** difficulty * ((200 + Player.skills.charisma) / 200);
|
||||
Player.gainCharismaExp(xpGained);
|
||||
|
||||
const result = `Liberated ${formatNumber(
|
||||
ramBlockRemoved,
|
||||
|
||||
@@ -595,7 +595,6 @@ export function NetscriptDarknet(): InternalAPI<DarknetAPI> {
|
||||
(ctx) =>
|
||||
(_host): number => {
|
||||
const targetHost = helpers.string(ctx, "host", _host ?? ctx.workerScript.hostname);
|
||||
expectRunningOnDarknetServer(ctx);
|
||||
const onlineConnectionCheck = getFailureResult(ctx, targetHost);
|
||||
if (!onlineConnectionCheck.success) {
|
||||
return 0;
|
||||
@@ -606,7 +605,6 @@ export function NetscriptDarknet(): InternalAPI<DarknetAPI> {
|
||||
(ctx) =>
|
||||
(_host): number => {
|
||||
const targetHost = helpers.string(ctx, "host", _host ?? ctx.workerScript.hostname);
|
||||
expectRunningOnDarknetServer(ctx);
|
||||
const onlineConnectionCheck = getFailureResult(ctx, targetHost);
|
||||
if (!onlineConnectionCheck.success) {
|
||||
return -1;
|
||||
|
||||
8
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
8
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@@ -4593,8 +4593,8 @@ export interface Darknet {
|
||||
packetCapture(host: string): Promise<DarknetResult & { data: string }>;
|
||||
|
||||
/**
|
||||
* Increases the chance that target connected server will move to other parts of the darknet, by overloading the connections between it and the current server.
|
||||
* Cannot target the current server. Must be run from a darknet server.
|
||||
* Increases the chance that the target server will move to other parts of the darknet, by overloading the connections between it and the current server.
|
||||
* The target must be a connected, non-stationary, darknet server - scripts cannot target the server they are running on.
|
||||
*
|
||||
* Effect scales with threads and charisma level.
|
||||
*
|
||||
@@ -4621,7 +4621,7 @@ export interface Darknet {
|
||||
/**
|
||||
* Returns whether the server is a darknet server.
|
||||
*
|
||||
* Returns false if the server does not exist or has gone offline recently. This function does not DarkscapeNavigator.exe.
|
||||
* Returns false if the server does not exist or has gone offline recently. This function does not require DarkscapeNavigator.exe.
|
||||
*
|
||||
* @remarks
|
||||
* RAM cost: 0.1 GB
|
||||
@@ -4646,7 +4646,7 @@ export interface Darknet {
|
||||
memoryReallocation(host?: string): Promise<DarknetResult>;
|
||||
|
||||
/**
|
||||
* Gets the amount of RAM blocked by the server owner's processes. This ram can be freed for use using memoryReallocation().
|
||||
* Gets the amount of RAM blocked by the server owner's processes. This ram can be freed for use using dnet.memoryReallocation() .
|
||||
*
|
||||
* @remarks
|
||||
* RAM cost: 0 GB
|
||||
|
||||
Reference in New Issue
Block a user