diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index ae2e61837..7b9781978 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -346,10 +346,13 @@ export function NetscriptCorporation( const cityName = helper.city("getMaterial", "cityName", _cityName); const materialName = helper.string("getMaterial", "materialName", _materialName); const material = getMaterial(divisionName, cityName, materialName); + const corporation = getCorporation(); return { name: material.name, qty: material.qty, qlt: material.qlt, + dmd: corporation.unlockUpgrades[2] ? material.dmd : undefined, + cmp: corporation.unlockUpgrades[3] ? material.cmp : undefined, prod: material.prd, sell: material.sll, }; @@ -359,10 +362,13 @@ export function NetscriptCorporation( const divisionName = helper.string("getProduct", "divisionName", _divisionName); const productName = helper.string("getProduct", "productName", _productName); const product = getProduct(divisionName, productName); + const corporation = getCorporation(); return { name: product.name, - dmd: product.dmd, - cmp: product.cmp, + dmd: corporation.unlockUpgrades[2] ? product.dmd : undefined, + cmp: corporation.unlockUpgrades[3] ? product.cmp : undefined, + rat: product.rat, + properties: {qlt:product.qlt, per:product.per, dur:product.dur, rel:product.rel, aes:product.aes, fea:product.fea}, pCost: product.pCost, sCost: product.sCost, cityData: product.data, diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index bb2124641..c2e07b6a0 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6938,10 +6938,14 @@ interface Employee { interface Product { /** Name of the product */ name: string; - /** Demand for the product */ - dmd: number; - /** Competition for the product */ - cmp: number; + /** Demand for the product, only present if "Market Research - Demand" unlocked */ + dmd: number | undefined; + /** Competition for the product, only present if "Market Research - Competition" unlocked */ + cmp: number | undefined; + /** Product Rating */ + rat: number; + /** Product Properties. The data is {qlt, per, dur, rel, aes, fea} */ + properties: { [key: string]: number }; /** Production cost */ pCost: number; /** Sell cost, can be "MP+5" */ @@ -6965,6 +6969,10 @@ interface Material { qty: number; /** Quality of the material */ qlt: number; + /** Demand for the material, only present if "Market Research - Demand" unlocked */ + dmd: number | undefined; + /** Competition for the material, only present if "Market Research - Competition" unlocked */ + cmp: number | undefined; /** Amount of material produced */ prod: number; /** Amount of material sold */