mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-03-21 09:42:31 +01:00
throw error without bulk purchase reasearch
This commit is contained in:
@ -270,6 +270,7 @@ export function SellShares(corporation: ICorporation, player: IPlayer, numShares
|
|||||||
if (numShares < 0) throw new Error("Invalid value for number of shares");
|
if (numShares < 0) throw new Error("Invalid value for number of shares");
|
||||||
if (numShares > corporation.numShares) throw new Error("You don't have that many shares to sell!");
|
if (numShares > corporation.numShares) throw new Error("You don't have that many shares to sell!");
|
||||||
if (!corporation.public) throw new Error("You haven't gone public!");
|
if (!corporation.public) throw new Error("You haven't gone public!");
|
||||||
|
if (corporation.shareSaleCooldown) throw new Error("Share sale on cooldown!");
|
||||||
const stockSaleResults = corporation.calculateShareSale(numShares);
|
const stockSaleResults = corporation.calculateShareSale(numShares);
|
||||||
const profit = stockSaleResults[0];
|
const profit = stockSaleResults[0];
|
||||||
const newSharePrice = stockSaleResults[1];
|
const newSharePrice = stockSaleResults[1];
|
||||||
|
@ -43,7 +43,7 @@ export function BuybackSharesModal(props: IProps): React.ReactElement {
|
|||||||
props.onClose();
|
props.onClose();
|
||||||
props.rerender();
|
props.rerender();
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (err) {
|
||||||
dialogBoxCreate(err + "");
|
dialogBoxCreate(err + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ function BulkPurchaseSection(props: IBPProps): React.ReactElement {
|
|||||||
|
|
||||||
function bulkPurchase(): void {
|
function bulkPurchase(): void {
|
||||||
try {
|
try {
|
||||||
BulkPurchase(corp, props.warehouse, props.mat, buyAmt);
|
BulkPurchase(corp, props.warehouse, props.mat, parseFloat(buyAmt));
|
||||||
props.onClose();
|
props.onClose();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
dialogBoxCreate(err + "");
|
dialogBoxCreate(err + "");
|
||||||
|
@ -63,7 +63,6 @@ import { CorporationConstants } from "../Corporation/data/Constants";
|
|||||||
import { IndustryUpgrades } from "../Corporation/IndustryUpgrades";
|
import { IndustryUpgrades } from "../Corporation/IndustryUpgrades";
|
||||||
import { ResearchMap } from "../Corporation/ResearchMap";
|
import { ResearchMap } from "../Corporation/ResearchMap";
|
||||||
import { Factions } from "../Faction/Factions";
|
import { Factions } from "../Faction/Factions";
|
||||||
import { sellStock } from '../StockMarket/BuyingAndSelling';
|
|
||||||
|
|
||||||
export function NetscriptCorporation(
|
export function NetscriptCorporation(
|
||||||
player: IPlayer,
|
player: IPlayer,
|
||||||
@ -427,8 +426,9 @@ export function NetscriptCorporation(
|
|||||||
},
|
},
|
||||||
bulkPurchase: function (adivisionName: any, acityName: any, amaterialName: any, aamt: any): void {
|
bulkPurchase: function (adivisionName: any, acityName: any, amaterialName: any, aamt: any): void {
|
||||||
checkAccess("bulkPurchase", 7);
|
checkAccess("bulkPurchase", 7);
|
||||||
const corporation = getCorporation();
|
|
||||||
const divisionName = helper.string("bulkPurchase", "divisionName", adivisionName);
|
const divisionName = helper.string("bulkPurchase", "divisionName", adivisionName);
|
||||||
|
if (!hasResearched(getDivision(adivisionName), "Bulk Purchasing")) throw new Error(`You have not researched Bulk Purchase in ${adivisionName}`)
|
||||||
|
const corporation = getCorporation();
|
||||||
const cityName = helper.string("bulkPurchase", "cityName", acityName);
|
const cityName = helper.string("bulkPurchase", "cityName", acityName);
|
||||||
const materialName = helper.string("bulkPurchase", "materialName", amaterialName);
|
const materialName = helper.string("bulkPurchase", "materialName", amaterialName);
|
||||||
const amt = helper.number("bulkPurchase", "amt", aamt);
|
const amt = helper.number("bulkPurchase", "amt", aamt);
|
||||||
|
Reference in New Issue
Block a user