mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 20:55:44 +01:00
Fix error check in issueDividends expecting 0-100 when it actually takes 0-1
This commit is contained in:
parent
74e4a32f13
commit
4a3558098c
@ -918,14 +918,15 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
||||
},
|
||||
issueDividends:
|
||||
(ctx: NetscriptContext) =>
|
||||
(_percent: unknown): void => {
|
||||
(_rate: unknown): void => {
|
||||
checkAccess(ctx);
|
||||
const percent = ctx.helper.number("percent", _percent);
|
||||
if (percent < 0 || percent > 100)
|
||||
throw new Error("Invalid value for percent field! Must be numeric, greater than 0, and less than 100");
|
||||
const rate = ctx.helper.number("rate", _rate);
|
||||
const max = CorporationConstants.DividendMaxRate;
|
||||
if (rate < 0 || rate > max)
|
||||
throw new Error(`Invalid value for rate field! Must be numeric, greater than 0, and less than ${max}`);
|
||||
const corporation = getCorporation();
|
||||
if (!corporation.public) throw ctx.makeRuntimeErrorMsg(`Your company has not gone public!`);
|
||||
IssueDividends(corporation, percent);
|
||||
IssueDividends(corporation, rate);
|
||||
},
|
||||
|
||||
// If you modify these objects you will affect them for real, it's not
|
||||
|
4
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
4
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -7048,9 +7048,9 @@ export interface Corporation extends WarehouseAPI, OfficeAPI {
|
||||
levelUpgrade(upgradeName: string): void;
|
||||
/**
|
||||
* Issue dividends
|
||||
* @param percent - Percent of profit to issue as dividends.
|
||||
* @param rate - Fraction of profit to issue as dividends.
|
||||
*/
|
||||
issueDividends(percent: number): void;
|
||||
issueDividends(rate: number): void;
|
||||
/**
|
||||
* Buyback Shares
|
||||
* @param amount - Amount of shares to buy back.
|
||||
|
Loading…
Reference in New Issue
Block a user