mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 09:43:54 +01:00
Add repFromDonation formula to the API
This commit is contained in:
parent
e1a56f9270
commit
accb9f7e23
@ -38,6 +38,7 @@ import {
|
||||
calculateAscensionPointsGain,
|
||||
} from "../Gang/formulas/formulas";
|
||||
import { favorToRep as calculateFavorToRep, repToFavor as calculateRepToFavor } from "../Faction/formulas/favor";
|
||||
import { repFromDonation } from "../Faction/formulas/donation";
|
||||
|
||||
export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): IFormulas {
|
||||
const checkFormulasAccess = function (func: string): void {
|
||||
@ -57,6 +58,11 @@ export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, h
|
||||
checkFormulasAccess("reputation.calculateRepToFavor");
|
||||
return calculateRepToFavor(rep);
|
||||
},
|
||||
repFromDonation: function (_amount: unknown, player: any): number {
|
||||
const amount = helper.number("repFromDonation", "amount", _amount);
|
||||
checkFormulasAccess("reputation.repFromDonation");
|
||||
return repFromDonation(amount, player);
|
||||
},
|
||||
},
|
||||
skills: {
|
||||
calculateSkill: function (_exp: unknown, _mult: unknown = 1): number {
|
||||
|
7
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
7
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -3837,6 +3837,13 @@ interface ReputationFormulas {
|
||||
* @returns The calculated faction favor.
|
||||
*/
|
||||
calculateRepToFavor(rep: number): number;
|
||||
|
||||
/**
|
||||
* Calculate how much rep would be gained.
|
||||
* @param amount - Amount of money donated
|
||||
* @param player - Player info from {@link NS.getPlayer | getPlayer}
|
||||
*/
|
||||
repFromDonation(amount: number, player: Player): number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user