Add repFromDonation formula to the API

This commit is contained in:
Zoë Hoekstra 2022-04-14 20:01:31 +02:00
parent e1a56f9270
commit accb9f7e23
No known key found for this signature in database
GPG Key ID: F9B7B7D8130F3323
2 changed files with 13 additions and 0 deletions

@ -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 {

@ -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;
}
/**