Fixed several more bugs. Rebalanced stock market changes to make the effects a bit less potent for now

This commit is contained in:
danielyxie 2019-05-14 04:23:55 -07:00
parent fef7aaba8f
commit bd02e724e5
9 changed files with 23 additions and 11 deletions

@ -242,7 +242,6 @@ function updateActiveScriptsItems(maxTasks=150) {
}
}
if (!routing.isOn(Page.ActiveScripts)) { return; }
let total = 0;
for (var i = 0; i < workerScripts.length; ++i) {
try {
@ -252,6 +251,7 @@ function updateActiveScriptsItems(maxTasks=150) {
}
}
if (!routing.isOn(Page.ActiveScripts)) { return total; }
getElementById("active-scripts-total-production-active").innerText = numeralWrapper.formatMoney(total);
getElementById("active-scripts-total-prod-aug-total").innerText = numeralWrapper.formatMoney(Player.scriptProdSinceLastAug);
getElementById("active-scripts-total-prod-aug-avg").innerText = numeralWrapper.formatMoney(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug/1000));

@ -244,6 +244,7 @@ export let CONSTANTS: IMap<any> = {
* getHackTime(), getGrowTime(), and getWeakenTime() now return Infinity if called on a Hacknet Server
* Money/Income tracker now displays money lost from hospitalizations
* Exported saves now have a unique filename based on current BitNode and timestamp
* Maximum number of Hacknet Servers decreased from 25 to 20
* Bug Fix: Corporation employees stats should no longer become negative
* Bug Fix: Fixed sleeve.getInformation() throwing error in certain scenarios
* Bug Fix: Coding contracts should no longer generate on the w0r1d_d43m0n server
@ -260,5 +261,7 @@ export let CONSTANTS: IMap<any> = {
* Bug Fix: Having Corporation warehouses at full capacity should no longer freeze game in certain conditions
* Bug Fix: Prevented an exploit that allows you to buy multiple copies of an Augmentation by holding the 'Enter' button
* Bug Fix: gang.getOtherGangInformation() now properly returns a deep copy
* Bug Fix: Fixed getScriptIncome() returning an undefined value
* Bug Fix: Fixed an issue with Hacknet Server hash rate not always updating
`
}

@ -426,7 +426,10 @@ function processAllHacknetServerEarnings(numCycles) {
let hashes = 0;
for (let i = 0; i < Player.hacknetNodes.length; ++i) {
const hserver = AllServers[Player.hacknetNodes[i]]; // hacknetNodes array only contains the IP addresses
// hacknetNodes array only contains the IP addresses of the servers.
// Also, update the hash rate before processing
const hserver = AllServers[Player.hacknetNodes[i]];
hserver.updateHashRate(Player.hacknet_node_money_mult);
hashes += hserver.process(numCycles);
}

@ -32,7 +32,7 @@ export const HacknetServerUpgradeRamMult: number = 1.4; // Multiplier for co
export const HacknetServerUpgradeCoreMult: number = 1.55; // Multiplier for cost when buying another core
export const HacknetServerUpgradeCacheMult: number = 1.85; // Multiplier for cost when upgrading cache
export const MaxNumberHacknetServers: number = 25; // Max number of Hacknet Servers you can own
export const MaxNumberHacknetServers: number = 20; // Max number of Hacknet Servers you can own
// Constants for max upgrade levels for Hacknet Server
export const HacknetServerMaxLevel: number = 300;

@ -2164,10 +2164,17 @@ function NetscriptFunctions(workerScript) {
getScriptIncome: function(scriptname, ip) {
updateDynamicRam("getScriptIncome", getRamCost("getScriptIncome"));
if (arguments.length === 0) {
// Get total script income
var res = [];
res.push(updateActiveScriptsItems());
res.push(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug/1000));
// First element is total income of all currently running scripts
let total = 0;
for (const script of workerScripts) {
total += (script.scriptRef.onlineMoneyMade / script.scriptRef.onlineRunningTime);
}
res.push(total);
// Second element is total income you've earned from scripts since you installed Augs
res.push(Player.scriptProdSinceLastAug / (Player.playtimeSinceLastAug / 1000));
return res;
} else {
// Get income for a particular script

@ -336,7 +336,7 @@ function prestigeSourceFile() {
hserver.level = 100;
hserver.cores = 10;
hserver.cache = 5;
hserver.updateHashRate(Player);
hserver.updateHashRate(Player.hacknet_node_money_mult);
hserver.updateHashCapacity();
updateHashManagerCapacity();
}

@ -202,7 +202,7 @@ export function stockMarketCycle() {
if (stock.b) { thresh = 0.4; }
if (Math.random() < thresh) {
stock.b = !stock.b;
if (stock.otlkMag < 10) { stock.otlkMag += 0.2; }
if (stock.otlkMag < 10) { stock.otlkMag += 0.15; }
}
}
}

@ -3,7 +3,7 @@ import { PositionTypes } from "./data/PositionTypes";
import { CONSTANTS } from "../Constants";
// Amount by which a stock's forecast changes during each price movement
export const forecastChangePerPriceMovement = 0.1;
export const forecastChangePerPriceMovement = 0.05;
/**
* Given a stock, calculates the amount by which the stock price is multiplied
@ -31,7 +31,6 @@ export function calculateDecreasingPriceMovement(stock: Stock): number | null {
return (1 - (stock.priceMovementPerc / 100));
}
/**
* Calculate the total cost of a "buy" transaction. This accounts for spread,
* price movements, and commission.

@ -277,8 +277,8 @@ const Engine = {
loadActiveScriptsContent: function() {
Engine.hideAllContent();
Engine.Display.activeScriptsContent.style.display = "block";
updateActiveScriptsItems();
routing.navigateTo(Page.ActiveScripts);
updateActiveScriptsItems();
MainMenuLinks.ActiveScripts.classList.add("active");
},