diff --git a/dist/bundle.js b/dist/bundle.js index 3fde985fa..a2dcb4d9f 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -2689,12 +2689,12 @@ let CONSTANTS = { InfiltrationRepValue: 1.4, //Convert "secret" value to faction reputation //Stock market constants - WSEAccountCost: 200000000, - TIXAPICost: 5000000000, - StockMarketCommission: 100000, + WSEAccountCost: 200e6, + TIXAPICost: 5e9, + StockMarketCommission: 100e3, //Hospital/Health - HospitalCostPerHp: 100000, + HospitalCostPerHp: 100e3, //Intelligence-related constants IntelligenceCrimeWeight: 0.05, //Weight for how much int affects crime success rates @@ -4112,14 +4112,16 @@ let Engine = { /* Load content when a main menu button is clicked */ loadTerminalContent: function() { Engine.hideAllContent(); - Engine.Display.terminalContent.style.visibility = "visible"; + //Engine.Display.terminalContent.style.display = "none"; + Engine.Display.terminalContent.style.display = "block"; Engine.currentPage = Engine.Page.Terminal; document.getElementById("terminal-menu-link").classList.add("active"); }, loadCharacterContent: function() { Engine.hideAllContent(); - Engine.Display.characterContent.style.visibility = "visible"; + //Engine.Display.characterContent.style.visibility = "visible"; + Engine.Display.characterContent.style.display = "block"; Engine.displayCharacterInfo(); Engine.currentPage = Engine.Page.CharacterInfo; document.getElementById("stats-menu-link").classList.add("active"); @@ -4127,7 +4129,8 @@ let Engine = { loadScriptEditorContent: function(filename = "", code = "") { Engine.hideAllContent(); - Engine.Display.scriptEditorContent.style.visibility = "visible"; + //Engine.Display.scriptEditorContent.style.visibility = "visible"; + Engine.Display.scriptEditorContent.style.display = "block"; var editor = ace.edit('javascript-editor'); if (filename != "") { document.getElementById("script-editor-filename").value = filename; @@ -4141,7 +4144,8 @@ let Engine = { loadActiveScriptsContent: function() { Engine.hideAllContent(); - Engine.Display.activeScriptsContent.style.visibility = "visible"; + //Engine.Display.activeScriptsContent.style.visibility = "visible"; + Engine.Display.activeScriptsContent.style.display = "block"; Object(__WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__["c" /* setActiveScriptsClickHandlers */])(); Object(__WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__["d" /* updateActiveScriptsItems */])(); Engine.currentPage = Engine.Page.ActiveScripts; @@ -4150,7 +4154,8 @@ let Engine = { loadHacknetNodesContent: function() { Engine.hideAllContent(); - Engine.Display.hacknetNodesContent.style.visibility = "visible"; + //Engine.Display.hacknetNodesContent.style.visibility = "visible"; + Engine.Display.hacknetNodesContent.style.display = "block"; Object(__WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__["a" /* displayHacknetNodesContent */])(); Engine.currentPage = Engine.Page.HacknetNodes; document.getElementById("hacknet-nodes-menu-link").classList.add("active"); @@ -4158,7 +4163,8 @@ let Engine = { loadWorldContent: function() { Engine.hideAllContent(); - Engine.Display.worldContent.style.visibility = "visible"; + //Engine.Display.worldContent.style.visibility = "visible"; + Engine.Display.worldContent.style.display = "block"; Engine.displayWorldInfo(); Engine.currentPage = Engine.Page.World; document.getElementById("city-menu-link").classList.add("active"); @@ -4166,7 +4172,8 @@ let Engine = { loadCreateProgramContent: function() { Engine.hideAllContent(); - Engine.Display.createProgramContent.style.visibility = "visible"; + //Engine.Display.createProgramContent.style.visibility = "visible"; + Engine.Display.createProgramContent.style.display = "block"; Object(__WEBPACK_IMPORTED_MODULE_11__CreateProgram_js__["b" /* displayCreateProgramContent */])(); Engine.currentPage = Engine.Page.CreateProgram; document.getElementById("create-program-menu-link").classList.add("active"); @@ -4174,7 +4181,8 @@ let Engine = { loadFactionsContent: function() { Engine.hideAllContent(); - Engine.Display.factionsContent.style.visibility = "visible"; + //Engine.Display.factionsContent.style.visibility = "visible"; + Engine.Display.factionsContent.style.display = "block"; Engine.displayFactionsInfo(); Engine.currentPage = Engine.Page.Factions; document.getElementById("factions-menu-link").classList.add("active"); @@ -4182,13 +4190,15 @@ let Engine = { loadFactionContent: function() { Engine.hideAllContent(); - Engine.Display.factionContent.style.visibility = "visible"; + //Engine.Display.factionContent.style.visibility = "visible"; + Engine.Display.factionContent.style.display = "block"; Engine.currentPage = Engine.Page.Faction; }, loadAugmentationsContent: function() { Engine.hideAllContent(); - Engine.Display.augmentationsContent.style.visibility = "visible"; + //Engine.Display.augmentationsContent.style.visibility = "visible"; + Engine.Display.augmentationsContent.style.display = "block"; Engine.displayAugmentationsContent(); Engine.currentPage = Engine.Page.Augmentations; document.getElementById("augmentations-menu-link").classList.add("active"); @@ -4196,7 +4206,8 @@ let Engine = { loadTutorialContent: function() { Engine.hideAllContent(); - Engine.Display.tutorialContent.style.visibility = "visible"; + //Engine.Display.tutorialContent.style.visibility = "visible"; + Engine.Display.tutorialContent.style.display = "block"; Engine.displayTutorialContent(); Engine.currentPage = Engine.Page.Tutorial; document.getElementById("tutorial-menu-link").classList.add("active"); @@ -4204,7 +4215,8 @@ let Engine = { loadLocationContent: function() { Engine.hideAllContent(); - Engine.Display.locationContent.style.visibility = "visible"; + //Engine.Display.locationContent.style.visibility = "visible"; + Engine.Display.locationContent.style.display = "block"; Object(__WEBPACK_IMPORTED_MODULE_13__Location_js__["b" /* displayLocationContent */])(); Engine.currentPage = Engine.Page.Location; }, @@ -4249,8 +4261,10 @@ let Engine = { loadWorkInProgressContent: function() { Engine.hideAllContent(); var mainMenu = document.getElementById("mainmenu-container"); + //mainMenu.style.visibility = "hidden"; mainMenu.style.visibility = "hidden"; - Engine.Display.workInProgressContent.style.visibility = "visible"; + //Engine.Display.workInProgressContent.style.visibility = "visible"; + Engine.Display.workInProgressContent.style.display = "block"; Engine.currentPage = Engine.Page.WorkInProgress; }, @@ -4258,19 +4272,22 @@ let Engine = { Engine.hideAllContent(); var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "hidden"; - Engine.Display.redPillContent.style.visibility = "visible"; + //Engine.Display.redPillContent.style.visibility = "visible"; + Engine.Display.redPillContent.style.display = "block"; Engine.currentPage = Engine.Page.RedPill; }, loadInfiltrationContent: function() { Engine.hideAllContent(); - Engine.Display.infiltrationContent.style.visibility = "visible"; + //Engine.Display.infiltrationContent.style.visibility = "visible"; + Engine.Display.infiltrationContent.style.display = "block"; Engine.currentPage = Engine.Page.Infiltration; }, loadStockMarketContent: function() { Engine.hideAllContent(); - Engine.Display.stockMarketContent.style.visibility = "visible"; + //Engine.Display.stockMarketContent.style.visibility = "visible"; + Engine.Display.stockMarketContent.style.display = "block"; Engine.currentPage = Engine.Page.StockMarket; Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["f" /* displayStockMarketContent */])(); }, @@ -4296,6 +4313,7 @@ let Engine = { //Helper function that hides all content hideAllContent: function() { + /* Engine.Display.terminalContent.style.visibility = "hidden"; Engine.Display.characterContent.style.visibility = "hidden"; Engine.Display.scriptEditorContent.style.visibility = "hidden"; @@ -4317,6 +4335,28 @@ let Engine = { if (document.getElementById("gang-container")) { document.getElementById("gang-container").style.visibility = "hidden"; } + */ + Engine.Display.terminalContent.style.display = "none"; + Engine.Display.characterContent.style.display = "none"; + Engine.Display.scriptEditorContent.style.display = "none"; + Engine.Display.activeScriptsContent.style.display = "none"; + Engine.Display.hacknetNodesContent.style.display = "none"; + Engine.Display.worldContent.style.display = "none"; + Engine.Display.createProgramContent.style.display = "none"; + Engine.Display.factionsContent.style.display = "none"; + Engine.Display.factionContent.style.display = "none"; + Engine.Display.factionAugmentationsContent.style.display = "none"; + Engine.Display.augmentationsContent.style.display = "none"; + Engine.Display.tutorialContent.style.display = "none"; + Engine.Display.locationContent.style.display = "none"; + Engine.Display.workInProgressContent.style.display = "none"; + Engine.Display.redPillContent.style.display = "none"; + Engine.Display.infiltrationContent.style.display = "none"; + Engine.Display.stockMarketContent.style.display = "none"; + Engine.Display.missionContent.style.display = "none"; + if (document.getElementById("gang-container")) { + document.getElementById("gang-container").style.display = "none"; + } //Location lists Engine.aevumLocationsList.style.display = "none"; @@ -5164,47 +5204,62 @@ let Engine = { Engine.currentPage = Engine.Page.Terminal; Engine.Display.characterContent = document.getElementById("character-container"); - Engine.Display.characterContent.style.visibility = "hidden"; + //Engine.Display.characterContent.style.visibility = "hidden"; + Engine.Display.characterContent.style.display = "none"; Engine.Display.scriptEditorContent = document.getElementById("script-editor-container"); - Engine.Display.scriptEditorContent.style.visibility = "hidden"; + //Engine.Display.scriptEditorContent.style.visibility = "hidden"; + Engine.Display.scriptEditorContent.style.display = "none"; Engine.Display.activeScriptsContent = document.getElementById("active-scripts-container"); - Engine.Display.activeScriptsContent.style.visibility = "hidden"; + //Engine.Display.activeScriptsContent.style.visibility = "hidden"; + Engine.Display.activeScriptsContent.style.display = "none"; Engine.Display.hacknetNodesContent = document.getElementById("hacknet-nodes-container"); - Engine.Display.hacknetNodesContent.style.visibility = "hidden"; + //Engine.Display.hacknetNodesContent.style.visibility = "hidden"; + Engine.Display.hacknetNodesContent.style.display = "none"; Engine.Display.worldContent = document.getElementById("world-container"); - Engine.Display.worldContent.style.visibility = "hidden"; + //Engine.Display.worldContent.style.visibility = "hidden"; + Engine.Display.worldContent.style.display = "none"; Engine.Display.createProgramContent = document.getElementById("create-program-container"); - Engine.Display.createProgramContent.style.visibility = "hidden"; + //Engine.Display.createProgramContent.style.visibility = "hidden"; + Engine.Display.createProgramContent.style.display = "none"; Engine.Display.factionsContent = document.getElementById("factions-container"); - Engine.Display.factionsContent.style.visibility = "hidden"; + //Engine.Display.factionsContent.style.visibility = "hidden"; + Engine.Display.factionsContent.style.display = "none"; Engine.Display.factionContent = document.getElementById("faction-container"); - Engine.Display.factionContent.style.visibility = "hidden"; + //Engine.Display.factionContent.style.visibility = "hidden"; + Engine.Display.factionContent.style.display = "none"; Engine.Display.factionAugmentationsContent = document.getElementById("faction-augmentations-container"); - Engine.Display.factionAugmentationsContent.style.visibility = "hidden"; + //Engine.Display.factionAugmentationsContent.style.visibility = "hidden"; + Engine.Display.factionAugmentationsContent.style.display = "none"; Engine.Display.augmentationsContent = document.getElementById("augmentations-container"); - Engine.Display.augmentationsContent.style.visibility = "hidden"; + //Engine.Display.augmentationsContent.style.visibility = "hidden"; + Engine.Display.augmentationsContent.style.display = "none"; + Engine.Display.tutorialContent = document.getElementById("tutorial-container"); - Engine.Display.tutorialContent.style.visibility = "hidden"; + //Engine.Display.tutorialContent.style.visibility = "hidden"; + Engine.Display.tutorialContent.style.display = "none"; Engine.Display.infiltrationContent = document.getElementById("infiltration-container"); - Engine.Display.infiltrationContent.style.visibility = "hidden"; + //Engine.Display.infiltrationContent.style.visibility = "hidden"; + Engine.Display.infiltrationContent.style.display = "none"; Engine.Display.stockMarketContent = document.getElementById("stock-market-container"); - Engine.Display.stockMarketContent.style.visibility = "hidden"; + //Engine.Display.stockMarketContent.style.visibility = "hidden"; + Engine.Display.stockMarketContent.style.display = "none"; Engine.Display.missionContent = document.getElementById("mission-container"); - Engine.Display.missionContent.style.visibility = "hidden"; + //Engine.Display.missionContent.style.visibility = "hidden"; + Engine.Display.missionContent.style.display = "none"; //Character info Engine.Display.characterInfo = document.getElementById("character-info"); @@ -5219,15 +5274,18 @@ let Engine = { //Location page (page that shows up when you visit a specific location in World) Engine.Display.locationContent = document.getElementById("location-container"); - Engine.Display.locationContent.style.visibility = "hidden"; + //Engine.Display.locationContent.style.visibility = "hidden"; + Engine.Display.locationContent.style.display = "none"; //Work In Progress Engine.Display.workInProgressContent = document.getElementById("work-in-progress-container"); - Engine.Display.workInProgressContent.style.visibility = "hidden"; + //Engine.Display.workInProgressContent.style.visibility = "hidden"; + Engine.Display.workInProgressContent.style.display = "none"; //Red Pill / Hack World Daemon Engine.Display.redPillContent = document.getElementById("red-pill-container"); - Engine.Display.redPillContent.style.visibility = "hidden"; + //Engine.Display.redPillContent.style.visibility = "hidden"; + Engine.Display.redPillContent.style.display = "none"; //Init Location buttons Object(__WEBPACK_IMPORTED_MODULE_13__Location_js__["c" /* initLocationButtons */])(); @@ -17577,7 +17635,8 @@ function displayFactionContent(factionName) { var newPurchaseAugmentationsButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-purchase-augmentations"); newPurchaseAugmentationsButton.addEventListener("click", function() { __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].hideAllContent(); - __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].Display.factionAugmentationsContent.style.visibility = "visible"; + //Engine.Display.factionAugmentationsContent.style.visibility = "visible"; + __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].Display.factionAugmentationsContent.style.display = "block"; var newBackButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-augmentations-back-button"); newBackButton.addEventListener("click", function() { @@ -36762,7 +36821,7 @@ function initStockMarket() { StockMarket[omnitek] = omnitekStk; var foursigma = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12FourSigma; - var foursigmaStk = new Stock(foursigma, StockSymbols[foursigma], 1.05, true, 18, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(60000, 70000)); + var foursigmaStk = new Stock(foursigma, StockSymbols[foursigma], 1.05, true, 17, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(60000, 70000)); StockMarket[foursigma] = foursigmaStk; var kuaigong = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].ChongqingKuaiGongInternational; @@ -36818,7 +36877,7 @@ function initStockMarket() { StockMarket[nova] = novaStk; var watchdog = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumWatchdogSecurity; - var watchdogStk = new Stock(watchdog, StockSymbols[watchdog], 1, true, 1.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(5000, 7500)); + var watchdogStk = new Stock(watchdog, StockSymbols[watchdog], 2.5, true, 1.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(5000, 7500)); StockMarket[watchdog] = watchdogStk; var lexocorp = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenLexoCorp; @@ -36834,15 +36893,15 @@ function initStockMarket() { StockMarket[alpha] = alphaStk; var syscore = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenSysCoreSecurities; - var syscoreStk = new Stock(syscore, StockSymbols[syscore], 1.25, true, 2, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(4000, 7000)) + var syscoreStk = new Stock(syscore, StockSymbols[syscore], 1.6, true, 3, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(4000, 7000)) StockMarket[syscore] = syscoreStk; var computek = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenCompuTek; - var computekStk = new Stock(computek, StockSymbols[computek], 0.9, true, 2, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(2000, 5000)); + var computekStk = new Stock(computek, StockSymbols[computek], 0.9, true, 4, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(2000, 5000)); StockMarket[computek] = computekStk; var netlink = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumNetLinkTechnologies; - var netlinkStk = new Stock(netlink, StockSymbols[netlink], 1, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(2000, 4000)); + var netlinkStk = new Stock(netlink, StockSymbols[netlink], 4.2, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(2000, 4000)); StockMarket[netlink] = netlinkStk; var omega = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].IshimaOmegaSoftware; @@ -36862,7 +36921,7 @@ function initStockMarket() { StockMarket[joesguns] = joesgunsStk; var catalyst = "Catalyst Ventures"; - var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.5, true, 14, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000)); + var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.45, true, 13.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000)); StockMarket[catalyst] = catalystStk; var microdyne = "Microdyne Technologies"; @@ -37668,6 +37727,11 @@ function updateStockTicker(stock, increase) { return; } var tickerId = "stock-market-ticker-" + stock.symbol; + + if (stock.playerShares > 0 || stock.playerShortShares > 0) { + updateStockPlayerPosition(stock); + } + var hdr = document.getElementById(tickerId + "-hdr"); if (hdr == null) { @@ -37678,10 +37742,6 @@ function updateStockTicker(stock, increase) { if (increase != null) { increase ? hdr.style.color = "#66ff33" : hdr.style.color = "red"; } - - if (stock.playerShares > 0 || stock.playerShortShares > 0) { - updateStockPlayerPosition(stock); - } } function updateStockPlayerPosition(stock) { @@ -39968,11 +40028,11 @@ function prestigeAugmentation() { if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount) { Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["g" /* initStockMarket */])(); Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["i" /* initSymbolToStockMap */])(); - Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["m" /* setStockMarketContentCreated */])(false); - var stockMarketList = document.getElementById("stock-market-list"); - while(stockMarketList.firstChild) { - stockMarketList.removeChild(stockMarketList.firstChild); - } + } + Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["m" /* setStockMarketContentCreated */])(false); + var stockMarketList = document.getElementById("stock-market-list"); + while(stockMarketList.firstChild) { + stockMarketList.removeChild(stockMarketList.firstChild); } //Gang, in BitNode 2 @@ -40095,9 +40155,20 @@ function prestigeSourceFile() { __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].resetTerminalInput(); __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].loadTerminalContent(); - //Reinitialize flags in case you just finished BN-4 + //Reinitialize Bit Node flags Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__["e" /* initSingularitySFFlags */])(); + //Reset Stock market + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount) { + Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["g" /* initStockMarket */])(); + Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["i" /* initSymbolToStockMap */])(); + } + Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["m" /* setStockMarketContentCreated */])(false); + var stockMarketList = document.getElementById("stock-market-list"); + while(stockMarketList.firstChild) { + stockMarketList.removeChild(stockMarketList.firstChild); + } + //Gain int exp __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainIntelligenceExp(5); } @@ -40652,7 +40723,12 @@ function evaluate(exp, workerScript) { } return Promise.resolve(object[index]); }).catch(function(e) { - return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression")); + if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] || isScriptErrorMessage(e)) { + return Promise.reject(e); + } else { + return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression")); + } + }); } else { try { diff --git a/src/CompanyManagement.js b/src/CompanyManagement.js index 22f1f9505..11d2be85f 100644 --- a/src/CompanyManagement.js +++ b/src/CompanyManagement.js @@ -53,15 +53,15 @@ Industries: - Some Industries let you create your own custom "Products", while others just produce Materials - Each Industry has different characteristics for things - List of Industries: - Energy - Requires hardware, real estate + Energy - Requires metal, hardware Produces Energy - Can Use Hardware/AI Cores to increase production + Can Use Robotics/AI Cores to increase production More real estate = more production with very little dimishing returns Production increased by scientific research High starting cost - Utilities - Requires hardware, Real Estate + Utilities - Requires metal, hardware Produces Water - Can use Hardware, Robotics, and AI Cores to increase production + Can use Robotics, and AI Cores to increase production More real estate = more production with medium diminishing returns Production increased by scientific research High starting cost @@ -84,57 +84,58 @@ Industries: More real estate = more production with medium diminishing returns High starting cost Food - Create your own "restaurant" products - Restaurants require food, water, energy, and real estate + Restaurants require food, water, energy Restaurants in general are high stable demand, but lots of competition, and medium markup Low starting cost Production increase from real estate diminishes greatly in city. e.g. making many restaurants in one city has high diminishing returns, but making a few in every city is good Tobacco - Create your own tobacco products - Requires plants, water, and real estate + Requires plants, water High volatile demand, but not much competition. Low markup Low starting cost Product quality significantly affected by scientific research - Chemical - Create your own chemical products. - Requires plants, energy, water, and real estate + Chemical - Create Chemicals + Requires plants, energy, water High stable demand, high competition, low markup Medium starting cost Advertising does very little Product quality significantly affected by scientific research Pharmaceutical - Create your own drug products - Requires chemicals, energy, water, and real estate + Requires chemicals, energy, water Very high stable demand. High competition, very high markup High starting cost Requires constant creation of new and better products to be successful Product quality significantly affected by scientific research Computer - Creates 'Hardware' material - Requires metal, energy, real estate + Requires metal, energy Can use Robotics/AI Cores to increase production More real estate = more production with high diminishing returns Production significantly affected by scientific research High starting cost Robotics - Create 'Robots' material and create your own 'Robot' products - Requires hardware, energy, and real estate + Requires hardware, energy Production can be improved by using AI Cores Extremely high stable demand, medium competition, high markup Extremely high starting cost Product quality significantly affected by scientific research more real estate = more production with medium diminishing returns for 'Robot' materials Software - Create 'AI Cores' material and create your own software products - Requires hardware, energy, real estate + Requires hardware, energy Very high stable demand, high competition, low markup Low starting cost Product quality slightly affected by scientific research Healthcare - Open your own hospitals (each is its own product). - Requires real estate, robots, AI Cores, energy, water + Requires robots, AI Cores, energy, water Extremely high stable demand, semi-high competition, super high markup Extremely high starting cost Production increase from real estate diminishes greatly in city. e.g. making many hospitals in one city has high diminishing returns, but making a few in every city is goodIn Real Estate - Create 'Real Estate'. Requires metal, energy, water, hardware - Can use Hardware/Robotics/AI Cores to increase production + Can use Robotics/AI Cores to increase production Production slightly affected by scientific research Heavily affected by advertising + Extremely high starting cost Biotechnology - Entertainment - Finance - @@ -207,40 +208,160 @@ Industries: will fluctuate based on company performance. Then you can sell whatever shares you have left on the stock market. */ + +/* Constants */ var TOTALSHARES = 1000000000; //Total number of shares you have at your company +var CyclesPerMarketCycle = 150; +var SecsPerMarketCycle = CyclesPerMarketCycle / 5; +var Cities = [Locations.Aevum, Locations.Chongqing, Locations.Sector12, + Locations.NewTokyo, Locations.Ishima, Locations.Volhaven]; function Material(params={}) { this.name = params.name ? params.name : ""; - this.qty = 0; //Quantity - this.qlt = 0; //Quality - this.dmd = 0; //Demand - this.cmp = 0; //Competition - this.mku = 0; //Markup + this.qty = 0; //Quantity + this.qlt = 0; //Quality, unbounded + this.dmd = 0; //Demand, 0-100? + this.dmdR = 0; //Range of possible demand + this.cmp = 0; //Competition, 0-100 + this.cmpR = 0; //Range of possible competition + this.mv = 0; //Maximum Volatility of stats - //How much space it takes in a Warehouse - this.siz = params.size ? params.size : 0; + //Markup. Determines how high of a price you can charge on the material + //compared to the market price (bCost) based on quality + //Quality is divided by this to determine markup limits + //e.g if mku is 10 and quality is 100 then you can mark up prices by 100/10 = 10 + //without consequences + this.mku = 0; - this.purc = 0; //How much of this material is being purchased per second - this.cost = 0; //$ Cost per material + this.buy = 0; //How much of this material is being bought per second + this.sll = 0; //How much of this material is being sold per second + this.prd = 0; //How much of this material is being produced per second + this.exp = []; //Exports of this material to another warehouse/industry + this.bCost = 0; //$ Cost/sec to buy material + this.sCost = 0; //$ Cost/sec to sell material - //Material requirements. An object that maps the name of a material to how much it requires - //to make 1 unit of the product. - this.req = params.req ? params.req : {}; + this.prdman = [false, 0]; //Production for this material is manually limited + this.sllman = [false, 0]; //Sale of this material is manually limited } -var Materials = { - Water: new Material({name: "Water", size: 0.1}), - Energy: new Material - Food: 13, - Plants: 14, - Metal: 15, - Hardware: 16, - Chemicals: 17, - RealEstate: 18, - Drugs: 19, - Robots: 20, - AICores:21, - SciResearch: 22 +Material.prototype.init = function(mats={}) { + switch(this.name) { + case "Water": + this.dmd = 75; this.dmdR = [65, 85]; + this.cmp = 50; this.cmpR = [40, 60]; + this.bCost = 100; this.mv = 0.3; + this.mku = 25; + break; + case "Energy": + this.dmd = 90; this.dmdR = [80, 100]; + this.cmp = 80; this.cmpR = [65, 95]; + this.bCost = 250; this.mv = 0.3; + this.mku = 25; + break; + case "Food": + this.dmd = 80; this.dmdR = [70, 90]; + this.cmp = 60; this.cmpR = [35, 85]; + this.bCost = 500; this.mv = 1.5; + this.mku = 15; + break; + case "Plants": + this.dmd = 70; this.dmdR = [20, 90]; + this.cmp = 50; this.cmpR = [30, 70]; + this.bCost = 300; this.mv = 0.9; + this.mku = 20; + break; + case "Metal": + this.dmd = 80; this.dmdR = [75, 85]; + this.cmp = 70; this.cmpR = [60, 80]; + this.bCost = 250; this.mv = 1.5; + this.mku = 25; + break; + case "Hardware": + this.dmd = 85; this.dmdR = [80, 90]; + this.cmp = 80; this.cmpR = [65, 95]; + this.bCost = 1000; this.mv = 1.2; + this.mku = 12; + break; + case "Chemicals": + this.dmd = 55; this.dmdR = [40, 70]; + this.cmp = 60; this.cmpR = [40, 80]; + this.bCost = 750; this.mv = 1.8; + this.mku = 14; + break; + case "Real Estate": + this.dmd = 50; this.dmdR = [5, 100]; + this.cmp = 50; this.cmpR = [25, 75]; + this.bCost = 1500; this.mv = 2.5; + this.mku = 11; + break; + case "Drugs": + this.dmd = 60; this.dmdR = [45, 75]; + this.cmp = 70; this.cmpR = [40, 100]; + this.bCost = 800; this.mv = 2.2; + this.mku = 10; + break; + case "Robots": + this.dmd = 90; this.dmdR = [80, 100]; + this.cmp = 90; this.cmpR = [80, 100]; + this.bCost = 2000; this.mv = 1.2; + this.mku = 5; + break; + case "AI Cores": + this.dmd = 90; this.dmdR = [80, 100]; + this.cmp = 90; this.cmpR = [80, 100]; + this.bCost = 2500; this.mv = 1.6; + this.mku = 4 + break; + default: + console.log("Invalid material type in init(): " + this.name); + break; + } +} + +//Process change in demand, competition, and buy cost of this material +Material.prototype.processMarket = function() { + //This 1st random check determines whether competition increases or decreases + //More competition = lower market price + var v = (Math.random() * this.mv) / 100; + var pv = (Math.random() * this.mv) / 100; + if (Math.random() < 0.42) { + this.cmp *= (1+v); + this.cmp > this.cmpR[1] ? this.cmp = this.cmpR[1]; + this.bCost *= (1-pv); + } else { + this.cmp *= (1-v); + this.cmp < this.cmpR[0] ? this.cmp = this.cmpR[0]; + this.bCost *= (1+pv); + } + + //This 2nd random check determines whether demand increases or decreases + //More demand = higher market price + v = (Math.random() * this.mv) / 100; + pv = (Math.random() * this.mv) / 100; + if (Math.random() < 0.45) { + this.dmd *= (1+v); + this.dmd > this.dmdR[1] ? this.dmd = this.dmdR[1]; + this.bCost *= (1+pv); + } else { + this.dmd *= (1-v); + this.dmd < this.dmdR[0] ? this.dmd = this.dmdR[0]; + this.bCost *= (1-pv); + } + +} + +//Map of material (by name) to their sizes (how much space it takes in warehouse) +let MaterialSizes = { + Water: 0.05, + Energy: 0.01, + Food: 0.03, + Plants: 0.05, + Metal: 0.1, + Hardware: 0.06, + Chemicals: 0.05, + Drugs: 0.02, + Robots: 0.5, + "AI Cores": 0.1 } function Product(params={}) { @@ -249,15 +370,24 @@ function Product(params={}) { this.dmd = params.demand ? params.demand : 0; this.cmp = params.competition ? params.competition : 0; this.mku = params.markup ? params.markup : 0; + + //Aggregate score for quality based on the other properties below + //The weighting of the other properties (performance, durability) + //differs between industries this.qlt = params.quality ? params.quality : 0; + this.qty = 0; this.per = params.performance ? params.performance : 0; this.dur = params.durability ? params.durability : 0; this.rel = params.reliability ? params.reliability : 0; this.aes = params.aesthetics ? params.aesthetics : 0; this.fea = params.features ? params.features : 0; + + //Only applicable for certain products like Restaurants this.loc = params.location ? params.location : ""; - this.siz = params.size ? params.size : 0; //How much space it takes in the warehouse + + //How much space it takes in the warehouse. Not applicable for all products + this.siz = params.size ? params.size : 0; //Material requirements. An object that maps the name of a material to how much it requires //to make 1 unit of the product. @@ -283,6 +413,9 @@ var Industries = { function Industry(params={}) { "use strict" + if (params.company == null) { + throw new Error("ERROR: Industry being created without a parent company"); + } this.offices = { //Maps locations to offices. 0 if no office at that location Locations.Aevum: 0, Locations.Chonqing: 0, @@ -302,24 +435,40 @@ function Industry(params={}) { }; this.type = params.type ? params.type : 0; - this.materials = {}; //Contains both materials that are created and required + + this.sciResearch = new Material({name: "Scientific Research"}); + + //A map of the NAME of materials required to create produced materials to + //how many are needed to produce 1 unit of produced materials + this.reqMats = {}; + + //An array of the name of materials being produced + this.prodMats = []; + this.products = {}; this.awareness = 0; - this.popularity = 0; + this.popularity = 0; //Should always be less than awareness this.startingCost = 0; /* The following are factors for how much production/other things are increased by different factors. The production increase always has diminishing returns, - and they are all reprsented by inverse exponentials. - The number for these properties represent the denominator in the inverse - exponential (aka higher number = more diminishing returns); */ + and they are all reprsented by exponentials of < 1 (e.g x ^ 0.5, x ^ 0.8) + The number for these represent the exponential. A lower number means more + diminishing returns */ this.reFac = 0; //Real estate Factor - this.sciFac = 0; //Scientific Research Factor + this.sciFac = 0; //Scientific Research Factor, affects quality this.hwFac = 0; //Hardware factor this.robFac = 0; //Robotics Factor this.aiFac = 0; //AI Cores factor; - this.advFac = 0; //Advertising factor + this.advFac = 0; //Advertising factor, affects sales + + this.prodMult = 0; //Production multiplier + + //Financials + this.funds = new Decimal(0); + this.revenue = new Decimal(0); + this.expenses = new Decimal(0); this.init(); } @@ -328,39 +477,435 @@ Industry.prototype.init = function() { //Set the unique properties of an industry (how much its affected by real estate/scientific research, etc.) switch (this.type) { case Industries.Energy: + this.reFac = 0.75; + this.sciFac = 0.8; + this.robFac = 0.1; + this.aiFac = 0.4; + this.advFac = 0.25; + this.startingCost = 200e9; + this.reqMats = { + "Hardware": 0.1, + "Metal": 0.25, + }; + this.prodMats = ["Energy"]; break; case Industries.Utilities: + this.reFac = 0.5; + this.sciFac = 0.7; + this.robFac = 0.4; + this.aiFac = 0.4; + this.advFac = 0.3; + this.startingCost = 125e9; + this.reqMats = { + "Hardware": 0.1, + "Metal": 0.2, + } + this.prodMats = ["Water"]; break; case Industries.Agriculture: + this.reFac = 0.9; + this.sciFac = 0.6; + this.hwFac = 0.3; + this.robFac = 0.4; + this.aiFac = 0.4; + this.advFac = 0.1; + this.startingCost = 30e9; + this.reqMats = { + "Water": 0.5, + "Energy": 0.5, + } + this.prodMats = ["Plants", "Food"]; break; case Industries.Fishing: + this.reFac = 0.15; + this.sciFac = 0.4; + this.hwFac = 0.4; + this.robFac = 0.6; + this.aiFac = 0.25; + this.advFac = 0.2; + this.startingCost = 60e9; + this.reqMats = { + "Energy": 0.5, + } + this.prodMats = ["Food"]; break; case Industries.Mining: + this.reFac = 0.4; + this.sciFac = 0.35; + this.hwFac = 0.5; + this.robFac = 0.6; + this.aiFac = 0.6; + this.advFac = 0.1; + this.startingCost = 300e9; + this.reqMats = { + "Energy": 0.8, + } + this.prodMats = ["Metal"]; break; case Industries.Food: + //reFac is unique for this bc it diminishes greatly per city. Handle this separately in code? + this.sciFac = 0.15; + this.hwFac = 0.2; + this.robFac = 0.4; + this.aiFac = 0.35; + this.advFac = 0.85; + this.startingCost = 5e9; + this.reqMats = { + "Food": 0.5, + "Water": 0.5, + "Energy": 0.2, + } break; case Industries.Tobacco: + this.reFac = 0.2; + this.sciFac = 0.85; + this.hwFac = 0.2; + this.robFac = 0.25; + this.aiFac = 0.2; + this.advFac = 0.7; + this.startingCost = 10e9; + this.reqMats = { + "Plants": 1, + "Water": 0.2, + } break; case Industries.Chemical: + this.reFac = 0.3; + this.sciFac = 0.85; + this.hwFac = 0.2; + this.robFac = 0.3; + this.aiFac = 0.2; + this.advFac = 0.15; + this.startingCost = 70e9; + this.reqMats = { + "Plants": 1, + "Energy": 0.5, + "Water": 0.5, + } + this.prodMats = ["Chemicals"]; break; case Industries.Pharmaceutical: + this.reFac = 0.1; + this.sciFac = 0.9; + this.hwFac = 0.2; + this.robFac = 0.3; + this.aiFac = 0.25; + this.advFac = 0.65; + this.startingCost = 150e9; + this.reqMats = { + "Chemicals": 2, + "Energy": 1, + "Water": 0.5, + } + this.prodMats = ["Drugs"]; break; case Industries.Computer: + this.reFac = 0.25; + this.sciFac = 0.75; + this.robFac = 0.5; + this.aiFac = 0.3; + this.advFac = 0.6; + this.startingCost = 200e9; + this.reqMats = { + "Metal": 2.5, + "Energy": 1, + } + this.prodMats = ["Hardware"]; break; case Industries.Robotics: + this.reFac = 0.45; + this.sciFac = 0.8; + this.aiFac = 0.5; + this.advFac = 0.7; + this.startingCost = 1e12; + this.reqMats = { + "Hardware": 5, + "Energy": 3, + } + this.prodMats = ["Robots"]; break; case Industries.Software: + this.sciFac = 0.8; + this.advFac = 0.6; + this.startingCost = 10e9; + this.reqMats = { + "Hardware": 0.5, + "Energy": 1, + } + this.prodMats = ["AI Cores"]; break; case Industries.Healthcare: + //reFac is unique for this bc it diminishes greatly per city. Handle this separately in code? + this.sciFac = 0.85; + this.advFac = 0.4; + this.startingCost = 750e9; + this.reqMats = { + "Robots": 10, + "AI Cores": 5, + "Energy": 5, + "Water": 5, + } break; case Industries.RealEstate: + this.robFac = 0.7; + this.aiFac = 0.7; + this.advFac = 0.75; + this.startingCost = 600e9; + this.reqMats = { + "Metal": 20, + "Energy": 10, + "Water": 10, + "Hardware": 5 + } + this.prodMats = ["Real Estate"]; break; default: - console.log("ERR: Invalid Industry Type passed into Industry.init()"); + console.log("ERR: Invalid Industry Type passed into Industry.init(): " + this.type); return; } } +//Calculates the values that factor into the production and properties of +//materials/products (such as quality, etc.) +Industry.prototype.calculateProductionFactors = function(city) { + var warehouse = this.warehouses[city], materials = warehouse.materials, + office = this.offices[city]; + //Production is multiplied by this + this.prodMult = Math.pow(0.1 * materials.RealEstate, this.reFac) * + Math.pow(0.1 * materials.Hardware, this.hwFac) * + Math.pow(0.1 * materials.Robots, this.robFac) * + Math.pow(0.1 * materials.AICores, this.aiFac); + this.prodMult += 1; +} + +Industry.prototype.updateWarehouseSizeUsed = function(city) { + var warehouse = this.warehouses[city]; + if (warehouse instanceof Warehouse) { + //This resets the size back to 1 and accounts for materials + warehouse.updateWarehouseSizeUsed(); + } + //TODO Account for products +} + +Industry.prototype.process = function(numCycles=1) { + //Process change in demand/competition of materials/products + + //Determine production of materials/products (including their quality) + + //Determine sale of materials/products (how many sell) +} + +//Process change in demand and competition for this industry's materials +Industry.prototype.processMaterialMarket = function(marketCycles=1) { + //References to prodMats and reqMats + var reqMats = this.reqMats, prodMats = this.prodMats; + + //Only 'process the market' for materials that this industry deals with + for (var i = 0; i < Cities.length; ++i) { + //If this industry has a warehouse in this city, process the market + //for every material this industry requires or produces + if (this.warehouses[Cities[i]] instanceof Warehouse) { + var wh = this.warehouses[Cities[i]]; + for (var name in reqMats) { + if (reqMats.hasOwnProperty(name)) { + wh.materials[name].processMarket(); + } + } + for (var name in prodMats) { + if (prodMats.hasOwnProperty(name)) { + wh.materials[name].processMarket(); + } + } + } + } +} + +//Process change in demand and competition for this industry's products +Industry.prototype.processProductMarket = function(marketCycles=1) { + //Demand gradually decreases, and competition gradually increases + for (var name in this.products) { + if (this.products.hasOwnProperty(name)) { + var product = this.products[name]; + var change = getRandomInt(1, 5) * 0.001; + if (this.type === Industries.Pharmaceutical || this.type === Industries.Software || + this.type === Industries.Robotics) { + change *= 2.5; + } + product.dmd -= change; + product.cmp += change; + } + } +} + +//Calculate employee producitivity values, which are unique per office +Industry.prototype.processEmployeeProductivity = function(marketCycles=1) { + for (var i = 0; i < Cities.length; ++i) { + var city = Cities[i]; + if (this.offices[city] instanceof OfficeSpace) { + this.offices[city].calculateEmployeeProductivity(); + } else { + console.log("ERROR: calling Industry.processEmployeeProductivity() for an office that doesn't exist"); + } + } +} + +//Process production, purchase, and import/export of materials +Industry.prototype.processMaterials = function(marketCycles=1) { + for (var i = 0; i < Cities.length; ++i) { + var city = Cities[i], office = this.offices[city]; + this.calculateProductionFactors(city); //TODO Should this go here? + + if (this.warehouses[city] instanceof Warehouse) { + var warehouse = this.warehouses[city]; + /* Process purchase of materials */ + for (var matName in warehouse.materials) { + if (warehouse.materials.hasOwnProperty(matName)) { + var mat = warehouse.materials[matName]; + var buyAmt = (mat.buy * SecsPerMarketCycle * marketCycles); + var maxAmt = Math.floor((warehouse.size - warehouse.sizedUsed) / MaterialSizes[matName]); + var buyAmt = Math.min(buyAmt, maxAmt); + if (buyAmt > 0) { + mat.qty += buyAmt; + this.funds = this.funds.minus(buyAmt * mat.bCost); + } + } + } //End process purchase of materials + + warehouse.updateSizeUsed(); + + /* Process production of materials */ + if (this.prodMats.length > 0) { + var mat = warehouse.materials[this.prodMats[0]]; + //Calculate the maximum production of this material based + //on the office's productivity + var total = office.employeeProd[EmployeePositions.Operations] + + office.employeeProd[EmployeePositions.Engineer] + + office.employeeProd[EmployeePositions.Management]; + var ratio = (office.employeeProd[EmployeePositions.Operations] / total) * + (office.employeeProd[EmployeePositions.Engineer] / total) * + (office.employeeProd[EmployeePositions.Management] / total); + var maxProd = ratio * (0.5 * total), prod; + + if (mat.prdman[0]) { + //Production is manually limited + prod = Math.min(maxProd, mat.prdman[1]); + } else { + prod = maxProd; + } + prod *= (SecsPerMarketCycle * marketCycles); //Convert production from per second to per market cycle + + //Calculate net change in warehouse storage making + //the produced materials will cost + var totalMatSize = 0; + for (var tmp = 0; tmp < this.prodMats.length; ++tmp) + totalMatSize += MaterialSizes[this.prodMats[tmp]]; + } + for (var reqMatName in this.reqMats) { + if (this.reqMats.hasOwnProperty(reqMatName)) { + var normQty = this.reqMats[reqMatName]; + totalMatSize -= (MaterialSizes[reqMatName] * normQty); + } + } + //If not enough space in warehouse, limit the amount of produced + //materials + if (totalMatSize > 0) { + var maxAmt = Math.floor((warehouse.size - warehouse.sizedUsed) / totalMatSize); + prod = Math.min(maxAmt, prod); + } + + //Make sure we have enough resource to make our materials + var producableFrac = 1; + for (var reqMatName in this.reqMats) { + if (this.reqMats.hasOwnProperty(reqMatName)) { + var req = this.reqMats[reqMatName] * prod; + if (warehouse[reqMatName].qty < req) { + producableFrac = Math.min(producableFrac, warehouse[reqMatName].qty / req); + } + } + } + + //Make our materials if they are producable + if (producableFrac > 0) { + for (var reqMatName in this.reqMats) { + if (this.reqMats.hasOwnProperty(reqMatName)) { + warehouse[reqMatName].qty -= (this.reqMats[reqMatName] * prod * producableFrac); + } + } + for (var j = 0; j < this.prodMats.length; ++j) { + warehouse[this.prodMats[j]].qty += (prod * producableFrac * this.prodMult); + warehouse[this.prodMats[j]].qlt = + (office.employeeProd[EmployeePositions.Engineer] + + Math.pow(this.sciResearch, this.sciFac) + + Math.pow(materials.AICores, this.aiFac) / 10e3; + } + } + //Per second + mat.prd = prod * producableFrac * this.prodMult / (SecsPerMarketCycle * marketCycles); + } + + /* Process sale of materials */ + for (var matName in warehouse.materials) { + if (warehouse.materials.hasOwnProperty(matName)) { + var mat = warehouse.materials[matName]; + + //Calculate how much of the material sells (per second) + var markup = 1, markupLimit = mat.qlt / mat.mku; + if (mat.sCost > mat.bCost) { + //Penalty if difference between sCost and bCost is greater than markup limit + if ((mat.sCost - mat.bCost) > markupLimit) { + markup = markupLimit / (mat.sCost - mat.bCost); + } + } + var maxSell = mat.qlt * mat.dmd * (1 - mat.cmp) * + (this.popularity / this.awareness) * markup; + var sellAmt; + if (mat.sllman[0]) { + //Sell amount is manually limited + sellAmt = Math.min(maxSell, mat.sllman[1]); + } + sellAmt = (sellAmt * SecsPerMarketCycle * marketCycles); + sellAmt = Math.min(mat.qty, sellAmt); + if (sellAmt && mat.sCost) { + mat.qty -= sellAmt; + this.funds = this.funds.plus(sellAmt * mat.sCost); + mat.sll = sellAmt / (SecsPerMarketCycle * marketCycles); + } else { + mat.sll = 0; + } + } + } //End processing of sale of materials + + warehouse.updateSizeUsed(); + + /* TODO Process Export of materials */ + + } // End warehouse + + //Produce Scientific Research based on R&D employees + //Scientific Research can be produced without a warehouse + this.sciResearch += (0.01 * office.employeeProd[EmployeePositions.RandD]); + } +} + +//Process this industry's producton of products (including all of their stats) +Industry.prototype.processProducts = function(marketCycles=1) { + for (var i = 0; i < Cities.length; ++i) { + var city = Cities[i], office = this.offices[city]; + + if (this.warehouses[city] instanceof Warehouse) { + var warehouse = this.warehouses[city]; + + //Process production of products + var total = + } + + } +} + +Industry.prototype.processProduct = function(marketCycles=1, product) { + +} + var EmployeePositions = { Operations: 1, Engineer: 2, @@ -386,11 +931,45 @@ function Employee(params={}) { this.cre = params.creativity ? params.creativity : getRandomInt(10, 50); this.eff = params.efficiency ? params.efficiency : getRandomInt(10, 50); this.sal = params.salary ? params.salary : getRandomInt(0.1, 5); - this.pro = 0; //Calculated + this.pro = 0; //Productivity, This is calculated this.off = params.officeSpace ? params.officeSpace : {}; this.loc = params.officeSpace ? params.officeSpace.loc : ""; - this.pos = 0; + this.pos = params.position ? params.position : EmployeePositions.Operations; +} + +Employee.prototype.calculateProductivity = function() { + var prodBase = this.mor * this.hap * this.ene, prodMult; + switch(this.pos) { + //Calculate productivity based on position. This is multipled by prodBase + //to get final value + EmployeePositions.Operations: + prodMult = (0.6 * this.int) + (0.1 * this.cha) + (this.exp) + + (0.5 * this.cre) + (this.eff); + break; + EmployeePositions.Engineer: + prodMult = (this.int) + (0.1 * this.cha) + (1.5 * this.exp) + + (this.eff); + break; + EmployeePositions.Business: + prodMult = (0.4 * this.int) + (this.cha) + (0.5 * this.exp); + break; + EmployeePositions.Accounting: + prodMult = (0.25 * this.int) + (0.5 * this.exp) + (this.eff); + break; + EmployeePositions.Management: + prodMult = (2 * this.cha) + (this.exp) + (0.2 * this.cre) + + (0.7 * this.eff); + break; + EmployeePositions.RandD: + prodMult = (1.5 * this.int) + (0.8 * this.exp) + (this.cre) + + (0.5 * this.eff); + break; + default: + console.log("Invalid employee position: " + this.pos); + break; + } + return prodBase * prodMult; } var OfficeSpaceTiers = { @@ -409,26 +988,79 @@ function OfficeSpace(params={}) { this.beau = parms.beauty ? params.beauty : 1; this.tier = OfficeSpaceTiers.Basic; this.employees = []; + this.employeeProd = { + EmployeePositions.Operations: 0, + EmployeePositions.Engineer: 0, + EmployeePositions.Business: 0, + EmployeePositions.Accounting: 0, + EmployeePositions.Management: 0, + EmployeePositions.RandD:0, + }; +} + +OfficeSpace.prototype.calculateEmployeeProductivity = function(marketCycles=1) { + //Reset + for (var name in this.employeeProd) { + if (this.employeeProd.hasOwnProperty(name)) { + this.employeeProd[name] = 0; + } + } + + for (var i = 0; i < this.employees.length; ++i) { + var employee = this.employees[i]; + var prod = employee.calculateProductivity(); + this.employeeProd[employee.pos] += prod; + } } function Warehouse(params={}) { "use strict" this.loc = params.loc ? params.loc : ""; this.size = params.size ? params.size : 0; + this.sizeUsed = 0; - this.materials = {}; - this.products = {}; + this.materials = { + Water: new Material({name: "Water"}), + Energy: new Material({name: "Energy"}), + Food: new Material({name: "Food"}), + Plants: new Material({name: "Plants"}), + Metal: new Material({name: "Metal"}), + Hardware: new Material({name: "Hardware"}), + Chemicals: new Material({name: "Chemicals"}), + Drugs: new Material({name: "Drugs"}), + Robots: new Material({name: "Robots"}), + AICores: new Material({name: "AI Cores"}), + RealEstate: new Material({name: "Real Estate"}) + } } -function Company() { - "use strict" +Warehouse.prototype.updateMaterialSizeUsed = function() { + this.sizeUsed = 0; + for (var matName in this.materials) { + if (this.materials.hasOwnProperty(matName)) { + var mat = this.materials[matName]; + this.sizeUsed += (mat.qty * MaterialSizes[mat.name]); + } + } + if (this.sizeUsed > this.size) { + console.log("ERROR: Warehouse sized used greater than capacity, something went wrong"); + } + //After this function is called, the Industry owning this Warehouse will call + //its own updateWarehouseSizeUsed function which accounts for products +} - this.industries = []; +function Company(params={}) { + "use strict" + this.name = params.name ? params.name : "The Company"; + + //A division/business sector is represented by the object: + //{name: "NAME HERE", industry: INDUSTRY OBJECT} + this.divisions = []; //Financial stats - this.funds = 0; - this.revenue = 0; - this.expenses = 0; + this.funds = new Decimal(0); + this.revenue = new Decimal(0); + this.expenses = new Decimal(0); this.valuation = 0; //Private investory valuation of company before you go public. this.numShares = TOTALSHARES; this.sharePrice = 0; diff --git a/src/Constants.js b/src/Constants.js index fd6c62312..d1564dea9 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -106,12 +106,12 @@ let CONSTANTS = { InfiltrationRepValue: 1.4, //Convert "secret" value to faction reputation //Stock market constants - WSEAccountCost: 200000000, - TIXAPICost: 5000000000, - StockMarketCommission: 100000, + WSEAccountCost: 200e6, + TIXAPICost: 5e9, + StockMarketCommission: 100e3, //Hospital/Health - HospitalCostPerHp: 100000, + HospitalCostPerHp: 100e3, //Intelligence-related constants IntelligenceCrimeWeight: 0.05, //Weight for how much int affects crime success rates diff --git a/src/Faction.js b/src/Faction.js index f024779a2..4f70faaeb 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -515,7 +515,8 @@ function displayFactionContent(factionName) { var newPurchaseAugmentationsButton = clearEventListeners("faction-purchase-augmentations"); newPurchaseAugmentationsButton.addEventListener("click", function() { Engine.hideAllContent(); - Engine.Display.factionAugmentationsContent.style.visibility = "visible"; + //Engine.Display.factionAugmentationsContent.style.visibility = "visible"; + Engine.Display.factionAugmentationsContent.style.display = "block"; var newBackButton = clearEventListeners("faction-augmentations-back-button"); newBackButton.addEventListener("click", function() { diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js index aa336473f..2e9405bf9 100644 --- a/src/NetscriptEvaluator.js +++ b/src/NetscriptEvaluator.js @@ -172,7 +172,12 @@ function evaluate(exp, workerScript) { } return Promise.resolve(object[index]); }).catch(function(e) { - return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression")); + if (e instanceof WorkerScript || isScriptErrorMessage(e)) { + return Promise.reject(e); + } else { + return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression")); + } + }); } else { try { diff --git a/src/Prestige.js b/src/Prestige.js index 65c8f907f..9fdf2ce0c 100644 --- a/src/Prestige.js +++ b/src/Prestige.js @@ -101,11 +101,11 @@ function prestigeAugmentation() { if (Player.hasWseAccount) { initStockMarket(); initSymbolToStockMap(); - setStockMarketContentCreated(false); - var stockMarketList = document.getElementById("stock-market-list"); - while(stockMarketList.firstChild) { - stockMarketList.removeChild(stockMarketList.firstChild); - } + } + setStockMarketContentCreated(false); + var stockMarketList = document.getElementById("stock-market-list"); + while(stockMarketList.firstChild) { + stockMarketList.removeChild(stockMarketList.firstChild); } //Gang, in BitNode 2 @@ -228,9 +228,20 @@ function prestigeSourceFile() { Terminal.resetTerminalInput(); Engine.loadTerminalContent(); - //Reinitialize flags in case you just finished BN-4 + //Reinitialize Bit Node flags initSingularitySFFlags(); + //Reset Stock market + if (Player.hasWseAccount) { + initStockMarket(); + initSymbolToStockMap(); + } + setStockMarketContentCreated(false); + var stockMarketList = document.getElementById("stock-market-list"); + while(stockMarketList.firstChild) { + stockMarketList.removeChild(stockMarketList.firstChild); + } + //Gain int exp Player.gainIntelligenceExp(5); } diff --git a/src/StockMarket.js b/src/StockMarket.js index 13f51a246..27df39b3c 100644 --- a/src/StockMarket.js +++ b/src/StockMarket.js @@ -269,7 +269,7 @@ function initStockMarket() { StockMarket[omnitek] = omnitekStk; var foursigma = Locations.Sector12FourSigma; - var foursigmaStk = new Stock(foursigma, StockSymbols[foursigma], 1.05, true, 18, getRandomInt(60000, 70000)); + var foursigmaStk = new Stock(foursigma, StockSymbols[foursigma], 1.05, true, 17, getRandomInt(60000, 70000)); StockMarket[foursigma] = foursigmaStk; var kuaigong = Locations.ChongqingKuaiGongInternational; @@ -325,7 +325,7 @@ function initStockMarket() { StockMarket[nova] = novaStk; var watchdog = Locations.AevumWatchdogSecurity; - var watchdogStk = new Stock(watchdog, StockSymbols[watchdog], 1, true, 1.5, getRandomInt(5000, 7500)); + var watchdogStk = new Stock(watchdog, StockSymbols[watchdog], 2.5, true, 1.5, getRandomInt(5000, 7500)); StockMarket[watchdog] = watchdogStk; var lexocorp = Locations.VolhavenLexoCorp; @@ -341,15 +341,15 @@ function initStockMarket() { StockMarket[alpha] = alphaStk; var syscore = Locations.VolhavenSysCoreSecurities; - var syscoreStk = new Stock(syscore, StockSymbols[syscore], 1.25, true, 2, getRandomInt(4000, 7000)) + var syscoreStk = new Stock(syscore, StockSymbols[syscore], 1.6, true, 3, getRandomInt(4000, 7000)) StockMarket[syscore] = syscoreStk; var computek = Locations.VolhavenCompuTek; - var computekStk = new Stock(computek, StockSymbols[computek], 0.9, true, 2, getRandomInt(2000, 5000)); + var computekStk = new Stock(computek, StockSymbols[computek], 0.9, true, 4, getRandomInt(2000, 5000)); StockMarket[computek] = computekStk; var netlink = Locations.AevumNetLinkTechnologies; - var netlinkStk = new Stock(netlink, StockSymbols[netlink], 1, true, 1, getRandomInt(2000, 4000)); + var netlinkStk = new Stock(netlink, StockSymbols[netlink], 4.2, true, 1, getRandomInt(2000, 4000)); StockMarket[netlink] = netlinkStk; var omega = Locations.IshimaOmegaSoftware; @@ -369,7 +369,7 @@ function initStockMarket() { StockMarket[joesguns] = joesgunsStk; var catalyst = "Catalyst Ventures"; - var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.5, true, 14, getRandomInt(500, 1000)); + var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.45, true, 13.5, getRandomInt(500, 1000)); StockMarket[catalyst] = catalystStk; var microdyne = "Microdyne Technologies"; @@ -1175,6 +1175,11 @@ function updateStockTicker(stock, increase) { return; } var tickerId = "stock-market-ticker-" + stock.symbol; + + if (stock.playerShares > 0 || stock.playerShortShares > 0) { + updateStockPlayerPosition(stock); + } + var hdr = document.getElementById(tickerId + "-hdr"); if (hdr == null) { @@ -1185,10 +1190,6 @@ function updateStockTicker(stock, increase) { if (increase != null) { increase ? hdr.style.color = "#66ff33" : hdr.style.color = "red"; } - - if (stock.playerShares > 0 || stock.playerShortShares > 0) { - updateStockPlayerPosition(stock); - } } function updateStockPlayerPosition(stock) { diff --git a/src/engine.js b/src/engine.js index 839229ab3..30f4ac01c 100644 --- a/src/engine.js +++ b/src/engine.js @@ -217,14 +217,16 @@ let Engine = { /* Load content when a main menu button is clicked */ loadTerminalContent: function() { Engine.hideAllContent(); - Engine.Display.terminalContent.style.visibility = "visible"; + //Engine.Display.terminalContent.style.display = "none"; + Engine.Display.terminalContent.style.display = "block"; Engine.currentPage = Engine.Page.Terminal; document.getElementById("terminal-menu-link").classList.add("active"); }, loadCharacterContent: function() { Engine.hideAllContent(); - Engine.Display.characterContent.style.visibility = "visible"; + //Engine.Display.characterContent.style.visibility = "visible"; + Engine.Display.characterContent.style.display = "block"; Engine.displayCharacterInfo(); Engine.currentPage = Engine.Page.CharacterInfo; document.getElementById("stats-menu-link").classList.add("active"); @@ -232,7 +234,8 @@ let Engine = { loadScriptEditorContent: function(filename = "", code = "") { Engine.hideAllContent(); - Engine.Display.scriptEditorContent.style.visibility = "visible"; + //Engine.Display.scriptEditorContent.style.visibility = "visible"; + Engine.Display.scriptEditorContent.style.display = "block"; var editor = ace.edit('javascript-editor'); if (filename != "") { document.getElementById("script-editor-filename").value = filename; @@ -246,7 +249,8 @@ let Engine = { loadActiveScriptsContent: function() { Engine.hideAllContent(); - Engine.Display.activeScriptsContent.style.visibility = "visible"; + //Engine.Display.activeScriptsContent.style.visibility = "visible"; + Engine.Display.activeScriptsContent.style.display = "block"; setActiveScriptsClickHandlers(); updateActiveScriptsItems(); Engine.currentPage = Engine.Page.ActiveScripts; @@ -255,7 +259,8 @@ let Engine = { loadHacknetNodesContent: function() { Engine.hideAllContent(); - Engine.Display.hacknetNodesContent.style.visibility = "visible"; + //Engine.Display.hacknetNodesContent.style.visibility = "visible"; + Engine.Display.hacknetNodesContent.style.display = "block"; displayHacknetNodesContent(); Engine.currentPage = Engine.Page.HacknetNodes; document.getElementById("hacknet-nodes-menu-link").classList.add("active"); @@ -263,7 +268,8 @@ let Engine = { loadWorldContent: function() { Engine.hideAllContent(); - Engine.Display.worldContent.style.visibility = "visible"; + //Engine.Display.worldContent.style.visibility = "visible"; + Engine.Display.worldContent.style.display = "block"; Engine.displayWorldInfo(); Engine.currentPage = Engine.Page.World; document.getElementById("city-menu-link").classList.add("active"); @@ -271,7 +277,8 @@ let Engine = { loadCreateProgramContent: function() { Engine.hideAllContent(); - Engine.Display.createProgramContent.style.visibility = "visible"; + //Engine.Display.createProgramContent.style.visibility = "visible"; + Engine.Display.createProgramContent.style.display = "block"; displayCreateProgramContent(); Engine.currentPage = Engine.Page.CreateProgram; document.getElementById("create-program-menu-link").classList.add("active"); @@ -279,7 +286,8 @@ let Engine = { loadFactionsContent: function() { Engine.hideAllContent(); - Engine.Display.factionsContent.style.visibility = "visible"; + //Engine.Display.factionsContent.style.visibility = "visible"; + Engine.Display.factionsContent.style.display = "block"; Engine.displayFactionsInfo(); Engine.currentPage = Engine.Page.Factions; document.getElementById("factions-menu-link").classList.add("active"); @@ -287,13 +295,15 @@ let Engine = { loadFactionContent: function() { Engine.hideAllContent(); - Engine.Display.factionContent.style.visibility = "visible"; + //Engine.Display.factionContent.style.visibility = "visible"; + Engine.Display.factionContent.style.display = "block"; Engine.currentPage = Engine.Page.Faction; }, loadAugmentationsContent: function() { Engine.hideAllContent(); - Engine.Display.augmentationsContent.style.visibility = "visible"; + //Engine.Display.augmentationsContent.style.visibility = "visible"; + Engine.Display.augmentationsContent.style.display = "block"; Engine.displayAugmentationsContent(); Engine.currentPage = Engine.Page.Augmentations; document.getElementById("augmentations-menu-link").classList.add("active"); @@ -301,7 +311,8 @@ let Engine = { loadTutorialContent: function() { Engine.hideAllContent(); - Engine.Display.tutorialContent.style.visibility = "visible"; + //Engine.Display.tutorialContent.style.visibility = "visible"; + Engine.Display.tutorialContent.style.display = "block"; Engine.displayTutorialContent(); Engine.currentPage = Engine.Page.Tutorial; document.getElementById("tutorial-menu-link").classList.add("active"); @@ -309,7 +320,8 @@ let Engine = { loadLocationContent: function() { Engine.hideAllContent(); - Engine.Display.locationContent.style.visibility = "visible"; + //Engine.Display.locationContent.style.visibility = "visible"; + Engine.Display.locationContent.style.display = "block"; displayLocationContent(); Engine.currentPage = Engine.Page.Location; }, @@ -354,8 +366,10 @@ let Engine = { loadWorkInProgressContent: function() { Engine.hideAllContent(); var mainMenu = document.getElementById("mainmenu-container"); + //mainMenu.style.visibility = "hidden"; mainMenu.style.visibility = "hidden"; - Engine.Display.workInProgressContent.style.visibility = "visible"; + //Engine.Display.workInProgressContent.style.visibility = "visible"; + Engine.Display.workInProgressContent.style.display = "block"; Engine.currentPage = Engine.Page.WorkInProgress; }, @@ -363,19 +377,22 @@ let Engine = { Engine.hideAllContent(); var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "hidden"; - Engine.Display.redPillContent.style.visibility = "visible"; + //Engine.Display.redPillContent.style.visibility = "visible"; + Engine.Display.redPillContent.style.display = "block"; Engine.currentPage = Engine.Page.RedPill; }, loadInfiltrationContent: function() { Engine.hideAllContent(); - Engine.Display.infiltrationContent.style.visibility = "visible"; + //Engine.Display.infiltrationContent.style.visibility = "visible"; + Engine.Display.infiltrationContent.style.display = "block"; Engine.currentPage = Engine.Page.Infiltration; }, loadStockMarketContent: function() { Engine.hideAllContent(); - Engine.Display.stockMarketContent.style.visibility = "visible"; + //Engine.Display.stockMarketContent.style.visibility = "visible"; + Engine.Display.stockMarketContent.style.display = "block"; Engine.currentPage = Engine.Page.StockMarket; displayStockMarketContent(); }, @@ -401,6 +418,7 @@ let Engine = { //Helper function that hides all content hideAllContent: function() { + /* Engine.Display.terminalContent.style.visibility = "hidden"; Engine.Display.characterContent.style.visibility = "hidden"; Engine.Display.scriptEditorContent.style.visibility = "hidden"; @@ -422,6 +440,28 @@ let Engine = { if (document.getElementById("gang-container")) { document.getElementById("gang-container").style.visibility = "hidden"; } + */ + Engine.Display.terminalContent.style.display = "none"; + Engine.Display.characterContent.style.display = "none"; + Engine.Display.scriptEditorContent.style.display = "none"; + Engine.Display.activeScriptsContent.style.display = "none"; + Engine.Display.hacknetNodesContent.style.display = "none"; + Engine.Display.worldContent.style.display = "none"; + Engine.Display.createProgramContent.style.display = "none"; + Engine.Display.factionsContent.style.display = "none"; + Engine.Display.factionContent.style.display = "none"; + Engine.Display.factionAugmentationsContent.style.display = "none"; + Engine.Display.augmentationsContent.style.display = "none"; + Engine.Display.tutorialContent.style.display = "none"; + Engine.Display.locationContent.style.display = "none"; + Engine.Display.workInProgressContent.style.display = "none"; + Engine.Display.redPillContent.style.display = "none"; + Engine.Display.infiltrationContent.style.display = "none"; + Engine.Display.stockMarketContent.style.display = "none"; + Engine.Display.missionContent.style.display = "none"; + if (document.getElementById("gang-container")) { + document.getElementById("gang-container").style.display = "none"; + } //Location lists Engine.aevumLocationsList.style.display = "none"; @@ -1269,47 +1309,62 @@ let Engine = { Engine.currentPage = Engine.Page.Terminal; Engine.Display.characterContent = document.getElementById("character-container"); - Engine.Display.characterContent.style.visibility = "hidden"; + //Engine.Display.characterContent.style.visibility = "hidden"; + Engine.Display.characterContent.style.display = "none"; Engine.Display.scriptEditorContent = document.getElementById("script-editor-container"); - Engine.Display.scriptEditorContent.style.visibility = "hidden"; + //Engine.Display.scriptEditorContent.style.visibility = "hidden"; + Engine.Display.scriptEditorContent.style.display = "none"; Engine.Display.activeScriptsContent = document.getElementById("active-scripts-container"); - Engine.Display.activeScriptsContent.style.visibility = "hidden"; + //Engine.Display.activeScriptsContent.style.visibility = "hidden"; + Engine.Display.activeScriptsContent.style.display = "none"; Engine.Display.hacknetNodesContent = document.getElementById("hacknet-nodes-container"); - Engine.Display.hacknetNodesContent.style.visibility = "hidden"; + //Engine.Display.hacknetNodesContent.style.visibility = "hidden"; + Engine.Display.hacknetNodesContent.style.display = "none"; Engine.Display.worldContent = document.getElementById("world-container"); - Engine.Display.worldContent.style.visibility = "hidden"; + //Engine.Display.worldContent.style.visibility = "hidden"; + Engine.Display.worldContent.style.display = "none"; Engine.Display.createProgramContent = document.getElementById("create-program-container"); - Engine.Display.createProgramContent.style.visibility = "hidden"; + //Engine.Display.createProgramContent.style.visibility = "hidden"; + Engine.Display.createProgramContent.style.display = "none"; Engine.Display.factionsContent = document.getElementById("factions-container"); - Engine.Display.factionsContent.style.visibility = "hidden"; + //Engine.Display.factionsContent.style.visibility = "hidden"; + Engine.Display.factionsContent.style.display = "none"; Engine.Display.factionContent = document.getElementById("faction-container"); - Engine.Display.factionContent.style.visibility = "hidden"; + //Engine.Display.factionContent.style.visibility = "hidden"; + Engine.Display.factionContent.style.display = "none"; Engine.Display.factionAugmentationsContent = document.getElementById("faction-augmentations-container"); - Engine.Display.factionAugmentationsContent.style.visibility = "hidden"; + //Engine.Display.factionAugmentationsContent.style.visibility = "hidden"; + Engine.Display.factionAugmentationsContent.style.display = "none"; Engine.Display.augmentationsContent = document.getElementById("augmentations-container"); - Engine.Display.augmentationsContent.style.visibility = "hidden"; + //Engine.Display.augmentationsContent.style.visibility = "hidden"; + Engine.Display.augmentationsContent.style.display = "none"; + Engine.Display.tutorialContent = document.getElementById("tutorial-container"); - Engine.Display.tutorialContent.style.visibility = "hidden"; + //Engine.Display.tutorialContent.style.visibility = "hidden"; + Engine.Display.tutorialContent.style.display = "none"; Engine.Display.infiltrationContent = document.getElementById("infiltration-container"); - Engine.Display.infiltrationContent.style.visibility = "hidden"; + //Engine.Display.infiltrationContent.style.visibility = "hidden"; + Engine.Display.infiltrationContent.style.display = "none"; Engine.Display.stockMarketContent = document.getElementById("stock-market-container"); - Engine.Display.stockMarketContent.style.visibility = "hidden"; + //Engine.Display.stockMarketContent.style.visibility = "hidden"; + Engine.Display.stockMarketContent.style.display = "none"; Engine.Display.missionContent = document.getElementById("mission-container"); - Engine.Display.missionContent.style.visibility = "hidden"; + //Engine.Display.missionContent.style.visibility = "hidden"; + Engine.Display.missionContent.style.display = "none"; //Character info Engine.Display.characterInfo = document.getElementById("character-info"); @@ -1324,15 +1379,18 @@ let Engine = { //Location page (page that shows up when you visit a specific location in World) Engine.Display.locationContent = document.getElementById("location-container"); - Engine.Display.locationContent.style.visibility = "hidden"; + //Engine.Display.locationContent.style.visibility = "hidden"; + Engine.Display.locationContent.style.display = "none"; //Work In Progress Engine.Display.workInProgressContent = document.getElementById("work-in-progress-container"); - Engine.Display.workInProgressContent.style.visibility = "hidden"; + //Engine.Display.workInProgressContent.style.visibility = "hidden"; + Engine.Display.workInProgressContent.style.display = "none"; //Red Pill / Hack World Daemon Engine.Display.redPillContent = document.getElementById("red-pill-container"); - Engine.Display.redPillContent.style.visibility = "hidden"; + //Engine.Display.redPillContent.style.visibility = "hidden"; + Engine.Display.redPillContent.style.display = "none"; //Init Location buttons initLocationButtons();