Refactored Stock market to store/accumulate cycles so that it's not completely useless when offline/tabbed out

This commit is contained in:
danielyxie
2018-10-30 16:02:16 -05:00
parent b65b5b2e58
commit 013af4e26c
5 changed files with 85 additions and 86 deletions
+6 -9
View File
@@ -66,7 +66,7 @@ import {SpecialServerIps, initSpecialServerIps} from "./SpecialServerIps
import {StockMarket, StockSymbols,
SymbolToStockMap, initStockSymbols,
initSymbolToStockMap, stockMarketCycle,
updateStockPrices,
processStockPrices,
displayStockMarketContent} from "./StockMarket";
import {Terminal, postNetburnerText} from "./Terminal";
import {KEY} from "../utils/helpers/keyCodes";
@@ -885,6 +885,11 @@ const Engine = {
}
}
// Update stock prices
if (Player.hasWseAccount) {
processStockPrices(numCycles);
}
//Gang, if applicable
if (Player.bitNodeN == 2 && Player.inGang()) {
Player.gang.process(numCycles, Player);
@@ -935,7 +940,6 @@ const Engine = {
checkFactionInvitations: 100, //Check whether you qualify for any faction invitations
passiveFactionGrowth: 600,
messages: 150,
stockTick: 30, //Update stock prices
sCr: 1500,
mechanicProcess: 5, //Processes certain mechanics (Corporation, Bladeburner)
contractGeneration: 3000 //Generate Coding Contracts
@@ -1056,13 +1060,6 @@ const Engine = {
}
}
if (Engine.Counters.stockTick <= 0) {
if (Player.hasWseAccount) {
updateStockPrices();
}
Engine.Counters.stockTick = 30;
}
if (Engine.Counters.sCr <= 0) {
if (Player.hasWseAccount) {
stockMarketCycle();