mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-29 19:13:49 +01:00
fix disable log for tix api
This commit is contained in:
parent
6fb38b5439
commit
6e71258a53
@ -315,18 +315,18 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
checkTixApiAccess("purchase4SMarketData");
|
checkTixApiAccess("purchase4SMarketData");
|
||||||
|
|
||||||
if (player.has4SData) {
|
if (player.has4SData) {
|
||||||
workerScript.log("purchase4SMarketData", () => "Already purchased 4S Market Data.");
|
workerScript.log("stock.purchase4SMarketData", () => "Already purchased 4S Market Data.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.money < getStockMarket4SDataCost()) {
|
if (player.money < getStockMarket4SDataCost()) {
|
||||||
workerScript.log("purchase4SMarketData", () => "Not enough money to purchase 4S Market Data.");
|
workerScript.log("stock.purchase4SMarketData", () => "Not enough money to purchase 4S Market Data.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.has4SData = true;
|
player.has4SData = true;
|
||||||
player.loseMoney(getStockMarket4SDataCost(), "stock");
|
player.loseMoney(getStockMarket4SDataCost(), "stock");
|
||||||
workerScript.log("purchase4SMarketData", () => "Purchased 4S Market Data");
|
workerScript.log("stock.purchase4SMarketData", () => "Purchased 4S Market Data");
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
purchase4SMarketDataTixApi: function () {
|
purchase4SMarketDataTixApi: function () {
|
||||||
@ -334,18 +334,21 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
checkTixApiAccess("purchase4SMarketDataTixApi");
|
checkTixApiAccess("purchase4SMarketDataTixApi");
|
||||||
|
|
||||||
if (player.has4SDataTixApi) {
|
if (player.has4SDataTixApi) {
|
||||||
workerScript.log("purchase4SMarketDataTixApi", () => "Already purchased 4S Market Data TIX API");
|
workerScript.log("stock.purchase4SMarketDataTixApi", () => "Already purchased 4S Market Data TIX API");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.money < getStockMarket4STixApiCost()) {
|
if (player.money < getStockMarket4STixApiCost()) {
|
||||||
workerScript.log("purchase4SMarketDataTixApi", () => "Not enough money to purchase 4S Market Data TIX API");
|
workerScript.log(
|
||||||
|
"stock.purchase4SMarketDataTixApi",
|
||||||
|
() => "Not enough money to purchase 4S Market Data TIX API",
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.has4SDataTixApi = true;
|
player.has4SDataTixApi = true;
|
||||||
player.loseMoney(getStockMarket4STixApiCost(), "stock");
|
player.loseMoney(getStockMarket4STixApiCost(), "stock");
|
||||||
workerScript.log("purchase4SMarketDataTixApi", () => "Purchased 4S Market Data TIX API");
|
workerScript.log("stock.purchase4SMarketDataTixApi", () => "Purchased 4S Market Data TIX API");
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,7 @@ export function buyStock(
|
|||||||
}
|
}
|
||||||
if (stock == null || isNaN(shares)) {
|
if (stock == null || isNaN(shares)) {
|
||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log("buyStock", () => `Invalid arguments: stock='${stock}' shares='${shares}'`);
|
workerScript.log("stock.buy", () => `Invalid arguments: stock='${stock}' shares='${shares}'`);
|
||||||
} else if (opts.suppressDialog !== true) {
|
} else if (opts.suppressDialog !== true) {
|
||||||
dialogBoxCreate("Failed to buy stock. This may be a bug, contact developer");
|
dialogBoxCreate("Failed to buy stock. This may be a bug, contact developer");
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ export function buyStock(
|
|||||||
if (Player.money < totalPrice) {
|
if (Player.money < totalPrice) {
|
||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log(
|
workerScript.log(
|
||||||
"buyStock",
|
"stock.buy",
|
||||||
() =>
|
() =>
|
||||||
`You do not have enough money to purchase this position. You need ${numeralWrapper.formatMoney(totalPrice)}.`,
|
`You do not have enough money to purchase this position. You need ${numeralWrapper.formatMoney(totalPrice)}.`,
|
||||||
);
|
);
|
||||||
@ -86,7 +86,7 @@ export function buyStock(
|
|||||||
if (shares + stock.playerShares + stock.playerShortShares > stock.maxShares) {
|
if (shares + stock.playerShares + stock.playerShortShares > stock.maxShares) {
|
||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log(
|
workerScript.log(
|
||||||
"buyStock",
|
"stock.buy",
|
||||||
() =>
|
() =>
|
||||||
`Purchasing '${shares + stock.playerShares + stock.playerShortShares}' shares would exceed ${
|
`Purchasing '${shares + stock.playerShares + stock.playerShortShares}' shares would exceed ${
|
||||||
stock.symbol
|
stock.symbol
|
||||||
@ -118,7 +118,7 @@ export function buyStock(
|
|||||||
`Bought ${numeralWrapper.formatShares(shares)} shares of ${stock.symbol} for ${numeralWrapper.formatMoney(
|
`Bought ${numeralWrapper.formatShares(shares)} shares of ${stock.symbol} for ${numeralWrapper.formatMoney(
|
||||||
totalPrice,
|
totalPrice,
|
||||||
)}. ` + `Paid ${numeralWrapper.formatMoney(CONSTANTS.StockMarketCommission)} in commission fees.`;
|
)}. ` + `Paid ${numeralWrapper.formatMoney(CONSTANTS.StockMarketCommission)} in commission fees.`;
|
||||||
workerScript.log("buyStock", () => resultTxt);
|
workerScript.log("stock.buy", () => resultTxt);
|
||||||
} else if (opts.suppressDialog !== true) {
|
} else if (opts.suppressDialog !== true) {
|
||||||
dialogBoxCreate(
|
dialogBoxCreate(
|
||||||
<>
|
<>
|
||||||
@ -148,7 +148,7 @@ export function sellStock(
|
|||||||
// Sanitize/Validate arguments
|
// Sanitize/Validate arguments
|
||||||
if (stock == null || shares < 0 || isNaN(shares)) {
|
if (stock == null || shares < 0 || isNaN(shares)) {
|
||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log("sellStock", () => `Invalid arguments: stock='${stock}' shares='${shares}'`);
|
workerScript.log("stock.sell", () => `Invalid arguments: stock='${stock}' shares='${shares}'`);
|
||||||
} else if (opts.suppressDialog !== true) {
|
} else if (opts.suppressDialog !== true) {
|
||||||
dialogBoxCreate(
|
dialogBoxCreate(
|
||||||
"Failed to sell stock. This is probably due to an invalid quantity. Otherwise, this may be a bug, contact developer",
|
"Failed to sell stock. This is probably due to an invalid quantity. Otherwise, this may be a bug, contact developer",
|
||||||
@ -194,7 +194,7 @@ export function sellStock(
|
|||||||
const resultTxt =
|
const resultTxt =
|
||||||
`Sold ${numeralWrapper.formatShares(shares)} shares of ${stock.symbol}. ` +
|
`Sold ${numeralWrapper.formatShares(shares)} shares of ${stock.symbol}. ` +
|
||||||
`After commissions, you gained a total of ${numeralWrapper.formatMoney(gains)}.`;
|
`After commissions, you gained a total of ${numeralWrapper.formatMoney(gains)}.`;
|
||||||
workerScript.log("sellStock", () => resultTxt);
|
workerScript.log("stock.sell", () => resultTxt);
|
||||||
} else if (opts.suppressDialog !== true) {
|
} else if (opts.suppressDialog !== true) {
|
||||||
dialogBoxCreate(
|
dialogBoxCreate(
|
||||||
<>
|
<>
|
||||||
@ -228,7 +228,7 @@ export function shortStock(
|
|||||||
}
|
}
|
||||||
if (stock == null || isNaN(shares)) {
|
if (stock == null || isNaN(shares)) {
|
||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log("shortStock", () => `Invalid arguments: stock='${stock}' shares='${shares}'`);
|
workerScript.log("stock.short", () => `Invalid arguments: stock='${stock}' shares='${shares}'`);
|
||||||
} else if (opts.suppressDialog !== true) {
|
} else if (opts.suppressDialog !== true) {
|
||||||
dialogBoxCreate(
|
dialogBoxCreate(
|
||||||
"Failed to initiate a short position in a stock. This is probably " +
|
"Failed to initiate a short position in a stock. This is probably " +
|
||||||
@ -246,7 +246,7 @@ export function shortStock(
|
|||||||
if (Player.money < totalPrice) {
|
if (Player.money < totalPrice) {
|
||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log(
|
workerScript.log(
|
||||||
"shortStock",
|
"stock.short",
|
||||||
() =>
|
() =>
|
||||||
"You do not have enough " +
|
"You do not have enough " +
|
||||||
"money to purchase this short position. You need " +
|
"money to purchase this short position. You need " +
|
||||||
@ -267,7 +267,7 @@ export function shortStock(
|
|||||||
if (shares + stock.playerShares + stock.playerShortShares > stock.maxShares) {
|
if (shares + stock.playerShares + stock.playerShortShares > stock.maxShares) {
|
||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log(
|
workerScript.log(
|
||||||
"shortStock",
|
"stock.short",
|
||||||
() =>
|
() =>
|
||||||
`This '${shares + stock.playerShares + stock.playerShortShares}' short shares would exceed ${
|
`This '${shares + stock.playerShares + stock.playerShortShares}' short shares would exceed ${
|
||||||
stock.symbol
|
stock.symbol
|
||||||
@ -300,7 +300,7 @@ export function shortStock(
|
|||||||
CONSTANTS.StockMarketCommission,
|
CONSTANTS.StockMarketCommission,
|
||||||
)} ` +
|
)} ` +
|
||||||
`in commission fees.`;
|
`in commission fees.`;
|
||||||
workerScript.log("shortStock", () => resultTxt);
|
workerScript.log("stock.short", () => resultTxt);
|
||||||
} else if (!opts.suppressDialog) {
|
} else if (!opts.suppressDialog) {
|
||||||
dialogBoxCreate(
|
dialogBoxCreate(
|
||||||
<>
|
<>
|
||||||
@ -329,7 +329,7 @@ export function sellShort(
|
|||||||
): boolean {
|
): boolean {
|
||||||
if (stock == null || isNaN(shares) || shares < 0) {
|
if (stock == null || isNaN(shares) || shares < 0) {
|
||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log("sellShort", () => `Invalid arguments: stock='${stock}' shares='${shares}'`);
|
workerScript.log("stock.sellShort", () => `Invalid arguments: stock='${stock}' shares='${shares}'`);
|
||||||
} else if (!opts.suppressDialog) {
|
} else if (!opts.suppressDialog) {
|
||||||
dialogBoxCreate(
|
dialogBoxCreate(
|
||||||
"Failed to sell a short position in a stock. This is probably " +
|
"Failed to sell a short position in a stock. This is probably " +
|
||||||
@ -352,7 +352,7 @@ export function sellShort(
|
|||||||
if (totalGain == null || isNaN(totalGain) || origCost == null) {
|
if (totalGain == null || isNaN(totalGain) || origCost == null) {
|
||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log(
|
workerScript.log(
|
||||||
"sellShort",
|
"stock.sellShort",
|
||||||
() => `Failed to sell short position in a stock. This is probably either due to invalid arguments, or a bug`,
|
() => `Failed to sell short position in a stock. This is probably either due to invalid arguments, or a bug`,
|
||||||
);
|
);
|
||||||
} else if (!opts.suppressDialog) {
|
} else if (!opts.suppressDialog) {
|
||||||
@ -387,7 +387,7 @@ export function sellShort(
|
|||||||
const resultTxt =
|
const resultTxt =
|
||||||
`Sold your short position of ${numeralWrapper.formatShares(shares)} shares of ${stock.symbol}. ` +
|
`Sold your short position of ${numeralWrapper.formatShares(shares)} shares of ${stock.symbol}. ` +
|
||||||
`After commissions, you gained a total of ${numeralWrapper.formatMoney(totalGain)}`;
|
`After commissions, you gained a total of ${numeralWrapper.formatMoney(totalGain)}`;
|
||||||
workerScript.log("sellShort", () => resultTxt);
|
workerScript.log("stock.sellShort", () => resultTxt);
|
||||||
} else if (!opts.suppressDialog) {
|
} else if (!opts.suppressDialog) {
|
||||||
dialogBoxCreate(
|
dialogBoxCreate(
|
||||||
<>
|
<>
|
||||||
|
@ -37,7 +37,7 @@ export function placeOrder(
|
|||||||
): boolean {
|
): boolean {
|
||||||
if (!(stock instanceof Stock)) {
|
if (!(stock instanceof Stock)) {
|
||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log("placeOrder", () => `Invalid stock: '${stock}'`);
|
workerScript.log("stock.placeOrder", () => `Invalid stock: '${stock}'`);
|
||||||
} else {
|
} else {
|
||||||
dialogBoxCreate(`ERROR: Invalid stock passed to placeOrder() function`);
|
dialogBoxCreate(`ERROR: Invalid stock passed to placeOrder() function`);
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ export function placeOrder(
|
|||||||
}
|
}
|
||||||
if (typeof shares !== "number" || typeof price !== "number") {
|
if (typeof shares !== "number" || typeof price !== "number") {
|
||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log("placeOrder", () => `Invalid arguments: shares='${shares}' price='${price}'`);
|
workerScript.log("stock.placeOrder", () => `Invalid arguments: shares='${shares}' price='${price}'`);
|
||||||
} else {
|
} else {
|
||||||
dialogBoxCreate("ERROR: Invalid numeric value provided for either 'shares' or 'price' argument");
|
dialogBoxCreate("ERROR: Invalid numeric value provided for either 'shares' or 'price' argument");
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,6 @@
|
|||||||
<meta name="msapplication-TileColor" content="#000000" />
|
<meta name="msapplication-TileColor" content="#000000" />
|
||||||
<meta name="msapplication-config" content="dist/browserconfig.xml" />
|
<meta name="msapplication-config" content="dist/browserconfig.xml" />
|
||||||
<meta name="theme-color" content="#ffffff" />
|
<meta name="theme-color" content="#ffffff" />
|
||||||
<script>
|
|
||||||
// Give a warning if you go back in browser history.
|
|
||||||
window.onbeforeunload = function () {
|
|
||||||
return "Your work will be lost.";
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<!-- Google Analytics -->
|
<!-- Google Analytics -->
|
||||||
<script>
|
<script>
|
||||||
(function (i, s, o, g, r, a, m) {
|
(function (i, s, o, g, r, a, m) {
|
||||||
|
@ -24,3 +24,10 @@ function rerender(): void {
|
|||||||
(function () {
|
(function () {
|
||||||
ThemeEvents.subscribe(rerender);
|
ThemeEvents.subscribe(rerender);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
if (process.env.NODE_ENV === "development") return;
|
||||||
|
window.onbeforeunload = function () {
|
||||||
|
return "Your work will be lost.";
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user