mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-02 04:23:48 +01:00
added some funcions
This commit is contained in:
parent
b1328b02ce
commit
53cb37a9fd
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -526,6 +526,9 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
|
|
||||||
return calculatePercentMoneyHacked(server, Player) * 100;
|
return calculatePercentMoneyHacked(server, Player) * 100;
|
||||||
},
|
},
|
||||||
|
hackAnalyzeSecurity: function (threads: any): number {
|
||||||
|
return CONSTANTS.ServerFortifyAmount * threads;
|
||||||
|
},
|
||||||
hackChance: function (hostname: any): any {
|
hackChance: function (hostname: any): any {
|
||||||
updateDynamicRam("hackChance", getRamCost("hackChance"));
|
updateDynamicRam("hackChance", getRamCost("hackChance"));
|
||||||
|
|
||||||
@ -617,6 +620,9 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
|
|
||||||
return numCycleForGrowth(server, Number(growth), Player, cores);
|
return numCycleForGrowth(server, Number(growth), Player, cores);
|
||||||
},
|
},
|
||||||
|
growthAnalyzeSecurity: function (threads: any): number {
|
||||||
|
return 2 * CONSTANTS.ServerFortifyAmount * threads;
|
||||||
|
},
|
||||||
weaken: function (hostname: any, { threads: requestedThreads }: any = {}): any {
|
weaken: function (hostname: any, { threads: requestedThreads }: any = {}): any {
|
||||||
updateDynamicRam("weaken", getRamCost("weaken"));
|
updateDynamicRam("weaken", getRamCost("weaken"));
|
||||||
const threads = resolveNetscriptRequestedThreads(workerScript, "weaken", requestedThreads);
|
const threads = resolveNetscriptRequestedThreads(workerScript, "weaken", requestedThreads);
|
||||||
@ -662,9 +668,13 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
);
|
);
|
||||||
workerScript.scriptRef.onlineExpGained += expGain;
|
workerScript.scriptRef.onlineExpGained += expGain;
|
||||||
Player.gainHackingExp(expGain);
|
Player.gainHackingExp(expGain);
|
||||||
return Promise.resolve(CONSTANTS.ServerWeakenAmount * threads);
|
return Promise.resolve(CONSTANTS.ServerWeakenAmount * threads * coreBonus);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
weakenAnalyze: function (threads: any, cores: any = 1): number {
|
||||||
|
const coreBonus = 1 + (cores - 1) / 16;
|
||||||
|
return CONSTANTS.ServerWeakenAmount * threads * coreBonus;
|
||||||
|
},
|
||||||
print: function (...args: any[]): void {
|
print: function (...args: any[]): void {
|
||||||
if (args.length === 0) {
|
if (args.length === 0) {
|
||||||
throw makeRuntimeErrorMsg("print", "Takes at least 1 argument.");
|
throw makeRuntimeErrorMsg("print", "Takes at least 1 argument.");
|
||||||
|
@ -3305,6 +3305,16 @@ interface NS extends Singularity {
|
|||||||
*/
|
*/
|
||||||
weaken (host: Host, opts?: BasicHGWOptions): Promise<number>;
|
weaken (host: Host, opts?: BasicHGWOptions): Promise<number>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the security decrease that would occur if a weaken with this many threads happened.
|
||||||
|
*
|
||||||
|
* @ramCost 1 GB
|
||||||
|
* @param {number} threads Amount of threads that will be used.
|
||||||
|
* @param {number} cores Optional. The number of cores of the server that would run weaken.
|
||||||
|
* @returns {number} The security decrease.
|
||||||
|
*/
|
||||||
|
weakenAnalyze (threads: number, cores?: number): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns the number of script threads you need when running the {@link hack} command
|
* This function returns the number of script threads you need when running the {@link hack} command
|
||||||
* to steal the specified amount of money from the target server.
|
* to steal the specified amount of money from the target server.
|
||||||
@ -3343,6 +3353,15 @@ interface NS extends Singularity {
|
|||||||
*/
|
*/
|
||||||
hackAnalyzePercent (host: Host): number;
|
hackAnalyzePercent (host: Host): number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the security increase that would occur if a hack with this many threads happened.
|
||||||
|
*
|
||||||
|
* @ramCost 1 GB
|
||||||
|
* @param {number} threads Amount of threads that will be used.
|
||||||
|
* @returns {number} The security increase.
|
||||||
|
*/
|
||||||
|
hackAnalyzeSecurity (threads: number): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the chance you have of successfully hacking the specified server.
|
* Returns the chance you have of successfully hacking the specified server.
|
||||||
*
|
*
|
||||||
@ -3374,6 +3393,16 @@ interface NS extends Singularity {
|
|||||||
*/
|
*/
|
||||||
growthAnalyze (host: Host, growthAmount: number): number;
|
growthAnalyze (host: Host, growthAmount: number): number;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the security increase that would occur if a grow with this many threads happened.
|
||||||
|
*
|
||||||
|
* @ramCost 1 GB
|
||||||
|
* @param {number} threads Amount of threads that will be used.
|
||||||
|
* @returns {number} The security increase.
|
||||||
|
*/
|
||||||
|
growthAnalyzeSecurity (threads: number): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suspends the script for n milliseconds.
|
* Suspends the script for n milliseconds.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user