Merge pull request #542 from danielyxie/dev

v0.44.0 Merge
This commit is contained in:
danielyxie 2019-02-26 00:30:42 -08:00 committed by GitHub
commit 3d76390c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 1105 additions and 1114 deletions

File diff suppressed because one or more lines are too long

122
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -208,3 +208,16 @@ The list contains the name of (i.e. the value returned by
| | | (a)())() -> ["(a)()()", "(a())()"] | | | | (a)())() -> ["(a)()()", "(a())()"] |
| | | )( -> [""] | | | | )( -> [""] |
+------------------------------------+------------------------------------------------------------------------------------------+ +------------------------------------+------------------------------------------------------------------------------------------+
| Find All Valid Math Expressions | | You are given a string which contains only digits between 0 and 9 as well as a target |
| | | number. Return all possible ways you can add the +, -, and * operators to the string |
| | | of digits such that it evaluates to the target number. |
| | | |
| | | The answer should be provided as an array of strings containing the valid expressions. |
| | | |
| | | Examples: |
| | | Input: digits = "123", target = 6 |
| | | Output: ["1+2+3", "1*2*3"] |
| | | |
| | | Input: digits = "105", target = 5 |
| | | Output: ["1*0+5", "10-5"] |
+------------------------------------+------------------------------------------------------------------------------------------+

@ -146,7 +146,7 @@ List of Factions and their Requirements
| | | * -90 Karma | | | | | * -90 Karma | |
| | | * Not working for CIA or NSA | | | | | * Not working for CIA or NSA | |
+---------------------+----------------+-----------------------------------------+-------------------------------+ +---------------------+----------------+-----------------------------------------+-------------------------------+
| Endgame | The Covenant | * 30 Augmentations | | | Endgame | The Covenant | * 20 Augmentations | |
| Factions | | * $75b | | | Factions | | * $75b | |
| | | * Hacking Level of 850 | | | | | * Hacking Level of 850 | |
| | | * All Combat Stats of 850 | | | | | * All Combat Stats of 850 | |

@ -3,6 +3,44 @@
Changelog Changelog
========= =========
v0.44.0 - 2/26/2019
-------------------
* Bladeburner Changes:
** Reduced the amount of rank needed to earn a skill point
** Reduced the effects of the "Reaper" and "Evasive System" skills
** Increased the effect of the "Hyperdrive" and "Hands of Midas" skills
** Slightly increased the rate which the skill point cost rises for almost all skills
** The "Overlock" Skill now has a maximum level of 90 instead of 95
** Money earned from Contracts increased by 400%
** Changed the way population affects success rate. Extreme populations now have less dramatic effects
** Added two new General Actions: Diplomacy and Hyperbolic Regeneration Chamber
** Lowered the rep and money cost of the "Blade's Simulacrum" augmentation
** Significantly decreased the initial amount of Contracts/Operations (the "Contracts/Operations remaining" value)
** Decreased the rate at which the amount of Contracts/Operations increases over time
** Decreased the number of successes you need to increase the max level of a Contract/Operation
** Increased the average number of Synthoid communities each city has
** Reduced the amount by which a successful raid will decrease the population of a city
** The "riots" event will now increase the chaos of a city by a greater amount
** Significantly increased the effect that Agility and Dexterity have on action time
* Added new BitNode multipliers:
* HomeComputerRamCost - Affects how much it costs to upgrade home computer's RAM
* DaedalusAugsRequirement - Affects how many Augmentations you need in order to get invited to Daedalus
* FourSigmaMarketDataCost - Affects how much it costs to unlock the stock market's 4S Market Data
* FourSigmaMarketDataApiCost - Affects how much it costs to unlock the stock market's 4S Market Data API
* A few minor changes to BitNode multipliers across the board (mostly for the new multipliers)
* 'The Covenant' now requires 20 total Augmentations to get invited, rather than 30
* You can now purchase permanent Duplicate Sleeves from 'The Covenant'. This requires Source-File 10, and you must be in BN-10 or after
* You can now track where all of your money comes from in the 'Stats' page
* Increased the money gained from Coding Contracts by 50%
* getCharacterInformation() function now returns the player's HP and max HP
* Bug Fix: You can no longer disconnect the enemy's connections in Hacking Missions
* Bug Fix: Duplicate Sleeve faction reputation gain is now properly affected by faction favor
* Bug Fix: After installing Augmentations, the Terminal display will now correctly show the current server as "home"
* Bug Fix: Fixed an exploit where you could change the duration of timed functions (e.g. hack, weaken) in NetscriptJS
* Bug Fix: You should now properly be able to use the ServerProfile.exe program
* Bug Fix: Prevented exploit that allowed you to accept faction invites programmatically through NetscriptJS
* Bug Fix: Faction invitations for megacorporations should now work properly
v0.43.1 - 2/11/2019 v0.43.1 - 2/11/2019
------------------- -------------------
* Terminal changes: * Terminal changes:

@ -0,0 +1,9 @@
Guides & Tips
=============
.. toctree::
:maxdepth: 3
Getting Started Guide for Beginner Programmers
Getting Started Guide for Intermediate Programmers
What BitNode should I do?

@ -25,7 +25,9 @@ secrets that you've been searching for.
Keyboard Shortcuts <shortcuts> Keyboard Shortcuts <shortcuts>
Script Editors <scripteditors> Script Editors <scripteditors>
Game Frozen or Stuck? <gamefrozen> Game Frozen or Stuck? <gamefrozen>
Guides & Tips <guidesandtips>
Changelog <changelog> Changelog <changelog>
Donate <https://paypal.me/danielyxie>
Indices and tables Indices and tables
================== ==================

@ -10,33 +10,14 @@ getBitNodeMultipliers
.. js:function:: getBitNodeMultipliers() .. js:function:: getBitNodeMultipliers()
Returns an object containing the current BitNode multipliers. This function requires Source-File 5 in order Returns an object containing the current BitNode multipliers. This function requires Source-File 5 in order
to run. The multipliers are returned in integer forms (e.g. 1.5 instead of 150%). The multipliers represent to run. The multipliers are returned in decimal forms (e.g. 1.5 instead of 150%). The multipliers represent
the difference between the current BitNode and the original BitNode (BitNode-1). For example, if the the difference between the current BitNode and the original BitNode (BitNode-1). For example, if the
*CrimeMoney* multiplier has a value of 0.1, then that means that committing crimes in the current BitNode *CrimeMoney* multiplier has a value of 0.1, then that means that committing crimes in the current BitNode
will only give 10% of the money you would have received in BitNode-1. The object has the following structure, will only give 10% of the money you would have received in BitNode-1.
(subject to change in the future)::
{ The structure of the returned object is subject to change as BitNode multipliers get added to the game.
ServerMaxMoney: 1, Refer to the `source code here <https://github.com/danielyxie/bitburner/blob/master/src/BitNode/BitNodeMultipliers.ts>`_
ServerStartingMoney: 1, to see the name of the BitNode multipliers.
ServerGrowthRate: 1,
ServerWeakenRate: 1,
ServerStartingSecurity: 1,
ManualHackMoney: 1,
ScriptHackMoney: 1,
CompanyWorkMoney: 1,
CrimeMoney: 1,
HacknetNodeMoney: 1,
CompanyWorkExpGain: 1,
ClassGymExpGain: 1,
FactionWorkExpGain: 1,
HackExpGain: 1,
CrimeExpGain: 1,
FactionWorkRepGain: 1,
FactionPassiveRepGain: 1,
AugmentationRepCost: 1,
AugmentationMoneyCost: 1,
}
Example:: Example::

@ -335,6 +335,13 @@ getCityChaos
Returns the chaos in the specified city, or -1 if an invalid city was specified Returns the chaos in the specified city, or -1 if an invalid city was specified
getCity
-------
.. js:function:: getCity()
Returns the city that the player is currently in (for Bladeburner).
switchCity switchCity
---------- ----------

@ -167,8 +167,10 @@ getCharacterInformation
bitnode: Current BitNode number bitnode: Current BitNode number
city: Name of city you are currently in city: Name of city you are currently in
factions: Array of factions you are currently a member of factions: Array of factions you are currently a member of
hp: Current health points
jobs: Array of all companies at which you have jobs jobs: Array of all companies at which you have jobs
jobTitle: Array of job positions for all companies you are employed at. Same order as 'jobs' jobTitle: Array of job positions for all companies you are employed at. Same order as 'jobs'
maxHp: Maximum health points
tor: Boolean indicating whether or not you have a tor router tor: Boolean indicating whether or not you have a tor router
// The following is an object with many of the player's multipliers from Augmentations/Source Files // The following is an object with many of the player's multipliers from Augmentations/Source Files

546
package-lock.json generated

@ -1259,7 +1259,6 @@
"anymatch": "2.0.0", "anymatch": "2.0.0",
"async-each": "1.0.1", "async-each": "1.0.1",
"braces": "2.3.2", "braces": "2.3.2",
"fsevents": "1.2.4",
"glob-parent": "3.1.0", "glob-parent": "3.1.0",
"inherits": "2.0.3", "inherits": "2.0.3",
"is-binary-path": "1.0.1", "is-binary-path": "1.0.1",
@ -3777,535 +3776,6 @@
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
}, },
"fsevents": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz",
"integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==",
"dev": true,
"optional": true,
"requires": {
"nan": "2.12.1",
"node-pre-gyp": "0.10.0"
},
"dependencies": {
"abbrev": {
"version": "1.1.1",
"bundled": true,
"dev": true,
"optional": true
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
},
"aproba": {
"version": "1.2.0",
"bundled": true,
"dev": true,
"optional": true
},
"are-we-there-yet": {
"version": "1.1.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"delegates": "1.0.0",
"readable-stream": "2.3.6"
}
},
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"requires": {
"balanced-match": "1.0.0",
"concat-map": "0.0.1"
}
},
"chownr": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
},
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
},
"core-util-is": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
},
"debug": {
"version": "2.6.9",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ms": "2.0.0"
}
},
"deep-extend": {
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true
},
"delegates": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
},
"detect-libc": {
"version": "1.0.3",
"bundled": true,
"dev": true,
"optional": true
},
"fs-minipass": {
"version": "1.2.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minipass": "2.2.4"
}
},
"fs.realpath": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
},
"gauge": {
"version": "2.7.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"aproba": "1.2.0",
"console-control-strings": "1.1.0",
"has-unicode": "2.0.1",
"object-assign": "4.1.1",
"signal-exit": "3.0.2",
"string-width": "1.0.2",
"strip-ansi": "3.0.1",
"wide-align": "1.1.2"
}
},
"glob": {
"version": "7.1.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"fs.realpath": "1.0.0",
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.4",
"once": "1.4.0",
"path-is-absolute": "1.0.1"
}
},
"has-unicode": {
"version": "2.0.1",
"bundled": true,
"dev": true,
"optional": true
},
"iconv-lite": {
"version": "0.4.21",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safer-buffer": "2.1.2"
}
},
"ignore-walk": {
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimatch": "3.0.4"
}
},
"inflight": {
"version": "1.0.6",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"once": "1.4.0",
"wrappy": "1.0.2"
}
},
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
},
"ini": {
"version": "1.3.5",
"bundled": true,
"dev": true,
"optional": true
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"requires": {
"number-is-nan": "1.0.1"
}
},
"isarray": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
},
"minimatch": {
"version": "3.0.4",
"bundled": true,
"dev": true,
"requires": {
"brace-expansion": "1.1.11"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
"requires": {
"safe-buffer": "5.1.1",
"yallist": "3.0.2"
}
},
"minizlib": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minipass": "2.2.4"
}
},
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"dev": true,
"requires": {
"minimist": "0.0.8"
}
},
"ms": {
"version": "2.0.0",
"bundled": true,
"dev": true,
"optional": true
},
"needle": {
"version": "2.2.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"debug": "2.6.9",
"iconv-lite": "0.4.21",
"sax": "1.2.4"
}
},
"node-pre-gyp": {
"version": "0.10.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"detect-libc": "1.0.3",
"mkdirp": "0.5.1",
"needle": "2.2.0",
"nopt": "4.0.1",
"npm-packlist": "1.1.10",
"npmlog": "4.1.2",
"rc": "1.2.7",
"rimraf": "2.6.2",
"semver": "5.5.0",
"tar": "4.4.1"
}
},
"nopt": {
"version": "4.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"abbrev": "1.1.1",
"osenv": "0.1.5"
}
},
"npm-bundled": {
"version": "1.0.3",
"bundled": true,
"dev": true,
"optional": true
},
"npm-packlist": {
"version": "1.1.10",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ignore-walk": "3.0.1",
"npm-bundled": "1.0.3"
}
},
"npmlog": {
"version": "4.1.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"are-we-there-yet": "1.1.4",
"console-control-strings": "1.1.0",
"gauge": "2.7.4",
"set-blocking": "2.0.0"
}
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
},
"object-assign": {
"version": "4.1.1",
"bundled": true,
"dev": true,
"optional": true
},
"once": {
"version": "1.4.0",
"bundled": true,
"dev": true,
"requires": {
"wrappy": "1.0.2"
}
},
"os-homedir": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
},
"os-tmpdir": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
},
"osenv": {
"version": "0.1.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"os-homedir": "1.0.2",
"os-tmpdir": "1.0.2"
}
},
"path-is-absolute": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
},
"process-nextick-args": {
"version": "2.0.0",
"bundled": true,
"dev": true,
"optional": true
},
"rc": {
"version": "1.2.7",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"deep-extend": "0.5.1",
"ini": "1.3.5",
"minimist": "1.2.0",
"strip-json-comments": "2.0.1"
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"bundled": true,
"dev": true,
"optional": true
}
}
},
"readable-stream": {
"version": "2.3.6",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "1.0.0",
"process-nextick-args": "2.0.0",
"safe-buffer": "5.1.1",
"string_decoder": "1.1.1",
"util-deprecate": "1.0.2"
}
},
"rimraf": {
"version": "2.6.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"glob": "7.1.2"
}
},
"safe-buffer": {
"version": "5.1.1",
"bundled": true,
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
"bundled": true,
"dev": true,
"optional": true
},
"sax": {
"version": "1.2.4",
"bundled": true,
"dev": true,
"optional": true
},
"semver": {
"version": "5.5.0",
"bundled": true,
"dev": true,
"optional": true
},
"set-blocking": {
"version": "2.0.0",
"bundled": true,
"dev": true,
"optional": true
},
"signal-exit": {
"version": "3.0.2",
"bundled": true,
"dev": true,
"optional": true
},
"string-width": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"requires": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
"strip-ansi": "3.0.1"
}
},
"string_decoder": {
"version": "1.1.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"dev": true,
"requires": {
"ansi-regex": "2.1.1"
}
},
"strip-json-comments": {
"version": "2.0.1",
"bundled": true,
"dev": true,
"optional": true
},
"tar": {
"version": "4.4.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"chownr": "1.0.1",
"fs-minipass": "1.2.5",
"minipass": "2.2.4",
"minizlib": "1.1.0",
"mkdirp": "0.5.1",
"safe-buffer": "5.1.1",
"yallist": "3.0.2"
}
},
"util-deprecate": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
},
"wide-align": {
"version": "1.1.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"string-width": "1.0.2"
}
},
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
},
"yallist": {
"version": "3.0.2",
"bundled": true,
"dev": true
}
}
},
"fstream": { "fstream": {
"version": "1.0.11", "version": "1.0.11",
"resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz",
@ -10642,6 +10112,14 @@
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
"dev": true "dev": true
}, },
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"requires": {
"safe-buffer": "5.1.1"
}
},
"string-width": { "string-width": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
@ -10675,14 +10153,6 @@
} }
} }
}, },
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"requires": {
"safe-buffer": "5.1.1"
}
},
"stringify-entities": { "stringify-entities": {
"version": "1.3.2", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-1.3.2.tgz", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-1.3.2.tgz",

@ -1954,7 +1954,7 @@ function initAugmentations() {
resetAugmentation(BladeArmorIPU); resetAugmentation(BladeArmorIPU);
var BladesSimulacrum = new Augmentation({ var BladesSimulacrum = new Augmentation({
name:AugmentationNames.BladesSimulacrum, repCost:3e3, moneyCost:80e9, name:AugmentationNames.BladesSimulacrum, repCost: 500, moneyCost: 30e9,
info:"A highly-advanced matter phase-shifter module that is embedded " + info:"A highly-advanced matter phase-shifter module that is embedded " +
"in the brainstem and cerebellum. This augmentation allows " + "in the brainstem and cerebellum. This augmentation allows " +
"the user to project and control a holographic simulacrum within an " + "the user to project and control a holographic simulacrum within an " +

@ -1,15 +1,33 @@
import { BitNodeMultipliers } from "./BitNodeMultipliers"; import { BitNodeMultipliers } from "./BitNodeMultipliers";
import { Player } from "../Player"; import { IPlayer } from "../PersonObjects/IPlayer";
import { IMap } from "../types";
function BitNode(n, name, desc="", info="") { class BitNode {
// A short description, or tagline, about the BitNode
desc: string;
// A long, detailed overview of the BitNode
info: string;
// Name of BitNode
name: string;
// BitNode number
number: number;
constructor(n: number, name: string, desc: string="", info: string="") {
this.number = n; this.number = n;
this.name = name; this.name = name;
this.desc = desc; this.desc = desc;
this.info = info; this.info = info;
}
} }
let BitNodes = {};
function initBitNodes() { export let BitNodes: IMap<BitNode> = {};
export function initBitNodes() {
BitNodes = {}; BitNodes = {};
BitNodes["BitNode1"] = new BitNode(1, "Source Genesis", "The original BitNode", BitNodes["BitNode1"] = new BitNode(1, "Source Genesis", "The original BitNode",
"The first BitNode created by the Enders to imprison the minds of humans. It became " + "The first BitNode created by the Enders to imprison the minds of humans. It became " +
@ -105,12 +123,12 @@ function initBitNodes() {
"than the humans that had created them.<br><br>" + "than the humans that had created them.<br><br>" +
"In this BitNode you will be able to access the Bladeburner Division at the NSA, which provides a new mechanic " + "In this BitNode you will be able to access the Bladeburner Division at the NSA, which provides a new mechanic " +
"for progression. Furthermore:<br><br>" + "for progression. Furthermore:<br><br>" +
"Hacking and Hacknet Nodes will be significantly less profitable<br>" + "Hacking and Hacknet Nodes will be less profitable<br>" +
"Your hacking level is reduced by 50%<br>" + "Your hacking level is reduced by 65%<br>" +
"Hacking experience gain from scripts is reduced by 75%<br>" + "Hacking experience gain from scripts is reduced by 75%<br>" +
"Corporations have 80% lower valuations and are therefore less profitable<br>" + "Corporations have 80% lower valuations and are therefore less profitable<br>" +
"Working for companies is 50% less profitable<br>" + "Working for companies is 50% less profitable<br>" +
"Crimes and Infiltration are 50% less profitable<br><br>" + "Crimes and Infiltration are 25% less profitable<br><br>" +
"Destroying this BitNode will give you Source-File 6, or if you already have this Source-File it will upgrade " + "Destroying this BitNode will give you Source-File 6, or if you already have this Source-File it will upgrade " +
"its level up to a maximum of 3. This Source-File allows you to access the NSA's Bladeburner Division in other " + "its level up to a maximum of 3. This Source-File allows you to access the NSA's Bladeburner Division in other " +
"BitNodes. In addition, this Source-File will raise both the level and experience gain rate of all your combat stats by:<br><br>" + "BitNodes. In addition, this Source-File will raise both the level and experience gain rate of all your combat stats by:<br><br>" +
@ -129,11 +147,11 @@ function initBitNodes() {
"Bladeburner skills cost twice as many skill points<br>" + "Bladeburner skills cost twice as many skill points<br>" +
"Augmentations are 3x more expensive<br>" + "Augmentations are 3x more expensive<br>" +
"Hacking and Hacknet Nodes will be significantly less profitable<br>" + "Hacking and Hacknet Nodes will be significantly less profitable<br>" +
"Your hacking level is reduced by 50%<br>" + "Your hacking level is reduced by 65%<br>" +
"Hacking experience gain from scripts is reduced by 75%<br>" + "Hacking experience gain from scripts is reduced by 75%<br>" +
"Corporations have 80% lower valuations and are therefore less profitable<br>" + "Corporations have 80% lower valuations and are therefore less profitable<br>" +
"Working for companies is 50% less profitable<br>" + "Working for companies is 50% less profitable<br>" +
"Crimes and Infiltration are 50% less profitable<br><br>" + "Crimes and Infiltration are 25% less profitable<br><br>" +
"Destroying this BitNode will give you Source-File 7, or if you already have this Source-File it will upgrade " + "Destroying this BitNode will give you Source-File 7, or if you already have this Source-File it will upgrade " +
"its level up to a maximum of 3. This Source-File allows you to access the Bladeburner Netscript API in other " + "its level up to a maximum of 3. This Source-File allows you to access the Bladeburner Netscript API in other " +
"BitNodes. In addition, this Source-File will increase all of your Bladeburner multipliers by:<br><br>" + "BitNodes. In addition, this Source-File will increase all of your Bladeburner multipliers by:<br><br>" +
@ -216,9 +234,9 @@ function initBitNodes() {
BitNodes["BitNode24"] = new BitNode(24, "", "COMING SOON"); BitNodes["BitNode24"] = new BitNode(24, "", "COMING SOON");
} }
function initBitNodeMultipliers() { export function initBitNodeMultipliers(p: IPlayer) {
if (Player.bitNodeN == null) { if (p.bitNodeN == null) {
Player.bitNodeN = 1; p.bitNodeN = 1;
} }
for (var mult in BitNodeMultipliers) { for (var mult in BitNodeMultipliers) {
if (BitNodeMultipliers.hasOwnProperty(mult)) { if (BitNodeMultipliers.hasOwnProperty(mult)) {
@ -226,7 +244,7 @@ function initBitNodeMultipliers() {
} }
} }
switch (Player.bitNodeN) { switch (p.bitNodeN) {
case 1: //Source Genesis (every multiplier is 1) case 1: //Source Genesis (every multiplier is 1)
break; break;
case 2: //Rise of the Underworld case 2: //Rise of the Underworld
@ -279,35 +297,39 @@ function initBitNodeMultipliers() {
BitNodeMultipliers.CorporationValuation = 0.5; BitNodeMultipliers.CorporationValuation = 0.5;
break; break;
case 6: //Bladeburner case 6: //Bladeburner
BitNodeMultipliers.HackingLevelMultiplier = 0.4; BitNodeMultipliers.HackingLevelMultiplier = 0.35;
BitNodeMultipliers.ServerMaxMoney = 0.5; BitNodeMultipliers.ServerMaxMoney = 0.4;
BitNodeMultipliers.ServerStartingMoney = 0.5; BitNodeMultipliers.ServerStartingMoney = 0.5;
BitNodeMultipliers.ServerStartingSecurity = 1.5; BitNodeMultipliers.ServerStartingSecurity = 1.5;
BitNodeMultipliers.ScriptHackMoney = 0.5; BitNodeMultipliers.ScriptHackMoney = 0.75;
BitNodeMultipliers.CompanyWorkMoney = 0.5; BitNodeMultipliers.CompanyWorkMoney = 0.5;
BitNodeMultipliers.CrimeMoney = 0.5; BitNodeMultipliers.CrimeMoney = 0.75;
BitNodeMultipliers.InfiltrationMoney = 0.5; BitNodeMultipliers.InfiltrationMoney = 0.75;
BitNodeMultipliers.CorporationValuation = 0.2; BitNodeMultipliers.CorporationValuation = 0.2;
BitNodeMultipliers.HacknetNodeMoney = 0.2; BitNodeMultipliers.HacknetNodeMoney = 0.2;
BitNodeMultipliers.FactionPassiveRepGain = 0; BitNodeMultipliers.FactionPassiveRepGain = 0;
BitNodeMultipliers.HackExpGain = 0.25; BitNodeMultipliers.HackExpGain = 0.25;
BitNodeMultipliers.DaedalusAugsRequirement = 1.166; // Results in 35 Augs needed
break; break;
case 7: //Bladeburner 2079 case 7: //Bladeburner 2079
BitNodeMultipliers.BladeburnerRank = 0.6; BitNodeMultipliers.BladeburnerRank = 0.6;
BitNodeMultipliers.BladeburnerSkillCost = 2; BitNodeMultipliers.BladeburnerSkillCost = 2;
BitNodeMultipliers.AugmentationMoneyCost = 3; BitNodeMultipliers.AugmentationMoneyCost = 3;
BitNodeMultipliers.HackingLevelMultiplier = 0.4; BitNodeMultipliers.HackingLevelMultiplier = 0.35;
BitNodeMultipliers.ServerMaxMoney = 0.5; BitNodeMultipliers.ServerMaxMoney = 0.4;
BitNodeMultipliers.ServerStartingMoney = 0.5; BitNodeMultipliers.ServerStartingMoney = 0.5;
BitNodeMultipliers.ServerStartingSecurity = 1.5; BitNodeMultipliers.ServerStartingSecurity = 1.5;
BitNodeMultipliers.ScriptHackMoney = 0.5; BitNodeMultipliers.ScriptHackMoney = 0.5;
BitNodeMultipliers.CompanyWorkMoney = 0.5; BitNodeMultipliers.CompanyWorkMoney = 0.5;
BitNodeMultipliers.CrimeMoney = 0.5; BitNodeMultipliers.CrimeMoney = 0.75;
BitNodeMultipliers.InfiltrationMoney = 0.5; BitNodeMultipliers.InfiltrationMoney = 0.75;
BitNodeMultipliers.CorporationValuation = 0.2; BitNodeMultipliers.CorporationValuation = 0.2;
BitNodeMultipliers.HacknetNodeMoney = 0.2; BitNodeMultipliers.HacknetNodeMoney = 0.2;
BitNodeMultipliers.FactionPassiveRepGain = 0; BitNodeMultipliers.FactionPassiveRepGain = 0;
BitNodeMultipliers.HackExpGain = 0.25; BitNodeMultipliers.HackExpGain = 0.25;
BitNodeMultipliers.FourSigmaMarketDataCost = 2;
BitNodeMultipliers.FourSigmaMarketDataApiCost = 2;
BitNodeMultipliers.DaedalusAugsRequirement = 1.166; // Results in 35 Augs needed
break; break;
case 8: //Ghost of Wall Street case 8: //Ghost of Wall Street
BitNodeMultipliers.ScriptHackMoney = 0; BitNodeMultipliers.ScriptHackMoney = 0;
@ -337,6 +359,7 @@ function initBitNodeMultipliers() {
BitNodeMultipliers.CorporationValuation = 0.5; BitNodeMultipliers.CorporationValuation = 0.5;
BitNodeMultipliers.AugmentationMoneyCost = 5; BitNodeMultipliers.AugmentationMoneyCost = 5;
BitNodeMultipliers.AugmentationRepCost = 2; BitNodeMultipliers.AugmentationRepCost = 2;
BitNodeMultipliers.HomeComputerRamCost = 1.5;
BitNodeMultipliers.PurchasedServerCost = 5; BitNodeMultipliers.PurchasedServerCost = 5;
BitNodeMultipliers.PurchasedServerLimit = 0.6; BitNodeMultipliers.PurchasedServerLimit = 0.6;
BitNodeMultipliers.PurchasedServerMaxRam = 0.5; BitNodeMultipliers.PurchasedServerMaxRam = 0.5;
@ -353,16 +376,24 @@ function initBitNodeMultipliers() {
BitNodeMultipliers.InfiltrationMoney = 2.5; BitNodeMultipliers.InfiltrationMoney = 2.5;
BitNodeMultipliers.InfiltrationRep = 2.5; BitNodeMultipliers.InfiltrationRep = 2.5;
BitNodeMultipliers.CorporationValuation = 0.01; BitNodeMultipliers.CorporationValuation = 0.01;
BitNodeMultipliers.CodingContractMoney = 0.5;
BitNodeMultipliers.FourSigmaMarketDataCost = 4;
BitNodeMultipliers.FourSigmaMarketDataApiCost = 4;
break; break;
case 12: //The Recursion case 12: //The Recursion
var sf12Lvl = 0; var sf12Lvl = 0;
for (var i = 0; i < Player.sourceFiles.length; i++) { for (var i = 0; i < p.sourceFiles.length; i++) {
if (Player.sourceFiles[i].n === 12) { if (p.sourceFiles[i].n === 12) {
sf12Lvl = Player.sourceFiles[i].lvl; sf12Lvl = p.sourceFiles[i].lvl;
} }
} }
var inc = Math.pow(1.02, sf12Lvl); var inc = Math.pow(1.02, sf12Lvl);
var dec = 1/inc; var dec = 1/inc;
// Multiplier for number of augs needed for Daedalus increases
// up to a maximum of 1.34, which results in 40 Augs required
BitNodeMultipliers.DaedalusAugsRequirement = Math.min(inc, 1.34);
BitNodeMultipliers.HackingLevelMultiplier = dec; BitNodeMultipliers.HackingLevelMultiplier = dec;
BitNodeMultipliers.StrengthLevelMultiplier = dec; BitNodeMultipliers.StrengthLevelMultiplier = dec;
BitNodeMultipliers.DefenseLevelMultiplier = dec; BitNodeMultipliers.DefenseLevelMultiplier = dec;
@ -378,6 +409,8 @@ function initBitNodeMultipliers() {
//Does not scale, otherwise security might start at 300+ //Does not scale, otherwise security might start at 300+
BitNodeMultipliers.ServerStartingSecurity = 1.5; BitNodeMultipliers.ServerStartingSecurity = 1.5;
BitNodeMultipliers.HomeComputerRamCost = inc;
BitNodeMultipliers.PurchasedServerCost = inc; BitNodeMultipliers.PurchasedServerCost = inc;
BitNodeMultipliers.PurchasedServerLimit = dec; BitNodeMultipliers.PurchasedServerLimit = dec;
BitNodeMultipliers.PurchasedServerMaxRam = dec; BitNodeMultipliers.PurchasedServerMaxRam = dec;
@ -404,6 +437,9 @@ function initBitNodeMultipliers() {
BitNodeMultipliers.InfiltrationMoney = dec; BitNodeMultipliers.InfiltrationMoney = dec;
BitNodeMultipliers.InfiltrationRep = dec; BitNodeMultipliers.InfiltrationRep = dec;
BitNodeMultipliers.FourSigmaMarketDataCost = inc;
BitNodeMultipliers.FourSigmaMarketDataApiCost = inc;
BitNodeMultipliers.CorporationValuation = dec; BitNodeMultipliers.CorporationValuation = dec;
BitNodeMultipliers.BladeburnerRank = dec; BitNodeMultipliers.BladeburnerRank = dec;
@ -414,7 +450,3 @@ function initBitNodeMultipliers() {
break; break;
} }
} }
export {initBitNodes,
BitNodes,
initBitNodeMultipliers};

@ -69,6 +69,11 @@ interface IBitNodeMultipliers {
*/ */
CrimeMoney: number; CrimeMoney: number;
/**
* Influences how many Augmentations you need in order to get invited to the Daedalus faction
*/
DaedalusAugsRequirement: number;
/** /**
* Influences how quickly the player's defense level (not exp) scales * Influences how quickly the player's defense level (not exp) scales
*/ */
@ -94,6 +99,16 @@ interface IBitNodeMultipliers {
*/ */
FactionWorkRepGain: number; FactionWorkRepGain: number;
/**
* Influences how much it costs to unlock the stock market's 4S Market Data API
*/
FourSigmaMarketDataApiCost: number;
/**
* Influences how much it costs to unlock the stock market's 4S Market Data (NOT API)
*/
FourSigmaMarketDataCost: number;
/** /**
* Influences the experienced gained when hacking a server. * Influences the experienced gained when hacking a server.
*/ */
@ -109,6 +124,11 @@ interface IBitNodeMultipliers {
*/ */
HacknetNodeMoney: number; HacknetNodeMoney: number;
/**
* Influences how much money it costs to upgrade your home computer's RAM
*/
HomeComputerRamCost: number;
/** /**
* Influences how much money is gained when the player infiltrates a company. * Influences how much money is gained when the player infiltrates a company.
*/ */
@ -178,6 +198,9 @@ interface IBitNodeMultipliers {
* Influences how quickly the player's strength level (not exp) scales * Influences how quickly the player's strength level (not exp) scales
*/ */
StrengthLevelMultiplier: number; StrengthLevelMultiplier: number;
// Index signature
[key: string]: number;
} }
/** /**
@ -198,6 +221,8 @@ export const BitNodeMultipliers: IBitNodeMultipliers = {
ServerStartingSecurity: 1, ServerStartingSecurity: 1,
ServerWeakenRate: 1, ServerWeakenRate: 1,
HomeComputerRamCost: 1,
PurchasedServerCost: 1, PurchasedServerCost: 1,
PurchasedServerLimit: 1, PurchasedServerLimit: 1,
PurchasedServerMaxRam: 1, PurchasedServerMaxRam: 1,
@ -225,8 +250,13 @@ export const BitNodeMultipliers: IBitNodeMultipliers = {
InfiltrationMoney: 1, InfiltrationMoney: 1,
InfiltrationRep: 1, InfiltrationRep: 1,
FourSigmaMarketDataCost: 1,
FourSigmaMarketDataApiCost: 1,
CorporationValuation: 1, CorporationValuation: 1,
BladeburnerRank: 1, BladeburnerRank: 1,
BladeburnerSkillCost: 1, BladeburnerSkillCost: 1,
DaedalusAugsRequirement: 1,
}; };

@ -10,6 +10,7 @@ import { Locations } from "./Locations";
import { Player } from "./Player"; import { Player } from "./Player";
import { hackWorldDaemon, redPillFlag } from "./RedPill"; import { hackWorldDaemon, redPillFlag } from "./RedPill";
import { numeralWrapper } from "./ui/numeralFormat"; import { numeralWrapper } from "./ui/numeralFormat";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import { KEY } from "../utils/helpers/keyCodes"; import { KEY } from "../utils/helpers/keyCodes";
import { createProgressBarText } from "../utils/helpers/createProgressBarText"; import { createProgressBarText } from "../utils/helpers/createProgressBarText";
@ -31,46 +32,52 @@ import { removeElement } from "../utils/uiHelpers/rem
import { removeElementById } from "../utils/uiHelpers/removeElementById"; import { removeElementById } from "../utils/uiHelpers/removeElementById";
var CityNames = ["Aevum", "Chongqing", "Sector-12", "New Tokyo", "Ishima", "Volhaven"]; const CityNames = ["Aevum", "Chongqing", "Sector-12", "New Tokyo", "Ishima", "Volhaven"];
var CyclesPerSecond = 5; //Game cycle is 200 ms const CyclesPerSecond = 5; //Game cycle is 200 ms
var StaminaGainPerSecond = 0.0085; const StaminaGainPerSecond = 0.0085;
var BaseStaminaLoss = 0.285; //Base stamina loss per action. Increased based on difficulty const BaseStaminaLoss = 0.285; //Base stamina loss per action. Increased based on difficulty
var MaxStaminaToGainFactor = 70000; //Max Stamina is divided by this to get bonus stamina gain const MaxStaminaToGainFactor = 70000; //Max Stamina is divided by this to get bonus stamina gain
var DifficultyToTimeFactor = 10; //Action Difficulty divided by this to get base action time const DifficultyToTimeFactor = 10; //Action Difficulty divided by this to get base action time
//The difficulty multiplier affects stamina loss and hp loss of an action. Also affects //The difficulty multiplier affects stamina loss and hp loss of an action. Also affects
//experience gain. Its formula is: //experience gain. Its formula is:
//difficulty ^ exponentialFactor + difficulty / linearFactor //difficulty ^ exponentialFactor + difficulty / linearFactor
var DiffMultExponentialFactor = 0.28; const DiffMultExponentialFactor = 0.28;
var DiffMultLinearFactor = 650; const DiffMultLinearFactor = 650;
var EffAgiLinearFactor = 40e3; // These factors are used to calculate action time.
var EffDexLinearFactor = 40e3; // They affect how much action time is reduced based on your agility and dexterity
var EffAgiExponentialFactor = 0.032; const EffAgiLinearFactor = 10e3;
var EffDexExponentialFactor = 0.03; const EffDexLinearFactor = 10e3;
const EffAgiExponentialFactor = 0.04;
const EffDexExponentialFactor = 0.035;
var BaseRecruitmentTimeNeeded = 300; //Base time needed (s) to complete a Recruitment action const BaseRecruitmentTimeNeeded = 300; //Base time needed (s) to complete a Recruitment action
var PopulationThreshold = 1e9; //Population at which success rates start being affected const PopulationThreshold = 1e9; // Population which determines baseline success rate
var ChaosThreshold = 50; //City chaos level after which it starts making tasks harder const PopulationExponent = 0.7; // Exponent that influences how different populations affect success rate
const ChaosThreshold = 50; //City chaos level after which it starts making tasks harder
var BaseStatGain = 1; //Base stat gain per second const BaseStatGain = 1; //Base stat gain per second
var BaseIntGain = 0.001; //Base intelligence stat gain const BaseIntGain = 0.001; //Base intelligence stat gain
var ActionCountGrowthPeriod = 300; //Time (s) it takes for action count to grow by its specified value const ActionCountGrowthPeriod = 480; //Time (s) it takes for action count to grow by its specified value
var RankToFactionRepFactor = 2; //Delta Faction Rep = this * Delta Rank const RankToFactionRepFactor = 2; //Delta Faction Rep = this * Delta Rank
var RankNeededForFaction = 25; const RankNeededForFaction = 25;
var ContractSuccessesPerLevel = 3.5; //How many successes you need to level up a contract const ContractSuccessesPerLevel = 3; //How many successes you need to level up a contract
var OperationSuccessesPerLevel = 3; //How many successes you need to level up an op const OperationSuccessesPerLevel = 2.5; //How many successes you need to level up an op
var RanksPerSkillPoint = 4; //How many ranks needed to get 1 Skill Point const RanksPerSkillPoint = 3; //How many ranks needed to get 1 Skill Point
var ContractBaseMoneyGain = 50e3; //Base Money Gained per contract const ContractBaseMoneyGain = 250e3; //Base Money Gained per contract
const HrcHpGain = 2; // HP gained from Hyperbolic Regeneration Chamber
const HrcStaminaGain = 0.1; // Stamina gained from Hyperbolic Regeneration Chamber
//DOM related variables //DOM related variables
var ActiveActionCssClass = "bladeburner-active-action"; var ActiveActionCssClass = "bladeburner-active-action";
@ -182,7 +189,7 @@ $(document).keydown(function(event) {
var prevCommand = consoleHistory[consoleHistoryIndex]; var prevCommand = consoleHistory[consoleHistoryIndex];
DomElems.consoleInput.value = prevCommand; DomElems.consoleInput.value = prevCommand;
setTimeout(function(){DomElems.consoleInput.selectionStart = DomElems.consoleInput.selectionEnd = 10000; }, 0); setTimeoutRef(function(){DomElems.consoleInput.selectionStart = DomElems.consoleInput.selectionEnd = 10000; }, 0);
} }
if (event.keyCode === KEY.DOWNARROW) { if (event.keyCode === KEY.DOWNARROW) {
@ -212,11 +219,11 @@ function City(params={}) {
this.name = params.name ? params.name : Locations.Sector12; this.name = params.name ? params.name : Locations.Sector12;
//Synthoid population and estimate //Synthoid population and estimate
this.pop = params.pop ? params.pop : getRandomInt(800e6, 1.2*PopulationThreshold); this.pop = params.pop ? params.pop : getRandomInt(PopulationThreshold, 1.5 * PopulationThreshold);
this.popEst = this.pop * (Math.random() + 0.5); this.popEst = this.pop * (Math.random() + 0.5);
//Number of Synthoid communities population and estimate //Number of Synthoid communities population and estimate
this.comms = params.comms ? params.comms : getRandomInt(5, 100); this.comms = params.comms ? params.comms : getRandomInt(5, 150);
this.commsEst = this.comms + getRandomInt(-5, 5); this.commsEst = this.comms + getRandomInt(-5, 5);
if (this.commsEst < 0) {this.commsEst = 0;} if (this.commsEst < 0) {this.commsEst = 0;}
this.chaos = 0; this.chaos = 0;
@ -491,9 +498,9 @@ Action.prototype.getSuccessChance = function(inst, params={}) {
if (!(this instanceof BlackOperation)) { if (!(this instanceof BlackOperation)) {
var city = inst.getCurrentCity(); var city = inst.getCurrentCity();
if (params.est) { if (params.est) {
competence *= (city.popEst / PopulationThreshold); competence *= Math.pow((city.popEst / PopulationThreshold), PopulationExponent);
} else { } else {
competence *= (city.pop / PopulationThreshold); competence *= Math.pow((city.pop / PopulationThreshold), PopulationExponent);
} }
//Too high of a chaos results in lower chances //Too high of a chaos results in lower chances
@ -582,7 +589,7 @@ Reviver.constructors.Action = Action;
var GeneralActions = {}; //Training, Field Analysis, Recruitment, etc. var GeneralActions = {}; //Training, Field Analysis, Recruitment, etc.
//Action Identifier //Action Identifier
var ActionTypes = Object.freeze({ const ActionTypes = Object.freeze({
"Idle": 1, "Idle": 1,
"Contract": 2, "Contract": 2,
"Operation": 3, "Operation": 3,
@ -591,7 +598,9 @@ var ActionTypes = Object.freeze({
"Training": 5, "Training": 5,
"Recruitment": 6, "Recruitment": 6,
"FieldAnalysis": 7, "FieldAnalysis": 7,
"Field Analysis": 7 "Field Analysis": 7,
"Diplomacy": 8,
"Hyperbolic Regeneration Chamber": 9,
}); });
function ActionIdentifier(params={}) { function ActionIdentifier(params={}) {
if (params.name) {this.name = params.name;} if (params.name) {this.name = params.name;}
@ -744,7 +753,7 @@ Bladeburner.prototype.create = function() {
"whatever city you are currently in.", "whatever city you are currently in.",
baseDifficulty:125,difficultyFac:1.02,rewardFac:1.041, baseDifficulty:125,difficultyFac:1.02,rewardFac:1.041,
rankGain:0.3, hpLoss:0.5, rankGain:0.3, hpLoss:0.5,
count:getRandomInt(25, 500), countGrowth:getRandomInt(5, 75)/10, count:getRandomInt(25, 150), countGrowth:getRandomInt(5, 75)/10,
weights:{hack:0,str:0.05,def:0.05,dex:0.35,agi:0.35,cha:0.1, int:0.05}, weights:{hack:0,str:0.05,def:0.05,dex:0.35,agi:0.35,cha:0.1, int:0.05},
decays:{hack:0,str:0.91,def:0.91,dex:0.91,agi:0.91,cha:0.9, int:1}, decays:{hack:0,str:0.91,def:0.91,dex:0.91,agi:0.91,cha:0.9, int:1},
isStealth:true isStealth:true
@ -756,7 +765,7 @@ Bladeburner.prototype.create = function() {
"current city, and will also increase its chaos level.", "current city, and will also increase its chaos level.",
baseDifficulty:250, difficultyFac:1.04,rewardFac:1.085, baseDifficulty:250, difficultyFac:1.04,rewardFac:1.085,
rankGain:0.9, hpLoss:1, rankGain:0.9, hpLoss:1,
count:getRandomInt(5, 500), countGrowth:getRandomInt(5, 75)/10, count:getRandomInt(5, 150), countGrowth:getRandomInt(5, 75)/10,
weights:{hack:0,str:0.15,def:0.15,dex:0.25,agi:0.25,cha:0.1, int:0.1}, weights:{hack:0,str:0.15,def:0.15,dex:0.25,agi:0.25,cha:0.1, int:0.1},
decays:{hack:0,str:0.91,def:0.91,dex:0.91,agi:0.91,cha:0.8, int:0.9}, decays:{hack:0,str:0.91,def:0.91,dex:0.91,agi:0.91,cha:0.8, int:0.9},
isKill:true isKill:true
@ -768,7 +777,7 @@ Bladeburner.prototype.create = function() {
"city, and will also increase its chaos level.", "city, and will also increase its chaos level.",
baseDifficulty:200, difficultyFac:1.03, rewardFac:1.065, baseDifficulty:200, difficultyFac:1.03, rewardFac:1.065,
rankGain:0.6, hpLoss:1, rankGain:0.6, hpLoss:1,
count:getRandomInt(5, 500), countGrowth:getRandomInt(5,75)/10, count:getRandomInt(5, 150), countGrowth:getRandomInt(5, 75)/10,
weights:{hack:0,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0.1, int:0.1}, weights:{hack:0,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0.1, int:0.1},
decays:{hack:0,str:0.91,def:0.91,dex:0.91,agi:0.91,cha:0.8, int:0.9}, decays:{hack:0,str:0.91,def:0.91,dex:0.91,agi:0.91,cha:0.8, int:0.9},
isKill:true isKill:true
@ -783,7 +792,7 @@ Bladeburner.prototype.create = function() {
"You will NOT lose HP from failed Investigation ops.", "You will NOT lose HP from failed Investigation ops.",
baseDifficulty:400, difficultyFac:1.03,rewardFac:1.07,reqdRank:25, baseDifficulty:400, difficultyFac:1.03,rewardFac:1.07,reqdRank:25,
rankGain:2.2, rankLoss:0.2, rankGain:2.2, rankLoss:0.2,
count:getRandomInt(1, 250), countGrowth:getRandomInt(10, 40)/10, count:getRandomInt(1, 100), countGrowth:getRandomInt(10, 40)/10,
weights:{hack:0.25,str:0.05,def:0.05,dex:0.2,agi:0.1,cha:0.25, int:0.1}, weights:{hack:0.25,str:0.05,def:0.05,dex:0.2,agi:0.1,cha:0.25, int:0.1},
decays:{hack:0.85,str:0.9,def:0.9,dex:0.9,agi:0.9,cha:0.7, int:0.9}, decays:{hack:0.85,str:0.9,def:0.9,dex:0.9,agi:0.9,cha:0.7, int:0.9},
isStealth:true isStealth:true
@ -796,7 +805,7 @@ Bladeburner.prototype.create = function() {
"data.", "data.",
baseDifficulty:500, difficultyFac:1.04, rewardFac:1.09, reqdRank:100, baseDifficulty:500, difficultyFac:1.04, rewardFac:1.09, reqdRank:100,
rankGain:4.4, rankLoss:0.4, hpLoss:2, rankGain:4.4, rankLoss:0.4, hpLoss:2,
count:getRandomInt(1, 250), countGrowth:getRandomInt(10, 40)/10, count:getRandomInt(1, 100), countGrowth:getRandomInt(10, 40)/10,
weights:{hack:0.2,str:0.05,def:0.05,dex:0.2,agi:0.2,cha:0.2, int:0.1}, weights:{hack:0.2,str:0.05,def:0.05,dex:0.2,agi:0.2,cha:0.2, int:0.1},
decays:{hack:0.8,str:0.9,def:0.9,dex:0.9,agi:0.9,cha:0.7, int:0.9}, decays:{hack:0.8,str:0.9,def:0.9,dex:0.9,agi:0.9,cha:0.7, int:0.9},
isStealth:true isStealth:true
@ -807,7 +816,7 @@ Bladeburner.prototype.create = function() {
"notorious Synthoid criminals.", "notorious Synthoid criminals.",
baseDifficulty:650, difficultyFac:1.04, rewardFac:1.095, reqdRank:500, baseDifficulty:650, difficultyFac:1.04, rewardFac:1.095, reqdRank:500,
rankGain:5.5, rankLoss:0.5, hpLoss:2.5, rankGain:5.5, rankLoss:0.5, hpLoss:2.5,
count:getRandomInt(1, 300), countGrowth:getRandomInt(3, 40)/10, count:getRandomInt(1, 150), countGrowth:getRandomInt(3, 40)/10,
weights:{hack:0.25,str:0.05,def:0.05,dex:0.25,agi:0.1,cha:0.2, int:0.1}, weights:{hack:0.25,str:0.05,def:0.05,dex:0.25,agi:0.1,cha:0.2, int:0.1},
decays:{hack:0.8,str:0.85,def:0.85,dex:0.85,agi:0.85,cha:0.7, int:0.9}, decays:{hack:0.8,str:0.85,def:0.85,dex:0.85,agi:0.85,cha:0.7, int:0.9},
isStealth:true isStealth:true
@ -819,7 +828,7 @@ Bladeburner.prototype.create = function() {
"in order for this Operation to be successful", "in order for this Operation to be successful",
baseDifficulty:800, difficultyFac:1.045, rewardFac:1.1, reqdRank:3000, baseDifficulty:800, difficultyFac:1.045, rewardFac:1.1, reqdRank:3000,
rankGain:55,rankLoss:2.5,hpLoss:50, rankGain:55,rankLoss:2.5,hpLoss:50,
count:getRandomInt(1, 200), countGrowth:getRandomInt(2, 40)/10, count:getRandomInt(1, 150), countGrowth:getRandomInt(2, 40)/10,
weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1}, weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},
decays:{hack:0.7,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.9}, decays:{hack:0.7,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.9},
isKill:true isKill:true
@ -831,7 +840,7 @@ Bladeburner.prototype.create = function() {
"drawing any attention. Stealth and discretion are key.", "drawing any attention. Stealth and discretion are key.",
baseDifficulty:1000, difficultyFac:1.05, rewardFac:1.11, reqdRank:20e3, baseDifficulty:1000, difficultyFac:1.05, rewardFac:1.11, reqdRank:20e3,
rankGain:22, rankLoss:2, hpLoss:10, rankGain:22, rankLoss:2, hpLoss:10,
count:getRandomInt(1, 250), countGrowth:getRandomInt(1, 20)/10, count:getRandomInt(1, 150), countGrowth:getRandomInt(1, 20)/10,
weights:{hack:0.1,str:0.1,def:0.1,dex:0.3,agi:0.3,cha:0, int:0.1}, weights:{hack:0.1,str:0.1,def:0.1,dex:0.3,agi:0.3,cha:0, int:0.1},
decays:{hack:0.7,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.9}, decays:{hack:0.7,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.9},
isStealth:true, isKill:true isStealth:true, isKill:true
@ -843,7 +852,7 @@ Bladeburner.prototype.create = function() {
"in the Synthoid communities.", "in the Synthoid communities.",
baseDifficulty:1500, difficultyFac:1.06, rewardFac:1.14, reqdRank:50e3, baseDifficulty:1500, difficultyFac:1.06, rewardFac:1.14, reqdRank:50e3,
rankGain:44, rankLoss:4, hpLoss:5, rankGain:44, rankLoss:4, hpLoss:5,
count:getRandomInt(1, 200), countGrowth:getRandomInt(1, 20)/10, count:getRandomInt(1, 150), countGrowth:getRandomInt(1, 20)/10,
weights:{hack:0.1,str:0.1,def:0.1,dex:0.3,agi:0.3,cha:0, int:0.1}, weights:{hack:0.1,str:0.1,def:0.1,dex:0.3,agi:0.3,cha:0, int:0.1},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.8}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.8},
isStealth:true, isKill:true isStealth:true, isKill:true
@ -981,7 +990,7 @@ Bladeburner.prototype.changeRank = function(change) {
} }
} }
//Gain skill points. You get 1 every 4 ranks // Gain skill points
var rankNeededForSp = (this.totalSkillPoints+1) * RanksPerSkillPoint; var rankNeededForSp = (this.totalSkillPoints+1) * RanksPerSkillPoint;
if (this.maxRank >= rankNeededForSp) { if (this.maxRank >= rankNeededForSp) {
//Calculate how many skill points to gain //Calculate how many skill points to gain
@ -1143,16 +1152,18 @@ Bladeburner.prototype.startAction = function(actionId) {
exceptionAlert(e); exceptionAlert(e);
} }
break; break;
case ActionTypes["Training"]:
this.actionTimeToComplete = 30;
break;
case ActionTypes["Recruitment"]: case ActionTypes["Recruitment"]:
this.actionTimeToComplete = this.getRecruitmentTime(); this.actionTimeToComplete = this.getRecruitmentTime();
break; break;
case ActionTypes["Training"]:
case ActionTypes["FieldAnalysis"]: case ActionTypes["FieldAnalysis"]:
case ActionTypes["Field Analysis"]: case ActionTypes["Field Analysis"]:
this.actionTimeToComplete = 30; this.actionTimeToComplete = 30;
break; break;
case ActionTypes["Diplomacy"]:
case ActionTypes["Hyperbolic Regeneration Chamber"]:
this.actionTimeToComplete = 60;
break;
default: default:
throw new Error("Invalid Action Type in Bladeburner.startAction(): " + actionId.type); throw new Error("Invalid Action Type in Bladeburner.startAction(): " + actionId.type);
break; break;
@ -1204,6 +1215,7 @@ Bladeburner.prototype.completeAction = function() {
if (!isOperation) { if (!isOperation) {
moneyGain = ContractBaseMoneyGain * rewardMultiplier * this.skillMultipliers.money; moneyGain = ContractBaseMoneyGain * rewardMultiplier * this.skillMultipliers.money;
Player.gainMoney(moneyGain); Player.gainMoney(moneyGain);
Player.recordMoneySource(moneyGain, "bladeburner");
} }
if (isOperation) { if (isOperation) {
@ -1378,7 +1390,6 @@ Bladeburner.prototype.completeAction = function() {
break; break;
case ActionTypes["Recruitment"]: case ActionTypes["Recruitment"]:
var successChance = this.getRecruitmentSuccessChance(); var successChance = this.getRecruitmentSuccessChance();
console.log("Bladeburner recruitment success chance: " + successChance);
if (Math.random() < successChance) { if (Math.random() < successChance) {
var expGain = 2 * BaseStatGain * this.actionTimeToComplete; var expGain = 2 * BaseStatGain * this.actionTimeToComplete;
Player.gainCharismaExp(expGain); Player.gainCharismaExp(expGain);
@ -1395,7 +1406,25 @@ Bladeburner.prototype.completeAction = function() {
} }
this.startAction(this.action); //Repeat action this.startAction(this.action); //Repeat action
break; break;
case ActionTypes["Diplomacy"]:
var eff = this.getDiplomacyEffectiveness();
this.getCurrentCity().chaos *= eff;
if (this.getCurrentCity().chaos < 0) { this.getCurrentCity().chaos = 0; }
if (this.logging.general) {
this.log(`Diplomacy completed. Chaos levels in the current city fell by ${numeralWrapper.formatPercentage(1 - eff)}`);
}
this.startAction(this.action); // Repeat Action
break;
case ActionTypes["Hyperbolic Regeneration Chamber"]:
Player.regenerateHp(HrcHpGain);
this.stamina = Math.max(this.maxStamina, this.stamina + HrcStaminaGain); // TODO Turn this into a const and adjust value
this.startAction(this.action);
if (this.logging.general) {
this.log(`Rested in Hyperbolic Regeneration Chamber. Restored ${HrcHpGain} HP and gained ${HrcStaminaGain} stamina`);
}
break;
default: default:
console.error(`Bladeburner.completeAction() called for invalid action: ${this.action.type}`);
break; break;
} }
} }
@ -1484,7 +1513,7 @@ Bladeburner.prototype.completeOperation = function(success) {
--city.comms; --city.comms;
--city.commsEst; --city.commsEst;
} else { } else {
var change = getRandomInt(-3, -1); var change = getRandomInt(-10, -5) / 10;
city.changePopulationByPercentage(change, {nonZero:true}); city.changePopulationByPercentage(change, {nonZero:true});
} }
city.changeChaosByPercentage(getRandomInt(1, 5)); city.changeChaosByPercentage(getRandomInt(1, 5));
@ -1516,6 +1545,15 @@ Bladeburner.prototype.getRecruitmentSuccessChance = function() {
return Math.pow(Player.charisma, 0.45) / (this.teamSize + 1); return Math.pow(Player.charisma, 0.45) / (this.teamSize + 1);
} }
Bladeburner.prototype.getDiplomacyEffectiveness = function() {
// Returns a decimal by which the city's chaos level should be multiplied (e.g. 0.98)
const CharismaLinearFactor = 1e3;
const CharismaExponentialFactor = 0.045;
const charismaEff = Math.pow(Player.charisma, CharismaExponentialFactor) + Player.charisma / CharismaLinearFactor;
return (100 - charismaEff) / 100;
}
//Process stat gains from Contracts, Operations, and Black Operations //Process stat gains from Contracts, Operations, and Black Operations
//@action(Action obj) - Derived action class //@action(Action obj) - Derived action class
//@success(bool) - Whether action was successful //@success(bool) - Whether action was successful
@ -1612,20 +1650,20 @@ Bladeburner.prototype.randomEvent = function() {
} else if (chance <= 0.7) { } else if (chance <= 0.7) {
//Synthoid Riots (+chaos), 20% //Synthoid Riots (+chaos), 20%
sourceCity.chaos += 1; sourceCity.chaos += 1;
sourceCity.chaos *= (1 + getRandomInt(5, 10) / 100); sourceCity.chaos *= (1 + getRandomInt(5, 20) / 100);
if (this.logging.events) { if (this.logging.events) {
this.log("Tensions between Synthoids and humans lead to riots in " + sourceCityName + "! Chaos increased"); this.log("Tensions between Synthoids and humans lead to riots in " + sourceCityName + "! Chaos increased");
} }
} else if (chance <= 0.9) { } else if (chance <= 0.9) {
//Less Synthoids, 20% //Less Synthoids, 20%
var percentage = getRandomInt(5, 20) / 100; var percentage = getRandomInt(8, 20) / 100;
var count = Math.round(sourceCity.pop * percentage); var count = Math.round(sourceCity.pop * percentage);
sourceCity.pop -= count; sourceCity.pop -= count;
if (this.logging.events) { if (this.logging.events) {
this.log("Intelligence indicates that the Synthoid population of " + sourceCityName + " just changed significantly"); this.log("Intelligence indicates that the Synthoid population of " + sourceCityName + " just changed significantly");
} }
} }
//20% chance of nothing happening // 10% chance of nothing happening
} }
Bladeburner.prototype.triggerPotentialMigration = function(sourceCityName, chance) { Bladeburner.prototype.triggerPotentialMigration = function(sourceCityName, chance) {
@ -3347,6 +3385,14 @@ Bladeburner.prototype.getActionIdFromTypeAndName = function(type="", name="") {
action.type = ActionTypes["Field Analysis"]; action.type = ActionTypes["Field Analysis"];
action.name = "Field Analysis"; action.name = "Field Analysis";
break; break;
case "diplomacy":
action.type = ActionTypes["Diplomacy"];
action.name = "Diplomacy";
break;
case "hyperbolic regeneration chamber":
action.type = ActionTypes["Hyperbolic Regeneration Chamber"];
action.name = "Hyperbolic Regeneration Chamber";
break;
default: default:
return null; return null;
} }
@ -3784,14 +3830,14 @@ function initBladeburner() {
name:SkillNames.BladesIntuition, name:SkillNames.BladesIntuition,
desc:"Each level of this skill increases your success chance " + desc:"Each level of this skill increases your success chance " +
"for all Contracts, Operations, and BlackOps by 3%", "for all Contracts, Operations, and BlackOps by 3%",
baseCost:5, costInc:2, baseCost: 3, costInc: 2.1,
successChanceAll:3 successChanceAll:3
}); });
Skills[SkillNames.Cloak] = new Skill({ Skills[SkillNames.Cloak] = new Skill({
name:SkillNames.Cloak, name:SkillNames.Cloak,
desc:"Each level of this skill increases your " + desc:"Each level of this skill increases your " +
"success chance in stealth-related Contracts, Operations, and BlackOps by 5.5%", "success chance in stealth-related Contracts, Operations, and BlackOps by 5.5%",
baseCost:3, costInc:1, baseCost: 2, costInc: 1.1,
successChanceStealth:5.5 successChanceStealth:5.5
}); });
@ -3802,42 +3848,42 @@ function initBladeburner() {
name:SkillNames.ShortCircuit, name:SkillNames.ShortCircuit,
desc:"Each level of this skill increases your success chance " + desc:"Each level of this skill increases your success chance " +
"in Contracts, Operations, and BlackOps that involve retirement by 5.5%", "in Contracts, Operations, and BlackOps that involve retirement by 5.5%",
baseCost:3, costInc:2, baseCost: 2, costInc: 2.1,
successChanceKill:5.5 successChanceKill:5.5
}); });
Skills[SkillNames.DigitalObserver] = new Skill({ Skills[SkillNames.DigitalObserver] = new Skill({
name:SkillNames.DigitalObserver, name:SkillNames.DigitalObserver,
desc:"Each level of this skill increases your success chance in " + desc:"Each level of this skill increases your success chance in " +
"all Operations and BlackOps by 4%", "all Operations and BlackOps by 4%",
baseCost:5, costInc:2, baseCost: 2, costInc: 2.1,
successChanceOperation:4 successChanceOperation:4
}); });
Skills[SkillNames.Tracer] = new Skill({ Skills[SkillNames.Tracer] = new Skill({
name:SkillNames.Tracer, name:SkillNames.Tracer,
desc:"Each level of this skill increases your success chance in " + desc:"Each level of this skill increases your success chance in " +
"all Contracts by 4%", "all Contracts by 4%",
baseCost:3, costInc:2, baseCost: 2, costInc: 2.1,
successChanceContract:4 successChanceContract:4
}); });
Skills[SkillNames.Overclock] = new Skill({ Skills[SkillNames.Overclock] = new Skill({
name:SkillNames.Overclock, name:SkillNames.Overclock,
desc:"Each level of this skill decreases the time it takes " + desc:"Each level of this skill decreases the time it takes " +
"to attempt a Contract, Operation, and BlackOp by 1% (Max Level: 95)", "to attempt a Contract, Operation, and BlackOp by 1% (Max Level: 90)",
baseCost:4, costInc:1.1, maxLvl:95, baseCost: 3, costInc: 1.4, maxLvl: 90,
actionTime:1 actionTime:1
}); });
Skills[SkillNames.Reaper] = new Skill({ Skills[SkillNames.Reaper] = new Skill({
name:SkillNames.Reaper, name: SkillNames.Reaper,
desc:"Each level of this skill increases your effective combat stats for Bladeburner actions by 3%", desc: "Each level of this skill increases your effective combat stats for Bladeburner actions by 2%",
baseCost:3, costInc:2, baseCost: 2, costInc: 2.1,
effStr:3, effDef:3, effDex:3, effAgi:3 effStr: 2, effDef: 2, effDex: 2, effAgi: 2
}); });
Skills[SkillNames.EvasiveSystem] = new Skill({ Skills[SkillNames.EvasiveSystem] = new Skill({
name:SkillNames.EvasiveSystem, name:SkillNames.EvasiveSystem,
desc:"Each level of this skill increases your effective " + desc:"Each level of this skill increases your effective " +
"dexterity and agility for Bladeburner actions by 5%", "dexterity and agility for Bladeburner actions by 4%",
baseCost:2, costInc: 1, baseCost: 2, costInc: 2.1,
effDex:5, effAgi:5 effDex: 4, effAgi: 4
}); });
Skills[SkillNames.Datamancer] = new Skill({ Skills[SkillNames.Datamancer] = new Skill({
name:SkillNames.Datamancer, name:SkillNames.Datamancer,
@ -3856,19 +3902,20 @@ function initBladeburner() {
}); });
Skills[SkillNames.HandsOfMidas] = new Skill({ Skills[SkillNames.HandsOfMidas] = new Skill({
name: SkillNames.HandsOfMidas, name: SkillNames.HandsOfMidas,
desc: "Each level of this skill increases the amount of money you receive from Contracts by 5%", desc: "Each level of this skill increases the amount of money you receive from Contracts by 10%",
baseCost: 2, costInc: 2.5, baseCost: 2, costInc: 2.5,
money: 5, money: 10,
}); });
Skills[SkillNames.Hyperdrive] = new Skill({ Skills[SkillNames.Hyperdrive] = new Skill({
name: SkillNames.Hyperdrive, name: SkillNames.Hyperdrive,
desc: "Each level of this skill increases the experience earned from Contracts, Operations, and BlackOps by 4%", desc: "Each level of this skill increases the experience earned from Contracts, Operations, and BlackOps by 10%",
baseCost: 1, costInc: 3, baseCost: 1, costInc: 2.5,
expGain: 4, expGain: 10,
}); });
//General Actions //General Actions
var actionName = "Training"; let actionName;
actionName = "Training";
GeneralActions[actionName] = new Action({ GeneralActions[actionName] = new Action({
name:actionName, name:actionName,
desc:"Improve your abilities at the Bladeburner unit's specialized training " + desc:"Improve your abilities at the Bladeburner unit's specialized training " +
@ -3876,7 +3923,7 @@ function initBladeburner() {
"increases your max stamina." "increases your max stamina."
}); });
var actionName = "Field Analysis"; actionName = "Field Analysis";
GeneralActions[actionName] = new Action({ GeneralActions[actionName] = new Action({
name:actionName, name:actionName,
desc:"Mine and analyze Synthoid-related data. This improve the " + desc:"Mine and analyze Synthoid-related data. This improve the " +
@ -3886,7 +3933,7 @@ function initBladeburner() {
"Does NOT require stamina." "Does NOT require stamina."
}); });
var actionName = "Recruitment"; actionName = "Recruitment";
GeneralActions[actionName] = new Action({ GeneralActions[actionName] = new Action({
name:actionName, name:actionName,
desc:"Attempt to recruit members for your Bladeburner team. These members " + desc:"Attempt to recruit members for your Bladeburner team. These members " +
@ -3894,6 +3941,21 @@ function initBladeburner() {
"Does NOT require stamina." "Does NOT require stamina."
}); });
actionName = "Diplomacy";
GeneralActions[actionName] = new Action({
name: actionName,
desc: "Improve diplomatic relations with the Synthoid population. " +
"Completing this action will reduce the Chaos level in your current city.<br><br>" +
"Does NOT require stamina."
});
actionName = "Hyperbolic Regeneration Chamber";
GeneralActions[actionName] = new Action({
name: actionName,
desc: "Enter cryogenic stasis using the Bladeburner division's hi-tech Regeneration Chamber. " +
"This will slowly heal your wounds and slightly increase your stamina gain.<br><br>",
});
//Black Operations //Black Operations
BlackOperations["Operation Typhoon"] = new BlackOperation({ BlackOperations["Operation Typhoon"] = new BlackOperation({
name:"Operation Typhoon", name:"Operation Typhoon",

@ -1,4 +1,5 @@
import {Engine} from "./engine"; import {Engine} from "./engine";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import {removeChildrenFromElement} from "../utils/uiHelpers/removeChildrenFromElement"; import {removeChildrenFromElement} from "../utils/uiHelpers/removeChildrenFromElement";
import {createElement} from "../utils/uiHelpers/createElement"; import {createElement} from "../utils/uiHelpers/createElement";
@ -59,7 +60,7 @@ function writeCinematicTextLine(line) {
function writeCinematicTextLetter(pElem, line, i=0) { function writeCinematicTextLetter(pElem, line, i=0) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
setTimeout(function() { setTimeoutRef(function() {
if (i >= line.length) { if (i >= line.length) {
var textToShow = line.substring(0, i); var textToShow = line.substring(0, i);
pElem.innerHTML = textToShow; pElem.innerHTML = textToShow;

@ -1,7 +1,7 @@
import {IMap} from "./types"; import {IMap} from "./types";
export let CONSTANTS: IMap<any> = { export let CONSTANTS: IMap<any> = {
Version: "0.43.1", Version: "0.44.0",
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //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 //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@ -274,7 +274,7 @@ export let CONSTANTS: IMap<any> = {
/* Coding Contract Constants */ /* Coding Contract Constants */
CodingContractBaseFactionRepGain: 2500, CodingContractBaseFactionRepGain: 2500,
CodingContractBaseCompanyRepGain: 4000, CodingContractBaseCompanyRepGain: 4000,
CodingContractBaseMoneyGain: 50e6, CodingContractBaseMoneyGain: 75e6,
// BitNode/Source-File related stuff // BitNode/Source-File related stuff
TotalNumBitNodes: 24, TotalNumBitNodes: 24,
@ -510,25 +510,44 @@ export let CONSTANTS: IMap<any> = {
LatestUpdate: LatestUpdate:
` `
v0.43.1 v0.44.0
* Terminal changes: * Bladeburner Changes:
** Quoted arguments are now properly parsed. (e.g. 'run f.script "this is one argument"' will be correctly parsed) ** Reduced the amount of rank needed to earn a skill point
** Errors are now shown in red text ** Reduced the effects of the "Reaper" and "Evasive System" skills
** 'unalias' command now has a different format and no longer needs the quotations ** Increased the effect of the "Hyperdrive" and "Hands of Midas" skills
** Bug Fix: Fixed several edge cases where autocomplete wasnt working properly ** Slightly increased the rate which the skill point cost rises for almost all skills
** The "Overlock" Skill now has a maximum level of 90 instead of 95
** Money earned from Contracts increased by 400%
** Changed the way population affects success rate. Extreme populations now have less dramatic effects
** Added two new General Actions: Diplomacy and Hyperbolic Regeneration Chamber
** Lowered the rep and money cost of the "Blade's Simulacrum" augmentation
** Significantly decreased the initial amount of Contracts/Operations (the "Contracts/Operations remaining" value)
** Decreased the rate at which the amount of Contracts/Operations increases over time
** Decreased the number of successes you need to increase the max level of a Contract/Operation
** Increased the average number of Synthoid communities each city has
** Reduced the amount by which a successful raid will decrease the population of a city
** The "riots" event will now increase the chaos of a city by a greater amount
** Significantly increased the effect that Agility and Dexterity have on action time
* Added two new Bladeburner skills for increasing money and experience gain * Added new BitNode multipliers:
* Made some minor adjustments to Bladeburner UI ** HomeComputerRamCost - Affects how much it costs to upgrade home computer's RAM
* Corporation "Smart Factories" and "Smart Storage" upgrades have slightly lower price multipliers ** DaedalusAugsRequirement - Affects how many Augmentations you need in order to get invited to Daedalus
* Added nFormat Netscript function ** FourSigmaMarketDataCost - Affects how much it costs to unlock the stock market's 4S Market Data
* Added 6 new Coding Contract problems ** FourSigmaMarketDataApiCost - Affects how much it costs to unlock the stock market's 4S Market Data API
* Updated documentation with list of all Coding Contract problems
* Minor improvements for 'Active Scripts' UI * A few minor changes to BitNode multipliers across the board (mostly for the new multipliers)
* Implemented several optimizations for active scripts. The game should now use less memory and the savefile should be slightly smaller when there are many scripts running * 'The Covenant' now requires 20 total Augmentations to get invited, rather than 30
* Bug Fix: A Stock Forecast should no longer go above 1 (i.e. 100%) * You can now purchase permanent Duplicate Sleeves from 'The Covenant'. This requires Source-File 10, and you must be in BN-10 or after
* Bug Fix: The cost of Resleeves should no longer be affected by buying Augs * You can now track where all of your money comes from in the 'Stats' page
* Bug Fix: Duplicate Sleeves now use their own stats to determine crime success rate, instead of the host consciousness' stats * Increased the money gained from Coding Contracts by 50%
* Bug Fix: You can now call the prompt() Netscript function from multiple scripts simultaneously * getCharacterInformation() function now returns the player's HP and max HP
* Bug Fix: You can no longer disconnect the enemy's connections in Hacking Missions
* Bug Fix: Duplicate Sleeve faction reputation gain is now properly affected by faction favor
* Bug Fix: After installing Augmentations, the Terminal display will now correctly show the current server as "home"
* Bug Fix: Fixed an exploit where you could change the duration of timed functions (e.g. hack, weaken) in NetscriptJS
* Bug Fix: You should now properly be able to use the ServerProfile.exe program
* Bug Fix: Prevented exploit that allowed you to accept faction invites programmatically through NetscriptJS
* Bug Fix: Faction invitations for megacorporations should now work properly
` `
} }

@ -2868,7 +2868,9 @@ Corporation.prototype.process = function() {
const totalDividends = (this.dividendPercentage / 100) * cycleProfit; const totalDividends = (this.dividendPercentage / 100) * cycleProfit;
const retainedEarnings = cycleProfit - totalDividends; const retainedEarnings = cycleProfit - totalDividends;
const dividendsPerShare = totalDividends / this.totalShares; const dividendsPerShare = totalDividends / this.totalShares;
Player.gainMoney(this.numShares * dividendsPerShare * (1 - (this.dividendTaxPercentage / 100))); const profit = this.numShares * dividendsPerShare * (1 - (this.dividendTaxPercentage / 100));
Player.gainMoney(profit);
Player.recordMoneySource(profit, "corporation");
this.funds = this.funds.plus(retainedEarnings); this.funds = this.funds.plus(retainedEarnings);
} }
} else { } else {
@ -3533,6 +3535,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
this.shareSalesUntilPriceUpdate = newSharesUntilUpdate; this.shareSalesUntilPriceUpdate = newSharesUntilUpdate;
this.shareSaleCooldown = SellSharesCooldown; this.shareSaleCooldown = SellSharesCooldown;
Player.gainMoney(profit); Player.gainMoney(profit);
Player.recordMoneySource(profit, "corporation");
removeElementById(popupId); removeElementById(popupId);
dialogBoxCreate(`Sold ${numeralWrapper.formatMoney(shares, "0.000a")} shares for ` + dialogBoxCreate(`Sold ${numeralWrapper.formatMoney(shares, "0.000a")} shares for ` +
`${numeralWrapper.formatMoney(profit, "$0.000a")}. ` + `${numeralWrapper.formatMoney(profit, "$0.000a")}. ` +

@ -1,30 +1,27 @@
import { Crimes } from "./Crimes"; import { Crimes } from "./Crimes";
import { IPlayer } from "../PersonObjects/IPlayer";
import { Player } from "../Player";
import { dialogBoxCreate } from "../../utils/DialogBox"; import { dialogBoxCreate } from "../../utils/DialogBox";
export function determineCrimeSuccess(type, moneyGained) { export function determineCrimeSuccess(p: IPlayer, type: string) {
var chance = 0; let chance: number = 0;
var found = false; let found: boolean = false;
for(const i in Crimes) { for (const i in Crimes) {
const crime = Crimes[i]; let crime = Crimes[i];
if(crime.type == type) { if (crime.type == type) {
chance = crime.successRate(Player); chance = crime.successRate(p);
found = true; found = true;
break; break;
} }
} }
if(!found) { if (!found) {
console.log(crime); dialogBoxCreate(`ERR: Unrecognized crime type: ${type} This is probably a bug please contact the developer`, false);
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
return; return;
} }
if (Math.random() <= chance) { if (Math.random() <= chance) {
//Success //Success
Player.gainMoney(moneyGained);
return true; return true;
} else { } else {
//Failure //Failure
@ -32,7 +29,7 @@ export function determineCrimeSuccess(type, moneyGained) {
} }
} }
export function findCrime(roughName) { export function findCrime(roughName: string) {
if (roughName.includes("shoplift")) { if (roughName.includes("shoplift")) {
return Crimes.Shoplift; return Crimes.Shoplift;
} else if (roughName.includes("rob") && roughName.includes("store")) { } else if (roughName.includes("rob") && roughName.includes("store")) {

@ -3,6 +3,8 @@ import { CodingContractTypes } from "./CodingContracts";
import { generateContract, import { generateContract,
generateRandomContract, generateRandomContract,
generateRandomContractOnHome } from "./CodingContractGenerator"; generateRandomContractOnHome } from "./CodingContractGenerator";
import { Companies } from "./Company/Companies";
import { Company } from "./Company/Company";
import { Programs } from "./Programs/Programs"; import { Programs } from "./Programs/Programs";
import { Factions } from "./Faction/Factions"; import { Factions } from "./Faction/Factions";
import { Player } from "./Player"; import { Player } from "./Player";
@ -265,7 +267,19 @@ export function createDevMenu() {
Player.queueAugmentation(augmentationsDropdown.options[augmentationsDropdown.selectedIndex].value); Player.queueAugmentation(augmentationsDropdown.options[augmentationsDropdown.selectedIndex].value);
}, },
innerText: "Queue Augmentation", innerText: "Queue Augmentation",
}) });
const giveAllAugmentationsButton = createElement("button", {
class: "std-button",
clickListener: () => {
for (const i in AugmentationNames) {
const augName = AugmentationNames[i];
Player.queueAugmentation(augName);
}
},
display: "block",
innerText: "Queue All Augmentations",
});
// Source Files // Source Files
const sourceFilesHeader = createElement("h2", { innerText: "Source-Files" }); const sourceFilesHeader = createElement("h2", { innerText: "Source-Files" });
@ -373,6 +387,38 @@ export function createDevMenu() {
innerText: "Connect to server", innerText: "Connect to server",
}); });
// Companies
const companiesHeader = createElement("h2", { innerText: "Companies" });
const companiesDropdown = createElement("select", {
class: "dropdown",
margin: "5px",
});
for (const c in Companies) {
companiesDropdown.add(createOptionElement(Companies[c].name));
}
const companyReputationInput = createElement("input", {
margin: "5px",
placeholder: "Rep to add to company",
type: "number",
});
const companyReputationButton = createElement("button", {
class: "std-button",
innerText: "Add rep to company",
clickListener: () => {
const compName = getSelectText(companiesDropdown);
const company = Companies[compName];
const rep = parseFloat(companyReputationInput.value);
if (company != null && !isNaN(rep)) {
company.playerReputation += rep;
} else {
console.warn(`Invalid input for Dev Menu Company Rep. Company Name: ${compName}. Rep: ${rep}`);
}
}
});
// Bladeburner // Bladeburner
const bladeburnerHeader = createElement("h2", {innerText: "Bladeburner"}); const bladeburnerHeader = createElement("h2", {innerText: "Bladeburner"});
@ -587,6 +633,7 @@ export function createDevMenu() {
devMenuContainer.appendChild(augmentationsHeader); devMenuContainer.appendChild(augmentationsHeader);
devMenuContainer.appendChild(augmentationsDropdown); devMenuContainer.appendChild(augmentationsDropdown);
devMenuContainer.appendChild(augmentationsQueueButton); devMenuContainer.appendChild(augmentationsQueueButton);
devMenuContainer.appendChild(giveAllAugmentationsButton);
devMenuContainer.appendChild(sourceFilesHeader); devMenuContainer.appendChild(sourceFilesHeader);
devMenuContainer.appendChild(removeSourceFileDropdown); devMenuContainer.appendChild(removeSourceFileDropdown);
devMenuContainer.appendChild(removeSourceFileButton); devMenuContainer.appendChild(removeSourceFileButton);
@ -599,6 +646,11 @@ export function createDevMenu() {
devMenuContainer.appendChild(serversMaxMoneyAll); devMenuContainer.appendChild(serversMaxMoneyAll);
devMenuContainer.appendChild(serversConnectToDropdown); devMenuContainer.appendChild(serversConnectToDropdown);
devMenuContainer.appendChild(serversConnectToButton); devMenuContainer.appendChild(serversConnectToButton);
devMenuContainer.appendChild(companiesHeader);
devMenuContainer.appendChild(companiesDropdown);
devMenuContainer.appendChild(createElement("br"));
devMenuContainer.appendChild(companyReputationInput);
devMenuContainer.appendChild(companyReputationButton);
devMenuContainer.appendChild(bladeburnerHeader); devMenuContainer.appendChild(bladeburnerHeader);
devMenuContainer.appendChild(bladeburnerGainRankInput); devMenuContainer.appendChild(bladeburnerGainRankInput);
devMenuContainer.appendChild(bladeburnerGainRankButton); devMenuContainer.appendChild(bladeburnerGainRankButton);

@ -12,6 +12,9 @@ import { HackingMission, setInMission } from "../Missions";
import { Player } from "../Player"; import { Player } from "../Player";
import { PurchaseAugmentationsOrderSetting } from "../Settings/SettingEnums"; import { PurchaseAugmentationsOrderSetting } from "../Settings/SettingEnums";
import { Settings } from "../Settings/Settings"; import { Settings } from "../Settings/Settings";
import { SourceFileFlags } from "../SourceFile/SourceFileFlags";
import { createPurchaseSleevesFromCovenantPopup } from "../PersonObjects/Sleeve/SleeveCovenantPurchases";
import {Page, routing} from "../ui/navigationTracking"; import {Page, routing} from "../ui/navigationTracking";
import {numeralWrapper} from "../ui/numeralFormat"; import {numeralWrapper} from "../ui/numeralFormat";
@ -57,6 +60,9 @@ function displayFactionContent(factionName) {
if (faction == null) { if (faction == null) {
throw new Error("Invalid factionName passed into displayFactionContent: " + factionName); throw new Error("Invalid factionName passed into displayFactionContent: " + factionName);
} }
if (!faction.isMember) {
throw new Error("Not a member of this faction, cannot display faction information");
}
var factionInfo = faction.getInfo(); var factionInfo = faction.getInfo();
removeChildrenFromElement(Engine.Display.factionContent); removeChildrenFromElement(Engine.Display.factionContent);
@ -108,9 +114,7 @@ function displayFactionContent(factionName) {
elements.push(createElement("br")); elements.push(createElement("br"));
//Hacking Mission Option //Hacking Mission Option
var hackMissionDiv = createElement("div", { var hackMissionDiv = createElement("div", { class:"faction-work-div" });
id:"faction-hack-mission-div", class:"faction-work-div",
});
var hackMissionDivWrapper = createElement("div", {class:"faction-work-div-wrapper"}); var hackMissionDivWrapper = createElement("div", {class:"faction-work-div-wrapper"});
hackMissionDiv.appendChild(hackMissionDivWrapper); hackMissionDiv.appendChild(hackMissionDivWrapper);
hackMissionDivWrapper.appendChild(createElement("a", { hackMissionDivWrapper.appendChild(createElement("a", {
@ -131,13 +135,11 @@ function displayFactionContent(factionName) {
elements.push(hackMissionDiv); elements.push(hackMissionDiv);
//Hacking Contracts Option //Hacking Contracts Option
var hackDiv = createElement("div", { var hackDiv = createElement("div", { class:"faction-work-div", });
id:"faction-hack-div", class:"faction-work-div",
});
var hackDivWrapper = createElement("div", {class:"faction-work-div-wrapper"}); var hackDivWrapper = createElement("div", {class:"faction-work-div-wrapper"});
hackDiv.appendChild(hackDivWrapper); hackDiv.appendChild(hackDivWrapper);
hackDivWrapper.appendChild(createElement("a", { hackDivWrapper.appendChild(createElement("a", {
class:"a-link-button", innerText:"Hacking Contracts", class:"std-button", innerText:"Hacking Contracts",
clickListener:()=>{ clickListener:()=>{
Player.startFactionHackWork(faction); Player.startFactionHackWork(faction);
return false; return false;
@ -152,13 +154,11 @@ function displayFactionContent(factionName) {
elements.push(hackDiv); elements.push(hackDiv);
//Field Work Option //Field Work Option
var fieldWorkDiv = createElement("div", { var fieldWorkDiv = createElement("div", { class:"faction-work-div" });
id:"faction-fieldwork-div", class:"faction-work-div"
});
var fieldWorkDivWrapper = createElement("div", {class:"faction-work-div-wrapper"}); var fieldWorkDivWrapper = createElement("div", {class:"faction-work-div-wrapper"});
fieldWorkDiv.appendChild(fieldWorkDivWrapper); fieldWorkDiv.appendChild(fieldWorkDivWrapper);
fieldWorkDivWrapper.appendChild(createElement("a", { fieldWorkDivWrapper.appendChild(createElement("a", {
class:"a-link-button", innerText:"Field Work", class:"std-button", innerText:"Field Work",
clickListener:()=>{ clickListener:()=>{
Player.startFactionFieldWork(faction); Player.startFactionFieldWork(faction);
return false; return false;
@ -173,13 +173,11 @@ function displayFactionContent(factionName) {
elements.push(fieldWorkDiv); elements.push(fieldWorkDiv);
//Security Work Option //Security Work Option
var securityWorkDiv = createElement("div", { var securityWorkDiv = createElement("div", { class:"faction-work-div" });
id:"faction-securitywork-div", class:"faction-work-div"
});
var securityWorkDivWrapper = createElement("div", {class:"faction-work-div-wrapper"}); var securityWorkDivWrapper = createElement("div", {class:"faction-work-div-wrapper"});
securityWorkDiv.appendChild(securityWorkDivWrapper); securityWorkDiv.appendChild(securityWorkDivWrapper);
securityWorkDivWrapper.appendChild(createElement("a", { securityWorkDivWrapper.appendChild(createElement("a", {
class:"a-link-button", innerText:"Security Work", class:"std-button", innerText:"Security Work",
clickListener:()=>{ clickListener:()=>{
Player.startFactionSecurityWork(faction); Player.startFactionSecurityWork(faction);
return false; return false;
@ -194,9 +192,7 @@ function displayFactionContent(factionName) {
elements.push(securityWorkDiv); elements.push(securityWorkDiv);
//Donate for reputation //Donate for reputation
var donateDiv = createElement("div", { var donateDiv = createElement("div", { class:"faction-work-div" });
id:"faction-donate-div", class:"faction-work-div"
});
var donateDivWrapper = createElement("div", {class:"faction-work-div-wrapper"}); var donateDivWrapper = createElement("div", {class:"faction-work-div-wrapper"});
donateDiv.appendChild(donateDivWrapper); donateDiv.appendChild(donateDivWrapper);
var donateRepGain = createElement("p", { var donateRepGain = createElement("p", {
@ -219,7 +215,7 @@ function displayFactionContent(factionName) {
}, },
}); });
donateDivWrapper.appendChild(createElement("a", { donateDivWrapper.appendChild(createElement("a", {
class:"a-link-button", innerText:"Donate Money", class:"std-button", innerText:"Donate Money",
clickListener:()=>{ clickListener:()=>{
var amt = parseFloat(donateAmountInput.value); var amt = parseFloat(donateAmountInput.value);
if (isNaN(amt) || amt < 0) { if (isNaN(amt) || amt < 0) {
@ -240,24 +236,6 @@ function displayFactionContent(factionName) {
donateDivWrapper.appendChild(donateRepGain); donateDivWrapper.appendChild(donateRepGain);
elements.push(donateDiv); elements.push(donateDiv);
//Purchase Augmentations
elements.push(createElement("pre", {
innerHTML: "<br>As your reputation with this faction rises, you will " +
"unlock Augmentations, which you can purchase to enhance " +
"your abilities.<br><br>"
}));
elements.push(createElement("a", {
class:"a-link-button", innerText:"Purchase Augmentations",
clickListener:()=>{
Engine.hideAllContent();
Engine.Display.factionAugmentationsContent.style.display = "block";
displayFactionAugmentations(factionName);
return false;
}
}));
//Gang (BitNode-2) //Gang (BitNode-2)
if (Player.bitNodeN == 2 && (factionName == "Slum Snakes" || factionName == "Tetrads" || if (Player.bitNodeN == 2 && (factionName == "Slum Snakes" || factionName == "Tetrads" ||
factionName == "The Syndicate" || factionName == "The Dark Army" || factionName == "Speakers for the Dead" || factionName == "The Syndicate" || factionName == "The Dark Army" || factionName == "Speakers for the Dead" ||
@ -338,10 +316,49 @@ function displayFactionContent(factionName) {
return; return;
} }
if (!faction.isMember) { // Purchase Sleeves from Covenant
throw new Error("Not a member of this faction, cannot display faction information"); if (factionName === "The Covenant" && Player.bitNodeN >= 10 && SourceFileFlags[10]) {
const covenantPurchaseSleevesDiv = createElement("div", { class: "faction-work-div", display: "inline" });
const covenantPurchaseSleevesDivWrapper = createElement("div", { class: "faction-work-div-wrapper" });
covenantPurchaseSleevesDiv.appendChild(covenantPurchaseSleevesDivWrapper);
covenantPurchaseSleevesDivWrapper.appendChild(createElement("a", {
class: "std-button",
innerText: "Purchase Duplicate Sleeves",
clickListener: () => {
createPurchaseSleevesFromCovenantPopup(Player);
}
}));
covenantPurchaseSleevesDivWrapper.appendChild(createElement("p", {
innerText: "Purchase Duplicate Sleeves. These are permanent! You can purchase up to 5 total.",
}));
elements.push(covenantPurchaseSleevesDiv);
} }
//Purchase Augmentations
const purchaseAugmentationsDiv = createElement("div", { class: "faction-work-div", display: "inline" });
const purchaseAugmentationsDivWrapper = createElement("div", { class: "faction-work-div-wrapper" });
purchaseAugmentationsDiv.appendChild(purchaseAugmentationsDivWrapper);
purchaseAugmentationsDivWrapper.appendChild(createElement("a", {
class:"std-button",
innerText:"Purchase Augmentations",
margin: "5px",
clickListener:()=>{
Engine.hideAllContent();
Engine.Display.factionAugmentationsContent.style.display = "block";
displayFactionAugmentations(factionName);
return false;
}
}));
purchaseAugmentationsDivWrapper.appendChild(createElement("pre", {
innerHTML: "<br>As your reputation with this faction rises, you will " +
"unlock Augmentations, which you can purchase to enhance " +
"your abilities.<br><br>"
}));
elements.push(purchaseAugmentationsDiv);
// Determine if actions should be possible
donateDiv.style.display = faction.favor >= Math.floor(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction) ? "inline" : "none"; donateDiv.style.display = faction.favor >= Math.floor(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction) ? "inline" : "none";
hackMissionDiv.style.display = factionInfo.offerHackingMission ? "inline": "none"; hackMissionDiv.style.display = factionInfo.offerHackingMission ? "inline": "none";

@ -247,6 +247,7 @@ Gang.prototype.processGains = function(numCycles=1, player) {
} }
if (typeof moneyGains === "number") { if (typeof moneyGains === "number") {
player.gainMoney(moneyGains * numCycles); player.gainMoney(moneyGains * numCycles);
player.recordMoneySource(moneyGains * numCycles, "gang");
} else { } else {
console.warn("ERROR: respectGains is NaN"); console.warn("ERROR: respectGains is NaN");
} }

@ -4,15 +4,19 @@ import { Engine } from "./engine";
import {iTutorialSteps, iTutorialNextStep, import {iTutorialSteps, iTutorialNextStep,
ITutorial} from "./InteractiveTutorial"; ITutorial} from "./InteractiveTutorial";
import {Player} from "./Player"; import {Player} from "./Player";
import {Page, routing} from "./ui/navigationTracking";
import { numeralWrapper } from "./ui/numeralFormat";
import {dialogBoxCreate} from "../utils/DialogBox"; import {dialogBoxCreate} from "../utils/DialogBox";
import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners"; import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners";
import {Reviver, Generic_toJSON, import {Reviver, Generic_toJSON,
Generic_fromJSON} from "../utils/JSONReviver"; Generic_fromJSON} from "../utils/JSONReviver";
import {createElement} from "../utils/uiHelpers/createElement"; import {createElement} from "../utils/uiHelpers/createElement";
import {Page, routing} from "./ui/navigationTracking";
import {formatNumber} from "../utils/StringHelperFunctions";
import {getElementById} from "../utils/uiHelpers/getElementById"; import {getElementById} from "../utils/uiHelpers/getElementById";
// Stores total money gain rate from all of the player's Hacknet Nodes
let TotalHacknetNodeProduction = 0;
/** /**
* Overwrites the inner text of the specified HTML element if it is different from what currently exists. * Overwrites the inner text of the specified HTML element if it is different from what currently exists.
* @param {string} elementId The HTML ID to find the first instance of. * @param {string} elementId The HTML ID to find the first instance of.
@ -299,7 +303,7 @@ function updateTotalHacknetProduction() {
for (var i = 0; i < Player.hacknetNodes.length; ++i) { for (var i = 0; i < Player.hacknetNodes.length; ++i) {
total += Player.hacknetNodes[i].moneyGainRatePerSecond; total += Player.hacknetNodes[i].moneyGainRatePerSecond;
} }
Player.totalHacknetNodeProduction = total; TotalHacknetNodeProduction = total;
} }
function getCostOfNextHacknetNode() { function getCostOfNextHacknetNode() {
@ -446,9 +450,9 @@ function updateHacknetNodesContent() {
//Set purchase button to inactive if not enough money, and update its price display //Set purchase button to inactive if not enough money, and update its price display
var cost = getCostOfNextHacknetNode(); var cost = getCostOfNextHacknetNode();
var purchaseButton = getElementById("hacknet-nodes-purchase-button"); var purchaseButton = getElementById("hacknet-nodes-purchase-button");
var formattedCost = formatNumber(cost, 2); var formattedCost = numeralWrapper.formatMoney(cost);
updateText("hacknet-nodes-purchase-button", "Purchase Hacknet Node - $" + formattedCost); updateText("hacknet-nodes-purchase-button", `Purchase Hacknet Node - ${formattedCost}`);
if (Player.money.lt(cost)) { if (Player.money.lt(cost)) {
purchaseButton.setAttribute("class", "a-link-button-inactive"); purchaseButton.setAttribute("class", "a-link-button-inactive");
@ -457,8 +461,8 @@ function updateHacknetNodesContent() {
} }
//Update player's money //Update player's money
updateText("hacknet-nodes-player-money", "$" + formatNumber(Player.money.toNumber(), 2)); updateText("hacknet-nodes-player-money", numeralWrapper.formatMoney(Player.money.toNumber()));
updateText("hacknet-nodes-total-production", "$" + formatNumber(Player.totalHacknetNodeProduction, 2) + " / sec"); updateText("hacknet-nodes-total-production", numeralWrapper.formatMoney(TotalHacknetNodeProduction) + " / sec");
//Update information in each owned hacknet node //Update information in each owned hacknet node
for (var i = 0; i < Player.hacknetNodes.length; ++i) { for (var i = 0; i < Player.hacknetNodes.length; ++i) {
@ -559,8 +563,8 @@ function updateHacknetNodeDomElement(nodeObj) {
var nodeName = nodeObj.name; var nodeName = nodeObj.name;
updateText("hacknet-node-name-" + nodeName, nodeName); updateText("hacknet-node-name-" + nodeName, nodeName);
updateText("hacknet-node-total-production-" + nodeName, "$" + formatNumber(nodeObj.totalMoneyGenerated, 2)); updateText("hacknet-node-total-production-" + nodeName, numeralWrapper.formatMoney(nodeObj.totalMoneyGenerated));
updateText("hacknet-node-production-rate-" + nodeName, "($" + formatNumber(nodeObj.moneyGainRatePerSecond, 2) + " / sec)"); updateText("hacknet-node-production-rate-" + nodeName, "(" + numeralWrapper.formatMoney(nodeObj.moneyGainRatePerSecond) + " / sec)");
updateText("hacknet-node-level-" + nodeName, nodeObj.level); updateText("hacknet-node-level-" + nodeName, nodeObj.level);
updateText("hacknet-node-ram-" + nodeName, nodeObj.ram + "GB"); updateText("hacknet-node-ram-" + nodeName, nodeObj.ram + "GB");
updateText("hacknet-node-cores-" + nodeName, nodeObj.cores); updateText("hacknet-node-cores-" + nodeName, nodeObj.cores);
@ -582,7 +586,7 @@ function updateHacknetNodeDomElement(nodeObj) {
} }
var upgradeLevelCost = nodeObj.calculateLevelUpgradeCost(multiplier); var upgradeLevelCost = nodeObj.calculateLevelUpgradeCost(multiplier);
updateText("hacknet-node-upgrade-level-" + nodeName, "Upgrade x" + multiplier + " - $" + formatNumber(upgradeLevelCost, 2)) updateText("hacknet-node-upgrade-level-" + nodeName, "Upgrade x" + multiplier + " - " + numeralWrapper.formatMoney(upgradeLevelCost))
if (Player.money.lt(upgradeLevelCost)) { if (Player.money.lt(upgradeLevelCost)) {
upgradeLevelButton.setAttribute("class", "a-link-button-inactive"); upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
} else { } else {
@ -606,7 +610,7 @@ function updateHacknetNodeDomElement(nodeObj) {
} }
var upgradeRamCost = nodeObj.calculateRamUpgradeCost(multiplier); var upgradeRamCost = nodeObj.calculateRamUpgradeCost(multiplier);
updateText("hacknet-node-upgrade-ram-" + nodeName, "Upgrade x" + multiplier + " - $" + formatNumber(upgradeRamCost, 2)); updateText("hacknet-node-upgrade-ram-" + nodeName, "Upgrade x" + multiplier + " - " + numeralWrapper.formatMoney(upgradeRamCost));
if (Player.money.lt(upgradeRamCost)) { if (Player.money.lt(upgradeRamCost)) {
upgradeRamButton.setAttribute("class", "a-link-button-inactive"); upgradeRamButton.setAttribute("class", "a-link-button-inactive");
} else { } else {
@ -629,7 +633,7 @@ function updateHacknetNodeDomElement(nodeObj) {
multiplier = Math.min(levelsToMax, hacknetNodePurchaseMultiplier); multiplier = Math.min(levelsToMax, hacknetNodePurchaseMultiplier);
} }
var upgradeCoreCost = nodeObj.calculateCoreUpgradeCost(multiplier); var upgradeCoreCost = nodeObj.calculateCoreUpgradeCost(multiplier);
updateText("hacknet-node-upgrade-core-" + nodeName, "Upgrade x" + multiplier + " - $" + formatNumber(upgradeCoreCost, 2)); updateText("hacknet-node-upgrade-core-" + nodeName, "Upgrade x" + multiplier + " - " + numeralWrapper.formatMoney(upgradeCoreCost));
if (Player.money.lt(upgradeCoreCost)) { if (Player.money.lt(upgradeCoreCost)) {
upgradeCoreButton.setAttribute("class", "a-link-button-inactive"); upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
} else { } else {
@ -660,6 +664,7 @@ function processSingleHacknetNodeEarnings(numCycles, nodeObj) {
nodeObj.totalMoneyGenerated += totalEarnings; nodeObj.totalMoneyGenerated += totalEarnings;
nodeObj.onlineTimeSeconds += (numCycles * (Engine._idleSpeed / 1000)); nodeObj.onlineTimeSeconds += (numCycles * (Engine._idleSpeed / 1000));
Player.gainMoney(totalEarnings); Player.gainMoney(totalEarnings);
Player.recordMoneySource(totalEarnings, "hacknetnode");
return totalEarnings; return totalEarnings;
} }

@ -32,7 +32,6 @@ Reviver.constructors.Message = Message;
//Sends message to player, including a pop up //Sends message to player, including a pop up
function sendMessage(msg, forced=false) { function sendMessage(msg, forced=false) {
console.log("sending message: " + msg.filename);
msg.recvd = true; msg.recvd = true;
if (forced || !Settings.SuppressMessages) { if (forced || !Settings.SuppressMessages) {
showMessage(msg); showMessage(msg);

@ -1021,13 +1021,17 @@ HackingMission.prototype.initJsPlumb = function() {
} }
//Clicking a connection drops it //Clicking a connection drops it
instance.bind("click", function(conn, originalEvent) { instance.bind("click", (conn, originalEvent) => {
// Cannot drop enemy's connections
const sourceNode = this.getNodeFromElement(conn.source);
if (sourceNode.enmyCtrl) { return; }
var endpoints = conn.endpoints; var endpoints = conn.endpoints;
endpoints[0].detachFrom(endpoints[1]); endpoints[0].detachFrom(endpoints[1]);
}); });
//Connection events //Connection events
instance.bind("connection", (info)=>{ instance.bind("connection", (info) => {
var targetNode = this.getNodeFromElement(info.target); var targetNode = this.getNodeFromElement(info.target);
//Do not detach for enemy nodes //Do not detach for enemy nodes

@ -8,6 +8,8 @@ import { Settings } from "./Settings/Settings";
import { Script, findRunningScript, import { Script, findRunningScript,
RunningScript } from "./Script"; RunningScript } from "./Script";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import {parse, Node} from "../utils/acorn"; import {parse, Node} from "../utils/acorn";
import {arrayToString} from "../utils/helpers/arrayToString"; import {arrayToString} from "../utils/helpers/arrayToString";
import {isValidIPAddress} from "../utils/helpers/isValidIPAddress"; import {isValidIPAddress} from "../utils/helpers/isValidIPAddress";
@ -134,7 +136,7 @@ export function killNetscriptDelay(workerScript) {
export function netscriptDelay(time, workerScript) { export function netscriptDelay(time, workerScript) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
workerScript.delay = setTimeout(()=>{ workerScript.delay = setTimeoutRef(() => {
workerScript.delay = null; workerScript.delay = null;
resolve(); resolve();
}, time); }, time);

@ -8,7 +8,7 @@ import { augmentationExists,
installAugmentations } from "./Augmentation/AugmentationHelpers"; installAugmentations } from "./Augmentation/AugmentationHelpers";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames"; import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers"; import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
import { determineCrimeSuccess, findCrime } from "./Crime/CrimeHelpers"; import { findCrime } from "./Crime/CrimeHelpers";
import {Bladeburner} from "./Bladeburner"; import {Bladeburner} from "./Bladeburner";
import {Company} from "./Company/Company"; import {Company} from "./Company/Company";
import {Companies, companyExists} from "./Company/Companies"; import {Companies, companyExists} from "./Company/Companies";
@ -51,8 +51,11 @@ import {StockMarket, StockSymbols, SymbolToStockMap,
sellStock, updateStockPlayerPosition, sellStock, updateStockPlayerPosition,
shortStock, sellShort, OrderTypes, shortStock, sellShort, OrderTypes,
PositionTypes, placeOrder, cancelOrder} from "./StockMarket/StockMarket"; PositionTypes, placeOrder, cancelOrder} from "./StockMarket/StockMarket";
import { getStockmarket4SDataCost,
getStockMarket4STixApiCost } from "./StockMarket/StockMarketCosts";
import {numeralWrapper} from "./ui/numeralFormat"; import {numeralWrapper} from "./ui/numeralFormat";
import {post} from "./ui/postToTerminal"; import {post} from "./ui/postToTerminal";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import {TextFile, getTextFile, createTextFile} from "./TextFile"; import {TextFile, getTextFile, createTextFile} from "./TextFile";
import {unknownBladeburnerActionErrorMessage, import {unknownBladeburnerActionErrorMessage,
@ -378,6 +381,7 @@ function NetscriptFunctions(workerScript) {
Player.gainMoney(moneyGained); Player.gainMoney(moneyGained);
workerScript.scriptRef.onlineMoneyMade += moneyGained; workerScript.scriptRef.onlineMoneyMade += moneyGained;
Player.scriptProdSinceLastAug += moneyGained; Player.scriptProdSinceLastAug += moneyGained;
Player.recordMoneySource(moneyGained, "hacking");
workerScript.scriptRef.recordHack(server.ip, moneyGained, threads); workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);
Player.gainHackingExp(expGainedOnSuccess); Player.gainHackingExp(expGainedOnSuccess);
workerScript.scriptRef.onlineExpGained += expGainedOnSuccess; workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
@ -851,7 +855,7 @@ function NetscriptFunctions(workerScript) {
if (scriptname == null || threads == null) { if (scriptname == null || threads == null) {
throw makeRuntimeRejectMsg(workerScript, "Invalid scriptname or numThreads argument passed to spawn()"); throw makeRuntimeRejectMsg(workerScript, "Invalid scriptname or numThreads argument passed to spawn()");
} }
setTimeout(()=>{ setTimeoutRef(() => {
if (scriptname === undefined) { if (scriptname === undefined) {
throw makeRuntimeRejectMsg(workerScript, "spawn() call has incorrect number of arguments. Usage: spawn(scriptname, numThreads, [arg1], [arg2]...)"); throw makeRuntimeRejectMsg(workerScript, "spawn() call has incorrect number of arguments. Usage: spawn(scriptname, numThreads, [arg1], [arg2]...)");
} }
@ -868,7 +872,7 @@ function NetscriptFunctions(workerScript) {
} }
return runScriptFromScript(scriptServer, scriptname, argsForNewScript, workerScript, threads); return runScriptFromScript(scriptServer, scriptname, argsForNewScript, workerScript, threads);
}, 20000); }, 20e3);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.spawn == null) { if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.spawn == null) {
workerScript.scriptRef.log("spawn() will execute " + scriptname + " in 20 seconds"); workerScript.scriptRef.log("spawn() will execute " + scriptname + " in 20 seconds");
} }
@ -1618,6 +1622,7 @@ function NetscriptFunctions(workerScript) {
if (isNaN(netProfit)) {netProfit = 0;} if (isNaN(netProfit)) {netProfit = 0;}
workerScript.scriptRef.onlineMoneyMade += netProfit; workerScript.scriptRef.onlineMoneyMade += netProfit;
Player.scriptProdSinceLastAug += netProfit; Player.scriptProdSinceLastAug += netProfit;
Player.recordMoneySource(netProfit, "stock");
stock.playerShares -= shares; stock.playerShares -= shares;
if (stock.playerShares == 0) { if (stock.playerShares == 0) {
@ -1847,7 +1852,7 @@ function NetscriptFunctions(workerScript) {
return true; return true;
} }
if (Player.money.lt(CONSTANTS.MarketData4SCost)) { if (Player.money.lt(getStockMarket4SDataCost())) {
if (workerScript.shouldLog("purchase4SMarketData")) { if (workerScript.shouldLog("purchase4SMarketData")) {
workerScript.log("Failed to purchase 4S Market Data - Not enough money"); workerScript.log("Failed to purchase 4S Market Data - Not enough money");
} }
@ -1855,7 +1860,7 @@ function NetscriptFunctions(workerScript) {
} }
Player.has4SData = true; Player.has4SData = true;
Player.loseMoney(CONSTANTS.MarketData4SCost); Player.loseMoney(getStockMarket4SDataCost());
if (workerScript.shouldLog("purchase4SMarketData")) { if (workerScript.shouldLog("purchase4SMarketData")) {
workerScript.log("Purchased 4S Market Data"); workerScript.log("Purchased 4S Market Data");
} }
@ -1878,7 +1883,7 @@ function NetscriptFunctions(workerScript) {
return true; return true;
} }
if (Player.money.lt(CONSTANTS.MarketDataTixApi4SCost)) { if (Player.money.lt(getStockMarket4STixApiCost())) {
if (workerScript.shouldLog("purchase4SMarketDataTixApi")) { if (workerScript.shouldLog("purchase4SMarketDataTixApi")) {
workerScript.log("Failed to purchase 4S Market Data TIX API - Not enough money"); workerScript.log("Failed to purchase 4S Market Data TIX API - Not enough money");
} }
@ -1886,7 +1891,7 @@ function NetscriptFunctions(workerScript) {
} }
Player.has4SDataTixApi = true; Player.has4SDataTixApi = true;
Player.loseMoney(CONSTANTS.MarketDataTixApi4SCost); Player.loseMoney(getStockMarket4STixApiCost());
if (workerScript.shouldLog("purchase4SMarketDataTixApi")) { if (workerScript.shouldLog("purchase4SMarketDataTixApi")) {
workerScript.log("Purchased 4S Market Data TIX API"); workerScript.log("Purchased 4S Market Data TIX API");
} }
@ -2907,8 +2912,10 @@ function NetscriptFunctions(workerScript) {
bitnode: Player.bitNodeN, bitnode: Player.bitNodeN,
city: Player.city, city: Player.city,
factions: Player.factions.slice(), factions: Player.factions.slice(),
hp: Player.hp,
jobs: Object.keys(Player.jobs), jobs: Object.keys(Player.jobs),
jobTitles: Object.values(Player.jobs), jobTitles: Object.values(Player.jobs),
maxHp: Player.max_hp,
mult: { mult: {
agility: Player.agility_mult, agility: Player.agility_mult,
agilityExp: Player.agility_exp_mult, agilityExp: Player.agility_exp_mult,

@ -13,6 +13,7 @@ import {executeJSScript} from "./NetscriptJSEvaluator";
import {NetscriptPort} from "./NetscriptPort"; import {NetscriptPort} from "./NetscriptPort";
import {AllServers} from "./Server"; import {AllServers} from "./Server";
import {Settings} from "./Settings/Settings"; import {Settings} from "./Settings/Settings";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import {generate} from 'escodegen'; import {generate} from 'escodegen';
@ -283,7 +284,7 @@ function startNetscript1Script(workerScript) {
if (workerScript.env.stopFlag) { return reject(workerScript); } if (workerScript.env.stopFlag) { return reject(workerScript); }
if (interpreter.step()) { if (interpreter.step()) {
window.setTimeout(runInterpreter, Settings.CodeInstructionRunTime); setTimeoutRef(runInterpreter, Settings.CodeInstructionRunTime);
} else { } else {
resolve(workerScript); resolve(workerScript);
} }
@ -553,7 +554,7 @@ function runScriptsLoop() {
} }
} }
setTimeout(runScriptsLoop, 6000); setTimeoutRef(runScriptsLoop, 6000);
} }
//Queues a script to be killed by settings its stop flag to true. Then, the code will reject //Queues a script to be killed by settings its stop flag to true. Then, the code will reject

@ -10,22 +10,33 @@ import { IMap } from "../types";
import { IPlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation"; import { IPlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation";
import { IPlayerOwnedSourceFile } from "../SourceFile/PlayerOwnedSourceFile"; import { IPlayerOwnedSourceFile } from "../SourceFile/PlayerOwnedSourceFile";
import { MoneySourceTracker } from "../utils/MoneySourceTracker";
export interface IPlayer { export interface IPlayer {
// Class members // Class members
augmentations: IPlayerOwnedAugmentation[]; augmentations: IPlayerOwnedAugmentation[];
bladeburner: any; bladeburner: any;
bitNodeN: number;
city: string;
companyName: string; companyName: string;
corporation: any; corporation: any;
factions: string[]; factions: string[];
hacknetNodes: any[];
hasWseAccount: boolean; hasWseAccount: boolean;
jobs: IMap<string>; jobs: IMap<string>;
karma: number;
money: any; money: any;
moneySourceA: MoneySourceTracker;
moneySourceB: MoneySourceTracker;
playtimeSinceLastAug: number;
playtimeSinceLastBitnode: number;
purchasedServers: any[];
queuedAugmentations: IPlayerOwnedAugmentation[]; queuedAugmentations: IPlayerOwnedAugmentation[];
resleeves: Resleeve[]; resleeves: Resleeve[];
sleeves: Sleeve[]; sleeves: Sleeve[];
sleevesFromCovenant: number; sleevesFromCovenant: number;
sourceFiles: IPlayerOwnedSourceFile[]; sourceFiles: IPlayerOwnedSourceFile[];
totalPlaytime: number;
// Stats // Stats
hacking_skill: number; hacking_skill: number;
@ -45,7 +56,32 @@ export interface IPlayer {
charisma_exp: number; charisma_exp: number;
// Multipliers // Multipliers
hacking_chance_mult: number;
hacking_speed_mult: number;
hacking_money_mult: number;
hacking_grow_mult: number;
hacking_mult: number;
hacking_exp_mult: number;
strength_mult: number;
strength_exp_mult: number;
defense_mult: number;
defense_exp_mult: number;
dexterity_mult: number;
dexterity_exp_mult: number;
agility_mult: number;
agility_exp_mult: number;
charisma_mult: number;
charisma_exp_mult: number;
hacknet_node_money_mult: number;
hacknet_node_purchase_cost_mult: number;
hacknet_node_ram_cost_mult: number;
hacknet_node_core_cost_mult: number;
hacknet_node_level_cost_mult: number;
company_rep_mult: number;
faction_rep_mult: number;
work_money_mult: number;
crime_success_mult: number; crime_success_mult: number;
crime_money_mult: number;
// Methods // Methods
canAfford(cost: number): boolean; canAfford(cost: number): boolean;
@ -62,6 +98,7 @@ export interface IPlayer {
loseMoney(money: number): void; loseMoney(money: number): void;
reapplyAllAugmentations(resetMultipliers: boolean): void; reapplyAllAugmentations(resetMultipliers: boolean): void;
reapplyAllSourceFiles(): void; reapplyAllSourceFiles(): void;
recordMoneySource(amt: number, source: string): void;
startCrime(crimeType: string, startCrime(crimeType: string,
hackExp: number, hackExp: number,
strExp: number, strExp: number,

@ -195,6 +195,8 @@ export class Sleeve extends Person {
} }
retValue = this.gainExperience(p, successGainRates); retValue = this.gainExperience(p, successGainRates);
this.gainMoney(p, this.gainRatesForTask); this.gainMoney(p, this.gainRatesForTask);
p.karma -= crime.karma;
} else { } else {
retValue = this.gainExperience(p, this.gainRatesForTask); retValue = this.gainExperience(p, this.gainRatesForTask);
} }
@ -336,13 +338,19 @@ export class Sleeve extends Person {
*/ */
getRepGain(p: IPlayer): number { getRepGain(p: IPlayer): number {
if (this.currentTask === SleeveTaskType.Faction) { if (this.currentTask === SleeveTaskType.Faction) {
let favorMult: number = 1;
const fac: Faction | null = Factions[this.currentTaskLocation];
if (fac != null) {
favorMult = 1 + (fac!.favor / 100);
}
switch (this.factionWorkType) { switch (this.factionWorkType) {
case FactionWorkType.Hacking: case FactionWorkType.Hacking:
return this.getFactionHackingWorkRepGain() * (this.shock / 100); return this.getFactionHackingWorkRepGain() * (this.shock / 100) * favorMult;
case FactionWorkType.Field: case FactionWorkType.Field:
return this.getFactionFieldWorkRepGain() * (this.shock / 100); return this.getFactionFieldWorkRepGain() * (this.shock / 100) * favorMult;
case FactionWorkType.Security: case FactionWorkType.Security:
return this.getFactionSecurityWorkRepGain() * (this.shock / 100); return this.getFactionSecurityWorkRepGain() * (this.shock / 100) * favorMult;
default: default:
console.warn(`Invalid Sleeve.factionWorkType property in Sleeve.getRepGain(): ${this.factionWorkType}`); console.warn(`Invalid Sleeve.factionWorkType property in Sleeve.getRepGain(): ${this.factionWorkType}`);
return 0; return 0;

@ -106,10 +106,12 @@ export function createSleevesPage(p: IPlayer) {
} }
}); });
UIElems.docButton = createElement("button", { UIElems.docButton = createElement("a", {
class: "std-button", class: "std-button",
display: "inline-block", display: "inline-block",
href: "https://bitburner.readthedocs.io/en/latest/advancedgameplay/sleeves.html#duplicate-sleeves",
innerText: "Documentation", innerText: "Documentation",
target: "_blank",
}); });
UIElems.sleeveList = createElement("ul"); UIElems.sleeveList = createElement("ul");
@ -124,6 +126,7 @@ export function createSleevesPage(p: IPlayer) {
UIElems.container.appendChild(UIElems.info); UIElems.container.appendChild(UIElems.info);
UIElems.container.appendChild(UIElems.faqButton); UIElems.container.appendChild(UIElems.faqButton);
UIElems.container.appendChild(UIElems.docButton);
UIElems.container.appendChild(UIElems.sleeveList); UIElems.container.appendChild(UIElems.sleeveList);
document.getElementById("entire-game-container")!.appendChild(UIElems.container); document.getElementById("entire-game-container")!.appendChild(UIElems.container);

@ -31,6 +31,7 @@ import {SourceFiles, applySourceFile} from "./SourceFile";
import { SourceFileFlags } from "./SourceFile/SourceFileFlags"; import { SourceFileFlags } from "./SourceFile/SourceFileFlags";
import Decimal from "decimal.js"; import Decimal from "decimal.js";
import {numeralWrapper} from "./ui/numeralFormat"; import {numeralWrapper} from "./ui/numeralFormat";
import { MoneySourceTracker } from "./utils/MoneySourceTracker";
import {dialogBoxCreate} from "../utils/DialogBox"; import {dialogBoxCreate} from "../utils/DialogBox";
import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners"; import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners";
import {createRandomIp} from "../utils/IPAddress"; import {createRandomIp} from "../utils/IPAddress";
@ -92,8 +93,6 @@ function PlayerObject() {
//Money //Money
this.money = new Decimal(1000); this.money = new Decimal(1000);
this.total_money = new Decimal(0); //Total money ever earned in this "simulation"
this.lifetime_money = new Decimal(0); //Total money ever earned
//IP Address of Starting (home) computer //IP Address of Starting (home) computer
this.homeComputer = ""; this.homeComputer = "";
@ -114,7 +113,6 @@ function PlayerObject() {
this.currentServer = ""; //IP address of Server currently being accessed through terminal this.currentServer = ""; //IP address of Server currently being accessed through terminal
this.purchasedServers = []; //IP Addresses of purchased servers this.purchasedServers = []; //IP Addresses of purchased servers
this.hacknetNodes = []; this.hacknetNodes = [];
this.totalHacknetNodeProduction = 0;
//Factions //Factions
this.factions = []; //Names of all factions player has joined this.factions = []; //Names of all factions player has joined
@ -218,11 +216,12 @@ function PlayerObject() {
this.playtimeSinceLastAug = 0; this.playtimeSinceLastAug = 0;
this.playtimeSinceLastBitnode = 0; this.playtimeSinceLastBitnode = 0;
//Production since last Augmentation installation // Keep track of where money comes from
this.moneySourceA = new MoneySourceTracker(); // Where money comes from since last-installed Augmentation
this.moneySourceB = new MoneySourceTracker(); // Where money comes from for this entire BitNode run
// Production since last Augmentation installation
this.scriptProdSinceLastAug = 0; this.scriptProdSinceLastAug = 0;
this.stockProdSinceLastAug = 0;
this.crimeProdSinceLastAug = 0;
this.jobProdSinceLastAug = 0;
}; };
PlayerObject.prototype.init = function() { PlayerObject.prototype.init = function() {
@ -315,11 +314,12 @@ PlayerObject.prototype.prestigeAugmentation = function() {
this.lastUpdate = new Date().getTime(); this.lastUpdate = new Date().getTime();
// Statistics Trackers
this.playtimeSinceLastAug = 0; this.playtimeSinceLastAug = 0;
this.scriptProdSinceLastAug = 0; this.scriptProdSinceLastAug = 0;
this.moneySourceA.reset();
this.hacknetNodes.length = 0; this.hacknetNodes.length = 0;
this.totalHacknetNodeProduction = 0;
//Re-calculate skills and reset HP //Re-calculate skills and reset HP
this.updateSkillLevels(); this.updateSkillLevels();
@ -405,7 +405,6 @@ PlayerObject.prototype.prestigeSourceFile = function() {
this.lastUpdate = new Date().getTime(); this.lastUpdate = new Date().getTime();
this.hacknetNodes.length = 0; this.hacknetNodes.length = 0;
this.totalHacknetNodeProduction = 0;
//Gang //Gang
this.gang = null; this.gang = null;
@ -420,9 +419,12 @@ PlayerObject.prototype.prestigeSourceFile = function() {
//BitNode 3: Corporatocracy //BitNode 3: Corporatocracy
this.corporation = 0; this.corporation = 0;
// Statistics trackers
this.playtimeSinceLastAug = 0; this.playtimeSinceLastAug = 0;
this.playtimeSinceLastBitnode = 0; this.playtimeSinceLastBitnode = 0;
this.scriptProdSinceLastAug = 0; this.scriptProdSinceLastAug = 0;
this.moneySourceA.reset();
this.moneySourceB.reset();
this.updateSkillLevels(); this.updateSkillLevels();
this.hp = this.max_hp; this.hp = this.max_hp;
@ -438,13 +440,13 @@ PlayerObject.prototype.getHomeComputer = function() {
PlayerObject.prototype.getUpgradeHomeRamCost = function() { PlayerObject.prototype.getUpgradeHomeRamCost = function() {
//Calculate how many times ram has been upgraded (doubled) //Calculate how many times ram has been upgraded (doubled)
const currentRam = Player.getHomeComputer().maxRam; const currentRam = this.getHomeComputer().maxRam;
const numUpgrades = Math.log2(currentRam); const numUpgrades = Math.log2(currentRam);
//Calculate cost //Calculate cost
//Have cost increase by some percentage each time RAM has been upgraded //Have cost increase by some percentage each time RAM has been upgraded
const mult = Math.pow(1.58, numUpgrades); const mult = Math.pow(1.58, numUpgrades);
var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRamHome * mult; var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRamHome * mult * BitNodeMultipliers.HomeComputerRamCost;
return cost; return cost;
} }
@ -542,8 +544,6 @@ PlayerObject.prototype.gainMoney = function(money) {
console.log("ERR: NaN passed into Player.gainMoney()"); return; console.log("ERR: NaN passed into Player.gainMoney()"); return;
} }
this.money = this.money.plus(money); this.money = this.money.plus(money);
this.total_money = this.total_money.plus(money);
this.lifetime_money = this.lifetime_money.plus(money);
} }
PlayerObject.prototype.loseMoney = function(money) { PlayerObject.prototype.loseMoney = function(money) {
@ -561,6 +561,11 @@ PlayerObject.prototype.canAfford = function(cost) {
return this.money.gte(cost); return this.money.gte(cost);
} }
PlayerObject.prototype.recordMoneySource = function(amt, source) {
this.moneySourceA.record(amt, source);
this.moneySourceB.record(amt, source);
}
PlayerObject.prototype.gainHackingExp = function(exp) { PlayerObject.prototype.gainHackingExp = function(exp) {
if (isNaN(exp)) { if (isNaN(exp)) {
console.log("ERR: NaN passed into Player.gainHackingExp()"); return; console.log("ERR: NaN passed into Player.gainHackingExp()"); return;
@ -690,6 +695,7 @@ PlayerObject.prototype.processWorkEarnings = function(numCycles=1) {
this.gainAgilityExp(agiExpGain); this.gainAgilityExp(agiExpGain);
this.gainCharismaExp(chaExpGain); this.gainCharismaExp(chaExpGain);
this.gainMoney(moneyGain); this.gainMoney(moneyGain);
this.recordMoneySource(moneyGain, "work");
this.workHackExpGained += hackExpGain; this.workHackExpGained += hackExpGain;
this.workStrExpGained += strExpGain; this.workStrExpGained += strExpGain;
this.workDefExpGained += defExpGain; this.workDefExpGained += defExpGain;
@ -1561,7 +1567,7 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
//Determine crime success/failure //Determine crime success/failure
if (!cancelled) { if (!cancelled) {
var statusText = ""; //TODO, unique message for each crime when you succeed var statusText = ""; //TODO, unique message for each crime when you succeed
if (determineCrimeSuccess(this.crimeType, this.workMoneyGained)) { if (determineCrimeSuccess(Player, this.crimeType)) {
//Handle Karma and crime statistics //Handle Karma and crime statistics
let crime = null; let crime = null;
for(const i in Crimes) { for(const i in Crimes) {
@ -1574,6 +1580,8 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
console.log(this.crimeType); console.log(this.crimeType);
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer"); dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
} }
Player.gainMoney(this.workMoneyGained);
Player.recordMoneySource(this.workMoneyGained, "crime");
this.karma -= crime.karma; this.karma -= crime.karma;
this.numPeopleKilled += crime.kills; this.numPeopleKilled += crime.kills;
if(crime.intelligence_exp > 0) { if(crime.intelligence_exp > 0) {
@ -1690,6 +1698,11 @@ PlayerObject.prototype.singularityStopWork = function() {
//Returns true if hospitalized, false otherwise //Returns true if hospitalized, false otherwise
PlayerObject.prototype.takeDamage = function(amt) { PlayerObject.prototype.takeDamage = function(amt) {
if (typeof amt !== "number") {
console.warn(`Player.takeDamage() called without a numeric argument: ${amt}`);
return;
}
this.hp -= amt; this.hp -= amt;
if (this.hp <= 0) { if (this.hp <= 0) {
this.hospitalize(); this.hospitalize();
@ -1699,6 +1712,15 @@ PlayerObject.prototype.takeDamage = function(amt) {
} }
} }
PlayerObject.prototype.regenerateHp = function(amt) {
if (typeof amt !== "number") {
console.warn(`Player.regenerateHp() called without a numeric argument: ${amt}`);
return;
}
this.hp += amt;
if (this.hp > this.max_hp) { this.hp = this.max_hp; }
}
PlayerObject.prototype.hospitalize = function() { PlayerObject.prototype.hospitalize = function() {
if (Settings.SuppressHospitalizationPopup === false) { if (Settings.SuppressHospitalizationPopup === false) {
dialogBoxCreate( dialogBoxCreate(
@ -2021,15 +2043,27 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
var numAugmentations = this.augmentations.length; var numAugmentations = this.augmentations.length;
var company = Companies[this.companyName];
var companyRep = 0;
if (company != null) {
companyRep = company.playerReputation;
}
const allCompanies = Object.keys(this.jobs); const allCompanies = Object.keys(this.jobs);
const allPositions = Object.values(this.jobs); const allPositions = Object.values(this.jobs);
// Given a company name, safely returns the reputation (returns 0 if invalid company is specified)
function getCompanyRep(companyName) {
const company = Companies[companyName];
if (company == null) {
return 0;
} else {
return company.playerReputation;
}
}
// Helper function that returns a boolean indicating whether the Player meets
// the requirements for the specified company. There are two requirements:
// 1. High enough reputation
// 2. Player is employed at the company
function checkMegacorpRequirements(companyName, repNeeded=CONSTANTS.CorpFactionRepRequirement) {
return allCompanies.includes(companyName) && (getCompanyRep(companyName) > repNeeded);
}
//Illuminati //Illuminati
var illuminatiFac = Factions["Illuminati"]; var illuminatiFac = Factions["Illuminati"];
if (!illuminatiFac.isBanned && !illuminatiFac.isMember && !illuminatiFac.alreadyInvited && if (!illuminatiFac.isBanned && !illuminatiFac.isMember && !illuminatiFac.alreadyInvited &&
@ -2044,7 +2078,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
//Daedalus //Daedalus
var daedalusFac = Factions["Daedalus"]; var daedalusFac = Factions["Daedalus"];
if (!daedalusFac.isBanned && !daedalusFac.isMember && !daedalusFac.alreadyInvited && if (!daedalusFac.isBanned && !daedalusFac.isMember && !daedalusFac.alreadyInvited &&
numAugmentations >= 30 && numAugmentations >= Math.round(30 * BitNodeMultipliers.DaedalusAugsRequirement) &&
this.money.gte(100000000000) && this.money.gte(100000000000) &&
(this.hacking_skill >= 2500 || (this.hacking_skill >= 2500 ||
(this.strength >= 1500 && this.defense >= 1500 && (this.strength >= 1500 && this.defense >= 1500 &&
@ -2055,7 +2089,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
//The Covenant //The Covenant
var covenantFac = Factions["The Covenant"]; var covenantFac = Factions["The Covenant"];
if (!covenantFac.isBanned && !covenantFac.isMember && !covenantFac.alreadyInvited && if (!covenantFac.isBanned && !covenantFac.isMember && !covenantFac.alreadyInvited &&
numAugmentations >= 30 && numAugmentations >= 20 &&
this.money.gte(75000000000) && this.money.gte(75000000000) &&
this.hacking_skill >= 850 && this.hacking_skill >= 850 &&
this.strength >= 850 && this.strength >= 850 &&
@ -2068,14 +2102,14 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
//ECorp //ECorp
var ecorpFac = Factions["ECorp"]; var ecorpFac = Factions["ECorp"];
if (!ecorpFac.isBanned && !ecorpFac.isMember && !ecorpFac.alreadyInvited && if (!ecorpFac.isBanned && !ecorpFac.isMember && !ecorpFac.alreadyInvited &&
allCompanies.includes(Locations.AevumECorp) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.AevumECorp)) {
invitedFactions.push(ecorpFac); invitedFactions.push(ecorpFac);
} }
//MegaCorp //MegaCorp
var megacorpFac = Factions["MegaCorp"]; var megacorpFac = Factions["MegaCorp"];
if (!megacorpFac.isBanned && !megacorpFac.isMember && !megacorpFac.alreadyInvited && if (!megacorpFac.isBanned && !megacorpFac.isMember && !megacorpFac.alreadyInvited &&
allCompanies.includes(Locations.Sector12MegaCorp) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.Sector12MegaCorp)) {
invitedFactions.push(megacorpFac); invitedFactions.push(megacorpFac);
} }
@ -2083,42 +2117,42 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
var bachmanandassociatesFac = Factions["Bachman & Associates"]; var bachmanandassociatesFac = Factions["Bachman & Associates"];
if (!bachmanandassociatesFac.isBanned && !bachmanandassociatesFac.isMember && if (!bachmanandassociatesFac.isBanned && !bachmanandassociatesFac.isMember &&
!bachmanandassociatesFac.alreadyInvited && !bachmanandassociatesFac.alreadyInvited &&
allCompanies.includes(Locations.AevumBachmanAndAssociates) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.AevumBachmanAndAssociates)) {
invitedFactions.push(bachmanandassociatesFac); invitedFactions.push(bachmanandassociatesFac);
} }
//Blade Industries //Blade Industries
var bladeindustriesFac = Factions["Blade Industries"]; var bladeindustriesFac = Factions["Blade Industries"];
if (!bladeindustriesFac.isBanned && !bladeindustriesFac.isMember && !bladeindustriesFac.alreadyInvited && if (!bladeindustriesFac.isBanned && !bladeindustriesFac.isMember && !bladeindustriesFac.alreadyInvited &&
allCompanies.includes(Locations.Sector12BladeIndustries) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.Sector12BladeIndustries)) {
invitedFactions.push(bladeindustriesFac); invitedFactions.push(bladeindustriesFac);
} }
//NWO //NWO
var nwoFac = Factions["NWO"]; var nwoFac = Factions["NWO"];
if (!nwoFac.isBanned && !nwoFac.isMember && !nwoFac.alreadyInvited && if (!nwoFac.isBanned && !nwoFac.isMember && !nwoFac.alreadyInvited &&
allCompanies.includes(Locations.VolhavenNWO) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.VolhavenNWO)) {
invitedFactions.push(nwoFac); invitedFactions.push(nwoFac);
} }
//Clarke Incorporated //Clarke Incorporated
var clarkeincorporatedFac = Factions["Clarke Incorporated"]; var clarkeincorporatedFac = Factions["Clarke Incorporated"];
if (!clarkeincorporatedFac.isBanned && !clarkeincorporatedFac.isMember && !clarkeincorporatedFac.alreadyInvited && if (!clarkeincorporatedFac.isBanned && !clarkeincorporatedFac.isMember && !clarkeincorporatedFac.alreadyInvited &&
allCompanies.includes(Locations.AevumClarkeIncorporated) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.AevumClarkeIncorporated)) {
invitedFactions.push(clarkeincorporatedFac); invitedFactions.push(clarkeincorporatedFac);
} }
//OmniTek Incorporated //OmniTek Incorporated
var omnitekincorporatedFac = Factions["OmniTek Incorporated"]; var omnitekincorporatedFac = Factions["OmniTek Incorporated"];
if (!omnitekincorporatedFac.isBanned && !omnitekincorporatedFac.isMember && !omnitekincorporatedFac.alreadyInvited && if (!omnitekincorporatedFac.isBanned && !omnitekincorporatedFac.isMember && !omnitekincorporatedFac.alreadyInvited &&
allCompanies.includes(Locations.VolhavenOmniTekIncorporated) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.VolhavenOmniTekIncorporated)) {
invitedFactions.push(omnitekincorporatedFac); invitedFactions.push(omnitekincorporatedFac);
} }
//Four Sigma //Four Sigma
var foursigmaFac = Factions["Four Sigma"]; var foursigmaFac = Factions["Four Sigma"];
if (!foursigmaFac.isBanned && !foursigmaFac.isMember && !foursigmaFac.alreadyInvited && if (!foursigmaFac.isBanned && !foursigmaFac.isMember && !foursigmaFac.alreadyInvited &&
allCompanies.includes(Locations.Sector12FourSigma) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.Sector12FourSigma)) {
invitedFactions.push(foursigmaFac); invitedFactions.push(foursigmaFac);
} }
@ -2126,7 +2160,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
var kuaigonginternationalFac = Factions["KuaiGong International"]; var kuaigonginternationalFac = Factions["KuaiGong International"];
if (!kuaigonginternationalFac.isBanned && !kuaigonginternationalFac.isMember && if (!kuaigonginternationalFac.isBanned && !kuaigonginternationalFac.isMember &&
!kuaigonginternationalFac.alreadyInvited && !kuaigonginternationalFac.alreadyInvited &&
allCompanies.includes(Locations.ChongqingKuaiGongInternational) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.ChongqingKuaiGongInternational)) {
invitedFactions.push(kuaigonginternationalFac); invitedFactions.push(kuaigonginternationalFac);
} }
@ -2139,7 +2173,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
if (!fulcrumsecrettechonologiesFac.isBanned && !fulcrumsecrettechonologiesFac.isMember && if (!fulcrumsecrettechonologiesFac.isBanned && !fulcrumsecrettechonologiesFac.isMember &&
!fulcrumsecrettechonologiesFac.alreadyInvited && !fulcrumsecrettechonologiesFac.alreadyInvited &&
fulcrumSecretServer.manuallyHacked && fulcrumSecretServer.manuallyHacked &&
allCompanies.includes(Locations.AevumFulcrumTechnologies) && companyRep >= 250000) { checkMegacorpRequirements(Locations.AevumFulcrumTechnologies, 250e3)) {
invitedFactions.push(fulcrumsecrettechonologiesFac); invitedFactions.push(fulcrumsecrettechonologiesFac);
} }
} }
@ -2415,6 +2449,7 @@ PlayerObject.prototype.gainCodingContractReward = function(reward, difficulty=1)
default: default:
var moneyGain = CONSTANTS.CodingContractBaseMoneyGain * difficulty * BitNodeMultipliers.CodingContractMoney; var moneyGain = CONSTANTS.CodingContractBaseMoneyGain * difficulty * BitNodeMultipliers.CodingContractMoney;
this.gainMoney(moneyGain); this.gainMoney(moneyGain);
this.recordMoneySource(moneyGain, "codingcontract");
return `Gained ${numeralWrapper.format(moneyGain, '$0.000a')}`; return `Gained ${numeralWrapper.format(moneyGain, '$0.000a')}`;
break; break;
} }
@ -2427,8 +2462,6 @@ function loadPlayer(saveString) {
//Parse Decimal.js objects //Parse Decimal.js objects
Player.money = new Decimal(Player.money); Player.money = new Decimal(Player.money);
Player.total_money = new Decimal(Player.total_money);
Player.lifetime_money = new Decimal(Player.lifetime_money);
if (Player.corporation instanceof Corporation) { if (Player.corporation instanceof Corporation) {
Player.corporation.funds = new Decimal(Player.corporation.funds); Player.corporation.funds = new Decimal(Player.corporation.funds);

@ -48,16 +48,20 @@ let BitNode8StartingMoney = 250e6;
//Prestige by purchasing augmentation //Prestige by purchasing augmentation
function prestigeAugmentation() { function prestigeAugmentation() {
// Load Terminal Screen // Set Navigation to Terminal screen, for any logic that depends on it
routing.navigateTo(Page.Terminal);
initBitNodeMultipliers(Player);
Player.prestigeAugmentation();
// Now actually go to the Terminal Screen (and reset it)
var mainMenu = document.getElementById("mainmenu-container"); var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible"; mainMenu.style.visibility = "visible";
Terminal.resetTerminalInput(); Terminal.resetTerminalInput();
Engine.loadTerminalContent(); Engine.loadTerminalContent();
routing.navigateTo(Page.Terminal); $("#terminal tr:not(:last)").remove();
postNetburnerText();
initBitNodeMultipliers();
Player.prestigeAugmentation();
//Delete all Worker Scripts objects //Delete all Worker Scripts objects
prestigeWorkerScripts(); prestigeWorkerScripts();
@ -116,10 +120,6 @@ function prestigeAugmentation() {
Player.reapplyAllSourceFiles(); Player.reapplyAllSourceFiles();
initCompanies(); initCompanies();
//Clear terminal
$("#terminal tr:not(:last)").remove();
postNetburnerText();
//Messages //Messages
initMessages(); initMessages();
@ -175,7 +175,7 @@ function prestigeAugmentation() {
//Prestige by destroying Bit Node and gaining a Source File //Prestige by destroying Bit Node and gaining a Source File
function prestigeSourceFile() { function prestigeSourceFile() {
initBitNodeMultipliers(); initBitNodeMultipliers(Player);
updateSourceFileFlags(Player); updateSourceFileFlags(Player);
Player.prestigeSourceFile(); Player.prestigeSourceFile();

@ -6,6 +6,7 @@ import { SourceFiles,
SourceFile } from "./SourceFile"; SourceFile } from "./SourceFile";
import { PlayerOwnedSourceFile } from "./SourceFile/PlayerOwnedSourceFile"; import { PlayerOwnedSourceFile } from "./SourceFile/PlayerOwnedSourceFile";
import { Terminal } from "./Terminal"; import { Terminal } from "./Terminal";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners"; import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners";
import {dialogBoxCreate} from "../utils/DialogBox"; import {dialogBoxCreate} from "../utils/DialogBox";
@ -34,7 +35,7 @@ function writeRedPillLine(line) {
function writeRedPillLetter(pElem, line, i=0) { function writeRedPillLetter(pElem, line, i=0) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
setTimeout(function() { setTimeoutRef(function() {
if (i >= line.length) { if (i >= line.length) {
var textToShow = line.substring(0, i); var textToShow = line.substring(0, i);
pElem.innerHTML = "> " + textToShow; pElem.innerHTML = "> " + textToShow;

@ -17,6 +17,8 @@ import {AllServers, loadAllServers} from "./Server";
import {Settings} from "./Settings/Settings"; import {Settings} from "./Settings/Settings";
import {loadSpecialServerIps, SpecialServerIps} from "./SpecialServerIps"; import {loadSpecialServerIps, SpecialServerIps} from "./SpecialServerIps";
import {loadStockMarket, StockMarket} from "./StockMarket/StockMarket"; import {loadStockMarket, StockMarket} from "./StockMarket/StockMarket";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import {dialogBoxCreate} from "../utils/DialogBox"; import {dialogBoxCreate} from "../utils/DialogBox";
import {gameOptionsBoxClose} from "../utils/GameOptions"; import {gameOptionsBoxClose} from "../utils/GameOptions";
import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners"; import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners";
@ -291,8 +293,6 @@ function loadImportedGame(saveObj, saveString) {
//Parse Decimal.js objects //Parse Decimal.js objects
tempPlayer.money = new Decimal(tempPlayer.money); tempPlayer.money = new Decimal(tempPlayer.money);
tempPlayer.total_money = new Decimal(tempPlayer.total_money);
tempPlayer.lifetime_money = new Decimal(tempPlayer.lifetime_money);
tempAllServers = JSON.parse(tempSaveObj.AllServersSave, Reviver); tempAllServers = JSON.parse(tempSaveObj.AllServersSave, Reviver);
tempCompanies = JSON.parse(tempSaveObj.CompaniesSave, Reviver); tempCompanies = JSON.parse(tempSaveObj.CompaniesSave, Reviver);
@ -546,7 +546,7 @@ BitburnerSaveObject.prototype.exportGame = function() {
a.download = "bitburnerSave.json"; a.download = "bitburnerSave.json";
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
setTimeout(function() { setTimeoutRef(function() {
document.body.removeChild(a); document.body.removeChild(a);
window.URL.revokeObjectURL(url); window.URL.revokeObjectURL(url);
}, 0); }, 0);

@ -20,6 +20,7 @@ import {TextFile} from "./TextFile";
import {parse, Node} from "../utils/acorn"; import {parse, Node} from "../utils/acorn";
import {Page, routing} from "./ui/navigationTracking"; import {Page, routing} from "./ui/navigationTracking";
import {numeralWrapper} from "./ui/numeralFormat"; import {numeralWrapper} from "./ui/numeralFormat";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import {dialogBoxCreate} from "../utils/DialogBox"; import {dialogBoxCreate} from "../utils/DialogBox";
import {Reviver, Generic_toJSON, import {Reviver, Generic_toJSON,
Generic_fromJSON} from "../utils/JSONReviver"; Generic_fromJSON} from "../utils/JSONReviver";
@ -758,7 +759,7 @@ Script.prototype.download = function() {
a.download = filename; a.download = filename;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
setTimeout(function() { setTimeoutRef(function() {
document.body.removeChild(a); document.body.removeChild(a);
window.URL.revokeObjectURL(url); window.URL.revokeObjectURL(url);
}, 0); }, 0);
@ -853,6 +854,7 @@ function scriptCalculateOfflineProduction(runningScriptObj) {
} }
totalOfflineProduction += production; totalOfflineProduction += production;
Player.gainMoney(production); Player.gainMoney(production);
Player.recordMoneySource(production, "hacking");
console.log(runningScriptObj.filename + " generated $" + production + " while offline by hacking " + serv.hostname); console.log(runningScriptObj.filename + " generated $" + production + " while offline by hacking " + serv.hostname);
runningScriptObj.log(runningScriptObj.filename + " generated $" + production + " while offline by hacking " + serv.hostname); runningScriptObj.log(runningScriptObj.filename + " generated $" + production + " while offline by hacking " + serv.hostname);
serv.moneyAvailable -= production; serv.moneyAvailable -= production;

@ -1,4 +1,6 @@
import {Stock} from "./Stock"; import {Stock} from "./Stock";
import { getStockMarket4SDataCost,
getStockMarket4STixApiCost } from "./StockMarketCosts";
import {CONSTANTS} from "../Constants"; import {CONSTANTS} from "../Constants";
import {Locations} from "../Locations"; import {Locations} from "../Locations";
@ -452,6 +454,7 @@ function sellStock(stock, shares) {
if (shares === 0) {return false;} if (shares === 0) {return false;}
var gains = stock.price * shares - CONSTANTS.StockMarketCommission; var gains = stock.price * shares - CONSTANTS.StockMarketCommission;
Player.gainMoney(gains); Player.gainMoney(gains);
Player.recordMoneySource(gains, "stock");
stock.playerShares = Math.round(stock.playerShares - shares); stock.playerShares = Math.round(stock.playerShares - shares);
if (stock.playerShares == 0) { if (stock.playerShares == 0) {
stock.playerAvgPx = 0; stock.playerAvgPx = 0;
@ -548,6 +551,7 @@ function sellShort(stock, shares, workerScript=null) {
var profit = ((stock.playerAvgShortPx - stock.price) * shares) - CONSTANTS.StockMarketCommission; var profit = ((stock.playerAvgShortPx - stock.price) * shares) - CONSTANTS.StockMarketCommission;
if (isNaN(profit)) {profit = 0;} if (isNaN(profit)) {profit = 0;}
Player.gainMoney(origCost + profit); Player.gainMoney(origCost + profit);
Player.recordMoneySource(profit, "stock");
if (tixApi) { if (tixApi) {
workerScript.scriptRef.onlineMoneyMade += profit; workerScript.scriptRef.onlineMoneyMade += profit;
Player.scriptProdSinceLastAug += profit; Player.scriptProdSinceLastAug += profit;
@ -767,13 +771,13 @@ function displayStockMarketContent() {
//Purchase Four Sigma Market Data Feed //Purchase Four Sigma Market Data Feed
var marketDataButton = clearEventListeners("stock-market-buy-4s-data"); var marketDataButton = clearEventListeners("stock-market-buy-4s-data");
stylePurchaseButton(marketDataButton, CONSTANTS.MarketData4SCost, Player.has4SData, stylePurchaseButton(marketDataButton, getStockMarket4SDataCost(), Player.has4SData,
"Buy 4S Market Data Access - " + numeralWrapper.format(CONSTANTS.MarketData4SCost, '($0.000a)'), "Buy 4S Market Data Access - " + numeralWrapper.format(getStockMarket4SDataCost(), '($0.000a)'),
"4S Market Data - Purchased"); "4S Market Data - Purchased");
marketDataButton.addEventListener("click", function() { marketDataButton.addEventListener("click", function() {
if (Player.money.lt(CONSTANTS.MarketData4SCost)) { return false; } if (Player.money.lt(getStockMarket4SDataCost())) { return false; }
Player.has4SData = true; Player.has4SData = true;
Player.loseMoney(CONSTANTS.MarketData4SCost); Player.loseMoney(getStockMarket4SDataCost());
displayStockMarketContent(); displayStockMarketContent();
return false; return false;
}); });
@ -806,14 +810,14 @@ function displayStockMarketContent() {
//Purchase Four Sigma Market Data TIX API (Requires TIX API Access) //Purchase Four Sigma Market Data TIX API (Requires TIX API Access)
var marketDataTixButton = clearEventListeners("stock-market-buy-4s-tix-api"); var marketDataTixButton = clearEventListeners("stock-market-buy-4s-tix-api");
stylePurchaseButton(marketDataTixButton, CONSTANTS.MarketDataTixApi4SCost, Player.has4SDataTixApi, stylePurchaseButton(marketDataTixButton, getStockMarket4STixApiCost(), Player.has4SDataTixApi,
"Buy 4S Market Data TIX API Access - " + numeralWrapper.format(CONSTANTS.MarketDataTixApi4SCost, '($0.000a)'), "Buy 4S Market Data TIX API Access - " + numeralWrapper.format(getStockMarket4STixApiCost(), '($0.000a)'),
"4S Market Data TIX API - Purchased"); "4S Market Data TIX API - Purchased");
if (Player.hasTixApiAccess) { if (Player.hasTixApiAccess) {
marketDataTixButton.addEventListener("click", function() { marketDataTixButton.addEventListener("click", function() {
if (Player.money.lt(CONSTANTS.MarketDataTixApi4SCost)) { return false; } if (Player.money.lt(getStockMarket4STixApiCost())) { return false; }
Player.has4SDataTixApi = true; Player.has4SDataTixApi = true;
Player.loseMoney(CONSTANTS.MarketDataTixApi4SCost); Player.loseMoney(getStockMarket4STixApiCost());
displayStockMarketContent(); displayStockMarketContent();
return false; return false;
}); });

@ -0,0 +1,18 @@
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
import { CONSTANTS } from "../Constants";
export function getStockMarketAccountCost(): number {
return CONSTANTS.WSEAccountCost;
}
export function getStockMarketTixApiCost(): number {
return CONSTANTS.TIXAPICost;
}
export function getStockMarket4SDataCost(): number {
return CONSTANTS.MarketData4SCost * BitNodeMultipliers.FourSigmaMarketDataCost;
}
export function getStockMarket4STixApiCost(): number {
return CONSTANTS.MarketDataTixApi4SCost * BitNodeMultipliers.FourSigmaMarketDataApiCost;
}

@ -35,6 +35,7 @@ import {Settings} from "./Settings/Settings";
import {SpecialServerIps, import {SpecialServerIps,
SpecialServerNames} from "./SpecialServerIps"; SpecialServerNames} from "./SpecialServerIps";
import {getTextFile} from "./TextFile"; import {getTextFile} from "./TextFile";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import {containsAllStrings, import {containsAllStrings,
longestCommonStart} from "../utils/StringHelperFunctions"; longestCommonStart} from "../utils/StringHelperFunctions";
import {Page, routing} from "./ui/navigationTracking"; import {Page, routing} from "./ui/navigationTracking";
@ -128,7 +129,7 @@ $(document).keydown(function(event) {
} }
var prevCommand = Terminal.commandHistory[Terminal.commandHistoryIndex]; var prevCommand = Terminal.commandHistory[Terminal.commandHistoryIndex];
terminalInput.value = prevCommand; terminalInput.value = prevCommand;
setTimeout(function(){terminalInput.selectionStart = terminalInput.selectionEnd = 10000; }, 0); setTimeoutRef(function(){terminalInput.selectionStart = terminalInput.selectionEnd = 10000; }, 0);
} }
if (event.keyCode === KEY.DOWNARROW || if (event.keyCode === KEY.DOWNARROW ||
@ -728,6 +729,7 @@ let Terminal = {
server.moneyAvailable -= moneyGained; server.moneyAvailable -= moneyGained;
Player.gainMoney(moneyGained); Player.gainMoney(moneyGained);
Player.recordMoneySource(moneyGained, "hacking");
Player.gainHackingExp(expGainedOnSuccess) Player.gainHackingExp(expGainedOnSuccess)
Player.gainIntelligenceExp(expGainedOnSuccess / CONSTANTS.IntelligenceTerminalHackBaseExpGain); Player.gainIntelligenceExp(expGainedOnSuccess / CONSTANTS.IntelligenceTerminalHackBaseExpGain);
@ -1405,7 +1407,7 @@ let Terminal = {
} else if (executableName.endsWith(".cct")) { } else if (executableName.endsWith(".cct")) {
Terminal.runContract(executableName); Terminal.runContract(executableName);
} else { } else {
Terminal.runProgram(executableName); Terminal.runProgram(commandArray);
} }
} }
break; break;
@ -1993,30 +1995,27 @@ let Terminal = {
//First called when the "run [program]" command is called. Checks to see if you //First called when the "run [program]" command is called. Checks to see if you
//have the executable and, if you do, calls the executeProgram() function //have the executable and, if you do, calls the executeProgram() function
runProgram: function(programName) { runProgram: function(commandArray) {
//Check if you have the program on your computer. If you do, execute it, otherwise if (commandArray.length < 2) { return; }
//display an error message
var splitArgs = programName.split(" "); // Check if you have the program on your computer. If you do, execute it, otherwise
var name = " "; // display an error message
if (splitArgs.length > 1) { const programName = commandArray[1];
name = splitArgs[0];
} else { if (Player.hasProgram(programName)) {
name = programName; Terminal.executeProgram(commandArray);
}
if (Player.hasProgram(name)) {
Terminal.executeProgram(programName);
return; return;
} }
post("ERROR: No such executable on home computer (Only programs that exist on your home computer can be run)"); post("ERROR: No such executable on home computer (Only programs that exist on your home computer can be run)");
}, },
//Contains the implementations of all possible programs //Contains the implementations of all possible programs
executeProgram: function(programName) { executeProgram: function(commandArray) {
if (commandArray.length < 2) { return; }
var s = Player.getCurrentServer(); var s = Player.getCurrentServer();
var splitArgs = programName.split(" "); const programName = commandArray[1];
if (splitArgs.length > 1) { const splitArgs = commandArray.slice(1);
programName = splitArgs[0];
}
// TODO: refactor this/these out of Terminal. This logic could reside closer to the Programs themselves. // TODO: refactor this/these out of Terminal. This logic could reside closer to the Programs themselves.
/** /**

@ -1,3 +1,4 @@
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import { dialogBoxCreate } from "../utils/DialogBox"; import { dialogBoxCreate } from "../utils/DialogBox";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver";
@ -52,12 +53,10 @@ export class TextFile {
a.download = this.fn; a.download = this.fn;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
setTimeout( setTimeoutRef(() => {
() => {
document.body.removeChild(a); document.body.removeChild(a);
window.URL.revokeObjectURL(url); window.URL.revokeObjectURL(url);
}, }, 0);
0);
} }
} }

@ -76,6 +76,7 @@ import { clearResleevesPage,
createResleevesPage } from "./PersonObjects/Resleeving/ResleevingUI"; createResleevesPage } from "./PersonObjects/Resleeving/ResleevingUI";
import { createStatusText } from "./ui/createStatusText"; import { createStatusText } from "./ui/createStatusText";
import { displayCharacterInfo } from "./ui/displayCharacterInfo";
import {Page, routing} from "./ui/navigationTracking"; import {Page, routing} from "./ui/navigationTracking";
import {numeralWrapper} from "./ui/numeralFormat"; import {numeralWrapper} from "./ui/numeralFormat";
import {setSettingsLabels} from "./ui/setSettingsLabels"; import {setSettingsLabels} from "./ui/setSettingsLabels";
@ -271,7 +272,7 @@ const Engine = {
loadCharacterContent: function() { loadCharacterContent: function() {
Engine.hideAllContent(); Engine.hideAllContent();
Engine.Display.characterContent.style.display = "block"; Engine.Display.characterContent.style.display = "block";
Engine.displayCharacterInfo(); Engine.updateCharacterInfo();
routing.navigateTo(Page.CharacterInfo); routing.navigateTo(Page.CharacterInfo);
MainMenuLinks.Stats.classList.add("active"); MainMenuLinks.Stats.classList.add("active");
}, },
@ -593,96 +594,8 @@ const Engine = {
}, },
/* Display character info */ /* Display character info */
displayCharacterInfo: function() { updateCharacterInfo: function() {
removeChildrenFromElement(Engine.Display.characterInfo); displayCharacterInfo(Engine.Display.characterInfo, Player);
let companyPosition = "";
if (Player.companyName !== "") {
companyPosition = Player.jobs[Player.companyName];
}
var intText = "";
if (Player.intelligence > 0) {
intText = 'Intelligence: ' + (Player.intelligence).toLocaleString() + '<br>';
}
let bitNodeTimeText = "";
if(Player.sourceFiles.length > 0) {
bitNodeTimeText = 'Time played since last Bitnode destroyed: ' + convertTimeMsToTimeElapsedString(Player.playtimeSinceLastBitnode) + '<br>';
}
Engine.Display.characterInfo.appendChild(createElement("pre", {
innerHTML:
'<b>General</b><br><br>' +
'Current City: ' + Player.city + '<br><br>' +
`Employer at which you last worked: ${Player.companyName}<br>` +
`Job you last worked: ${companyPosition}<br>` +
`All Employers: ${Object.keys(Player.jobs).join(", ")}<br><br>` +
'Money: $' + formatNumber(Player.money.toNumber(), 2) + '<br><br><br>' +
'<b>Stats</b><br><br>' +
'Hacking Level: ' + (Player.hacking_skill).toLocaleString() +
' (' + numeralWrapper.format(Player.hacking_exp, '(0.000a)') + ' experience)<br>' +
'Strength: ' + (Player.strength).toLocaleString() +
' (' + numeralWrapper.format(Player.strength_exp, '(0.000a)') + ' experience)<br>' +
'Defense: ' + (Player.defense).toLocaleString() +
' (' + numeralWrapper.format(Player.defense_exp, '(0.000a)') + ' experience)<br>' +
'Dexterity: ' + (Player.dexterity).toLocaleString() +
' (' + numeralWrapper.format(Player.dexterity_exp, '(0.000a)') + ' experience)<br>' +
'Agility: ' + (Player.agility).toLocaleString() +
' (' + numeralWrapper.format(Player.agility_exp, '(0.000a)') + ' experience)<br>' +
'Charisma: ' + (Player.charisma).toLocaleString() +
' (' + numeralWrapper.format(Player.charisma_exp, '(0.000a)') + ' experience)<br>' +
intText + '<br><br>' +
'<b>Multipliers</b><br><br>' +
'Hacking Chance multiplier: ' + formatNumber(Player.hacking_chance_mult * 100, 2) + '%<br>' +
'Hacking Speed multiplier: ' + formatNumber(Player.hacking_speed_mult * 100, 2) + '%<br>' +
'Hacking Money multiplier: ' + formatNumber(Player.hacking_money_mult * 100, 2) + '%<br>' +
'Hacking Growth multiplier: ' + formatNumber(Player.hacking_grow_mult * 100, 2) + '%<br><br>' +
'Hacking Level multiplier: ' + formatNumber(Player.hacking_mult * 100, 2) + '%<br>' +
'Hacking Experience multiplier: ' + formatNumber(Player.hacking_exp_mult * 100, 2) + '%<br><br>' +
'Strength Level multiplier: ' + formatNumber(Player.strength_mult * 100, 2) + '%<br>' +
'Strength Experience multiplier: ' + formatNumber(Player.strength_exp_mult * 100, 2) + '%<br><br>' +
'Defense Level multiplier: ' + formatNumber(Player.defense_mult * 100, 2) + '%<br>' +
'Defense Experience multiplier: ' + formatNumber(Player.defense_exp_mult * 100, 2) + '%<br><br>' +
'Dexterity Level multiplier: ' + formatNumber(Player.dexterity_mult * 100, 2) + '%<br>' +
'Dexterity Experience multiplier: ' + formatNumber(Player.dexterity_exp_mult * 100, 2) + '%<br><br>' +
'Agility Level multiplier: ' + formatNumber(Player.agility_mult * 100, 2) + '%<br>' +
'Agility Experience multiplier: ' + formatNumber(Player.agility_exp_mult * 100, 2) + '%<br><br>' +
'Charisma Level multiplier: ' + formatNumber(Player.charisma_mult * 100, 2) + '%<br>' +
'Charisma Experience multiplier: ' + formatNumber(Player.charisma_exp_mult * 100, 2) + '%<br><br>' +
'Hacknet Node production multiplier: ' + formatNumber(Player.hacknet_node_money_mult * 100, 2) + '%<br>' +
'Hacknet Node purchase cost multiplier: ' + formatNumber(Player.hacknet_node_purchase_cost_mult * 100, 2) + '%<br>' +
'Hacknet Node RAM upgrade cost multiplier: ' + formatNumber(Player.hacknet_node_ram_cost_mult * 100, 2) + '%<br>' +
'Hacknet Node Core purchase cost multiplier: ' + formatNumber(Player.hacknet_node_core_cost_mult * 100, 2) + '%<br>' +
'Hacknet Node level upgrade cost multiplier: ' + formatNumber(Player.hacknet_node_level_cost_mult * 100, 2) + '%<br><br>' +
'Company reputation gain multiplier: ' + formatNumber(Player.company_rep_mult * 100, 2) + '%<br>' +
'Faction reputation gain multiplier: ' + formatNumber(Player.faction_rep_mult * 100, 2) + '%<br>' +
'Salary multiplier: ' + formatNumber(Player.work_money_mult * 100, 2) + '%<br>' +
'Crime success multiplier: ' + formatNumber(Player.crime_success_mult * 100, 2) + '%<br>' +
'Crime money multiplier: ' + formatNumber(Player.crime_money_mult * 100, 2) + '%<br><br><br>' +
'<b>Misc</b><br><br>' +
'Servers owned: ' + Player.purchasedServers.length + '<br>' +
'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '<br>' +
'Augmentations installed: ' + Player.augmentations.length + '<br>' +
'Time played since last Augmentation: ' + convertTimeMsToTimeElapsedString(Player.playtimeSinceLastAug) + '<br>' +
bitNodeTimeText +
'Time played: ' + convertTimeMsToTimeElapsedString(Player.totalPlaytime),
}));
if (Player.sourceFiles.length !== 0) {
var index = "BitNode" + Player.bitNodeN;
Engine.Display.characterInfo.appendChild(createElement("p", {
width:"60%",
innerHTML:
"<br>Current BitNode: " + Player.bitNodeN + " (" + BitNodes[index].name + ")<br><br>",
}));
Engine.Display.characterInfo.appendChild(createElement("p", {
width:"60%", fontSize: "13px", marginLeft:"4%",
innerHTML:BitNodes[index].info,
}))
}
}, },
/* Display locations in the world*/ /* Display locations in the world*/
@ -835,7 +748,8 @@ const Engine = {
item.appendChild(createElement("a", { item.appendChild(createElement("a", {
innerText:"Accept Faction Invitation", innerText:"Accept Faction Invitation",
class:"a-link-button", display:"inline", margin:"4px", padding:"4px", class:"a-link-button", display:"inline", margin:"4px", padding:"4px",
clickListener:()=>{ clickListener: (e) => {
if (!e.isTrusted) { return false; }
joinFaction(Factions[factionName]); joinFaction(Factions[factionName]);
for (var i = 0; i < Player.factionInvitations.length; ++i) { for (var i = 0; i < Player.factionInvitations.length; ++i) {
if (Player.factionInvitations[i] == factionName || Factions[Player.factionInvitations[i]].isBanned) { if (Player.factionInvitations[i] == factionName || Factions[Player.factionInvitations[i]].isBanned) {
@ -1060,9 +974,7 @@ const Engine = {
if (Engine.Counters.updateDisplays <= 0) { if (Engine.Counters.updateDisplays <= 0) {
Engine.displayCharacterOverviewInfo(); Engine.displayCharacterOverviewInfo();
if (routing.isOn(Page.CharacterInfo)) { if (routing.isOn(Page.HacknetNodes)) {
Engine.displayCharacterInfo();
} else if (routing.isOn(Page.HacknetNodes)) {
updateHacknetNodesContent(); updateHacknetNodesContent();
} else if (routing.isOn(Page.CreateProgram)) { } else if (routing.isOn(Page.CreateProgram)) {
displayCreateProgramContent(); displayCreateProgramContent();
@ -1080,6 +992,8 @@ const Engine = {
if (Engine.Counters.updateDisplaysMed <= 0) { if (Engine.Counters.updateDisplaysMed <= 0) {
if (routing.isOn(Page.Corporation)) { if (routing.isOn(Page.Corporation)) {
Player.corporation.updateUIContent(); Player.corporation.updateUIContent();
} else if (routing.isOn(Page.CharacterInfo)) {
Engine.updateCharacterInfo();
} }
Engine.Counters.updateDisplaysMed = 9; Engine.Counters.updateDisplaysMed = 9;
} }
@ -1275,7 +1189,7 @@ const Engine = {
if (loadGame(saveString)) { if (loadGame(saveString)) {
console.log("Loaded game from save"); console.log("Loaded game from save");
initBitNodes(); initBitNodes();
initBitNodeMultipliers(); initBitNodeMultipliers(Player);
initSourceFiles(); initSourceFiles();
Engine.setDisplayElements(); //Sets variables for important DOM elements Engine.setDisplayElements(); //Sets variables for important DOM elements
Engine.init(); //Initialize buttons, work, etc. Engine.init(); //Initialize buttons, work, etc.
@ -1397,7 +1311,7 @@ const Engine = {
//No save found, start new game //No save found, start new game
console.log("Initializing new game"); console.log("Initializing new game");
initBitNodes(); initBitNodes();
initBitNodeMultipliers(); initBitNodeMultipliers(Player);
initSourceFiles(); initSourceFiles();
initSpecialServerIps(); initSpecialServerIps();
Engine.setDisplayElements(); //Sets variables for important DOM elements Engine.setDisplayElements(); //Sets variables for important DOM elements

@ -1,3 +1,4 @@
import { setTimeoutRef } from "../utils/SetTimeoutRef";
import { getElementById } from "../../utils/uiHelpers/getElementById"; import { getElementById } from "../../utils/uiHelpers/getElementById";
import { Action } from "../types"; import { Action } from "../types";
@ -23,5 +24,5 @@ export function createStatusText(text: string) {
statusElement.innerText = ""; statusElement.innerText = "";
}; };
x = setTimeout(handler, threeSeconds); x = setTimeoutRef(handler, threeSeconds);
} }

@ -0,0 +1,156 @@
// Displays character info on a given element. This is used to create & update
// the 'Stats' page from the main menu
import { BitNodes } from "../BitNode/BitNode";
import { IPlayer } from "../PersonObjects/IPlayer";
import { numeralWrapper } from "../ui/numeralFormat";
import { MoneySourceTracker } from "../utils/MoneySourceTracker";
import { dialogBoxCreate } from "../../utils/DialogBox";
import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions";
import { createElement } from "../../utils/uiHelpers/createElement";
import { removeChildrenFromElement } from "../../utils/uiHelpers/removeChildrenFromElement";
export function displayCharacterInfo(elem: HTMLElement, p: IPlayer) {
removeChildrenFromElement(elem);
let companyPosition = "";
if (p.companyName !== "") {
companyPosition = p.jobs[p.companyName];
}
var intText = "";
if (p.intelligence > 0) {
intText = 'Intelligence: ' + (p.intelligence).toLocaleString() + '<br>';
}
let bitNodeTimeText = "";
if(p.sourceFiles.length > 0) {
bitNodeTimeText = 'Time played since last Bitnode destroyed: ' + convertTimeMsToTimeElapsedString(p.playtimeSinceLastBitnode) + '<br>';
}
const unlockedBitnodes: boolean = p.sourceFiles.length !== 0;
// General info
elem.appendChild(createElement("pre", {
display: "block",
innerHTML:
'<b>General</b><br><br>' +
'Current City: ' + p.city + '<br><br>' +
`Employer at which you last worked: ${p.companyName}<br>` +
`Job you last worked: ${companyPosition}<br>` +
`All Employers: ${Object.keys(p.jobs).join(", ")}<br><br>`
}));
// Money, and a button to show money breakdown
elem.appendChild(createElement("pre", {
display: "inline-block",
innerHTML: 'Money: ' + numeralWrapper.formatMoney(p.money.toNumber()) + '<br><br><br>',
margin: "6px",
}));
function convertMoneySourceTrackerToString(src: MoneySourceTracker): string {
let parts: string[] = [`Total: ${numeralWrapper.formatMoney(src.total)}`];
if (src.bladeburner) { parts.push(`Bladeburner: ${numeralWrapper.formatMoney(src.bladeburner)}`) };
if (src.codingcontract) { parts.push(`Coding Contracts: ${numeralWrapper.formatMoney(src.codingcontract)}`) };
if (src.work) { parts.push(`Company Work: ${numeralWrapper.formatMoney(src.work)}`) };
if (src.corporation) { parts.push(`Corporation: ${numeralWrapper.formatMoney(src.corporation)}}`) };
if (src.crime) { parts.push(`Crimes: ${numeralWrapper.formatMoney(src.crime)}`) };
if (src.gang) { parts.push(`Gang: ${numeralWrapper.formatMoney(src.gang)}`) };
if (src.hacking) { parts.push(`Hacking: ${numeralWrapper.formatMoney(src.hacking)}`) };
if (src.hacknetnode) { parts.push(`Hacknet Nodes: ${numeralWrapper.formatMoney(src.hacknetnode)}`) };
if (src.infiltration) { parts.push(`Infiltration: ${numeralWrapper.formatMoney(src.infiltration)}`) };
if (src.stock) { parts.push(`Stock Market: ${numeralWrapper.formatMoney(src.stock)}`) };
return parts.join("<br>");
}
elem.appendChild(createElement("button", {
class: "popup-box-button",
display: "inline-block",
float: "none",
innerText: "Money Statistics & Breakdown",
clickListener: () => {
let txt: string = "<u>Money earned since you last installed Augmentations:</u><br>" +
convertMoneySourceTrackerToString(p.moneySourceA);
if (unlockedBitnodes) {
txt += "<br><br><u>Money earned in this BitNode:</u><br>" +
convertMoneySourceTrackerToString(p.moneySourceB);
}
dialogBoxCreate(txt, false);
}
}));
// Stats and multiplier
elem.appendChild(createElement("pre", {
display: "block",
innerHTML:
'<b>Stats</b><br><br>' +
'Hacking Level: ' + (p.hacking_skill).toLocaleString() +
' (' + numeralWrapper.format(p.hacking_exp, '(0.000a)') + ' experience)<br>' +
'Strength: ' + (p.strength).toLocaleString() +
' (' + numeralWrapper.format(p.strength_exp, '(0.000a)') + ' experience)<br>' +
'Defense: ' + (p.defense).toLocaleString() +
' (' + numeralWrapper.format(p.defense_exp, '(0.000a)') + ' experience)<br>' +
'Dexterity: ' + (p.dexterity).toLocaleString() +
' (' + numeralWrapper.format(p.dexterity_exp, '(0.000a)') + ' experience)<br>' +
'Agility: ' + (p.agility).toLocaleString() +
' (' + numeralWrapper.format(p.agility_exp, '(0.000a)') + ' experience)<br>' +
'Charisma: ' + (p.charisma).toLocaleString() +
' (' + numeralWrapper.format(p.charisma_exp, '(0.000a)') + ' experience)<br>' +
intText + '<br><br>' +
'<b>Multipliers</b><br><br>' +
'Hacking Chance multiplier: ' + numeralWrapper.formatPercentage(p.hacking_chance_mult) + '<br>' +
'Hacking Speed multiplier: ' + numeralWrapper.formatPercentage(p.hacking_speed_mult) + '<br>' +
'Hacking Money multiplier: ' + numeralWrapper.formatPercentage(p.hacking_money_mult) + '<br>' +
'Hacking Growth multiplier: ' + numeralWrapper.formatPercentage(p.hacking_grow_mult) + '<br><br>' +
'Hacking Level multiplier: ' + numeralWrapper.formatPercentage(p.hacking_mult) + '<br>' +
'Hacking Experience multiplier: ' + numeralWrapper.formatPercentage(p.hacking_exp_mult) + '<br><br>' +
'Strength Level multiplier: ' + numeralWrapper.formatPercentage(p.strength_mult) + '<br>' +
'Strength Experience multiplier: ' + numeralWrapper.formatPercentage(p.strength_exp_mult) + '<br><br>' +
'Defense Level multiplier: ' + numeralWrapper.formatPercentage(p.defense_mult) + '<br>' +
'Defense Experience multiplier: ' + numeralWrapper.formatPercentage(p.defense_exp_mult) + '<br><br>' +
'Dexterity Level multiplier: ' + numeralWrapper.formatPercentage(p.dexterity_mult) + '<br>' +
'Dexterity Experience multiplier: ' + numeralWrapper.formatPercentage(p.dexterity_exp_mult) + '<br><br>' +
'Agility Level multiplier: ' + numeralWrapper.formatPercentage(p.agility_mult) + '<br>' +
'Agility Experience multiplier: ' + numeralWrapper.formatPercentage(p.agility_exp_mult) + '<br><br>' +
'Charisma Level multiplier: ' + numeralWrapper.formatPercentage(p.charisma_mult) + '<br>' +
'Charisma Experience multiplier: ' + numeralWrapper.formatPercentage(p.charisma_exp_mult) + '<br><br>' +
'Hacknet Node production multiplier: ' + numeralWrapper.formatPercentage(p.hacknet_node_money_mult) + '<br>' +
'Hacknet Node purchase cost multiplier: ' + numeralWrapper.formatPercentage(p.hacknet_node_purchase_cost_mult) + '<br>' +
'Hacknet Node RAM upgrade cost multiplier: ' + numeralWrapper.formatPercentage(p.hacknet_node_ram_cost_mult) + '<br>' +
'Hacknet Node Core purchase cost multiplier: ' + numeralWrapper.formatPercentage(p.hacknet_node_core_cost_mult) + '<br>' +
'Hacknet Node level upgrade cost multiplier: ' + numeralWrapper.formatPercentage(p.hacknet_node_level_cost_mult) + '<br><br>' +
'Company reputation gain multiplier: ' + numeralWrapper.formatPercentage(p.company_rep_mult) + '<br>' +
'Faction reputation gain multiplier: ' + numeralWrapper.formatPercentage(p.faction_rep_mult) + '<br>' +
'Salary multiplier: ' + numeralWrapper.formatPercentage(p.work_money_mult) + '<br>' +
'Crime success multiplier: ' + numeralWrapper.formatPercentage(p.crime_success_mult) + '<br>' +
'Crime money multiplier: ' + numeralWrapper.formatPercentage(p.crime_money_mult) + '<br><br><br>' +
'<b>Misc</b><br><br>' +
'Servers owned: ' + p.purchasedServers.length + '<br>' +
'Hacknet Nodes owned: ' + p.hacknetNodes.length + '<br>' +
'Augmentations installed: ' + p.augmentations.length + '<br>' +
'Time played since last Augmentation: ' + convertTimeMsToTimeElapsedString(p.playtimeSinceLastAug) + '<br>' +
bitNodeTimeText +
'Time played: ' + convertTimeMsToTimeElapsedString(p.totalPlaytime),
}));
// BitNode information, if player has gotten that far
if (unlockedBitnodes) {
var index = "BitNode" + p.bitNodeN;
elem.appendChild(createElement("p", {
width:"60%",
innerHTML:
"<br>Current BitNode: " + p.bitNodeN + " (" + BitNodes[index].name + ")<br><br>",
}));
elem.appendChild(createElement("p", {
width:"60%", fontSize: "13px", marginLeft:"4%",
innerHTML:BitNodes[index].info,
}))
}
}

@ -0,0 +1,56 @@
/**
* This is an object that is used to keep track of where all of the player's
* money is coming from
*/
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../../utils/JSONReviver";
export class MoneySourceTracker {
// Initiatizes a MoneySourceTracker object from a JSON save state.
static fromJSON(value: any): MoneySourceTracker {
return Generic_fromJSON(MoneySourceTracker, value.data);
}
bladeburner: number = 0;
codingcontract: number = 0;
corporation: number = 0;
crime: number = 0;
gang: number = 0;
hacking: number = 0;
hacknetnode: number = 0;
infiltration: number = 0;
stock: number = 0;
total: number = 0;
work: number = 0;
[key: string]: number | Function;
constructor() {}
// Record money earned
record(amt: number, source: string): void {
const sanitizedSource = source.toLowerCase();
if (typeof this[sanitizedSource] !== "number") {
console.warn(`MoneySourceTracker.record() called with invalid source: ${source}`);
return;
}
(<number> this[sanitizedSource]) += amt;
this.total += amt;
}
// Reset the money tracker by setting all stats to 0
reset(): void {
for (const prop in this) {
if (typeof this[prop] === "number") {
this[prop] = 0;
}
}
}
// Serialize the current object to a JSON save state.
toJSON(): any {
return Generic_toJSON("MoneySourceTracker", this);
}
}
Reviver.constructors.MoneySourceTracker = MoneySourceTracker;

@ -0,0 +1,5 @@
// This is a reference to the native setTimeout() function
// setTimeout() is used in various places around the game's source code.
// This reference is used to make sure that if players alter window.setTimeout()
// through NetscriptJS, then the game will still function properly
export const setTimeoutRef = window.setTimeout.bind(window);

@ -88,6 +88,7 @@ function infiltrationBoxCreate(inst) {
sellButton.addEventListener("click", function(e) { sellButton.addEventListener("click", function(e) {
if (!e.isTrusted) {return false;} if (!e.isTrusted) {return false;}
Player.gainMoney(moneyValue); Player.gainMoney(moneyValue);
Player.recordMoneySource(moneyValue, "infiltration");
dialogBoxCreate("You sold the classified information you stole from " + inst.companyName + dialogBoxCreate("You sold the classified information you stole from " + inst.companyName +
" for <span class='money-gold'>$" + formatNumber(moneyValue, 2) + "</span> on the black market!<br><br>" + " for <span class='money-gold'>$" + formatNumber(moneyValue, 2) + "</span> on the black market!<br><br>" +
expGainText); expGainText);