diff --git a/src/Corporation/Actions.ts b/src/Corporation/Actions.ts index b1f7eff11..26e4ee99e 100644 --- a/src/Corporation/Actions.ts +++ b/src/Corporation/Actions.ts @@ -105,6 +105,7 @@ export function SellMaterial(mat: Material, amt: string, price: string): void { } //Parse quantity + amt = amt.toUpperCase(); if (amt.includes("MAX") || amt.includes("PROD")) { let q = amt.replace(/\s+/g, ""); q = q.replace(/[^-()\d/*+.MAXPROD]/g, ""); @@ -168,6 +169,7 @@ export function SellProduct(product: Product, city: string, amt: string, price: const cities = Object.keys(Cities); // Parse quantity + amt = amt.toUpperCase(); if (amt.includes("MAX") || amt.includes("PROD")) { //Dynamically evaluated quantity. First test to make sure its valid let qty = amt.replace(/\s+/g, ""); @@ -372,7 +374,7 @@ export function Research(division: IIndustry, researchName: string): void { export function ExportMaterial(divisionName: string, cityName: string, material: Material, amt: string): void { // Sanitize amt - let sanitizedAmt = amt.replace(/\s+/g, ""); + let sanitizedAmt = amt.replace(/\s+/g, "").toUpperCase(); sanitizedAmt = sanitizedAmt.replace(/[^-()\d/*+.MAX]/g, ""); let temp = sanitizedAmt.replace(/MAX/g, "1"); try { diff --git a/src/Corporation/Industry.ts b/src/Corporation/Industry.ts index 6be0d0da6..d10e8b448 100644 --- a/src/Corporation/Industry.ts +++ b/src/Corporation/Industry.ts @@ -840,7 +840,7 @@ export class Industry implements IIndustry { let sellAmt; if (isString(mat.sllman[1])) { //Dynamically evaluated - let tmp = (mat.sllman[1] as string).replace(/MAX/g, maxSell + ""); + let tmp = (mat.sllman[1] as string).replace(/MAX/g, (maxSell + "").toUpperCase()); tmp = tmp.replace(/PROD/g, mat.prd + ""); try { sellAmt = eval(tmp); @@ -893,7 +893,7 @@ export class Industry implements IIndustry { const exp = mat.exp[expI]; const amtStr = exp.amt.replace( /MAX/g, - mat.qty / (CorporationConstants.SecsPerMarketCycle * marketCycles) + "", + (mat.qty / (CorporationConstants.SecsPerMarketCycle * marketCycles) + "").toUpperCase(), ); let amt = 0; try { @@ -1201,7 +1201,7 @@ export class Industry implements IIndustry { let sellAmt; if (product.sllman[city][0] && isString(product.sllman[city][1])) { //Sell amount is dynamically evaluated - let tmp = product.sllman[city][1].replace(/MAX/g, maxSell); + let tmp = product.sllman[city][1].replace(/MAX/g, (maxSell + "").toUpperCase()); tmp = tmp.replace(/PROD/g, product.data[city][1]); try { tmp = eval(tmp);