From 03fdaeaba4e35dbb41ea6fc956981553544e2e7c Mon Sep 17 00:00:00 2001 From: danielyxie Date: Thu, 2 Nov 2017 22:11:14 -0500 Subject: [PATCH] Changed confirm to prompt, updated version, more stock market balancing --- dist/bundle.js | 24 ++++++++----- src/CompanyManagement.js | 72 +++++++++++++++++++++++++++------------ src/Constants.js | 13 ++++--- src/NetscriptFunctions.js | 2 +- src/Player.js | 1 + src/StockMarket.js | 8 ++--- 6 files changed, 80 insertions(+), 40 deletions(-) diff --git a/dist/bundle.js b/dist/bundle.js index 8c9db18b7..86a331a39 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -282,6 +282,7 @@ function PlayerObject() { this.scriptProdSinceLastAug = 0; this.stockProdSinceLastAug = 0; this.crimeProdSinceLastAug = 0; + this.jobProdSinceLastAug = 0; }; PlayerObject.prototype.init = function() { @@ -2581,7 +2582,7 @@ function powerOfTwo(n) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CONSTANTS; }); let CONSTANTS = { - Version: "0.32.0", + Version: "0.32.1", //Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then @@ -3289,6 +3290,11 @@ let CONSTANTS = { "Returns the amount of time in milliseconds that have passed since you last installed Augmentations (or destroyed a BitNode).

" + "sprintf()/vsprintf()
" + "See this link for details

" + + "prompt(message)
" + + "Prompts the player with a dialog box with two options: 'Yes' and 'No'. This function will returns true if " + + "the player clicks 'Yes' and false if the player click's 'No'. The script's execution is halted until the " + + "player selects 'Yes' or 'No'. The function takes a single string as an argument which specifies the text " + + "that appears on the dialog box.

" + "

Hacknet Nodes API


" + "Netscript provides the following API for accessing and upgrading your Hacknet Nodes through scripts. This API does NOT work offline.

" + "hacknetnodes
A special variable. This is an array that maps to the Player's Hacknet Nodes. The Hacknet Nodes are accessed through " + @@ -3692,11 +3698,11 @@ let CONSTANTS = { "v0.32.1
" + "-Updated Netscript's 'interpreter/engine' to use the Bluebird promise library instead of native promises. " + "It should now be faster and more memory-efficient. If this has broken any Netscript features please report it through Github or the subreddit (reddit.com/r/bitburner)
" + - "-Rebalanced stock market (adjusted parameters such as the volatility/trends/starting price of certain stocks)
" + - "-Added confirm() Netscript function
" + + "-Rebalanced stock market (adjusted parameters such as the volatility/trends/starting price of certain stocks)
" + + "-Added prompt() Netscript function
" + "-Added 'Buy Max' and 'Sell All' functions to Stock Market UI
" + "-Added 'Portfolio' Mode to Stock Market UI so you can only view stocks you have a position/order in
" + - "-Added a button to kill a script from its log display box
" + + "-Added a button to kill a script from its log display box

" + "v0.32.0
" + "-Released BitNode-8: Ghost of Wall Street
" + "-Re-designed Stock Market UI
" + @@ -22921,7 +22927,7 @@ function NetscriptFunctions(workerScript) { getTimeSinceLastAug : function() { return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].playtimeSinceLastAug; }, - confirm : function(txt) { + prompt : function(txt) { if (__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["e" /* yesNoBoxOpen */]) { workerScript.scriptRef.log("ERROR: confirm() failed because a pop-up dialog box is already open"); return false; @@ -36736,11 +36742,11 @@ function initStockMarket() { } var ecorp = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumECorp; - var ecorpStk = new Stock(ecorp, StockSymbols[ecorp], 0.5, true, 16, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(20000, 25000)); + var ecorpStk = new Stock(ecorp, StockSymbols[ecorp], 0.45, true, 19, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(20000, 25000)); StockMarket[ecorp] = ecorpStk; var megacorp = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12MegaCorp; - var megacorpStk = new Stock(megacorp, StockSymbols[megacorp], 0.5, true, 16, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(25000, 33000)); + var megacorpStk = new Stock(megacorp, StockSymbols[megacorp], 0.45, true, 19, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(25000, 33000)); StockMarket[megacorp] = megacorpStk; var blade = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12BladeIndustries; @@ -36852,11 +36858,11 @@ function initStockMarket() { StockMarket[sigmacosm] = sigmacosmStk; var joesguns = "Joes Guns"; - var joesgunsStk = new Stock(joesguns, StockSymbols[joesguns], 3.7, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000)); + var joesgunsStk = new Stock(joesguns, StockSymbols[joesguns], 3.8, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000)); StockMarket[joesguns] = joesgunsStk; var catalyst = "Catalyst Ventures"; - var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.5, true, 13, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000)); + var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.5, true, 14, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000)); StockMarket[catalyst] = catalystStk; var microdyne = "Microdyne Technologies"; diff --git a/src/CompanyManagement.js b/src/CompanyManagement.js index f059f1648..22f1f9505 100644 --- a/src/CompanyManagement.js +++ b/src/CompanyManagement.js @@ -209,9 +209,28 @@ Industries: */ var TOTALSHARES = 1000000000; //Total number of shares you have at your company +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 + + //How much space it takes in a Warehouse + this.siz = params.size ? params.size : 0; + + this.purc = 0; //How much of this material is being purchased per second + this.cost = 0; //$ Cost per 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 : {}; +} + var Materials = { - Water: 11, - Energy: 12, + Water: new Material({name: "Water", size: 0.1}), + Energy: new Material Food: 13, Plants: 14, Metal: 15, @@ -224,23 +243,6 @@ var Materials = { SciResearch: 22 } -function Material(params={}) { - this.name = params.name ? params.name : ""; - this.qty = 0; - this.qlt = 0; - this.dmd = 0; - this.cmp = 0; - this.mku = 0; - - //How much space it takes in a Warehouse - this.siz = params.size ? params.size : 0; - - this.purc = 0; //How much of this material is being purchased per second - this.cost = 0; //$ Cost per material - - this.req = params.req ? params.req : []; -} - function Product(params={}) { "use strict" this.name = params.name ? params.name : 0; @@ -258,6 +260,7 @@ function Product(params={}) { this.siz = params.size ? params.size : 0; //How much space it takes in the warehouse //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 : {}; } @@ -298,9 +301,9 @@ function Industry(params={}) { Locations.Volhaven: 0 }; - this.type = params.type ? params.type : 0; - this.materials = {}; - this.products = {}; + this.type = params.type ? params.type : 0; + this.materials = {}; //Contains both materials that are created and required + this.products = {}; this.awareness = 0; this.popularity = 0; @@ -330,6 +333,31 @@ Industry.prototype.init = function() { break; case Industries.Agriculture: break; + case Industries.Fishing: + break; + case Industries.Mining: + break; + case Industries.Food: + break; + case Industries.Tobacco: + break; + case Industries.Chemical: + break; + case Industries.Pharmaceutical: + break; + case Industries.Computer: + break; + case Industries.Robotics: + break; + case Industries.Software: + break; + case Industries.Healthcare: + break; + case Industries.RealEstate: + break; + default: + console.log("ERR: Invalid Industry Type passed into Industry.init()"); + return; } } diff --git a/src/Constants.js b/src/Constants.js index d0e93dfa1..fd6c62312 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -1,5 +1,5 @@ let CONSTANTS = { - Version: "0.32.0", + Version: "0.32.1", //Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then @@ -707,6 +707,11 @@ let CONSTANTS = { "Returns the amount of time in milliseconds that have passed since you last installed Augmentations (or destroyed a BitNode).

" + "sprintf()/vsprintf()
" + "See this link for details

" + + "prompt(message)
" + + "Prompts the player with a dialog box with two options: 'Yes' and 'No'. This function will returns true if " + + "the player clicks 'Yes' and false if the player click's 'No'. The script's execution is halted until the " + + "player selects 'Yes' or 'No'. The function takes a single string as an argument which specifies the text " + + "that appears on the dialog box.

" + "

Hacknet Nodes API


" + "Netscript provides the following API for accessing and upgrading your Hacknet Nodes through scripts. This API does NOT work offline.

" + "hacknetnodes
A special variable. This is an array that maps to the Player's Hacknet Nodes. The Hacknet Nodes are accessed through " + @@ -1110,11 +1115,11 @@ let CONSTANTS = { "v0.32.1
" + "-Updated Netscript's 'interpreter/engine' to use the Bluebird promise library instead of native promises. " + "It should now be faster and more memory-efficient. If this has broken any Netscript features please report it through Github or the subreddit (reddit.com/r/bitburner)
" + - "-Rebalanced stock market (adjusted parameters such as the volatility/trends/starting price of certain stocks)
" + - "-Added confirm() Netscript function
" + + "-Rebalanced stock market (adjusted parameters such as the volatility/trends/starting price of certain stocks)
" + + "-Added prompt() Netscript function
" + "-Added 'Buy Max' and 'Sell All' functions to Stock Market UI
" + "-Added 'Portfolio' Mode to Stock Market UI so you can only view stocks you have a position/order in
" + - "-Added a button to kill a script from its log display box
" + + "-Added a button to kill a script from its log display box

" + "v0.32.0
" + "-Released BitNode-8: Ghost of Wall Street
" + "-Re-designed Stock Market UI
" + diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 0e20a78e2..61da7c260 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -1350,7 +1350,7 @@ function NetscriptFunctions(workerScript) { getTimeSinceLastAug : function() { return Player.playtimeSinceLastAug; }, - confirm : function(txt) { + prompt : function(txt) { if (yesNoBoxOpen) { workerScript.scriptRef.log("ERROR: confirm() failed because a pop-up dialog box is already open"); return false; diff --git a/src/Player.js b/src/Player.js index dce83d8b1..2fe634534 100644 --- a/src/Player.js +++ b/src/Player.js @@ -194,6 +194,7 @@ function PlayerObject() { this.scriptProdSinceLastAug = 0; this.stockProdSinceLastAug = 0; this.crimeProdSinceLastAug = 0; + this.jobProdSinceLastAug = 0; }; PlayerObject.prototype.init = function() { diff --git a/src/StockMarket.js b/src/StockMarket.js index a974cdb1f..13f51a246 100644 --- a/src/StockMarket.js +++ b/src/StockMarket.js @@ -249,11 +249,11 @@ function initStockMarket() { } var ecorp = Locations.AevumECorp; - var ecorpStk = new Stock(ecorp, StockSymbols[ecorp], 0.5, true, 16, getRandomInt(20000, 25000)); + var ecorpStk = new Stock(ecorp, StockSymbols[ecorp], 0.45, true, 19, getRandomInt(20000, 25000)); StockMarket[ecorp] = ecorpStk; var megacorp = Locations.Sector12MegaCorp; - var megacorpStk = new Stock(megacorp, StockSymbols[megacorp], 0.5, true, 16, getRandomInt(25000, 33000)); + var megacorpStk = new Stock(megacorp, StockSymbols[megacorp], 0.45, true, 19, getRandomInt(25000, 33000)); StockMarket[megacorp] = megacorpStk; var blade = Locations.Sector12BladeIndustries; @@ -365,11 +365,11 @@ function initStockMarket() { StockMarket[sigmacosm] = sigmacosmStk; var joesguns = "Joes Guns"; - var joesgunsStk = new Stock(joesguns, StockSymbols[joesguns], 3.7, true, 1, getRandomInt(500, 1000)); + var joesgunsStk = new Stock(joesguns, StockSymbols[joesguns], 3.8, true, 1, getRandomInt(500, 1000)); StockMarket[joesguns] = joesgunsStk; var catalyst = "Catalyst Ventures"; - var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.5, true, 13, getRandomInt(500, 1000)); + var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.5, true, 14, getRandomInt(500, 1000)); StockMarket[catalyst] = catalystStk; var microdyne = "Microdyne Technologies";