mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-21 00:32:51 +02:00
NETSCRIPT: add formulas.hacking.growAmount() (#1090)
Also, improve docs.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Player as player } from "../Player";
|
||||
import { calculateServerGrowth } from "../Server/formulas/grow";
|
||||
import { calculateServerGrowth, calculateGrowMoney } from "../Server/formulas/grow";
|
||||
import { numCycleForGrowthCorrected } from "../Server/ServerHelpers";
|
||||
import {
|
||||
calculateMoneyGainRate,
|
||||
@@ -196,6 +196,16 @@ export function NetscriptFormulas(): InternalAPI<IFormulas> {
|
||||
checkFormulasAccess(ctx);
|
||||
return numCycleForGrowthCorrected(server, targetMoney, startMoney, cores, player);
|
||||
},
|
||||
growAmount:
|
||||
(ctx) =>
|
||||
(_server, _player, _threads, _cores = 1) => {
|
||||
const server = helpers.server(ctx, _server);
|
||||
const person = helpers.person(ctx, _player);
|
||||
const threads = helpers.number(ctx, "threads", _threads);
|
||||
const cores = helpers.number(ctx, "cores", _cores);
|
||||
checkFormulasAccess(ctx);
|
||||
return calculateGrowMoney(server, threads, person, cores);
|
||||
},
|
||||
hackTime: (ctx) => (_server, _player) => {
|
||||
const server = helpers.server(ctx, _server);
|
||||
const person = helpers.person(ctx, _player);
|
||||
|
||||
Reference in New Issue
Block a user