run auto fix lint

This commit is contained in:
Olivier Gagnon 2021-04-29 23:52:56 -04:00
parent 77cb63e36a
commit 3fad505096
183 changed files with 1547 additions and 1546 deletions

@ -76,7 +76,7 @@ module.exports = {
"imports": "always-multiline", "imports": "always-multiline",
"exports": "always-multiline", "exports": "always-multiline",
"functions": "always-multiline", "functions": "always-multiline",
} },
], ],
"comma-spacing": [ "comma-spacing": [
"off", "off",
@ -102,14 +102,14 @@ module.exports = {
"error", "error",
], ],
"curly": [ "curly": [
"off" "off",
], ],
"default-case": [ "default-case": [
"off" "off",
], ],
"dot-location": [ "dot-location": [
"error", "error",
"property" "property",
], ],
"dot-notation": [ "dot-notation": [
"off", "off",
@ -310,104 +310,104 @@ module.exports = {
"error", "error",
], ],
"no-div-regex": [ "no-div-regex": [
"error" "error",
], ],
"no-dupe-args": [ "no-dupe-args": [
"error" "error",
], ],
"no-dupe-class-members": [ "no-dupe-class-members": [
"error" "error",
], ],
"no-dupe-keys": [ "no-dupe-keys": [
"error" "error",
], ],
"no-duplicate-case": [ "no-duplicate-case": [
"error" "error",
], ],
"no-duplicate-imports": [ "no-duplicate-imports": [
"error", "error",
{ {
"includeExports": true "includeExports": true,
} },
], ],
"no-else-return": [ "no-else-return": [
"off" "off",
], ],
"no-empty": [ "no-empty": [
"off", "off",
{ {
"allowEmptyCatch": false "allowEmptyCatch": false,
} },
], ],
"no-empty-character-class": [ "no-empty-character-class": [
"error" "error",
], ],
"no-empty-function": [ "no-empty-function": [
"off" "off",
], ],
"no-empty-pattern": [ "no-empty-pattern": [
"error" "error",
], ],
"no-eq-null": [ "no-eq-null": [
"off" "off",
], ],
"no-ex-assign": [ "no-ex-assign": [
"off" "off",
], ],
"no-extra-boolean-cast": [ "no-extra-boolean-cast": [
"error" "error",
], ],
"no-extra-parens": [ "no-extra-parens": [
"off" "off",
], ],
"no-extra-semi": [ "no-extra-semi": [
"off" "off",
], ],
"no-eval": [ "no-eval": [
"off" "off",
], ],
"no-extend-native": [ "no-extend-native": [
"off" "off",
], ],
"no-extra-bind": [ "no-extra-bind": [
"error" "error",
], ],
"no-extra-label": [ "no-extra-label": [
"error" "error",
], ],
"no-fallthrough": [ "no-fallthrough": [
"off" "off",
], ],
"no-floating-decimal": [ "no-floating-decimal": [
"off" "off",
], ],
"no-func-assign": [ "no-func-assign": [
"error" "error",
], ],
"no-global-assign": [ "no-global-assign": [
"error" "error",
], ],
"no-implicit-coercion": [ "no-implicit-coercion": [
"off" "off",
], ],
"no-implicit-globals": [ "no-implicit-globals": [
"error" "error",
], ],
"no-implied-eval": [ "no-implied-eval": [
"error" "error",
], ],
"no-inline-comments": [ "no-inline-comments": [
"off" "off",
], ],
"no-inner-declarations": [ "no-inner-declarations": [
"off", "off",
"both" "both",
], ],
"no-invalid-regexp": [ "no-invalid-regexp": [
"error" "error",
], ],
"no-invalid-this": [ "no-invalid-this": [
"off" "off",
], ],
"no-irregular-whitespace": [ "no-irregular-whitespace": [
"error", "error",
@ -415,449 +415,449 @@ module.exports = {
"skipStrings": false, "skipStrings": false,
"skipComments": false, "skipComments": false,
"skipRegExps": false, "skipRegExps": false,
"skipTemplates": false "skipTemplates": false,
} },
], ],
"no-iterator": [ "no-iterator": [
"error" "error",
], ],
"no-label-var": [ "no-label-var": [
"error" "error",
], ],
"no-labels": [ "no-labels": [
"off" "off",
], ],
"no-lone-blocks": [ "no-lone-blocks": [
"error" "error",
], ],
"no-lonely-if": [ "no-lonely-if": [
"off" "off",
], ],
"no-loop-func": [ "no-loop-func": [
"off" "off",
], ],
"no-magic-numbers": [ "no-magic-numbers": [
"off" "off",
], ],
"no-mixed-operators": [ "no-mixed-operators": [
"off" "off",
], ],
"no-mixed-requires": [ "no-mixed-requires": [
"error" "error",
], ],
"no-mixed-spaces-and-tabs": [ "no-mixed-spaces-and-tabs": [
"off" "off",
], ],
"no-multi-assign": [ "no-multi-assign": [
"off" "off",
], ],
"no-multi-spaces": [ "no-multi-spaces": [
"off" "off",
], ],
"no-multi-str": [ "no-multi-str": [
"error" "error",
], ],
"no-multiple-empty-lines": [ "no-multiple-empty-lines": [
"off", "off",
{ {
"max": 1 "max": 1,
} },
], ],
"no-native-reassign": [ "no-native-reassign": [
"error" "error",
], ],
"no-negated-condition": [ "no-negated-condition": [
"off" "off",
], ],
"no-negated-in-lhs": [ "no-negated-in-lhs": [
"error" "error",
], ],
"no-nested-ternary": [ "no-nested-ternary": [
"off" "off",
], ],
"no-new": [ "no-new": [
"error" "error",
], ],
"no-new-func": [ "no-new-func": [
"error" "error",
], ],
"no-new-object": [ "no-new-object": [
"error" "error",
], ],
"no-new-require": [ "no-new-require": [
"error" "error",
], ],
"no-new-symbol": [ "no-new-symbol": [
"error" "error",
], ],
"no-new-wrappers": [ "no-new-wrappers": [
"error" "error",
], ],
"no-octal": [ "no-octal": [
"error" "error",
], ],
"no-octal-escape": [ "no-octal-escape": [
"error" "error",
], ],
"no-obj-calls": [ "no-obj-calls": [
"error" "error",
], ],
"no-param-reassign": [ "no-param-reassign": [
"off" "off",
], ],
"no-path-concat": [ "no-path-concat": [
"error" "error",
], ],
"no-plusplus": [ "no-plusplus": [
"off" "off",
], ],
"no-process-env": [ "no-process-env": [
"off" "off",
], ],
"no-process-exit": [ "no-process-exit": [
"error" "error",
], ],
"no-proto": [ "no-proto": [
"error" "error",
], ],
"no-prototype-builtins": [ "no-prototype-builtins": [
"off" "off",
], ],
"no-redeclare": [ "no-redeclare": [
"off" "off",
], ],
"no-regex-spaces": [ "no-regex-spaces": [
"error" "error",
], ],
"no-restricted-globals": [ "no-restricted-globals": [
"error" "error",
], ],
"no-restricted-imports": [ "no-restricted-imports": [
"error" "error",
], ],
"no-restricted-modules": [ "no-restricted-modules": [
"error" "error",
], ],
"no-restricted-properties": [ "no-restricted-properties": [
"off", "off",
{ {
"object": "console", "object": "console",
"property": "log", "property": "log",
"message": "'log' is too general, use an appropriate level when logging." "message": "'log' is too general, use an appropriate level when logging.",
} },
], ],
"no-restricted-syntax": [ "no-restricted-syntax": [
"error" "error",
], ],
"no-return-assign": [ "no-return-assign": [
"off" "off",
], ],
"no-return-await": [ "no-return-await": [
"error" "error",
], ],
"no-script-url": [ "no-script-url": [
"error" "error",
], ],
"no-self-assign": [ "no-self-assign": [
"error", "error",
{ {
"props": false "props": false,
} },
], ],
"no-self-compare": [ "no-self-compare": [
"error" "error",
], ],
"no-sequences": [ "no-sequences": [
"error" "error",
], ],
"no-shadow": [ "no-shadow": [
"off" "off",
], ],
"no-shadow-restricted-names": [ "no-shadow-restricted-names": [
"error" "error",
], ],
"no-spaced-func": [ "no-spaced-func": [
"off" "off",
], ],
"no-sparse-arrays": [ "no-sparse-arrays": [
"error" "error",
], ],
"no-sync": [ "no-sync": [
"error" "error",
], ],
"no-tabs": [ "no-tabs": [
"off" "off",
], ],
"no-template-curly-in-string": [ "no-template-curly-in-string": [
"error" "error",
], ],
"no-ternary": [ "no-ternary": [
"off" "off",
], ],
"no-this-before-super": [ "no-this-before-super": [
"off" "off",
], ],
"no-throw-literal": [ "no-throw-literal": [
"error" "error",
], ],
"no-trailing-spaces": [ "no-trailing-spaces": [
"off" "off",
], ],
"no-undef": [ "no-undef": [
"off" "off",
], ],
"no-undef-init": [ "no-undef-init": [
"error" "error",
], ],
"no-undefined": [ "no-undefined": [
"off" "off",
], ],
"no-underscore-dangle": [ "no-underscore-dangle": [
"off" "off",
], ],
"no-unexpected-multiline": [ "no-unexpected-multiline": [
"error" "error",
], ],
"no-unmodified-loop-condition": [ "no-unmodified-loop-condition": [
"error" "error",
], ],
"no-unneeded-ternary": [ "no-unneeded-ternary": [
"off" "off",
], ],
"no-unreachable": [ "no-unreachable": [
"off" "off",
], ],
"no-unsafe-finally": [ "no-unsafe-finally": [
"error" "error",
], ],
"no-unsafe-negation": [ "no-unsafe-negation": [
"error" "error",
], ],
"no-unused-expressions": [ "no-unused-expressions": [
"off" "off",
], ],
"no-unused-labels": [ "no-unused-labels": [
"error" "error",
], ],
"no-unused-vars": [ "no-unused-vars": [
"off" "off",
], ],
"no-use-before-define": [ "no-use-before-define": [
"off" "off",
], ],
"no-useless-call": [ "no-useless-call": [
"off" "off",
], ],
"no-useless-computed-key": [ "no-useless-computed-key": [
"error" "error",
], ],
"no-useless-concat": [ "no-useless-concat": [
"off" "off",
], ],
"no-useless-constructor": [ "no-useless-constructor": [
"error" "error",
], ],
"no-useless-escape": [ "no-useless-escape": [
"off" "off",
], ],
"no-useless-rename": [ "no-useless-rename": [
"error", "error",
{ {
"ignoreDestructuring": false, "ignoreDestructuring": false,
"ignoreExport": false, "ignoreExport": false,
"ignoreImport": false "ignoreImport": false,
} },
], ],
"no-useless-return": [ "no-useless-return": [
"off" "off",
], ],
"no-var": [ "no-var": [
"off" "off",
], ],
"no-void": [ "no-void": [
"off" "off",
], ],
"no-warning-comments": [ "no-warning-comments": [
"off" "off",
], ],
"no-whitespace-before-property": [ "no-whitespace-before-property": [
"error" "error",
], ],
"no-with": [ "no-with": [
"error" "error",
], ],
"nonblock-statement-body-position": [ "nonblock-statement-body-position": [
"off", "off",
"below" "below",
], ],
"object-curly-newline": [ "object-curly-newline": [
"off" "off",
], ],
"object-curly-spacing": [ "object-curly-spacing": [
"off" "off",
], ],
"object-property-newline": [ "object-property-newline": [
"off" "off",
], ],
"object-shorthand": [ "object-shorthand": [
"off" "off",
], ],
"one-var": [ "one-var": [
"off" "off",
], ],
"one-var-declaration-per-line": [ "one-var-declaration-per-line": [
"off" "off",
], ],
"operator-assignment": [ "operator-assignment": [
"off" "off",
], ],
"operator-linebreak": [ "operator-linebreak": [
"off", "off",
"none" "none",
], ],
"padded-blocks": [ "padded-blocks": [
"off" "off",
], ],
"padding-line-between-statements": [ "padding-line-between-statements": [
"error" "error",
], ],
"prefer-arrow-callback": [ "prefer-arrow-callback": [
"off" "off",
], ],
"prefer-const": [ "prefer-const": [
"off" "off",
], ],
"prefer-destructuring": [ "prefer-destructuring": [
"off" "off",
], ],
"prefer-numeric-literals": [ "prefer-numeric-literals": [
"error" "error",
], ],
"prefer-promise-reject-errors": [ "prefer-promise-reject-errors": [
"off" "off",
], ],
"prefer-reflect": [ "prefer-reflect": [
"off" "off",
], ],
"prefer-rest-params": [ "prefer-rest-params": [
"off" "off",
], ],
"prefer-spread": [ "prefer-spread": [
"off" "off",
], ],
"prefer-template": [ "prefer-template": [
"off" "off",
], ],
"quote-props": [ "quote-props": [
"off" "off",
], ],
"quotes": [ "quotes": [
"off" "off",
], ],
"radix": [ "radix": [
"off", "off",
"as-needed" "as-needed",
], ],
"require-await": [ "require-await": [
"off" "off",
], ],
"require-jsdoc": [ "require-jsdoc": [
"off" "off",
], ],
"require-yield": [ "require-yield": [
"error" "error",
], ],
"rest-spread-spacing": [ "rest-spread-spacing": [
"error", "error",
"never" "never",
], ],
"semi": [ "semi": [
"off" "off",
], ],
"semi-spacing": [ "semi-spacing": [
"off" "off",
], ],
"semi-style": [ "semi-style": [
"error", "error",
"last" "last",
], ],
"sort-imports": [ "sort-imports": [
"off" "off",
], ],
"sort-keys": [ "sort-keys": [
"off" "off",
], ],
"sort-vars": [ "sort-vars": [
"off" "off",
], ],
"space-before-blocks": [ "space-before-blocks": [
"off" "off",
], ],
"space-before-function-paren": [ "space-before-function-paren": [
"off" "off",
], ],
"space-in-parens": [ "space-in-parens": [
"off" "off",
], ],
"space-infix-ops": [ "space-infix-ops": [
"off" "off",
], ],
"space-unary-ops": [ "space-unary-ops": [
"off" "off",
], ],
"spaced-comment": [ "spaced-comment": [
"off" "off",
], ],
"strict": [ "strict": [
"off" "off",
], ],
"switch-colon-spacing": [ "switch-colon-spacing": [
"error", "error",
{ {
"after": true, "after": true,
"before": false "before": false,
} },
], ],
"symbol-description": [ "symbol-description": [
"error" "error",
], ],
"template-curly-spacing": [ "template-curly-spacing": [
"error" "error",
], ],
"template-tag-spacing": [ "template-tag-spacing": [
"error" "error",
], ],
"unicode-bom": [ "unicode-bom": [
"error", "error",
"never" "never",
], ],
"use-isnan": [ "use-isnan": [
"error" "error",
], ],
"valid-jsdoc": [ "valid-jsdoc": [
"off" "off",
], ],
"valid-typeof": [ "valid-typeof": [
"error" "error",
], ],
"vars-on-top": [ "vars-on-top": [
"off" "off",
], ],
"wrap-iife": [ "wrap-iife": [
"error", "error",
"any" "any",
], ],
"wrap-regex": [ "wrap-regex": [
"off" "off",
], ],
"yield-star-spacing": [ "yield-star-spacing": [
"error", "error",
"before" "before",
], ],
"yoda": [ "yoda": [
"error", "error",
"never" "never",
] ],
}, },
"overrides": [ "overrides": [
{ {
@ -888,7 +888,7 @@ module.exports = {
"singleline": { "singleline": {
"delimiter": "semi", "delimiter": "semi",
"requireLast": false, "requireLast": false,
} },
}], }],
"@typescript-eslint/member-ordering": ["error", { "@typescript-eslint/member-ordering": ["error", {
"default": [ "default": [
@ -900,11 +900,11 @@ module.exports = {
"instance-method", "instance-method",
"abstract-method", "abstract-method",
"static-method", "static-method",
] ],
}], }],
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-use-before-define": "off", "@typescript-eslint/no-use-before-define": "off",
} },
} },
] ],
}; };

@ -1,24 +1,24 @@
.casino-card { .casino-card {
padding: 10px; padding: 10px;
border: solid 1px #808080; border: solid 1px #808080;
background-color: white; background-color: white;
display: inline-block; display: inline-block;
border-radius: 10px; border-radius: 10px;
font-size: 14pt; font-size: 14pt;
text-align: center; text-align: center;
margin: 3px; margin: 3px;
font-weight: bold; font-weight: bold;
} }
.casino-card .value { .casino-card .value {
font-size:15pt; font-size:15pt;
font-family: sans-serif; font-family: sans-serif;
} }
.casino-card.red { .casino-card.red {
color: red; color: red;
} }
.casino-card.black { .casino-card.black {
color: black; color: black;
} }

@ -43,9 +43,9 @@
background-color: #444; background-color: #444;
} }
.character-stat-cell { .character-stat-cell {
text-align: right; text-align: right;
} }
#character-hack-wrapper td, #character-hack-wrapper td,
#character-agi-wrapper td { #character-agi-wrapper td {

@ -117,8 +117,8 @@
"build:dev": "webpack --mode development", "build:dev": "webpack --mode development",
"build:test": "webpack --config webpack.config-test.js", "build:test": "webpack --config webpack.config-test.js",
"lint": "npm run lint:jsts & npm run lint:style", "lint": "npm run lint:jsts & npm run lint:style",
"lint:jsts": "eslint '*.{js,jsx,ts,tsx}' './src/**/*.{js,jsx,ts,tsx}' './test/**/*.{js,jsx,ts,tsx}' './utils/**/*.{js,jsx,ts,tsx}'", "lint:jsts": "eslint --fix '*.{js,jsx,ts,tsx}' './src/**/*.{js,jsx,ts,tsx}' './test/**/*.{js,jsx,ts,tsx}' './utils/**/*.{js,jsx,ts,tsx}'",
"lint:style": "stylelint ./css/*", "lint:style": "stylelint --fix ./css/*",
"preinstall": "node ./scripts/engines-check.js", "preinstall": "node ./scripts/engines-check.js",
"test": "mochapack --webpack-config webpack.config-test.js -r jsdom-global/register ./test/index.js", "test": "mochapack --webpack-config webpack.config-test.js -r jsdom-global/register ./test/index.js",
"watch": "webpack --watch --mode production", "watch": "webpack --watch --mode production",

@ -36,8 +36,8 @@ export function printAliases(): void {
// Returns true if successful, false otherwise // Returns true if successful, false otherwise
export function parseAliasDeclaration(dec: string, global = false): boolean { export function parseAliasDeclaration(dec: string, global = false): boolean {
var re = /^([_|\w|!|%|,|@]+)="(.+)"$/; const re = /^([_|\w|!|%|,|@]+)="(.+)"$/;
var matches = dec.match(re); const matches = dec.match(re);
if (matches == null || matches.length != 3) {return false;} if (matches == null || matches.length != 3) {return false;}
if (global){ if (global){
addGlobalAlias(matches[1],matches[2]); addGlobalAlias(matches[1],matches[2]);
@ -109,7 +109,7 @@ export function substituteAliases(origCommand: string): string {
commandArray[0] = alias; commandArray[0] = alias;
} }
} }
for (var i = 0; i < commandArray.length; ++i) { for (let i = 0; i < commandArray.length; ++i) {
var alias = getGlobalAlias(commandArray[i]); var alias = getGlobalAlias(commandArray[i]);
if (alias != null) { if (alias != null) {
commandArray[i] = alias; commandArray[i] = alias;

@ -55,25 +55,25 @@ export class Augmentation {
} }
// How much money this costs to buy // How much money this costs to buy
baseCost: number = 0; baseCost = 0;
// How much faction reputation is required to unlock this // How much faction reputation is required to unlock this
baseRepRequirement: number = 0; baseRepRequirement = 0;
// Description of what this Aug is and what it does // Description of what this Aug is and what it does
info: string = ""; info = "";
// Any Augmentation not immediately available in BitNode-1 is special (e.g. Bladeburner augs) // Any Augmentation not immediately available in BitNode-1 is special (e.g. Bladeburner augs)
isSpecial: boolean = false; isSpecial = false;
// Augmentation level - for repeatable Augs like NeuroFlux Governor // Augmentation level - for repeatable Augs like NeuroFlux Governor
level: number = 0; level = 0;
// Name of Augmentation // Name of Augmentation
name: string = ""; name = "";
// Whether the player owns this Augmentation // Whether the player owns this Augmentation
owned: boolean = false; owned = false;
// Array of names of all prerequisites // Array of names of all prerequisites
prereqs: string[] = []; prereqs: string[] = [];
@ -83,7 +83,7 @@ export class Augmentation {
mults: IMap<number> = {} mults: IMap<number> = {}
// Initial cost. Doesn't change when you purchase multiple Augmentation // Initial cost. Doesn't change when you purchase multiple Augmentation
startingCost: number = 0; startingCost = 0;
constructor(params: IConstructorParams={ info: "", moneyCost: 0, name: "", repCost: 0 }) { constructor(params: IConstructorParams={ info: "", moneyCost: 0, name: "", repCost: 0 }) {
this.name = params.name; this.name = params.name;

@ -24,7 +24,7 @@ import { createAccordionElement } from "../../utils/uiHelpers/createAccordionEle
import { import {
Reviver, Reviver,
Generic_toJSON, Generic_toJSON,
Generic_fromJSON Generic_fromJSON,
} from "../../utils/JSONReviver"; } from "../../utils/JSONReviver";
import { formatNumber } from "../../utils/StringHelperFunctions"; import { formatNumber } from "../../utils/StringHelperFunctions";
import { clearObject } from "../../utils/helpers/clearObject"; import { clearObject } from "../../utils/helpers/clearObject";
@ -1256,7 +1256,7 @@ function initAugmentations() {
// Daedalus // Daedalus
const RedPill = new Augmentation({ const RedPill = new Augmentation({
name:AugmentationNames.TheRedPill, repCost:1e6, moneyCost:0, name:AugmentationNames.TheRedPill, repCost:1e6, moneyCost:0,
info:"It's time to leave the cave." info:"It's time to leave the cave.",
}); });
RedPill.addToFactions(["Daedalus"]); RedPill.addToFactions(["Daedalus"]);
if (augmentationExists(AugmentationNames.TheRedPill)) { if (augmentationExists(AugmentationNames.TheRedPill)) {
@ -1556,7 +1556,7 @@ function initAugmentations() {
and upload the assets.<br /><br /> and upload the assets.<br /><br />
This augmentation:<br /> This augmentation:<br />
Lets the player start with {Money(1e6)} after a reset.<br /> Lets the player start with {Money(1e6)} after a reset.<br />
Lets the player start with the BruteSSH.exe program after a reset.</> Lets the player start with the BruteSSH.exe program after a reset.</>,
}); });
CashRoot.addToFactions(["Sector-12"]); CashRoot.addToFactions(["Sector-12"]);
if (augmentationExists(AugmentationNames.CashRoot)) { if (augmentationExists(AugmentationNames.CashRoot)) {
@ -2098,7 +2098,7 @@ export function displayAugmentationsContent(contentEl) {
exportGameFn={saveObject.exportGame.bind(saveObject)} exportGameFn={saveObject.exportGame.bind(saveObject)}
installAugmentationsFn={installAugmentations} installAugmentationsFn={installAugmentations}
/>, />,
contentEl contentEl,
); );
} }

@ -1,4 +1,4 @@
import { Augmentation } from "./Augmentation"; import { Augmentation } from "./Augmentation";
import { IMap } from "../types"; import { IMap } from "../types";
export let Augmentations: IMap<Augmentation> = {}; export const Augmentations: IMap<Augmentation> = {};

@ -1,8 +1,8 @@
export class PlayerOwnedAugmentation { export class PlayerOwnedAugmentation {
level: number = 1; level = 1;
name: string = ""; name = "";
constructor(name: string = "") { constructor(name = "") {
this.name = name; this.name = name;
} }
} }

@ -1,6 +1,6 @@
import { IMap } from "../../types"; import { IMap } from "../../types";
export let AugmentationNames: IMap<string> = { export const AugmentationNames: IMap<string> = {
Targeting1: "Augmented Targeting I", Targeting1: "Augmented Targeting I",
Targeting2: "Augmented Targeting II", Targeting2: "Augmented Targeting II",
Targeting3: "Augmented Targeting III", Targeting3: "Augmented Targeting III",

@ -27,7 +27,7 @@ export function PlayerMultipliers(): React.ReactElement {
if(r) { if(r) {
elems = [ elems = [
<td key="2">&nbsp;{"=>"}&nbsp;</td>, <td key="2">&nbsp;{"=>"}&nbsp;</td>,
<td key="3">{numeralWrapper.formatPercentage(r)}</td> <td key="3">{numeralWrapper.formatPercentage(r)}</td>,
]; ];
} }
return elems; return elems;
@ -51,38 +51,38 @@ export function PlayerMultipliers(): React.ReactElement {
['Hacking Chance ', Player.hacking_chance_mult, Player.hacking_chance_mult*mults.hacking_chance_mult], ['Hacking Chance ', Player.hacking_chance_mult, Player.hacking_chance_mult*mults.hacking_chance_mult],
['Hacking Speed ', Player.hacking_speed_mult, Player.hacking_speed_mult*mults.hacking_speed_mult], ['Hacking Speed ', Player.hacking_speed_mult, Player.hacking_speed_mult*mults.hacking_speed_mult],
['Hacking Money ', Player.hacking_money_mult, Player.hacking_money_mult*mults.hacking_money_mult], ['Hacking Money ', Player.hacking_money_mult, Player.hacking_money_mult*mults.hacking_money_mult],
['Hacking Growth ', Player.hacking_grow_mult, Player.hacking_grow_mult*mults.hacking_grow_mult] ['Hacking Growth ', Player.hacking_grow_mult, Player.hacking_grow_mult*mults.hacking_grow_mult],
])}<br /> ])}<br />
{MultiplierTable([ {MultiplierTable([
['Hacking Level ', Player.hacking_mult, Player.hacking_mult*mults.hacking_mult], ['Hacking Level ', Player.hacking_mult, Player.hacking_mult*mults.hacking_mult],
['Hacking Experience ', Player.hacking_exp_mult, Player.hacking_exp_mult*mults.hacking_exp_mult] ['Hacking Experience ', Player.hacking_exp_mult, Player.hacking_exp_mult*mults.hacking_exp_mult],
])}<br /> ])}<br />
{MultiplierTable([ {MultiplierTable([
['Strength Level ', Player.strength_mult, Player.strength_mult*mults.strength_mult], ['Strength Level ', Player.strength_mult, Player.strength_mult*mults.strength_mult],
['Strength Experience ', Player.strength_exp_mult, Player.strength_exp_mult*mults.strength_exp_mult] ['Strength Experience ', Player.strength_exp_mult, Player.strength_exp_mult*mults.strength_exp_mult],
])}<br /> ])}<br />
{MultiplierTable([ {MultiplierTable([
['Defense Level ', Player.defense_mult, Player.defense_mult*mults.defense_mult], ['Defense Level ', Player.defense_mult, Player.defense_mult*mults.defense_mult],
['Defense Experience ', Player.defense_exp_mult, Player.defense_exp_mult*mults.defense_exp_mult] ['Defense Experience ', Player.defense_exp_mult, Player.defense_exp_mult*mults.defense_exp_mult],
])}<br /> ])}<br />
{MultiplierTable([ {MultiplierTable([
['Dexterity Level ', Player.dexterity_mult, Player.dexterity_mult*mults.dexterity_mult], ['Dexterity Level ', Player.dexterity_mult, Player.dexterity_mult*mults.dexterity_mult],
['Dexterity Experience ', Player.dexterity_exp_mult, Player.dexterity_exp_mult*mults.dexterity_exp_mult] ['Dexterity Experience ', Player.dexterity_exp_mult, Player.dexterity_exp_mult*mults.dexterity_exp_mult],
])}<br /> ])}<br />
{MultiplierTable([ {MultiplierTable([
['Agility Level ', Player.agility_mult, Player.agility_mult*mults.agility_mult], ['Agility Level ', Player.agility_mult, Player.agility_mult*mults.agility_mult],
['Agility Experience ', Player.agility_exp_mult, Player.agility_exp_mult*mults.agility_exp_mult] ['Agility Experience ', Player.agility_exp_mult, Player.agility_exp_mult*mults.agility_exp_mult],
])}<br /> ])}<br />
{MultiplierTable([ {MultiplierTable([
['Charisma Level ', Player.charisma_mult, Player.charisma_mult*mults.charisma_mult], ['Charisma Level ', Player.charisma_mult, Player.charisma_mult*mults.charisma_mult],
['Charisma Experience ', Player.charisma_exp_mult, Player.charisma_exp_mult*mults.charisma_exp_mult] ['Charisma Experience ', Player.charisma_exp_mult, Player.charisma_exp_mult*mults.charisma_exp_mult],
])}<br /> ])}<br />
{MultiplierTable([ {MultiplierTable([
@ -90,13 +90,13 @@ export function PlayerMultipliers(): React.ReactElement {
['Hacknet Node purchase cost ', Player.hacknet_node_purchase_cost_mult, Player.hacknet_node_purchase_cost_mult*mults.hacknet_node_purchase_cost_mult], ['Hacknet Node purchase cost ', Player.hacknet_node_purchase_cost_mult, Player.hacknet_node_purchase_cost_mult*mults.hacknet_node_purchase_cost_mult],
['Hacknet Node RAM upgrade cost ', Player.hacknet_node_ram_cost_mult, Player.hacknet_node_ram_cost_mult*mults.hacknet_node_ram_cost_mult], ['Hacknet Node RAM upgrade cost ', Player.hacknet_node_ram_cost_mult, Player.hacknet_node_ram_cost_mult*mults.hacknet_node_ram_cost_mult],
['Hacknet Node Core purchase cost ', Player.hacknet_node_core_cost_mult, Player.hacknet_node_core_cost_mult*mults.hacknet_node_core_cost_mult], ['Hacknet Node Core purchase cost ', Player.hacknet_node_core_cost_mult, Player.hacknet_node_core_cost_mult*mults.hacknet_node_core_cost_mult],
['Hacknet Node level upgrade cost ', Player.hacknet_node_level_cost_mult, Player.hacknet_node_level_cost_mult*mults.hacknet_node_level_cost_mult] ['Hacknet Node level upgrade cost ', Player.hacknet_node_level_cost_mult, Player.hacknet_node_level_cost_mult*mults.hacknet_node_level_cost_mult],
])}<br /> ])}<br />
{MultiplierTable([ {MultiplierTable([
['Company reputation gain ', Player.company_rep_mult, Player.company_rep_mult*mults.company_rep_mult], ['Company reputation gain ', Player.company_rep_mult, Player.company_rep_mult*mults.company_rep_mult],
['Faction reputation gain ', Player.faction_rep_mult, Player.faction_rep_mult*mults.faction_rep_mult], ['Faction reputation gain ', Player.faction_rep_mult, Player.faction_rep_mult*mults.faction_rep_mult],
['Salary ', Player.work_money_mult, Player.work_money_mult*mults.work_money_mult] ['Salary ', Player.work_money_mult, Player.work_money_mult*mults.work_money_mult],
])}<br /> ])}<br />
{MultiplierTable([ {MultiplierTable([

@ -22,7 +22,7 @@ export function PurchasedAugmentations(): React.ReactElement {
augs.push( augs.push(
<li key={`${ownedAug.name}${ownedAug.level}`}> <li key={`${ownedAug.name}${ownedAug.level}`}>
<AugmentationAccordion aug={aug} level={level} /> <AugmentationAccordion aug={aug} level={level} />
</li> </li>,
) )
} }

@ -13,7 +13,7 @@ import { Exploit, ExploitName } from "../../Exploits/Exploit";
import { Accordion } from "../../ui/React/Accordion"; import { Accordion } from "../../ui/React/Accordion";
export function SourceFileMinus1(): React.ReactElement { export function SourceFileMinus1(): React.ReactElement {
let exploits = Player.exploits; const exploits = Player.exploits;
if(exploits.length === 0) { if(exploits.length === 0) {
return <></> return <></>

@ -16,7 +16,7 @@ class BitNode {
number: number; number: number;
constructor(n: number, name: string, desc: string="", info: string="") { constructor(n: number, name: string, desc="", info="") {
this.number = n; this.number = n;
this.name = name; this.name = name;
this.desc = desc; this.desc = desc;
@ -256,7 +256,7 @@ export function initBitNodeMultipliers(p: IPlayer) {
if (p.bitNodeN == null) { if (p.bitNodeN == null) {
p.bitNodeN = 1; p.bitNodeN = 1;
} }
for (var mult in BitNodeMultipliers) { for (const mult in BitNodeMultipliers) {
if (BitNodeMultipliers.hasOwnProperty(mult)) { if (BitNodeMultipliers.hasOwnProperty(mult)) {
BitNodeMultipliers[mult] = 1; BitNodeMultipliers[mult] = 1;
} }
@ -435,7 +435,7 @@ export function initBitNodeMultipliers(p: IPlayer) {
break; break;
case 12: //The Recursion case 12: //The Recursion
var sf12Lvl = 0; var sf12Lvl = 0;
for (var i = 0; i < p.sourceFiles.length; i++) { for (let i = 0; i < p.sourceFiles.length; i++) {
if (p.sourceFiles[i].n === 12) { if (p.sourceFiles[i].n === 12) {
sf12Lvl = p.sourceFiles[i].lvl; sf12Lvl = p.sourceFiles[i].lvl;
} }

@ -17,7 +17,7 @@ import { dialogBoxCreate } from "../utils/DialogBox";
import { import {
Reviver, Reviver,
Generic_toJSON, Generic_toJSON,
Generic_fromJSON Generic_fromJSON,
} from "../utils/JSONReviver"; } from "../utils/JSONReviver";
import { setTimeoutRef } from "./utils/SetTimeoutRef"; import { setTimeoutRef } from "./utils/SetTimeoutRef";
import { formatNumber } from "../utils/StringHelperFunctions"; import { formatNumber } from "../utils/StringHelperFunctions";
@ -236,7 +236,7 @@ Bladeburner.prototype.create = function() {
count:getRandomInt(25, 150), 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,
}); });
this.contracts["Bounty Hunter"] = new Contract({ this.contracts["Bounty Hunter"] = new Contract({
name:"Bounty Hunter", name:"Bounty Hunter",
@ -248,7 +248,7 @@ Bladeburner.prototype.create = function() {
count:getRandomInt(5, 150), 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,
}); });
this.contracts["Retirement"] = new Contract({ this.contracts["Retirement"] = new Contract({
name:"Retirement", name:"Retirement",
@ -260,7 +260,7 @@ Bladeburner.prototype.create = function() {
count:getRandomInt(5, 150), 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,
}); });
this.operations["Investigation"] = new Operation({ this.operations["Investigation"] = new Operation({
@ -275,7 +275,7 @@ Bladeburner.prototype.create = function() {
count:getRandomInt(1, 100), 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,
}); });
this.operations["Undercover Operation"] = new Operation({ this.operations["Undercover Operation"] = new Operation({
name:"Undercover Operation", name:"Undercover Operation",
@ -288,7 +288,7 @@ Bladeburner.prototype.create = function() {
count:getRandomInt(1, 100), 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,
}); });
this.operations["Sting Operation"] = new Operation({ this.operations["Sting Operation"] = new Operation({
name:"Sting Operation", name:"Sting Operation",
@ -299,7 +299,7 @@ Bladeburner.prototype.create = function() {
count:getRandomInt(1, 150), 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,
}); });
this.operations["Raid"] = new Operation({ this.operations["Raid"] = new Operation({
name:"Raid", name:"Raid",
@ -311,7 +311,7 @@ Bladeburner.prototype.create = function() {
count:getRandomInt(1, 150), 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,
}); });
this.operations["Stealth Retirement Operation"] = new Operation({ this.operations["Stealth Retirement Operation"] = new Operation({
name:"Stealth Retirement Operation", name:"Stealth Retirement Operation",
@ -323,7 +323,7 @@ Bladeburner.prototype.create = function() {
count:getRandomInt(1, 150), 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,
}); });
this.operations["Assassination"] = new Operation({ this.operations["Assassination"] = new Operation({
name:"Assassination", name:"Assassination",
@ -335,7 +335,7 @@ Bladeburner.prototype.create = function() {
count:getRandomInt(1, 150), 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,
}); });
} }
@ -1271,7 +1271,7 @@ Bladeburner.prototype.createContent = function() {
DomElems.consoleInput.focus(); DomElems.consoleInput.focus();
} }
return false; return false;
} },
}); });
DomElems.consoleTable = createElement("table", {class:"bladeburner-console-table"}); DomElems.consoleTable = createElement("table", {class:"bladeburner-console-table"});
DomElems.consoleInputRow = createElement("tr", {class:"bladeburner-console-input-row", id:"bladeburner-console-input-row"}); DomElems.consoleInputRow = createElement("tr", {class:"bladeburner-console-input-row", id:"bladeburner-console-input-row"});
@ -1279,7 +1279,7 @@ Bladeburner.prototype.createContent = function() {
DomElems.consoleInputHeader = createElement("pre", {innerText:"> "}); DomElems.consoleInputHeader = createElement("pre", {innerText:"> "});
DomElems.consoleInput = createElement("input", { DomElems.consoleInput = createElement("input", {
type:"text", class:"bladeburner-console-input", tabIndex:1, type:"text", class:"bladeburner-console-input", tabIndex:1,
onfocus:() => {DomElems.consoleInput.value = DomElems.consoleInput.value} onfocus:() => {DomElems.consoleInput.value = DomElems.consoleInput.value},
}); });
DomElems.consoleInputCell.appendChild(DomElems.consoleInputHeader); DomElems.consoleInputCell.appendChild(DomElems.consoleInputHeader);
@ -1363,7 +1363,7 @@ Bladeburner.prototype.createOverviewContent = function() {
innerText:"Est. Synthoid Population: ", innerText:"Est. Synthoid Population: ",
display:"inline-block", display:"inline-block",
tooltip:"This is your Bladeburner division's estimate of how many Synthoids exist " + tooltip:"This is your Bladeburner division's estimate of how many Synthoids exist " +
"in your current city." "in your current city.",
}); });
DomElems.overviewEstPopHelpTip = createElement("div", { DomElems.overviewEstPopHelpTip = createElement("div", {
@ -1381,7 +1381,7 @@ Bladeburner.prototype.createOverviewContent = function() {
"The Synthoid populations of cities can change due to your " + "The Synthoid populations of cities can change due to your " +
"actions or random events. If random events occur, they will " + "actions or random events. If random events occur, they will " +
"be logged in the Bladeburner Console."); "be logged in the Bladeburner Console.");
} },
}); });
DomElems.overviewEstComms = createElement("p", { DomElems.overviewEstComms = createElement("p", {
@ -1395,14 +1395,14 @@ Bladeburner.prototype.createOverviewContent = function() {
innerText:"City Chaos: ", innerText:"City Chaos: ",
display:"inline-block", display:"inline-block",
tooltip:"The city's chaos level due to tensions and conflicts between humans and Synthoids. " + tooltip:"The city's chaos level due to tensions and conflicts between humans and Synthoids. " +
"Having too high of a chaos level can make contracts and operations harder." "Having too high of a chaos level can make contracts and operations harder.",
}); });
DomElems.overviewBonusTime = createElement("p", { DomElems.overviewBonusTime = createElement("p", {
innerText: "Bonus time: ", innerText: "Bonus time: ",
display: "inline-block", display: "inline-block",
tooltip: "You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by browser). " + tooltip: "You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by browser). " +
"Bonus time makes the Bladeburner mechanic progress faster, up to 5x the normal speed." "Bonus time makes the Bladeburner mechanic progress faster, up to 5x the normal speed.",
}); });
DomElems.overviewSkillPoints = createElement("p", {display:"block"}); DomElems.overviewSkillPoints = createElement("p", {display:"block"});
@ -1438,7 +1438,7 @@ Bladeburner.prototype.createOverviewContent = function() {
innerText:"Cancel", class:"a-link-button", innerText:"Cancel", class:"a-link-button",
clickListener:() => { clickListener:() => {
removeElementById(popupId); return false; removeElementById(popupId); return false;
} },
})) }))
popupArguments.push(createElement("p", { // Info Text popupArguments.push(createElement("p", { // Info Text
innerText:"Travel to a different city for your Bladeburner " + innerText:"Travel to a different city for your Bladeburner " +
@ -1460,12 +1460,12 @@ Bladeburner.prototype.createOverviewContent = function() {
removeElementById(popupId); removeElementById(popupId);
inst.updateOverviewContent(); inst.updateOverviewContent();
return false; return false;
} },
})); }));
})(this, i); })(this, i);
} }
createPopup(popupId, popupArguments); createPopup(popupId, popupArguments);
} },
})); }));
// Faction button // Faction button
@ -1493,7 +1493,7 @@ Bladeburner.prototype.createOverviewContent = function() {
} }
} }
return false; return false;
} },
})); }));
} }
@ -1526,14 +1526,14 @@ Bladeburner.prototype.createActionAndSkillsContent = function() {
DomElems.currentTab = buttons[i].toLowerCase(); DomElems.currentTab = buttons[i].toLowerCase();
inst.createActionAndSkillsContent(); inst.createActionAndSkillsContent();
return false; return false;
} },
})); }));
}) (buttons, i, this, currTab); }) (buttons, i, this, currTab);
} }
// General info/description for each action // General info/description for each action
DomElems.actionsAndSkillsDesc = createElement("p", { DomElems.actionsAndSkillsDesc = createElement("p", {
display:"block", margin:"4px", padding:"4px" display:"block", margin:"4px", padding:"4px",
}); });
// List for actions/skills // List for actions/skills
@ -1578,7 +1578,7 @@ Bladeburner.prototype.createGeneralActionsContent = function() {
for (var actionName in GeneralActions) { for (var actionName in GeneralActions) {
if (GeneralActions.hasOwnProperty(actionName)) { if (GeneralActions.hasOwnProperty(actionName)) {
DomElems.generalActions[actionName] = createElement("div", { DomElems.generalActions[actionName] = createElement("div", {
class:"bladeburner-action", name:actionName class:"bladeburner-action", name:actionName,
}); });
DomElems.actionsAndSkillsList.appendChild(DomElems.generalActions[actionName]); DomElems.actionsAndSkillsList.appendChild(DomElems.generalActions[actionName]);
} }
@ -1600,7 +1600,7 @@ Bladeburner.prototype.createContractsContent = function() {
for (var contractName in this.contracts) { for (var contractName in this.contracts) {
if (this.contracts.hasOwnProperty(contractName)) { if (this.contracts.hasOwnProperty(contractName)) {
DomElems.contracts[contractName] = createElement("div", { DomElems.contracts[contractName] = createElement("div", {
class:"bladeburner-action", name:contractName class:"bladeburner-action", name:contractName,
}); });
DomElems.actionsAndSkillsList.appendChild(DomElems.contracts[contractName]); DomElems.actionsAndSkillsList.appendChild(DomElems.contracts[contractName]);
} }
@ -1629,7 +1629,7 @@ Bladeburner.prototype.createOperationsContent = function() {
for (var operationName in this.operations) { for (var operationName in this.operations) {
if (this.operations.hasOwnProperty(operationName)) { if (this.operations.hasOwnProperty(operationName)) {
DomElems.operations[operationName] = createElement("div", { DomElems.operations[operationName] = createElement("div", {
class:"bladeburner-action", name:operationName class:"bladeburner-action", name:operationName,
}); });
DomElems.actionsAndSkillsList.appendChild(DomElems.operations[operationName]); DomElems.actionsAndSkillsList.appendChild(DomElems.operations[operationName]);
} }
@ -1667,7 +1667,7 @@ Bladeburner.prototype.createBlackOpsContent = function() {
for (var i = blackops.length-1; i >= 0 ; --i) { for (var i = blackops.length-1; i >= 0 ; --i) {
if (this.blackops[[blackops[i].name]] == null && i !== 0 && this.blackops[[blackops[i-1].name]] == null) {continue;} // If this one nor the next are completed then this isn't unlocked yet. if (this.blackops[[blackops[i].name]] == null && i !== 0 && this.blackops[[blackops[i-1].name]] == null) {continue;} // If this one nor the next are completed then this isn't unlocked yet.
DomElems.blackops[blackops[i].name] = createElement("div", { DomElems.blackops[blackops[i].name] = createElement("div", {
class:"bladeburner-action", name:blackops[i].name class:"bladeburner-action", name:blackops[i].name,
}); });
DomElems.actionsAndSkillsList.appendChild(DomElems.blackops[blackops[i].name]); DomElems.actionsAndSkillsList.appendChild(DomElems.blackops[blackops[i].name]);
} }
@ -1750,7 +1750,7 @@ Bladeburner.prototype.createSkillsContent = function() {
// Skill Points // Skill Points
DomElems.skillPointsDisplay = createElement("p", { DomElems.skillPointsDisplay = createElement("p", {
innerHTML:"<br><strong>Skill Points: " + formatNumber(this.skillPoints, 0) + "</strong>" innerHTML:"<br><strong>Skill Points: " + formatNumber(this.skillPoints, 0) + "</strong>",
}); });
DomElems.actionAndSkillsDiv.appendChild(DomElems.skillPointsDisplay); DomElems.actionAndSkillsDiv.appendChild(DomElems.skillPointsDisplay);
@ -1758,7 +1758,7 @@ Bladeburner.prototype.createSkillsContent = function() {
for (var skillName in Skills) { for (var skillName in Skills) {
if (Skills.hasOwnProperty(skillName)) { if (Skills.hasOwnProperty(skillName)) {
DomElems.skills[skillName] = createElement("div", { DomElems.skills[skillName] = createElement("div", {
class:"bladeburner-action", name:skillName class:"bladeburner-action", name:skillName,
}); });
DomElems.actionsAndSkillsList.appendChild(DomElems.skills[skillName]); DomElems.actionsAndSkillsList.appendChild(DomElems.skills[skillName]);
} }
@ -1902,7 +1902,7 @@ Bladeburner.prototype.updateGeneralActionsUIElement = function(el, action) {
var progress = this.actionTimeCurrent / this.actionTimeToComplete; var progress = this.actionTimeCurrent / this.actionTimeToComplete;
el.appendChild(createElement("p", { el.appendChild(createElement("p", {
display:"block", display:"block",
innerText:createProgressBarText({progress:progress}) innerText:createProgressBarText({progress:progress}),
})); }));
} else { } else {
// Start button // Start button
@ -1915,13 +1915,13 @@ Bladeburner.prototype.updateGeneralActionsUIElement = function(el, action) {
this.startAction(this.action); this.startAction(this.action);
this.updateActionAndSkillsContent(); this.updateActionAndSkillsContent();
return false; return false;
} },
})); }));
} }
appendLineBreaks(el, 2); appendLineBreaks(el, 2);
el.appendChild(createElement("pre", { // Info el.appendChild(createElement("pre", { // Info
innerHTML:action.desc, display:"inline-block" innerHTML:action.desc, display:"inline-block",
})); }));
@ -1937,14 +1937,14 @@ Bladeburner.prototype.updateContractsUIElement = function(el, action) {
formatNumber(this.actionTimeCurrent, 0) + " / " + formatNumber(this.actionTimeCurrent, 0) + " / " +
formatNumber(this.actionTimeToComplete, 0) + ")" formatNumber(this.actionTimeToComplete, 0) + ")"
: action.name, : action.name,
display:"inline-block" display:"inline-block",
})); }));
if (isActive) { // Progress bar if its active if (isActive) { // Progress bar if its active
var progress = this.actionTimeCurrent / this.actionTimeToComplete; var progress = this.actionTimeCurrent / this.actionTimeToComplete;
el.appendChild(createElement("p", { el.appendChild(createElement("p", {
display:"block", display:"block",
innerText:createProgressBarText({progress:progress}) innerText:createProgressBarText({progress:progress}),
})); }));
} else { // Start button } else { // Start button
el.appendChild(createElement("a", { el.appendChild(createElement("a", {
@ -1956,7 +1956,7 @@ Bladeburner.prototype.updateContractsUIElement = function(el, action) {
this.startAction(this.action); this.startAction(this.action);
this.updateActionAndSkillsContent(); this.updateActionAndSkillsContent();
return false; return false;
} },
})); }));
} }
@ -1967,7 +1967,7 @@ Bladeburner.prototype.updateContractsUIElement = function(el, action) {
display:"inline-block", display:"inline-block",
innerText:"Level: " + action.level + " / " + action.maxLevel, innerText:"Level: " + action.level + " / " + action.maxLevel,
tooltip:action.getSuccessesNeededForNextLevel(BladeburnerConstants.ContractSuccessesPerLevel) + " successes " + tooltip:action.getSuccessesNeededForNextLevel(BladeburnerConstants.ContractSuccessesPerLevel) + " successes " +
"needed for next level" "needed for next level",
})); }));
el.appendChild(createElement("a", { el.appendChild(createElement("a", {
class: maxLevel ? "a-link-button-inactive" : "a-link-button", innerHTML:"&uarr;", class: maxLevel ? "a-link-button-inactive" : "a-link-button", innerHTML:"&uarr;",
@ -1979,7 +1979,7 @@ Bladeburner.prototype.updateContractsUIElement = function(el, action) {
if (isActive) {this.startAction(this.action);} // Restart Action if (isActive) {this.startAction(this.action);} // Restart Action
this.updateContractsUIElement(el, action); this.updateContractsUIElement(el, action);
return false; return false;
} },
})); }));
el.appendChild(createElement("a", { el.appendChild(createElement("a", {
class: (action.level <= 1) ? "a-link-button-inactive" : "a-link-button", innerHTML:"&darr;", class: (action.level <= 1) ? "a-link-button-inactive" : "a-link-button", innerHTML:"&darr;",
@ -1991,7 +1991,7 @@ Bladeburner.prototype.updateContractsUIElement = function(el, action) {
if (isActive) {this.startAction(this.action);} // Restart Action if (isActive) {this.startAction(this.action);} // Restart Action
this.updateContractsUIElement(el, action); this.updateContractsUIElement(el, action);
return false; return false;
} },
})); }));
var actionTime = action.getActionTime(this); var actionTime = action.getActionTime(this);
@ -2011,7 +2011,7 @@ Bladeburner.prototype.updateContractsUIElement = function(el, action) {
var autolevelCheckboxId = "bladeburner-" + action.name + "-autolevel-checkbox"; var autolevelCheckboxId = "bladeburner-" + action.name + "-autolevel-checkbox";
el.appendChild(createElement("label", { el.appendChild(createElement("label", {
for:autolevelCheckboxId, innerText:"Autolevel: ",color:"white", for:autolevelCheckboxId, innerText:"Autolevel: ",color:"white",
tooltip:"Automatically increase contract level when possible" tooltip:"Automatically increase contract level when possible",
})); }));
const checkboxInput = createElement("input", { const checkboxInput = createElement("input", {
@ -2035,14 +2035,14 @@ Bladeburner.prototype.updateOperationsUIElement = function(el, action) {
formatNumber(this.actionTimeCurrent, 0) + " / " + formatNumber(this.actionTimeCurrent, 0) + " / " +
formatNumber(this.actionTimeToComplete, 0) + ")" formatNumber(this.actionTimeToComplete, 0) + ")"
: action.name, : action.name,
display:"inline-block" display:"inline-block",
})); }));
if (isActive) { // Progress bar if its active if (isActive) { // Progress bar if its active
var progress = this.actionTimeCurrent / this.actionTimeToComplete; var progress = this.actionTimeCurrent / this.actionTimeToComplete;
el.appendChild(createElement("p", { el.appendChild(createElement("p", {
display:"block", display:"block",
innerText:createProgressBarText({progress:progress}) innerText:createProgressBarText({progress:progress}),
})); }));
} else { // Start button and set Team Size button } else { // Start button and set Team Size button
el.appendChild(createElement("a", { el.appendChild(createElement("a", {
@ -2054,7 +2054,7 @@ Bladeburner.prototype.updateOperationsUIElement = function(el, action) {
this.startAction(this.action); this.startAction(this.action);
this.updateActionAndSkillsContent(); this.updateActionAndSkillsContent();
return false; return false;
} },
})); }));
el.appendChild(createElement("a", { el.appendChild(createElement("a", {
innerText:"Set Team Size (Curr Size: " + formatNumber(action.teamCount, 0) + ")", class:"a-link-button", innerText:"Set Team Size (Curr Size: " + formatNumber(action.teamCount, 0) + ")", class:"a-link-button",
@ -2065,7 +2065,7 @@ Bladeburner.prototype.updateOperationsUIElement = function(el, action) {
innerText:"Enter the amount of team members you would like to take on these " + innerText:"Enter the amount of team members you would like to take on these " +
"operations. If you do not have the specified number of team members, " + "operations. If you do not have the specified number of team members, " +
"then as many as possible will be used. Note that team members may " + "then as many as possible will be used. Note that team members may " +
"be lost during operations." "be lost during operations.",
}); });
var input = createElement("input", { var input = createElement("input", {
@ -2083,17 +2083,17 @@ Bladeburner.prototype.updateOperationsUIElement = function(el, action) {
} }
removeElementById(popupId); removeElementById(popupId);
return false; return false;
} },
}); });
var cancelBtn = createElement("a", { var cancelBtn = createElement("a", {
innerText:"Cancel", class:"a-link-button", innerText:"Cancel", class:"a-link-button",
clickListener:() => { clickListener:() => {
removeElementById(popupId); removeElementById(popupId);
return false; return false;
} },
}); });
createPopup(popupId, [txt, input, setBtn, cancelBtn]); createPopup(popupId, [txt, input, setBtn, cancelBtn]);
} },
})); }));
} }
@ -2104,7 +2104,7 @@ Bladeburner.prototype.updateOperationsUIElement = function(el, action) {
display:"inline-block", display:"inline-block",
innerText:"Level: " + action.level + " / " + action.maxLevel, innerText:"Level: " + action.level + " / " + action.maxLevel,
tooltip:action.getSuccessesNeededForNextLevel(BladeburnerConstants.OperationSuccessesPerLevel) + " successes " + tooltip:action.getSuccessesNeededForNextLevel(BladeburnerConstants.OperationSuccessesPerLevel) + " successes " +
"needed for next level" "needed for next level",
})); }));
el.appendChild(createElement("a", { el.appendChild(createElement("a", {
class: maxLevel ? "a-link-button-inactive" : "a-link-button", innerHTML:"&uarr;", class: maxLevel ? "a-link-button-inactive" : "a-link-button", innerHTML:"&uarr;",
@ -2116,7 +2116,7 @@ Bladeburner.prototype.updateOperationsUIElement = function(el, action) {
if (isActive) {this.startAction(this.action);} // Restart Action if (isActive) {this.startAction(this.action);} // Restart Action
this.updateOperationsUIElement(el, action); this.updateOperationsUIElement(el, action);
return false; return false;
} },
})); }));
el.appendChild(createElement("a", { el.appendChild(createElement("a", {
class: (action.level <= 1) ? "a-link-button-inactive" : "a-link-button", innerHTML:"&darr;", class: (action.level <= 1) ? "a-link-button-inactive" : "a-link-button", innerHTML:"&darr;",
@ -2128,7 +2128,7 @@ Bladeburner.prototype.updateOperationsUIElement = function(el, action) {
if (isActive) {this.startAction(this.action);} // Restart Action if (isActive) {this.startAction(this.action);} // Restart Action
this.updateOperationsUIElement(el, action); this.updateOperationsUIElement(el, action);
return false; return false;
} },
})); }));
// General Info // General Info
@ -2150,7 +2150,7 @@ Bladeburner.prototype.updateOperationsUIElement = function(el, action) {
var autolevelCheckboxId = "bladeburner-" + action.name + "-autolevel-checkbox"; var autolevelCheckboxId = "bladeburner-" + action.name + "-autolevel-checkbox";
el.appendChild(createElement("label", { el.appendChild(createElement("label", {
for:autolevelCheckboxId, innerText:"Autolevel: ",color:"white", for:autolevelCheckboxId, innerText:"Autolevel: ",color:"white",
tooltip:"Automatically increase operation level when possible" tooltip:"Automatically increase operation level when possible",
})); }));
const checkboxInput = createElement("input", { const checkboxInput = createElement("input", {
@ -2194,7 +2194,7 @@ Bladeburner.prototype.updateBlackOpsUIElement = function(el, action) {
var progress = this.actionTimeCurrent / this.actionTimeToComplete; var progress = this.actionTimeCurrent / this.actionTimeToComplete;
el.appendChild(createElement("p", { el.appendChild(createElement("p", {
display:"block", display:"block",
innerText:createProgressBarText({progress:progress}) innerText:createProgressBarText({progress:progress}),
})); }));
} else { } else {
el.appendChild(createElement("a", { // Start button el.appendChild(createElement("a", { // Start button
@ -2206,7 +2206,7 @@ Bladeburner.prototype.updateBlackOpsUIElement = function(el, action) {
this.startAction(this.action); this.startAction(this.action);
this.updateActionAndSkillsContent(); this.updateActionAndSkillsContent();
return false; return false;
} },
})); }));
el.appendChild(createElement("a", { // Set Team Size Button el.appendChild(createElement("a", { // Set Team Size Button
innerText:"Set Team Size (Curr Size: " + formatNumber(action.teamCount, 0) + ")", class:"a-link-button", innerText:"Set Team Size (Curr Size: " + formatNumber(action.teamCount, 0) + ")", class:"a-link-button",
@ -2217,7 +2217,7 @@ Bladeburner.prototype.updateBlackOpsUIElement = function(el, action) {
innerText:"Enter the amount of team members you would like to take on this " + innerText:"Enter the amount of team members you would like to take on this " +
"BlackOp. If you do not have the specified number of team members, " + "BlackOp. If you do not have the specified number of team members, " +
"then as many as possible will be used. Note that team members may " + "then as many as possible will be used. Note that team members may " +
"be lost during operations." "be lost during operations.",
}); });
var input = createElement("input", { var input = createElement("input", {
@ -2235,17 +2235,17 @@ Bladeburner.prototype.updateBlackOpsUIElement = function(el, action) {
} }
removeElementById(popupId); removeElementById(popupId);
return false; return false;
} },
}); });
var cancelBtn = createElement("a", { var cancelBtn = createElement("a", {
innerText:"Cancel", class:"a-link-button", innerText:"Cancel", class:"a-link-button",
clickListener:() => { clickListener:() => {
removeElementById(popupId); removeElementById(popupId);
return false; return false;
} },
}); });
createPopup(popupId, [txt, input, setBtn, cancelBtn]); createPopup(popupId, [txt, input, setBtn, cancelBtn]);
} },
})); }));
} }
@ -2257,7 +2257,7 @@ Bladeburner.prototype.updateBlackOpsUIElement = function(el, action) {
})); }));
el.appendChild(createElement("p", { el.appendChild(createElement("p", {
display:"block", color:hasReqdRank ? "white" : "red", display:"block", color:hasReqdRank ? "white" : "red",
innerHTML:"Required Rank: " + formatNumber(action.reqdRank, 0) + "<br>" innerHTML:"Required Rank: " + formatNumber(action.reqdRank, 0) + "<br>",
})); }));
el.appendChild(createElement("p", { el.appendChild(createElement("p", {
display:"inline-block", display:"inline-block",
@ -2297,7 +2297,7 @@ Bladeburner.prototype.updateSkillsUIElement = function(el, skill) {
this.upgradeSkill(skill); this.upgradeSkill(skill);
this.createActionAndSkillsContent(); this.createActionAndSkillsContent();
return false; return false;
} },
})); }));
appendLineBreaks(el, 2); appendLineBreaks(el, 2);
el.appendChild(createElement("p", { el.appendChild(createElement("p", {
@ -2307,7 +2307,7 @@ Bladeburner.prototype.updateSkillsUIElement = function(el, skill) {
if (maxLvl) { if (maxLvl) {
el.appendChild(createElement("p", { el.appendChild(createElement("p", {
color:"red", display:"block", color:"red", display:"block",
innerText:"MAX LEVEL" innerText:"MAX LEVEL",
})); }));
} else { } else {
el.appendChild(createElement("p", { el.appendChild(createElement("p", {
@ -2508,7 +2508,7 @@ Bladeburner.prototype.executeAutomateConsoleCommand = function(args) {
case "gen": case "gen":
if (GeneralActions[val] != null) { if (GeneralActions[val] != null) {
var action = new ActionIdentifier({ var action = new ActionIdentifier({
type:ActionTypes[val], name:val type:ActionTypes[val], name:val,
}); });
if (highLow) { if (highLow) {
this.automateActionHigh = action; this.automateActionHigh = action;
@ -2524,7 +2524,7 @@ Bladeburner.prototype.executeAutomateConsoleCommand = function(args) {
case "contracts": case "contracts":
if (this.contracts[val] != null) { if (this.contracts[val] != null) {
var action = new ActionIdentifier({ var action = new ActionIdentifier({
type:ActionTypes.Contract, name:val type:ActionTypes.Contract, name:val,
}); });
if (highLow) { if (highLow) {
this.automateActionHigh = action; this.automateActionHigh = action;
@ -2542,7 +2542,7 @@ Bladeburner.prototype.executeAutomateConsoleCommand = function(args) {
case "operation": case "operation":
if (this.operations[val] != null) { if (this.operations[val] != null) {
var action = new ActionIdentifier({ var action = new ActionIdentifier({
type:ActionTypes.Operation, name:val type:ActionTypes.Operation, name:val,
}); });
if (highLow) { if (highLow) {
this.automateActionHigh = action; this.automateActionHigh = action;

@ -8,16 +8,16 @@ import { BladeburnerConstants } from "./data/Constants";
// import { BlackOperation } from "./BlackOperation"; // import { BlackOperation } from "./BlackOperation";
class StatsMultiplier { class StatsMultiplier {
hack: number = 0; hack = 0;
str: number = 0; str = 0;
def: number = 0; def = 0;
dex: number = 0; dex = 0;
agi: number = 0; agi = 0;
cha: number = 0; cha = 0;
int: number = 0; int = 0;
[key: string]: number; [key: string]: number;
}; }
export interface IActionParams { export interface IActionParams {
name?: string; name?: string;
@ -44,31 +44,31 @@ export interface IActionParams {
} }
export class Action { export class Action {
name: string = ""; name = "";
desc: string = ""; desc = "";
// Difficulty scales with level. See getDifficulty() method // Difficulty scales with level. See getDifficulty() method
level: number = 1; level = 1;
maxLevel: number = 1; maxLevel = 1;
autoLevel: boolean = true; autoLevel = true;
baseDifficulty: number = 100; baseDifficulty = 100;
difficultyFac: number = 1.01; difficultyFac = 1.01;
// Rank increase/decrease is affected by this exponent // Rank increase/decrease is affected by this exponent
rewardFac: number = 1.02; rewardFac = 1.02;
successes: number = 0; successes = 0;
failures: number = 0; failures = 0;
// All of these scale with level/difficulty // All of these scale with level/difficulty
rankGain: number = 0; rankGain = 0;
rankLoss: number = 0; rankLoss = 0;
hpLoss: number = 0; hpLoss = 0;
hpLost: number = 0; hpLost = 0;
// Action Category. Current categories are stealth and kill // Action Category. Current categories are stealth and kill
isStealth: boolean = false; isStealth = false;
isKill: boolean = false; isKill = false;
/** /**
* Number of this contract remaining, and its growth rate * Number of this contract remaining, and its growth rate
@ -81,7 +81,7 @@ export class Action {
weights: StatsMultiplier = {hack:1/7,str:1/7,def:1/7,dex:1/7,agi:1/7,cha:1/7,int:1/7}; weights: StatsMultiplier = {hack:1/7,str:1/7,def:1/7,dex:1/7,agi:1/7,cha:1/7,int:1/7};
// Diminishing returns of stats (stat ^ decay where 0 <= decay <= 1) // Diminishing returns of stats (stat ^ decay where 0 <= decay <= 1)
decays: StatsMultiplier = { hack: 0.9, str: 0.9, def: 0.9, dex: 0.9, agi: 0.9, cha: 0.9, int: 0.9 }; decays: StatsMultiplier = { hack: 0.9, str: 0.9, def: 0.9, dex: 0.9, agi: 0.9, cha: 0.9, int: 0.9 };
teamCount: number = 0; teamCount = 0;
// Base Class for Contracts, Operations, and BlackOps // Base Class for Contracts, Operations, and BlackOps
constructor(params: IActionParams| null = null) { // | null = null constructor(params: IActionParams| null = null) { // | null = null
@ -202,10 +202,10 @@ export class Action {
if (inst == null) {throw new Error("Invalid Bladeburner instance passed into Action.getSuccessChance");} if (inst == null) {throw new Error("Invalid Bladeburner instance passed into Action.getSuccessChance");}
let difficulty = this.getDifficulty(); let difficulty = this.getDifficulty();
let competence = 0; let competence = 0;
for (let stat in this.weights) { for (const stat in this.weights) {
if (this.weights.hasOwnProperty(stat)) { if (this.weights.hasOwnProperty(stat)) {
let playerStatLvl = Player.queryStatFromString(stat); const playerStatLvl = Player.queryStatFromString(stat);
let key = "eff" + stat.charAt(0).toUpperCase() + stat.slice(1); const key = "eff" + stat.charAt(0).toUpperCase() + stat.slice(1);
let effMultiplier = inst.skillMultipliers[key]; let effMultiplier = inst.skillMultipliers[key];
if (effMultiplier == null) { if (effMultiplier == null) {
console.error(`Failed to find Bladeburner Skill multiplier for: ${stat}`); console.error(`Failed to find Bladeburner Skill multiplier for: ${stat}`);

@ -16,7 +16,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:50, rankLoss:10, hpLoss:100, rankGain:50, rankLoss:10, hpLoss:100,
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.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true isKill:true,
}); });
BlackOperations["Operation Zero"] = new BlackOperation({ BlackOperations["Operation Zero"] = new BlackOperation({
name:"Operation Zero", name:"Operation Zero",
@ -33,7 +33,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:60, rankLoss:15, hpLoss:50, rankGain:60, rankLoss:15, hpLoss:50,
weights:{hack:0.2,str:0.15,def:0.15,dex:0.2,agi:0.2,cha:0, int:0.1}, weights:{hack:0.2,str:0.15,def:0.15,dex:0.2,agi:0.2,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.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isStealth:true isStealth:true,
}); });
BlackOperations["Operation X"] = new BlackOperation({ BlackOperations["Operation X"] = new BlackOperation({
name:"Operation X", name:"Operation X",
@ -52,7 +52,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:75, rankLoss:15, hpLoss:100, rankGain:75, rankLoss:15, hpLoss:100,
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.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true isKill:true,
}); });
BlackOperations["Operation Titan"] = new BlackOperation({ BlackOperations["Operation Titan"] = new BlackOperation({
name:"Operation Titan", name:"Operation Titan",
@ -70,7 +70,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:100, rankLoss:20, hpLoss:100, rankGain:100, rankLoss:20, hpLoss:100,
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.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true isKill:true,
}); });
BlackOperations["Operation Ares"] = new BlackOperation({ BlackOperations["Operation Ares"] = new BlackOperation({
name:"Operation Ares", name:"Operation Ares",
@ -84,7 +84,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:125, rankLoss:20, hpLoss:200, rankGain:125, rankLoss:20, hpLoss:200,
weights:{hack:0,str:0.25,def:0.25,dex:0.25,agi:0.25,cha:0, int:0}, weights:{hack:0,str:0.25,def:0.25,dex:0.25,agi:0.25,cha:0, int:0},
decays:{hack:0,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true isKill:true,
}); });
BlackOperations["Operation Archangel"] = new BlackOperation({ BlackOperations["Operation Archangel"] = new BlackOperation({
name:"Operation Archangel", name:"Operation Archangel",
@ -152,7 +152,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:750, rankLoss:60, hpLoss:1000, rankGain:750, rankLoss:60, hpLoss:1000,
weights:{hack:0.05,str:0.2,def:0.2,dex:0.25,agi:0.25,cha:0, int:0.05}, weights:{hack:0.05,str:0.2,def:0.2,dex:0.25,agi:0.25,cha:0, int:0.05},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true isKill:true,
}); });
BlackOperations["Operation Deckard"] = new BlackOperation({ BlackOperations["Operation Deckard"] = new BlackOperation({
name:"Operation Deckard", name:"Operation Deckard",
@ -202,7 +202,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:2e3, rankLoss:150, hpLoss:1500, rankGain:2e3, rankLoss:150, hpLoss:1500,
weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04}, weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true isKill:true,
}); });
BlackOperations["Operation Shoulder of Orion"] = new BlackOperation({ BlackOperations["Operation Shoulder of Orion"] = new BlackOperation({
name:"Operation Shoulder of Orion", name:"Operation Shoulder of Orion",
@ -218,7 +218,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:2.5e3, rankLoss:500, hpLoss:1500, rankGain:2.5e3, rankLoss:500, hpLoss:1500,
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.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isStealth:true isStealth:true,
}); });
BlackOperations["Operation Hyron"] = new BlackOperation({ BlackOperations["Operation Hyron"] = new BlackOperation({
name:"Operation Hyron", name:"Operation Hyron",
@ -240,7 +240,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:3e3, rankLoss:1e3, hpLoss:500, rankGain:3e3, rankLoss:1e3, hpLoss:500,
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.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true isKill:true,
}); });
BlackOperations["Operation Morpheus"] = new BlackOperation({ BlackOperations["Operation Morpheus"] = new BlackOperation({
name:"Operation Morpheus", name:"Operation Morpheus",
@ -257,7 +257,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:4e3, rankLoss:1e3, hpLoss:100, rankGain:4e3, rankLoss:1e3, hpLoss:100,
weights:{hack:0.05,str:0.15,def:0.15,dex:0.3,agi:0.3,cha:0, int:0.05}, weights:{hack:0.05,str:0.15,def:0.15,dex:0.3,agi:0.3,cha:0, int:0.05},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isStealth:true isStealth:true,
}); });
BlackOperations["Operation Ion Storm"] = new BlackOperation({ BlackOperations["Operation Ion Storm"] = new BlackOperation({
name:"Operation Ion Storm", name:"Operation Ion Storm",
@ -272,7 +272,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:5e3, rankLoss:1e3, hpLoss:5000, rankGain:5e3, rankLoss:1e3, hpLoss:5000,
weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04}, weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true isKill:true,
}); });
BlackOperations["Operation Annihilus"] = new BlackOperation({ BlackOperations["Operation Annihilus"] = new BlackOperation({
name:"Operation Annihilus", name:"Operation Annihilus",
@ -286,7 +286,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:7.5e3, rankLoss:1e3, hpLoss:10e3, rankGain:7.5e3, rankLoss:1e3, hpLoss:10e3,
weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04}, weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true isKill:true,
}); });
BlackOperations["Operation Ultron"] = new BlackOperation({ BlackOperations["Operation Ultron"] = new BlackOperation({
name:"Operation Ultron", name:"Operation Ultron",
@ -306,7 +306,7 @@ export const BlackOperations: IMap<BlackOperation> = {};
rankGain:10e3, rankLoss:2e3, hpLoss:10e3, rankGain:10e3, rankLoss:2e3, hpLoss:10e3,
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.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75}, decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true isKill:true,
}); });
BlackOperations["Operation Centurion"] = new BlackOperation({ BlackOperations["Operation Centurion"] = new BlackOperation({
name:"Operation Centurion", name:"Operation Centurion",

@ -5,13 +5,13 @@ import { Generic_fromJSON, Generic_toJSON, Reviver } from "../../utils/JSONReviv
import { addOffset } from "../../utils/helpers/addOffset"; import { addOffset } from "../../utils/helpers/addOffset";
export class ChangePopulationByCountParams { export class ChangePopulationByCountParams {
estChange: number = 0; estChange = 0;
estOffset: number = 0; estOffset = 0;
} }
export class ChangePopulationByPercentageParams { export class ChangePopulationByPercentageParams {
nonZero: boolean = false; nonZero = false;
changeEstEqually: boolean = false; changeEstEqually = false;
} }
export class City { export class City {
@ -19,32 +19,32 @@ export class City {
/** /**
* Name of the city. * Name of the city.
*/ */
name: string = ""; name = "";
/** /**
* Population of the city. * Population of the city.
*/ */
pop: number = 0; pop = 0;
/** /**
* Population estimation of the city. * Population estimation of the city.
*/ */
popEst: number = 0; popEst = 0;
/** /**
* Number of communities in the city. * Number of communities in the city.
*/ */
comms: number = 0; comms = 0;
/** /**
* Estimated number of communities in the city. * Estimated number of communities in the city.
*/ */
commsEst: number = 0; commsEst = 0;
/** /**
* Chaos level of the city. * Chaos level of the city.
*/ */
chaos: number = 0; chaos = 0;
constructor(name: string = BladeburnerConstants.CityNames[2]) { constructor(name: string = BladeburnerConstants.CityNames[2]) {
this.name = name; this.name = name;
@ -84,7 +84,7 @@ export class City {
/** /**
* p is the percentage, not the multiplier (e.g. pass in p = 5 for 5%) * p is the percentage, not the multiplier (e.g. pass in p = 5 for 5%)
*/ */
improvePopulationEstimateByPercentage(p: number, skillMult: number=1): void { improvePopulationEstimateByPercentage(p: number, skillMult=1): void {
p = p*skillMult; p = p*skillMult;
if (isNaN(p)) {throw new Error("NaN passed into City.improvePopulationEstimateByPercentage()");} if (isNaN(p)) {throw new Error("NaN passed into City.improvePopulationEstimateByPercentage()");}
if (this.popEst < this.pop) { if (this.popEst < this.pop) {
@ -97,7 +97,7 @@ export class City {
} }
} }
improveCommunityEstimate(n: number=1): void { improveCommunityEstimate(n=1): void {
if (isNaN(n)) {throw new Error("NaN passed into City.improveCommunityEstimate()");} if (isNaN(n)) {throw new Error("NaN passed into City.improveCommunityEstimate()");}
if (this.commsEst < this.comms) { if (this.commsEst < this.comms) {
this.commsEst += n; this.commsEst += n;

@ -11,7 +11,7 @@ export const GeneralActions: IMap<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 " +
"center. Doing this gives experience for all combat stats and also " + "center. Doing this gives experience for all combat stats and also " +
"increases your max stamina." "increases your max stamina.",
}); });
actionName = "Field Analysis"; actionName = "Field Analysis";
@ -21,7 +21,7 @@ export const GeneralActions: IMap<Action> = {};
"Bladeburner's unit intelligence on Synthoid locations and " + "Bladeburner's unit intelligence on Synthoid locations and " +
"activities. Completing this action will improve the accuracy " + "activities. Completing this action will improve the accuracy " +
"of your Synthoid population estimated in the current city.<br><br>" + "of your Synthoid population estimated in the current city.<br><br>" +
"Does NOT require stamina." "Does NOT require stamina.",
}); });
actionName = "Recruitment"; actionName = "Recruitment";
@ -29,7 +29,7 @@ export const GeneralActions: IMap<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 " +
"can help you conduct operations.<br><br>" + "can help you conduct operations.<br><br>" +
"Does NOT require stamina." "Does NOT require stamina.",
}); });
actionName = "Diplomacy"; actionName = "Diplomacy";
@ -37,7 +37,7 @@ export const GeneralActions: IMap<Action> = {};
name: actionName, name: actionName,
desc: "Improve diplomatic relations with the Synthoid population. " + desc: "Improve diplomatic relations with the Synthoid population. " +
"Completing this action will reduce the Chaos level in your current city.<br><br>" + "Completing this action will reduce the Chaos level in your current city.<br><br>" +
"Does NOT require stamina." "Does NOT require stamina.",
}); });
actionName = "Hyperbolic Regeneration Chamber"; actionName = "Hyperbolic Regeneration Chamber";

@ -8,8 +8,8 @@ export interface IOperationParams extends IActionParams {
} }
export class Operation extends Action { export class Operation extends Action {
reqdRank: number = 100; reqdRank = 100;
teamCount: number = 0; teamCount = 0;
constructor(params: IOperationParams | null = null) { constructor(params: IOperationParams | null = null) {
super(params); super(params);
@ -21,7 +21,7 @@ export class Operation extends Action {
getTeamSuccessBonus(inst: any): number { getTeamSuccessBonus(inst: any): number {
if (this.teamCount && this.teamCount > 0) { if (this.teamCount && this.teamCount > 0) {
this.teamCount = Math.min(this.teamCount, inst.teamSize); this.teamCount = Math.min(this.teamCount, inst.teamSize);
let teamMultiplier = Math.pow(this.teamCount, 0.05); const teamMultiplier = Math.pow(this.teamCount, 0.05);
return teamMultiplier; return teamMultiplier;
} }
@ -35,8 +35,8 @@ export class Operation extends Action {
getChaosDifficultyBonus(inst: any, params: any): number { getChaosDifficultyBonus(inst: any, params: any): number {
const city = inst.getCurrentCity(); const city = inst.getCurrentCity();
if (city.chaos > BladeburnerConstants.ChaosThreshold) { if (city.chaos > BladeburnerConstants.ChaosThreshold) {
let diff = 1 + (city.chaos - BladeburnerConstants.ChaosThreshold); const diff = 1 + (city.chaos - BladeburnerConstants.ChaosThreshold);
let mult = Math.pow(diff, 0.1); const mult = Math.pow(diff, 0.1);
return mult; return mult;
} }

@ -33,36 +33,36 @@ export class Skill {
name: string; name: string;
desc: string; desc: string;
// Cost is in Skill Points // Cost is in Skill Points
baseCost: number = 1; baseCost = 1;
// Additive cost increase per level // Additive cost increase per level
costInc: number = 1; costInc = 1;
maxLvl: number = 0; maxLvl = 0;
/** /**
* These benefits are additive. So total multiplier will be level (handled externally) times the * These benefits are additive. So total multiplier will be level (handled externally) times the
* effects below * effects below
*/ */
successChanceAll: number = 0; successChanceAll = 0;
successChanceStealth: number = 0; successChanceStealth = 0;
successChanceKill: number = 0; successChanceKill = 0;
successChanceContract: number = 0; successChanceContract = 0;
successChanceOperation: number = 0; successChanceOperation = 0;
/** /**
* This multiplier affects everything that increases synthoid population/community estimate * This multiplier affects everything that increases synthoid population/community estimate
* e.g. Field analysis, Investigation Op, Undercover Op * e.g. Field analysis, Investigation Op, Undercover Op
*/ */
successChanceEstimate: number = 0; successChanceEstimate = 0;
actionTime: number = 0; actionTime = 0;
effHack: number = 0; effHack = 0;
effStr: number = 0; effStr = 0;
effDef: number = 0; effDef = 0;
effDex: number = 0; effDex = 0;
effAgi: number = 0; effAgi = 0;
effCha: number = 0; effCha = 0;
stamina: number = 0; stamina = 0;
money: number = 0; money = 0;
expGain: number = 0; expGain = 0;
constructor(params: ISkillParams={name:"foo", desc:"foo"}) { constructor(params: ISkillParams={name:"foo", desc:"foo"}) {
if (!params.name) { if (!params.name) {

@ -10,55 +10,55 @@ export const Skills: IMap<Skill> = {};
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: 3, costInc: 2.1, 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: 2, costInc: 1.1, baseCost: 2, costInc: 1.1,
successChanceStealth:5.5 successChanceStealth:5.5,
}); });
Skills[SkillNames.ShortCircuit] = new Skill({ Skills[SkillNames.ShortCircuit] = new Skill({
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: 2, costInc: 2.1, 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: 2, costInc: 2.1, 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: 2, costInc: 2.1, 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: 90)", "to attempt a Contract, Operation, and BlackOp by 1% (Max Level: 90)",
baseCost: 3, costInc: 1.4, maxLvl: 90, 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 2%", desc: "Each level of this skill increases your effective combat stats for Bladeburner actions by 2%",
baseCost: 2, costInc: 2.1, baseCost: 2, costInc: 2.1,
effStr: 2, effDef: 2, effDex: 2, effAgi: 2 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 4%", "dexterity and agility for Bladeburner actions by 4%",
baseCost: 2, costInc: 2.1, baseCost: 2, costInc: 2.1,
effDex: 4, effAgi: 4 effDex: 4, effAgi: 4,
}); });
Skills[SkillNames.Datamancer] = new Skill({ Skills[SkillNames.Datamancer] = new Skill({
name:SkillNames.Datamancer, name:SkillNames.Datamancer,
@ -67,13 +67,13 @@ export const Skills: IMap<Skill> = {};
"This affects all actions that can potentially increase " + "This affects all actions that can potentially increase " +
"the accuracy of your synthoid population/community estimates.", "the accuracy of your synthoid population/community estimates.",
baseCost:3, costInc:1, baseCost:3, costInc:1,
successChanceEstimate:5 successChanceEstimate:5,
}); });
Skills[SkillNames.CybersEdge] = new Skill({ Skills[SkillNames.CybersEdge] = new Skill({
name:SkillNames.CybersEdge, name:SkillNames.CybersEdge,
desc:"Each level of this skill increases your max stamina by 2%", desc:"Each level of this skill increases your max stamina by 2%",
baseCost:1, costInc:3, baseCost:1, costInc:3,
stamina:2 stamina:2,
}); });
Skills[SkillNames.HandsOfMidas] = new Skill({ Skills[SkillNames.HandsOfMidas] = new Skill({
name: SkillNames.HandsOfMidas, name: SkillNames.HandsOfMidas,

@ -8,7 +8,7 @@ export const ConsoleHelpText: {} = {
" log [en/dis] [type] Enable or disable logging for events and actions", " log [en/dis] [type] Enable or disable logging for events and actions",
" skill [action] [name] Level or display info about your Bladeburner skills", " skill [action] [name] Level or display info about your Bladeburner skills",
" start [type] [name] Start a Bladeburner action/task" , " start [type] [name] Start a Bladeburner action/task" ,
" stop Stops your current Bladeburner action/task" " stop Stops your current Bladeburner action/task",
], ],
automate: [ automate: [
"automate [var] [val] [hi/low]", "automate [var] [val] [hi/low]",
@ -30,17 +30,17 @@ export const ConsoleHelpText: {} = {
"Using the four console commands above will set the automation to perform Tracking contracts " + "Using the four console commands above will set the automation to perform Tracking contracts " +
"if your stamina is 100 or higher, and then switch to Field Analysis if your stamina drops below " + "if your stamina is 100 or higher, and then switch to Field Analysis if your stamina drops below " +
"50. Note that when setting the action, the name of the action is CASE-SENSITIVE. It must " + "50. Note that when setting the action, the name of the action is CASE-SENSITIVE. It must " +
"exactly match whatever the name is in the UI." "exactly match whatever the name is in the UI.",
], ],
clear: [ clear: [
"clear", "clear",
"", "",
"Clears the console" "Clears the console",
], ],
cls: [ cls: [
"cls", "cls",
"", "",
"Clears the console" "Clears the console",
], ],
help: [ help: [
"help [command]", "help [command]",
@ -51,7 +51,7 @@ export const ConsoleHelpText: {} = {
"", "",
" help automate", " help automate",
"", "",
"will display specific information about using the automate console command" "will display specific information about using the automate console command",
], ],
log: [ log: [
"log [en/dis] [type]", "log [en/dis] [type]",
@ -71,7 +71,7 @@ export const ConsoleHelpText: {} = {
"Logging can be universally enabled/disabled using the 'all' keyword:", "Logging can be universally enabled/disabled using the 'all' keyword:",
"", "",
" log dis all", " log dis all",
" log en all" " log en all",
], ],
skill: [ skill: [
"skill [action] [name]", "skill [action] [name]",
@ -91,7 +91,7 @@ export const ConsoleHelpText: {} = {
"", "",
"This console command can also be used to level up skills:", "This console command can also be used to level up skills:",
"", "",
" skill level [skill name]" " skill level [skill name]",
], ],
start: [ start: [
"start [type] [name]", "start [type] [name]",
@ -106,11 +106,11 @@ export const ConsoleHelpText: {} = {
"Examples:", "Examples:",
"", "",
" start contract Tracking", " start contract Tracking",
" start op 'Undercover Operation'" " start op 'Undercover Operation'",
], ],
stop:[ stop:[
"stop", "stop",
"", "",
"Stop your current action and go idle." "Stop your current action and go idle.",
], ],
} }

@ -55,9 +55,8 @@ export function BlackOperationsPage(inst: any): React.ReactElement {
Black Operations (Black Ops) are special, one-time covert operations. Each Black Op must be unlocked successively by completing the one before it.<br /><br /> Black Operations (Black Ops) are special, one-time covert operations. Each Black Op must be unlocked successively by completing the one before it.<br /><br />
<b>Your ultimate goal to climb through the ranks of Bladeburners is to complete all of the Black Ops.</b><br /><br /> <b>Your ultimate goal to climb through the ranks of Bladeburners is to complete all of the Black Ops.</b><br /><br />
Like normal operations, you may use a team for Black Ops. Failing a black op will incur heavy HP and rank losses.</p> Like normal operations, you may use a team for Black Ops. Failing a black op will incur heavy HP and rank losses.</p>
{blackops.map( op => {blackops.map( op => <div className="bladeburner-action">
<div className="bladeburner-action"> </div>,
</div>
)} )}
</div>) </div>)
} }

@ -89,7 +89,7 @@ export class CoinFlip extends Game<IProps, IState> {
| | | |<br /> | | | |<br />
++<br /> ++<br />
</pre> </pre>
<span className="text">Play for: </span><input type="number" className='text-input' onChange={this.updateInvestment} value={this.state.investment} /><br /> <span className="text">Play for: </span><input type="number" className="text-input" onChange={this.updateInvestment} value={this.state.investment} /><br />
<StdButton onClick={trusted(() => this.play('H'))} text={"Head!"} disabled={this.state.playLock} /> <StdButton onClick={trusted(() => this.play('H'))} text={"Head!"} disabled={this.state.playLock} />
<StdButton onClick={trusted(() => this.play('T'))} text={"Tail!"} disabled={this.state.playLock} /> <StdButton onClick={trusted(() => this.play('T'))} text={"Tail!"} disabled={this.state.playLock} />
<h1>{this.state.status}</h1> <h1>{this.state.status}</h1>

@ -1,6 +1,6 @@
export interface RNG { export interface RNG {
random(): number random(): number;
} }
/* /*
@ -9,9 +9,9 @@ export interface RNG {
*/ */
class RNG0 implements RNG { class RNG0 implements RNG {
x: number; x: number;
m: number = 1024; m = 1024;
a: number = 341; a = 341;
c: number = 1; c = 1;
constructor() { constructor() {
this.x = 0; this.x = 0;
@ -39,9 +39,9 @@ export const BadRNG: RNG0 = new RNG0();
* The period is 6e12. * The period is 6e12.
*/ */
export class WHRNG implements RNG { export class WHRNG implements RNG {
s1: number = 0; s1 = 0;
s2: number = 0; s2 = 0;
s3: number = 0; s3 = 0;
constructor(totalPlaytime: number) { constructor(totalPlaytime: number) {
// This one is seeded by the players total play time. // This one is seeded by the players total play time.

@ -102,14 +102,14 @@ const strategies: {
Third2: { Third2: {
match: (n: number): boolean => { match: (n: number): boolean => {
if (n === 0) return false; if (n === 0) return false;
return 13 <= n && n <= 24; return n >= 13 && n <= 24;
}, },
payout: 2, payout: 2,
}, },
Third3: { Third3: {
match: (n: number): boolean => { match: (n: number): boolean => {
if (n === 0) return false; if (n === 0) return false;
return 25 <= n; return n >= 25;
}, },
payout: 2, payout: 2,
}, },
@ -125,7 +125,7 @@ function Single(s: number): Strategy {
} }
export class Roulette extends Game<IProps, IState> { export class Roulette extends Game<IProps, IState> {
interval: number = -1; interval = -1;
rng: WHRNG; rng: WHRNG;
constructor(props: IProps) { constructor(props: IProps) {
@ -226,7 +226,7 @@ export class Roulette extends Game<IProps, IState> {
render() { render() {
return <> return <>
<h1>{this.currentNumber()}</h1> <h1>{this.currentNumber()}</h1>
<input type="number" className='text-input' onChange={this.updateInvestment} placeholder={"Amount to play"} value={this.state.investment} disabled={!this.state.canPlay} /> <input type="number" className="text-input" onChange={this.updateInvestment} placeholder={"Amount to play"} value={this.state.investment} disabled={!this.state.canPlay} />
<h1>{this.state.status}</h1> <h1>{this.state.status}</h1>
<table> <table>
<tbody> <tbody>

@ -20,7 +20,7 @@ type IState = {
} }
// statically shuffled array of symbols. // statically shuffled array of symbols.
let symbols = ["D", "C", "$", "?", "♥", "A", "C", "B", "C", "E", "B", "E", "C", const symbols = ["D", "C", "$", "?", "♥", "A", "C", "B", "C", "E", "B", "E", "C",
"*", "D", "♥", "B", "A", "A", "A", "C", "A", "D", "B", "E", "?", "D", "*", "*", "D", "♥", "B", "A", "A", "A", "C", "A", "D", "B", "E", "?", "D", "*",
"@", "♥", "B", "E", "?"]; "@", "♥", "B", "E", "?"];
@ -63,7 +63,7 @@ const maxPlay = 1e6;
export class SlotMachine extends Game<IProps, IState> { export class SlotMachine extends Game<IProps, IState> {
rng: WHRNG; rng: WHRNG;
interval: number = -1; interval = -1;
constructor(props: IProps) { constructor(props: IProps) {
super(props); super(props);
@ -142,7 +142,7 @@ export class SlotMachine extends Game<IProps, IState> {
checkWinnings() { checkWinnings() {
const t = this.getTable(); const t = this.getTable();
const getPaylineData = function(payline: number[][]): string[] { const getPaylineData = function(payline: number[][]): string[] {
let data = []; const data = [];
for(const point of payline) { for(const point of payline) {
data.push(t[point[0]][point[1]]); data.push(t[point[0]][point[1]]);
} }
@ -209,7 +209,7 @@ export class SlotMachine extends Game<IProps, IState> {
| | {symbols[(this.state.index[0]+1)%symbols.length]} | {symbols[(this.state.index[1]+1)%symbols.length]} | {symbols[(this.state.index[2]+1)%symbols.length]} | {symbols[(this.state.index[3]+1)%symbols.length]} | {symbols[(this.state.index[4]+1)%symbols.length]} | |<br /> | | {symbols[(this.state.index[0]+1)%symbols.length]} | {symbols[(this.state.index[1]+1)%symbols.length]} | {symbols[(this.state.index[2]+1)%symbols.length]} | {symbols[(this.state.index[3]+1)%symbols.length]} | {symbols[(this.state.index[4]+1)%symbols.length]} | |<br />
++<br /> ++<br />
</pre> </pre>
<input type="number" className='text-input' onChange={this.updateInvestment} placeholder={"Amount to play"} value={this.state.investment} disabled={!this.state.canPlay} /> <input type="number" className="text-input" onChange={this.updateInvestment} placeholder={"Amount to play"} value={this.state.investment} disabled={!this.state.canPlay} />
<StdButton onClick={trusted(this.play)} text={"Spin!"} disabled={!this.state.canPlay} /> <StdButton onClick={trusted(this.play)} text={"Spin!"} disabled={!this.state.canPlay} />
<h1>{this.state.status}</h1> <h1>{this.state.status}</h1>
<h2>Pay lines</h2> <h2>Pay lines</h2>

@ -99,7 +99,7 @@ function cinematicTextEnd() {
mainMenu.style.visibility = "visible"; mainMenu.style.visibility = "visible";
cinematicTextFlag = false; cinematicTextFlag = false;
resolve(); resolve();
} },
})); }));
}); });
} }

@ -2,7 +2,7 @@ import {
CodingContract, CodingContract,
CodingContractRewardType, CodingContractRewardType,
CodingContractTypes, CodingContractTypes,
ICodingContractReward ICodingContractReward,
} from "./CodingContracts"; } from "./CodingContracts";
import { Factions } from "./Faction/Factions"; import { Factions } from "./Faction/Factions";
import { Player } from "./Player"; import { Player } from "./Player";
@ -88,7 +88,7 @@ export function generateContract(params: IGenerateContractParams) {
fn = getRandomFilename(server, reward); fn = getRandomFilename(server, reward);
} }
let contract = new CodingContract(fn, problemType, reward); const contract = new CodingContract(fn, problemType, reward);
server.addContract(contract); server.addContract(contract);
} }
@ -119,13 +119,13 @@ function sanitizeRewardType(rewardType: CodingContractRewardType): CodingContrac
function getRandomProblemType() { function getRandomProblemType() {
const problemTypes = Object.keys(CodingContractTypes); const problemTypes = Object.keys(CodingContractTypes);
let randIndex = getRandomInt(0, problemTypes.length - 1); const randIndex = getRandomInt(0, problemTypes.length - 1);
return problemTypes[randIndex]; return problemTypes[randIndex];
} }
function getRandomReward(): ICodingContractReward { function getRandomReward(): ICodingContractReward {
let reward: ICodingContractReward = { const reward: ICodingContractReward = {
name: "", name: "",
type: getRandomInt(0, CodingContractRewardType.Money), type: getRandomInt(0, CodingContractRewardType.Money),
}; };
@ -145,8 +145,8 @@ function getRandomReward(): ICodingContractReward {
case CodingContractRewardType.FactionReputation: { case CodingContractRewardType.FactionReputation: {
// Get a random faction that player is a part of. That // Get a random faction that player is a part of. That
// faction must allow hacking contracts // faction must allow hacking contracts
var numFactions = factionsThatAllowHacking.length; const numFactions = factionsThatAllowHacking.length;
var randFaction = factionsThatAllowHacking[getRandomInt(0, numFactions - 1)]; const randFaction = factionsThatAllowHacking[getRandomInt(0, numFactions - 1)];
reward.name = randFaction; reward.name = randFaction;
break; break;
} }

@ -2,7 +2,7 @@ import {
codingContractTypesMetadata, codingContractTypesMetadata,
DescriptionFunc, DescriptionFunc,
GeneratorFunc, GeneratorFunc,
SolverFunc SolverFunc,
} from "./data/codingcontracttypes"; } from "./data/codingcontracttypes";
import { IMap } from "./types"; import { IMap } from "./types";
@ -10,7 +10,7 @@ import { IMap } from "./types";
import { import {
Generic_fromJSON, Generic_fromJSON,
Generic_toJSON, Generic_toJSON,
Reviver Reviver,
} from "../utils/JSONReviver"; } from "../utils/JSONReviver";
import { KEY } from "../utils/helpers/keyCodes"; import { KEY } from "../utils/helpers/keyCodes";
import { createElement } from "../utils/uiHelpers/createElement"; import { createElement } from "../utils/uiHelpers/createElement";
@ -126,13 +126,13 @@ export class CodingContract {
reward: ICodingContractReward | null; reward: ICodingContractReward | null;
/* Number of times the Contract has been attempted */ /* Number of times the Contract has been attempted */
tries: number = 0; tries = 0;
/* String representing the contract's type. Must match type in ContractTypes */ /* String representing the contract's type. Must match type in ContractTypes */
type: string; type: string;
constructor(fn: string = "", constructor(fn = "",
type: string = "Find Largest Prime Factor", type = "Find Largest Prime Factor",
reward: ICodingContractReward | null = null) { reward: ICodingContractReward | null = null) {
this.fn = fn; this.fn = fn;
if (!this.fn.endsWith(".cct")) { if (!this.fn.endsWith(".cct")) {
@ -180,7 +180,7 @@ export class CodingContract {
// tslint:disable-next-line // tslint:disable-next-line
return new Promise<CodingContractResult>((resolve: Function, reject: Function) => { return new Promise<CodingContractResult>((resolve: Function, reject: Function) => {
const contractType: CodingContractType = CodingContractTypes[this.type]; const contractType: CodingContractType = CodingContractTypes[this.type];
const popupId: string = `coding-contract-prompt-popup-${this.fn}`; const popupId = `coding-contract-prompt-popup-${this.fn}`;
const title: HTMLElement = createElement("h1", { const title: HTMLElement = createElement("h1", {
innerHTML: this.type, innerHTML: this.type,
}); });

@ -136,7 +136,7 @@ export class Company {
gainFavor(): void { gainFavor(): void {
if (this.favor == null) { this.favor = 0; } if (this.favor == null) { this.favor = 0; }
if (this.rolloverRep == null) { this.rolloverRep = 0; } if (this.rolloverRep == null) { this.rolloverRep = 0; }
var res = this.getFavorGain(); const res = this.getFavorGain();
if (res.length != 2) { if (res.length != 2) {
console.error("Invalid result from getFavorGain() function"); console.error("Invalid result from getFavorGain() function");
return; return;

@ -5,8 +5,8 @@ import { CompanyPosition } from "./CompanyPosition";
* Returns a string with the given CompanyPosition's stat requirements * Returns a string with the given CompanyPosition's stat requirements
*/ */
export function getJobRequirementText(company: Company, pos: CompanyPosition, tooltiptext: boolean = false): string { export function getJobRequirementText(company: Company, pos: CompanyPosition, tooltiptext = false): string {
let reqText: string = ""; let reqText = "";
const offset: number = company.jobStatReqOffset; const offset: number = company.jobStatReqOffset;
const reqHacking: number = pos.requiredHacking > 0 ? pos.requiredHacking+offset : 0; const reqHacking: number = pos.requiredHacking > 0 ? pos.requiredHacking+offset : 0;
const reqStrength: number = pos.requiredStrength > 0 ? pos.requiredStrength+offset : 0; const reqStrength: number = pos.requiredStrength > 0 ? pos.requiredStrength+offset : 0;

@ -95,7 +95,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 3, expMultiplier: 3,
salaryMultiplier: 3, salaryMultiplier: 3,
@ -107,7 +107,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 3, expMultiplier: 3,
salaryMultiplier: 3, salaryMultiplier: 3,
@ -119,7 +119,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 2.6, expMultiplier: 2.6,
salaryMultiplier: 2.6, salaryMultiplier: 2.6,
@ -131,7 +131,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 2.75, expMultiplier: 2.75,
salaryMultiplier: 2.75, salaryMultiplier: 2.75,
@ -143,7 +143,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 2.75, expMultiplier: 2.75,
salaryMultiplier: 2.75, salaryMultiplier: 2.75,
@ -155,7 +155,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 2.25, expMultiplier: 2.25,
salaryMultiplier: 2.25, salaryMultiplier: 2.25,
@ -167,7 +167,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 2.25, expMultiplier: 2.25,
salaryMultiplier: 2.25, salaryMultiplier: 2.25,
@ -179,7 +179,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 2.5, expMultiplier: 2.5,
salaryMultiplier: 2.5, salaryMultiplier: 2.5,
@ -191,7 +191,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 2.2, expMultiplier: 2.2,
salaryMultiplier: 2.2, salaryMultiplier: 2.2,
@ -202,7 +202,7 @@ export const companiesMetadata: IConstructorParams[] = [
info: "", info: "",
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions AllBusinessPositions,
), ),
expMultiplier: 2, expMultiplier: 2,
salaryMultiplier: 2, salaryMultiplier: 2,
@ -214,7 +214,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllSoftwareConsultantPositions, AllSoftwareConsultantPositions,
AllBusinessPositions AllBusinessPositions,
), ),
expMultiplier: 1.8, expMultiplier: 1.8,
salaryMultiplier: 1.8, salaryMultiplier: 1.8,
@ -226,7 +226,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
CEOOnly, CEOOnly,
AllTechnologyPositions, AllTechnologyPositions,
AllSoftwareConsultantPositions AllSoftwareConsultantPositions,
), ),
expMultiplier: 1.75, expMultiplier: 1.75,
salaryMultiplier: 1.75, salaryMultiplier: 1.75,
@ -238,7 +238,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
CEOOnly, CEOOnly,
AllTechnologyPositions, AllTechnologyPositions,
AllSoftwareConsultantPositions AllSoftwareConsultantPositions,
), ),
expMultiplier: 1.8, expMultiplier: 1.8,
salaryMultiplier: 1.8, salaryMultiplier: 1.8,
@ -250,7 +250,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSoftwareConsultantPositions AllSoftwareConsultantPositions,
), ),
expMultiplier: 1.8, expMultiplier: 1.8,
salaryMultiplier: 1.8, salaryMultiplier: 1.8,
@ -262,7 +262,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSoftwareConsultantPositions AllSoftwareConsultantPositions,
), ),
expMultiplier: 1.9, expMultiplier: 1.9,
salaryMultiplier: 1.9, salaryMultiplier: 1.9,
@ -274,7 +274,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSoftwareConsultantPositions AllSoftwareConsultantPositions,
), ),
expMultiplier: 2, expMultiplier: 2,
salaryMultiplier: 2, salaryMultiplier: 2,
@ -286,7 +286,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSoftwareConsultantPositions AllSoftwareConsultantPositions,
), ),
expMultiplier: 1.9, expMultiplier: 1.9,
salaryMultiplier: 1.9, salaryMultiplier: 1.9,
@ -299,7 +299,7 @@ export const companiesMetadata: IConstructorParams[] = [
CEOOnly, CEOOnly,
OperationsManagerOnly, OperationsManagerOnly,
AllTechnologyPositions, AllTechnologyPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 1.7, expMultiplier: 1.7,
salaryMultiplier: 1.7, salaryMultiplier: 1.7,
@ -351,7 +351,7 @@ export const companiesMetadata: IConstructorParams[] = [
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSoftwareConsultantPositions, AllSoftwareConsultantPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 1.8, expMultiplier: 1.8,
salaryMultiplier: 1.8, salaryMultiplier: 1.8,
@ -364,7 +364,7 @@ export const companiesMetadata: IConstructorParams[] = [
AllTechnologyPositions, AllTechnologyPositions,
AllBusinessPositions, AllBusinessPositions,
AllSoftwareConsultantPositions, AllSoftwareConsultantPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 1.75, expMultiplier: 1.75,
salaryMultiplier: 1.75, salaryMultiplier: 1.75,
@ -379,7 +379,7 @@ export const companiesMetadata: IConstructorParams[] = [
SecurityEngineerPositions, SecurityEngineerPositions,
AllITPositions, AllITPositions,
AllSecurityPositions, AllSecurityPositions,
AllAgentPositions AllAgentPositions,
), ),
expMultiplier: 2, expMultiplier: 2,
salaryMultiplier: 2, salaryMultiplier: 2,
@ -394,7 +394,7 @@ export const companiesMetadata: IConstructorParams[] = [
SecurityEngineerPositions, SecurityEngineerPositions,
AllITPositions, AllITPositions,
AllSecurityPositions, AllSecurityPositions,
AllAgentPositions AllAgentPositions,
), ),
expMultiplier: 2, expMultiplier: 2,
salaryMultiplier: 2, salaryMultiplier: 2,
@ -409,7 +409,7 @@ export const companiesMetadata: IConstructorParams[] = [
AllITPositions, AllITPositions,
AllSecurityPositions, AllSecurityPositions,
AllAgentPositions, AllAgentPositions,
AllSoftwareConsultantPositions AllSoftwareConsultantPositions,
), ),
expMultiplier: 1.5, expMultiplier: 1.5,
salaryMultiplier: 1.5, salaryMultiplier: 1.5,
@ -422,7 +422,7 @@ export const companiesMetadata: IConstructorParams[] = [
AllTechnologyPositions, AllTechnologyPositions,
AllSoftwareConsultantPositions, AllSoftwareConsultantPositions,
AllBusinessPositions, AllBusinessPositions,
AllSecurityPositions AllSecurityPositions,
), ),
expMultiplier: 1.4, expMultiplier: 1.4,
salaryMultiplier: 1.4, salaryMultiplier: 1.4,
@ -433,7 +433,7 @@ export const companiesMetadata: IConstructorParams[] = [
info: "", info: "",
companyPositions: Object.assign({}, companyPositions: Object.assign({},
SoftwarePositionsUpToLeadDeveloper, SoftwarePositionsUpToLeadDeveloper,
BusinessPositionsUpToOperationsManager BusinessPositionsUpToOperationsManager,
), ),
expMultiplier: 1.3, expMultiplier: 1.3,
salaryMultiplier: 1.3, salaryMultiplier: 1.3,
@ -445,7 +445,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
SoftwarePositionsUpToLeadDeveloper, SoftwarePositionsUpToLeadDeveloper,
BusinessPositionsUpToOperationsManager, BusinessPositionsUpToOperationsManager,
AllSoftwareConsultantPositions AllSoftwareConsultantPositions,
), ),
expMultiplier: 1.5, expMultiplier: 1.5,
salaryMultiplier: 1.5, salaryMultiplier: 1.5,
@ -456,7 +456,7 @@ export const companiesMetadata: IConstructorParams[] = [
info: "", info: "",
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllSecurityPositions, AllSecurityPositions,
SoftwarePositionsUpToLeadDeveloper SoftwarePositionsUpToLeadDeveloper,
), ),
expMultiplier: 1.3, expMultiplier: 1.3,
salaryMultiplier: 1.3, salaryMultiplier: 1.3,
@ -466,7 +466,7 @@ export const companiesMetadata: IConstructorParams[] = [
name: LocationName.VolhavenSysCoreSecurities, name: LocationName.VolhavenSysCoreSecurities,
info: "", info: "",
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions AllTechnologyPositions,
), ),
expMultiplier: 1.3, expMultiplier: 1.3,
salaryMultiplier: 1.3, salaryMultiplier: 1.3,
@ -476,7 +476,7 @@ export const companiesMetadata: IConstructorParams[] = [
name: LocationName.VolhavenCompuTek, name: LocationName.VolhavenCompuTek,
info: "", info: "",
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions AllTechnologyPositions,
), ),
expMultiplier: 1.2, expMultiplier: 1.2,
salaryMultiplier: 1.2, salaryMultiplier: 1.2,
@ -486,7 +486,7 @@ export const companiesMetadata: IConstructorParams[] = [
name: LocationName.AevumNetLinkTechnologies, name: LocationName.AevumNetLinkTechnologies,
info: "", info: "",
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllTechnologyPositions AllTechnologyPositions,
), ),
expMultiplier: 1.2, expMultiplier: 1.2,
salaryMultiplier: 1.2, salaryMultiplier: 1.2,
@ -509,7 +509,7 @@ export const companiesMetadata: IConstructorParams[] = [
name: LocationName.Sector12FoodNStuff, name: LocationName.Sector12FoodNStuff,
info: "", info: "",
companyPositions: Object.assign({}, companyPositions: Object.assign({},
EmployeeOnly, PartTimeEmployeeOnly EmployeeOnly, PartTimeEmployeeOnly,
), ),
expMultiplier: 1, expMultiplier: 1,
salaryMultiplier: 1, salaryMultiplier: 1,
@ -519,7 +519,7 @@ export const companiesMetadata: IConstructorParams[] = [
name: LocationName.Sector12JoesGuns, name: LocationName.Sector12JoesGuns,
info: "", info: "",
companyPositions: Object.assign({}, companyPositions: Object.assign({},
EmployeeOnly, PartTimeEmployeeOnly EmployeeOnly, PartTimeEmployeeOnly,
), ),
expMultiplier: 1, expMultiplier: 1,
salaryMultiplier: 1, salaryMultiplier: 1,
@ -531,7 +531,7 @@ export const companiesMetadata: IConstructorParams[] = [
companyPositions: Object.assign({}, companyPositions: Object.assign({},
AllSoftwarePositions, AllSoftwarePositions,
AllSoftwareConsultantPositions, AllSoftwareConsultantPositions,
AllITPositions AllITPositions,
), ),
expMultiplier: 1.1, expMultiplier: 1.1,
salaryMultiplier: 1.1, salaryMultiplier: 1.1,
@ -541,7 +541,7 @@ export const companiesMetadata: IConstructorParams[] = [
name: LocationName.NewTokyoNoodleBar, name: LocationName.NewTokyoNoodleBar,
info: "", info: "",
companyPositions: Object.assign({}, companyPositions: Object.assign({},
WaiterOnly, PartTimeWaiterOnly WaiterOnly, PartTimeWaiterOnly,
), ),
expMultiplier: 1, expMultiplier: 1,
salaryMultiplier: 1, salaryMultiplier: 1,

@ -8,23 +8,23 @@ export const SoftwareCompanyPositions: string[] = [
"Head of Software", "Head of Software",
"Head of Engineering", "Head of Engineering",
"Vice President of Technology", "Vice President of Technology",
"Chief Technology Officer" "Chief Technology Officer",
]; ];
export const ITCompanyPositions: string[] = [ export const ITCompanyPositions: string[] = [
"IT Intern", "IT Intern",
"IT Analyst", "IT Analyst",
"IT Manager", "IT Manager",
"Systems Administrator" "Systems Administrator",
]; ];
export const SecurityEngineerCompanyPositions: string[] = [ export const SecurityEngineerCompanyPositions: string[] = [
"Security Engineer" "Security Engineer",
]; ];
export const NetworkEngineerCompanyPositions: string[] = [ export const NetworkEngineerCompanyPositions: string[] = [
"Network Engineer", "Network Engineer",
"Network Administrator" "Network Administrator",
]; ];
export const BusinessCompanyPositions: string[] = [ export const BusinessCompanyPositions: string[] = [
@ -33,7 +33,7 @@ export const BusinessCompanyPositions: string[] = [
"Business Manager", "Business Manager",
"Operations Manager", "Operations Manager",
"Chief Financial Officer", "Chief Financial Officer",
"Chief Executive Officer" "Chief Executive Officer",
]; ];
export const SecurityCompanyPositions: string[] = [ export const SecurityCompanyPositions: string[] = [
@ -42,31 +42,31 @@ export const SecurityCompanyPositions: string[] = [
"Security Guard", "Security Guard",
"Security Officer", "Security Officer",
"Security Supervisor", "Security Supervisor",
"Head of Security" "Head of Security",
]; ];
export const AgentCompanyPositions: string[] = [ export const AgentCompanyPositions: string[] = [
"Field Agent", "Field Agent",
"Secret Agent", "Secret Agent",
"Special Operative" "Special Operative",
]; ];
export const MiscCompanyPositions: string[] = [ export const MiscCompanyPositions: string[] = [
"Waiter", "Waiter",
"Employee" "Employee",
]; ];
export const SoftwareConsultantCompanyPositions: string[] = [ export const SoftwareConsultantCompanyPositions: string[] = [
"Software Consultant", "Software Consultant",
"Senior Software Consultant" "Senior Software Consultant",
]; ];
export const BusinessConsultantCompanyPositions: string[] = [ export const BusinessConsultantCompanyPositions: string[] = [
"Business Consultant", "Business Consultant",
"Senior Business Consultant" "Senior Business Consultant",
]; ];
export const PartTimeCompanyPositions: string[] = [ export const PartTimeCompanyPositions: string[] = [
"Part-time Waiter", "Part-time Waiter",
"Part-time Employee" "Part-time Employee",
]; ];

@ -5,7 +5,7 @@
*/ */
import { IMap } from "./types"; import { IMap } from "./types";
export let CONSTANTS: IMap<any> = { export const CONSTANTS: IMap<any> = {
Version: "0.51.6", Version: "0.51.6",
/** 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
@ -268,5 +268,5 @@ export let CONSTANTS: IMap<any> = {
* so many documentation and typos fixes (@Pimgd) * so many documentation and typos fixes (@Pimgd)
* A corruption visual effect has been added to location with servers that * A corruption visual effect has been added to location with servers that
have backdoor installed. (@dewint) have backdoor installed. (@dewint)
` `,
} }

@ -122,7 +122,7 @@ function Industry(params={}) {
}), }),
[CityName.NewTokyo]: 0, [CityName.NewTokyo]: 0,
[CityName.Ishima]: 0, [CityName.Ishima]: 0,
[CityName.Volhaven]: 0 [CityName.Volhaven]: 0,
}; };
this.name = params.name ? params.name : 0; this.name = params.name ? params.name : 0;
@ -183,7 +183,7 @@ function Industry(params={}) {
}), }),
[CityName.NewTokyo]: 0, [CityName.NewTokyo]: 0,
[CityName.Ishima]: 0, [CityName.Ishima]: 0,
[CityName.Volhaven]: 0 [CityName.Volhaven]: 0,
}; };
this.init(); this.init();
@ -378,7 +378,7 @@ Industry.prototype.init = function() {
"Metal": 5, "Metal": 5,
"Energy": 5, "Energy": 5,
"Water": 2, "Water": 2,
"Hardware": 4 "Hardware": 4,
} }
this.prodMats = ["RealEstate"]; this.prodMats = ["RealEstate"];
this.makesProducts = true; this.makesProducts = true;
@ -1620,7 +1620,7 @@ var OfficeSpaceTiers = {
Basic: "Basic", Basic: "Basic",
Enhanced: "Enhanced", Enhanced: "Enhanced",
Luxurious: "Luxurious", Luxurious: "Luxurious",
Extravagant: "Extravagant" Extravagant: "Extravagant",
} }
function OfficeSpace(params={}) { function OfficeSpace(params={}) {
@ -1800,7 +1800,7 @@ OfficeSpace.prototype.findEmployees = function(parentRefs) {
office.hireEmployee(employee, parentRefs); office.hireEmployee(employee, parentRefs);
removeElementById("cmpy-mgmt-hire-employee-popup"); removeElementById("cmpy-mgmt-hire-employee-popup");
return false; return false;
} },
}); });
return div; return div;
}; };
@ -1812,7 +1812,7 @@ OfficeSpace.prototype.findEmployees = function(parentRefs) {
clickListener:() => { clickListener:() => {
removeElementById("cmpy-mgmt-hire-employee-popup"); removeElementById("cmpy-mgmt-hire-employee-popup");
return false; return false;
} },
}); });
var elems = [text, var elems = [text,
@ -2111,7 +2111,7 @@ Corporation.prototype.goPublic = function() {
onkeyup:(e) => { onkeyup:(e) => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === KEY.ENTER) {yesBtn.click();} if (e.keyCode === KEY.ENTER) {yesBtn.click();}
} },
}); });
var br = createElement("br", {}); var br = createElement("br", {});
yesBtn = createElement("a", { yesBtn = createElement("a", {
@ -2138,7 +2138,7 @@ Corporation.prototype.goPublic = function() {
dialogBoxCreate(`You took your ${this.name} public and earned ` + dialogBoxCreate(`You took your ${this.name} public and earned ` +
`${numeralWrapper.formatMoney(numShares * initialSharePrice)} in your IPO`); `${numeralWrapper.formatMoney(numShares * initialSharePrice)} in your IPO`);
return false; return false;
} },
}); });
var noBtn = createElement("a", { var noBtn = createElement("a", {
class:"a-link-button", class:"a-link-button",
@ -2146,7 +2146,7 @@ Corporation.prototype.goPublic = function() {
clickListener:() => { clickListener:() => {
removeElementById(goPublicPopupId); removeElementById(goPublicPopupId);
return false; return false;
} },
}); });
createPopup(goPublicPopupId, [txt, br, input, yesBtn, noBtn]); createPopup(goPublicPopupId, [txt, br, input, yesBtn, noBtn]);
} }
@ -2351,7 +2351,7 @@ Corporation.prototype.createUI = function() {
companyManagementDiv = createElement("div", { companyManagementDiv = createElement("div", {
id:"cmpy-mgmt-container", id:"cmpy-mgmt-container",
position:"fixed", position:"fixed",
class:"generic-menupage-container" class:"generic-menupage-container",
}); });
document.getElementById("entire-game-container").appendChild(companyManagementDiv); document.getElementById("entire-game-container").appendChild(companyManagementDiv);

@ -13,7 +13,7 @@ export class CorporationState {
// Number representing what state the Corporation is in. The number // Number representing what state the Corporation is in. The number
// is an index for the array that holds all Corporation States // is an index for the array that holds all Corporation States
state: number = 0; state = 0;
constructor() {} constructor() {}

@ -107,7 +107,7 @@ export const IndustryDescriptions: IIndustryMap<string> = {
// Map of available Research for each Industry. This data is held in a // Map of available Research for each Industry. This data is held in a
// ResearchTree object // ResearchTree object
export let IndustryResearchTrees: IIndustryMap<ResearchTree> = { export const IndustryResearchTrees: IIndustryMap<ResearchTree> = {
Energy: getBaseResearchTreeCopy(), Energy: getBaseResearchTreeCopy(),
Utilities: getBaseResearchTreeCopy(), Utilities: getBaseResearchTreeCopy(),
Agriculture: getBaseResearchTreeCopy(), Agriculture: getBaseResearchTreeCopy(),

@ -11,5 +11,5 @@ export const IndustryUpgrades: IMap<any[]> = {
"this upgrade grants your company a static increase of 3 and 1 to its awareness and " + "this upgrade grants your company a static increase of 3 and 1 to its awareness and " +
"popularity, respectively. It will then increase your company's awareness by 1%, and its popularity " + "popularity, respectively. It will then increase your company's awareness by 1%, and its popularity " +
"by a random percentage between 1% and 3%. These effects are increased by other upgrades " + "by a random percentage between 1% and 3%. These effects are increased by other upgrades " +
"that increase the power of your advertising."] "that increase the power of your advertising."],
} }

@ -13,50 +13,50 @@ export class Material {
} }
// Name of material // Name of material
name: string = "InitName"; name = "InitName";
// Amount of material owned // Amount of material owned
qty: number = 0; qty = 0;
// Material's "quality". Unbounded // Material's "quality". Unbounded
qlt: number = 0; qlt = 0;
// How much demand the Material has in the market, and the range of possible // How much demand the Material has in the market, and the range of possible
// values for this "demand" // values for this "demand"
dmd: number = 0; dmd = 0;
dmdR: number[] = [0, 0]; dmdR: number[] = [0, 0];
// How much competition there is for this Material in the market, and the range // How much competition there is for this Material in the market, and the range
// of possible values for this "competition" // of possible values for this "competition"
cmp: number = 0; cmp = 0;
cmpR: number[] = [0, 0]; cmpR: number[] = [0, 0];
// Maximum volatility of this Materials stats // Maximum volatility of this Materials stats
mv: number = 0; mv = 0;
// Markup. Determines how high of a price you can charge on the material // Markup. Determines how high of a price you can charge on the material
// compared to the market price without suffering loss in # of sales // compared to the market price without suffering loss in # of sales
// Quality is divided by this to determine markup limits // Quality is divided by this to determine markup limits
// e,g, If mku is 10 and quality is 100 then you can markup prices by 100/10 = 10 // e,g, If mku is 10 and quality is 100 then you can markup prices by 100/10 = 10
mku: number = 0; mku = 0;
// How much of this material is being bought, sold, imported and produced every second // How much of this material is being bought, sold, imported and produced every second
buy: number = 0; buy = 0;
sll: number = 0; sll = 0;
prd: number = 0; prd = 0;
imp: number = 0; imp = 0;
// Exports of this material to another warehouse/industry // Exports of this material to another warehouse/industry
exp: any[] = []; exp: any[] = [];
// Total amount of this material exported in the last cycle // Total amount of this material exported in the last cycle
totalExp: number = 0; totalExp = 0;
// Cost / sec to buy this material. AKA Market Price // Cost / sec to buy this material. AKA Market Price
bCost: number = 0; bCost = 0;
// Cost / sec to sell this material // Cost / sec to sell this material
sCost: number = 0; sCost = 0;
// Flags to keep track of whether production and/or sale of this material is limited // Flags to keep track of whether production and/or sale of this material is limited
// [Whether production/sale is limited, limit amount] // [Whether production/sale is limited, limit amount]
@ -64,9 +64,9 @@ export class Material {
sllman: any[] = [false, 0]; // Sale sllman: any[] = [false, 0]; // Sale
// Flags that signal whether automatic sale pricing through Market TA is enabled // Flags that signal whether automatic sale pricing through Market TA is enabled
marketTa1: boolean = false; marketTa1 = false;
marketTa2: boolean = false; marketTa2 = false;
marketTa2Price: number = 0; marketTa2Price = 0;
constructor(params: IConstructorParams = {}) { constructor(params: IConstructorParams = {}) {
if (params.name) { this.name = params.name; } if (params.name) { this.name = params.name; }
@ -166,7 +166,7 @@ export class Material {
const compChange: number = 1 + compVolatility; const compChange: number = 1 + compVolatility;
if (Math.random() < 0.5) { if (Math.random() < 0.5) {
this.cmp *= compChange; this.cmp *= compChange;
if (this.cmp > this.cmpR[1]) {this.cmp = this.cmpR[1]}; if (this.cmp > this.cmpR[1]) {this.cmp = this.cmpR[1]}
this.bCost *= (1 / priceChange); // Competition increases, so price goes down this.bCost *= (1 / priceChange); // Competition increases, so price goes down
} else { } else {
this.cmp *= (1 / compChange); this.cmp *= (1 / compChange);

@ -48,43 +48,43 @@ export class Product {
} }
// Product name // Product name
name: string = ""; name = "";
// The demand for this Product in the market. Gradually decreases // The demand for this Product in the market. Gradually decreases
dmd: number = 0; dmd = 0;
// How much competition there is in the market for this Product // How much competition there is in the market for this Product
cmp: number = 0; cmp = 0;
// Markup. Affects how high of a price you can charge for this Product // Markup. Affects how high of a price you can charge for this Product
// without suffering a loss in the # of sales // without suffering a loss in the # of sales
mku: number = 0; mku = 0;
// Production cost - estimation of how much money it costs to make this Product // Production cost - estimation of how much money it costs to make this Product
pCost: number = 0; pCost = 0;
// Sell cost // Sell cost
sCost: number = 0; sCost = 0;
// Variables for handling the creation process of this Product // Variables for handling the creation process of this Product
fin: boolean = false; // Whether this Product has finished being created fin = false; // Whether this Product has finished being created
prog: number = 0; // Creation progress - A number betwee 0-100 representing percentage prog = 0; // Creation progress - A number betwee 0-100 representing percentage
createCity: string = ""; // City in which the product is/was being created createCity = ""; // City in which the product is/was being created
designCost: number = 0; // How much money was invested into designing this Product designCost = 0; // How much money was invested into designing this Product
advCost: number = 0; // How much money was invested into advertising this Product advCost = 0; // How much money was invested into advertising this Product
// Aggregate score for this Product's 'rating' // Aggregate score for this Product's 'rating'
// This is based on the stats/properties below. The weighting of the // This is based on the stats/properties below. The weighting of the
// stats/properties below differs between different industries // stats/properties below differs between different industries
rat: number = 0; rat = 0;
// Stats/properties of this Product // Stats/properties of this Product
qlt: number = 0; qlt = 0;
per: number = 0; per = 0;
dur: number = 0; dur = 0;
rel: number = 0; rel = 0;
aes: number = 0; aes = 0;
fea: number = 0; fea = 0;
// Data refers to the production, sale, and quantity of the products // Data refers to the production, sale, and quantity of the products
// These values are specific to a city // These values are specific to a city
@ -93,11 +93,11 @@ export class Product {
// Location of this Product // Location of this Product
// Only applies for location-based products like restaurants/hospitals // Only applies for location-based products like restaurants/hospitals
loc: string = ""; loc = "";
// How much space 1 unit of the Product takes (in the warehouse) // How much space 1 unit of the Product takes (in the warehouse)
// Not applicable for all Products // Not applicable for all Products
siz: number = 0; siz = 0;
// Material requirements. An object that maps the name of a material to how much it requires // Material requirements. An object that maps the name of a material to how much it requires
// to make 1 unit of the product. // to make 1 unit of the product.
@ -110,8 +110,8 @@ export class Product {
sllman: IMap<any[]> = createCityMap<any[]>([false, 0]); sllman: IMap<any[]> = createCityMap<any[]>([false, 0]);
// Flags that signal whether automatic sale pricing through Market TA is enabled // Flags that signal whether automatic sale pricing through Market TA is enabled
marketTa1: boolean = false; marketTa1 = false;
marketTa2: boolean = false; marketTa2 = false;
marketTa2Price: IMap<number> = createCityMap<number>(0); marketTa2Price: IMap<number> = createCityMap<number>(0);
constructor(params: IConstructorParams={}) { constructor(params: IConstructorParams={}) {
@ -135,7 +135,7 @@ export class Product {
// empWorkMult is a multiplier that increases progress rate based on // empWorkMult is a multiplier that increases progress rate based on
// productivity of employees // productivity of employees
createProduct(marketCycles: number=1, empWorkMult: number=1): void { createProduct(marketCycles=1, empWorkMult=1): void {
if (this.fin) { return; } if (this.fin) { return; }
this.prog += (marketCycles * .01 * empWorkMult); this.prog += (marketCycles * .01 * empWorkMult);
} }
@ -145,18 +145,18 @@ export class Product {
this.fin = true; this.fin = true;
//Calculate properties //Calculate properties
var progrMult = this.prog / 100; const progrMult = this.prog / 100;
const engrRatio = employeeProd[EmployeePositions.Engineer] / employeeProd["total"]; const engrRatio = employeeProd[EmployeePositions.Engineer] / employeeProd["total"];
const mgmtRatio = employeeProd[EmployeePositions.Management] / employeeProd["total"]; const mgmtRatio = employeeProd[EmployeePositions.Management] / employeeProd["total"];
const rndRatio = employeeProd[EmployeePositions.RandD] / employeeProd["total"]; const rndRatio = employeeProd[EmployeePositions.RandD] / employeeProd["total"];
const opsRatio = employeeProd[EmployeePositions.Operations] / employeeProd["total"]; const opsRatio = employeeProd[EmployeePositions.Operations] / employeeProd["total"];
const busRatio = employeeProd[EmployeePositions.Business] / employeeProd["total"]; const busRatio = employeeProd[EmployeePositions.Business] / employeeProd["total"];
var designMult = 1 + (Math.pow(this.designCost, 0.1) / 100); const designMult = 1 + (Math.pow(this.designCost, 0.1) / 100);
var balanceMult = (1.2 * engrRatio) + (0.9 * mgmtRatio) + (1.3 * rndRatio) + const balanceMult = (1.2 * engrRatio) + (0.9 * mgmtRatio) + (1.3 * rndRatio) +
(1.5 * opsRatio) + (busRatio); (1.5 * opsRatio) + (busRatio);
var sciMult = 1 + (Math.pow(industry.sciResearch.qty, industry.sciFac) / 800); const sciMult = 1 + (Math.pow(industry.sciResearch.qty, industry.sciFac) / 800);
var totalMult = progrMult * balanceMult * designMult * sciMult; const totalMult = progrMult * balanceMult * designMult * sciMult;
this.qlt = totalMult * ((0.10 * employeeProd[EmployeePositions.Engineer]) + this.qlt = totalMult * ((0.10 * employeeProd[EmployeePositions.Engineer]) +
(0.05 * employeeProd[EmployeePositions.Management]) + (0.05 * employeeProd[EmployeePositions.Management]) +
@ -189,7 +189,7 @@ export class Product {
(0.05 * employeeProd[EmployeePositions.Operations]) + (0.05 * employeeProd[EmployeePositions.Operations]) +
(0.05 * employeeProd[EmployeePositions.Business])); (0.05 * employeeProd[EmployeePositions.Business]));
this.calculateRating(industry); this.calculateRating(industry);
var advMult = 1 + (Math.pow(this.advCost, 0.1) / 100); const advMult = 1 + (Math.pow(this.advCost, 0.1) / 100);
this.mku = 100 / (advMult * Math.pow((this.qlt + 0.001), 0.65) * (busRatio + mgmtRatio)); this.mku = 100 / (advMult * Math.pow((this.qlt + 0.001), 0.65) * (busRatio + mgmtRatio));
this.dmd = industry.awareness === 0 ? 20 : Math.min(100, advMult * (100 * (industry.popularity / industry.awareness))); this.dmd = industry.awareness === 0 ? 20 : Math.min(100, advMult * (100 * (industry.popularity / industry.awareness)));
this.cmp = getRandomInt(0, 70); this.cmp = getRandomInt(0, 70);

@ -73,5 +73,5 @@ export const ProductRatingWeights: IMap<object> = {
Reliability: 0.1, Reliability: 0.1,
Aesthetics: 0.35, Aesthetics: 0.35,
Features: 0.1, Features: 0.1,
} },
} }

@ -16,25 +16,25 @@ export interface IConstructorParams {
export class Research { export class Research {
// Name of research. This will be used to identify researches in the Research Tree // Name of research. This will be used to identify researches in the Research Tree
name: string = ""; name = "";
// How much scientific research it costs to unlock this // How much scientific research it costs to unlock this
cost: number = 0; cost = 0;
// Description of what the Research does // Description of what the Research does
desc: string = ""; desc = "";
// All possible generic upgrades for the company, in the form of multipliers // All possible generic upgrades for the company, in the form of multipliers
advertisingMult: number = 1; advertisingMult = 1;
employeeChaMult: number = 1; employeeChaMult = 1;
employeeCreMult: number = 1; employeeCreMult = 1;
employeeEffMult: number = 1; employeeEffMult = 1;
employeeIntMult: number = 1; employeeIntMult = 1;
productionMult: number = 1; productionMult = 1;
productProductionMult: number = 1; productProductionMult = 1;
salesMult: number = 1; salesMult = 1;
sciResearchMult: number = 1; sciResearchMult = 1;
storageMult: number = 1; storageMult = 1;
constructor(p: IConstructorParams={name: "", cost: 0, desc: ""}) { constructor(p: IConstructorParams={name: "", cost: 0, desc: ""}) {
this.name = p.name; this.name = p.name;

@ -5,7 +5,7 @@ import { Research,
import { researchMetadata } from "./data/ResearchMetadata"; import { researchMetadata } from "./data/ResearchMetadata";
import { IMap } from "../types"; import { IMap } from "../types";
export let ResearchMap: IMap<Research> = {}; export const ResearchMap: IMap<Research> = {};
function addResearch(p: IConstructorParams) { function addResearch(p: IConstructorParams) {
if (ResearchMap[p.name] != null) { if (ResearchMap[p.name] != null) {

@ -26,10 +26,10 @@ export class Node {
// How much Scientific Research is needed for this // How much Scientific Research is needed for this
// Necessary to show it on the UI // Necessary to show it on the UI
cost: number = 0; cost = 0;
// Whether or not this Research has been unlocked // Whether or not this Research has been unlocked
researched: boolean = false; researched = false;
// Parent node in the tree // Parent node in the tree
// The parent node defines the prerequisite Research (there can only be one) // The parent node defines the prerequisite Research (there can only be one)
@ -37,7 +37,7 @@ export class Node {
parent: Node | null = null; parent: Node | null = null;
// Name of the Research held in this Node // Name of the Research held in this Node
text: string = ""; text = "";
constructor(p: IConstructorParams = {cost: 0, text: ""}) { constructor(p: IConstructorParams = {cost: 0, text: ""}) {
if (ResearchMap[p.text] == null) { if (ResearchMap[p.text] == null) {
@ -70,7 +70,7 @@ export class Node {
} }
// Determine what css class this Node should have in the diagram // Determine what css class this Node should have in the diagram
let htmlClass: string = ""; let htmlClass = "";
if (this.researched) { if (this.researched) {
htmlClass = "researched"; htmlClass = "researched";
} else if (this.parent && this.parent.researched === false) { } else if (this.parent && this.parent.researched === false) {
@ -205,7 +205,7 @@ export class ResearchTree {
// Helper function for all the multiplier getter fns // Helper function for all the multiplier getter fns
getMultiplierHelper(propName: string): number { getMultiplierHelper(propName: string): number {
let res: number = 1; let res = 1;
if (this.root == null) { return res; } if (this.root == null) { return res; }
const queue: Node[] = []; const queue: Node[] = [];

@ -26,10 +26,10 @@ export class Warehouse {
// Text that describes how the space in this Warehouse is being used // Text that describes how the space in this Warehouse is being used
// Used to create a tooltip in the UI // Used to create a tooltip in the UI
breakdown: string = ""; breakdown = "";
// Warehouse's level, which affects its maximum size // Warehouse's level, which affects its maximum size
level: number = 1; level = 1;
// City that this Warehouse is in // City that this Warehouse is in
loc: string; loc: string;
@ -41,19 +41,19 @@ export class Warehouse {
size: number; size: number;
// Amount of space currently used by warehouse // Amount of space currently used by warehouse
sizeUsed: number = 0; sizeUsed = 0;
// Whether Smart Supply is enabled for this Industry (the Industry that this Warehouse is for) // Whether Smart Supply is enabled for this Industry (the Industry that this Warehouse is for)
smartSupplyEnabled: boolean = false; smartSupplyEnabled = false;
// Flag that indicates whether Smart Supply accounts for imports when calculating // Flag that indicates whether Smart Supply accounts for imports when calculating
// the amount fo purchase // the amount fo purchase
smartSupplyConsiderExports: boolean = false; smartSupplyConsiderExports = false;
// Stores the amount of product to be produced. Used for Smart Supply unlock. // Stores the amount of product to be produced. Used for Smart Supply unlock.
// The production tracked by smart supply is always based on the previous cycle, // The production tracked by smart supply is always based on the previous cycle,
// so it will always trail the "true" production by 1 cycle // so it will always trail the "true" production by 1 cycle
smartSupplyStore: number = 0; smartSupplyStore = 0;
constructor(params: IConstructorParams = {}) { constructor(params: IConstructorParams = {}) {
this.loc = params.loc ? params.loc : ""; this.loc = params.loc ? params.loc : "";
@ -70,7 +70,7 @@ export class Warehouse {
Drugs: new Material({name: "Drugs"}), Drugs: new Material({name: "Drugs"}),
Robots: new Material({name: "Robots"}), Robots: new Material({name: "Robots"}),
AICores: new Material({name: "AI Cores"}), AICores: new Material({name: "AI Cores"}),
RealEstate: new Material({name: "Real Estate"}) RealEstate: new Material({name: "Real Estate"}),
} }
if (params.corp && params.industry) { if (params.corp && params.industry) {
@ -83,7 +83,7 @@ export class Warehouse {
this.sizeUsed = 0; this.sizeUsed = 0;
this.breakdown = ""; this.breakdown = "";
for (const matName in this.materials) { for (const matName in this.materials) {
var mat = this.materials[matName]; const mat = this.materials[matName];
if (MaterialSizes.hasOwnProperty(matName)) { if (MaterialSizes.hasOwnProperty(matName)) {
this.sizeUsed += (mat.qty * MaterialSizes[matName]); this.sizeUsed += (mat.qty * MaterialSizes[matName]);
if (mat.qty > 0) { if (mat.qty > 0) {

@ -82,7 +82,7 @@ export const researchMetadata: IConstructorParams[] = [
cost: 15e3, cost: 15e3,
desc: "Use automated software to handle the hiring of employees. With this " + desc: "Use automated software to handle the hiring of employees. With this " +
"research, each office will automatically hire one employee per " + "research, each office will automatically hire one employee per " +
"market cycle if there is available space." "market cycle if there is available space.",
}, },
{ {
@ -90,7 +90,7 @@ export const researchMetadata: IConstructorParams[] = [
cost: 20e3, cost: 20e3,
desc: "Use automated software to handle the training of employees. With this " + desc: "Use automated software to handle the training of employees. With this " +
"research, each employee hired with HRBuddy-Recruitment will automatically " + "research, each employee hired with HRBuddy-Recruitment will automatically " +
"be assigned to 'Training', rather than being unassigned." "be assigned to 'Training', rather than being unassigned.",
}, },
{ {
name: "JoyWire", name: "JoyWire",

@ -61,13 +61,13 @@ export class CorporationEventHandler {
createBribeFactionsPopup() { createBribeFactionsPopup() {
const popupId = "cmpy-mgmt-bribe-factions-popup"; const popupId = "cmpy-mgmt-bribe-factions-popup";
const txt = createElement("p", { const txt = createElement("p", {
innerText:"You can use Corporation funds or stock shares to bribe Faction Leaders in exchange for faction reputation" innerText:"You can use Corporation funds or stock shares to bribe Faction Leaders in exchange for faction reputation",
}); });
const factionSelector = createElement("select", { margin:"3px" }); const factionSelector = createElement("select", { margin:"3px" });
for (let i = 0; i < Player.factions.length; ++i) { for (let i = 0; i < Player.factions.length; ++i) {
const facName = Player.factions[i]; const facName = Player.factions[i];
factionSelector.add(createElement("option", { factionSelector.add(createElement("option", {
text: facName, value: facName text: facName, value: facName,
})); }));
} }
var repGainText = createElement("p"); var repGainText = createElement("p");
@ -93,7 +93,7 @@ export class CorporationEventHandler {
factionSelector.options[factionSelector.selectedIndex].value + factionSelector.options[factionSelector.selectedIndex].value +
" with this bribe"; " with this bribe";
} }
} },
}); });
stockSharesInput = createElement("input", { stockSharesInput = createElement("input", {
type:"number", placeholder:"Stock Shares", margin: "5px", type:"number", placeholder:"Stock Shares", margin: "5px",
@ -115,7 +115,7 @@ export class CorporationEventHandler {
factionSelector.options[factionSelector.selectedIndex].value + factionSelector.options[factionSelector.selectedIndex].value +
" with this bribe"; " with this bribe";
} }
} },
}); });
var confirmButton = createElement("button", { var confirmButton = createElement("button", {
class:"a-link-button", innerText:"Bribe", display:"inline-block", class:"a-link-button", innerText:"Bribe", display:"inline-block",
@ -145,7 +145,7 @@ export class CorporationEventHandler {
removeElementById(popupId); removeElementById(popupId);
return false; return false;
} }
} },
}); });
const cancelButton = createPopupCloseButton(popupId, { const cancelButton = createPopupCloseButton(popupId, {
class: "std-button", class: "std-button",
@ -187,7 +187,7 @@ export class CorporationEventHandler {
costIndicator.innerText = "Purchase " + numShares + " shares for a total of " + costIndicator.innerText = "Purchase " + numShares + " shares for a total of " +
numeralWrapper.format(numShares * buybackPrice, '$0.000a'); numeralWrapper.format(numShares * buybackPrice, '$0.000a');
} }
} },
}); });
var confirmBtn = createElement("button", { var confirmBtn = createElement("button", {
class:"a-link-button", innerText:"Buy shares", display:"inline-block", class:"a-link-button", innerText:"Buy shares", display:"inline-block",
@ -221,7 +221,7 @@ export class CorporationEventHandler {
} }
return false; return false;
} },
}); });
var cancelBtn = createPopupCloseButton(popupId, { var cancelBtn = createPopupCloseButton(popupId, {
class: "std-button", class: "std-button",
@ -249,7 +249,7 @@ export class CorporationEventHandler {
removeElementById(popupId); removeElementById(popupId);
this.rerender(); this.rerender();
return false; return false;
} },
}); });
const cancelBtn = createPopupCloseButton(popupId, { innerText: "Cancel" }); const cancelBtn = createPopupCloseButton(popupId, { innerText: "Cancel" });
@ -264,7 +264,7 @@ export class CorporationEventHandler {
const exportTxt = createElement("p", { const exportTxt = createElement("p", {
innerText:"Select the industry and city to export this material to, as well as " + innerText:"Select the industry and city to export this material to, as well as " +
"how much of this material to export per second. You can set the export " + "how much of this material to export per second. You can set the export " +
"amount to 'MAX' to export all of the materials in this warehouse." "amount to 'MAX' to export all of the materials in this warehouse.",
}); });
//Select industry and city to export to //Select industry and city to export to
@ -286,7 +286,7 @@ export class CorporationEventHandler {
return; return;
} }
} }
} },
}); });
for (let i = 0; i < corp.divisions.length; ++i) { for (let i = 0; i < corp.divisions.length; ++i) {
@ -299,7 +299,7 @@ export class CorporationEventHandler {
//Select amount to export //Select amount to export
const exportAmount = createElement("input", { const exportAmount = createElement("input", {
class: "text-input", class: "text-input",
placeholder:"Export amount / s" placeholder:"Export amount / s",
}); });
const exportBtn = createElement("button", { const exportBtn = createElement("button", {
@ -328,14 +328,14 @@ export class CorporationEventHandler {
mat.exp.push(exportObj); mat.exp.push(exportObj);
removeElementById(popupId); removeElementById(popupId);
return false; return false;
} },
}); });
const cancelBtn = createPopupCloseButton(popupId, { innerText: "Cancel" }); const cancelBtn = createPopupCloseButton(popupId, { innerText: "Cancel" });
const currExportsText = createElement("p", { const currExportsText = createElement("p", {
innerText:"Below is a list of all current exports of this material from this warehouse. " + innerText:"Below is a list of all current exports of this material from this warehouse. " +
"Clicking on one of the exports below will REMOVE that export." "Clicking on one of the exports below will REMOVE that export.",
}); });
const currExports = []; const currExports = [];
for (var i = 0; i < mat.exp.length; ++i) { for (var i = 0; i < mat.exp.length; ++i) {
@ -349,7 +349,7 @@ export class CorporationEventHandler {
mat.exp.splice(i, 1); //Remove export object mat.exp.splice(i, 1); //Remove export object
removeElementById(popupId); removeElementById(popupId);
createExportMaterialPopup(mat); createExportMaterialPopup(mat);
} },
})); }));
})(i, mat, currExports); })(i, mat, currExports);
} }
@ -385,7 +385,7 @@ export class CorporationEventHandler {
onkeyup: (e) => { onkeyup: (e) => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === KEY.ENTER) {allocateBtn.click();} if (e.keyCode === KEY.ENTER) {allocateBtn.click();}
} },
}); });
allocateBtn = createElement("button", { allocateBtn = createElement("button", {
@ -404,7 +404,7 @@ export class CorporationEventHandler {
this.rerender(); this.rerender();
return false; return false;
} },
}); });
const cancelBtn = createPopupCloseButton(popupId, { const cancelBtn = createPopupCloseButton(popupId, {
@ -478,7 +478,7 @@ export class CorporationEventHandler {
} else { } else {
updateDynamicText(this.corp); updateDynamicText(this.corp);
} }
} },
}); });
issueBtn = createElement("button", { issueBtn = createElement("button", {
@ -523,7 +523,7 @@ export class CorporationEventHandler {
this.rerender(); this.rerender();
return false; return false;
} },
}); });
const cancelBtn = createPopupCloseButton(popupId, { const cancelBtn = createPopupCloseButton(popupId, {
@ -541,7 +541,7 @@ export class CorporationEventHandler {
const popupId = "cmpy-mgmt-limit-product-production-popup"; const popupId = "cmpy-mgmt-limit-product-production-popup";
const txt = createElement("p", { const txt = createElement("p", {
innerText:"Enter a limit to the amount of this product you would " + innerText:"Enter a limit to the amount of this product you would " +
"like to product per second. Leave the box empty to set no limit." "like to product per second. Leave the box empty to set no limit.",
}); });
let confirmBtn; let confirmBtn;
const input = createElement("input", { const input = createElement("input", {
@ -551,7 +551,7 @@ export class CorporationEventHandler {
onkeyup: (e) => { onkeyup: (e) => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === KEY.ENTER) { confirmBtn.click(); } if (e.keyCode === KEY.ENTER) { confirmBtn.click(); }
} },
}); });
confirmBtn = createElement("button", { confirmBtn = createElement("button", {
class: "std-button", class: "std-button",
@ -578,7 +578,7 @@ export class CorporationEventHandler {
removeElementById(popupId); removeElementById(popupId);
this.rerender(); this.rerender();
return false; return false;
} },
}); });
const cancelBtn = createPopupCloseButton(popupId, { innerText: "Cancel" }); const cancelBtn = createPopupCloseButton(popupId, { innerText: "Cancel" });
cancelBtn.style.margin = "6px"; cancelBtn.style.margin = "6px";
@ -600,7 +600,7 @@ export class CorporationEventHandler {
if (division.offices[cityName] instanceof OfficeSpace) { if (division.offices[cityName] instanceof OfficeSpace) {
designCity.add(createElement("option", { designCity.add(createElement("option", {
value: cityName, value: cityName,
text: cityName text: cityName,
})); }));
} }
} }
@ -630,7 +630,7 @@ export class CorporationEventHandler {
onkeyup: (e) => { onkeyup: (e) => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === KEY.ENTER) { confirmBtn.click(); } if (e.keyCode === KEY.ENTER) { confirmBtn.click(); }
} },
}); });
confirmBtn = createElement("button", { confirmBtn = createElement("button", {
class: "std-button", class: "std-button",
@ -665,7 +665,7 @@ export class CorporationEventHandler {
} }
this.rerender(); this.rerender();
return false; return false;
} },
}) })
const cancelBtn = createPopupCloseButton(popupId, { const cancelBtn = createPopupCloseButton(popupId, {
class: "std-button", class: "std-button",
@ -699,7 +699,7 @@ export class CorporationEventHandler {
for: useTa1AutoSaleId, for: useTa1AutoSaleId,
innerText: "Use Market-TA.I for Auto-Sale Price", innerText: "Use Market-TA.I for Auto-Sale Price",
tooltip: "If this is enabled, then this Material will automatically " + tooltip: "If this is enabled, then this Material will automatically " +
"be sold at the price identified by Market-TA.I (i.e. the price shown above)" "be sold at the price identified by Market-TA.I (i.e. the price shown above)",
}) })
const useTa1AutoSaleCheckbox = createElement("input", { const useTa1AutoSaleCheckbox = createElement("input", {
checked: mat.marketTa1, checked: mat.marketTa1,
@ -708,7 +708,7 @@ export class CorporationEventHandler {
type: "checkbox", type: "checkbox",
changeListener: (e) => { changeListener: (e) => {
mat.marketTa1 = e.target.checked; mat.marketTa1 = e.target.checked;
} },
}); });
useTa1AutoSaleDiv.appendChild(useTa1AutoSaleLabel); useTa1AutoSaleDiv.appendChild(useTa1AutoSaleLabel);
useTa1AutoSaleDiv.appendChild(useTa1AutoSaleCheckbox); useTa1AutoSaleDiv.appendChild(useTa1AutoSaleCheckbox);
@ -766,7 +766,7 @@ export class CorporationEventHandler {
tooltip: "If this is enabled, then this Material will automatically " + tooltip: "If this is enabled, then this Material will automatically " +
"be sold at the optimal price such that the amount sold matches the " + "be sold at the optimal price such that the amount sold matches the " +
"amount produced. (i.e. the highest possible price, while still ensuring " + "amount produced. (i.e. the highest possible price, while still ensuring " +
" that all produced materials will be sold)" " that all produced materials will be sold)",
}) })
const useTa2AutoSaleCheckbox = createElement("input", { const useTa2AutoSaleCheckbox = createElement("input", {
checked: mat.marketTa2, checked: mat.marketTa2,
@ -775,14 +775,14 @@ export class CorporationEventHandler {
type: "checkbox", type: "checkbox",
changeListener: (e) => { changeListener: (e) => {
mat.marketTa2 = e.target.checked; mat.marketTa2 = e.target.checked;
} },
}); });
useTa2AutoSaleDiv.appendChild(useTa2AutoSaleLabel); useTa2AutoSaleDiv.appendChild(useTa2AutoSaleLabel);
useTa2AutoSaleDiv.appendChild(useTa2AutoSaleCheckbox); useTa2AutoSaleDiv.appendChild(useTa2AutoSaleCheckbox);
const ta2OverridesTa1 = createElement("p", { const ta2OverridesTa1 = createElement("p", {
innerText: "Note that Market-TA.II overrides Market-TA.I. This means that if " + innerText: "Note that Market-TA.II overrides Market-TA.I. This means that if " +
"both are enabled, then Market-TA.II will take effect, not Market-TA.I" "both are enabled, then Market-TA.II will take effect, not Market-TA.I",
}); });
createPopup(popupId, [ta1, useTa1AutoSaleDiv, ta2Text, ta2Input, useTa2AutoSaleDiv, ta2OverridesTa1, closeBtn]); createPopup(popupId, [ta1, useTa1AutoSaleDiv, ta2Text, ta2Input, useTa2AutoSaleDiv, ta2OverridesTa1, closeBtn]);
@ -805,7 +805,7 @@ export class CorporationEventHandler {
if (!(division.offices[cityName] instanceof OfficeSpace)) { if (!(division.offices[cityName] instanceof OfficeSpace)) {
citySelector.add(createElement("option", { citySelector.add(createElement("option", {
text: cityName, text: cityName,
value: cityName value: cityName,
})); }));
} }
} }
@ -832,7 +832,7 @@ export class CorporationEventHandler {
removeElementById(popupId); removeElementById(popupId);
this.rerender(); this.rerender();
return false; return false;
} },
}); });
const cancelBtn = createPopupCloseButton(popupId, { const cancelBtn = createPopupCloseButton(popupId, {
class: "std-button", class: "std-button",
@ -852,7 +852,7 @@ export class CorporationEventHandler {
innerHTML: "Create a new division to expand into a new industry:", innerHTML: "Create a new division to expand into a new industry:",
}); });
var selector = createElement("select", { var selector = createElement("select", {
class:"dropdown" class:"dropdown",
}); });
var industryDescription = createElement("p", {}); var industryDescription = createElement("p", {});
var yesBtn; var yesBtn;
@ -866,11 +866,11 @@ export class CorporationEventHandler {
onkeyup:(e)=>{ onkeyup:(e)=>{
e.preventDefault(); e.preventDefault();
if (e.keyCode === KEY.ENTER) {yesBtn.click();} if (e.keyCode === KEY.ENTER) {yesBtn.click();}
} },
}); });
var nameLabel = createElement("label", { var nameLabel = createElement("label", {
for:"cmpy-mgmt-expand-industry-name-input", for:"cmpy-mgmt-expand-industry-name-input",
innerText:"Division name: " innerText:"Division name: ",
}); });
yesBtn = createElement("span", { yesBtn = createElement("span", {
class:"popup-box-button", class:"popup-box-button",
@ -905,7 +905,7 @@ export class CorporationEventHandler {
this.rerender(); this.rerender();
} }
return false; return false;
} },
}); });
const noBtn = createPopupCloseButton(popupId, { const noBtn = createPopupCloseButton(popupId, {
@ -923,7 +923,7 @@ export class CorporationEventHandler {
// Have Agriculture be first as recommended option // Have Agriculture be first as recommended option
if (!ownedIndustries["Agriculture"]) { if (!ownedIndustries["Agriculture"]) {
selector.add(createElement("option", { selector.add(createElement("option", {
text:Industries["Agriculture"], value:"Agriculture" text:Industries["Agriculture"], value:"Agriculture",
})); }));
} }
@ -984,7 +984,7 @@ export class CorporationEventHandler {
for: useTa1AutoSaleId, for: useTa1AutoSaleId,
innerText: "Use Market-TA.I for Auto-Sale Price", innerText: "Use Market-TA.I for Auto-Sale Price",
tooltip: "If this is enabled, then this Product will automatically " + tooltip: "If this is enabled, then this Product will automatically " +
"be sold at the price identified by Market-TA.I (i.e. the price shown above)" "be sold at the price identified by Market-TA.I (i.e. the price shown above)",
}) })
const useTa1AutoSaleCheckbox = createElement("input", { const useTa1AutoSaleCheckbox = createElement("input", {
checked: product.marketTa1, checked: product.marketTa1,
@ -993,7 +993,7 @@ export class CorporationEventHandler {
type: "checkbox", type: "checkbox",
changeListener: (e) => { changeListener: (e) => {
product.marketTa1 = e.target.checked; product.marketTa1 = e.target.checked;
} },
}); });
useTa1AutoSaleDiv.appendChild(useTa1AutoSaleLabel); useTa1AutoSaleDiv.appendChild(useTa1AutoSaleLabel);
useTa1AutoSaleDiv.appendChild(useTa1AutoSaleCheckbox); useTa1AutoSaleDiv.appendChild(useTa1AutoSaleCheckbox);
@ -1043,7 +1043,7 @@ export class CorporationEventHandler {
tooltip: "If this is enabled, then this Product will automatically " + tooltip: "If this is enabled, then this Product will automatically " +
"be sold at the optimal price such that the amount sold matches the " + "be sold at the optimal price such that the amount sold matches the " +
"amount produced. (i.e. the highest possible price, while still ensuring " + "amount produced. (i.e. the highest possible price, while still ensuring " +
" that all produced materials will be sold)" " that all produced materials will be sold)",
}) })
const useTa2AutoSaleCheckbox = createElement("input", { const useTa2AutoSaleCheckbox = createElement("input", {
checked: product.marketTa2, checked: product.marketTa2,
@ -1052,14 +1052,14 @@ export class CorporationEventHandler {
type: "checkbox", type: "checkbox",
changeListener: (e) => { changeListener: (e) => {
product.marketTa2 = e.target.checked; product.marketTa2 = e.target.checked;
} },
}); });
useTa2AutoSaleDiv.appendChild(useTa2AutoSaleLabel); useTa2AutoSaleDiv.appendChild(useTa2AutoSaleLabel);
useTa2AutoSaleDiv.appendChild(useTa2AutoSaleCheckbox); useTa2AutoSaleDiv.appendChild(useTa2AutoSaleCheckbox);
const ta2OverridesTa1 = createElement("p", { const ta2OverridesTa1 = createElement("p", {
innerText: "Note that Market-TA.II overrides Market-TA.I. This means that if " + innerText: "Note that Market-TA.II overrides Market-TA.I. This means that if " +
"both are enabled, then Market-TA.II will take effect, not Market-TA.I" "both are enabled, then Market-TA.II will take effect, not Market-TA.I",
}); });
createPopup(popupId, [ta1, useTa1AutoSaleDiv, ta2Text, ta2Input, useTa2AutoSaleDiv, ta2OverridesTa1, closeBtn]); createPopup(popupId, [ta1, useTa1AutoSaleDiv, ta2Text, ta2Input, useTa2AutoSaleDiv, ta2OverridesTa1, closeBtn]);
@ -1076,7 +1076,7 @@ export class CorporationEventHandler {
const purchasePopupId = "cmpy-mgmt-material-purchase-popup"; const purchasePopupId = "cmpy-mgmt-material-purchase-popup";
const txt = createElement("p", { const txt = createElement("p", {
innerHTML: "Enter the amount of " + mat.name + " you would like " + innerHTML: "Enter the amount of " + mat.name + " you would like " +
"to purchase per second. This material's cost changes constantly" "to purchase per second. This material's cost changes constantly",
}); });
let confirmBtn; let confirmBtn;
let input = createElement("input", { let input = createElement("input", {
@ -1087,7 +1087,7 @@ export class CorporationEventHandler {
onkeyup: (e) => { onkeyup: (e) => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === KEY.ENTER) {confirmBtn.click();} if (e.keyCode === KEY.ENTER) {confirmBtn.click();}
} },
}); });
confirmBtn = createElement("button", { confirmBtn = createElement("button", {
innerText: "Confirm", class: "std-button", innerText: "Confirm", class: "std-button",
@ -1101,7 +1101,7 @@ export class CorporationEventHandler {
this.rerender(); this.rerender();
return false; return false;
} }
} },
}); });
const clearButton = createElement("button", { const clearButton = createElement("button", {
innerText: "Clear Purchase", class: "std-button", innerText: "Clear Purchase", class: "std-button",
@ -1110,7 +1110,7 @@ export class CorporationEventHandler {
removeElementById(purchasePopupId); removeElementById(purchasePopupId);
this.rerender(); this.rerender();
return false; return false;
} },
}); });
const cancelBtn = createPopupCloseButton(purchasePopupId, { const cancelBtn = createPopupCloseButton(purchasePopupId, {
class: "std-button", class: "std-button",
@ -1153,7 +1153,7 @@ export class CorporationEventHandler {
e.preventDefault(); e.preventDefault();
updateBulkPurchaseText(e.target.value); updateBulkPurchaseText(e.target.value);
if (e.keyCode === KEY.ENTER) {bulkPurchaseConfirmBtn.click();} if (e.keyCode === KEY.ENTER) {bulkPurchaseConfirmBtn.click();}
} },
}); });
bulkPurchaseConfirmBtn = createElement("button", { bulkPurchaseConfirmBtn = createElement("button", {
@ -1184,7 +1184,7 @@ export class CorporationEventHandler {
removeElementById(purchasePopupId); removeElementById(purchasePopupId);
return false; return false;
} }
} },
}) })
elems.push(bulkPurchaseInfo); elems.push(bulkPurchaseInfo);
@ -1224,7 +1224,7 @@ export class CorporationEventHandler {
onkeyup: (e) => { onkeyup: (e) => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === KEY.ENTER) {confirmBtn.click();} if (e.keyCode === KEY.ENTER) {confirmBtn.click();}
} },
}); });
let inputButtonInitValue = mat.sCost ? mat.sCost : null; let inputButtonInitValue = mat.sCost ? mat.sCost : null;
@ -1241,7 +1241,7 @@ export class CorporationEventHandler {
onkeyup: (e) => { onkeyup: (e) => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === KEY.ENTER) {confirmBtn.click();} if (e.keyCode === KEY.ENTER) {confirmBtn.click();}
} },
}); });
confirmBtn = createElement("button", { confirmBtn = createElement("button", {
class: "std-button", class: "std-button",
@ -1307,7 +1307,7 @@ export class CorporationEventHandler {
removeElementById(sellPopupId); removeElementById(sellPopupId);
this.rerender(); this.rerender();
return false; return false;
} },
}); });
const cancelBtn = createPopupCloseButton(sellPopupId, { const cancelBtn = createPopupCloseButton(sellPopupId, {
class: "std-button", class: "std-button",
@ -1347,7 +1347,7 @@ export class CorporationEventHandler {
onkeyup: (e) => { onkeyup: (e) => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === KEY.ENTER) {confirmBtn.click();} if (e.keyCode === KEY.ENTER) {confirmBtn.click();}
} },
}); });
let inputButtonInitValue = product.sCost ? product.sCost : null; let inputButtonInitValue = product.sCost ? product.sCost : null;
@ -1365,7 +1365,7 @@ export class CorporationEventHandler {
onkeyup: (e) => { onkeyup: (e) => {
e.preventDefault(); e.preventDefault();
if (e.keyCode === KEY.ENTER) {confirmBtn.click();} if (e.keyCode === KEY.ENTER) {confirmBtn.click();}
} },
}); });
const checkboxDiv = createElement("div", { const checkboxDiv = createElement("div", {
border: "1px solid white", border: "1px solid white",
@ -1478,7 +1478,7 @@ export class CorporationEventHandler {
removeElementById(popupId); removeElementById(popupId);
this.rerender(); this.rerender();
return false; return false;
} },
}); });
const cancelBtn = createPopupCloseButton(popupId, { class: "std-button" }); const cancelBtn = createPopupCloseButton(popupId, { class: "std-button" });
@ -1520,7 +1520,7 @@ export class CorporationEventHandler {
profitIndicator.innerText = "Sell " + numShares + " shares for a total of " + profitIndicator.innerText = "Sell " + numShares + " shares for a total of " +
numeralWrapper.format(profit, '$0.000a'); numeralWrapper.format(profit, '$0.000a');
} }
} },
}); });
const confirmBtn = createElement("button", { const confirmBtn = createElement("button", {
class:"a-link-button", innerText:"Sell shares", display:"inline-block", class:"a-link-button", innerText:"Sell shares", display:"inline-block",
@ -1562,7 +1562,7 @@ export class CorporationEventHandler {
return false; return false;
} }
} },
}); });
const cancelBtn = createPopupCloseButton(popupId, { const cancelBtn = createPopupCloseButton(popupId, {
class: "std-button", class: "std-button",
@ -1579,10 +1579,10 @@ export class CorporationEventHandler {
const popupId = "cmpy-mgmt-throw-office-party-popup"; const popupId = "cmpy-mgmt-throw-office-party-popup";
const txt = createElement("p", { const txt = createElement("p", {
innerText:"Enter the amount of money you would like to spend PER EMPLOYEE " + innerText:"Enter the amount of money you would like to spend PER EMPLOYEE " +
"on this office party" "on this office party",
}); });
const totalCostTxt = createElement("p", { const totalCostTxt = createElement("p", {
innerText:"Throwing this party will cost a total of $0" innerText:"Throwing this party will cost a total of $0",
}); });
let confirmBtn; let confirmBtn;
const input = createElement("input", { const input = createElement("input", {
@ -1598,7 +1598,7 @@ export class CorporationEventHandler {
onkeyup:(e)=>{ onkeyup:(e)=>{
e.preventDefault(); e.preventDefault();
if (e.keyCode === KEY.ENTER) {confirmBtn.click();} if (e.keyCode === KEY.ENTER) {confirmBtn.click();}
} },
}); });
confirmBtn = createElement("button", { confirmBtn = createElement("button", {
class: "std-button", class: "std-button",
@ -1622,7 +1622,7 @@ export class CorporationEventHandler {
} }
} }
return false; return false;
} },
}); });
const cancelBtn = createPopupCloseButton(popupId, { class: "std-button", innerText: "Cancel" }); const cancelBtn = createPopupCloseButton(popupId, { class: "std-button", innerText: "Cancel" });
@ -1661,7 +1661,7 @@ export class CorporationEventHandler {
const upgradeCostMax = OfficeInitialCost * mult; const upgradeCostMax = OfficeInitialCost * mult;
const text = createElement("p", { const text = createElement("p", {
innerText:"Increase the size of your office space to fit additional employees!" innerText:"Increase the size of your office space to fit additional employees!",
}); });
const text2 = createElement("p", { innerText: "Upgrade size: " }); const text2 = createElement("p", { innerText: "Upgrade size: " });
@ -1680,7 +1680,7 @@ export class CorporationEventHandler {
} }
removeElementById(popupId); removeElementById(popupId);
return false; return false;
} },
}); });
const confirmBtn15 = createElement("button", { const confirmBtn15 = createElement("button", {
class: this.corp.funds.lt(upgradeCost15) ? "a-link-button-inactive" : "a-link-button", class: this.corp.funds.lt(upgradeCost15) ? "a-link-button-inactive" : "a-link-button",
@ -1697,7 +1697,7 @@ export class CorporationEventHandler {
} }
removeElementById(popupId); removeElementById(popupId);
return false; return false;
} },
}); });
const confirmBtnMax = createElement("button", { const confirmBtnMax = createElement("button", {
class:this.corp.funds.lt(upgradeCostMax) ? "a-link-button-inactive" : "a-link-button", class:this.corp.funds.lt(upgradeCostMax) ? "a-link-button-inactive" : "a-link-button",
@ -1714,7 +1714,7 @@ export class CorporationEventHandler {
} }
removeElementById(popupId); removeElementById(popupId);
return false; return false;
} },
}); });
const cancelBtn = createPopupCloseButton(popupId, { innerText: "Cancel" }); const cancelBtn = createPopupCloseButton(popupId, { innerText: "Cancel" });
cancelBtn.style.margin = "4px"; cancelBtn.style.margin = "4px";

@ -71,7 +71,7 @@ export class HeaderTabs extends BaseReactComponent {
{ {
this.renderTab({ this.renderTab({
onClick: this.eventHandler().createNewIndustryPopup.bind(this.eventHandler()), onClick: this.eventHandler().createNewIndustryPopup.bind(this.eventHandler()),
text: "Expand into new Industry" text: "Expand into new Industry",
}) })
} }
</div> </div>

@ -158,7 +158,7 @@ export class Overview extends BaseReactComponent {
onClick: findInvestorsOnClick, onClick: findInvestorsOnClick,
style: "inline-block", style: "inline-block",
text: "Find Investors", text: "Find Investors",
tooltip: findInvestorsTooltip tooltip: findInvestorsTooltip,
}); });
const goPublicBtn = this.createButton({ const goPublicBtn = this.createButton({
class: "std-button", class: "std-button",
@ -167,7 +167,7 @@ export class Overview extends BaseReactComponent {
text: "Go Public", text: "Go Public",
tooltip: "Become a publicly traded and owned entity. Going public " + tooltip: "Become a publicly traded and owned entity. Going public " +
"involves issuing shares for an IPO. Once you are a public " + "involves issuing shares for an IPO. Once you are a public " +
"company, your shares will be traded on the stock market." "company, your shares will be traded on the stock market.",
}); });
return ( return (

@ -1,6 +1,6 @@
import { IMap } from "../../types"; import { IMap } from "../../types";
export const overviewPage: string = "Overview"; export const overviewPage = "Overview";
// Interfaces for whatever's required to sanitize routing with Corporation Data // Interfaces for whatever's required to sanitize routing with Corporation Data
interface IOfficeSpace { interface IOfficeSpace {
@ -9,7 +9,7 @@ interface IOfficeSpace {
interface IDivision { interface IDivision {
name: string; name: string;
offices: IMap<IOfficeSpace> offices: IMap<IOfficeSpace>;
} }
interface ICorporation { interface ICorporation {
@ -76,7 +76,7 @@ export class CorporationRouting {
for (let i = 0; i < this.corp.divisions.length; ++i) { for (let i = 0; i < this.corp.divisions.length; ++i) {
if (this.corp.divisions[i].name === page) { if (this.corp.divisions[i].name === page) {
this.currentDivision = this.corp.divisions[i]; this.currentDivision = this.corp.divisions[i];
}; }
} }
// 'currentDivision' should not be null, since the routing is either on // 'currentDivision' should not be null, since the routing is either on

@ -22,49 +22,49 @@ export interface IConstructorParams {
export class Crime { export class Crime {
// Number representing the difficulty of the crime. Used for success chance calculations // Number representing the difficulty of the crime. Used for success chance calculations
difficulty: number = 0; difficulty = 0;
// Amount of karma lost for SUCCESSFULLY committing this crime // Amount of karma lost for SUCCESSFULLY committing this crime
karma: number = 0; karma = 0;
// How many people die as a result of this crime // How many people die as a result of this crime
kills: number = 0; kills = 0;
// How much money is given by the // How much money is given by the
money: number = 0; money = 0;
// Name of crime // Name of crime
name: string = ""; name = "";
// Milliseconds it takes to attempt the crime // Milliseconds it takes to attempt the crime
time: number = 0; time = 0;
// Corresponding type in CONSTANTS. Contains a description for the crime activity // Corresponding type in CONSTANTS. Contains a description for the crime activity
type: string = ""; type = "";
// Weighting factors that determine how stats affect the success rate of this crime // Weighting factors that determine how stats affect the success rate of this crime
hacking_success_weight: number = 0; hacking_success_weight = 0;
strength_success_weight: number = 0; strength_success_weight = 0;
defense_success_weight: number = 0; defense_success_weight = 0;
dexterity_success_weight: number = 0; dexterity_success_weight = 0;
agility_success_weight: number = 0; agility_success_weight = 0;
charisma_success_weight: number = 0; charisma_success_weight = 0;
// How much stat experience is granted by this crime // How much stat experience is granted by this crime
hacking_exp: number = 0; hacking_exp = 0;
strength_exp: number = 0; strength_exp = 0;
defense_exp: number = 0; defense_exp = 0;
dexterity_exp: number = 0; dexterity_exp = 0;
agility_exp: number = 0; agility_exp = 0;
charisma_exp: number = 0; charisma_exp = 0;
intelligence_exp: number = 0; intelligence_exp = 0;
constructor(name: string = "", constructor(name = "",
type: string = "", type = "",
time: number = 0, time = 0,
money: number = 0, money = 0,
difficulty: number = 0, difficulty = 0,
karma: number = 0, karma = 0,
params: IConstructorParams={}) { params: IConstructorParams={}) {
this.name = name; this.name = name;
this.type = type; this.type = type;
@ -91,7 +91,7 @@ export class Crime {
this.kills = params.kills ? params.kills : 0; this.kills = params.kills ? params.kills : 0;
} }
commit(p: IPlayer, div: number=1, singParams: any=null): number { commit(p: IPlayer, div=1, singParams: any=null): number {
if (div <= 0) { div = 1; } if (div <= 0) { div = 1; }
p.startCrime( p.startCrime(
this.type, this.type,
@ -103,7 +103,7 @@ export class Crime {
this.charisma_exp/div, this.charisma_exp/div,
this.money/div, this.money/div,
this.time, this.time,
singParams singParams,
); );
return this.time; return this.time;

@ -4,10 +4,10 @@ import { IPlayer } from "../PersonObjects/IPlayer";
import { dialogBoxCreate } from "../../utils/DialogBox"; import { dialogBoxCreate } from "../../utils/DialogBox";
export function determineCrimeSuccess(p: IPlayer, type: string) { export function determineCrimeSuccess(p: IPlayer, type: string) {
let chance: number = 0; let chance = 0;
let found: boolean = false; let found = false;
for (const i in Crimes) { for (const i in Crimes) {
let crime = Crimes[i]; const crime = Crimes[i];
if (crime.type == type) { if (crime.type == type) {
chance = crime.successRate(p); chance = crime.successRate(p);
found = true; found = true;

@ -3,7 +3,7 @@ import { CodingContractTypes } from "./CodingContracts";
import { import {
generateContract, generateContract,
generateRandomContract, generateRandomContract,
generateRandomContractOnHome generateRandomContractOnHome,
} from "./CodingContractGenerator"; } from "./CodingContractGenerator";
import { Companies } from "./Company/Companies"; import { Companies } from "./Company/Companies";
import { Company } from "./Company/Company"; import { Company } from "./Company/Company";
@ -47,9 +47,11 @@ class ValueAdjusterComponent extends Component {
this.state = { value: '' }; this.state = { value: '' };
this.setValue = this.setValue.bind(this); this.setValue = this.setValue.bind(this);
} }
setValue(event) { setValue(event) {
this.setState({ value: parseFloat(event.target.value) }); this.setState({ value: parseFloat(event.target.value) });
} }
render() { render() {
const { title, add, subtract, reset } = this.props; const { title, add, subtract, reset } = this.props;
const { value } = this.state; const { value } = this.state;
@ -496,7 +498,7 @@ class DevMenuComponent extends Component {
modifyBladeburnerRank(modify) { modifyBladeburnerRank(modify) {
return function(rank) { return function(rank) {
if (!!Player.bladeburner) { if (Player.bladeburner) {
Player.bladeburner.changeRank(rank*modify); Player.bladeburner.changeRank(rank*modify);
} }
} }
@ -508,67 +510,67 @@ class DevMenuComponent extends Component {
} }
addTonsBladeburnerRank() { addTonsBladeburnerRank() {
if (!!Player.bladeburner) { if (Player.bladeburner) {
Player.bladeburner.changeRank(tonsP); Player.bladeburner.changeRank(tonsP);
} }
} }
modifyBladeburnerCycles(modify) { modifyBladeburnerCycles(modify) {
return function(cycles) { return function(cycles) {
if (!!Player.bladeburner) { if (Player.bladeburner) {
Player.bladeburner.storedCycles += cycles*modify; Player.bladeburner.storedCycles += cycles*modify;
} }
} }
} }
resetBladeburnerCycles() { resetBladeburnerCycles() {
if (!!Player.bladeburner) { if (Player.bladeburner) {
Player.bladeburner.storedCycles = 0; Player.bladeburner.storedCycles = 0;
} }
} }
addTonsBladeburnerCycles() { addTonsBladeburnerCycles() {
if (!!Player.bladeburner) { if (Player.bladeburner) {
Player.bladeburner.storedCycles += tonsP; Player.bladeburner.storedCycles += tonsP;
} }
} }
addTonsGangCycles() { addTonsGangCycles() {
if (!!Player.gang) { if (Player.gang) {
Player.gang.storedCycles = tonsP; Player.gang.storedCycles = tonsP;
} }
} }
modifyGangCycles(modify) { modifyGangCycles(modify) {
return function(cycles) { return function(cycles) {
if (!!Player.gang) { if (Player.gang) {
Player.gang.storedCycles += cycles*modify; Player.gang.storedCycles += cycles*modify;
} }
} }
} }
resetGangCycles() { resetGangCycles() {
if (!!Player.gang) { if (Player.gang) {
Player.gang.storedCycles = 0; Player.gang.storedCycles = 0;
} }
} }
addTonsCorporationCycles() { addTonsCorporationCycles() {
if (!!Player.corporation) { if (Player.corporation) {
Player.corporation.storedCycles = tonsP; Player.corporation.storedCycles = tonsP;
} }
} }
modifyCorporationCycles(modify) { modifyCorporationCycles(modify) {
return function(cycles) { return function(cycles) {
if (!!Player.corporation) { if (Player.corporation) {
Player.corporation.storedCycles += cycles*modify; Player.corporation.storedCycles += cycles*modify;
} }
} }
} }
resetCorporationCycles() { resetCorporationCycles() {
if (!!Player.corporation) { if (Player.corporation) {
Player.corporation.storedCycles = 0; Player.corporation.storedCycles = 0;
} }
} }
@ -674,7 +676,7 @@ class DevMenuComponent extends Component {
<button className="std-button touch-sides" onClick={this.setSF(i, 2)}>2</button> <button className="std-button touch-sides" onClick={this.setSF(i, 2)}>2</button>
<button className="std-button touch-left" onClick={this.setSF(i, 3)}>3</button> <button className="std-button touch-left" onClick={this.setSF(i, 3)}>3</button>
</td> </td>
</tr> </tr>,
)); ));

@ -15,7 +15,7 @@ export class Faction {
* Flag signalling whether the player has already received an invitation * Flag signalling whether the player has already received an invitation
* to this faction * to this faction
*/ */
alreadyInvited: boolean = false; alreadyInvited = false;
/** /**
* Holds names of all augmentations that this Faction offers * Holds names of all augmentations that this Faction offers
@ -25,35 +25,35 @@ export class Faction {
/** /**
* Amount of favor the player has with this faction. * Amount of favor the player has with this faction.
*/ */
favor: number = 0; favor = 0;
/** /**
* Flag signalling whether player has been banned from this faction * Flag signalling whether player has been banned from this faction
*/ */
isBanned: boolean = false; isBanned = false;
/** /**
* Flag signalling whether player is a member of this faction * Flag signalling whether player is a member of this faction
*/ */
isMember: boolean = false; isMember = false;
/** /**
* Name of faction * Name of faction
*/ */
name: string = ""; name = "";
/** /**
* Amount of reputation player has with this faction * Amount of reputation player has with this faction
*/ */
playerReputation: number = 0; playerReputation = 0;
/** /**
* Reputation from the last "prestige" that was not converted to favor. * Reputation from the last "prestige" that was not converted to favor.
* This reputation rolls over and is used for the next favor calculation * This reputation rolls over and is used for the next favor calculation
*/ */
rolloverRep: number = 0; rolloverRep = 0;
constructor(name: string="") { constructor(name="") {
this.name = name; this.name = name;
} }
@ -82,7 +82,7 @@ export class Faction {
getFavorGain(): number[] { getFavorGain(): number[] {
if (this.favor == null) { this.favor = 0; } if (this.favor == null) { this.favor = 0; }
if (this.rolloverRep == null) { this.rolloverRep = 0; } if (this.rolloverRep == null) { this.rolloverRep = 0; }
var favorGain = 0, rep = this.playerReputation + this.rolloverRep; let favorGain = 0, rep = this.playerReputation + this.rolloverRep;
let reqdRep = CONSTANTS.FactionReputationToFavorBase * let reqdRep = CONSTANTS.FactionReputationToFavorBase *
Math.pow(CONSTANTS.FactionReputationToFavorMult, this.favor); Math.pow(CONSTANTS.FactionReputationToFavorMult, this.favor);
while(rep > 0) { while(rep > 0) {

@ -27,7 +27,7 @@ import { factionInvitationBoxCreate } from "../../utils/FactionInvitationBox";
import { import {
Reviver, Reviver,
Generic_toJSON, Generic_toJSON,
Generic_fromJSON Generic_fromJSON,
} from "../../utils/JSONReviver"; } from "../../utils/JSONReviver";
import { formatNumber } from "../../utils/StringHelperFunctions"; import { formatNumber } from "../../utils/StringHelperFunctions";
import { numeralWrapper } from "../ui/numeralFormat"; import { numeralWrapper } from "../ui/numeralFormat";
@ -36,7 +36,7 @@ import {
yesNoBoxCreate, yesNoBoxCreate,
yesNoBoxGetYesButton, yesNoBoxGetYesButton,
yesNoBoxGetNoButton, yesNoBoxGetNoButton,
yesNoBoxClose yesNoBoxClose,
} from "../../utils/YesNoBox"; } from "../../utils/YesNoBox";
export function inviteToFaction(faction) { export function inviteToFaction(faction) {
@ -90,7 +90,7 @@ export function displayFactionContent(factionName, initiallyOnAugmentationsPage=
p={Player} p={Player}
startHackingMissionFn={startHackingMission} startHackingMissionFn={startHackingMission}
/>, />,
Engine.Display.factionContent Engine.Display.factionContent,
) )
} }

@ -25,7 +25,7 @@ export function factionExists(name: string): boolean {
return Factions.hasOwnProperty(name); return Factions.hasOwnProperty(name);
} }
export function initFactions(bitNode: number=1) { export function initFactions(bitNode=1) {
for (const name in FactionInfos) { for (const name in FactionInfos) {
resetFaction(new Faction(name)); resetFaction(new Faction(name));
} }

@ -77,7 +77,7 @@ export class AugmentationsPage extends React.Component<IProps, IState> {
getAugsSortedByCost(): string[] { getAugsSortedByCost(): string[] {
const augs = this.getAugs(); const augs = this.getAugs();
augs.sort((augName1, augName2)=>{ augs.sort((augName1, augName2)=>{
var aug1 = Augmentations[augName1], aug2 = Augmentations[augName2]; const aug1 = Augmentations[augName1], aug2 = Augmentations[augName2];
if (aug1 == null || aug2 == null) { if (aug1 == null || aug2 == null) {
throw new Error("Invalid Augmentation Names"); throw new Error("Invalid Augmentation Names");
} }
@ -91,7 +91,7 @@ export class AugmentationsPage extends React.Component<IProps, IState> {
getAugsSortedByReputation(): string[] { getAugsSortedByReputation(): string[] {
const augs = this.getAugs(); const augs = this.getAugs();
augs.sort((augName1, augName2)=>{ augs.sort((augName1, augName2)=>{
var aug1 = Augmentations[augName1], aug2 = Augmentations[augName2]; const aug1 = Augmentations[augName1], aug2 = Augmentations[augName2];
if (aug1 == null || aug2 == null) { if (aug1 == null || aug2 == null) {
throw new Error("Invalid Augmentation Names"); throw new Error("Invalid Augmentation Names");
} }
@ -120,10 +120,9 @@ export class AugmentationsPage extends React.Component<IProps, IState> {
render() { render() {
const augs = this.getAugsSorted(); const augs = this.getAugsSorted();
const purchasable = augs.filter((aug: string) => const purchasable = augs.filter((aug: string) => aug === AugmentationNames.NeuroFluxGovernor ||
aug === AugmentationNames.NeuroFluxGovernor ||
(!this.props.p.augmentations.some(a => a.name === aug) && (!this.props.p.augmentations.some(a => a.name === aug) &&
!this.props.p.queuedAugmentations.some(a => a.name === aug)) !this.props.p.queuedAugmentations.some(a => a.name === aug)),
) )
const parent = this; const parent = this;

@ -91,7 +91,7 @@ export class DonateOption extends React.Component<IProps, IState> {
return ( return (
<div className={"faction-work-div"}> <div className={"faction-work-div"}>
<div className={"faction-work-div-wrapper"}> <div className={"faction-work-div-wrapper"}>
<input className='text-input' onChange={this.handleChange} placeholder={"Donation amount"} style={inputStyleMarkup} /> <input className="text-input" onChange={this.handleChange} placeholder={"Donation amount"} style={inputStyleMarkup} />
<StdButton <StdButton
onClick={this.donate} onClick={this.donate}
text={"Donate Money"} text={"Donate Money"}

@ -108,9 +108,9 @@ export class PurchaseableAugmentation extends React.Component<IProps, any> {
const repCost = this.getRepCost(); const repCost = this.getRepCost();
// Determine UI properties // Determine UI properties
let disabled: boolean = false; let disabled = false;
let status: JSX.Element = <></>; let status: JSX.Element = <></>;
let color: string = ""; let color = "";
if (!this.hasPrereqs()) { if (!this.hasPrereqs()) {
disabled = true; disabled = true;
status = <>LOCKED (Requires {this.aug.prereqs.map(aug => AugFormat(aug))} as prerequisite)</>; status = <>LOCKED (Requires {this.aug.prereqs.map(aug => AugFormat(aug))} as prerequisite)</>;

@ -69,7 +69,7 @@ const GangNames = [
"The Dark Army", "The Dark Army",
"Speakers for the Dead", "Speakers for the Dead",
"NiteSec", "NiteSec",
"The Black Hand" "The Black Hand",
]; ];
export class FactionRoot extends React.Component<IProps, IState> { export class FactionRoot extends React.Component<IProps, IState> {

@ -19,7 +19,7 @@ import { dialogBoxCreate } from "../utils/DialogBox";
import { import {
Reviver, Reviver,
Generic_toJSON, Generic_toJSON,
Generic_fromJSON Generic_fromJSON,
} from "../utils/JSONReviver"; } from "../utils/JSONReviver";
import { formatNumber } from "../utils/StringHelperFunctions"; import { formatNumber } from "../utils/StringHelperFunctions";
@ -90,7 +90,7 @@ const GangNames = [
"The Dark Army", "The Dark Army",
"Speakers for the Dead", "Speakers for the Dead",
"NiteSec", "NiteSec",
"The Black Hand" "The Black Hand",
]; ];
export let AllGangs = { export let AllGangs = {
@ -1055,14 +1055,14 @@ Gang.prototype.createGangMemberUpgradeBox = function(player, initialFilter="") {
onkeyup:() => { onkeyup:() => {
var filterValue = UIElems.gangMemberUpgradeBoxFilter.value.toString(); var filterValue = UIElems.gangMemberUpgradeBoxFilter.value.toString();
this.createGangMemberUpgradeBox(player, filterValue); this.createGangMemberUpgradeBox(player, filterValue);
} },
}); });
UIElems.gangMemberUpgradeBoxDiscount = createElement("p", { UIElems.gangMemberUpgradeBoxDiscount = createElement("p", {
innerText: "Discount: -" + numeralWrapper.formatPercentage(1 - 1 / this.getDiscount()), innerText: "Discount: -" + numeralWrapper.formatPercentage(1 - 1 / this.getDiscount()),
marginLeft: "6px", marginLeft: "6px",
tooltip: "You get a discount on equipment and upgrades based on your gang's " + tooltip: "You get a discount on equipment and upgrades based on your gang's " +
"respect and power. More respect and power leads to more discounts." "respect and power. More respect and power leads to more discounts.",
}); });
UIElems.gangMemberUpgradeBoxElements = [UIElems.gangMemberUpgradeBoxFilter, UIElems.gangMemberUpgradeBoxDiscount]; UIElems.gangMemberUpgradeBoxElements = [UIElems.gangMemberUpgradeBoxFilter, UIElems.gangMemberUpgradeBoxDiscount];
@ -1087,7 +1087,7 @@ GangMember.prototype.createGangMemberUpgradePanel = function(gangObj, player) {
}); });
var header = createElement("h1", { var header = createElement("h1", {
innerText: this.name + " (" + this.task + ")" innerText: this.name + " (" + this.task + ")",
}); });
container.appendChild(header); container.appendChild(header);
@ -1192,7 +1192,7 @@ GangMember.prototype.createGangMemberUpgradePanel = function(gangObj, player) {
clickListener:() => { clickListener:() => {
memberObj.buyUpgrade(upg, player, gangObj); memberObj.buyUpgrade(upg, player, gangObj);
return false; return false;
} },
} }
// For the last two divs, tooltip should be on the left // For the last two divs, tooltip should be on the left
@ -1278,7 +1278,7 @@ Gang.prototype.displayGangContent = function(player) {
Engine.loadFactionContent(); Engine.loadFactionContent();
displayFactionContent(facName); displayFactionContent(facName);
return false; return false;
} },
})); }));
// Buttons to switch between panels // Buttons to switch between panels
@ -1294,7 +1294,7 @@ Gang.prototype.displayGangContent = function(player) {
UIElems.territoryButton.classList.toggle("a-link-button"); UIElems.territoryButton.classList.toggle("a-link-button");
this.updateGangContent(); this.updateGangContent();
return false; return false;
} },
}) })
UIElems.territoryButton = createElement("a", { UIElems.territoryButton = createElement("a", {
id:"gang-territory-subpage-button", class:"a-link-button", id:"gang-territory-subpage-button", class:"a-link-button",
@ -1308,7 +1308,7 @@ Gang.prototype.displayGangContent = function(player) {
UIElems.territoryButton.classList.toggle("a-link-button"); UIElems.territoryButton.classList.toggle("a-link-button");
this.updateGangContent(); this.updateGangContent();
return false; return false;
} },
}); });
UIElems.gangContainer.appendChild(UIElems.managementButton); UIElems.gangContainer.appendChild(UIElems.managementButton);
UIElems.gangContainer.appendChild(UIElems.territoryButton); UIElems.gangContainer.appendChild(UIElems.territoryButton);
@ -1338,7 +1338,7 @@ Gang.prototype.displayGangContent = function(player) {
"Installing Augmentations does NOT reset your progress with your Gang. " + "Installing Augmentations does NOT reset your progress with your Gang. " +
"Furthermore, after installing Augmentations, you will " + "Furthermore, after installing Augmentations, you will " +
"automatically be a member of whatever Faction you created your gang with.<br><br>" + "automatically be a member of whatever Faction you created your gang with.<br><br>" +
"You can also manage your gang programmatically through Netscript using the Gang API" "You can also manage your gang programmatically through Netscript using the Gang API",
}); });
UIElems.gangManagementSubpage.appendChild(UIElems.gangDesc); UIElems.gangManagementSubpage.appendChild(UIElems.gangDesc);
@ -1399,7 +1399,7 @@ Gang.prototype.displayGangContent = function(player) {
}); });
createPopup(popupId, [txt, br, nameInput, yesBtn, noBtn]); createPopup(popupId, [txt, br, nameInput, yesBtn, noBtn]);
nameInput.focus(); nameInput.focus();
} },
}); });
UIElems.gangManagementSubpage.appendChild(UIElems.gangRecruitMemberButton); UIElems.gangManagementSubpage.appendChild(UIElems.gangRecruitMemberButton);
@ -1425,7 +1425,7 @@ Gang.prototype.displayGangContent = function(player) {
} }
} }
return false; return false;
} },
}); });
UIElems.gangCollapseAllButton = createElement("a", { UIElems.gangCollapseAllButton = createElement("a", {
class:"a-link-button", display:"inline-block", class:"a-link-button", display:"inline-block",
@ -1439,21 +1439,21 @@ Gang.prototype.displayGangContent = function(player) {
} }
} }
return false; return false;
} },
}); });
UIElems.gangMemberFilter = createElement("input", { UIElems.gangMemberFilter = createElement("input", {
type:"text", placeholder:"Filter gang members", margin:"5px", padding:"5px", type:"text", placeholder:"Filter gang members", margin:"5px", padding:"5px",
class:"text-input", class:"text-input",
onkeyup:() => { onkeyup:() => {
this.displayGangMemberList(); this.displayGangMemberList();
} },
}); });
UIElems.gangManageEquipmentButton = createElement("a", { UIElems.gangManageEquipmentButton = createElement("a", {
class:"a-link-button", display:"inline-block", class:"a-link-button", display:"inline-block",
innerHTML:"Manage Equipment", innerHTML:"Manage Equipment",
clickListener: () => { clickListener: () => {
this.createGangMemberUpgradeBox(player); this.createGangMemberUpgradeBox(player);
} },
}); });
UIElems.gangManagementSubpage.appendChild(UIElems.gangExpandAllButton); UIElems.gangManagementSubpage.appendChild(UIElems.gangExpandAllButton);
UIElems.gangManagementSubpage.appendChild(UIElems.gangCollapseAllButton); UIElems.gangManagementSubpage.appendChild(UIElems.gangCollapseAllButton);
@ -1467,7 +1467,7 @@ Gang.prototype.displayGangContent = function(player) {
// Subpage for seeing gang territory information // Subpage for seeing gang territory information
UIElems.gangTerritorySubpage = createElement("div", { UIElems.gangTerritorySubpage = createElement("div", {
id:"gang-territory-subpage", display:"none" id:"gang-territory-subpage", display:"none",
}); });
// Info text for territory page // Info text for territory page
@ -1485,7 +1485,7 @@ Gang.prototype.displayGangContent = function(player) {
"NOTE: Gang members assigned to 'Territory Warfare' can be killed during clashes. This can happen regardless of whether you win " + "NOTE: Gang members assigned to 'Territory Warfare' can be killed during clashes. This can happen regardless of whether you win " +
"or lose the clash. A gang member being killed results in both respect and power loss for your gang.<br><br>" + "or lose the clash. A gang member being killed results in both respect and power loss for your gang.<br><br>" +
"The amount of territory you have affects all aspects of your Gang members' production, including " + "The amount of territory you have affects all aspects of your Gang members' production, including " +
"money, respect, and wanted level. It is very beneficial to have high territory control.<br><br>" "money, respect, and wanted level. It is very beneficial to have high territory control.<br><br>",
}); });
UIElems.gangTerritorySubpage.appendChild(UIElems.gangTerritoryDescText); UIElems.gangTerritorySubpage.appendChild(UIElems.gangTerritoryDescText);
@ -1654,7 +1654,7 @@ Gang.prototype.updateGangContent = function() {
tooltip: "Represents the amount of respect your gang has from other gangs and criminal " + tooltip: "Represents the amount of respect your gang has from other gangs and criminal " +
"organizations. Your respect affects the amount of money " + "organizations. Your respect affects the amount of money " +
"your gang members will earn, and also determines how much " + "your gang members will earn, and also determines how much " +
"reputation you are earning with your gang's corresponding Faction." "reputation you are earning with your gang's corresponding Faction.",
})); }));
UIElems.gangInfo.appendChild(createElement("br")); UIElems.gangInfo.appendChild(createElement("br"));
@ -1664,7 +1664,7 @@ Gang.prototype.updateGangContent = function() {
" (" + numeralWrapper.formatWanted(5*this.wantedGainRate) + " / sec)", " (" + numeralWrapper.formatWanted(5*this.wantedGainRate) + " / sec)",
tooltip: "Represents how much the gang is wanted by law enforcement. The higher " + tooltip: "Represents how much the gang is wanted by law enforcement. The higher " +
"your gang's wanted level, the harder it will be for your gang members " + "your gang's wanted level, the harder it will be for your gang members " +
"to make money and earn respect. Note that the minimum wanted level is 1." "to make money and earn respect. Note that the minimum wanted level is 1.",
})); }));
UIElems.gangInfo.appendChild(createElement("br")); UIElems.gangInfo.appendChild(createElement("br"));
@ -1673,7 +1673,7 @@ Gang.prototype.updateGangContent = function() {
UIElems.gangInfo.appendChild(createElement("p", { // Wanted Level multiplier UIElems.gangInfo.appendChild(createElement("p", { // Wanted Level multiplier
display: "inline-block", display: "inline-block",
innerText: `Wanted Level Penalty: -${formatNumber(wantedPenalty, 2)}%`, innerText: `Wanted Level Penalty: -${formatNumber(wantedPenalty, 2)}%`,
tooltip: "Penalty for respect and money gain rates due to Wanted Level" tooltip: "Penalty for respect and money gain rates due to Wanted Level",
})); }));
UIElems.gangInfo.appendChild(createElement("br")); UIElems.gangInfo.appendChild(createElement("br"));
@ -1695,7 +1695,7 @@ Gang.prototype.updateGangContent = function() {
UIElems.gangInfo.appendChild(createElement("p", { // Territory multiplier UIElems.gangInfo.appendChild(createElement("p", { // Territory multiplier
display: "inline-block", display: "inline-block",
innerText: `Territory: ${formatNumber(displayNumber, 3)}%`, innerText: `Territory: ${formatNumber(displayNumber, 3)}%`,
tooltip: "The percentage of total territory your Gang controls" tooltip: "The percentage of total territory your Gang controls",
})); }));
UIElems.gangInfo.appendChild(createElement("br")); UIElems.gangInfo.appendChild(createElement("br"));
@ -1819,7 +1819,7 @@ Gang.prototype.createGangMemberDisplayElement = function(memberObj) {
innerText: "Cancel", innerText: "Cancel",
}); });
createPopup(popupId, [txt, confirmBtn, cancelBtn]); createPopup(popupId, [txt, confirmBtn, cancelBtn]);
} },
}); });
const ascendHelpTip = createElement("div", { const ascendHelpTip = createElement("div", {
class: "help-tip", class: "help-tip",

@ -15,7 +15,7 @@ function baseCheck(server: Server, fnName: string): IReturnStatus {
if (!("requiredHackingSkill" in server)) { if (!("requiredHackingSkill" in server)) {
return { return {
res: false, res: false,
msg: `Cannot ${fnName} ${hostname} server because it is a Hacknet Node` msg: `Cannot ${fnName} ${hostname} server because it is a Hacknet Node`,
} }
} }
@ -33,7 +33,7 @@ export function netscriptCanHack(server: Server, p: IPlayer): IReturnStatus {
const initialCheck = baseCheck(server, "hack"); const initialCheck = baseCheck(server, "hack");
if (!initialCheck.res) { return initialCheck; } if (!initialCheck.res) { return initialCheck; }
let s = server; const s = server;
if (s.requiredHackingSkill > p.hacking_skill) { if (s.requiredHackingSkill > p.hacking_skill) {
return { return {
res: false, res: false,

@ -20,7 +20,7 @@ import { generateRandomContract } from "../CodingContractGenerator";
import { import {
iTutorialSteps, iTutorialSteps,
iTutorialNextStep, iTutorialNextStep,
ITutorial ITutorial,
} from "../InteractiveTutorial"; } from "../InteractiveTutorial";
import { Player } from "../Player"; import { Player } from "../Player";
import { AllServers } from "../Server/AllServers"; import { AllServers } from "../Server/AllServers";

@ -31,50 +31,50 @@ export class HacknetNode implements IHacknetNode {
} }
// Node's number of cores // Node's number of cores
cores: number = 1; cores = 1;
// Node's Level // Node's Level
level: number = 1; level = 1;
// Node's production per second // Node's production per second
moneyGainRatePerSecond: number = 0; moneyGainRatePerSecond = 0;
// Identifier for Node. Includes the full "name" (hacknet-node-N) // Identifier for Node. Includes the full "name" (hacknet-node-N)
name: string; name: string;
// How long this Node has existed, in seconds // How long this Node has existed, in seconds
onlineTimeSeconds: number = 0; onlineTimeSeconds = 0;
// Node's RAM (GB) // Node's RAM (GB)
ram: number = 1; ram = 1;
// Total money earned by this Node // Total money earned by this Node
totalMoneyGenerated: number = 0; totalMoneyGenerated = 0;
constructor(name: string="", prodMult: number=1) { constructor(name="", prodMult=1) {
this.name = name; this.name = name;
this.updateMoneyGainRate(prodMult); this.updateMoneyGainRate(prodMult);
} }
// Get the cost to upgrade this Node's number of cores // Get the cost to upgrade this Node's number of cores
calculateCoreUpgradeCost(levels: number=1, costMult: number): number { calculateCoreUpgradeCost(levels=1, costMult: number): number {
return calculateCoreUpgradeCost(this.cores, levels, costMult); return calculateCoreUpgradeCost(this.cores, levels, costMult);
} }
// Get the cost to upgrade this Node's level // Get the cost to upgrade this Node's level
calculateLevelUpgradeCost(levels: number=1, costMult: number): number { calculateLevelUpgradeCost(levels=1, costMult: number): number {
return calculateLevelUpgradeCost(this.level, levels, costMult); return calculateLevelUpgradeCost(this.level, levels, costMult);
} }
// Get the cost to upgrade this Node's RAM // Get the cost to upgrade this Node's RAM
calculateRamUpgradeCost(levels: number=1, costMult: number): number { calculateRamUpgradeCost(levels=1, costMult: number): number {
return calculateRamUpgradeCost(this.ram, levels, costMult); return calculateRamUpgradeCost(this.ram, levels, costMult);
} }
// Process this Hacknet Node in the game loop. // Process this Hacknet Node in the game loop.
// Returns the amount of money generated // Returns the amount of money generated
process(numCycles: number=1): number { process(numCycles=1): number {
const seconds = numCycles * CONSTANTS.MilliPerCycle / 1000; const seconds = numCycles * CONSTANTS.MilliPerCycle / 1000;
let gain = this.moneyGainRatePerSecond * seconds; let gain = this.moneyGainRatePerSecond * seconds;
if (isNaN(gain)) { if (isNaN(gain)) {
@ -90,21 +90,21 @@ export class HacknetNode implements IHacknetNode {
// Upgrade this Node's number of cores, if possible // Upgrade this Node's number of cores, if possible
// Returns a boolean indicating whether new cores were successfully bought // Returns a boolean indicating whether new cores were successfully bought
upgradeCore(levels: number=1, prodMult: number): void { upgradeCore(levels=1, prodMult: number): void {
this.cores = Math.min(HacknetNodeConstants.MaxCores, Math.round(this.cores + levels)); this.cores = Math.min(HacknetNodeConstants.MaxCores, Math.round(this.cores + levels));
this.updateMoneyGainRate(prodMult); this.updateMoneyGainRate(prodMult);
} }
// Upgrade this Node's level, if possible // Upgrade this Node's level, if possible
// Returns a boolean indicating whether the level was successfully updated // Returns a boolean indicating whether the level was successfully updated
upgradeLevel(levels: number=1, prodMult: number): void { upgradeLevel(levels=1, prodMult: number): void {
this.level = Math.min(HacknetNodeConstants.MaxLevel, Math.round(this.level + levels)); this.level = Math.min(HacknetNodeConstants.MaxLevel, Math.round(this.level + levels));
this.updateMoneyGainRate(prodMult); this.updateMoneyGainRate(prodMult);
} }
// Upgrade this Node's RAM, if possible // Upgrade this Node's RAM, if possible
// Returns a boolean indicating whether the RAM was successfully upgraded // Returns a boolean indicating whether the RAM was successfully upgraded
upgradeRam(levels: number=1, prodMult: number): void { upgradeRam(levels=1, prodMult: number): void {
for (let i = 0; i < levels; ++i) { for (let i = 0; i < levels; ++i) {
this.ram *= 2; // Ram is always doubled this.ram *= 2; // Ram is always doubled
} }

@ -22,7 +22,7 @@ import { createRandomIp } from "../../utils/IPAddress";
import { import {
Generic_fromJSON, Generic_fromJSON,
Generic_toJSON, Generic_toJSON,
Reviver Reviver,
} from "../../utils/JSONReviver"; } from "../../utils/JSONReviver";
interface IConstructorParams { interface IConstructorParams {
@ -41,25 +41,25 @@ export class HacknetServer extends BaseServer implements IHacknetNode {
} }
// Cache level. Affects hash Capacity // Cache level. Affects hash Capacity
cache: number = 1; cache = 1;
// Number of cores. Improves hash production // Number of cores. Improves hash production
cores: number = 1; cores = 1;
// Number of hashes that can be stored by this Hacknet Server // Number of hashes that can be stored by this Hacknet Server
hashCapacity: number = 0; hashCapacity = 0;
// Hashes produced per second // Hashes produced per second
hashRate: number = 0; hashRate = 0;
// Similar to Node level. Improves hash production // Similar to Node level. Improves hash production
level: number = 1; level = 1;
// How long this HacknetServer has existed, in seconds // How long this HacknetServer has existed, in seconds
onlineTimeSeconds: number = 0; onlineTimeSeconds = 0;
// Total number of hashes earned by this server // Total number of hashes earned by this server
totalHashesGenerated: number = 0; totalHashesGenerated = 0;
constructor(params: IConstructorParams={ hostname: "", ip: createRandomIp() }) { constructor(params: IConstructorParams={ hostname: "", ip: createRandomIp() }) {
super(params); super(params);
@ -85,7 +85,7 @@ export class HacknetServer extends BaseServer implements IHacknetNode {
} }
// Process this Hacknet Server in the game loop. Returns the number of hashes generated // Process this Hacknet Server in the game loop. Returns the number of hashes generated
process(numCycles: number=1): number { process(numCycles=1): number {
const seconds = numCycles * CONSTANTS.MilliPerCycle / 1000; const seconds = numCycles * CONSTANTS.MilliPerCycle / 1000;
return this.hashRate * seconds; return this.hashRate * seconds;

@ -22,10 +22,10 @@ export class HashManager {
// Max number of hashes this can hold. Equal to the sum of capacities of // Max number of hashes this can hold. Equal to the sum of capacities of
// all Hacknet Servers // all Hacknet Servers
capacity: number = 0; capacity = 0;
// Number of hashes currently in storage // Number of hashes currently in storage
hashes: number = 0; hashes = 0;
// Map of Hash Upgrade Name -> levels in that upgrade // Map of Hash Upgrade Name -> levels in that upgrade
upgrades: IMap<number> = {}; upgrades: IMap<number> = {};

@ -23,25 +23,25 @@ export class HashUpgrade {
* Base cost for this upgrade. Every time the upgrade is purchased, * Base cost for this upgrade. Every time the upgrade is purchased,
* its cost increases by this same amount (so its 1x, 2x, 3x, 4x, etc.) * its cost increases by this same amount (so its 1x, 2x, 3x, 4x, etc.)
*/ */
costPerLevel: number = 0; costPerLevel = 0;
/** /**
* Description of what the upgrade does * Description of what the upgrade does
*/ */
desc: string = ""; desc = "";
/** /**
* Boolean indicating that this upgrade's effect affects a single server, * Boolean indicating that this upgrade's effect affects a single server,
* the "target" server * the "target" server
*/ */
hasTargetServer: boolean = false; hasTargetServer = false;
// Name of upgrade // Name of upgrade
name: string = ""; name = "";
// Generic value used to indicate the potency/amount of this upgrade's effect // Generic value used to indicate the potency/amount of this upgrade's effect
// The meaning varies between different upgrades // The meaning varies between different upgrades
value: number = 0; value = 0;
constructor(p: IConstructorParams) { constructor(p: IConstructorParams) {
if (p.cost != null) { this.cost = p.cost; } if (p.cost != null) { this.cost = p.cost; }

@ -14,7 +14,7 @@ export function calculateMoneyGainRate(level: number, ram: number, cores: number
BitNodeMultipliers.HacknetNodeMoney; BitNodeMultipliers.HacknetNodeMoney;
} }
export function calculateLevelUpgradeCost(startingLevel: number, extraLevels: number=1, costMult: number=1): number { export function calculateLevelUpgradeCost(startingLevel: number, extraLevels=1, costMult=1): number {
const sanitizedLevels = Math.round(extraLevels); const sanitizedLevels = Math.round(extraLevels);
if (isNaN(sanitizedLevels) || sanitizedLevels < 1) { if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {
return 0; return 0;
@ -35,7 +35,7 @@ export function calculateLevelUpgradeCost(startingLevel: number, extraLevels: nu
return HacknetNodeConstants.BaseCost / 2 * totalMultiplier * costMult; return HacknetNodeConstants.BaseCost / 2 * totalMultiplier * costMult;
} }
export function calculateRamUpgradeCost(startingRam: number, extraLevels: number=1, costMult: number=1): number { export function calculateRamUpgradeCost(startingRam: number, extraLevels=1, costMult=1): number {
const sanitizedLevels = Math.round(extraLevels); const sanitizedLevels = Math.round(extraLevels);
if (isNaN(sanitizedLevels) || sanitizedLevels < 1) { if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {
return 0; return 0;
@ -64,7 +64,7 @@ export function calculateRamUpgradeCost(startingRam: number, extraLevels: number
return totalCost; return totalCost;
} }
export function calculateCoreUpgradeCost(startingCore: number, extraLevels: number=1, costMult: number=1): number { export function calculateCoreUpgradeCost(startingCore: number, extraLevels=1, costMult=1): number {
const sanitizedCores = Math.round(extraLevels); const sanitizedCores = Math.round(extraLevels);
if (isNaN(sanitizedCores) || sanitizedCores < 1) { if (isNaN(sanitizedCores) || sanitizedCores < 1) {
return 0; return 0;
@ -88,7 +88,7 @@ export function calculateCoreUpgradeCost(startingCore: number, extraLevels: numb
return totalCost; return totalCost;
} }
export function calculateNodeCost(n: number, mult: number=1): number { export function calculateNodeCost(n: number, mult=1): number {
if(n <= 0) { if(n <= 0) {
return 0; return 0;
} }

@ -15,7 +15,7 @@ export function calculateHashGainRate(level: number, ramUsed: number, maxRam: nu
BitNodeMultipliers.HacknetNodeMoney; BitNodeMultipliers.HacknetNodeMoney;
} }
export function calculateLevelUpgradeCost(startingLevel: number, extraLevels: number=1, costMult: number=1): number { export function calculateLevelUpgradeCost(startingLevel: number, extraLevels=1, costMult=1): number {
const sanitizedLevels = Math.round(extraLevels); const sanitizedLevels = Math.round(extraLevels);
if (isNaN(sanitizedLevels) || sanitizedLevels < 1) { if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {
return 0; return 0;
@ -36,7 +36,7 @@ export function calculateLevelUpgradeCost(startingLevel: number, extraLevels: nu
return 10 * HacknetServerConstants.BaseCost * totalMultiplier * costMult; return 10 * HacknetServerConstants.BaseCost * totalMultiplier * costMult;
} }
export function calculateRamUpgradeCost(startingRam: number, extraLevels: number=1, costMult: number=1): number { export function calculateRamUpgradeCost(startingRam: number, extraLevels=1, costMult=1): number {
const sanitizedLevels = Math.round(extraLevels); const sanitizedLevels = Math.round(extraLevels);
if (isNaN(sanitizedLevels) || sanitizedLevels < 1) { if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {
return 0; return 0;
@ -50,8 +50,8 @@ export function calculateRamUpgradeCost(startingRam: number, extraLevels: number
let numUpgrades = Math.round(Math.log2(startingRam)); let numUpgrades = Math.round(Math.log2(startingRam));
let currentRam = startingRam; let currentRam = startingRam;
for (let i = 0; i < sanitizedLevels; ++i) { for (let i = 0; i < sanitizedLevels; ++i) {
let baseCost = currentRam * HacknetServerConstants.RamBaseCost; const baseCost = currentRam * HacknetServerConstants.RamBaseCost;
let mult = Math.pow(HacknetServerConstants.UpgradeRamMult, numUpgrades); const mult = Math.pow(HacknetServerConstants.UpgradeRamMult, numUpgrades);
totalCost += (baseCost * mult); totalCost += (baseCost * mult);
@ -63,7 +63,7 @@ export function calculateRamUpgradeCost(startingRam: number, extraLevels: number
return totalCost; return totalCost;
} }
export function calculateCoreUpgradeCost(startingCores: number, extraLevels: number=1, costMult: number=1): number { export function calculateCoreUpgradeCost(startingCores: number, extraLevels=1, costMult=1): number {
const sanitizedLevels = Math.round(extraLevels); const sanitizedLevels = Math.round(extraLevels);
if (isNaN(sanitizedLevels) || sanitizedLevels < 1) { if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {
return 0; return 0;
@ -86,7 +86,7 @@ export function calculateCoreUpgradeCost(startingCores: number, extraLevels: num
return totalCost; return totalCost;
} }
export function calculateCacheUpgradeCost(startingCache: number, extraLevels: number=1): number { export function calculateCacheUpgradeCost(startingCache: number, extraLevels=1): number {
const sanitizedLevels = Math.round(extraLevels); const sanitizedLevels = Math.round(extraLevels);
if (isNaN(sanitizedLevels) || sanitizedLevels < 1) { if (isNaN(sanitizedLevels) || sanitizedLevels < 1) {
return 0; return 0;
@ -108,7 +108,7 @@ export function calculateCacheUpgradeCost(startingCache: number, extraLevels: nu
return totalCost; return totalCost;
} }
export function calculateServerCost(n: number, mult: number=1): number { export function calculateServerCost(n: number, mult=1): number {
if (n-1 >= HacknetServerConstants.MaxServers) { return Infinity; } if (n-1 >= HacknetServerConstants.MaxServers) { return Infinity; }
return HacknetServerConstants.BaseCost * Math.pow(HacknetServerConstants.PurchaseMult, n-1) * mult; return HacknetServerConstants.BaseCost * Math.pow(HacknetServerConstants.PurchaseMult, n-1) * mult;

@ -36,7 +36,7 @@ class HashUpgrade extends React.Component {
changeTargetServer(e) { changeTargetServer(e) {
this.setState({ this.setState({
selectedServer: e.target.value selectedServer: e.target.value,
}); });
} }

@ -42,7 +42,7 @@ const orderedITutorialSteps = [
"HacknetNodesGoToWorldPage", "HacknetNodesGoToWorldPage",
"WorldDescription", "WorldDescription",
"TutorialPageInfo", "TutorialPageInfo",
"End" "End",
] ]
// Create an 'enum' for the Steps // Create an 'enum' for the Steps
@ -500,13 +500,13 @@ function iTutorialEnd() {
"<a class='a-link-button' href='https://bitburner.readthedocs.io/en/latest/guidesandtips/gettingstartedguideforbeginnerprogrammers.html' target='_blank'>Getting Started Guide</a>" + "<a class='a-link-button' href='https://bitburner.readthedocs.io/en/latest/guidesandtips/gettingstartedguideforbeginnerprogrammers.html' target='_blank'>Getting Started Guide</a>" +
"<a class='a-link-button' href='https://bitburner.readthedocs.io/en/latest/' target='_blank'>Documentation</a><br><br>" + "<a class='a-link-button' href='https://bitburner.readthedocs.io/en/latest/' target='_blank'>Documentation</a><br><br>" +
"The Beginner's Guide to Hacking was added to your home computer! It contains some tips/pointers for starting out with the game. " + "The Beginner's Guide to Hacking was added to your home computer! It contains some tips/pointers for starting out with the game. " +
"To read it, go to Terminal and enter<br><br>cat " + LiteratureNames.HackersStartingHandbook "To read it, go to Terminal and enter<br><br>cat " + LiteratureNames.HackersStartingHandbook,
}); });
var gotitBtn = createElement("a", { var gotitBtn = createElement("a", {
class:"a-link-button", float:"right", padding:"6px", innerText:"Got it!", class:"a-link-button", float:"right", padding:"6px", innerText:"Got it!",
clickListener:()=>{ clickListener:()=>{
removeElementById(popupId); removeElementById(popupId);
} },
}); });
createPopup(popupId, [txt, gotitBtn]); createPopup(popupId, [txt, gotitBtn]);

@ -85,7 +85,7 @@ var Interpreter = function(code, opt_initFunc, lineOffset=0) {
*/ */
Interpreter.PARSE_OPTIONS = { Interpreter.PARSE_OPTIONS = {
ecmaVersion: 5, ecmaVersion: 5,
locations: true locations: true,
}; };
/** /**
@ -94,7 +94,7 @@ Interpreter.PARSE_OPTIONS = {
Interpreter.READONLY_DESCRIPTOR = { Interpreter.READONLY_DESCRIPTOR = {
configurable: true, configurable: true,
enumerable: true, enumerable: true,
writable: false writable: false,
}; };
/** /**
@ -103,7 +103,7 @@ Interpreter.READONLY_DESCRIPTOR = {
Interpreter.NONENUMERABLE_DESCRIPTOR = { Interpreter.NONENUMERABLE_DESCRIPTOR = {
configurable: true, configurable: true,
enumerable: false, enumerable: false,
writable: true writable: true,
}; };
/** /**
@ -112,7 +112,7 @@ Interpreter.NONENUMERABLE_DESCRIPTOR = {
Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR = { Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR = {
configurable: true, configurable: true,
enumerable: false, enumerable: false,
writable: false writable: false,
}; };
/** /**
@ -121,7 +121,7 @@ Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR = {
Interpreter.VARIABLE_DESCRIPTOR = { Interpreter.VARIABLE_DESCRIPTOR = {
configurable: false, configurable: false,
enumerable: true, enumerable: true,
writable: true writable: true,
}; };
/** /**
@ -312,7 +312,7 @@ Interpreter.prototype.initGlobalScope = function(scope) {
var strFunctions = [ var strFunctions = [
[escape, 'escape'], [unescape, 'unescape'], [escape, 'escape'], [unescape, 'unescape'],
[decodeURI, 'decodeURI'], [decodeURIComponent, 'decodeURIComponent'], [decodeURI, 'decodeURI'], [decodeURIComponent, 'decodeURIComponent'],
[encodeURI, 'encodeURI'], [encodeURIComponent, 'encodeURIComponent'] [encodeURI, 'encodeURI'], [encodeURIComponent, 'encodeURIComponent'],
]; ];
for (var i = 0; i < strFunctions.length; i++) { for (var i = 0; i < strFunctions.length; i++) {
var wrapper = (function(nativeFunc) { var wrapper = (function(nativeFunc) {
@ -1985,8 +1985,8 @@ Interpreter.prototype.nativeToPseudo = function(nativeObj) {
Array.prototype.slice.call(arguments) Array.prototype.slice.call(arguments)
.map(function(i) { .map(function(i) {
return interpreter.pseudoToNative(i); return interpreter.pseudoToNative(i);
}) }),
) ),
); );
}; };
return this.createNativeFunction(wrapper, undefined); return this.createNativeFunction(wrapper, undefined);
@ -2033,7 +2033,7 @@ Interpreter.prototype.pseudoToNative = function(pseudoObj, opt_cycles) {
var cycles = opt_cycles || { var cycles = opt_cycles || {
pseudo: [], pseudo: [],
native: [] native: [],
}; };
var i = cycles.pseudo.indexOf(pseudoObj); var i = cycles.pseudo.indexOf(pseudoObj);
if (i !== -1) { if (i !== -1) {
@ -2610,7 +2610,7 @@ Interpreter.prototype.setValue = function(ref, value) {
BREAK: 1, BREAK: 1,
CONTINUE: 2, CONTINUE: 2,
RETURN: 3, RETURN: 3,
THROW: 4 THROW: 4,
}; };
/** /**
@ -2691,7 +2691,7 @@ Interpreter.prototype.unwind = function(type, value, label, lineNumberMsg="") {
'ReferenceError': ReferenceError, 'ReferenceError': ReferenceError,
'SyntaxError': SyntaxError, 'SyntaxError': SyntaxError,
'TypeError': TypeError, 'TypeError': TypeError,
'URIError': URIError 'URIError': URIError,
}; };
var name = this.getProperty(value, 'name').toString(); var name = this.getProperty(value, 'name').toString();
var message = this.getProperty(value, 'message').valueOf(); var message = this.getProperty(value, 'message').valueOf();
@ -3485,7 +3485,7 @@ Interpreter.prototype['stepObjectExpression'] = function(stack, state, node) {
configurable: true, configurable: true,
enumerable: true, enumerable: true,
get: kinds['get'], get: kinds['get'],
set: kinds['set'] set: kinds['set'],
}; };
this.setProperty(state.object_, key, null, descriptor); this.setProperty(state.object_, key, null, descriptor);
} else { } else {

@ -20,7 +20,7 @@ export class City {
*/ */
asciiArt: string; asciiArt: string;
constructor(name: CityName, locations: LocationName[]=[], asciiArt: string='') { constructor(name: CityName, locations: LocationName[]=[], asciiArt='') {
this.name = name; this.name = name;
this.locations = locations; this.locations = locations;
this.asciiArt = asciiArt; this.asciiArt = asciiArt;

@ -33,12 +33,12 @@ export class Location {
/** /**
* Cost multiplier that influences how expensive a gym/university is * Cost multiplier that influences how expensive a gym/university is
*/ */
costMult: number = 0; costMult = 0;
/** /**
* Exp multiplier that influences how effective a gym/university is * Exp multiplier that influences how effective a gym/university is
*/ */
expMult: number = 0; expMult = 0;
/** /**
* Companies can be infiltrated. This contains the data required for that * Companies can be infiltrated. This contains the data required for that
@ -61,13 +61,13 @@ export class Location {
* Tech vendors allow you to purchase servers. * Tech vendors allow you to purchase servers.
* This property defines the max RAM server you can purchase from this vendor * This property defines the max RAM server you can purchase from this vendor
*/ */
techVendorMaxRam: number = 0; techVendorMaxRam = 0;
/** /**
* Tech vendors allow you to purchase servers. * Tech vendors allow you to purchase servers.
* This property defines the max RAM server you can purchase from this vendor * This property defines the max RAM server you can purchase from this vendor
*/ */
techVendorMinRam: number = 0; techVendorMinRam = 0;
constructor(p: IConstructorParams) { constructor(p: IConstructorParams) {
if (p.city) { this.city = p.city; } if (p.city) { this.city = p.city; }

@ -15,7 +15,7 @@ import { safetlyCreateUniqueServer } from "../Server/ServerHelpers";
import { import {
getPurchaseServerCost, getPurchaseServerCost,
purchaseRamForHomeComputer, purchaseRamForHomeComputer,
purchaseServer purchaseServer,
} from "../Server/ServerPurchases"; } from "../Server/ServerPurchases";
import { SpecialServerIps } from "../Server/SpecialServerIps"; import { SpecialServerIps } from "../Server/SpecialServerIps";
import { Settings } from "../Settings/Settings"; import { Settings } from "../Settings/Settings";
@ -32,7 +32,7 @@ import {
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetYesButton,
yesNoTxtInpBoxGetNoButton, yesNoTxtInpBoxGetNoButton,
yesNoTxtInpBoxClose, yesNoTxtInpBoxClose,
yesNoTxtInpBoxCreate yesNoTxtInpBoxCreate,
} from "../../utils/YesNoBox"; } from "../../utils/YesNoBox";
import { createElement } from "../../utils/uiHelpers/createElement"; import { createElement } from "../../utils/uiHelpers/createElement";
@ -94,8 +94,8 @@ export function createPurchaseServerPopup(ram: number, p: IPlayer): void {
return; return;
} }
var yesBtn = yesNoTxtInpBoxGetYesButton(); const yesBtn = yesNoTxtInpBoxGetYesButton();
var noBtn = yesNoTxtInpBoxGetNoButton(); const noBtn = yesNoTxtInpBoxGetNoButton();
if (yesBtn == null || noBtn == null) { return; } if (yesBtn == null || noBtn == null) { return; }
yesBtn.innerHTML = "Purchase Server"; yesBtn.innerHTML = "Purchase Server";
noBtn.innerHTML = "Cancel"; noBtn.innerHTML = "Cancel";
@ -158,7 +158,7 @@ export function createStartCorporationPopup(p: IPlayer) {
"and manage your company in the City"); "and manage your company in the City");
removeElementById(popupId); removeElementById(popupId);
return false; return false;
} },
}); });
const seedMoneyButton = createElement("button", { const seedMoneyButton = createElement("button", {
@ -179,11 +179,11 @@ export function createStartCorporationPopup(p: IPlayer) {
} }
dialogBoxCreate( dialogBoxCreate(
"Congratulations! You just started your own corporation with government seed money. " + "Congratulations! You just started your own corporation with government seed money. " +
"You can visit and manage your company in the City" "You can visit and manage your company in the City",
); );
removeElementById(popupId); removeElementById(popupId);
return false; return false;
} },
}) })
const cancelBtn = createPopupCloseButton(popupId, { class: "popup-box-button" }); const cancelBtn = createPopupCloseButton(popupId, { class: "popup-box-button" });
@ -214,7 +214,7 @@ export function createUpgradeHomeCoresPopup(p: IPlayer) {
100e12, 100e12,
1e15, 1e15,
20e15, 20e15,
200e15 200e15,
]; ];
const cost: number = allCosts[currentCores]; const cost: number = allCosts[currentCores];
@ -231,7 +231,7 @@ export function createUpgradeHomeCoresPopup(p: IPlayer) {
p.getHomeComputer().cpuCores++; p.getHomeComputer().cpuCores++;
dialogBoxCreate( dialogBoxCreate(
"You purchased an additional CPU Core for your home computer! It now has " + "You purchased an additional CPU Core for your home computer! It now has " +
p.getHomeComputer().cpuCores + " cores." p.getHomeComputer().cpuCores + " cores.",
); );
} }
yesNoBoxClose(); yesNoBoxClose();
@ -304,7 +304,7 @@ export function purchaseTorRouter(p: IPlayer) {
const darkweb = safetlyCreateUniqueServer({ const darkweb = safetlyCreateUniqueServer({
ip: createUniqueRandomIp(), hostname:"darkweb", organizationName:"", ip: createUniqueRandomIp(), hostname:"darkweb", organizationName:"",
isConnectedTo:false, adminRights:false, purchasedByPlayer:false, maxRam:1 isConnectedTo:false, adminRights:false, purchasedByPlayer:false, maxRam:1,
}); });
AddToAllServers(darkweb); AddToAllServers(darkweb);
SpecialServerIps.addIp("Darkweb Server", darkweb.ip); SpecialServerIps.addIp("Darkweb Server", darkweb.ip);
@ -314,6 +314,6 @@ export function purchaseTorRouter(p: IPlayer) {
dialogBoxCreate( dialogBoxCreate(
"You have purchased a Tor router!<br>" + "You have purchased a Tor router!<br>" +
"You now have access to the dark web from your home computer<br>" + "You now have access to the dark web from your home computer<br>" +
"Use the scan/scan-analyze commands to search for the dark web connection." "Use the scan/scan-analyze commands to search for the dark web connection.",
); );
} }

@ -78,4 +78,4 @@ export enum LocationName {
// Default name for Location objects // Default name for Location objects
Void = "The Void", Void = "The Void",
}; }

@ -28,7 +28,7 @@ export class ApplyToJobButton extends React.Component<IProps, any> {
getJobRequirementTooltip(): string { getJobRequirementTooltip(): string {
const pos = this.props.p.getNextCompanyPosition(this.props.company, this.props.entryPosType); const pos = this.props.p.getNextCompanyPosition(this.props.company, this.props.entryPosType);
if (pos == null) { return "" }; if (pos == null) { return "" }
if (!this.props.company.hasPosition(pos)) { return ""; } if (!this.props.company.hasPosition(pos)) { return ""; }

@ -23,7 +23,7 @@ export class LocationCity extends React.Component<IProps, any> {
function LocationLetter(location: LocationName) { function LocationLetter(location: LocationName) {
if (location) if (location)
return <span key={location} className='tooltip' style={{color: 'blue', whiteSpace: 'nowrap', margin: '0px', padding: '0px', cursor: 'pointer'}} onClick={topprop.enterLocation.bind(thiscity, location)}> return <span key={location} className="tooltip" style={{color: 'blue', whiteSpace: 'nowrap', margin: '0px', padding: '0px', cursor: 'pointer'}} onClick={topprop.enterLocation.bind(thiscity, location)}>
X X
</span> </span>
return <span>*</span> return <span>*</span>
@ -37,8 +37,8 @@ export class LocationCity extends React.Component<IProps, any> {
let locI = 0; let locI = 0;
function lineElems(s: string) { function lineElems(s: string) {
let elems: any[] = []; const elems: any[] = [];
let matches: any[] = []; const matches: any[] = [];
let match: any; let match: any;
while ((match = locationLettersRegex.exec(s)) !== null) { while ((match = locationLettersRegex.exec(s)) !== null) {
matches.push(match); matches.push(match);
@ -48,7 +48,7 @@ export class LocationCity extends React.Component<IProps, any> {
return elems; return elems;
} }
let parts: any[] = []; const parts: any[] = [];
for(let i = 0; i < matches.length; i++) { for(let i = 0; i < matches.length; i++) {
const startI = i === 0 ? 0 : matches[i-1].index+1; const startI = i === 0 ? 0 : matches[i-1].index+1;
const endI = matches[i].index; const endI = matches[i].index;
@ -61,7 +61,7 @@ export class LocationCity extends React.Component<IProps, any> {
return elems; return elems;
} }
let elems: any[] = []; const elems: any[] = [];
const lines = this.props.city.asciiArt.split('\n'); const lines = this.props.city.asciiArt.split('\n');
for(const i in lines) { for(const i in lines) {
elems.push(<pre key={i}>{lineElems(lines[i])}</pre>) elems.push(<pre key={i}>{lineElems(lines[i])}</pre>)

@ -30,7 +30,7 @@ import {
yesNoBoxGetYesButton, yesNoBoxGetYesButton,
yesNoBoxGetNoButton, yesNoBoxGetNoButton,
yesNoBoxClose, yesNoBoxClose,
yesNoBoxCreate yesNoBoxCreate,
} from "../../../utils/YesNoBox"; } from "../../../utils/YesNoBox";
type IProps = { type IProps = {
@ -186,7 +186,7 @@ export class CompanyLocation extends React.Component<IProps, IState> {
if (updateState) { if (updateState) {
this.setState({ this.setState({
employedHere: this.jobTitle != null employedHere: this.jobTitle != null,
}); });
} }
} }
@ -218,8 +218,8 @@ export class CompanyLocation extends React.Component<IProps, IState> {
quit(e: React.MouseEvent<HTMLElement>) { quit(e: React.MouseEvent<HTMLElement>) {
if (!e.isTrusted) { return false; } if (!e.isTrusted) { return false; }
var yesBtn = yesNoBoxGetYesButton(); const yesBtn = yesNoBoxGetYesButton();
var noBtn = yesNoBoxGetNoButton(); const noBtn = yesNoBoxGetNoButton();
if (yesBtn == null || noBtn == null) { return; } if (yesBtn == null || noBtn == null) { return; }
yesBtn.innerHTML = "Quit job"; yesBtn.innerHTML = "Quit job";
noBtn.innerHTML = "Cancel"; noBtn.innerHTML = "Cancel";

@ -64,7 +64,7 @@ export class GenericLocation extends React.Component<IProps, any> {
key={"companylocation"} key={"companylocation"}
locName={this.props.loc.name} locName={this.props.loc.name}
p={this.props.p} p={this.props.p}
/> />,
) )
} }
@ -74,7 +74,7 @@ export class GenericLocation extends React.Component<IProps, any> {
key={"gymlocation"} key={"gymlocation"}
loc={this.props.loc} loc={this.props.loc}
p={this.props.p} p={this.props.p}
/> />,
) )
} }
@ -83,7 +83,7 @@ export class GenericLocation extends React.Component<IProps, any> {
<HospitalLocation <HospitalLocation
key={"hospitallocation"} key={"hospitallocation"}
p={this.props.p} p={this.props.p}
/> />,
) )
} }
@ -92,7 +92,7 @@ export class GenericLocation extends React.Component<IProps, any> {
<SlumsLocation <SlumsLocation
key={"slumslocation"} key={"slumslocation"}
p={this.props.p} p={this.props.p}
/> />,
) )
} }
@ -103,7 +103,7 @@ export class GenericLocation extends React.Component<IProps, any> {
key={"speciallocation"} key={"speciallocation"}
loc={this.props.loc} loc={this.props.loc}
p={this.props.p} p={this.props.p}
/> />,
) )
} }
@ -113,7 +113,7 @@ export class GenericLocation extends React.Component<IProps, any> {
key={"techvendorlocation"} key={"techvendorlocation"}
loc={this.props.loc} loc={this.props.loc}
p={this.props.p} p={this.props.p}
/> />,
) )
} }
@ -123,7 +123,7 @@ export class GenericLocation extends React.Component<IProps, any> {
key={"travelagencylocation"} key={"travelagencylocation"}
p={this.props.p} p={this.props.p}
travel={this.props.travel} travel={this.props.travel}
/> />,
) )
} }
@ -133,7 +133,7 @@ export class GenericLocation extends React.Component<IProps, any> {
key={"universitylocation"} key={"universitylocation"}
loc={this.props.loc} loc={this.props.loc}
p={this.props.p} p={this.props.p}
/> />,
) )
} }
@ -142,7 +142,7 @@ export class GenericLocation extends React.Component<IProps, any> {
<CasinoLocation <CasinoLocation
key={"casinoLocation"} key={"casinoLocation"}
p={this.props.p} p={this.props.p}
/> />,
) )
} }

@ -136,7 +136,7 @@ export class LocationRoot extends React.Component<IProps, IState> {
if (this.props.p.travel(to)) { if (this.props.p.travel(to)) {
this.setState({ this.setState({
inCity: true, inCity: true,
city: to city: to,
}); });
} }
} }

@ -72,7 +72,7 @@ export class TechVendorLocation extends React.Component<IProps, any> {
onClick={() => createPurchaseServerPopup(i, this.props.p)} onClick={() => createPurchaseServerPopup(i, this.props.p)}
style={this.btnStyle} style={this.btnStyle}
text={<>Purchase {i}GB Server - {Money(cost)}</>} text={<>Purchase {i}GB Server - {Money(cost)}</>}
/> />,
) )
} }

@ -38,8 +38,8 @@ export class TravelAgencyLocation extends React.Component<IProps, any> {
function LocationLetter(props: any) { function LocationLetter(props: any) {
if(props.city !== thisTravelAgencyLocation.props.p.city) { if(props.city !== thisTravelAgencyLocation.props.p.city) {
return <span className='tooltip' style={{color: 'blue', whiteSpace: 'nowrap', margin: '0px', padding: '0px'}} onClick={createTravelPopup.bind(null, props.city, thisTravelAgencyLocation.props.travel)}> return <span className="tooltip" style={{color: 'blue', whiteSpace: 'nowrap', margin: '0px', padding: '0px'}} onClick={createTravelPopup.bind(null, props.city, thisTravelAgencyLocation.props.travel)}>
<span className='tooltiptext'>{props.city}</span> <span className="tooltiptext">{props.city}</span>
{props.city[0]} {props.city[0]}
</span> </span>
} }
@ -55,20 +55,20 @@ export class TravelAgencyLocation extends React.Component<IProps, any> {
<pre> ,_ . ._. _. .</pre> <pre> ,_ . ._. _. .</pre>
<pre> , _-\','|~\~ ~/ ;-'_ _-' ,;_;_, ~~-</pre> <pre> , _-\','|~\~ ~/ ;-'_ _-' ,;_;_, ~~-</pre>
<pre> /~~-\_/-'~'--' \~~| ', ,' / / ~|-_\_/~/~ ~~--~~~~'--_</pre> <pre> /~~-\_/-'~'--' \~~| ', ,' / / ~|-_\_/~/~ ~~--~~~~'--_</pre>
<pre> / ,/'-/~ '\ ,' _ , '<LocationLetter city='Volhaven' />,'|~ ._/-, /~</pre> <pre> / ,/'-/~ '\ ,' _ , '<LocationLetter city="Volhaven" />,'|~ ._/-, /~</pre>
<pre> ~/-'~\_, '-,| '|. ' ~ ,\ /'~ / /_ /~</pre> <pre> ~/-'~\_, '-,| '|. ' ~ ,\ /'~ / /_ /~</pre>
<pre>.-~ '| '',\~|\ _\~ ,_ , <LocationLetter city='Chongqing' /> /,</pre> <pre>.-~ '| '',\~|\ _\~ ,_ , <LocationLetter city="Chongqing" /> /,</pre>
<pre> '\ <LocationLetter city='Sector-12' /> /'~ |_/~\\,-,~ \ " ,_,/ |</pre> <pre> '\ <LocationLetter city="Sector-12" /> /'~ |_/~\\,-,~ \ " ,_,/ |</pre>
<pre> | / ._-~'\_ _~| \ ) <LocationLetter city='New Tokyo' /></pre> <pre> | / ._-~'\_ _~| \ ) <LocationLetter city="New Tokyo" /></pre>
<pre> \ __-\ '/ ~ |\ \_ / ~</pre> <pre> \ __-\ '/ ~ |\ \_ / ~</pre>
<pre> ., '\ |, ~-_ - | \\_' ~| /\ \~ ,</pre> <pre> ., '\ |, ~-_ - | \\_' ~| /\ \~ ,</pre>
<pre> ~-_' _; '\ '-, \,' /\/ |</pre> <pre> ~-_' _; '\ '-, \,' /\/ |</pre>
<pre> '\_,~'\_ \_ _, /' ' |, /|'</pre> <pre> '\_,~'\_ \_ _, /' ' |, /|'</pre>
<pre> / \_ ~ | / \ ~'; -,_.</pre> <pre> / \_ ~ | / \ ~'; -,_.</pre>
<pre> | ~\ | | , '-_, ,; ~ ~\</pre> <pre> | ~\ | | , '-_, ,; ~ ~\</pre>
<pre> \, <LocationLetter city='Aevum' /> / \ / /| ,-, , -,</pre> <pre> \, <LocationLetter city="Aevum" /> / \ / /| ,-, , -,</pre>
<pre> | ,/ | |' |/ ,- ~ \ '.</pre> <pre> | ,/ | |' |/ ,- ~ \ '.</pre>
<pre> ,| ,/ \ ,/ \ <LocationLetter city='Ishima' /> |</pre> <pre> ,| ,/ \ ,/ \ <LocationLetter city="Ishima" /> |</pre>
<pre> / | ~ -~~-, / _</pre> <pre> / | ~ -~~-, / _</pre>
<pre> | ,-' ~ /</pre> <pre> | ,-' ~ /</pre>
<pre> / ,' ~</pre> <pre> / ,' ~</pre>
@ -93,7 +93,7 @@ export class TravelAgencyLocation extends React.Component<IProps, any> {
onClick={createTravelPopup.bind(null, city, this.props.travel)} onClick={createTravelPopup.bind(null, city, this.props.travel)}
style={this.btnStyle} style={this.btnStyle}
text={`Travel to ${city}`} text={`Travel to ${city}`}
/> />,
) )
} }

@ -9,13 +9,13 @@ export class Message {
} }
// Name of Message file // Name of Message file
filename: string = ""; filename = "";
// The text contains in the Message // The text contains in the Message
msg: string = ""; msg = "";
// Flag indicating whether this Message has been received by the player // Flag indicating whether this Message has been received by the player
recvd: boolean = false; recvd = false;
constructor(filename="", msg="") { constructor(filename="", msg="") {
this.filename = filename; this.filename = filename;

@ -23,7 +23,7 @@ export function displayMilestonesContent() {
if (milestonesContainer instanceof HTMLElement) { if (milestonesContainer instanceof HTMLElement) {
ReactDOM.render( ReactDOM.render(
<Root player={Player}/>, <Root player={Player}/>,
milestonesContainer milestonesContainer,
); );
} }
} }

@ -6,7 +6,7 @@ import { Faction } from "../Faction/Faction";
import { GetServerByHostname } from "../Server/ServerHelpers"; import { GetServerByHostname } from "../Server/ServerHelpers";
function allFactionAugs(p: IPlayer, f: Faction): boolean { function allFactionAugs(p: IPlayer, f: Faction): boolean {
const factionAugs = f.augmentations.slice().filter((aug)=> "NeuroFlux Governor" !== aug); const factionAugs = f.augmentations.slice().filter((aug)=> aug !== "NeuroFlux Governor");
for(const factionAug of factionAugs) { for(const factionAug of factionAugs) {
if(!p.augmentations.some(aug => {return aug.name == factionAug})) return false; if(!p.augmentations.some(aug => {return aug.name == factionAug})) return false;
} }

@ -65,7 +65,7 @@ let NodeTypes = {
Database: "Database Node", // No actions available Database: "Database Node", // No actions available
Spam: "Spam Node", // No actions Available Spam: "Spam Node", // No actions Available
Transfer: "Transfer Node", // Can Weaken, Scan, Fortify and Overflow Transfer: "Transfer Node", // Can Weaken, Scan, Fortify and Overflow
Shield: "Shield Node" // Can Fortify Shield: "Shield Node", // Can Fortify
} }
let NodeActions = { let NodeActions = {
@ -252,7 +252,7 @@ HackingMission.prototype.init = function() {
var stats = { var stats = {
atk: randMult * getRandomInt(80, 86), atk: randMult * getRandomInt(80, 86),
def: randMult * getRandomInt(5, 10), def: randMult * getRandomInt(5, 10),
hp: randMult * getRandomInt(210, 230) hp: randMult * getRandomInt(210, 230),
} }
this.enemyCores.push(new Node(NodeTypes.Core, stats)); this.enemyCores.push(new Node(NodeTypes.Core, stats));
this.enemyCores[i].setControlledByEnemy(); this.enemyCores[i].setControlledByEnemy();
@ -262,7 +262,7 @@ HackingMission.prototype.init = function() {
var stats = { var stats = {
atk: 0, atk: 0,
def: randMult * getRandomInt(10, 20), def: randMult * getRandomInt(10, 20),
hp: randMult * getRandomInt(275, 300) hp: randMult * getRandomInt(275, 300),
} }
this.enemyNodes.push(new Node(NodeTypes.Firewall, stats)); this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));
this.enemyNodes[i].setControlledByEnemy(); this.enemyNodes[i].setControlledByEnemy();
@ -272,7 +272,7 @@ HackingMission.prototype.init = function() {
var stats = { var stats = {
atk: 0, atk: 0,
def: randMult * getRandomInt(30, 55), def: randMult * getRandomInt(30, 55),
hp: randMult * getRandomInt(210, 275) hp: randMult * getRandomInt(210, 275),
} }
var node = new Node(NodeTypes.Database, stats); var node = new Node(NodeTypes.Database, stats);
node.setControlledByEnemy(); node.setControlledByEnemy();
@ -674,7 +674,7 @@ HackingMission.prototype.createMap = function() {
var stats = { var stats = {
atk: 0, atk: 0,
def: averageAttack * 1.1 + getRandomInt(15, 45), def: averageAttack * 1.1 + getRandomInt(15, 45),
hp: randMult * getRandomInt(200, 225) hp: randMult * getRandomInt(200, 225),
} }
node = new Node(NodeTypes.Spam, stats); node = new Node(NodeTypes.Spam, stats);
break; break;
@ -682,7 +682,7 @@ HackingMission.prototype.createMap = function() {
var stats = { var stats = {
atk: 0, atk: 0,
def: averageAttack * 1.1 + getRandomInt(15, 45), def: averageAttack * 1.1 + getRandomInt(15, 45),
hp: randMult * getRandomInt(250, 275) hp: randMult * getRandomInt(250, 275),
} }
node = new Node(NodeTypes.Transfer, stats); node = new Node(NodeTypes.Transfer, stats);
break; break;
@ -691,7 +691,7 @@ HackingMission.prototype.createMap = function() {
var stats = { var stats = {
atk: 0, atk: 0,
def: averageAttack * 1.1 + getRandomInt(30, 70), def: averageAttack * 1.1 + getRandomInt(30, 70),
hp: randMult * getRandomInt(300, 320) hp: randMult * getRandomInt(300, 320),
} }
node = new Node(NodeTypes.Shield, stats); node = new Node(NodeTypes.Shield, stats);
break; break;
@ -971,10 +971,10 @@ HackingMission.prototype.initJsPlumb = function() {
PaintStyle: { PaintStyle: {
gradient: { stops: [ gradient: { stops: [
[ 0, "#FFFFFF" ], [ 0, "#FFFFFF" ],
[ 1, "#FFFFFF" ] [ 1, "#FFFFFF" ],
] }, ] },
stroke: "#FFFFFF", stroke: "#FFFFFF",
strokeWidth: 8 strokeWidth: 8,
}, },
}); });
@ -986,7 +986,7 @@ HackingMission.prototype.initJsPlumb = function() {
deleteEndpointsOnEmpty:true, deleteEndpointsOnEmpty:true,
maxConnections:1, maxConnections:1,
anchor:"Continuous", anchor:"Continuous",
connector:"Flowchart" connector:"Flowchart",
}); });
} }
@ -995,28 +995,28 @@ HackingMission.prototype.initJsPlumb = function() {
instance.makeTarget(this.enemyCores[i].el, { instance.makeTarget(this.enemyCores[i].el, {
maxConnections:-1, maxConnections:-1,
anchor:"Continuous", anchor:"Continuous",
connector:"Flowchart" connector:"Flowchart",
}); });
} }
for (var i = 0; i < this.enemyDatabases.length; ++i) { for (var i = 0; i < this.enemyDatabases.length; ++i) {
instance.makeTarget(this.enemyDatabases[i].el, { instance.makeTarget(this.enemyDatabases[i].el, {
maxConnections:-1, maxConnections:-1,
anchor:"Continuous", anchor:"Continuous",
connector:["Flowchart"] connector:["Flowchart"],
}); });
} }
for (var i = 0; i < this.enemyNodes.length; ++i) { for (var i = 0; i < this.enemyNodes.length; ++i) {
instance.makeTarget(this.enemyNodes[i].el, { instance.makeTarget(this.enemyNodes[i].el, {
maxConnections:-1, maxConnections:-1,
anchor:"Continuous", anchor:"Continuous",
connector:"Flowchart" connector:"Flowchart",
}); });
} }
for (var i = 0; i < this.miscNodes.length; ++i) { for (var i = 0; i < this.miscNodes.length; ++i) {
instance.makeTarget(this.miscNodes[i].el, { instance.makeTarget(this.miscNodes[i].el, {
maxConnections:-1, maxConnections:-1,
anchor:"Continuous", anchor:"Continuous",
connector:"Flowchart" connector:"Flowchart",
}); });
} }
@ -1264,7 +1264,7 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
deleteEndpointsOnEmpty:true, deleteEndpointsOnEmpty:true,
maxConnections:1, maxConnections:1,
anchor:"Continuous", anchor:"Continuous",
connector:"Flowchart" connector:"Flowchart",
}); });
} else { } else {
targetNode.setControlledByEnemy(); targetNode.setControlledByEnemy();
@ -1273,7 +1273,7 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
this.jsplumbinstance.makeTarget(targetNode.el, { this.jsplumbinstance.makeTarget(targetNode.el, {
maxConnections:-1, maxConnections:-1,
anchor:"Continuous", anchor:"Continuous",
connector:["Flowchart"] connector:["Flowchart"],
}); });
} }
@ -1393,7 +1393,7 @@ HackingMission.prototype.enemyAISelectAction = function(nodeObj) {
// Create connection // Create connection
nodeObj.conn = this.jsplumbinstance.connect({ nodeObj.conn = this.jsplumbinstance.connect({
source:nodeObj.el, source:nodeObj.el,
target:node.el target:node.el,
}); });
++node.targetedCount; ++node.targetedCount;
} else { } else {
@ -1409,7 +1409,7 @@ HackingMission.prototype.enemyAISelectAction = function(nodeObj) {
// Create connection // Create connection
nodeObj.conn = this.jsplumbinstance.connect({ nodeObj.conn = this.jsplumbinstance.connect({
source:nodeObj.el, source:nodeObj.el,
target:node.el target:node.el,
}); });
++node.targetedCount; ++node.targetedCount;
} }

@ -13,7 +13,7 @@ export class Environment {
/** /**
* Whether or not the script that uses this Environment should stop running * Whether or not the script that uses this Environment should stop running
*/ */
stopFlag: boolean = false; stopFlag = false;
/** /**
* Environment variables (currently only Netscript functions) * Environment variables (currently only Netscript functions)
@ -54,7 +54,7 @@ export class Environment {
//Sets the value of a variable in any scope //Sets the value of a variable in any scope
set(name: string, value: any) { set(name: string, value: any) {
var scope = this.lookup(name); const scope = this.lookup(name);
//If scope has a value, then this variable is already set in a higher scope, so //If scope has a value, then this variable is already set in a higher scope, so
//set is there. Otherwise, create a new variable in the local scope //set is there. Otherwise, create a new variable in the local scope

@ -307,7 +307,7 @@ export const RamCosts: IMap<any> = {
heart: { heart: {
// Easter egg function // Easter egg function
break : () => 0, break : () => 0,
} },
} }
export function getRamCost(...args: string[]): number { export function getRamCost(...args: string[]): number {

@ -24,7 +24,7 @@ export class WorkerScript {
/** /**
* Copy of the script's code * Copy of the script's code
*/ */
code: string = ""; code = "";
/** /**
* Holds the timeoutID (numeric value) for whenever this script is blocked by a * Holds the timeoutID (numeric value) for whenever this script is blocked by a
@ -62,7 +62,7 @@ export class WorkerScript {
/** /**
* Status message in case of script error. Currently unused I think * Status message in case of script error. Currently unused I think
*/ */
errorMessage: string = ""; errorMessage = "";
/** /**
* Used for static RAM calculation. Stores names of all functions that have * Used for static RAM calculation. Stores names of all functions that have
@ -78,7 +78,7 @@ export class WorkerScript {
/** /**
* Script's output/return value. Currently not used or implemented * Script's output/return value. Currently not used or implemented
*/ */
output: string = ""; output = "";
/** /**
* Process ID. Must be an integer. Used for efficient script * Process ID. Must be an integer. Used for efficient script
@ -89,12 +89,12 @@ export class WorkerScript {
/** /**
* Script's Static RAM usage. Equivalent to underlying script's RAM usage * Script's Static RAM usage. Equivalent to underlying script's RAM usage
*/ */
ramUsage: number = 0; ramUsage = 0;
/** /**
* Whether or not this workerScript is currently running * Whether or not this workerScript is currently running
*/ */
running: boolean = false; running = false;
/** /**
* Reference to underlying RunningScript object * Reference to underlying RunningScript object
@ -155,7 +155,7 @@ export class WorkerScript {
* Returns null if it cannot be found (which would be a bug) * Returns null if it cannot be found (which would be a bug)
*/ */
getScript(): Script | null { getScript(): Script | null {
let server = this.getServer(); const server = this.getServer();
for (let i = 0; i < server.scripts.length; ++i) { for (let i = 0; i < server.scripts.length; ++i) {
if (server.scripts[i].filename === this.name) { if (server.scripts[i].filename === this.name) {
return server.scripts[i]; return server.scripts[i];

@ -50,7 +50,7 @@ export function killWorkerScript(script: RunningScript | WorkerScript | number,
} }
} }
function killWorkerScriptByPid(pid: number, rerenderUi: boolean=true): boolean { function killWorkerScriptByPid(pid: number, rerenderUi=true): boolean {
const ws = workerScripts.get(pid); const ws = workerScripts.get(pid);
if (ws instanceof WorkerScript) { if (ws instanceof WorkerScript) {
stopAndCleanUpWorkerScript(ws, rerenderUi); stopAndCleanUpWorkerScript(ws, rerenderUi);
@ -61,7 +61,7 @@ function killWorkerScriptByPid(pid: number, rerenderUi: boolean=true): boolean {
return false; return false;
} }
function stopAndCleanUpWorkerScript(workerScript: WorkerScript, rerenderUi: boolean=true): void { function stopAndCleanUpWorkerScript(workerScript: WorkerScript, rerenderUi=true): void {
workerScript.env.stopFlag = true; workerScript.env.stopFlag = true;
killNetscriptDelay(workerScript); killNetscriptDelay(workerScript);
removeWorkerScript(workerScript, rerenderUi); removeWorkerScript(workerScript, rerenderUi);
@ -74,7 +74,7 @@ function stopAndCleanUpWorkerScript(workerScript: WorkerScript, rerenderUi: bool
* @param {WorkerScript | number} - Identifier for WorkerScript. Either the object itself, or * @param {WorkerScript | number} - Identifier for WorkerScript. Either the object itself, or
* its index in the global workerScripts array * its index in the global workerScripts array
*/ */
function removeWorkerScript(workerScript: WorkerScript, rerenderUi: boolean=true): void { function removeWorkerScript(workerScript: WorkerScript, rerenderUi=true): void {
if (workerScript instanceof WorkerScript) { if (workerScript instanceof WorkerScript) {
const ip = workerScript.serverIp; const ip = workerScript.serverIp;
const name = workerScript.name; const name = workerScript.name;

@ -9,7 +9,7 @@ import { Augmentation } from "./Augmentation/Augmentation";
import { Augmentations } from "./Augmentation/Augmentations"; import { Augmentations } from "./Augmentation/Augmentations";
import { import {
augmentationExists, augmentationExists,
installAugmentations installAugmentations,
} from "./Augmentation/AugmentationHelpers"; } from "./Augmentation/AugmentationHelpers";
import { prestigeAugmentation } from "./Prestige"; import { prestigeAugmentation } from "./Prestige";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames"; import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
@ -28,13 +28,13 @@ import {
calculatePercentMoneyHacked, calculatePercentMoneyHacked,
calculateHackingTime, calculateHackingTime,
calculateGrowTime, calculateGrowTime,
calculateWeakenTime calculateWeakenTime,
} from "./Hacking"; } from "./Hacking";
import { calculateServerGrowth } from "./Server/formulas/grow"; import { calculateServerGrowth } from "./Server/formulas/grow";
import { import {
AllGangs, AllGangs,
GangMemberUpgrades, GangMemberUpgrades,
GangMemberTasks GangMemberTasks,
} from "./Gang"; } from "./Gang";
import { Faction } from "./Faction/Faction"; import { Faction } from "./Faction/Faction";
import { Factions, factionExists } from "./Faction/Factions"; import { Factions, factionExists } from "./Faction/Factions";
@ -43,7 +43,7 @@ import { FactionWorkType } from "./Faction/FactionWorkTypeEnum";
import { import {
netscriptCanGrow, netscriptCanGrow,
netscriptCanHack, netscriptCanHack,
netscriptCanWeaken netscriptCanWeaken,
} from "./Hacking/netscriptCanHack"; } from "./Hacking/netscriptCanHack";
import { import {
@ -114,7 +114,7 @@ import {
import { import {
getPurchaseServerCost, getPurchaseServerCost,
getPurchaseServerLimit, getPurchaseServerLimit,
getPurchaseServerMaxRam getPurchaseServerMaxRam,
} from "./Server/ServerPurchases"; } from "./Server/ServerPurchases";
import { Settings } from "./Settings/Settings"; import { Settings } from "./Settings/Settings";
import { SpecialServerIps } from "./Server/SpecialServerIps"; import { SpecialServerIps } from "./Server/SpecialServerIps";
@ -146,13 +146,13 @@ import { PositionTypes } from "./StockMarket/data/PositionTypes";
import { StockSymbols } from "./StockMarket/data/StockSymbols"; import { StockSymbols } from "./StockMarket/data/StockSymbols";
import { import {
getStockMarket4SDataCost, getStockMarket4SDataCost,
getStockMarket4STixApiCost getStockMarket4STixApiCost,
} from "./StockMarket/StockMarketCosts"; } from "./StockMarket/StockMarketCosts";
import { isValidFilePath } from "./Terminal/DirectoryHelpers"; import { isValidFilePath } from "./Terminal/DirectoryHelpers";
import { TextFile, getTextFile, createTextFile } from "./TextFile"; import { TextFile, getTextFile, createTextFile } from "./TextFile";
import { import {
unknownBladeburnerActionErrorMessage unknownBladeburnerActionErrorMessage,
} from"./NetscriptBladeburner"; } from"./NetscriptBladeburner";
import { Gang } from "./Gang"; import { Gang } from "./Gang";
import { import {
@ -351,7 +351,7 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg( throw makeRuntimeRejectMsg(
workerScript, workerScript,
`Invalid scriptArgs argument passed into getRunningScript() from ${callingFnName}(). ` + `Invalid scriptArgs argument passed into getRunningScript() from ${callingFnName}(). ` +
`This is probably a bug. Please report to game developer` `This is probably a bug. Please report to game developer`,
); );
} }
@ -489,7 +489,7 @@ function NetscriptFunctions(workerScript) {
} }
return null; return null;
} }
let call = {line: "-1", func: "unknown"};; let call = {line: "-1", func: "unknown"};
let chromeCall = parseChromeStackline(stackline); let chromeCall = parseChromeStackline(stackline);
if (chromeCall) { if (chromeCall) {
call = chromeCall; call = chromeCall;
@ -1343,7 +1343,7 @@ function NetscriptFunctions(workerScript) {
scriptname.forEach(function(script) { scriptname.forEach(function(script) {
if (NetscriptFunctions(workerScript).scp(script, ip1, ip2)) { if (NetscriptFunctions(workerScript).scp(script, ip1, ip2)) {
res = true; res = true;
}; }
}); });
return res; return res;
} }
@ -1965,7 +1965,7 @@ function NetscriptFunctions(workerScript) {
shares: shares, shares: shares,
price: price, price: price,
type: orderType, type: orderType,
pos: orderPos pos: orderPos,
}; };
return cancelOrder(params, workerScript); return cancelOrder(params, workerScript);
}, },
@ -2832,7 +2832,7 @@ function NetscriptFunctions(workerScript) {
var darkweb = safetlyCreateUniqueServer({ var darkweb = safetlyCreateUniqueServer({
ip: createUniqueRandomIp(), hostname:"darkweb", organizationName:"", ip: createUniqueRandomIp(), hostname:"darkweb", organizationName:"",
isConnectedTo:false, adminRights:false, purchasedByPlayer:false, maxRam:1 isConnectedTo:false, adminRights:false, purchasedByPlayer:false, maxRam:1,
}); });
AddToAllServers(darkweb); AddToAllServers(darkweb);
SpecialServerIps.addIp("Darkweb Server", darkweb.ip); SpecialServerIps.addIp("Darkweb Server", darkweb.ip);
@ -2943,7 +2943,7 @@ function NetscriptFunctions(workerScript) {
dexterity: Player.dexterity, dexterity: Player.dexterity,
agility: Player.agility, agility: Player.agility,
charisma: Player.charisma, charisma: Player.charisma,
intelligence: Player.intelligence intelligence: Player.intelligence,
} }
}, },
getCharacterInformation: function() { getCharacterInformation: function() {
@ -4087,7 +4087,7 @@ function NetscriptFunctions(workerScript) {
updateDynamicRam("getBonusTime", getRamCost("bladeburner", "getBonusTime")); updateDynamicRam("getBonusTime", getRamCost("bladeburner", "getBonusTime"));
checkBladeburnerAccess("getBonusTime"); checkBladeburnerAccess("getBonusTime");
return Math.round(Player.bladeburner.storedCycles / 5); return Math.round(Player.bladeburner.storedCycles / 5);
} },
}, // End Bladeburner }, // End Bladeburner
// Coding Contract API // Coding Contract API
@ -4373,7 +4373,7 @@ function NetscriptFunctions(workerScript) {
} }
return Player.sleeves[sleeveNumber].tryBuyAugmentation(Player, aug); return Player.sleeves[sleeveNumber].tryBuyAugmentation(Player, aug);
} },
}, // End sleeve }, // End sleeve
formulas: { formulas: {
basic: { basic: {
@ -4438,7 +4438,7 @@ function NetscriptFunctions(workerScript) {
constants: function() { constants: function() {
checkFormulasAccess("hacknetNodes.constants", 5); checkFormulasAccess("hacknetNodes.constants", 5);
return Object.assign({}, HacknetNodeConstants, HacknetServerConstants); return Object.assign({}, HacknetNodeConstants, HacknetServerConstants);
} },
}, },
hacknetServers: { hacknetServers: {
hashGainRate: function(level, ram, cores, mult=1) { hashGainRate: function(level, ram, cores, mult=1) {
@ -4476,14 +4476,14 @@ function NetscriptFunctions(workerScript) {
constants: function() { constants: function() {
checkFormulasAccess("hacknetServers.constants", 9); checkFormulasAccess("hacknetServers.constants", 9);
return Object.assign({}, HacknetServerConstants); return Object.assign({}, HacknetServerConstants);
} },
}, },
}, // end formulas }, // end formulas
heart: { heart: {
// Easter egg function // Easter egg function
break: function() { break: function() {
return Player.karma; return Player.karma;
} },
}, },
exploit: function() { exploit: function() {
Player.giveExploit(Exploit.UndocumentedFunctionCall); Player.giveExploit(Exploit.UndocumentedFunctionCall);
@ -4515,7 +4515,7 @@ function NetscriptFunctions(workerScript) {
ret[key.slice(2)] = value; ret[key.slice(2)] = value;
} }
return ret; return ret;
} },
} // End return } // End return
} // End NetscriptFunction() } // End NetscriptFunction()

@ -49,7 +49,7 @@ export async function executeJSScript(scripts = [], workerScript) {
if (urls != null) { if (urls != null) {
for (const b in urls) URL.revokeObjectURL(b.url); for (const b in urls) URL.revokeObjectURL(b.url);
} }
}; }
} }
/** Returns whether we should compile the script parameter. /** Returns whether we should compile the script parameter.
@ -121,7 +121,7 @@ export function _getScriptUrls(script, scripts, seen) {
// The top url in the stack is the replacement import file for this script. // The top url in the stack is the replacement import file for this script.
urlStack.push(...urls); urlStack.push(...urls);
return [prefix, urls[urls.length - 1].url, suffix].join(''); return [prefix, urls[urls.length - 1].url, suffix].join('');
} },
); );
// We automatically define a print function() in the NetscriptJS module so that // We automatically define a print function() in the NetscriptJS module so that

@ -32,7 +32,7 @@ export class NetscriptPort {
if (this.data.length === 0) { if (this.data.length === 0) {
return "NULL PORT DATA"; return "NULL PORT DATA";
} else { } else {
var foo = this.data.slice(); const foo = this.data.slice();
return foo[0]; return foo[0];
} }
} }

@ -111,7 +111,7 @@ function startNetscript2Script(workerScript) {
return result; return result;
} }
} }
}; }
for (let prop in workerScript.env.vars) { for (let prop in workerScript.env.vars) {
if (typeof workerScript.env.vars[prop] !== "function") continue; if (typeof workerScript.env.vars[prop] !== "function") continue;
@ -330,7 +330,7 @@ function processNetscript1Imports(code, workerScript) {
FunctionDeclaration: (node) => { FunctionDeclaration: (node) => {
fnNames.push(node.id.name); fnNames.push(node.id.name);
fnDeclarations.push(node); fnDeclarations.push(node);
} },
}); });
//Now we have to generate the code that would create the namespace //Now we have to generate the code that would create the namespace
@ -370,7 +370,7 @@ function processNetscript1Imports(code, workerScript) {
if (fnsToImport.includes(node.id.name)) { if (fnsToImport.includes(node.id.name)) {
fnDeclarations.push(node); fnDeclarations.push(node);
} }
} },
}); });
//Convert FunctionDeclarations into code //Convert FunctionDeclarations into code
@ -379,7 +379,7 @@ function processNetscript1Imports(code, workerScript) {
generatedCode += "\n"; generatedCode += "\n";
}); });
} }
} },
}); });
//If there are no imports, just return the original code //If there are no imports, just return the original code
@ -408,7 +408,7 @@ function processNetscript1Imports(code, workerScript) {
var res = { var res = {
code: code, code: code,
lineOffset: lineOffset lineOffset: lineOffset,
} }
return res; return res;
} }
@ -459,7 +459,7 @@ export function createAndAddWorkerScript(runningScriptObj, server) {
`Not enough RAM to run script ${runningScriptObj.filename} with args ` + `Not enough RAM to run script ${runningScriptObj.filename} with args ` +
`${arrayToString(runningScriptObj.args)}. This likely occurred because you re-loaded ` + `${arrayToString(runningScriptObj.args)}. This likely occurred because you re-loaded ` +
`the game and the script's RAM usage increased (either because of an update to the game or ` + `the game and the script's RAM usage increased (either because of an update to the game or ` +
`your changes to the script.)` `your changes to the script.)`,
); );
return false; return false;
} }
@ -470,7 +470,7 @@ export function createAndAddWorkerScript(runningScriptObj, server) {
if (pid === -1) { if (pid === -1) {
throw new Error( throw new Error(
`Failed to start script because could not find available PID. This is most ` + `Failed to start script because could not find available PID. This is most ` +
`because you have too many scripts running.` `because you have too many scripts running.`,
); );
} }

@ -36,67 +36,67 @@ export abstract class Person {
/** /**
* Stats * Stats
*/ */
hacking_skill: number = 1; hacking_skill = 1;
strength: number = 1; strength = 1;
defense: number = 1; defense = 1;
dexterity: number = 1; dexterity = 1;
agility: number = 1; agility = 1;
charisma: number = 1; charisma = 1;
intelligence: number = 1; intelligence = 1;
hp: number = 10; hp = 10;
max_hp: number = 10; max_hp = 10;
/** /**
* Experience * Experience
*/ */
hacking_exp: number = 0; hacking_exp = 0;
strength_exp: number = 0; strength_exp = 0;
defense_exp: number = 0; defense_exp = 0;
dexterity_exp: number = 0; dexterity_exp = 0;
agility_exp: number = 0; agility_exp = 0;
charisma_exp: number = 0; charisma_exp = 0;
intelligence_exp: number = 0; intelligence_exp = 0;
/** /**
* Multipliers * Multipliers
*/ */
hacking_mult: number = 1; hacking_mult = 1;
strength_mult: number = 1; strength_mult = 1;
defense_mult: number = 1; defense_mult = 1;
dexterity_mult: number = 1; dexterity_mult = 1;
agility_mult: number = 1; agility_mult = 1;
charisma_mult: number = 1; charisma_mult = 1;
hacking_exp_mult: number = 1; hacking_exp_mult = 1;
strength_exp_mult: number = 1; strength_exp_mult = 1;
defense_exp_mult: number = 1; defense_exp_mult = 1;
dexterity_exp_mult: number = 1; dexterity_exp_mult = 1;
agility_exp_mult: number = 1; agility_exp_mult = 1;
charisma_exp_mult: number = 1; charisma_exp_mult = 1;
hacking_chance_mult: number = 1; hacking_chance_mult = 1;
hacking_speed_mult: number = 1; hacking_speed_mult = 1;
hacking_money_mult: number = 1; hacking_money_mult = 1;
hacking_grow_mult: number = 1; hacking_grow_mult = 1;
company_rep_mult: number = 1; company_rep_mult = 1;
faction_rep_mult: number = 1; faction_rep_mult = 1;
crime_money_mult: number = 1; crime_money_mult = 1;
crime_success_mult: number = 1; crime_success_mult = 1;
work_money_mult: number = 1; work_money_mult = 1;
hacknet_node_money_mult: number = 1; hacknet_node_money_mult = 1;
hacknet_node_purchase_cost_mult: number = 1; hacknet_node_purchase_cost_mult = 1;
hacknet_node_ram_cost_mult: number = 1; hacknet_node_ram_cost_mult = 1;
hacknet_node_core_cost_mult: number = 1; hacknet_node_core_cost_mult = 1;
hacknet_node_level_cost_mult: number = 1; hacknet_node_level_cost_mult = 1;
bladeburner_max_stamina_mult: number = 1; bladeburner_max_stamina_mult = 1;
bladeburner_stamina_gain_mult: number = 1; bladeburner_stamina_gain_mult = 1;
bladeburner_analysis_mult: number = 1; bladeburner_analysis_mult = 1;
bladeburner_success_chance_mult : number = 1; bladeburner_success_chance_mult = 1;
/** /**
* Augmentations * Augmentations
@ -128,7 +128,7 @@ export abstract class Person {
* Given an experience amount and stat multiplier, calculates the * Given an experience amount and stat multiplier, calculates the
* stat level. Stat-agnostic (same formula for every stat) * stat level. Stat-agnostic (same formula for every stat)
*/ */
calculateStat(exp: number, mult: number=1): number { calculateStat(exp: number, mult=1): number {
return calculateSkill(exp, mult); return calculateSkill(exp, mult);
} }

@ -12,7 +12,7 @@ import { MoneySourceTracker } from "../../utils/MoneySourceTracker";
import { import {
Reviver, Reviver,
Generic_toJSON, Generic_toJSON,
Generic_fromJSON Generic_fromJSON,
} from "../../../utils/JSONReviver"; } from "../../../utils/JSONReviver";
import Decimal from "decimal.js"; import Decimal from "decimal.js";
@ -203,7 +203,7 @@ export function PlayerObject() {
this.scriptProdSinceLastAug = 0; this.scriptProdSinceLastAug = 0;
this.exploits = []; this.exploits = [];
}; }
// Apply player methods to the prototype using Object.assign() // Apply player methods to the prototype using Object.assign()
Object.assign( Object.assign(
@ -213,7 +213,7 @@ Object.assign(
bladeburnerMethods, bladeburnerMethods,
corporationMethods, corporationMethods,
gangMethods, gangMethods,
augmentationMethods augmentationMethods,
); );
PlayerObject.prototype.toJSON = function() { PlayerObject.prototype.toJSON = function() {

@ -12,7 +12,7 @@ export function hasCorporation() {
export function startCorporation(corpName, additionalShares=0) { export function startCorporation(corpName, additionalShares=0) {
this.corporation = new Corporation({ this.corporation = new Corporation({
name: corpName name: corpName,
}); });
this.corporation.totalShares += additionalShares; this.corporation.totalShares += additionalShares;

Some files were not shown because too many files have changed in this diff Show More