mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 15:43:49 +01:00
Update exportMaterial amount to number | string (#583)
This commit is contained in:
parent
c67f32cdc1
commit
cc5247ac89
@ -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:**
|
||||
|
||||
|
@ -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);
|
||||
|
2
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
2
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -7084,7 +7084,7 @@ export interface WarehouseAPI {
|
||||
targetDivision: string,
|
||||
targetCity: CityName | `${CityName}`,
|
||||
materialName: string,
|
||||
amt: number,
|
||||
amt: number | string,
|
||||
): void;
|
||||
/**
|
||||
* Cancel material export
|
||||
|
Loading…
Reference in New Issue
Block a user