mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 00:04:22 +02:00
Added copy save to clipbaord option. Added getOrders netscript function. Fixed Corporation Bugs
This commit is contained in:
@@ -1713,6 +1713,40 @@ function NetscriptFunctions(workerScript) {
|
||||
};
|
||||
return cancelOrder(params, workerScript);
|
||||
},
|
||||
getOrders : function() {
|
||||
if (workerScript.checkingRam) {
|
||||
return updateStaticRam("getOrders", CONSTANTS.ScriptBuySellStockRamCost);
|
||||
}
|
||||
updateDynamicRam("getOrders", CONSTANTS.ScriptBuySellStockRamCost);
|
||||
if (!Player.hasTixApiAccess) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "You don't have TIX API Access! Cannot use getOrders()");
|
||||
}
|
||||
if (Player.bitNodeN !== 8) {
|
||||
if (!(hasWallStreetSF && wallStreetSFLvl >= 3)) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "ERROR: Cannot use getOrders(). You must either be in BitNode-8 or have Level 3 of Source-File 8");
|
||||
}
|
||||
}
|
||||
|
||||
const orders = {};
|
||||
|
||||
const stockMarketOrders = StockMarket["Orders"];
|
||||
for (let symbol in stockMarketOrders) {
|
||||
const orderBook = stockMarketOrders[symbol];
|
||||
if (orderBook.constructor === Array && orderBook.length > 0) {
|
||||
orders[symbol] = [];
|
||||
for (let i = 0; i < orderBook.length; ++i) {
|
||||
orders[symbol].push({
|
||||
shares: orderBook[i].shares,
|
||||
price: orderBook[i].price,
|
||||
type: orderBook[i].type,
|
||||
position: orderBook[i].pos,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return orders;
|
||||
},
|
||||
getStockVolatility : function(symbol) {
|
||||
if (workerScript.checkingRam) {
|
||||
return updateStaticRam("getStockVolatility", CONSTANTS.ScriptBuySellStockRamCost);
|
||||
|
||||
Reference in New Issue
Block a user