mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-21 08:42:53 +02:00
Merge branch 'dev' into corp-remove-async
This commit is contained in:
@@ -279,26 +279,28 @@ export function NetscriptBladeburner(player: IPlayer, workerScript: WorkerScript
|
||||
},
|
||||
getSkillUpgradeCost:
|
||||
(ctx: NetscriptContext) =>
|
||||
(_skillName: unknown): number => {
|
||||
(_skillName: unknown, _count: unknown = 1): number => {
|
||||
const skillName = ctx.helper.string("skillName", _skillName);
|
||||
const count = ctx.helper.number("count", _count);
|
||||
checkBladeburnerAccess(ctx);
|
||||
const bladeburner = player.bladeburner;
|
||||
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
|
||||
try {
|
||||
return bladeburner.getSkillUpgradeCostNetscriptFn(skillName, workerScript);
|
||||
return bladeburner.getSkillUpgradeCostNetscriptFn(skillName, count, workerScript);
|
||||
} catch (e: any) {
|
||||
throw ctx.makeRuntimeErrorMsg(e);
|
||||
}
|
||||
},
|
||||
upgradeSkill:
|
||||
(ctx: NetscriptContext) =>
|
||||
(_skillName: unknown): boolean => {
|
||||
(_skillName: unknown, _count: unknown = 1): boolean => {
|
||||
const skillName = ctx.helper.string("skillName", _skillName);
|
||||
const count = ctx.helper.number("count", _count);
|
||||
checkBladeburnerAccess(ctx);
|
||||
const bladeburner = player.bladeburner;
|
||||
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
|
||||
try {
|
||||
return bladeburner.upgradeSkillNetscriptFn(skillName, workerScript);
|
||||
return bladeburner.upgradeSkillNetscriptFn(skillName, count, workerScript);
|
||||
} catch (e: any) {
|
||||
throw ctx.makeRuntimeErrorMsg(e);
|
||||
}
|
||||
|
||||
@@ -913,14 +913,15 @@ export function NetscriptCorporation(player: IPlayer): InternalAPI<NSCorporation
|
||||
},
|
||||
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
|
||||
@@ -947,6 +948,9 @@ export function NetscriptCorporation(player: IPlayer): InternalAPI<NSCorporation
|
||||
shareSaleCooldown: corporation.shareSaleCooldown,
|
||||
issuedShares: corporation.issuedShares,
|
||||
sharePrice: corporation.sharePrice,
|
||||
dividendRate: corporation.dividendRate,
|
||||
dividendTax: corporation.dividendTax,
|
||||
dividendEarnings: corporation.getCycleDividends() / CorporationConstants.SecsPerMarketCycle,
|
||||
state: corporation.state.getState(),
|
||||
divisions: corporation.divisions.map((division): NSDivision => getSafeDivision(division)),
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ export function NetscriptInfiltration(player: IPlayer): InternalAPI<IInfiltratio
|
||||
};
|
||||
return {
|
||||
getPossibleLocations: () => (): string[] => {
|
||||
return getLocationsWithInfiltrations.map((l) => l + "");
|
||||
return getLocationsWithInfiltrations.map((l) => l.name);
|
||||
},
|
||||
getInfiltration:
|
||||
(ctx: NetscriptContext) =>
|
||||
|
||||
@@ -164,6 +164,11 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
|
||||
const augs = getFactionAugmentationsFiltered(player, fac);
|
||||
|
||||
if (!player.factions.includes(fac.name)) {
|
||||
_ctx.log(() => `You can't purchase augmentations from '${facName}' because you aren't a member`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!augs.includes(augName)) {
|
||||
_ctx.log(() => `Faction '${facName}' does not have the '${augName}' augmentation.`);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user