From cc5247ac89d82f8eb26db73b9f0e3c583c91d31a Mon Sep 17 00:00:00 2001 From: Kateract Date: Wed, 7 Jun 2023 10:48:23 -0700 Subject: [PATCH] Update exportMaterial amount to number | string (#583) --- markdown/bitburner.warehouseapi.exportmaterial.md | 4 ++-- src/Corporation/Actions.ts | 2 +- src/ScriptEditor/NetscriptDefinitions.d.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/markdown/bitburner.warehouseapi.exportmaterial.md b/markdown/bitburner.warehouseapi.exportmaterial.md index 81f32e89f..a35a0fe3a 100644 --- a/markdown/bitburner.warehouseapi.exportmaterial.md +++ b/markdown/bitburner.warehouseapi.exportmaterial.md @@ -15,7 +15,7 @@ exportMaterial( targetDivision: string, targetCity: CityName | `${CityName}`, materialName: string, - amt: number, + amt: number | string, ): void; ``` @@ -28,7 +28,7 @@ exportMaterial( | targetDivision | string | Target division | | targetCity | [CityName](./bitburner.cityname.md) \| \`${[CityName](./bitburner.cityname.md)}\` | Target city | | materialName | string | Name of the material | -| amt | number | Amount of material to export. | +| amt | number \| string | Amount of material to export. | **Returns:** diff --git a/src/Corporation/Actions.ts b/src/Corporation/Actions.ts index 05e1ea5d1..105568905 100644 --- a/src/Corporation/Actions.ts +++ b/src/Corporation/Actions.ts @@ -478,7 +478,7 @@ Attempted export amount: ${amount}`); let sanitizedAmt = amount.replace(/\s+/g, "").toUpperCase(); sanitizedAmt = sanitizedAmt.replace(/[^-()\d/*+.MAXEPRODINV]/g, ""); for (const testReplacement of ["(1.23)", "(-1.23)"]) { - const replaced = sanitizedAmt.replace(/(IPROD|EPROD|IINV|EINV)/g, testReplacement); + const replaced = sanitizedAmt.replace(/(MAX|IPROD|EPROD|IINV|EINV)/g, testReplacement); let evaluated, error; try { evaluated = eval(replaced); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 6707d0307..be01a6511 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -7084,7 +7084,7 @@ export interface WarehouseAPI { targetDivision: string, targetCity: CityName | `${CityName}`, materialName: string, - amt: number, + amt: number | string, ): void; /** * Cancel material export