Improved module import styling for all top-level src files

This commit is contained in:
danielyxie
2019-04-11 01:37:40 -07:00
committed by danielyxie
parent 3b6b37f8a6
commit df89cc5002
27 changed files with 751 additions and 629 deletions

View File

@ -1,24 +1,27 @@
import {workerScripts,
killWorkerScript} from "./NetscriptWorker";
// TODO - Convert this to React
import { workerScripts, killWorkerScript } from "./NetscriptWorker";
import { Player } from "./Player";
import { getServer } from "./Server/ServerHelpers";
import { Page, routing } from "./ui/navigationTracking";
import { numeralWrapper } from "./ui/numeralFormat";
import { dialogBoxCreate } from "../utils/DialogBox";
import {createAccordionElement} from "../utils/uiHelpers/createAccordionElement";
import { logBoxCreate } from "../utils/LogBox";
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
import { arrayToString } from "../utils/helpers/arrayToString";
import {createElement} from "../utils/uiHelpers/createElement";
import { createProgressBarText } from "../utils/helpers/createProgressBarText";
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { roundToTwo } from "../utils/helpers/roundToTwo";
import { createAccordionElement } from "../utils/uiHelpers/createAccordionElement";
import { createElement } from "../utils/uiHelpers/createElement";
import { getElementById } from "../utils/uiHelpers/getElementById";
import {logBoxCreate} from "../utils/LogBox";
import {formatNumber,
convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
import { removeChildrenFromElement } from "../utils/uiHelpers/removeChildrenFromElement";
import { removeElement } from "../utils/uiHelpers/removeElement";
import {roundToTwo} from "../utils/helpers/roundToTwo";
import {Page, routing} from "./ui/navigationTracking";
/* {
/**
* {
* serverName: {
* header: Server Header Element
* panel: Server Panel List (ul) element
@ -28,8 +31,8 @@ import {Page, routing} from "./ui/navigationTracking";
* }
* ...
*/
let ActiveScriptsUI = {};
let ActiveScriptsTasks = []; //Sequentially schedule the creation/deletion of UI elements
const ActiveScriptsUI = {};
const ActiveScriptsTasks = []; //Sequentially schedule the creation/deletion of UI elements
const getHeaderHtml = (server) => {
// TODO: calculate the longest hostname length rather than hard coding it

View File

@ -8,25 +8,31 @@ import { Factions, factionExists } from "./Faction/Factions";
import { joinFaction, displayFactionContent } from "./Faction/FactionHelpers";
import { Player } from "./Player";
import { hackWorldDaemon, redPillFlag } from "./RedPill";
import { numeralWrapper } from "./ui/numeralFormat";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import { KEY } from "../utils/helpers/keyCodes";
import { createProgressBarText } from "../utils/helpers/createProgressBarText";
import { dialogBoxCreate } from "../utils/DialogBox";
import { removeChildrenFromElement } from "../utils/uiHelpers/removeChildrenFromElement";
import { Reviver, Generic_toJSON,
Generic_fromJSON } from "../utils/JSONReviver";
import { addOffset } from "../utils/helpers/addOffset";
import { appendLineBreaks } from "../utils/uiHelpers/appendLineBreaks";
import { clearObject } from "../utils/helpers/clearObject";
import { createElement } from "../utils/uiHelpers/createElement";
import { createPopup } from "../utils/uiHelpers/createPopup";
import { Page, routing } from "./ui/navigationTracking";
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { numeralWrapper } from "./ui/numeralFormat";
import { dialogBoxCreate } from "../utils/DialogBox";
import {
Reviver,
Generic_toJSON,
Generic_fromJSON
} from "../utils/JSONReviver";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import { formatNumber } from "../utils/StringHelperFunctions";
import { addOffset } from "../utils/helpers/addOffset";
import { clearObject } from "../utils/helpers/clearObject";
import { createProgressBarText } from "../utils/helpers/createProgressBarText";
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { getRandomInt } from "../utils/helpers/getRandomInt";
import { getTimestamp } from "../utils/helpers/getTimestamp";
import { KEY } from "../utils/helpers/keyCodes";
import { removeChildrenFromElement } from "../utils/uiHelpers/removeChildrenFromElement";
import { appendLineBreaks } from "../utils/uiHelpers/appendLineBreaks";
import { createElement } from "../utils/uiHelpers/createElement";
import { createPopup } from "../utils/uiHelpers/createPopup";
import { removeElement } from "../utils/uiHelpers/removeElement";
import { removeElementById } from "../utils/uiHelpers/removeElementById";

View File

@ -6,24 +6,24 @@ import {createElement} from "../utils/uiHelpers/createElement";
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { isString } from "../utils/helpers/isString";
var cinematicTextFlag = false;
export let cinematicTextFlag = false;
// Lines must be an array of strings
function writeCinematicText(lines) {
export function writeCinematicText(lines) {
cinematicTextFlag = true;
if (lines.constructor !== Array) {
throw new Error("Invalid non-array argument passed into writeCinematicText()");
}
//We'll reuse the 'Red Pill' content
// Reuse the 'Red Pill' content
Engine.loadCinematicTextContent();
var container = document.getElementById("cinematic-text-container");
const container = document.getElementById("cinematic-text-container");
container.style.width = "75%";
if (container == null) {throw new Error("Could not find cinematic-text-container for writeCinematicText()");}
removeChildrenFromElement(container);
for (var i = 0; i < lines.length; ++i) {
for (let i = 0; i < lines.length; ++i) {
if (!isString(lines[i])) {
throw new Error("Invalid non-string element in 'lines' argument. writeCinematicText() failed");
}
@ -45,11 +45,11 @@ function writeCinematicTextRecurse(lines, lineNumber=0) {
function writeCinematicTextLine(line) {
return new Promise(function(resolve, reject) {
var container = document.getElementById("cinematic-text-container");
var pElem = document.createElement("p");
const container = document.getElementById("cinematic-text-container");
const pElem = document.createElement("p");
container.appendChild(pElem);
var promise = writeCinematicTextLetter(pElem, line, 0);
const promise = writeCinematicTextLetter(pElem, line, 0);
promise.then(function(res) {
resolve(res);
}, function(e) {
@ -61,14 +61,15 @@ function writeCinematicTextLine(line) {
function writeCinematicTextLetter(pElem, line, i=0) {
return new Promise(function(resolve, reject) {
setTimeoutRef(function() {
const textToShow = line.substring(0, i);
if (i >= line.length) {
var textToShow = line.substring(0, i);
pElem.innerHTML = textToShow;
return resolve(true);
}
var textToShow = line.substring(0, i);
pElem.innerHTML = textToShow + "<span class='typed-cursor'> &#9608; </span>";
var promise = writeCinematicTextLetter(pElem, line, i+1);
const promise = writeCinematicTextLetter(pElem, line, i+1);
promise.then(function(res) {
resolve(res);
}, function(e) {
@ -96,5 +97,3 @@ function cinematicTextEnd() {
}));
});
}
export {cinematicTextFlag, writeCinematicText};

View File

@ -1,6 +1,8 @@
import { CodingContract,
import {
CodingContract,
CodingContractRewardType,
CodingContractTypes } from "./CodingContracts";
CodingContractTypes
} from "./CodingContracts";
import { Factions } from "./Faction/Factions";
import { Player } from "./Player";
import { AllServers } from "./Server/AllServers";
@ -8,6 +10,7 @@ import { GetServerByHostname } from "./Server/ServerHelpers";
import { getRandomInt } from "../utils/helpers/getRandomInt";
export function generateRandomContract() {
// First select a random problem type
let problemType = getRandomProblemType();

View File

@ -1,11 +1,17 @@
import { codingContractTypesMetadata,
import {
codingContractTypesMetadata,
DescriptionFunc,
GeneratorFunc,
SolverFunc } from "./data/codingcontracttypes";
SolverFunc
} from "./data/codingcontracttypes";
import { IMap } from "./types";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver";
import {
Generic_fromJSON,
Generic_toJSON,
Reviver
} from "../utils/JSONReviver";
import { KEY } from "../utils/helpers/keyCodes";
import { createElement } from "../utils/uiHelpers/createElement";
import { createPopup } from "../utils/uiHelpers/createPopup";
@ -13,6 +19,7 @@ import { removeElementById } from "../utils/uiHelpers/removeElementById";
/* tslint:disable:no-magic-numbers completed-docs max-classes-per-file no-console */
/* Represents different types of problems that a Coding Contract can have */

View File

@ -1,8 +1,10 @@
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
import { CodingContractTypes } from "./CodingContracts";
import { generateContract,
import {
generateContract,
generateRandomContract,
generateRandomContractOnHome } from "./CodingContractGenerator";
generateRandomContractOnHome
} from "./CodingContractGenerator";
import { Companies } from "./Company/Companies";
import { Company } from "./Company/Company";
import { Programs } from "./Programs/Programs";
@ -12,8 +14,7 @@ import { PlayerOwnedSourceFile } from "./SourceFile/PlayerOwnedSourceFile
import { AllServers } from "./Server/AllServers";
import { GetServerByHostname } from "./Server/ServerHelpers";
import { hackWorldDaemon } from "./RedPill";
import { StockMarket,
SymbolToStockMap } from "./StockMarket/StockMarket";
import { StockMarket, SymbolToStockMap } from "./StockMarket/StockMarket";
import { Stock } from "./StockMarket/Stock";
import { Terminal } from "./Terminal";
@ -29,6 +30,7 @@ import { removeElementById } from "../utils/uiHelpers/removeElementBy
import React from "react";
import ReactDOM from "react-dom";
const Component = React.Component;
const validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12];

View File

@ -10,23 +10,30 @@ import { Engine } from "./engine";
import { Faction } from "./Faction/Faction";
import { Factions } from "./Faction/Factions";
import { displayFactionContent } from "./Faction/FactionHelpers";
import { Page, routing } from "./ui/navigationTracking";
import { numeralWrapper } from "./ui/numeralFormat";
import { dialogBoxCreate } from "../utils/DialogBox";
import { Reviver, Generic_toJSON,
Generic_fromJSON } from "../utils/JSONReviver";
import {
Reviver,
Generic_toJSON,
Generic_fromJSON
} from "../utils/JSONReviver";
import { formatNumber } from "../utils/StringHelperFunctions";
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { getRandomInt } from "../utils/helpers/getRandomInt";
import { KEY } from "../utils/helpers/keyCodes";
import { createAccordionElement } from "../utils/uiHelpers/createAccordionElement";
import { createElement } from "../utils/uiHelpers/createElement";
import { createPopup } from "../utils/uiHelpers/createPopup";
import { Page,
routing } from "./ui/navigationTracking";
import { formatNumber } from "../utils/StringHelperFunctions";
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { getRandomInt } from "../utils/helpers/getRandomInt";
import { removeChildrenFromElement } from "../utils/uiHelpers/removeChildrenFromElement";
import { removeElement } from "../utils/uiHelpers/removeElement";
import { removeElementById } from "../utils/uiHelpers/removeElementById";
// Constants
const GangRespectToReputationRatio = 5; // Respect is divided by this to get rep gain
const MaximumGangMembers = 30;

View File

@ -8,24 +8,6 @@ import { getRandomInt } from "../utils/helpers/getRandom
import { infiltrationBoxCreate } from "../utils/InfiltrationBox";
import { formatNumber } from "../utils/StringHelperFunctions";
/* Infiltration.js
*
* Kill
* Knockout (nonlethal)
* Stealth Knockout (nonlethal)
* Assassinate
*
* Hack Security
* Destroy Security
* Sneak past Security
*
* Pick the locked door
*
* Bribe security
*
* Escape
*/
let InfiltrationScenarios = {
Guards: "You see an armed security guard patrolling the area.",
TechOnly: "The area is equipped with a state-of-the-art security system: cameras, laser tripwires, and sentry turrets.",

View File

@ -1,13 +1,16 @@
import { Engine } from "./engine";
import { Player } from "./Player";
import { Settings } from "./Settings/Settings";
import { initializeMainMenuLinks } from "./ui/MainMenu/Links";
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { clearEventListeners } from "../utils/uiHelpers/clearEventListeners";
import { createElement } from "../utils/uiHelpers/createElement";
import { createPopup } from "../utils/uiHelpers/createPopup";
import { removeElementById } from "../utils/uiHelpers/removeElementById";
//Ordered array of keys to Interactive Tutorial Steps
const orderedITutorialSteps = [
"Start",

View File

@ -2,13 +2,18 @@ import { CONSTANTS } from "./Constants";
import { Engine } from "./engine";
import { displayFactionContent } from "./Faction/FactionHelpers";
import { Player } from "./Player";
import { dialogBoxCreate } from "../utils/DialogBox";
import { clearEventListeners } from "../utils/uiHelpers/clearEventListeners";
import { addOffset } from "../utils/helpers/addOffset";
import { formatNumber } from "../utils/StringHelperFunctions";
import { addOffset } from "../utils/helpers/addOffset";
import { getRandomInt } from "../utils/helpers/getRandomInt";
import { isString } from "../utils/helpers/isString";
import jsplumb from 'jsplumb'
import { clearEventListeners } from "../utils/uiHelpers/clearEventListeners";
import jsplumb from "jsplumb";
let inMission = false; //Flag to denote whether a mission is running
let currMission = null;

View File

@ -11,8 +11,8 @@ import { Script } from "./Script/Script";
import { findRunningScript } from "./Script/ScriptHelpers";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import { parse, Node } from "../utils/acorn";
import { arrayToString } from "../utils/helpers/arrayToString";
import { isValidIPAddress } from "../utils/helpers/isValidIPAddress";
import { isString } from "../utils/helpers/isString";

View File

@ -1,11 +1,13 @@
var sprintf = require('sprintf-js').sprintf,
vsprintf = require('sprintf-js').vsprintf
const sprintf = require("sprintf-js").sprintf;
const vsprintf = require("sprintf-js").vsprintf;
import { updateActiveScriptsItems } from "./ActiveScriptsUI";
import { Augmentation } from "./Augmentation/Augmentation";
import { Augmentations } from "./Augmentation/Augmentations";
import { augmentationExists,
installAugmentations } from "./Augmentation/AugmentationHelpers";
import {
augmentationExists,
installAugmentations
} from "./Augmentation/AugmentationHelpers";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
import { findCrime } from "./Crime/CrimeHelpers";
@ -16,28 +18,32 @@ import {CompanyPosition} from "./Company/CompanyPosit
import { CompanyPositions } from "./Company/CompanyPositions";
import { CONSTANTS } from "./Constants";
import { DarkWebItems } from "./DarkWeb/DarkWebItems";
import {calculateHackingChance,
import {
calculateHackingChance,
calculateHackingExpGain,
calculatePercentMoneyHacked,
calculateHackingTime,
calculateGrowTime,
calculateWeakenTime} from "./Hacking";
calculateWeakenTime
} from "./Hacking";
import { AllGangs } from "./Gang";
import { Faction } from "./Faction/Faction";
import { Factions,
factionExists } from "./Faction/Factions";
import { joinFaction,
purchaseAugmentation } from "./Faction/FactionHelpers";
import { Factions, factionExists } from "./Faction/Factions";
import { joinFaction, purchaseAugmentation } from "./Faction/FactionHelpers";
import { FactionWorkType } from "./Faction/FactionWorkTypeEnum";
import { netscriptCanGrow,
import {
netscriptCanGrow,
netscriptCanHack,
netscriptCanWeaken } from "./Hacking/netscriptCanHack";
netscriptCanWeaken
} from "./Hacking/netscriptCanHack";
import { getCostOfNextHacknetNode,
import {
getCostOfNextHacknetNode,
getCostOfNextHacknetServer,
purchaseHacknet,
hasHacknetServers,
purchaseHashUpgrade } from "./Hacknet/HacknetHelpers";
purchaseHashUpgrade
} from "./Hacknet/HacknetHelpers";
import { CityName } from "./Locations/data/CityNames";
import { LocationName } from "./Locations/data/LocationNames";
@ -50,38 +56,63 @@ import { Programs } from "./Programs/Programs";
import { Script } from "./Script/Script";
import { findRunningScript } from "./Script/ScriptHelpers";
import { isScriptFilename } from "./Script/ScriptHelpersTS";
import { AllServers,
AddToAllServers } from "./Server/AllServers";
import { AllServers, AddToAllServers } from "./Server/AllServers";
import { Server } from "./Server/Server";
import { GetServerByHostname,
import {
GetServerByHostname,
getServer,
getServerOnNetwork,
numCycleForGrowth,
processSingleServerGrowth } from "./Server/ServerHelpers";
import { getPurchaseServerCost,
processSingleServerGrowth
} from "./Server/ServerHelpers";
import {
getPurchaseServerCost,
getPurchaseServerLimit,
getPurchaseServerMaxRam } from "./Server/ServerPurchases";
getPurchaseServerMaxRam
} from "./Server/ServerPurchases";
import { Settings } from "./Settings/Settings";
import { SpecialServerIps } from "./Server/SpecialServerIps";
import { Stock } from "./StockMarket/Stock";
import {StockMarket, StockSymbols, SymbolToStockMap,
initStockMarket, initSymbolToStockMap, buyStock,
sellStock, updateStockPlayerPosition,
shortStock, sellShort, OrderTypes,
PositionTypes, placeOrder, cancelOrder} from "./StockMarket/StockMarket";
import { getStockmarket4SDataCost,
getStockMarket4STixApiCost } from "./StockMarket/StockMarketCosts";
import { SourceFileFlags } from "./SourceFile/SourceFileFlags"
import {
StockMarket,
StockSymbols,
SymbolToStockMap,
initStockMarket,
initSymbolToStockMap,
buyStock,
sellStock,
updateStockPlayerPosition,
shortStock,
sellShort,
OrderTypes,
PositionTypes,
placeOrder,
cancelOrder
} from "./StockMarket/StockMarket";
import {
getStockmarket4SDataCost,
getStockMarket4STixApiCost
} from "./StockMarket/StockMarketCosts";
import { SourceFileFlags } from "./SourceFile/SourceFileFlags";
import { TextFile, getTextFile, createTextFile } from "./TextFile";
import {unknownBladeburnerActionErrorMessage,
import {
unknownBladeburnerActionErrorMessage,
unknownBladeburnerExceptionMessage,
checkBladeburnerAccess} from "./NetscriptBladeburner";
checkBladeburnerAccess
} from "./NetscriptBladeburner";
import * as nsGang from "./NetscriptGang";
import {WorkerScript, workerScripts,
killWorkerScript, NetscriptPorts} from "./NetscriptWorker";
import {makeRuntimeRejectMsg, netscriptDelay,
runScriptFromScript} from "./NetscriptEvaluator";
import {
WorkerScript,
workerScripts,
killWorkerScript,
NetscriptPorts
} from "./NetscriptWorker";
import {
makeRuntimeRejectMsg,
netscriptDelay,
runScriptFromScript
} from "./NetscriptEvaluator";
import { NetscriptPort } from "./NetscriptPort";
import { SleeveTaskType } from "./PersonObjects/Sleeve/SleeveTaskTypesEnum";
import { findSleevePurchasableAugs } from "./PersonObjects/Sleeve/Sleeve";
@ -103,15 +134,16 @@ import { createElement } from "../utils/uiHelpers/cre
import { createPopup } from "../utils/uiHelpers/createPopup";
import { removeElementById } from "../utils/uiHelpers/removeElementById";
var hasCorporationSF = false, //Source-File 3
hasSingularitySF = false, //Source-File 4
hasAISF = false, //Source-File 5
hasBladeburnerSF = false, //Source-File 6
hasBladeburner2079SF = false, //Source-File 7
hasWallStreetSF = false, //Source-File 8
hasBn11SF = false; //Source-File 11
let hasCorporationSF = false; //Source-File 3
let hasSingularitySF = false; //Source-File 4
let hasAISF = false; //Source-File 5
let hasBladeburnerSF = false; //Source-File 6
let hasBladeburner2079SF = false; //Source-File 7
let hasWallStreetSF = false; //Source-File 8
let hasBn11SF = false; //Source-File 11
var singularitySFLvl=1, wallStreetSFLvl=1;
let singularitySFLvl = 1;
let wallStreetSFLvl = 1;
var possibleLogs = {
ALL: true,

View File

@ -1,13 +1,18 @@
import {addActiveScriptsItem,
import {
addActiveScriptsItem,
deleteActiveScriptsItem,
updateActiveScriptsItems} from "./ActiveScriptsUI";
updateActiveScriptsItems
} from "./ActiveScriptsUI";
import { CONSTANTS } from "./Constants";
import { Engine } from "./engine";
import { Interpreter } from "./JSInterpreter";
import { Environment } from "./NetscriptEnvironment";
import {evaluate, isScriptErrorMessage,
import {
evaluate,
isScriptErrorMessage,
makeRuntimeRejectMsg,
killNetscriptDelay} from "./NetscriptEvaluator";
killNetscriptDelay
} from "./NetscriptEvaluator";
import { NetscriptFunctions } from "./NetscriptFunctions";
import { executeJSScript } from "./NetscriptJSEvaluator";
import { NetscriptPort } from "./NetscriptPort";
@ -15,7 +20,7 @@ import { AllServers } from "./Server/AllServers";
import { Settings } from "./Settings/Settings";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import {generate} from 'escodegen';
import { generate } from "escodegen";
import { parse, Node } from "../utils/acorn";
import { dialogBoxCreate } from "../utils/DialogBox";
@ -24,6 +29,7 @@ import {arrayToString} from "../utils/helpers/arrayToString
import { roundToTwo } from "../utils/helpers/roundToTwo";
import { isString } from "../utils/StringHelperFunctions";
const walk = require("acorn/dist/walk");
function WorkerScript(runningScriptObj) {

View File

@ -1,7 +1,9 @@
import { deleteActiveScriptsItem } from "./ActiveScriptsUI";
import { Augmentations } from "./Augmentation/Augmentations";
import { augmentationExists,
initAugmentations } from "./Augmentation/AugmentationHelpers";
import {
augmentationExists,
initAugmentations
} from "./Augmentation/AugmentationHelpers";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
import { initBitNodeMultipliers } from "./BitNode/BitNode";
import { Bladeburner } from "./Bladeburner";
@ -11,45 +13,56 @@ import { resetIndustryResearchTrees } from "./Corporation/IndustryData
import { Programs } from "./Programs/Programs";
import { Engine } from "./engine";
import { Faction } from "./Faction/Faction";
import { Factions,
initFactions } from "./Faction/Factions";
import { Factions, initFactions } from "./Faction/Factions";
import { joinFaction } from "./Faction/FactionHelpers";
import { deleteGangDisplayContent } from "./Gang";
import { Message } from "./Message/Message";
import { initMessages,
Messages } from "./Message/MessageHelpers";
import { initMessages, Messages } from "./Message/MessageHelpers";
import { initSingularitySFFlags, hasWallStreetSF } from "./NetscriptFunctions";
import {WorkerScript, workerScripts,
prestigeWorkerScripts} from "./NetscriptWorker";
import {
WorkerScript,
workerScripts,
prestigeWorkerScripts
} from "./NetscriptWorker";
import { Player } from "./Player";
import { AllServers,
import {
AllServers,
AddToAllServers,
initForeignServers,
prestigeAllServers } from "./Server/AllServers";
import { Server } from "./Server/Server"
prestigeAllServers
} from "./Server/AllServers";
import { Server } from "./Server/Server";
import { prestigeHomeComputer } from "./Server/ServerHelpers";
import { SourceFileFlags,
updateSourceFileFlags } from "./SourceFile/SourceFileFlags";
import { SpecialServerIps,
import {
SourceFileFlags,
updateSourceFileFlags
} from "./SourceFile/SourceFileFlags";
import {
SpecialServerIps,
SpecialServerIpsMap,
prestigeSpecialServerIps,
SpecialServerNames} from "./Server/SpecialServerIps";
import {initStockMarket, initSymbolToStockMap,
SpecialServerNames
} from "./Server/SpecialServerIps";
import {
initStockMarket,
initSymbolToStockMap,
stockMarketContentCreated,
setStockMarketContentCreated} from "./StockMarket/StockMarket";
setStockMarketContentCreated
} from "./StockMarket/StockMarket";
import { Terminal, postNetburnerText } from "./Terminal";
import { Page, routing } from "./ui/navigationTracking";
import Decimal from "decimal.js";
import { dialogBoxCreate } from "../utils/DialogBox";
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { removeElementById } from "../utils/uiHelpers/removeElementById";
import { createElement } from "../utils/uiHelpers/createElement";
import { createPopup } from "../utils/uiHelpers/createPopup";
import {exceptionAlert} from "../utils/helpers/exceptionAlert";
let BitNode8StartingMoney = 250e6;
import Decimal from "decimal.js";
const BitNode8StartingMoney = 250e6;
//Prestige by purchasing augmentation
function prestigeAugmentation() {

View File

@ -2,17 +2,21 @@ import { BitNodes } from "./BitNode/BitNode";
import { Engine } from "./engine";
import { Player } from "./Player";
import { prestigeSourceFile } from "./Prestige";
import { SourceFiles,
SourceFile } from "./SourceFile";
import { SourceFiles, SourceFile } from "./SourceFile";
import { PlayerOwnedSourceFile } from "./SourceFile/PlayerOwnedSourceFile";
import { Terminal } from "./Terminal";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners";
import { dialogBoxCreate } from "../utils/DialogBox";
import {
yesNoBoxCreate,
yesNoBoxGetYesButton,
yesNoBoxGetNoButton,
yesNoBoxClose
} from "../utils/YesNoBox";
import { clearEventListeners } from "../utils/uiHelpers/clearEventListeners";
import { removeChildrenFromElement } from "../utils/uiHelpers/removeChildrenFromElement";
import {yesNoBoxCreate, yesNoBoxGetYesButton,
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
/* RedPill.js
* Implements what happens when you have Red Pill augmentation and then hack the world daemon */

View File

@ -1,38 +1,49 @@
import {loadAliases, loadGlobalAliases,
Aliases, GlobalAliases} from "./Alias";
import {
loadAliases,
loadGlobalAliases,
Aliases,
GlobalAliases
} from "./Alias";
import { Companies, loadCompanies } from "./Company/Companies";
import { CompanyPosition } from "./Company/CompanyPosition";
import { CONSTANTS } from "./Constants";
import { Engine } from "./engine";
import { Factions,
loadFactions } from "./Faction/Factions";
import { Factions, loadFactions } from "./Faction/Factions";
import { processPassiveFactionRepGain } from "./Faction/FactionHelpers";
import { loadFconf } from "./Fconf/Fconf";
import { FconfSettings } from "./Fconf/FconfSettings";
import { loadAllGangs, AllGangs } from "./Gang";
import { hasHacknetServers,
processHacknetEarnings } from "./Hacknet/HacknetHelpers";
import {
hasHacknetServers,
processHacknetEarnings
} from "./Hacknet/HacknetHelpers";
import { loadMessages, initMessages, Messages } from "./Message/MessageHelpers";
import { Player, loadPlayer } from "./Player";
import { loadAllRunningScripts } from "./Script/ScriptHelpers";
import { AllServers,
loadAllServers } from "./Server/AllServers";
import { AllServers, loadAllServers } from "./Server/AllServers";
import { Settings } from "./Settings/Settings";
import { loadSpecialServerIps,
SpecialServerIps } from "./Server/SpecialServerIps";
import {
loadSpecialServerIps,
SpecialServerIps
} from "./Server/SpecialServerIps";
import { loadStockMarket, StockMarket } from "./StockMarket/StockMarket";
import { createStatusText } from "./ui/createStatusText";
import { numeralWrapper } from "./ui/numeralFormat";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import { dialogBoxCreate } from "../utils/DialogBox";
import { gameOptionsBoxClose } from "../utils/GameOptions";
import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners";
import {Reviver, Generic_toJSON,
Generic_fromJSON} from "../utils/JSONReviver";
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
import { clearEventListeners } from "../utils/uiHelpers/clearEventListeners";
import {
Reviver,
Generic_toJSON,
Generic_fromJSON
} from "../utils/JSONReviver";
import { createElement } from "../utils/uiHelpers/createElement";
import { createPopup } from "../utils/uiHelpers/createPopup";
import {createStatusText} from "./ui/createStatusText";
import {numeralWrapper} from "./ui/numeralFormat";
import { removeElementById } from "../utils/uiHelpers/removeElementById";
import Decimal from "decimal.js";

View File

@ -8,47 +8,48 @@ import {
removeLeadingSlash,
removeTrailingSlash
} from "./Terminal/DirectoryHelpers";
import { determineAllPossibilitiesForTabCompletion } from "./Terminal/determineAllPossibilitiesForTabCompletion";
import { TerminalHelpText, HelpTexts } from "./Terminal/HelpText";
import { tabCompletion } from "./Terminal/tabCompletion";
import {
determineAllPossibilitiesForTabCompletion
} from "./Terminal/determineAllPossibilitiesForTabCompletion";
import {
TerminalHelpText,
HelpTexts
} from "./Terminal/HelpText";
import {
tabCompletion
} from "./Terminal/tabCompletion";
import { Aliases,
Aliases,
GlobalAliases,
parseAliasDeclaration,
printAliases,
removeAlias,
substituteAliases } from "./Alias";
substituteAliases
} from "./Alias";
import { BitNodeMultipliers } from "./BitNode/BitNodeMultipliers";
import {CodingContract, CodingContractResult,
CodingContractRewardType} from "./CodingContracts";
import {
CodingContract,
CodingContractResult,
CodingContractRewardType
} from "./CodingContracts";
import { CONSTANTS } from "./Constants";
import { Programs } from "./Programs/Programs";
import { executeDarkwebTerminalCommand,
checkIfConnectedToDarkweb } from "./DarkWeb/DarkWeb";
import {
executeDarkwebTerminalCommand,
checkIfConnectedToDarkweb
} from "./DarkWeb/DarkWeb";
import { DarkWebItems } from "./DarkWeb/DarkWebItems";
import { Engine } from "./engine";
import { parseFconfSettings,
createFconf } from "./Fconf/Fconf";
import { parseFconfSettings, createFconf } from "./Fconf/Fconf";
import { FconfSettings } from "./Fconf/FconfSettings";
import {calculateHackingChance,
import {
calculateHackingChance,
calculateHackingExpGain,
calculatePercentMoneyHacked,
calculateHackingTime,
calculateGrowTime,
calculateWeakenTime} from "./Hacking";
calculateWeakenTime
} from "./Hacking";
import { HacknetServer } from "./Hacknet/HacknetServer";
import {iTutorialNextStep, iTutorialSteps,
ITutorial} from "./InteractiveTutorial";
import {
iTutorialNextStep,
iTutorialSteps,
ITutorial
} from "./InteractiveTutorial";
import { showLiterature } from "./Literature";
import { Message } from "./Message/Message";
import { showMessage } from "./Message/MessageHelpers";
@ -60,12 +61,16 @@ import { findRunningScript } from "./Script/ScriptHelpers";
import { isScriptFilename } from "./Script/ScriptHelpersTS";
import { AllServers } from "./Server/AllServers";
import { Server } from "./Server/Server";
import { GetServerByHostname,
import {
GetServerByHostname,
getServer,
getServerOnNetwork } from "./Server/ServerHelpers";
getServerOnNetwork
} from "./Server/ServerHelpers";
import { Settings } from "./Settings/Settings";
import { SpecialServerIps,
SpecialServerNames } from "./Server/SpecialServerIps";
import {
SpecialServerIps,
SpecialServerNames
} from "./Server/SpecialServerIps";
import { getTextFile } from "./TextFile";
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import { Page, routing } from "./ui/navigationTracking";
@ -76,9 +81,12 @@ import {isString} from "../utils/helpers/isString";
import { arrayToString } from "../utils/helpers/arrayToString";
import { getTimestamp } from "../utils/helpers/getTimestamp";
import { logBoxCreate } from "../utils/LogBox";
import {yesNoBoxCreate,
import {
yesNoBoxCreate,
yesNoBoxGetYesButton,
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
yesNoBoxGetNoButton,
yesNoBoxClose
} from "../utils/YesNoBox";
import {
post,
postContent,
@ -87,9 +95,10 @@ import {
hackProgressPost
} from "./ui/postToTerminal";
import autosize from 'autosize';
import * as JSZip from 'jszip';
import * as FileSaver from 'file-saver';
import autosize from "autosize";
import * as JSZip from "jszip";
import * as FileSaver from "file-saver";
function postNetburnerText() {
post("Bitburner v" + CONSTANTS.Version);

View File

@ -1,6 +1,11 @@
import { setTimeoutRef } from "./utils/SetTimeoutRef";
import { dialogBoxCreate } from "../utils/DialogBox";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver";
import {
Generic_fromJSON,
Generic_toJSON,
Reviver
} from "../utils/JSONReviver";
/**
* Represents a plain text file that is typically stored on a server.

View File

@ -1,18 +1,24 @@
import {formatNumber,
import {
formatNumber,
convertTimeMsToTimeElapsedString,
replaceAt} from "../utils/StringHelperFunctions";
import {loxBoxCreate, logBoxUpdateText,
logBoxOpened} from "../utils/LogBox";
replaceAt
} from "../utils/StringHelperFunctions";
import { loxBoxCreate, logBoxUpdateText, logBoxOpened } from "../utils/LogBox";
import { updateActiveScriptsItems } from "./ActiveScriptsUI";
import { Augmentations } from "./Augmentation/Augmentations";
import { installAugmentations,
import {
installAugmentations,
initAugmentations,
displayAugmentationsContent,
PlayerOwnedAugmentation } from "./Augmentation/AugmentationHelpers";
PlayerOwnedAugmentation
} from "./Augmentation/AugmentationHelpers";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
import {BitNodes, initBitNodes,
initBitNodeMultipliers} from "./BitNode/BitNode";
import {
BitNodes,
initBitNodes,
initBitNodeMultipliers
} from "./BitNode/BitNode";
import { Bladeburner } from "./Bladeburner";
import { CharacterOverviewComponent } from "./ui/React/CharacterOverview";
import { cinematicTextFlag } from "./CinematicText";
@ -23,58 +29,79 @@ import { Corporation } from "./Corporation/Corp
import { CONSTANTS } from "./Constants";
import { createDevMenu, closeDevMenu } from "./DevMenu";
import { Factions, initFactions } from "./Faction/Factions";
import { displayFactionContent, joinFaction,
import {
displayFactionContent,
joinFaction,
processPassiveFactionRepGain,
inviteToFaction } from "./Faction/FactionHelpers";
inviteToFaction
} from "./Faction/FactionHelpers";
import { FconfSettings } from "./Fconf/FconfSettings";
import { hasHacknetServers,
import {
hasHacknetServers,
renderHacknetNodesUI,
clearHacknetNodesUI,
processHacknetEarnings } from "./Hacknet/HacknetHelpers";
processHacknetEarnings
} from "./Hacknet/HacknetHelpers";
import { iTutorialStart } from "./InteractiveTutorial";
import { initLiterature } from "./Literature";
import { LocationName } from "./Locations/data/LocationNames";
import { LocationRoot } from "./Locations/ui/Root";
import { checkForMessagesToSend, initMessages } from "./Message/MessageHelpers";
import { inMission, currMission } from "./Missions";
import {initSingularitySFFlags,
hasSingularitySF, hasCorporationSF} from "./NetscriptFunctions";
import {updateOnlineScriptTimes,
runScriptsLoop} from "./NetscriptWorker";
import {
initSingularitySFFlags,
hasSingularitySF,
hasCorporationSF
} from "./NetscriptFunctions";
import { updateOnlineScriptTimes, runScriptsLoop } from "./NetscriptWorker";
import { Player } from "./Player";
import {prestigeAugmentation,
prestigeSourceFile} from "./Prestige";
import { prestigeAugmentation, prestigeSourceFile } from "./Prestige";
import { Programs } from "./Programs/Programs";
import { displayCreateProgramContent,
import {
displayCreateProgramContent,
getNumAvailableCreateProgram,
initCreateProgramButtons } from "./Programs/ProgramHelpers";
initCreateProgramButtons
} from "./Programs/ProgramHelpers";
import { redPillFlag, hackWorldDaemon } from "./RedPill";
import { saveObject, loadGame } from "./SaveObject";
import { getCurrentEditor,
import {
getCurrentEditor,
loadAllRunningScripts,
scriptEditorInit,
updateScriptEditorContent } from "./Script/ScriptHelpers";
import { AllServers,
initForeignServers } from "./Server/AllServers";
updateScriptEditorContent
} from "./Script/ScriptHelpers";
import { AllServers, initForeignServers } from "./Server/AllServers";
import { Server } from "./Server/Server";
import { Settings } from "./Settings/Settings";
import { initSourceFiles, SourceFiles } from "./SourceFile";
import { updateSourceFileFlags } from "./SourceFile/SourceFileFlags";
import {SpecialServerIps, initSpecialServerIps} from "./Server/SpecialServerIps";
import {StockMarket, StockSymbols,
SymbolToStockMap, initStockSymbols,
initSymbolToStockMap, stockMarketCycle,
import {
SpecialServerIps,
initSpecialServerIps
} from "./Server/SpecialServerIps";
import {
StockMarket,
StockSymbols,
SymbolToStockMap,
initStockSymbols,
initSymbolToStockMap,
stockMarketCycle,
processStockPrices,
displayStockMarketContent} from "./StockMarket/StockMarket";
displayStockMarketContent
} from "./StockMarket/StockMarket";
import { Terminal, postNetburnerText } from "./Terminal";
import { Sleeve } from "./PersonObjects/Sleeve/Sleeve";
import { clearSleevesPage,
import {
clearSleevesPage,
createSleevesPage,
updateSleevesPage } from "./PersonObjects/Sleeve/SleeveUI";
import { clearResleevesPage,
createResleevesPage } from "./PersonObjects/Resleeving/ResleevingUI";
updateSleevesPage
} from "./PersonObjects/Sleeve/SleeveUI";
import {
clearResleevesPage,
createResleevesPage
} from "./PersonObjects/Resleeving/ResleevingUI";
import { createStatusText } from "./ui/createStatusText";
import { displayCharacterInfo } from "./ui/displayCharacterInfo";
@ -82,13 +109,10 @@ import {Page, routing} from "./ui/navigationTra
import { numeralWrapper } from "./ui/numeralFormat";
import { setSettingsLabels } from "./ui/setSettingsLabels";
import { initializeMainMenuHeaders } from "./ui/MainMenu/Headers";
import { initializeMainMenuLinks,
MainMenuLinks } from "./ui/MainMenu/Links";
import { initializeMainMenuLinks, MainMenuLinks } from "./ui/MainMenu/Links";
import { dialogBoxCreate } from "../utils/DialogBox";
import { gameOptionsBoxClose,
gameOptionsBoxOpen } from "../utils/GameOptions";
import { gameOptionsBoxClose, gameOptionsBoxOpen } from "../utils/GameOptions";
import { getRandomInt } from "../utils/helpers/getRandomInt";
import { removeChildrenFromElement } from "../utils/uiHelpers/removeChildrenFromElement";
import { clearEventListeners } from "../utils/uiHelpers/clearEventListeners";
@ -100,6 +124,7 @@ import {KEY} from "../utils/helpers/k
import React from "react";
import ReactDOM from "react-dom";
// These should really be imported with the module that is presenting that UI, but because they very much depend on the
// cascade order, we'll pull them all in here.
import 'normalize.css';