CORPORATION: Add missing checks for Export API (#1202)

This commit is contained in:
catloversg 2024-04-01 03:53:02 +07:00 committed by GitHub
parent da7f01cca9
commit 524714601e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -411,6 +411,9 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
(ctx) =>
(_sourceDivision, _sourceCity, _targetDivision, _targetCity, _materialName, _amt): void => {
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
if (!hasUnlock(CorpUnlockName.Export)) {
throw helpers.errorMessage(ctx, `You have not unlocked the Export feature!`);
}
const sourceDivision = helpers.string(ctx, "sourceDivision", _sourceDivision);
const sourceCity = getEnumHelper("CityName").nsGetMember(ctx, _sourceCity, "sourceCity");
const targetDivision = getDivision(helpers.string(ctx, "targetDivision", _targetDivision));
@ -424,6 +427,9 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
(ctx) =>
(_sourceDivision, _sourceCity, _targetDivision, _targetCity, _materialName): void => {
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
if (!hasUnlock(CorpUnlockName.Export)) {
throw helpers.errorMessage(ctx, `You have not unlocked the Export feature!`);
}
const sourceDivision = helpers.string(ctx, "sourceDivision", _sourceDivision);
const sourceCity = getEnumHelper("CityName").nsGetMember(ctx, _sourceCity, "sourceCity");
const targetDivision = helpers.string(ctx, "targetDivision", _targetDivision);