mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-11 10:13:52 +01:00
CORPORATION: fixed Sell Buttons (#564)
This commit is contained in:
parent
3c6b5a1a83
commit
d8fee8e25a
@ -545,7 +545,6 @@ export class Division {
|
|||||||
|
|
||||||
// We'll store this "Optimal Price" in a property so that we don't have
|
// We'll store this "Optimal Price" in a property so that we don't have
|
||||||
// to re-calculate it for the UI
|
// to re-calculate it for the UI
|
||||||
mat.marketTa2Price = optimalPrice;
|
|
||||||
|
|
||||||
sCost = optimalPrice;
|
sCost = optimalPrice;
|
||||||
} else if (mat.marketTa1) {
|
} else if (mat.marketTa1) {
|
||||||
@ -556,6 +555,7 @@ export class Division {
|
|||||||
} else {
|
} else {
|
||||||
sCost = mat.desiredSellPrice;
|
sCost = mat.desiredSellPrice;
|
||||||
}
|
}
|
||||||
|
mat.uiMarketPrice = sCost;
|
||||||
|
|
||||||
// Calculate how much of the material sells (per second)
|
// Calculate how much of the material sells (per second)
|
||||||
let markup = 1;
|
let markup = 1;
|
||||||
@ -890,7 +890,6 @@ export class Division {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store this "optimal Price" in a property so we don't have to re-calculate for UI
|
// Store this "optimal Price" in a property so we don't have to re-calculate for UI
|
||||||
product.marketTa2Price[city] = optimalPrice;
|
|
||||||
sCost = optimalPrice;
|
sCost = optimalPrice;
|
||||||
} else if (product.marketTa1) {
|
} else if (product.marketTa1) {
|
||||||
sCost = product.productionCost + markupLimit;
|
sCost = product.productionCost + markupLimit;
|
||||||
@ -905,7 +904,7 @@ export class Division {
|
|||||||
} else {
|
} else {
|
||||||
sCost = sellPrice;
|
sCost = sellPrice;
|
||||||
}
|
}
|
||||||
|
product.uiMarketPrice[city] = sCost;
|
||||||
let markup = 1;
|
let markup = 1;
|
||||||
if (sCost > product.productionCost) {
|
if (sCost > product.productionCost) {
|
||||||
if (sCost - product.productionCost > markupLimit) {
|
if (sCost - product.productionCost > markupLimit) {
|
||||||
|
@ -62,7 +62,7 @@ export class Material {
|
|||||||
// Flags that signal whether automatic sale pricing through Market TA is enabled
|
// Flags that signal whether automatic sale pricing through Market TA is enabled
|
||||||
marketTa1 = false;
|
marketTa1 = false;
|
||||||
marketTa2 = false;
|
marketTa2 = false;
|
||||||
marketTa2Price = 0;
|
uiMarketPrice = 0;
|
||||||
|
|
||||||
// Determines the maximum amount of this material that can be sold in one market cycle
|
// Determines the maximum amount of this material that can be sold in one market cycle
|
||||||
maxSellPerCycle = 0;
|
maxSellPerCycle = 0;
|
||||||
|
@ -93,7 +93,7 @@ export class Product {
|
|||||||
// Flags that signal whether automatic sale pricing through Market TA is enabled
|
// Flags that signal whether automatic sale pricing through Market TA is enabled
|
||||||
marketTa1 = false;
|
marketTa1 = false;
|
||||||
marketTa2 = false;
|
marketTa2 = false;
|
||||||
marketTa2Price = createEnumKeyedRecord(CityName, () => 0);
|
uiMarketPrice = createEnumKeyedRecord(CityName, () => 0);
|
||||||
|
|
||||||
/** Effective number that "MAX" represents in a sell amount */
|
/** Effective number that "MAX" represents in a sell amount */
|
||||||
maxSellAmount = 0;
|
maxSellAmount = 0;
|
||||||
|
@ -44,7 +44,6 @@ export function MaterialElem(props: IMaterialProps): React.ReactElement {
|
|||||||
const warehouse = props.warehouse;
|
const warehouse = props.warehouse;
|
||||||
const city = props.city;
|
const city = props.city;
|
||||||
const mat = props.mat;
|
const mat = props.mat;
|
||||||
const markupLimit = mat.getMarkupLimit();
|
|
||||||
const office = division.offices[city];
|
const office = division.offices[city];
|
||||||
if (!office) {
|
if (!office) {
|
||||||
throw new Error(`Could not get OfficeSpace object for this city (${city})`);
|
throw new Error(`Could not get OfficeSpace object for this city (${city})`);
|
||||||
@ -68,7 +67,7 @@ export function MaterialElem(props: IMaterialProps): React.ReactElement {
|
|||||||
if (isString(mat.desiredSellAmount)) {
|
if (isString(mat.desiredSellAmount)) {
|
||||||
sellButtonText = (
|
sellButtonText = (
|
||||||
<>
|
<>
|
||||||
Sell ({formatBigNumber(mat.actualSellAmount)}/{mat.desiredSellAmount[1]})
|
Sell ({formatBigNumber(mat.actualSellAmount)}/{mat.desiredSellAmount})
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -78,35 +77,9 @@ export function MaterialElem(props: IMaterialProps): React.ReactElement {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mat.marketTa2) {
|
|
||||||
sellButtonText = (
|
|
||||||
<>
|
<>
|
||||||
{sellButtonText} @ <Money money={mat.marketTa2Price} />
|
{sellButtonText} @ <Money money={mat.uiMarketPrice} />
|
||||||
</>
|
</>;
|
||||||
);
|
|
||||||
} else if (mat.marketTa1) {
|
|
||||||
sellButtonText = (
|
|
||||||
<>
|
|
||||||
{sellButtonText} @ <Money money={mat.marketPrice + markupLimit} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
} else if (mat.desiredSellPrice) {
|
|
||||||
if (isString(mat.desiredSellPrice)) {
|
|
||||||
const sCost = mat.desiredSellPrice.replace(/MP/g, mat.marketPrice + "");
|
|
||||||
sellButtonText = (
|
|
||||||
<>
|
|
||||||
{sellButtonText} @ <Money money={eval(sCost)} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
sellButtonText = (
|
|
||||||
<>
|
|
||||||
{sellButtonText} @ <Money money={mat.desiredSellPrice} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
sellButtonText = <>Sell (0.000/0.000)</>;
|
sellButtonText = <>Sell (0.000/0.000)</>;
|
||||||
}
|
}
|
||||||
|
@ -66,37 +66,11 @@ export function ProductElem(props: IProductProps): React.ReactElement {
|
|||||||
sellButtonText = <>Sell (0.000/0.000)</>;
|
sellButtonText = <>Sell (0.000/0.000)</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (product.marketTa2) {
|
|
||||||
sellButtonText = (
|
sellButtonText = (
|
||||||
<>
|
<>
|
||||||
{sellButtonText} @ <Money money={product.marketTa2Price[city]} />
|
{sellButtonText} @ <Money money={product.uiMarketPrice[city]} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
} else if (product.marketTa1) {
|
|
||||||
const markupLimit = product.rating / product.markup;
|
|
||||||
sellButtonText = (
|
|
||||||
<>
|
|
||||||
{sellButtonText} @ <Money money={product.productionCost + markupLimit} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
} else if (product.cityData[city].desiredSellPrice) {
|
|
||||||
const desiredSellPrice = product.cityData[city].desiredSellPrice;
|
|
||||||
if (isString(desiredSellPrice)) {
|
|
||||||
const sCost = desiredSellPrice.replace(/MP/g, product.productionCost + product.rating / product.markup + "");
|
|
||||||
sellButtonText = (
|
|
||||||
<>
|
|
||||||
{sellButtonText} @ <Money money={eval(sCost)} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
sellButtonText = (
|
|
||||||
<>
|
|
||||||
{sellButtonText} @ <Money money={product.cityData[city].desiredSellPrice} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Limit Production button
|
// Limit Production button
|
||||||
const productionLimit = product.cityData[city].productionLimit;
|
const productionLimit = product.cityData[city].productionLimit;
|
||||||
const limitProductionButtonText =
|
const limitProductionButtonText =
|
||||||
|
Loading…
Reference in New Issue
Block a user