)
From 7875d1ba9348152bb6417c80fdefe683ffbd2cca Mon Sep 17 00:00:00 2001
From: Olivier Gagnon
Date: Wed, 9 Jun 2021 16:33:21 -0400
Subject: [PATCH 13/27] Fix reputation transfering when applying for other jobs
---
src/PersonObjects/Player/PlayerObjectGeneralMethods.jsx | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.jsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.jsx
index 87e22bcba..eddfa8b72 100644
--- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.jsx
+++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.jsx
@@ -1740,7 +1740,6 @@ export function applyForJob(entryPosType, sing=false) {
}
}
- this.companyName = company.name;
this.jobs[company.name] = pos.name;
document.getElementById("world-menu-header").click();
@@ -1863,7 +1862,6 @@ export function applyForEmployeeJob(sing=false) {
export function applyForPartTimeEmployeeJob(sing=false) {
var company = Companies[this.location]; //Company being applied to
if (this.isQualified(company, CompanyPositions[posNames.PartTimeCompanyPositions[1]])) {
- this.companyName = company.name;
this.jobs[company.name] = posNames.PartTimeCompanyPositions[1];
document.getElementById("world-menu-header").click();
document.getElementById("world-menu-header").click();
From dd75c1b2d2eb426a99f60f83977790838f3fc3a3 Mon Sep 17 00:00:00 2001
From: Tesseract1234567890
Date: Thu, 10 Jun 2021 08:54:21 -0400
Subject: [PATCH 14/27] Fixed typo in Infiltration.js
---
src/Infiltration.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Infiltration.js b/src/Infiltration.js
index 2ac800e29..dc6ca5116 100644
--- a/src/Infiltration.js
+++ b/src/Infiltration.js
@@ -591,7 +591,7 @@ function updateInfiltrationButtons(inst, scenario) {
"Attempt to kill the security guard. You have a " +
numeralWrapper.formatPercentage(killChance, 2) + " chance of success. " +
"If you succeed, the security level will increase by 5%. If you fail, " +
- "the security level will decrease by 10%. ";
+ "the security level will increase by 10%. ";
document.getElementById("infiltration-knockout").innerHTML = "Knockout" +
"" +
From 34b3843e187d5c1ea504c535808a91ec5aa8abc6 Mon Sep 17 00:00:00 2001
From: Tesseract1234567890
Date: Thu, 10 Jun 2021 08:55:06 -0400
Subject: [PATCH 15/27] Fixed typo in PlayerObjectGeneralMethods.jsx
---
src/PersonObjects/Player/PlayerObjectGeneralMethods.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.jsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.jsx
index eddfa8b72..157377f81 100644
--- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.jsx
+++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.jsx
@@ -660,7 +660,7 @@ export function work(numCycles) {
const penalty = this.cancelationPenalty();
- const penaltyString = penalty === 0.5 ? 'half' : 'three quarter'
+ const penaltyString = penalty === 0.5 ? 'half' : 'three-quarters'
var elem = document.getElementById("work-in-progress-text");
ReactDOM.render(<>
From 6a8aa79396048c02831fe842c0db64cf280ff96e Mon Sep 17 00:00:00 2001
From: Tesseract1234567890
Date: Thu, 10 Jun 2021 08:56:53 -0400
Subject: [PATCH 16/27] Fixed capitalization error in Quotes.txt
---
Quotes.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Quotes.txt b/Quotes.txt
index e908c0697..496bb55b3 100644
--- a/Quotes.txt
+++ b/Quotes.txt
@@ -1,13 +1,13 @@
Collection of Quotes
-The past is relevant only as data
+The past is relevant only as data.
Pull on the new flesh like borrowed gloves and burn your fingers once again.
A weapon is a tool. A tool for killing and destroying. And there will be times
when you must kill and destroy. Then you will choose and equip yourself with the tools
that you need. But remember the weakness of weapons. They are an extension --
-You are the killer and destroyer. You are whole, with or without them.
+you are the killer and destroyer. You are whole, with or without them.
For all that we have done, as a civilization, as individuals, the universe is
not stable, and nor is any single thing within it. Stars consume themselves,
From 1b734be895d68e2680b8fa38d01ab3c2ee1dc4f7 Mon Sep 17 00:00:00 2001
From: Tesseract1234567890
Date: Thu, 10 Jun 2021 09:05:16 -0400
Subject: [PATCH 17/27] Test to fix server/node text
---
src/Hacknet/ui/PlayerInfo.jsx | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/Hacknet/ui/PlayerInfo.jsx b/src/Hacknet/ui/PlayerInfo.jsx
index 0db2cc528..7afab39b4 100644
--- a/src/Hacknet/ui/PlayerInfo.jsx
+++ b/src/Hacknet/ui/PlayerInfo.jsx
@@ -29,11 +29,10 @@ export function PlayerInfo(props) {
{Money(Player.money.toNumber())}
{
- hasServers &&
- <>Hashes: {Hashes(Player.hashManager.hashes)} / {Hashes(Player.hashManager.capacity)} >
+ hasServers && <>Hashes: {Hashes(Player.hashManager.hashes)} / {Hashes(Player.hashManager.capacity)} >
}
- Total Hacknet Node Production:
+ Total Hacknet {hasServers ? 'Server' : 'Node'} Production:
{prod}
)
From 4cd17607e61b845b0e7a498cfaaa4dfec395f061 Mon Sep 17 00:00:00 2001
From: Tesseract1234567890
Date: Thu, 10 Jun 2021 09:19:44 -0400
Subject: [PATCH 18/27] Fixed server/node text always displaying as Hacknet
Nodes even if the player has servers unlocked
---
src/Hacknet/ui/Root.jsx | 2 +-
src/index.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Hacknet/ui/Root.jsx b/src/Hacknet/ui/Root.jsx
index 4f77bbb07..008289033 100644
--- a/src/Hacknet/ui/Root.jsx
+++ b/src/Hacknet/ui/Root.jsx
@@ -129,7 +129,7 @@ export class HacknetRoot extends React.Component {
return (
diff --git a/src/index.html b/src/index.html
index 427f7589c..1303d7a12 100644
--- a/src/index.html
+++ b/src/index.html
@@ -67,7 +67,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
-
+
From cdd376f2ae3ac59ca4a5e625981bc590630f9e46 Mon Sep 17 00:00:00 2001
From: Olivier Gagnon
Date: Sat, 12 Jun 2021 04:23:15 -0400
Subject: [PATCH 19/27] gave some love to the tutorial.
---
css/interactivetutorial.scss | 19 ++++
src/InteractiveTutorial.js | 171 ++++++++++++++++++-----------------
src/Script/ScriptHelpers.js | 6 +-
src/Terminal.jsx | 24 ++---
src/index.html | 2 +-
5 files changed, 121 insertions(+), 101 deletions(-)
diff --git a/css/interactivetutorial.scss b/css/interactivetutorial.scss
index e3f7a58a5..f6e0cebe4 100644
--- a/css/interactivetutorial.scss
+++ b/css/interactivetutorial.scss
@@ -69,3 +69,22 @@
float: right;
padding: 4px;
}
+
+.interactive-tutorial-command {
+ background-color: #000;
+ color: $hacker-green;
+ white-space: nowrap;
+}
+
+.interactive-tutorial-code {
+ background-color: #272822;
+ color: white;
+ padding: 3px;
+}
+
+.interactive-tutorial-tab {
+ background-color: #555;
+ color: #e6e6e6;
+ padding: 3px;
+ box-shadow: 0 0 3px #000;
+}
\ No newline at end of file
diff --git a/src/InteractiveTutorial.js b/src/InteractiveTutorial.js
index a8e93b71f..8f5dc12fe 100644
--- a/src/InteractiveTutorial.js
+++ b/src/InteractiveTutorial.js
@@ -11,7 +11,6 @@ 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",
@@ -24,10 +23,10 @@ const orderedITutorialSteps = [
"TerminalScan", // Using 'scan' Terminal command
"TerminalScanAnalyze1", // Using 'scan-analyze' Terminal command
"TerminalScanAnalyze2", // Using 'scan-analyze 3' Terminal command
- "TerminalConnect", // Connecting to foodnstuff
- "TerminalAnalyze", // Analyzing foodnstuff
- "TerminalNuke", // NUKE foodnstuff
- "TerminalManualHack", // Hack foodnstuff
+ "TerminalConnect", // Connecting to n00dles
+ "TerminalAnalyze", // Analyzing n00dles
+ "TerminalNuke", // NUKE n00dles
+ "TerminalManualHack", // Hack n00dles
"TerminalHackingMechanics", // Explanation of hacking mechanics
"TerminalCreateScript", // Create a script using 'nano'
"TerminalTypeScript", // Script Editor page - Type script and then save & close
@@ -51,7 +50,7 @@ for (let i = 0; i < orderedITutorialSteps.length; ++i) {
iTutorialSteps[orderedITutorialSteps[i]] = i;
}
-var ITutorial = {
+const ITutorial = {
currStep: 0, // iTutorialSteps.Start
isRunning: false,
@@ -76,21 +75,21 @@ function iTutorialStart() {
document.getElementById("interactive-tutorial-container").style.display = "block";
// Exit tutorial button
- var exitButton = clearEventListeners("interactive-tutorial-exit");
+ const exitButton = clearEventListeners("interactive-tutorial-exit");
exitButton.addEventListener("click", function() {
iTutorialEnd();
return false;
});
// Back button
- var backButton = clearEventListeners("interactive-tutorial-back");
+ const backButton = clearEventListeners("interactive-tutorial-back");
backButton.addEventListener("click", function() {
iTutorialPrevStep();
return false;
});
// Next button
- var nextButton = clearEventListeners("interactive-tutorial-next");
+ const nextButton = clearEventListeners("interactive-tutorial-next");
nextButton.addEventListener("click", function() {
iTutorialNextStep();
return false;
@@ -103,12 +102,12 @@ function iTutorialEvaluateStep() {
if (!ITutorial.isRunning) {return;}
// Disable and clear main menu
- var terminalMainMenu = clearEventListeners("terminal-menu-link");
- var statsMainMenu = clearEventListeners("stats-menu-link");
- var activeScriptsMainMenu = clearEventListeners("active-scripts-menu-link");
- var hacknetMainMenu = clearEventListeners("hacknet-nodes-menu-link");
- var cityMainMenu = clearEventListeners("city-menu-link");
- var tutorialMainMenu = clearEventListeners("tutorial-menu-link");
+ const terminalMainMenu = clearEventListeners("terminal-menu-link");
+ const statsMainMenu = clearEventListeners("stats-menu-link");
+ const activeScriptsMainMenu = clearEventListeners("active-scripts-menu-link");
+ const hacknetMainMenu = clearEventListeners("hacknet-nodes-menu-link");
+ const cityMainMenu = clearEventListeners("city-menu-link");
+ const tutorialMainMenu = clearEventListeners("tutorial-menu-link");
terminalMainMenu.removeAttribute("class");
statsMainMenu.removeAttribute("class");
activeScriptsMainMenu.removeAttribute("class");
@@ -117,20 +116,20 @@ function iTutorialEvaluateStep() {
tutorialMainMenu.removeAttribute("class");
// Interactive Tutorial Next button
- var nextBtn = document.getElementById("interactive-tutorial-next");
+ const nextBtn = document.getElementById("interactive-tutorial-next");
switch(ITutorial.currStep) {
case iTutorialSteps.Start:
Engine.loadTerminalContent();
iTutorialSetText("Welcome to Bitburner, a cyberpunk-themed incremental RPG! " +
- "The game takes place in a dark, dystopian future...The year is 2077...
" +
+ "The game takes place in a dark, dystopian future... The year is 2077...
" +
"This tutorial will show you the basics of the game. " +
"You may skip the tutorial at any time.");
nextBtn.style.display = "inline-block";
break;
case iTutorialSteps.GoToCharacterPage:
Engine.loadTerminalContent();
- iTutorialSetText("Let's start by heading to the Stats page. Click the 'Stats' tab on " +
+ iTutorialSetText("Let's start by heading to the Stats page. Click the Stats tab on " +
"the main navigation menu (left-hand side of the screen)");
nextBtn.style.display = "none";
@@ -144,13 +143,13 @@ function iTutorialEvaluateStep() {
break;
case iTutorialSteps.CharacterPage:
Engine.loadCharacterContent();
- iTutorialSetText("The Stats page shows a lot of important information about your progress, " +
- "such as your skills, money, and bonuses/multipliers. ")
+ iTutorialSetText("The Stats page shows a lot of important information about your progress, " +
+ "such as your skills, money, and bonuses. ")
nextBtn.style.display = "inline-block";
break;
case iTutorialSteps.CharacterGoToTerminalPage:
Engine.loadCharacterContent();
- iTutorialSetText("Let's head to your computer's terminal by clicking the 'Terminal' tab on the " +
+ iTutorialSetText("Let's head to your computer's terminal by clicking the Terminal tab on the " +
"main navigation menu.");
nextBtn.style.display = "none";
@@ -164,57 +163,56 @@ function iTutorialEvaluateStep() {
break;
case iTutorialSteps.TerminalIntro:
Engine.loadTerminalContent();
- iTutorialSetText("The Terminal is used to interface with your home computer as well as " +
+ iTutorialSetText("The Terminal is used to interface with your home computer as well as " +
"all of the other machines around the world.");
nextBtn.style.display = "inline-block";
break;
case iTutorialSteps.TerminalHelp:
Engine.loadTerminalContent();
- iTutorialSetText("Let's try it out. Start by entering the 'help' command into the Terminal " +
+ iTutorialSetText("Let's try it out. Start by entering the help command into the Terminal " +
"(Don't forget to press Enter after typing the command)");
nextBtn.style.display = "none"; // next step triggered by terminal command
break;
case iTutorialSteps.TerminalLs:
Engine.loadTerminalContent();
- iTutorialSetText("The 'help' command displays a list of all available Terminal commands, how to use them, " +
- "and a description of what they do.
Let's try another command. Enter the 'ls' command");
+ iTutorialSetText("The help command displays a list of all available Terminal commands, how to use them, " +
+ "and a description of what they do.
Let's try another command. Enter the ls command.");
nextBtn.style.display = "none"; // next step triggered by terminal command
break;
case iTutorialSteps.TerminalScan:
Engine.loadTerminalContent();
- iTutorialSetText("'ls' is a basic command that shows all of the contents (programs/scripts) " +
- "on the computer. Right now, it shows that you have a program called 'NUKE.exe' on your computer. " +
+ iTutorialSetText(" ls is a basic command that shows files " +
+ "on the computer. Right now, it shows that you have a program called NUKE.exe on your computer. " +
"We'll get to what this does later.
Using your home computer's terminal, you can connect " +
"to other machines throughout the world. Let's do that now by first entering " +
- "the 'scan' command.");
+ "the scan command.");
nextBtn.style.display = "none"; // next step triggered by terminal command
break;
case iTutorialSteps.TerminalScanAnalyze1:
Engine.loadTerminalContent();
- iTutorialSetText("The 'scan' command shows all available network connections. In other words, " +
+ iTutorialSetText("The scan command shows all available network connections. In other words, " +
"it displays a list of all servers that can be connected to from your " +
- "current machine. A server is identified by either its IP or its hostname.
" +
+ "current machine. A server is identified by its hostname.
" +
"That's great and all, but there's so many servers. Which one should you go to? " +
- "The 'scan-analyze' command gives some more detailed information about servers on the " +
- "network. Try it now");
+ "The scan-analyze command gives some more detailed information about servers on the " +
+ "network. Try it now!");
nextBtn.style.display = "none"; // next step triggered by terminal command
break;
case iTutorialSteps.TerminalScanAnalyze2:
Engine.loadTerminalContent();
- iTutorialSetText("You just ran 'scan-analyze' with a depth of one. This command shows more detailed " +
+ iTutorialSetText("You just ran scan-analyze with a depth of one. This command shows more detailed " +
"information about each server that you can connect to (servers that are a distance of " +
- "one node away).
It is also possible to run 'scan-analyze' with " +
- "a higher depth. Let's try a depth of two with the following command: 'scan-analyze 2'.")
+ "one node away).
It is also possible to run scan-analyze with " +
+ "a higher depth. Let's try a depth of two with the following command: scan-analyze 2.")
nextBtn.style.display = "none"; // next step triggered by terminal command
break;
case iTutorialSteps.TerminalConnect:
Engine.loadTerminalContent();
iTutorialSetText("Now you can see information about all servers that are up to two nodes away, as well " +
"as figure out how to navigate to those servers through the network. You can only connect to " +
- "a server that is one node away. To connect to a machine, use the 'connect [ip/hostname]' command. You can type in " +
- "the ip or the hostname, but dont use both.
" +
- "From the results of the 'scan-analyze' command, we can see that the 'foodnstuff' server is " +
- "only one node away. Let's connect so it now using: 'connect foodnstuff'");
+ "a server that is one node away. To connect to a machine, use the connect [hostname] command.
" +
+ "From the results of the scan-analyze command, we can see that the n00dles server is " +
+ "only one node away. Let's connect so it now using: connect n00dles");
nextBtn.style.display = "none"; // next step triggered by terminal command
break;
case iTutorialSteps.TerminalAnalyze:
@@ -223,30 +221,30 @@ function iTutorialEvaluateStep() {
"become digital and decentralized. People and corporations store their money " +
"on servers and computers. Using your hacking abilities, you can hack servers " +
"to steal money and gain experience.
" +
- "Before you try to hack a server, you should run diagnostics using the 'analyze' command");
+ "Before you try to hack a server, you should run diagnostics using the analyze command.");
nextBtn.style.display = "none"; // next step triggered by terminal command
break;
case iTutorialSteps.TerminalNuke:
Engine.loadTerminalContent();
- iTutorialSetText("When the 'analyze' command finishes running it will show useful information " +
- "about hacking the server.
For this server, the required hacking skill is only 1, " +
+ iTutorialSetText("When the analyze command finishes running it will show useful information " +
+ "about hacking the server.
For this server, the required hacking skill is only 1, " +
"which means you can hack it right now. However, in order to hack a server " +
- "you must first gain root access. The 'NUKE.exe' program that we saw earlier on your " +
+ "you must first gain root access. The NUKE.exe program that we saw earlier on your " +
"home computer is a virus that will grant you root access to a machine if there are enough " +
- "open ports.
The 'analyze' results shows that there do not need to be any open ports " +
+ "open ports.
The analyze results shows that there do not need to be any open ports " +
"on this machine for the NUKE virus to work, so go ahead and run the virus using the " +
- "'run NUKE.exe' command.");
+ "run NUKE.exe command.");
nextBtn.style.display = "none"; // next step triggered by terminal command
break;
case iTutorialSteps.TerminalManualHack:
Engine.loadTerminalContent();
- iTutorialSetText("You now have root access! You can hack the server using the 'hack' command. " +
+ iTutorialSetText("You now have root access! You can hack the server using the hack command. " +
"Try doing that now.");
nextBtn.style.display = "none"; // next step triggered by terminal command
break;
case iTutorialSteps.TerminalHackingMechanics:
Engine.loadTerminalContent();
- iTutorialSetText("You are now attempting to hack the server. Note that performing a hack takes time and " +
+ iTutorialSetText("You are now attempting to hack the server. Performing a hack takes time and " +
"only has a certain percentage chance " +
"of success. This time and success chance is determined by a variety of factors, including " +
"your hacking skill and the server's security level.
" +
@@ -261,25 +259,22 @@ function iTutorialEvaluateStep() {
Engine.loadTerminalContent();
iTutorialSetText("Hacking is the core mechanic of the game and is necessary for progressing. However, " +
"you don't want to be hacking manually the entire time. You can automate your hacking " +
- "by writing scripts!
To create a new script or edit an existing one, you can use the 'nano' " +
- "command. Scripts must end with the '.script' extension. Let's make a script now by " +
- "entering 'nano foodnstuff.script' after the hack command finishes running (Sidenote: Pressing ctrl + c" +
+ "by writing scripts!
To create a new script or edit an existing one, you can use the nano " +
+ "command. Scripts must end with the .script extension. Let's make a script now by " +
+ "entering nano n00dles.script after the hack command finishes running (Sidenote: Pressing ctrl + c" +
" will end a command like hack early)");
nextBtn.style.display = "none"; // next step triggered by terminal command
break;
case iTutorialSteps.TerminalTypeScript:
- Engine.loadScriptEditorContent("foodnstuff.script", "");
+ Engine.loadScriptEditorContent("n00dles.script", "");
iTutorialSetText("This is the script editor. You can use it to program your scripts. Scripts are " +
- "written in the Netscript language, a programming language created for " +
- "this game. There are details about the Netscript language in the documentation, which " +
- "can be accessed in the 'Tutorial' tab on the main navigation menu. I highly suggest you check " +
- "it out after this tutorial. For now, just copy " +
- "and paste the following code into the script editor:
" +
"For anyone with basic programming experience, this code should be straightforward. " +
- "This script will continuously hack the 'foodnstuff' server.
" +
+ "This script will continuously hack the n00dles server.
" +
"To save and close the script editor, press the button in the bottom left, or press ctrl + b.");
nextBtn.style.display = "none"; // next step triggered in saveAndCloseScriptEditor() (Script.js)
break;
@@ -288,25 +283,25 @@ function iTutorialEvaluateStep() {
iTutorialSetText("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " +
"run on any machine which you have root access to. Different servers have different " +
"amounts of RAM. You can also purchase more RAM for your home server.
To check how much " +
- "RAM is available on this machine, enter the 'free' command.");
+ "RAM is available on this machine, enter the free command.");
nextBtn.style.display = "none"; // next step triggered by terminal commmand
break;
case iTutorialSteps.TerminalRunScript:
Engine.loadTerminalContent();
iTutorialSetText("We have 16GB of free RAM on this machine, which is enough to run our " +
- "script. Let's run our script using 'run foodnstuff.script'.");
+ "script. Let's run our script using run n00dles.script.");
nextBtn.style.display = "none"; // next step triggered by terminal commmand
break;
case iTutorialSteps.TerminalGoToActiveScriptsPage:
Engine.loadTerminalContent();
- iTutorialSetText("Your script is now running! The script might take a few seconds to 'fully start up'. " +
- "Your scripts will continuously run in the background and will automatically stop if " +
- "the code ever completes (the 'foodnstuff.script' will never complete because it " +
+ iTutorialSetText("Your script is now running! " +
+ "It will continuously run in the background and will automatically stop if " +
+ "the code ever completes (the n00dles.script will never complete because it " +
"runs an infinite loop).
These scripts can passively earn you income and hacking experience. " +
"Your scripts will also earn money and experience while you are offline, although at a " +
- "much slower rate.
" +
+ "slightly slower rate.
" +
"Let's check out some statistics for our running scripts by clicking the " +
- "'Active Scripts' link in the main navigation menu.");
+ "Active Scripts link in the main navigation menu.");
nextBtn.style.display = "none";
// Flash 'Active Scripts' menu and set its tutorial click handler
@@ -319,10 +314,9 @@ function iTutorialEvaluateStep() {
break;
case iTutorialSteps.ActiveScriptsPage:
Engine.loadActiveScriptsContent();
- iTutorialSetText("This page displays stats/information about all of your scripts that are " +
- "running across every existing server. You can use this to gauge how well " +
- "your scripts are doing. Let's go back to the Terminal now using the 'Terminal' " +
- "link.");
+ iTutorialSetText("This page displays information about all of your scripts that are " +
+ "running across every server. You can use this to gauge how well " +
+ "your scripts are doing. Let's go back to the Terminal");
nextBtn.style.display = "none";
// Flash 'Terminal' button and set its tutorial click handler
@@ -336,27 +330,27 @@ function iTutorialEvaluateStep() {
case iTutorialSteps.ActiveScriptsToTerminal:
Engine.loadTerminalContent();
iTutorialSetText("One last thing about scripts, each active script contains logs that detail " +
- "what it's doing. We can check these logs using the 'tail' command. Do that " +
- "now for the script we just ran by typing 'tail foodnstuff.script'");
+ "what it's doing. We can check these logs using the tail command. Do that " +
+ "now for the script we just ran by typing tail n00dles.script");
nextBtn.style.display = "none"; // next step triggered by terminal command
break;
case iTutorialSteps.TerminalTailScript:
Engine.loadTerminalContent();
iTutorialSetText("The log for this script won't show much right now (it might show nothing at all) because it " +
"just started running...but check back again in a few minutes!
" +
- "This pretty much covers the basics of hacking. To learn more about writing " +
- "scripts using the Netscript language, select the 'Tutorial' link in the " +
+ "This covers the basics of hacking. To learn more about writing " +
+ "scripts, select the Tutorial link in the " +
"main navigation menu to look at the documentation. " +
"If you are an experienced JavaScript " +
"developer, I would highly suggest you check out the section on " +
- "NetscriptJS/Netscript 2.0.
For now, let's move on to something else!");
+ "NetscriptJS/Netscript 2.0, it's faster and more powerful.
For now, let's move on to something else!");
nextBtn.style.display = "inline-block";
break;
case iTutorialSteps.GoToHacknetNodesPage:
Engine.loadTerminalContent();
iTutorialSetText("Hacking is not the only way to earn money. One other way to passively " +
"earn money is by purchasing and upgrading Hacknet Nodes. Let's go to " +
- "the 'Hacknet Nodes' page through the main navigation menu now.");
+ "the Hacknet page through the main navigation menu now.");
nextBtn.style.display = "none";
// Flash 'Hacknet' menu and set its tutorial click handler
@@ -369,7 +363,7 @@ function iTutorialEvaluateStep() {
break;
case iTutorialSteps.HacknetNodesIntroduction:
Engine.loadHacknetNodesContent();
- iTutorialSetText("From this page you can purchase new Hacknet Nodes and upgrade your " +
+ iTutorialSetText("here you can purchase new Hacknet Nodes and upgrade your " +
"existing ones. Let's purchase a new one now.");
nextBtn.style.display = "none"; // Next step triggered by purchaseHacknet() (HacknetNode.js)
break;
@@ -379,7 +373,7 @@ function iTutorialEvaluateStep() {
"earn you money over time, both online and offline. When you get enough " +
" money, you can upgrade " +
"your newly-purchased Hacknet Node below.
" +
- "Let's go to the 'City' page through the main navigation menu.");
+ "Let's go to the City page through the main navigation menu.");
nextBtn.style.display = "none";
// Flash 'City' menu and set its tutorial click handler
@@ -396,7 +390,7 @@ function iTutorialEvaluateStep() {
"travel to. Each location has something that you can do. " +
"There's a lot of content out in the world, make sure " +
"you explore and discover!
" +
- "Lastly, click on the 'Tutorial' link in the main navigation menu.");
+ "Lastly, click on the Tutorial link in the main navigation menu.");
nextBtn.style.display = "none";
// Flash 'Tutorial' menu and set its tutorial click handler
@@ -493,8 +487,8 @@ function iTutorialEnd() {
document.getElementById("interactive-tutorial-container").style.display = "none";
// Create a popup with final introductory stuff
- var popupId = "interactive-tutorial-ending-popup";
- var txt = createElement("p", {
+ const popupId = "interactive-tutorial-ending-popup";
+ const txt = createElement("p", {
innerHTML:
"If you are new to the game, the following links may be useful for you!
" +
"Getting Started Guide" +
@@ -502,7 +496,7 @@ function iTutorialEnd() {
"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
cat " + LiteratureNames.HackersStartingHandbook,
});
- var gotitBtn = createElement("a", {
+ const gotitBtn = createElement("a", {
class:"a-link-button", float:"right", padding:"6px", innerText:"Got it!",
clickListener:()=>{
removeElementById(popupId);
@@ -513,9 +507,16 @@ function iTutorialEnd() {
Player.getHomeComputer().messages.push(LiteratureNames.HackersStartingHandbook);
}
+let textBox = null;
+(function() {
+ function set() {
+ textBox = document.getElementById("interactive-tutorial-text");
+ document.removeEventListener("DOMContentLoaded", set);
+ }
+ document.addEventListener("DOMContentLoaded", set);
+})();
+
function iTutorialSetText(txt) {
- var textBox = document.getElementById("interactive-tutorial-text");
- if (textBox == null) {throw new Error("Could not find text box"); return;}
textBox.innerHTML = txt;
textBox.parentElement.scrollTop = 0; // this resets scroll position
}
diff --git a/src/Script/ScriptHelpers.js b/src/Script/ScriptHelpers.js
index 9d6fde7b1..838ac19aa 100644
--- a/src/Script/ScriptHelpers.js
+++ b/src/Script/ScriptHelpers.js
@@ -231,12 +231,12 @@ function saveAndCloseScriptEditor() {
if (ITutorial.isRunning && ITutorial.currStep === iTutorialSteps.TerminalTypeScript) {
//Make sure filename + code properly follow tutorial
- if (filename !== "foodnstuff.script") {
- dialogBoxCreate("Leave the script name as 'foodnstuff'!");
+ if (filename !== "n00dles.script") {
+ dialogBoxCreate("Leave the script name as 'n00dles'!");
return;
}
code = code.replace(/\s/g, "");
- if (code.indexOf("while(true){hack('foodnstuff');}") == -1) {
+ if (code.indexOf("while(true){hack('n00dles');}") == -1) {
dialogBoxCreate("Please copy and paste the code from the tutorial!");
return;
}
diff --git a/src/Terminal.jsx b/src/Terminal.jsx
index 0af22e1de..28451adf6 100644
--- a/src/Terminal.jsx
+++ b/src/Terminal.jsx
@@ -742,8 +742,8 @@ let Terminal = {
/****************** Interactive Tutorial Terminal Commands ******************/
if (ITutorial.isRunning) {
- var foodnstuffServ = GetServerByHostname("foodnstuff");
- if (foodnstuffServ == null) {throw new Error("Could not get foodnstuff server"); return;}
+ var n00dlesServ = GetServerByHostname("n00dles");
+ if (n00dlesServ == null) {throw new Error("Could not get n00dles server"); return;}
switch(ITutorial.currStep) {
case iTutorialSteps.TerminalHelp:
@@ -780,11 +780,11 @@ let Terminal = {
case iTutorialSteps.TerminalConnect:
if (commandArray.length == 2) {
if ((commandArray[0] == "connect") &&
- (commandArray[1] == "foodnstuff" || commandArray[1] == foodnstuffServ.ip)) {
+ (commandArray[1] == "n00dles" || commandArray[1] == n00dlesServ.ip)) {
Player.getCurrentServer().isConnectedTo = false;
- Player.currentServer = foodnstuffServ.ip;
+ Player.currentServer = n00dlesServ.ip;
Player.getCurrentServer().isConnectedTo = true;
- post("Connected to foodnstuff");
+ post("Connected to n00dles");
iTutorialNextStep();
} else {post("Wrong command! Try again!"); return;}
} else {post("Bad command. Please follow the tutorial");}
@@ -804,8 +804,8 @@ let Terminal = {
case iTutorialSteps.TerminalNuke:
if (commandArray.length == 2 &&
commandArray[0] == "run" && commandArray[1] == "NUKE.exe") {
- foodnstuffServ.hasAdminRights = true;
- post("NUKE successful! Gained root access to foodnstuff");
+ n00dlesServ.hasAdminRights = true;
+ post("NUKE successful! Gained root access to n00dles");
iTutorialNextStep();
} else {post("Bad command. Please follow the tutorial");}
break;
@@ -817,8 +817,8 @@ let Terminal = {
break;
case iTutorialSteps.TerminalCreateScript:
if (commandArray.length == 2 &&
- commandArray[0] == "nano" && commandArray[1] == "foodnstuff.script") {
- Engine.loadScriptEditorContent("foodnstuff.script", "");
+ commandArray[0] == "nano" && commandArray[1] == "n00dles.script") {
+ Engine.loadScriptEditorContent("n00dles.script", "");
iTutorialNextStep();
} else {post("Bad command. Please follow the tutorial");}
break;
@@ -830,16 +830,16 @@ let Terminal = {
break;
case iTutorialSteps.TerminalRunScript:
if (commandArray.length == 2 &&
- commandArray[0] == "run" && commandArray[1] == "foodnstuff.script") {
+ commandArray[0] == "run" && commandArray[1] == "n00dles.script") {
Terminal.runScript(commandArray);
iTutorialNextStep();
} else {post("Bad command. Please follow the tutorial");}
break;
case iTutorialSteps.ActiveScriptsToTerminal:
if (commandArray.length == 2 &&
- commandArray[0] == "tail" && commandArray[1] == "foodnstuff.script") {
+ commandArray[0] == "tail" && commandArray[1] == "n00dles.script") {
// Check that the script exists on this machine
- var runningScript = findRunningScript("foodnstuff.script", [], Player.getCurrentServer());
+ var runningScript = findRunningScript("n00dles.script", [], Player.getCurrentServer());
if (runningScript == null) {
post("Error: No such script exists");
return;
diff --git a/src/index.html b/src/index.html
index 1303d7a12..3d329668e 100644
--- a/src/index.html
+++ b/src/index.html
@@ -67,7 +67,7 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
-
+
From 9996232751b7527399728067aa6a930b87cfcbc9 Mon Sep 17 00:00:00 2001
From: Olivier Gagnon
Date: Sat, 12 Jun 2021 04:28:17 -0400
Subject: [PATCH 20/27] Nerf the effect of intelligence on faction reputation
gain
---
src/PersonObjects/formulas/reputation.ts | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/PersonObjects/formulas/reputation.ts b/src/PersonObjects/formulas/reputation.ts
index 6e52ad264..2fb66d90a 100644
--- a/src/PersonObjects/formulas/reputation.ts
+++ b/src/PersonObjects/formulas/reputation.ts
@@ -10,9 +10,9 @@ function mult(f: Faction): number {
}
export function getHackingWorkRepGain(p: IPlayer, f: Faction): number {
- return (p.hacking_skill + p.intelligence) /
+ return (p.hacking_skill + p.intelligence/3) /
CONSTANTS.MaxSkillLevel * p.faction_rep_mult *
- p.getIntelligenceBonus(0.25) * mult(f);
+ p.getIntelligenceBonus(1) * mult(f);
}
export function getFactionSecurityWorkRepGain(p: IPlayer, f: Faction): number {
@@ -20,8 +20,9 @@ export function getFactionSecurityWorkRepGain(p: IPlayer, f: Faction): number {
p.strength / CONSTANTS.MaxSkillLevel +
p.defense / CONSTANTS.MaxSkillLevel +
p.dexterity / CONSTANTS.MaxSkillLevel +
- p.agility / CONSTANTS.MaxSkillLevel) / 4.5;
- return t * p.faction_rep_mult * mult(f);
+ p.agility / CONSTANTS.MaxSkillLevel +
+ p.intelligence / CONSTANTS.MaxSkillLevel) / 4.5;
+ return t * p.faction_rep_mult * mult(f) * p.getIntelligenceBonus(1);
}
export function getFactionFieldWorkRepGain(p: IPlayer, f: Faction): number {
@@ -32,5 +33,5 @@ export function getFactionFieldWorkRepGain(p: IPlayer, f: Faction): number {
p.agility / CONSTANTS.MaxSkillLevel +
p.charisma / CONSTANTS.MaxSkillLevel +
p.intelligence / CONSTANTS.MaxSkillLevel) / 5.5;
- return t * p.faction_rep_mult * mult(f);
+ return t * p.faction_rep_mult * mult(f) * p.getIntelligenceBonus(1);
}
From d6a7471e0b2af93754de530dedb3eb88a44ca77a Mon Sep 17 00:00:00 2001
From: Olivier Gagnon
Date: Sat, 12 Jun 2021 04:47:03 -0400
Subject: [PATCH 21/27] Added functions to create gang
---
doc/source/netscript/gangapi/createGang.rst | 12 +++++++++++
doc/source/netscript/gangapi/inGang.rst | 7 ++++++
doc/source/netscript/netscriptgangapi.rst | 2 ++
src/Netscript/RamCostGenerator.ts | 2 ++
src/NetscriptFunctions.js | 24 +++++++++++++++++++++
5 files changed, 47 insertions(+)
create mode 100644 doc/source/netscript/gangapi/createGang.rst
create mode 100644 doc/source/netscript/gangapi/inGang.rst
diff --git a/doc/source/netscript/gangapi/createGang.rst b/doc/source/netscript/gangapi/createGang.rst
new file mode 100644
index 000000000..2e0365484
--- /dev/null
+++ b/doc/source/netscript/gangapi/createGang.rst
@@ -0,0 +1,12 @@
+createGang() Netscript Function
+======================================
+
+.. js:function:: createGang(faction)
+
+ :RAM cost: 1 GB
+ :param string faction: Name of faction
+ :returns: ``true`` if a Gang was created with that faction.
+
+ Creates a Gang with that faction. You need to have access to Gangs, the
+ faction must be one of the approved gang factions, and you must be a member
+ of that faction for the creation to be successful.
diff --git a/doc/source/netscript/gangapi/inGang.rst b/doc/source/netscript/gangapi/inGang.rst
new file mode 100644
index 000000000..7813b4d9f
--- /dev/null
+++ b/doc/source/netscript/gangapi/inGang.rst
@@ -0,0 +1,7 @@
+inGang() Netscript Function
+======================================
+
+.. js:function:: inGang()
+
+ :RAM cost: 1 GB
+ :returns: ``true`` if the player is already in a gang.
diff --git a/doc/source/netscript/netscriptgangapi.rst b/doc/source/netscript/netscriptgangapi.rst
index 24cedd801..df26529c1 100644
--- a/doc/source/netscript/netscriptgangapi.rst
+++ b/doc/source/netscript/netscriptgangapi.rst
@@ -25,6 +25,8 @@ In :ref:`netscriptjs`::
.. toctree::
:caption: API Functions:
+ createGang()
+ inGang()
getMemberNames()
getGangInformation()
getOtherGangInformation()
diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts
index 7e428ab89..ff3ccdcac 100644
--- a/src/Netscript/RamCostGenerator.ts
+++ b/src/Netscript/RamCostGenerator.ts
@@ -223,6 +223,8 @@ export const RamCosts: IMap = {
// Gang API
gang : {
+ createGang: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
+ inGang: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
getMemberNames: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
getGangInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
getOtherGangInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js
index cd243f199..f8b74fe16 100644
--- a/src/NetscriptFunctions.js
+++ b/src/NetscriptFunctions.js
@@ -3603,6 +3603,30 @@ function NetscriptFunctions(workerScript) {
// Gang API
gang: {
+ createGang: function(faction) {
+ updateDynamicRam("createGang", getRamCost("gang", "createGang"));
+ // this list is copied from Faction/ui/Root.tsx
+ const GangNames = [
+ "Slum Snakes",
+ "Tetrads",
+ "The Syndicate",
+ "The Dark Army",
+ "Speakers for the Dead",
+ "NiteSec",
+ "The Black Hand",
+ ];
+ if(!Player.canAccessGang() || !GangNames.includes(faction)) return false;
+ if (Player.inGang()) return false;
+ if(!Player.factions.includes(faction)) return false;
+
+ const isHacking = (faction === "NiteSec" || faction === "The Black Hand");
+ Player.startGang(faction, isHacking);
+ return true;
+ },
+ inGang: function() {
+ updateDynamicRam("inGang", getRamCost("gang", "inGang"));
+ return Player.inGang();
+ },
getMemberNames: function() {
updateDynamicRam("getMemberNames", getRamCost("gang", "getMemberNames"));
checkGangApiAccess("getMemberNames");
From 6661473adc674211084fbb839e99b8de367f7d47 Mon Sep 17 00:00:00 2001
From: Olivier Gagnon
Date: Sat, 12 Jun 2021 05:09:12 -0400
Subject: [PATCH 22/27] Fix an issue where an empty stack trace would appear in
ns1 scripts
---
src/NetscriptFunctions.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js
index f8b74fe16..486b0ddc0 100644
--- a/src/NetscriptFunctions.js
+++ b/src/NetscriptFunctions.js
@@ -376,7 +376,7 @@ function NetscriptFunctions(workerScript) {
const makeRuntimeErrorMsg = function(caller, msg) {
const stack = (new Error()).stack.split('\n').slice(1);
const scripts = workerScript.getServer().scripts;
- let userstack = [];
+ const userstack = [];
for(const stackline of stack) {
let filename;
for(const script of scripts) {
@@ -398,13 +398,12 @@ function NetscriptFunctions(workerScript) {
const lineMatch = line.match(lineRe);
const funcMatch = line.match(funcRe);
if(lineMatch && funcMatch) {
- let func = funcMatch[1];
- return {line: lineMatch[1], func: func};
+ return {line: lineMatch[1], func: funcMatch[1]};
}
return null;
}
let call = {line: "-1", func: "unknown"};
- let chromeCall = parseChromeStackline(stackline);
+ const chromeCall = parseChromeStackline(stackline);
if (chromeCall) {
call = chromeCall;
}
@@ -430,7 +429,8 @@ function NetscriptFunctions(workerScript) {
}
workerScript.log(caller, msg);
- const rejectMsg = `${caller}: ${msg}
Stack: ${userstack.join(' ')}`;
return makeRuntimeRejectMsg(workerScript, rejectMsg);
}
From 2b13b5329f72ddca3282fdd0069f8bd1d2887ddd Mon Sep 17 00:00:00 2001
From: Olivier Gagnon
Date: Sat, 12 Jun 2021 05:42:18 -0400
Subject: [PATCH 23/27] tail is smarter
---
src/Terminal.jsx | 44 +++++++++++++++++++++++++++++++++++++++-----
1 file changed, 39 insertions(+), 5 deletions(-)
diff --git a/src/Terminal.jsx b/src/Terminal.jsx
index 28451adf6..d46e750b5 100644
--- a/src/Terminal.jsx
+++ b/src/Terminal.jsx
@@ -53,6 +53,7 @@ import { WorkerScriptStartStopEventEmitter } from "./Netscript/WorkerScriptStart
import { Player } from "./Player";
import { hackWorldDaemon } from "./RedPill";
import { RunningScript } from "./Script/RunningScript";
+import { compareArrays } from "../utils/helpers/compareArrays";
import { getRamUsageFromRunningScript } from "./Script/RunningScriptHelpers";
import {
getCurrentEditor,
@@ -1422,13 +1423,46 @@ let Terminal = {
args.push(commandArray[i]);
}
- // Check that the script exists on this machine
- const runningScript = findRunningScript(scriptName, args, s);
- if (runningScript == null) {
- postError("No such script exists");
+ // go over all the running scripts. If there's a perfect
+ // match, use it!
+ for (var i = 0; i < s.runningScripts.length; ++i) {
+ if (s.runningScripts[i].filename === scriptName &&
+ compareArrays(s.runningScripts[i].args, args)) {
+ logBoxCreate(s.runningScripts[i]);
+ return;
+ }
+ }
+
+ // Find all scripts that are potential candidates.
+ const candidates = [];
+ for (var i = 0; i < s.runningScripts.length; ++i) {
+ // only scripts that have more arguments (equal arguments is already caught)
+ if(s.runningScripts[i].args.length < args.length) continue;
+ // make a smaller copy of the args.
+ const args2 = s.runningScripts[i].args.slice(0, args.length);
+ if (s.runningScripts[i].filename === scriptName &&
+ compareArrays(args2, args)) {
+ candidates.push(s.runningScripts[i]);
+ }
+ }
+
+ // If there's only 1 possible choice, use that.
+ if(candidates.length === 1) {
+ logBoxCreate(candidates[0]);
return;
}
- logBoxCreate(runningScript);
+
+ // otherwise lists all possible conflicting choices.
+ if(candidates.length > 1) {
+ postError("Found several potential candidates:");
+ for(const candidate of candidates)
+ postError(`${candidate.filename} ${candidate.args.join(' ')}`);
+ postError("Script arguments need to be specified.");
+ return;
+ }
+
+ // if there's no candidate then we just don't know.
+ postError("No such script exists.");
} else {
const runningScript = findRunningScriptByPid(commandArray[1], Player.getCurrentServer());
if (runningScript == null) {
From 2b1ec7d5736c9f7a473d1eca71ccc9877fdd9c69 Mon Sep 17 00:00:00 2001
From: Olivier Gagnon
Date: Sat, 12 Jun 2021 05:57:09 -0400
Subject: [PATCH 24/27] update patch notes
---
src/Constants.ts | 57 +++++++++++++++++++++++++-----------------------
1 file changed, 30 insertions(+), 27 deletions(-)
diff --git a/src/Constants.ts b/src/Constants.ts
index 99dd7a93e..d609e2873 100644
--- a/src/Constants.ts
+++ b/src/Constants.ts
@@ -6,7 +6,7 @@
import { IMap } from "./types";
export const CONSTANTS: IMap = {
- Version: "0.51.10",
+ Version: "0.52.0",
/** Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
* and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@@ -226,40 +226,43 @@ export const CONSTANTS: IMap = {
LatestUpdate:
`
- v0.51.10 - 2021-05-31 Focus Mark, Focus! (hydroflame)
+ v0.52.0 - 2021-06-12 Infiltration 2.0 (hydroflame)
-------
- Focus
- * You can now use the terminal and write scripts while working for factions
- but you will gain reputation at a slower rate.
+ Terminal
+ * tail is smarter. It automatically assume the only possible options in some
+ cases.
- SF -1
- * Added a new SF -1: Bypass
+ Intelligence
+ * Now available when starting BN5 instead of after beating it for the first
+ time.
+ * Nerf the effect of intelligence on reputation gain.
- Gang
- * "Vigilante justice"/"Ethical hacking" now reduces wanted level by a very
- small percentage as well an absolute value.
+ Augmentation
+ * Added a new augmentation, the 'Unstable Circadian Modulator', whose
+ gimmick is that its stats are randomized every hour.
Netscript
- * 'tFormat' now has a second argument to display with millisecond precision.
- * 'purchaseSleeveAug' can no longer purchase the same aug over and over for
- the same sleeve.
- * fix typo in logging for 'getServerSecurityLevel'
- * Fixed some weird issue where very rarely you would get 0 exp from 'grow'
- * 'getActionTime' now returns correct values for Diplomacy and Regeneration.
+ * 'getPlayer' is not a singularity function anymore.
+ * 'hacknetNodes.constants' returns the correct values.
+ * 'createGang' has been added.
+ * 'inGang' has been added.
- Corporations
- * Fixed an exploit where you could get nearly infinite corporation funds by
- entering negative numbers in textboxes.
- * Fixed an exploit where shares could be sold again by clicking the
- "sell share" button via scripts.
-
- Documentation
- * typo fix in purchaseTor
- * typo fix in basicgameplay/stats
+ Tutorial
+ * Updated the tutorial. Made it look cleaner, fixed typos, etc.
Misc.
- * Very large number will no longer appear as "$NaNt"
- * Hash capacity now displays in the "big number" format.
+ * Fix many typos in literature (@kwazygloo)
+ * Fix being able to unfocus from gym and university.
+ * Fix being able to do hacking missions while unfocused.
+ * Fix many typos in Augmentation descriptions (@kwazygloo)
+ * More numbers handle absurdly large values. (@Tesseract1234567890)
+ * Fix many typos (@Tesseract1234567890)
+ * Fixed an issue that caused a UI desync when sleeves were set to workout
+ stats other than strength at the gym.
+ * Fix weird alignment of donation text box and button. (@Tesseract1234567890)
+ * Fixed an issue where reputation could be transfered to new jobs when unfocused.
+ * Empty stack traces should no longer appear.
+
`,
}
\ No newline at end of file
From 39b40486038c501da7bca032dbf5c9c87cfb152d Mon Sep 17 00:00:00 2001
From: Olivier Gagnon
Date: Sun, 13 Jun 2021 11:05:07 -0400
Subject: [PATCH 25/27] Fixed a performance issue when installing too many
Neuroflux at once.
---
src/Augmentation/AugmentationHelpers.jsx | 26 +++++++++++++++----
.../ui/PurchasedAugmentations.tsx | 13 +++++++++-
src/Constants.ts | 2 +-
src/DevMenu.jsx | 2 +-
.../Player/PlayerObjectGeneralMethods.jsx | 1 +
5 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/src/Augmentation/AugmentationHelpers.jsx b/src/Augmentation/AugmentationHelpers.jsx
index f89970ff1..78922f353 100644
--- a/src/Augmentation/AugmentationHelpers.jsx
+++ b/src/Augmentation/AugmentationHelpers.jsx
@@ -2157,15 +2157,31 @@ function installAugmentations() {
dialogBoxCreate("You have not purchased any Augmentations to install!");
return false;
}
- var augmentationList = "";
- for (var i = 0; i < Player.queuedAugmentations.length; ++i) {
- var aug = Augmentations[Player.queuedAugmentations[i].name];
+ let augmentationList = "";
+ let nfgIndex = -1;
+ for(let i = Player.queuedAugmentations.length-1; i >= 0; i--) {
+ if(Player.queuedAugmentations[i].name === AugmentationNames.NeuroFluxGovernor) {
+ nfgIndex = i;
+ break;
+ }
+ }
+ for (let i = 0; i < Player.queuedAugmentations.length; ++i) {
+ const ownedAug = Player.queuedAugmentations[i];
+ const aug = Augmentations[ownedAug.name];
if (aug == null) {
- console.error(`Invalid augmentation: ${Player.queuedAugmentations[i].name}`);
+ console.error(`Invalid augmentation: ${ownedAug.name}`);
continue;
}
+
+ if(ownedAug.name === AugmentationNames.NeuroFluxGovernor
+ && i !== nfgIndex) continue;
+
+ let level = null;
+ if (ownedAug.name === AugmentationNames.NeuroFluxGovernor) {
+ level = ` - ${ownedAug.level}`;
+ }
applyAugmentation(Player.queuedAugmentations[i]);
- augmentationList += (aug.name + " ");
+ augmentationList += (aug.name + level + " ");
}
Player.queuedAugmentations = [];
dialogBoxCreate("You slowly drift to sleep as scientists put you under in order " +
diff --git a/src/Augmentation/ui/PurchasedAugmentations.tsx b/src/Augmentation/ui/PurchasedAugmentations.tsx
index ab0854e9a..9cb94fe72 100644
--- a/src/Augmentation/ui/PurchasedAugmentations.tsx
+++ b/src/Augmentation/ui/PurchasedAugmentations.tsx
@@ -7,12 +7,23 @@ import * as React from "react";
import { Augmentations } from "../../Augmentation/Augmentations";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
import { Player } from "../../Player";
+import { IPlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation";
import { AugmentationAccordion } from "../../ui/React/AugmentationAccordion";
export function PurchasedAugmentations(): React.ReactElement {
const augs: React.ReactElement[] = [];
- for (const ownedAug of Player.queuedAugmentations) {
+ // Only render the last NeuroFlux (there are no findLastIndex btw)
+ let nfgIndex = -1;
+ for(let i = Player.queuedAugmentations.length-1; i >= 0; i--) {
+ if(Player.queuedAugmentations[i].name === AugmentationNames.NeuroFluxGovernor) {
+ nfgIndex = i;
+ break;
+ }
+ }
+ for (let i = 0; i < Player.queuedAugmentations.length; i++) {
+ const ownedAug = Player.queuedAugmentations[i];
+ if(ownedAug.name === AugmentationNames.NeuroFluxGovernor && i !== nfgIndex) continue;
const aug = Augmentations[ownedAug.name];
let level = null;
if (ownedAug.name === AugmentationNames.NeuroFluxGovernor) {
diff --git a/src/Constants.ts b/src/Constants.ts
index d609e2873..77c44bdad 100644
--- a/src/Constants.ts
+++ b/src/Constants.ts
@@ -263,6 +263,6 @@ export const CONSTANTS: IMap = {
* Fix weird alignment of donation text box and button. (@Tesseract1234567890)
* Fixed an issue where reputation could be transfered to new jobs when unfocused.
* Empty stack traces should no longer appear.
-
+ * Purchasing anything with Infinity money doesn't result in NaN.
`,
}
\ No newline at end of file
diff --git a/src/DevMenu.jsx b/src/DevMenu.jsx
index 52b54e9a0..f8583ef66 100644
--- a/src/DevMenu.jsx
+++ b/src/DevMenu.jsx
@@ -726,7 +726,7 @@ class DevMenuComponent extends Component {
-
+
`;a.getElementById("terminal-input").insertAdjacentHTML("beforebegin",r),function(){const e=a.getElementById("terminal-container");e.scrollTop=e.scrollHeight}()}t.post=function(e){i(e)},t.postError=function(e){i(`ERROR: ${e}`,{color:"#ff2929"})},t.hackProgressBarPost=function(e){i(e,{id:"hack-progress-bar"})},t.hackProgressPost=function(e){i(e,{id:"hack-progress"})},t.postElement=function(e){i(r.renderToStaticMarkup(e))},t.postContent=i},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CONSTANTS=void 0,t.CONSTANTS={Version:"0.51.10",MaxSkillLevel:975,MilliPerCycle:200,CorpFactionRepRequirement:2e5,BaseCostFor1GBOfRamHome:32e3,BaseCostFor1GBOfRamServer:55e3,TravelCost:2e5,BaseFavorToDonate:150,DonateMoneyToRepDivisor:1e6,FactionReputationToFavorBase:500,FactionReputationToFavorMult:1.02,CompanyReputationToFavorBase:500,CompanyReputationToFavorMult:1.02,NeuroFluxGovernorLevelMult:1.14,NumNetscriptPorts:20,HomeComputerMaxRam:1073741824,ServerBaseGrowthRate:1.03,ServerMaxGrowthRate:1.0035,ServerFortifyAmount:.002,ServerWeakenAmount:.05,PurchasedServerLimit:25,PurchasedServerMaxRam:1048576,MultipleAugMultiplier:1.9,TorRouterCost:2e5,InfiltrationBribeBaseAmount:1e5,InfiltrationMoneyValue:5e3,InfiltrationRepValue:1.4,InfiltrationExpPow:.8,WSEAccountCost:2e8,TIXAPICost:5e9,MarketData4SCost:1e9,MarketDataTixApi4SCost:25e9,StockMarketCommission:1e5,HospitalCostPerHp:1e5,IntelligenceCrimeWeight:.025,IntelligenceInfiltrationWeight:.1,IntelligenceCrimeBaseExpGain:.05,IntelligenceProgramBaseExpGain:2.5,IntelligenceTerminalHackBaseExpGain:200,IntelligenceSingFnBaseExpGain:1.5,IntelligenceClassBaseExpGain:.01,IntelligenceHackingMissionBaseExpGain:3,HackingMissionRepToDiffConversion:1e4,HackingMissionRepToRewardConversion:7,HackingMissionSpamTimeIncrease:25e3,HackingMissionTransferAttackIncrease:1.05,HackingMissionMiscDefenseIncrease:1.05,HackingMissionDifficultyToHacking:135,HackingMissionHowToPlay:"Hacking missions are a minigame that, if won, will reward you with faction reputation.
In this game you control a set of Nodes and use them to try and defeat an enemy. Your Nodes are colored blue, while the enemy's are red. There are also other nodes on the map colored gray that initially belong to neither you nor the enemy. The goal of the game is to capture all of the enemy's Database nodes within the time limit. If you fail to do this, you will lose.
Each Node has three stats: Attack, Defense, and HP. There are five different actions that a Node can take:
Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the enemy's defense.
Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the enemy's defense.
Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the enemy's defense.
Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.
Overflow - Raises the Node's Attack but lowers its Defense. The effectiveness is determined by your hacking level.
Note that when determining the effectiveness of the above actions, the TOTAL Attack or Defense of the team is used, not just the Attack/Defense of the individual Node that is performing the action.
To capture a Node, you must lower its HP down to 0.
There are six different types of Nodes:
CPU Core - These are your main Nodes that are used to perform actions. Capable of performing every action
Firewall - Nodes with high defense. These Nodes can 'Fortify'
Database - A special type of Node. The player's objective is to conquer all of the enemy's Database Nodes within the time limit. These Nodes cannot perform any actions
Spam - Conquering one of these Nodes will slow the enemy's trace, giving the player additional time to complete the mission. These Nodes cannot perform any actions
Transfer - Conquering one of these nodes will increase the Attack of all of your CPU Cores by a small fixed percentage. These Nodes are capable of performing every action except the 'Attack' action
Shield - Nodes with high defense. These Nodes can 'Fortify'
To assign an action to a Node, you must first select one of your Nodes. This can be done by simply clicking on it. Double-clicking a node will select all of your Nodes of the same type (e.g. select all CPU Core Nodes or all Transfer Nodes). Note that only Nodes that can perform actions (CPU Core, Transfer, Shield, Firewall) can be selected. Selected Nodes will be denoted with a white highlight. After selecting a Node or multiple Nodes, select its action using the Action Buttons near the top of the screen. Every action also has a corresponding keyboard shortcut.
For certain actions such as attacking, scanning, and weakening, the Node performing the action must have a target. To target another node, simply click-and-drag from the 'source' Node to a target. A Node can only have one target, and you can target any Node that is adjacent to one of your Nodes (immediately above, below, or to the side. NOT diagonal). Furthermore, only CPU Cores and Transfer Nodes can target, since they are the only ones that can perform the related actions. To remove a target, you can simply click on the line that represents the connection between one of your Nodes and its target. Alternatively, you can select the 'source' Node and click the 'Drop Connection' button, or press 'd'.
Other Notes:
-Whenever a miscellenaous Node (not owned by the player or enemy) is conquered, the defense of all remaining miscellaneous Nodes that are not actively being targeted will increase by a fixed percentage.
-Whenever a Node is conquered, its stats are significantly reduced
-Miscellaneous Nodes slowly raise their defense over time
-Nodes slowly regenerate health over time.",MillisecondsPer20Hours:72e6,GameCyclesPer20Hours:36e4,MillisecondsPer10Hours:36e6,GameCyclesPer10Hours:18e4,MillisecondsPer8Hours:288e5,GameCyclesPer8Hours:144e3,MillisecondsPer4Hours:144e5,GameCyclesPer4Hours:72e3,MillisecondsPer2Hours:72e5,GameCyclesPer2Hours:36e3,MillisecondsPerHour:36e5,GameCyclesPerHour:18e3,MillisecondsPerHalfHour:18e5,GameCyclesPerHalfHour:9e3,MillisecondsPerQuarterHour:9e5,GameCyclesPerQuarterHour:4500,MillisecondsPerFiveMinutes:3e5,GameCyclesPerFiveMinutes:1500,FactionWorkHacking:"Faction Hacking Work",FactionWorkField:"Faction Field Work",FactionWorkSecurity:"Faction Security Work",WorkTypeCompany:"Working for Company",WorkTypeCompanyPartTime:"Working for Company part-time",WorkTypeFaction:"Working for Faction",WorkTypeCreateProgram:"Working on Create a Program",WorkTypeStudyClass:"Studying or Taking a class at university",WorkTypeCrime:"Committing a crime",ClassStudyComputerScience:"studying Computer Science",ClassDataStructures:"taking a Data Structures course",ClassNetworks:"taking a Networks course",ClassAlgorithms:"taking an Algorithms course",ClassManagement:"taking a Management course",ClassLeadership:"taking a Leadership course",ClassGymStrength:"training your strength at a gym",ClassGymDefense:"training your defense at a gym",ClassGymDexterity:"training your dexterity at a gym",ClassGymAgility:"training your agility at a gym",ClassDataStructuresBaseCost:40,ClassNetworksBaseCost:80,ClassAlgorithmsBaseCost:320,ClassManagementBaseCost:160,ClassLeadershipBaseCost:320,ClassGymBaseCost:120,ClassStudyComputerScienceBaseExp:.5,ClassDataStructuresBaseExp:1,ClassNetworksBaseExp:2,ClassAlgorithmsBaseExp:4,ClassManagementBaseExp:2,ClassLeadershipBaseExp:4,CrimeShoplift:"shoplift",CrimeRobStore:"rob a store",CrimeMug:"mug someone",CrimeLarceny:"commit larceny",CrimeDrugs:"deal drugs",CrimeBondForgery:"forge corporate bonds",CrimeTraffickArms:"traffick illegal arms",CrimeHomicide:"commit homicide",CrimeGrandTheftAuto:"commit grand theft auto",CrimeKidnap:"kidnap someone for ransom",CrimeAssassination:"assassinate a high-profile target",CrimeHeist:"pull off the ultimate heist",CodingContractBaseFactionRepGain:2500,CodingContractBaseCompanyRepGain:4e3,CodingContractBaseMoneyGain:75e6,TotalNumBitNodes:24,LatestUpdate:"\n v0.51.10 - 2021-05-31 Focus Mark, Focus! (hydroflame)\n -------\n\n Focus\n * You can now use the terminal and write scripts while working for factions\n but you will gain reputation at a slower rate.\n\n SF -1\n * Added a new SF -1: Bypass\n\n Gang\n * \"Vigilante justice\"/\"Ethical hacking\" now reduces wanted level by a very\n small percentage as well an absolute value.\n\n Netscript\n * 'tFormat' now has a second argument to display with millisecond precision.\n * 'purchaseSleeveAug' can no longer purchase the same aug over and over for\n the same sleeve.\n * fix typo in logging for 'getServerSecurityLevel'\n * Fixed some weird issue where very rarely you would get 0 exp from 'grow'\n * 'getActionTime' now returns correct values for Diplomacy and Regeneration.\n\n Corporations\n * Fixed an exploit where you could get nearly infinite corporation funds by\n entering negative numbers in textboxes.\n * Fixed an exploit where shares could be sold again by clicking the\n \"sell share\" button via scripts.\n\n Documentation\n * typo fix in purchaseTor\n * typo fix in basicgameplay/stats\n\n Misc.\n * Very large number will no longer appear as \"$NaNt\"\n * Hash capacity now displays in the \"big number\" format.\n "}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRamCost=t.RamCosts=t.RamCostConstants=void 0,t.RamCostConstants={ScriptBaseRamCost:1.6,ScriptDomRamCost:25,ScriptHackRamCost:.1,ScriptHackAnalyzeRamCost:1,ScriptGrowRamCost:.15,ScriptGrowthAnalyzeRamCost:1,ScriptWeakenRamCost:.15,ScriptScanRamCost:.2,ScriptPortProgramRamCost:.05,ScriptRunRamCost:1,ScriptExecRamCost:1.3,ScriptSpawnRamCost:2,ScriptScpRamCost:.6,ScriptKillRamCost:.5,ScriptHasRootAccessRamCost:.05,ScriptGetHostnameRamCost:.05,ScriptGetHackingLevelRamCost:.05,ScriptGetMultipliersRamCost:4,ScriptGetServerRamCost:.1,ScriptGetServerMaxRam:.05,ScriptGetServerUsedRam:.05,ScriptFileExistsRamCost:.1,ScriptIsRunningRamCost:.1,ScriptHacknetNodesRamCost:4,ScriptHNUpgLevelRamCost:.4,ScriptHNUpgRamRamCost:.6,ScriptHNUpgCoreRamCost:.8,ScriptGetStockRamCost:2,ScriptBuySellStockRamCost:2.5,ScriptGetPurchaseServerRamCost:.25,ScriptPurchaseServerRamCost:2.25,ScriptGetPurchasedServerLimit:.05,ScriptGetPurchasedServerMaxRam:.05,ScriptRoundRamCost:.05,ScriptReadWriteRamCost:1,ScriptArbScriptRamCost:1,ScriptGetScriptRamCost:.1,ScriptGetRunningScriptRamCost:.3,ScriptGetHackTimeRamCost:.05,ScriptGetFavorToDonate:.1,ScriptCodingContractBaseRamCost:10,ScriptSleeveBaseRamCost:4,ScriptSingularityFn1RamCost:2,ScriptSingularityFn2RamCost:3,ScriptSingularityFn3RamCost:5,ScriptGangApiBaseRamCost:4,ScriptBladeburnerApiBaseRamCost:4},t.RamCosts={hacknet:{numNodes:()=>0,purchaseNode:()=>0,getPurchaseNodeCost:()=>0,getNodeStats:()=>0,upgradeLevel:()=>0,upgradeRam:()=>0,upgradeCore:()=>0,upgradeCache:()=>0,getLevelUpgradeCost:()=>0,getRamUpgradeCost:()=>0,getCoreUpgradeCost:()=>0,getCacheUpgradeCost:()=>0,numHashes:()=>0,hashCost:()=>0,spendHashes:()=>0},sprintf:()=>0,vsprintf:()=>0,scan:()=>t.RamCostConstants.ScriptScanRamCost,hack:()=>t.RamCostConstants.ScriptHackRamCost,hackAnalyzeThreads:()=>t.RamCostConstants.ScriptHackAnalyzeRamCost,hackAnalyzePercent:()=>t.RamCostConstants.ScriptHackAnalyzeRamCost,hackChance:()=>t.RamCostConstants.ScriptHackAnalyzeRamCost,sleep:()=>0,grow:()=>t.RamCostConstants.ScriptGrowRamCost,growthAnalyze:()=>t.RamCostConstants.ScriptGrowthAnalyzeRamCost,weaken:()=>t.RamCostConstants.ScriptWeakenRamCost,print:()=>0,tprint:()=>0,clearLog:()=>0,disableLog:()=>0,enableLog:()=>0,isLogEnabled:()=>0,getScriptLogs:()=>0,nuke:()=>t.RamCostConstants.ScriptPortProgramRamCost,brutessh:()=>t.RamCostConstants.ScriptPortProgramRamCost,ftpcrack:()=>t.RamCostConstants.ScriptPortProgramRamCost,relaysmtp:()=>t.RamCostConstants.ScriptPortProgramRamCost,httpworm:()=>t.RamCostConstants.ScriptPortProgramRamCost,sqlinject:()=>t.RamCostConstants.ScriptPortProgramRamCost,run:()=>t.RamCostConstants.ScriptRunRamCost,exec:()=>t.RamCostConstants.ScriptExecRamCost,spawn:()=>t.RamCostConstants.ScriptSpawnRamCost,kill:()=>t.RamCostConstants.ScriptKillRamCost,killall:()=>t.RamCostConstants.ScriptKillRamCost,exit:()=>0,scp:()=>t.RamCostConstants.ScriptScpRamCost,ls:()=>t.RamCostConstants.ScriptScanRamCost,ps:()=>t.RamCostConstants.ScriptScanRamCost,hasRootAccess:()=>t.RamCostConstants.ScriptHasRootAccessRamCost,getIp:()=>t.RamCostConstants.ScriptGetHostnameRamCost,getHostname:()=>t.RamCostConstants.ScriptGetHostnameRamCost,getHackingLevel:()=>t.RamCostConstants.ScriptGetHackingLevelRamCost,getHackingMultipliers:()=>t.RamCostConstants.ScriptGetMultipliersRamCost,getHacknetMultipliers:()=>t.RamCostConstants.ScriptGetMultipliersRamCost,getBitNodeMultipliers:()=>t.RamCostConstants.ScriptGetMultipliersRamCost,getServer:()=>t.RamCostConstants.ScriptGetMultipliersRamCost/2,getServerMoneyAvailable:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerSecurityLevel:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerBaseSecurityLevel:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerMinSecurityLevel:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerRequiredHackingLevel:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerMaxMoney:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerGrowth:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerNumPortsRequired:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerRam:()=>t.RamCostConstants.ScriptGetServerRamCost,getServerMaxRam:()=>t.RamCostConstants.ScriptGetServerMaxRam,getServerUsedRam:()=>t.RamCostConstants.ScriptGetServerUsedRam,serverExists:()=>t.RamCostConstants.ScriptGetServerRamCost,fileExists:()=>t.RamCostConstants.ScriptFileExistsRamCost,isRunning:()=>t.RamCostConstants.ScriptIsRunningRamCost,getStockSymbols:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockPrice:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockAskPrice:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockBidPrice:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockPosition:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockMaxShares:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockPurchaseCost:()=>t.RamCostConstants.ScriptGetStockRamCost,getStockSaleGain:()=>t.RamCostConstants.ScriptGetStockRamCost,buyStock:()=>t.RamCostConstants.ScriptBuySellStockRamCost,sellStock:()=>t.RamCostConstants.ScriptBuySellStockRamCost,shortStock:()=>t.RamCostConstants.ScriptBuySellStockRamCost,sellShort:()=>t.RamCostConstants.ScriptBuySellStockRamCost,placeOrder:()=>t.RamCostConstants.ScriptBuySellStockRamCost,cancelOrder:()=>t.RamCostConstants.ScriptBuySellStockRamCost,getOrders:()=>t.RamCostConstants.ScriptBuySellStockRamCost,getStockVolatility:()=>t.RamCostConstants.ScriptBuySellStockRamCost,getStockForecast:()=>t.RamCostConstants.ScriptBuySellStockRamCost,purchase4SMarketData:()=>t.RamCostConstants.ScriptBuySellStockRamCost,purchase4SMarketDataTixApi:()=>t.RamCostConstants.ScriptBuySellStockRamCost,getPurchasedServerLimit:()=>t.RamCostConstants.ScriptGetPurchasedServerLimit,getPurchasedServerMaxRam:()=>t.RamCostConstants.ScriptGetPurchasedServerMaxRam,getPurchasedServerCost:()=>t.RamCostConstants.ScriptGetPurchaseServerRamCost,purchaseServer:()=>t.RamCostConstants.ScriptPurchaseServerRamCost,deleteServer:()=>t.RamCostConstants.ScriptPurchaseServerRamCost,getPurchasedServers:()=>t.RamCostConstants.ScriptPurchaseServerRamCost,write:()=>t.RamCostConstants.ScriptReadWriteRamCost,tryWrite:()=>t.RamCostConstants.ScriptReadWriteRamCost,read:()=>t.RamCostConstants.ScriptReadWriteRamCost,peek:()=>t.RamCostConstants.ScriptReadWriteRamCost,clear:()=>t.RamCostConstants.ScriptReadWriteRamCost,getPortHandle:()=>10*t.RamCostConstants.ScriptReadWriteRamCost,rm:()=>t.RamCostConstants.ScriptReadWriteRamCost,scriptRunning:()=>t.RamCostConstants.ScriptArbScriptRamCost,scriptKill:()=>t.RamCostConstants.ScriptArbScriptRamCost,getScriptName:()=>0,getScriptRam:()=>t.RamCostConstants.ScriptGetScriptRamCost,getHackTime:()=>t.RamCostConstants.ScriptGetHackTimeRamCost,getGrowTime:()=>t.RamCostConstants.ScriptGetHackTimeRamCost,getWeakenTime:()=>t.RamCostConstants.ScriptGetHackTimeRamCost,getScriptIncome:()=>t.RamCostConstants.ScriptGetScriptRamCost,getScriptExpGain:()=>t.RamCostConstants.ScriptGetScriptRamCost,getRunningScript:()=>t.RamCostConstants.ScriptGetRunningScriptRamCost,nFormat:()=>0,getTimeSinceLastAug:()=>t.RamCostConstants.ScriptGetHackTimeRamCost,prompt:()=>0,wget:()=>0,getFavorToDonate:()=>t.RamCostConstants.ScriptGetFavorToDonate,universityCourse:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,gymWorkout:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,travelToCity:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,purchaseTor:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,purchaseProgram:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,getCurrentServer:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,connect:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,manualHack:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,installBackdoor:()=>t.RamCostConstants.ScriptSingularityFn1RamCost,getStats:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/4,getCharacterInformation:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/4,getPlayer:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/4,hospitalize:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/4,isBusy:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/4,stopAction:()=>t.RamCostConstants.ScriptSingularityFn1RamCost/2,upgradeHomeRam:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,getUpgradeHomeRamCost:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/2,workForCompany:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,applyToCompany:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,getCompanyRep:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/3,getCompanyFavor:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/3,getCompanyFavorGain:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/4,checkFactionInvitations:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,joinFaction:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,workForFaction:()=>t.RamCostConstants.ScriptSingularityFn2RamCost,getFactionRep:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/3,getFactionFavor:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/3,getFactionFavorGain:()=>t.RamCostConstants.ScriptSingularityFn2RamCost/4,donateToFaction:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,createProgram:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,commitCrime:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getCrimeChance:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getCrimeStats:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getOwnedAugmentations:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getOwnedSourceFiles:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getAugmentationsFromFaction:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getAugmentationPrereq:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getAugmentationCost:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,getAugmentationStats:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,purchaseAugmentation:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,softReset:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,installAugmentations:()=>t.RamCostConstants.ScriptSingularityFn3RamCost,gang:{getMemberNames:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,getGangInformation:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getOtherGangInformation:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getMemberInformation:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,canRecruitMember:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,recruitMember:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getTaskNames:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,getTaskStats:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,setMemberTask:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getEquipmentNames:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/4,getEquipmentCost:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getEquipmentType:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getEquipmentStats:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,purchaseEquipment:()=>t.RamCostConstants.ScriptGangApiBaseRamCost,ascendMember:()=>t.RamCostConstants.ScriptGangApiBaseRamCost,setTerritoryWarfare:()=>t.RamCostConstants.ScriptGangApiBaseRamCost/2,getChanceToWinClash:()=>t.RamCostConstants.ScriptGangApiBaseRamCost,getBonusTime:()=>0},bladeburner:{getContractNames:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/10,getOperationNames:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/10,getBlackOpNames:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/10,getBlackOpRank:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/2,getGeneralActionNames:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/10,getSkillNames:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/10,startAction:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,stopBladeburnerAction:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/2,getCurrentAction:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost/4,getActionTime:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionEstimatedSuccessChance:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionRepGain:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionCountRemaining:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionMaxLevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionCurrentLevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getActionAutolevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,setActionAutolevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,setActionLevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getRank:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getSkillPoints:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getSkillLevel:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getSkillUpgradeCost:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,upgradeSkill:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getTeamSize:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,setTeamSize:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getCityEstimatedPopulation:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getCityEstimatedCommunities:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getCityChaos:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getCity:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,switchCity:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getStamina:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,joinBladeburnerFaction:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,joinBladeburnerDivision:()=>t.RamCostConstants.ScriptBladeburnerApiBaseRamCost,getBonusTime:()=>0},codingcontract:{attempt:()=>t.RamCostConstants.ScriptCodingContractBaseRamCost,getContractType:()=>t.RamCostConstants.ScriptCodingContractBaseRamCost/2,getData:()=>t.RamCostConstants.ScriptCodingContractBaseRamCost/2,getDescription:()=>t.RamCostConstants.ScriptCodingContractBaseRamCost/2,getNumTriesRemaining:()=>t.RamCostConstants.ScriptCodingContractBaseRamCost/5},sleeve:{getNumSleeves:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToShockRecovery:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToSynchronize:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToCommitCrime:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToUniversityCourse:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,travel:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToCompanyWork:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToFactionWork:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,setToGymWorkout:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,getSleeveStats:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,getTask:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,getInformation:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,getSleeveAugmentations:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,getSleevePurchasableAugs:()=>t.RamCostConstants.ScriptSleeveBaseRamCost,purchaseSleeveAug:()=>t.RamCostConstants.ScriptSleeveBaseRamCost},heart:{break:()=>0}},t.getRamCost=function(...e){if(0===e.length)return console.warn("No arguments passed to getRamCost()"),0;let n=t.RamCosts[e[0]];for(let t=1;t=1&&(e(t.target).closest(c[0]).length||u())}),e(document).on("click",".dialog-box-close-button",function(){u()}),document.addEventListener("keydown",function(e){e.keyCode==r.KEY.ESC&&m&&(u(),e.preventDefault())});let m=!1;function p(e,t=!1){const n=document.createElement("div");n.setAttribute("class","dialog-box-container");let r=e;"string"==typeof e&&(r=t?o.a.createElement("pre",{dangerouslySetInnerHTML:{__html:e}}):o.a.createElement("p",{dangerouslySetInnerHTML:{__html:e.replace(/(?:\r\n|\r|\n)/g," ")}})),l.a.render(Object(a.DialogBox)(r),n),document.body.appendChild(n),c.length>=1&&(n.style.visibility="hidden"),c.push(n),setTimeout(function(){m=!0},400)}}.call(this,n(122))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.replaceAt=t.generateRandomString=t.isHTML=t.formatNumber=t.containsAllStrings=t.longestCommonStart=t.convertTimeMsToTimeElapsedString=void 0;const r=n(65);function a(e){return e.every(r.isString)}t.replaceAt=function(e,t,n){return e.substr(0,t)+n+e.substr(t+n.length)},t.convertTimeMsToTimeElapsedString=function(e,t=!1){e=Math.floor(e);const n=Math.floor(e/1e3),r=Math.floor(n/86400),a=n%86400,i=Math.floor(a/3600),o=a%3600,s=Math.floor(o/60),l=o%60,c=(()=>{let t=`${e%1e3}`;for(;t.length<3;)t="0"+t;return t})(),u=t?`${l}.${c}`:`${l}`;let m="";return r>0&&(m+=`${r} days `),i>0&&(m+=`${i} hours `),s>0&&(m+=`${s} minutes `),m+=`${u} seconds`},t.longestCommonStart=function(e){if(!a(e))return"";if(0===e.length)return"";const t=e.concat().sort(),n=t[0],r=t[t.length-1],i=n.length;let o=0;const s=(e,t)=>e.toUpperCase()===t.toUpperCase();for(;o=0;e--)if(1===n[e].nodeType)return!0;return!1},t.generateRandomString=function(e){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let r=0;r(pe.loadFactionContent(),Object(f.displayFactionContent)(n),!1)})),e.appendChild(Object(ae.createElement)("br"))}();pe.Display.factionsContent.appendChild(e),pe.Display.factionsContent.appendChild(Object(ae.createElement)("br")),pe.Display.factionsContent.appendChild(Object(ae.createElement)("h1",{innerText:"Outstanding Faction Invitations"})),pe.Display.factionsContent.appendChild(Object(ae.createElement)("p",{width:"70%",innerText:"Lists factions you have been invited to. You can accept these faction invitations at any time."}));var n=Object(ae.createElement)("ul");for(t=0;t!!t.isTrusted&&(Object(f.joinFaction)(y.Factions[e]),pe.displayFactionsInfo(),!1)})),n.appendChild(r)}();pe.Display.factionsContent.appendChild(n)},idleTimer:function(){var e=(new Date).getTime(),t=e-pe._lastUpdate,n=t%pe._idleSpeed;(t=Math.floor(t/pe._idleSpeed))>0&&(pe._lastUpdate=e-n,x.Player.lastUpdate=e-n,pe.updateGame(t)),window.requestAnimationFrame(pe.idleTimer)},updateGame:function(e=1){var t=e*pe._idleSpeed;null==x.Player.totalPlaytime&&(x.Player.totalPlaytime=0),null==x.Player.playtimeSinceLastAug&&(x.Player.playtimeSinceLastAug=0),null==x.Player.playtimeSinceLastBitnode&&(x.Player.playtimeSinceLastBitnode=0),x.Player.totalPlaytime+=t,x.Player.playtimeSinceLastAug+=t,x.Player.playtimeSinceLastBitnode+=t,!0===U.a.actionStarted&&(pe._totalActionTime=U.a.actionTime,pe._actionTimeLeft=U.a.actionTime,pe._actionInProgress=!0,pe._actionProgressBarCount=1,pe._actionProgressStr="[ ]",pe._actionTimeStr="Time left: ",U.a.actionStarted=!1),x.Player.isWorking&&(x.Player.workType==_.CONSTANTS.WorkTypeFaction?x.Player.workForFaction(e):x.Player.workType==_.CONSTANTS.WorkTypeCreateProgram?x.Player.createProgramWork(e):x.Player.workType==_.CONSTANTS.WorkTypeStudyClass?x.Player.takeClass(e):x.Player.workType==_.CONSTANTS.WorkTypeCrime?x.Player.commitCrime(e):x.Player.workType==_.CONSTANTS.WorkTypeCompanyPartTime?x.Player.workPartTime(e):x.Player.work(e)),x.Player.hasWseAccount&&Object(W.processStockPrices)(e),x.Player.inGang()&&x.Player.gang.process(e,x.Player),O.c&&O.b&&O.b.process(e),x.Player.corporation instanceof d.c&&x.Player.corporation.storeCycles(e),x.Player.bladeburner instanceof c.a&&x.Player.bladeburner.storeCycles(e);for(let t=0;t0?(t.innerHTML=e,t.setAttribute("class","notification-on")):(t.innerHTML="",t.setAttribute("class","notification-off")),pe.Counters.createProgramNotifications=10}if(pe.Counters.augmentationsNotifications<=0){e=x.Player.queuedAugmentations.length,t=document.getElementById("augmentations-notification");e>0?(t.innerHTML=e,t.setAttribute("class","notification-on")):(t.innerHTML="",t.setAttribute("class","notification-off")),pe.Counters.augmentationsNotifications=10}if(pe.Counters.checkFactionInvitations<=0){var n=x.Player.checkForFactionInvitations();if(n.length>0){!1===x.Player.firstFacInvRecvd&&(x.Player.firstFacInvRecvd=!0,document.getElementById("factions-tab").style.display="list-item",document.getElementById("character-menu-header").click(),document.getElementById("character-menu-header").click());var r=n[Math.floor(Math.random()*n.length)];Object(f.inviteToFaction)(r)}const e=x.Player.factionInvitations.length,t=document.getElementById("factions-notification");e>0?(t.innerHTML=e,t.setAttribute("class","notification-on")):(t.innerHTML="",t.setAttribute("class","notification-off")),pe.Counters.checkFactionInvitations=100}if(pe.Counters.passiveFactionGrowth<=0){var o=Math.floor(5-pe.Counters.passiveFactionGrowth);Object(f.processPassiveFactionRepGain)(o),pe.Counters.passiveFactionGrowth=5}if(pe.Counters.messages<=0&&(Object(S.b)(),i.Augmentations[s.AugmentationNames.TheRedPill].owned?pe.Counters.messages=4500:pe.Counters.messages=150),pe.Counters.mechanicProcess<=0){if(x.Player.corporation instanceof d.c&&x.Player.corporation.process(),x.Player.bladeburner instanceof c.a)try{x.Player.bladeburner.process()}catch(e){Object(ie.exceptionAlert)("Exception caught in Bladeburner.process(): "+e)}pe.Counters.mechanicProcess=5}pe.Counters.contractGeneration<=0&&(Math.random()<=.25&&Object(p.generateRandomContract)(),pe.Counters.contractGeneration=3e3)},_totalActionTime:0,_actionTimeLeft:0,_actionTimeStr:"Time left: ",_actionProgressStr:"[ ]",_actionProgressBarCount:1,_actionInProgress:!1,updateHackProgress:function(e=1){var t=e*pe._idleSpeed;pe._actionTimeLeft-=t/1e3,pe._actionTimeLeft=Math.max(pe._actionTimeLeft,0);for(var n=Math.round(100*(1-pe._actionTimeLeft/pe._totalActionTime));2*pe._actionProgressBarCount<=n;)pe._actionProgressStr=Object(r.replaceAt)(pe._actionProgressStr,pe._actionProgressBarCount,"|"),pe._actionProgressBarCount+=1;pe._actionTimeStr="Time left: "+Math.max(0,Math.round(pe._actionTimeLeft)).toString()+"s",document.getElementById("hack-progress").innerHTML=pe._actionTimeStr,document.getElementById("hack-progress-bar").innerHTML=pe._actionProgressStr.replace(/ /g," "),n>=100&&(pe._actionInProgress=!1,U.a.finishAction())},closeMainMenuHeader:function(e){for(var t=0;t{switch(typeof e){case"number":return e;case"object":return s.getRandomInt(e.min,e.max);default:throw Error(`Do not know how to convert the type '${typeof e}' to a number`)}};for(const e of i.serverMetadata){const i={hostname:e.hostname,ip:u(),numOpenPortsRequired:e.numOpenPortsRequired,organizationName:e.organizationName};void 0!==e.maxRamExponent&&(i.maxRam=Math.pow(2,o(e.maxRamExponent)));for(const t of n)void 0!==e[t]&&(i[t]=o(e[t]));const s=new r.Server(i);for(const t of e.literature||[])s.messages.push(t);void 0!==e.specialName&&a.SpecialServerIps.addIp(e.specialName,s.ip),m(s),void 0!==e.networkLayer&&t[o(e.networkLayer)-1].push(s)}const l=(e,t)=>{e.serversOnNetwork.push(t.ip),t.serversOnNetwork.push(e.ip)},c=e=>e[Math.floor(Math.random()*e.length)],p=(e,t)=>{for(const n of e)l(n,t())};p(t[0],()=>e);for(let e=1;ec(t[e-1]))},t.prestigeAllServers=function(){for(const e in t.AllServers)delete t.AllServers[e];t.AllServers={}},t.loadAllServers=function(e){t.AllServers=JSON.parse(e,l.Reviver)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmployeePositions=void 0,t.EmployeePositions={Operations:"Operations",Engineer:"Engineer",Business:"Business",Management:"Management",RandD:"Research & Development",Training:"Training",Unassigned:"Unassigned"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isBackdoorInstalled=t.getServerOnNetwork=t.getServer=t.GetServerByHostname=t.prestigeHomeComputer=t.processSingleServerGrowth=t.numCycleForGrowth=t.safetlyCreateUniqueServer=void 0;const r=n(27),a=n(486),i=n(516),o=n(23),s=n(10),l=n(43),c=n(145),u=n(1157),m=n(674);function p(e,t,n){let r=1+(s.CONSTANTS.ServerBaseGrowthRate-1)/e.hackDifficulty;r>s.CONSTANTS.ServerMaxGrowthRate&&(r=s.CONSTANTS.ServerMaxGrowthRate);const a=e.serverGrowth/100;return Math.log(t)/(Math.log(r)*n.hacking_grow_mult*a*o.BitNodeMultipliers.ServerGrowthRate)}function h(e){for(const t in r.AllServers)if(r.AllServers.hasOwnProperty(t)&&r.AllServers[t].hostname==e)return r.AllServers[t];return null}t.safetlyCreateUniqueServer=function(e){if(null!=e.ip&&r.ipExists(e.ip)&&(e.ip=r.createUniqueRandomIp()),null!=h(e.hostname)){let t=e.hostname;for(let n=0;n<200&&null!=h(t=`${e.hostname}-${n}`);++n);e.hostname=t}return new a.Server(e)},t.numCycleForGrowth=p,t.processSingleServerGrowth=function(e,t,n){let r=i.calculateServerGrowth(e,t,n);r<1&&(console.warn("serverGrowth calculated to be less than 1"),r=1);const a=e.moneyAvailable;if(e.moneyAvailable*=r,u.isValidNumber(e.moneyMax)&&isNaN(e.moneyAvailable)&&(e.moneyAvailable=e.moneyMax),u.isValidNumber(e.moneyMax)&&e.moneyAvailable>e.moneyMax&&(e.moneyAvailable=e.moneyMax),a!==e.moneyAvailable){let t=p(e,e.moneyAvailable/a,n);t=Math.max(0,t),e.fortify(2*s.CONSTANTS.ServerFortifyAmount*Math.ceil(t))}return e.moneyAvailable/a},t.prestigeHomeComputer=function(e){const t=e.programs.includes(l.Programs.BitFlume.name);e.programs.length=0,e.runningScripts=[],e.serversOnNetwork=[],e.isConnectedTo=!0,e.ramUsed=0,e.programs.push(l.Programs.NukeProgram.name),t&&e.programs.push(l.Programs.BitFlume.name),e.scripts.forEach(function(t){t.updateRamUsage(e.scripts)}),e.messages.length=0,e.messages.push(c.LiteratureNames.HackersStartingHandbook)},t.GetServerByHostname=h,t.getServer=function(e){return m.isValidIPAddress(e)?void 0!==r.AllServers[e]?r.AllServers[e]:null:h(e)},t.getServerOnNetwork=function(e,t){return t>e.serversOnNetwork.length?(console.error("Tried to get server on network that was out of range"),null):r.AllServers[e.serversOnNetwork[t]]},t.isBackdoorInstalled=function(e){return"backdoorInstalled"in e&&e.backdoorInstalled}},function(e,t,n){"use strict";n.d(t,"h",function(){return C}),n.d(t,"m",function(){return P}),n.d(t,"i",function(){return S}),n.d(t,"b",function(){return O}),n.d(t,"c",function(){return T}),n.d(t,"f",function(){return M}),n.d(t,"g",function(){return x}),n.d(t,"e",function(){return w}),n.d(t,"d",function(){return A}),n.d(t,"o",function(){return R}),n.d(t,"p",function(){return N}),n.d(t,"l",function(){return D}),n.d(t,"k",function(){return I}),n.d(t,"q",function(){return B}),n.d(t,"a",function(){return L}),n.d(t,"j",function(){return j}),n.d(t,"r",function(){return F}),n.d(t,"n",function(){return U});var r=n(531),a=n(161),i=n(153),o=n(38),s=n(91),l=n(179),c=n(244),u=n(178),m=n(53),p=n(1),h=n(27),d=n(29),_=n(49),g=n(16),y=n(0),f=n.n(y),b=n(26),E=n.n(b),v=n(446);let k;function C(){return 9===p.Player.bitNodeN||_.SourceFileFlags[9]>0}function P(){if(m.a.isRunning){if(m.a.currStep!==m.d.HacknetNodesIntroduction)return;Object(m.b)()}const e=p.Player.hacknetNodes.length;if(C()){const t=T();if(isNaN(t))throw new Error("Calculated cost of purchasing HacknetServer is NaN");return p.Player.canAfford(t)?(p.Player.loseMoney(t),p.Player.createHacknetServer(),F(),e):-1}{const t=O();if(isNaN(t))throw new Error("Calculated cost of purchasing HacknetNode is NaN");if(!p.Player.canAfford(t))return-1;const n="hacknet-node-"+e,a=new r.HacknetNode(n,p.Player.hacknet_node_money_mult);return p.Player.loseMoney(t),p.Player.hacknetNodes.push(a),e}}function S(){return C()&&p.Player.hacknetNodes.length>=o.HacknetServerConstants.MaxServers}function O(){return Object(a.calculateNodeCost)(p.Player.hacknetNodes.length+1,p.Player.hacknet_node_purchase_cost_mult)}function T(){return Object(i.calculateServerCost)(p.Player.hacknetNodes.length+1,p.Player.hacknet_node_purchase_cost_mult)}function M(e,t){if(null==t)throw new Error("getMaxNumberLevelUpgrades() called without maxLevel arg");if(p.Player.money.lt(e.calculateLevelUpgradeCost(1,p.Player.hacknet_node_level_cost_mult)))return 0;let n=1,r=t-1,a=t-e.level;if(p.Player.money.gt(e.calculateLevelUpgradeCost(a,p.Player.hacknet_node_level_cost_mult)))return a;for(;n<=r;){var i=(n+r)/2|0;if(i!==t&&p.Player.money.gt(e.calculateLevelUpgradeCost(i,p.Player.hacknet_node_level_cost_mult))&&p.Player.money.lt(e.calculateLevelUpgradeCost(i+1,p.Player.hacknet_node_level_cost_mult)))return Math.min(a,i);if(p.Player.money.lt(e.calculateLevelUpgradeCost(i,p.Player.hacknet_node_level_cost_mult)))r=i-1;else{if(!p.Player.money.gt(e.calculateLevelUpgradeCost(i,p.Player.hacknet_node_level_cost_mult)))return Math.min(a,i);n=i+1}}return 0}function x(e,t){if(null==t)throw new Error("getMaxNumberRamUpgrades() called without maxLevel arg");if(p.Player.money.lt(e.calculateRamUpgradeCost(1,p.Player.hacknet_node_ram_cost_mult)))return 0;let n;if(n=e instanceof s.HacknetServer?Math.round(Math.log2(t/e.maxRam)):Math.round(Math.log2(t/e.ram)),p.Player.money.gt(e.calculateRamUpgradeCost(n,p.Player.hacknet_node_ram_cost_mult)))return n;for(let t=n-1;t>=0;--t)if(p.Player.money.gt(e.calculateRamUpgradeCost(t,p.Player.hacknet_node_ram_cost_mult)))return t;return 0}function w(e,t){if(null==t)throw new Error("getMaxNumberCoreUpgrades() called without maxLevel arg");if(p.Player.money.lt(e.calculateCoreUpgradeCost(1,p.Player.hacknet_node_core_cost_mult)))return 0;let n=1,r=t-1;const a=t-e.cores;if(p.Player.money.gt(e.calculateCoreUpgradeCost(a,p.Player.hacknet_node_core_cost_mult)))return a;for(;n<=r;){let i=(n+r)/2|0;if(i!=t&&p.Player.money.gt(e.calculateCoreUpgradeCost(i,p.Player.hacknet_node_core_cost_mult))&&p.Player.money.lt(e.calculateCoreUpgradeCost(i+1,p.Player.hacknet_node_core_cost_mult)))return Math.min(a,i);if(p.Player.money.lt(e.calculateCoreUpgradeCost(i,p.Player.hacknet_node_core_cost_mult)))r=i-1;else{if(!p.Player.money.gt(e.calculateCoreUpgradeCost(i,p.Player.hacknet_node_core_cost_mult)))return Math.min(a,i);n=i+1}}return 0}function A(e,t){if(null==t)throw new Error("getMaxNumberCacheUpgrades() called without maxLevel arg");if(!p.Player.canAfford(e.calculateCacheUpgradeCost(1)))return 0;let n=1,r=t-1;const a=t-e.cache;if(p.Player.canAfford(e.calculateCacheUpgradeCost(a)))return a;for(;n<=r;){let i=(n+r)/2|0;if(i!=t&&p.Player.canAfford(e.calculateCacheUpgradeCost(i))&&!p.Player.canAfford(e.calculateCacheUpgradeCost(i+1)))return Math.min(a,i);if(p.Player.canAfford(e.calculateCacheUpgradeCost(i))){if(!p.Player.canAfford(e.calculateCacheUpgradeCost(i)))return Math.min(a,i);n=i+1}else r=i-1}return 0}function R(e,t=1){const n=Math.round(t),r=e.calculateLevelUpgradeCost(n,p.Player.hacknet_node_level_cost_mult);if(isNaN(r)||r<=0||n<0)return!1;const a=e instanceof s.HacknetServer;if(e.level>=(a?o.HacknetServerConstants.MaxLevel:o.HacknetNodeConstants.MaxLevel))return!1;if(e.level+n>(a?o.HacknetServerConstants.MaxLevel:o.HacknetNodeConstants.MaxLevel)){return R(e,Math.max(0,(a?o.HacknetServerConstants.MaxLevel:o.HacknetNodeConstants.MaxLevel)-e.level))}return!!p.Player.canAfford(r)&&(p.Player.loseMoney(r),e.upgradeLevel(n,p.Player.hacknet_node_money_mult),!0)}function N(e,t=1){const n=Math.round(t),r=e.calculateRamUpgradeCost(n,p.Player.hacknet_node_ram_cost_mult);if(isNaN(r)||r<=0||n<0)return!1;const a=e instanceof s.HacknetServer;if(e.ram>=(a?o.HacknetServerConstants.MaxRam:o.HacknetNodeConstants.MaxRam))return!1;if(a){if(e.maxRam*Math.pow(2,n)>o.HacknetServerConstants.MaxRam){return N(e,Math.max(0,Math.log2(Math.round(o.HacknetServerConstants.MaxRam/e.maxRam))))}}else if(e.ram*Math.pow(2,n)>o.HacknetNodeConstants.MaxRam){return N(e,Math.max(0,Math.log2(Math.round(o.HacknetNodeConstants.MaxRam/e.ram))))}return!!p.Player.canAfford(r)&&(p.Player.loseMoney(r),e.upgradeRam(n,p.Player.hacknet_node_money_mult),!0)}function D(e,t=1){const n=Math.round(t),r=e.calculateCoreUpgradeCost(n,p.Player.hacknet_node_core_cost_mult);if(isNaN(r)||r<=0||n<0)return!1;const a=e instanceof s.HacknetServer;if(e.cores>=(a?o.HacknetServerConstants.MaxCores:o.HacknetNodeConstants.MaxCores))return!1;if(e.cores+n>(a?o.HacknetServerConstants.MaxCores:o.HacknetNodeConstants.MaxCores)){return D(e,Math.max(0,(a?o.HacknetServerConstants.MaxCores:o.HacknetNodeConstants.MaxCores)-e.cores))}return!!p.Player.canAfford(r)&&(p.Player.loseMoney(r),e.upgradeCore(n,p.Player.hacknet_node_money_mult),!0)}function I(e,t=1){const n=Math.round(t),r=e.calculateCacheUpgradeCost(n);if(isNaN(r)||r<=0||n<0)return!1;if(!(e instanceof s.HacknetServer))return console.warn("purchaseCacheUpgrade() called for a non-HacknetNode"),!1;if(e.cache+n>o.HacknetServerConstants.MaxCache){return I(e,Math.max(0,o.HacknetServerConstants.MaxCache-e.cache))}return!!p.Player.canAfford(r)&&(p.Player.loseMoney(r),e.upgradeCache(n),!0)}function B(){g.routing.isOn(g.Page.HacknetNodes)&&E.a.render(f.a.createElement(v.a,null),k)}function L(){k instanceof HTMLElement&&E.a.unmountComponentAtNode(k),k.style.display="none"}function j(e){return 0===p.Player.hacknetNodes.length?0:C()?function(e){if(!(p.Player.hashManager instanceof l.HashManager))throw new Error("Player does not have a HashManager (should be in 'hashManager' prop)");let t=0;for(let n=0;n{!function(e){null!=t.Companies[e.name]&&console.warn(`Duplicate Company Position being defined: ${e.name}`),t.Companies[e.name]=new a.Company(e)}(e)});for(const n in t.Companies){const r=t.Companies[n];e[n]instanceof a.Company?(r.favor=e[n].favor,isNaN(r.favor)&&(r.favor=0)):r.favor=0}},t.loadCompanies=function(e){t.Companies=JSON.parse(e,i.Reviver)},t.companyExists=function(e){return t.Companies.hasOwnProperty(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetIndustryResearchTrees=t.IndustryResearchTrees=t.IndustryDescriptions=t.IndustryStartingCosts=t.Industries=void 0;const r=n(1197),a=n(2);t.Industries={Energy:"Energy",Utilities:"Water Utilities",Agriculture:"Agriculture",Fishing:"Fishing",Mining:"Mining",Food:"Food",Tobacco:"Tobacco",Chemical:"Chemical",Pharmaceutical:"Pharmaceutical",Computer:"Computer Hardware",Robotics:"Robotics",Software:"Software",Healthcare:"Healthcare",RealEstate:"RealEstate"},t.IndustryStartingCosts={Energy:225e9,Utilities:15e10,Agriculture:4e10,Fishing:8e10,Mining:3e11,Food:1e10,Tobacco:2e10,Chemical:7e10,Pharmaceutical:2e11,Computer:5e11,Robotics:1e12,Software:25e9,Healthcare:75e10,RealEstate:6e11},t.IndustryDescriptions={Energy:"Engage in the production and distribution of energy.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Energy,"$0.000a")+" Recommended starting Industry: NO",Utilities:"Distribute water and provide wastewater services.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Utilities,"$0.000a")+" Recommended starting Industry: NO",Agriculture:"Cultivate crops and breed livestock to produce food.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Agriculture,"$0.000a")+" Recommended starting Industry: YES",Fishing:"Produce food through the breeding and processing of fish and fish products.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Fishing,"$0.000a")+" Recommended starting Industry: NO",Mining:"Extract and process metals from the earth.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Mining,"$0.000a")+" Recommended starting Industry: NO",Food:"Create your own restaurants all around the world.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Food,"$0.000a")+" Recommended starting Industry: YES",Tobacco:"Create and distribute tobacco and tobacco-related products.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Chemical,"$0.000a")+" Recommended starting Industry: NO",Pharmaceutical:"Discover, develop, and create new pharmaceutical drugs.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Pharmaceutical,"$0.000a")+" Recommended starting Industry: NO",Computer:"Develop and manufacture new computer hardware and networking infrastructures.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Computer,"$0.000a")+" Recommended starting Industry: NO",Robotics:"Develop and create robots.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Robotics,"$0.000a")+" Recommended starting Industry: NO",Software:"Develop computer software and create AI Cores.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Software,"$0.000a")+" Recommended starting Industry: YES",Healthcare:"Create and manage hospitals.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.Healthcare,"$0.000a")+" Recommended starting Industry: NO",RealEstate:"Develop and manage real estate properties.
Starting cost: "+a.numeralWrapper.format(t.IndustryStartingCosts.RealEstate,"$0.000a")+" Recommended starting Industry: NO"},t.IndustryResearchTrees={Energy:r.getBaseResearchTreeCopy(),Utilities:r.getBaseResearchTreeCopy(),Agriculture:r.getBaseResearchTreeCopy(),Fishing:r.getBaseResearchTreeCopy(),Mining:r.getBaseResearchTreeCopy(),Food:r.getProductIndustryResearchTreeCopy(),Tobacco:r.getProductIndustryResearchTreeCopy(),Chemical:r.getBaseResearchTreeCopy(),Pharmaceutical:r.getProductIndustryResearchTreeCopy(),Computer:r.getProductIndustryResearchTreeCopy(),Robotics:r.getProductIndustryResearchTreeCopy(),Software:r.getProductIndustryResearchTreeCopy(),Healthcare:r.getProductIndustryResearchTreeCopy(),RealEstate:r.getProductIndustryResearchTreeCopy()},t.resetIndustryResearchTrees=function(){t.IndustryResearchTrees.Energy=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Utilities=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Agriculture=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Fishing=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Mining=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Food=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Tobacco=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Chemical=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Pharmaceutical=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Computer=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Robotics=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Software=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.Healthcare=r.getBaseResearchTreeCopy(),t.IndustryResearchTrees.RealEstate=r.getBaseResearchTreeCopy()}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HacknetServerConstants=t.HacknetNodeConstants=void 0,t.HacknetNodeConstants={MoneyGainPerLevel:1.6,BaseCost:1e3,LevelBaseCost:1,RamBaseCost:3e4,CoreBaseCost:5e5,PurchaseNextMult:1.85,UpgradeLevelMult:1.04,UpgradeRamMult:1.28,UpgradeCoreMult:1.48,MaxLevel:200,MaxRam:64,MaxCores:16},t.HacknetServerConstants={HashesPerLevel:.001,BaseCost:5e4,RamBaseCost:2e5,CoreBaseCost:1e6,CacheBaseCost:1e7,PurchaseMult:3.2,UpgradeLevelMult:1.1,UpgradeRamMult:1.4,UpgradeCoreMult:1.55,UpgradeCacheMult:1.85,MaxServers:20,MaxLevel:300,MaxRam:8192,MaxCores:128,MaxCache:15}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initializeMainMenuLinks=t.MainMenuLinks=void 0;const r=n(35),a=(()=>{const e=document.createElement("div");if(null===e)throw new Error("unable to create empty div element");return e})();t.MainMenuLinks={Terminal:a,ScriptEditor:a,ActiveScripts:a,CreateProgram:a,Stats:a,Factions:a,Augmentations:a,HacknetNodes:a,Sleeves:a,City:a,Travel:a,Job:a,StockMarket:a,Bladeburner:a,Corporation:a,Gang:a,Milestones:a,Tutorial:a,Options:a,DevMenu:a},t.initializeMainMenuLinks=function(){try{function e(e){const t=r.clearEventListeners(e);if(null==t)throw new Error(`clearEventListeners() failed for element with id: ${e}`);return t}t.MainMenuLinks.Terminal=e("terminal-menu-link"),t.MainMenuLinks.ScriptEditor=e("create-script-menu-link"),t.MainMenuLinks.ActiveScripts=e("active-scripts-menu-link"),t.MainMenuLinks.CreateProgram=e("create-program-menu-link"),t.MainMenuLinks.Stats=e("stats-menu-link"),t.MainMenuLinks.Factions=e("factions-menu-link"),t.MainMenuLinks.Augmentations=e("augmentations-menu-link"),t.MainMenuLinks.HacknetNodes=e("hacknet-nodes-menu-link"),t.MainMenuLinks.Sleeves=e("sleeves-menu-link"),t.MainMenuLinks.City=e("city-menu-link"),t.MainMenuLinks.Travel=e("travel-menu-link"),t.MainMenuLinks.Job=e("job-menu-link"),t.MainMenuLinks.StockMarket=e("stock-market-menu-link"),t.MainMenuLinks.Bladeburner=e("bladeburner-menu-link"),t.MainMenuLinks.Corporation=e("corporation-menu-link"),t.MainMenuLinks.Gang=e("gang-menu-link"),t.MainMenuLinks.Milestones=e("milestones-menu-link"),t.MainMenuLinks.Tutorial=e("tutorial-menu-link");const n=document.getElementById("options-menu-link");if(null===n)throw new Error('Could not find element with id: "options-menu-link"');return t.MainMenuLinks.Options=n,t.MainMenuLinks.DevMenu=e("dev-menu-link"),!0}catch(e){return console.error(`Failed to initialize Main Menu Links: ${e}`),!1}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CityName=void 0,function(e){e.Aevum="Aevum",e.Chongqing="Chongqing",e.Ishima="Ishima",e.NewTokyo="New Tokyo",e.Sector12="Sector-12",e.Volhaven="Volhaven"}(t.CityName||(t.CityName={}))},,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Programs=void 0;const r=n(1161),a=n(1160);t.Programs={};for(const e of a.programsMetadata)t.Programs[e.key]=new r.Program(e.name,e.create)},function(module,__webpack_exports__,__webpack_require__){"use strict";(function($){__webpack_require__.d(__webpack_exports__,"f",function(){return IssueNewSharesCooldown}),__webpack_require__.d(__webpack_exports__,"k",function(){return SellSharesCooldown}),__webpack_require__.d(__webpack_exports__,"m",function(){return WarehouseInitialCost}),__webpack_require__.d(__webpack_exports__,"n",function(){return WarehouseInitialSize}),__webpack_require__.d(__webpack_exports__,"o",function(){return WarehouseUpgradeBaseCost}),__webpack_require__.d(__webpack_exports__,"g",function(){return OfficeInitialCost}),__webpack_require__.d(__webpack_exports__,"h",function(){return OfficeInitialSize}),__webpack_require__.d(__webpack_exports__,"a",function(){return BribeThreshold}),__webpack_require__.d(__webpack_exports__,"b",function(){return BribeToRepRatio}),__webpack_require__.d(__webpack_exports__,"j",function(){return ProductProductionCostRatio}),__webpack_require__.d(__webpack_exports__,"d",function(){return DividendMaxPercentage}),__webpack_require__.d(__webpack_exports__,"c",function(){return Corporation}),__webpack_require__.d(__webpack_exports__,"e",function(){return Industry}),__webpack_require__.d(__webpack_exports__,"i",function(){return OfficeSpace});var _CorporationState__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(532),_CorporationState__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_CorporationState__WEBPACK_IMPORTED_MODULE_0__),_data_CorporationUnlockUpgrades__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(451),_data_CorporationUnlockUpgrades__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_data_CorporationUnlockUpgrades__WEBPACK_IMPORTED_MODULE_1__),_data_CorporationUpgrades__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(450),_data_CorporationUpgrades__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(_data_CorporationUpgrades__WEBPACK_IMPORTED_MODULE_2__),_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(28),_EmployeePositions__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__),_IndustryData__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(37),_IndustryData__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(_IndustryData__WEBPACK_IMPORTED_MODULE_4__),_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(305),_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_5__),_Material__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(291),_Material__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(_Material__WEBPACK_IMPORTED_MODULE_6__),_MaterialSizes__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(141),_MaterialSizes__WEBPACK_IMPORTED_MODULE_7___default=__webpack_require__.n(_MaterialSizes__WEBPACK_IMPORTED_MODULE_7__),_Product__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(205),_Product__WEBPACK_IMPORTED_MODULE_8___default=__webpack_require__.n(_Product__WEBPACK_IMPORTED_MODULE_8__),_ResearchMap__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(409),_ResearchMap__WEBPACK_IMPORTED_MODULE_9___default=__webpack_require__.n(_ResearchMap__WEBPACK_IMPORTED_MODULE_9__),_Warehouse__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(127),_Warehouse__WEBPACK_IMPORTED_MODULE_10___default=__webpack_require__.n(_Warehouse__WEBPACK_IMPORTED_MODULE_10__);__webpack_require__.d(__webpack_exports__,"l",function(){return _Warehouse__WEBPACK_IMPORTED_MODULE_10__.Warehouse});var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(23),_BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_11___default=__webpack_require__.n(_BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_11__),_Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(449),_Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_12___default=__webpack_require__.n(_Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_12__),_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(145),_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_13___default=__webpack_require__.n(_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_13__),_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(40),_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14___default=__webpack_require__.n(_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__),_Player__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(1),_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(2),_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16___default=__webpack_require__.n(_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__),_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(16),_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17___default=__webpack_require__.n(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__),_utils_calculateEffectWithFactors__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(779),_utils_calculateEffectWithFactors__WEBPACK_IMPORTED_MODULE_18___default=__webpack_require__.n(_utils_calculateEffectWithFactors__WEBPACK_IMPORTED_MODULE_18__),_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__(12),_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__(25),_utils_uiHelpers_appendLineBreaks__WEBPACK_IMPORTED_MODULE_21__=__webpack_require__(107),_utils_uiHelpers_appendLineBreaks__WEBPACK_IMPORTED_MODULE_21___default=__webpack_require__.n(_utils_uiHelpers_appendLineBreaks__WEBPACK_IMPORTED_MODULE_21__),_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__=__webpack_require__(5),_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22___default=__webpack_require__.n(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__),_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_23__=__webpack_require__(52),_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_23___default=__webpack_require__.n(_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_23__),_utils_uiHelpers_createPopupCloseButton__WEBPACK_IMPORTED_MODULE_24__=__webpack_require__(73),_utils_uiHelpers_createPopupCloseButton__WEBPACK_IMPORTED_MODULE_24___default=__webpack_require__.n(_utils_uiHelpers_createPopupCloseButton__WEBPACK_IMPORTED_MODULE_24__),_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__=__webpack_require__(13),_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25___default=__webpack_require__.n(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__),_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__=__webpack_require__(22),_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26___default=__webpack_require__.n(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__),_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_27__=__webpack_require__(65),_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_27___default=__webpack_require__.n(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_27__),_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_28__=__webpack_require__(34),_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_28___default=__webpack_require__.n(_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_28__),_utils_uiHelpers_removeElement__WEBPACK_IMPORTED_MODULE_29__=__webpack_require__(110),_utils_uiHelpers_removeElement__WEBPACK_IMPORTED_MODULE_29___default=__webpack_require__.n(_utils_uiHelpers_removeElement__WEBPACK_IMPORTED_MODULE_29__),_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__=__webpack_require__(45),_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30___default=__webpack_require__.n(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__),_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__=__webpack_require__(58),_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31___default=__webpack_require__.n(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__),react__WEBPACK_IMPORTED_MODULE_32__=__webpack_require__(0),react__WEBPACK_IMPORTED_MODULE_32___default=__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_32__),react_dom__WEBPACK_IMPORTED_MODULE_33__=__webpack_require__(26),react_dom__WEBPACK_IMPORTED_MODULE_33___default=__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_33__),_ui_CorporationUIEventHandler__WEBPACK_IMPORTED_MODULE_34__=__webpack_require__(778),_ui_Root__WEBPACK_IMPORTED_MODULE_35__=__webpack_require__(776),_ui_Routing__WEBPACK_IMPORTED_MODULE_36__=__webpack_require__(448),_ui_Routing__WEBPACK_IMPORTED_MODULE_36___default=__webpack_require__.n(_ui_Routing__WEBPACK_IMPORTED_MODULE_36__),decimal_js__WEBPACK_IMPORTED_MODULE_37__=__webpack_require__(59);const INITIALSHARES=1e9,SHARESPERPRICEUPDATE=1e6,IssueNewSharesCooldown=216e3,SellSharesCooldown=18e3,CyclesPerMarketCycle=50,CyclesPerIndustryStateCycle=CyclesPerMarketCycle/_CorporationState__WEBPACK_IMPORTED_MODULE_0__.AllCorporationStates.length,SecsPerMarketCycle=CyclesPerMarketCycle/5,Cities=["Aevum","Chongqing","Sector-12","New Tokyo","Ishima","Volhaven"],WarehouseInitialCost=5e9,WarehouseInitialSize=100,WarehouseUpgradeBaseCost=1e9,OfficeInitialCost=4e9,OfficeInitialSize=3,OfficeUpgradeBaseCost=1e9,BribeThreshold=1e14,BribeToRepRatio=1e9,ProductProductionCostRatio=5,DividendMaxPercentage=50,EmployeeSalaryMultiplier=3,CyclesPerEmployeeRaise=400,EmployeeRaiseAmount=50,BaseMaxProducts=3;let researchTreeBoxOpened=!1,researchTreeBox=null;function Industry(e={}){this.offices={[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Aevum]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Chongqing]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Sector12]:new OfficeSpace({loc:_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Sector12,size:OfficeInitialSize}),[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.NewTokyo]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Ishima]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Volhaven]:0},this.name=e.name?e.name:0,this.type=e.type?e.type:0,this.sciResearch=new _Material__WEBPACK_IMPORTED_MODULE_6__.Material({name:"Scientific Research"}),this.researched={},this.reqMats={},this.prodMats=[],this.products={},this.makesProducts=!1,this.awareness=0,this.popularity=0,this.startingCost=0,this.reFac=0,this.sciFac=0,this.hwFac=0,this.robFac=0,this.aiFac=0,this.advFac=0,this.prodMult=0,this.lastCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.lastCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0);var t=Object.keys(_IndustryUpgrades__WEBPACK_IMPORTED_MODULE_5__.IndustryUpgrades).length;this.upgrades=Array(t).fill(0),this.state="START",this.newInd=!0,this.warehouses={[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Aevum]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Chonqing]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Sector12]:new _Warehouse__WEBPACK_IMPORTED_MODULE_10__.Warehouse({corp:e.corp,industry:this,loc:_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Sector12,size:WarehouseInitialSize}),[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.NewTokyo]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Ishima]:0,[_Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_14__.CityName.Volhaven]:0},this.init()}function Employee(e={}){if(!(this instanceof Employee))return new Employee(e);this.name=e.name?e.name:"Bobby",this.mor=e.morale?e.morale:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),this.hap=e.happiness?e.happiness:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),this.ene=e.energy?e.energy:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),this.int=e.intelligence?e.intelligence:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(10,50),this.cha=e.charisma?e.charisma:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(10,50),this.exp=e.experience?e.experience:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(10,50),this.cre=e.creativity?e.creativity:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(10,50),this.eff=e.efficiency?e.efficiency:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(10,50),this.sal=e.salary?e.salary:Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(.1,5),this.pro=0,this.cyclesUntilRaise=CyclesPerEmployeeRaise,this.loc=e.loc?e.loc:"",this.pos=_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Unassigned}$(document).mousedown(function(e){researchTreeBoxOpened&&null==$(e.target).closest("#corporation-research-popup-box-content").get(0)&&(Object(_utils_uiHelpers_removeElement__WEBPACK_IMPORTED_MODULE_29__.removeElement)(researchTreeBox),researchTreeBox=null,researchTreeBoxOpened=!1)}),Industry.prototype.init=function(){switch(this.startingCost=_IndustryData__WEBPACK_IMPORTED_MODULE_4__.IndustryStartingCosts[this.type],this.type){case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Energy:this.reFac=.65,this.sciFac=.7,this.robFac=.05,this.aiFac=.3,this.advFac=.08,this.reqMats={Hardware:.1,Metal:.2},this.prodMats=["Energy"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Utilities:case"Utilities":this.reFac=.5,this.sciFac=.6,this.robFac=.4,this.aiFac=.4,this.advFac=.08,this.reqMats={Hardware:.1,Metal:.1},this.prodMats=["Water"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Agriculture:this.reFac=.72,this.sciFac=.5,this.hwFac=.2,this.robFac=.3,this.aiFac=.3,this.advFac=.04,this.reqMats={Water:.5,Energy:.5},this.prodMats=["Plants","Food"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Fishing:this.reFac=.15,this.sciFac=.35,this.hwFac=.35,this.robFac=.5,this.aiFac=.2,this.advFac=.08,this.reqMats={Energy:.5},this.prodMats=["Food"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Mining:this.reFac=.3,this.sciFac=.26,this.hwFac=.4,this.robFac=.45,this.aiFac=.45,this.advFac=.06,this.reqMats={Energy:.8},this.prodMats=["Metal"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Food:this.sciFac=.12,this.hwFac=.15,this.robFac=.3,this.aiFac=.25,this.advFac=.25,this.reFac=.05,this.reqMats={Food:.5,Water:.5,Energy:.2},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Tobacco:this.reFac=.15,this.sciFac=.75,this.hwFac=.15,this.robFac=.2,this.aiFac=.15,this.advFac=.2,this.reqMats={Plants:1,Water:.2},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Chemical:this.reFac=.25,this.sciFac=.75,this.hwFac=.2,this.robFac=.25,this.aiFac=.2,this.advFac=.07,this.reqMats={Plants:1,Energy:.5,Water:.5},this.prodMats=["Chemicals"];break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Pharmaceutical:this.reFac=.05,this.sciFac=.8,this.hwFac=.15,this.robFac=.25,this.aiFac=.2,this.advFac=.16,this.reqMats={Chemicals:2,Energy:1,Water:.5},this.prodMats=["Drugs"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Computer:case"Computer":this.reFac=.2,this.sciFac=.62,this.robFac=.36,this.aiFac=.19,this.advFac=.17,this.reqMats={Metal:2,Energy:1},this.prodMats=["Hardware"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Robotics:this.reFac=.32,this.sciFac=.65,this.aiFac=.36,this.advFac=.18,this.hwFac=.19,this.reqMats={Hardware:5,Energy:3},this.prodMats=["Robots"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Software:this.sciFac=.62,this.advFac=.16,this.hwFac=.25,this.reFac=.15,this.aiFac=.18,this.robFac=.05,this.reqMats={Hardware:.5,Energy:.5},this.prodMats=["AICores"],this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Healthcare:this.reFac=.1,this.sciFac=.75,this.advFac=.11,this.hwFac=.1,this.robFac=.1,this.aiFac=.1,this.reqMats={Robots:10,AICores:5,Energy:5,Water:5},this.makesProducts=!0;break;case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.RealEstate:this.robFac=.6,this.aiFac=.6,this.advFac=.25,this.sciFac=.05,this.hwFac=.05,this.reqMats={Metal:5,Energy:5,Water:2,Hardware:4},this.prodMats=["RealEstate"],this.makesProducts=!0;break;default:return void console.error(`Invalid Industry Type passed into Industry.init(): ${this.type}`)}},Industry.prototype.getProductDescriptionText=function(){if(this.makesProducts)switch(this.type){case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Food:return"create and manage restaurants";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Tobacco:return"create tobacco and tobacco-related products";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Pharmaceutical:return"develop new pharmaceutical drugs";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Computer:case"Computer":return"create new computer hardware and networking infrastructures";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Robotics:return"build specialized robots and robot-related products";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Software:return"develop computer software";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.Healthcare:return"build and manage hospitals";case _IndustryData__WEBPACK_IMPORTED_MODULE_4__.Industries.RealEstate:return"develop and manage real estate properties";default:return console.error("Invalid industry type in Industry.getProductDescriptionText"),""}},Industry.prototype.getMaximumNumberProducts=function(){if(!this.makesProducts)return 0;let e=0;return this.hasResearch("uPgrade: Capacity.I")&&++e,this.hasResearch("uPgrade: Capacity.II")&&++e,BaseMaxProducts+e},Industry.prototype.hasMaximumNumberProducts=function(){return Object.keys(this.products).length>=this.getMaximumNumberProducts()},Industry.prototype.calculateProductionFactors=function(){for(var e=0,t=0;t0&&(e.breakdown+=t+": "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(n.data[e.loc][0]*n.siz,0)+" ")}},Industry.prototype.process=function(e=1,t,n){if(this.state=t,"START"===t){(isNaN(this.thisCycleRevenue)||isNaN(this.thisCycleExpenses))&&(console.error("NaN in Corporation's computed revenue/expenses"),Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("Something went wrong when compting Corporation's revenue/expenses. This is a bug. Please report to game developer"),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0)),this.lastCycleRevenue=this.thisCycleRevenue.dividedBy(e*SecsPerMarketCycle),this.lastCycleExpenses=this.thisCycleExpenses.dividedBy(e*SecsPerMarketCycle),this.thisCycleRevenue=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.thisCycleExpenses=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.lastCycleRevenue.gt(0)&&(this.newInd=!1);var r=0;for(var a in this.offices)this.offices[a]instanceof OfficeSpace&&(r+=this.offices[a].process(e,{industry:this,corporation:n}));this.thisCycleExpenses=this.thisCycleExpenses.plus(r),this.processMaterialMarket(e),this.processProductMarket(e),this.popularity-=1e-4*e,this.popularity=Math.max(0,this.popularity);var i=n.getDreamSenseGain(),o=4*i;return void(i>0&&(this.popularity+=i*e,this.awareness+=o*e))}let s=this.processMaterials(e,n);Array.isArray(s)&&(this.thisCycleRevenue=this.thisCycleRevenue.plus(s[0]),this.thisCycleExpenses=this.thisCycleExpenses.plus(s[1])),s=this.processProducts(e,n),Array.isArray(s)&&(this.thisCycleRevenue=this.thisCycleRevenue.plus(s[0]),this.thisCycleExpenses=this.thisCycleExpenses.plus(s[1]))},Industry.prototype.processMaterialMarket=function(){for(var e=this.reqMats,t=this.prodMats,n=0;n0&&(a.qty+=r,expenses+=r*a.bCost)}(matName,this),this.updateWarehouseSizeUsed(warehouse));break;case"PRODUCTION":if(warehouse.smartSupplyStore=0,this.prodMats.length>0){var mat=warehouse.materials[this.prodMats[0]],maxProd=this.getOfficeProductivity(office)*this.prodMult*company.getProductionMultiplier()*this.getProductionMultiplier();let e;e=mat.prdman[0]?Math.min(maxProd,mat.prdman[1]):maxProd,e*=SecsPerMarketCycle*marketCycles;var totalMatSize=0;for(let e=0;e0){var maxAmt=Math.floor((warehouse.size-warehouse.sizeUsed)/totalMatSize);e=Math.min(maxAmt,e)}e<0&&(e=0),warehouse.smartSupplyStore+=e/(SecsPerMarketCycle*marketCycles);var producableFrac=1;for(var reqMatName in this.reqMats)if(this.reqMats.hasOwnProperty(reqMatName)){var req=this.reqMats[reqMatName]*e;warehouse.materials[reqMatName].qty0&&e>0){for(const t in this.reqMats){var reqMatQtyNeeded=this.reqMats[t]*e*producableFrac;warehouse.materials[t].qty-=reqMatQtyNeeded,warehouse.materials[t].prd=0,warehouse.materials[t].prd-=reqMatQtyNeeded/(SecsPerMarketCycle*marketCycles)}for(let t=0;tmat.bCost?sCost-mat.bCost>markupLimit&&(markup=Math.pow(markupLimit/(sCost-mat.bCost),2)):sCost=0?(mat.qty-=sellAmt,revenue+=sellAmt*sCost,mat.sll=sellAmt/(SecsPerMarketCycle*marketCycles)):mat.sll=0}break;case"EXPORT":for(var matName in warehouse.materials)if(warehouse.materials.hasOwnProperty(matName)){var mat=warehouse.materials[matName];mat.totalExp=0;for(var expI=0;expI=expWarehouse.size)return[0,0];var maxAmt=Math.floor((expWarehouse.size-expWarehouse.sizeUsed)/_MaterialSizes__WEBPACK_IMPORTED_MODULE_7__.MaterialSizes[matName]);amt=Math.min(maxAmt,amt),expWarehouse.materials[matName].imp+=amt/(SecsPerMarketCycle*marketCycles),expWarehouse.materials[matName].qty+=amt,expWarehouse.materials[matName].qlt=mat.qlt,mat.qty-=amt,mat.totalExp+=amt,expIndustry.updateWarehouseSizeUsed(expWarehouse);break}}}mat.totalExp/=SecsPerMarketCycle*marketCycles}break;case"START":break;default:console.error(`Invalid state: ${this.state}`)}this.updateWarehouseSizeUsed(warehouse)}office instanceof OfficeSpace&&(this.sciResearch.qty+=.004*Math.pow(office.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.RandD],.5)*company.getScientificResearchMultiplier()*this.getScientificResearchMultiplier())}return[revenue,expenses]},Industry.prototype.processProducts=function(e=1,t){var n=0;if("PRODUCTION"===this.state)for(const t in this.products){const n=this.products[t];if(!n.fin){const t=n.createCity,r=this.offices[t],a=r.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Engineer],i=r.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Management],o=r.employeeProd[_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Operations],s=a+i+o;if(s<=0)break;const l=1+i/(1.2*s),c=(Math.pow(a,.34)+Math.pow(o,.2))*l;n.createProduct(e,c),n.prog>=100&&n.finishProduct(r.employeeProd,this);break}}for(var r in this.products)if(this.products.hasOwnProperty(r)){var a=this.products[r];a instanceof _Product__WEBPACK_IMPORTED_MODULE_8__.Product&&a.fin&&(n+=this.processProduct(e,a,t))}return[n,0]},Industry.prototype.processProduct=function(marketCycles=1,product,corporation){let totalProfit=0;for(let i=0;i0){var maxAmt=Math.floor((warehouse.size-warehouse.sizeUsed)/netStorageSize);e=Math.min(maxAmt,e)}warehouse.smartSupplyStore+=e/(SecsPerMarketCycle*marketCycles);var producableFrac=1;for(var reqMatName in product.reqMats)if(product.reqMats.hasOwnProperty(reqMatName)){var req=product.reqMats[reqMatName]*e;warehouse.materials[reqMatName].qty0&&e>0){for(var reqMatName in product.reqMats)if(product.reqMats.hasOwnProperty(reqMatName)){var reqMatQtyNeeded=product.reqMats[reqMatName]*e*producableFrac;warehouse.materials[reqMatName].qty-=reqMatQtyNeeded,warehouse.materials[reqMatName].prd-=reqMatQtyNeeded/(SecsPerMarketCycle*marketCycles)}product.data[city][0]+=e*producableFrac}product.data[city][1]=e*producableFrac/(SecsPerMarketCycle*marketCycles);break}case"SALE":{for(var reqMatName in product.pCost=0,product.reqMats)product.reqMats.hasOwnProperty(reqMatName)&&(product.pCost+=product.reqMats[reqMatName]*warehouse.materials[reqMatName].bCost);product.pCost*=ProductProductionCostRatio;const businessFactor=this.getBusinessFactor(office),advertisingFactor=this.getAdvertisingFactors()[0],marketFactor=this.getMarketFactor(product),markupLimit=product.rat/product.mku;var sCost;if(product.marketTa2){const e=product.data[city][1],t=markupLimit,n=e,r=.5*Math.pow(product.rat,.65)*marketFactor*corporation.getSalesMultiplier()*businessFactor*advertisingFactor*this.getSalesMultiplier(),a=Math.sqrt(n/r);let i;0===r||0===a?0===n?i=0:(i=product.pCost+markupLimit,console.warn("In Corporation, found illegal 0s when trying to calculate MarketTA2 sale cost")):i=t/a+product.pCost,product.marketTa2Price[city]=i,sCost=i}else product.marketTa1?sCost=product.pCost+markupLimit:Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_27__.isString)(product.sCost)?(sCost=product.sCost.replace(/MP/g,product.pCost+product.rat/product.mku),sCost=eval(sCost)):sCost=product.sCost;var markup=1;sCost>product.pCost&&sCost-product.pCost>markupLimit&&(markup=markupLimit/(sCost-product.pCost));var maxSell=.5*Math.pow(product.rat,.65)*marketFactor*corporation.getSalesMultiplier()*Math.pow(markup,2)*businessFactor*advertisingFactor*this.getSalesMultiplier(),sellAmt;if(product.sllman[city][0]&&Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_27__.isString)(product.sllman[city][1])){var tmp=product.sllman[city][1].replace(/MAX/g,maxSell);tmp=tmp.replace(/PROD/g,product.data[city][1]);try{tmp=eval(tmp)}catch(e){Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("Error evaluating your sell price expression for "+product.name+" in "+this.name+"'s "+city+" office. Sell price is being set to MAX"),tmp=maxSell}sellAmt=Math.min(maxSell,tmp)}else sellAmt=product.sllman[city][0]&&product.sllman[city][1]>0?Math.min(maxSell,product.sllman[city][1]):!1===product.sllman[city][0]?0:maxSell;sellAmt<0&&(sellAmt=0),sellAmt=sellAmt*SecsPerMarketCycle*marketCycles,sellAmt=Math.min(product.data[city][0],sellAmt),sellAmt&&sCost?(product.data[city][0]-=sellAmt,totalProfit+=sellAmt*sCost,product.data[city][2]=sellAmt/(SecsPerMarketCycle*marketCycles)):product.data[city][2]=0;break}case"START":case"PURCHASE":case"EXPORT":break;default:console.error(`Invalid State: ${this.state}`)}}return totalProfit},Industry.prototype.discontinueProduct=function(e){for(var t in this.products)this.products.hasOwnProperty(t)&&e===this.products[t]&&delete this.products[t]},Industry.prototype.upgrade=function(e,t){for(var n=t.corporation,r=t.office,a=e[0];this.upgrades.length<=a;)this.upgrades.push(0);switch(++this.upgrades[a],a){case 0:for(let e=0;e{if(this.sciResearch.qty>=n.cost)return this.sciResearch.qty-=n.cost,t.research(r[e]),this.researched[r[e]]=!0,Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)(`Researched ${r[e]}. It may take a market cycle `+`(~${SecsPerMarketCycle} seconds) before the effects of `+"the Research apply."),this.createResearchBox();Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)(`You do not have enough Scientific Research for ${n.name}`)}):console.warn(`Could not find Research Tree div for ${a}`)}const a=document.getElementById(`${e}-content`);null!=a&&(Object(_utils_uiHelpers_appendLineBreaks__WEBPACK_IMPORTED_MODULE_21__.appendLineBreaks)(a,2),a.appendChild(Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("pre",{display:"block",innerText:"Multipliers from research:\n"+` * Advertising Multiplier: x${t.getAdvertisingMultiplier()}\n`+` * Employee Charisma Multiplier: x${t.getEmployeeChaMultiplier()}\n`+` * Employee Creativity Multiplier: x${t.getEmployeeCreMultiplier()}\n`+` * Employee Efficiency Multiplier: x${t.getEmployeeEffMultiplier()}\n`+` * Employee Intelligence Multiplier: x${t.getEmployeeIntMultiplier()}\n`+` * Production Multiplier: x${t.getProductionMultiplier()}\n`+` * Sales Multiplier: x${t.getSalesMultiplier()}\n`+` * Scientific Research Multiplier: x${t.getScientificResearchMultiplier()}\n`+` * Storage Multiplier: x${t.getStorageMultiplier()}`})),a.appendChild(Object(_utils_uiHelpers_createPopupCloseButton__WEBPACK_IMPORTED_MODULE_24__.createPopupCloseButton)(researchTreeBox,{class:"std-button",display:"block",innerText:"Close"}))),researchTreeBoxOpened=!0},Industry.prototype.toJSON=function(){return Object(_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_20__.Generic_toJSON)("Industry",this)},Industry.fromJSON=function(e){return Object(_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_20__.Generic_fromJSON)(Industry,e.data)},_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_20__.Reviver.constructors.Industry=Industry,Employee.prototype.process=function(e=1,t){var n=.003*e,r=n*Math.random();this.exp+=n,this.cyclesUntilRaise-=e,this.cyclesUntilRaise<=0&&(this.salary+=EmployeeRaiseAmount,this.cyclesUntilRaise+=CyclesPerEmployeeRaise);var a=n*Math.random();return this.pos===_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Training&&(this.cha+=a,this.exp+=a,this.eff+=a),this.ene-=r,this.hap-=r,this.eneHappiness: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(this.hap,3)+" Energy: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(this.ene,3)+" Intelligence: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(i,3)+" Charisma: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(a,3)+" Experience: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(this.exp,3)+" Creativity: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(r,3)+" Efficiency: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(o,3)+" Salary: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(this.sal,"$0.000a")+"/ s "}));var s=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("select",{});for(var l in _EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions)_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.hasOwnProperty(l)&&s.add(Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("option",{text:_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions[l],value:_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions[l]}));s.addEventListener("change",()=>{this.pos=s.options[s.selectedIndex].value});for(var c=0;c=this.size},OfficeSpace.prototype.process=function(e=1,t){var n=t.industry;if(n.hasResearch("HRBuddy-Recruitment")&&!this.atCapacity()){const e=this.hireRandomEmployee();n.hasResearch("HRBuddy-Training")&&(e.pos=_EmployeePositions__WEBPACK_IMPORTED_MODULE_3__.EmployeePositions.Training)}this.maxEne=100,this.maxHap=100,this.maxMor=100,n.hasResearch("Go-Juice")&&(this.maxEne+=10),n.hasResearch("JoyWire")&&(this.maxHap+=10),n.hasResearch("Sti.mu")&&(this.maxMor+=10);var r=1;n.funds<0&&n.lastCycleRevenue<0?r=Math.pow(.99,e):n.funds>0&&n.lastCycleRevenue>0&&(r=Math.pow(1.01,e));const a=n.hasResearch("AutoBrew"),i=n.hasResearch("AutoPartyManager");var o=0;for(let t=0;tCharisma: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(t.cha,1)+" Experience: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(t.exp,1)+" Creativity: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(t.cre,1)+" Efficiency: "+Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.formatNumber)(t.eff,1)+" Salary: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(t.sal,"$0.000a")+" s ",clickListener:()=>(n.hireEmployee(t,e),Object(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__.removeElementById)("cmpy-mgmt-hire-employee-popup"),!1)})},_=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("a",{class:"a-link-button",innerText:"Cancel",float:"right",clickListener:()=>(Object(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__.removeElementById)("cmpy-mgmt-hire-employee-popup"),!1)}),g=[h,d(u,this),d(m,this),d(p,this),_];Object(_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_23__.createPopup)("cmpy-mgmt-hire-employee-popup",g)}},OfficeSpace.prototype.hireEmployee=function(e,t){var n=t.corporation,r=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoTxtInpBoxGetYesButton)(),a=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoTxtInpBoxGetNoButton)();r.innerHTML="Hire",a.innerHTML="Cancel",r.addEventListener("click",()=>{for(var t=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoTxtInpBoxGetInput)(),r=0;rObject(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoTxtInpBoxClose)()),Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoTxtInpBoxCreate)("Give your employee a nickname!")},OfficeSpace.prototype.hireRandomEmployee=function(){if(!this.atCapacity()&&null==document.getElementById("cmpy-mgmt-hire-employee-popup")){var e=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(76,100)/100,t=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),n=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),r=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),a=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),i=Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_26__.getRandomInt)(50,100),o=new Employee({intelligence:t*e,charisma:n*e,experience:r*e,creativity:a*e,efficiency:i*e,salary:EmployeeSalaryMultiplier*(t+n+r+a+i)*e}),s=Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_25__.generateRandomString)(7);for(let e=0;e=CyclesPerIndustryStateCycle){const e=this.getState(),t=1,n=t*CyclesPerIndustryStateCycle;if(this.storedCycles-=n,this.divisions.forEach(n=>{n.process(t,e,this)}),this.shareSaleCooldown>0&&(this.shareSaleCooldown-=n),this.issueNewSharesCooldown>0&&(this.issueNewSharesCooldown-=n),"START"===e){this.revenue=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.expenses=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(0),this.divisions.forEach(e=>{e.lastCycleRevenue!==-1/0&&e.lastCycleRevenue!==1/0&&e.lastCycleExpenses!==-1/0&&e.lastCycleExpenses!==1/0&&(this.revenue=this.revenue.plus(e.lastCycleRevenue),this.expenses=this.expenses.plus(e.lastCycleExpenses))});const e=this.revenue.minus(this.expenses).times(t*SecsPerMarketCycle);if(isNaN(this.funds)&&(Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("There was an error calculating your Corporations funds and they got reset to 0. This is a bug. Please report to game developer.
(Your funds have been set to $150b for the inconvenience)"),this.funds=new decimal_js__WEBPACK_IMPORTED_MODULE_37__.a(15e10)),this.dividendPercentage>0&&e>0)if(isNaN(this.dividendPercentage)||this.dividendPercentage<0||this.dividendPercentage>DividendMaxPercentage)console.error(`Invalid Corporation dividend percentage: ${this.dividendPercentage}`);else{const t=this.dividendPercentage/100*e,n=e-t,r=t/this.totalShares,a=this.numShares*r*(1-this.dividendTaxPercentage/100);_Player__WEBPACK_IMPORTED_MODULE_15__.Player.gainMoney(a),_Player__WEBPACK_IMPORTED_MODULE_15__.Player.recordMoneySource(a,"corporation"),this.funds=this.funds.plus(n)}else this.funds=this.funds.plus(e);this.updateSharePrice()}this.state.nextState(),_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__.routing.isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__.Page.Corporation)&&this.rerender()}},Corporation.prototype.determineValuation=function(){var e,t=this.revenue.minus(this.expenses).toNumber();return this.public?(this.dividendPercentage>0&&(t*=(100-this.dividendPercentage)/100),e=this.funds.toNumber()+85e3*t,e*=Math.pow(1.1,this.divisions.length),e=Math.max(e,0)):(e=1e10+Math.max(this.funds.toNumber(),0)/3,t>0?(e+=315e3*t,e*=Math.pow(1.1,this.divisions.length)):e=1e10*Math.pow(1.1,this.divisions.length),e-=e%1e6),e*_BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_11__.BitNodeMultipliers.CorporationValuation},Corporation.prototype.getInvestment=function(){var e,t=this.determineValuation();let n=4;switch(this.fundingRound){case 0:e=.1,n=4;break;case 1:e=.35,n=3;break;case 2:e=.25,n=3;break;case 3:e=.2,n=2.5;break;case 4:return}var r=t*e*n,a=Math.floor(INITIALSHARES*e),i=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoBoxGetYesButton)(),o=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoBoxGetNoButton)();i.innerHTML="Accept",o.innerHML="Reject",i.addEventListener("click",()=>(++this.fundingRound,this.funds=this.funds.plus(r),this.numShares-=a,this.rerender(),Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoBoxClose)())),o.addEventListener("click",()=>Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoBoxClose)()),Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_31__.yesNoBoxCreate)("An investment firm has offered you "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(r,"$0.000a")+" in funding in exchange for a "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(100*e,"0.000a")+"% stake in the company ("+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(a,"0.000a")+" shares).
Do you accept or reject this offer?
Hint: Investment firms will offer more money if your corporation is turning a profit")},Corporation.prototype.goPublic=function(){var e,t=this.determineValuation()/this.totalShares,n=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("p",{innerHTML:"Enter the number of shares you would like to issue for your IPO. These shares will be publicly sold and you will no longer own them. Your Corporation will receive "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(t,"$0.000a")+" per share (the IPO money will be deposited directly into your Corporation's funds).
You have a total of "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.format(this.numShares,"0.000a")+" of shares that you can issue."}),r=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("input",{type:"number",placeholder:"Shares to issue",onkeyup:t=>{t.preventDefault(),t.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_28__.KEY.ENTER&&e.click()}}),a=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("br",{});e=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("a",{class:"a-link-button",innerText:"Go Public",clickListener:()=>{var e=Math.round(r.value),t=this.determineValuation()/this.totalShares;return isNaN(e)?(Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("Invalid value for number of issued shares"),!1):e>this.numShares?(Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("Error: You don't have that many shares to issue!"),!1):(this.public=!0,this.sharePrice=t,this.issuedShares=e,this.numShares-=e,this.funds=this.funds.plus(e*t),this.rerender(),Object(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__.removeElementById)("cmpy-mgmt-go-public-popup"),Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)(`You took your ${this.name} public and earned `+`${_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_16__.numeralWrapper.formatMoney(e*t)} in your IPO`),!1)}});var i=Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_22__.createElement)("a",{class:"a-link-button",innerText:"Cancel",clickListener:()=>(Object(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_30__.removeElementById)("cmpy-mgmt-go-public-popup"),!1)});Object(_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_23__.createPopup)("cmpy-mgmt-go-public-popup",[n,a,r,e,i])},Corporation.prototype.getTargetSharePrice=function(){return this.determineValuation()/(2*(this.totalShares-this.numShares)+1)},Corporation.prototype.updateSharePrice=function(){const e=this.getTargetSharePrice();this.sharePrice<=e?this.sharePrice*=1+.01*Math.random():this.sharePrice*=1-.01*Math.random(),this.sharePrice<=.01&&(this.sharePrice=.01)},Corporation.prototype.immediatelyUpdateSharePrice=function(){this.sharePrice=this.getTargetSharePrice()},Corporation.prototype.calculateShareSale=function(e){let t=e,n=this.shareSalesUntilPriceUpdate,r=this.sharePrice,a=0,i=0;const o=Math.ceil(e/SHARESPERPRICEUPDATE);if(!(isNaN(o)||o>1e7)){for(let e=0;e3600?`${Math.floor(t/3600)} hour(s)`:t>60?`${Math.floor(t/60)} minute(s)`:`${Math.floor(t)} second(s)`},Corporation.prototype.unlock=function(e){const t=e[0],n=e[1];for(;this.unlockUpgrades.length<=t;)this.unlockUpgrades.push(0);this.funds.lt(n)?Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("You don't have enough funds to unlock this!"):(this.unlockUpgrades[t]=1,this.funds=this.funds.minus(n),5===t?this.dividendTaxPercentage-=5:6===t&&(this.dividendTaxPercentage-=10))},Corporation.prototype.upgrade=function(e){for(var t=e[0],n=e[1],r=e[2],a=e[3];this.upgrades.length<=t;)this.upgrades.push(0);for(;this.upgradeMultipliers.length<=t;)this.upgradeMultipliers.push(1);var i=n*Math.pow(r,this.upgrades[t]);if(this.funds.lt(i))Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_19__.dialogBoxCreate)("You don't have enough funds to purchase this!");else if(++this.upgrades[t],this.funds=this.funds.minus(i),this.upgradeMultipliers[t]=1+this.upgrades[t]*a,1===t)for(var o=0;od.Start&&(_.currStep-=1);y()}(),!1}),Object(c.clearEventListeners)("interactive-tutorial-next").addEventListener("click",function(){return f(),!1}),y()}function y(){if(_.isRunning){var e=Object(c.clearEventListeners)("terminal-menu-link"),t=Object(c.clearEventListeners)("stats-menu-link"),n=Object(c.clearEventListeners)("active-scripts-menu-link"),a=Object(c.clearEventListeners)("hacknet-nodes-menu-link"),i=Object(c.clearEventListeners)("city-menu-link"),o=Object(c.clearEventListeners)("tutorial-menu-link");e.removeAttribute("class"),t.removeAttribute("class"),n.removeAttribute("class"),a.removeAttribute("class"),i.removeAttribute("class"),o.removeAttribute("class");var s=document.getElementById("interactive-tutorial-next");switch(_.currStep){case d.Start:r.Engine.loadTerminalContent(),E("Welcome to Bitburner, a cyberpunk-themed incremental RPG! The game takes place in a dark, dystopian future...The year is 2077...
This tutorial will show you the basics of the game. You may skip the tutorial at any time."),s.style.display="inline-block";break;case d.GoToCharacterPage:r.Engine.loadTerminalContent(),E("Let's start by heading to the Stats page. Click the 'Stats' tab on the main navigation menu (left-hand side of the screen)"),s.style.display="none",t.setAttribute("class","flashing-button"),t.addEventListener("click",function(){return r.Engine.loadCharacterContent(),f(),!1});break;case d.CharacterPage:r.Engine.loadCharacterContent(),E("The Stats page shows a lot of important information about your progress, such as your skills, money, and bonuses/multipliers. "),s.style.display="inline-block";break;case d.CharacterGoToTerminalPage:r.Engine.loadCharacterContent(),E("Let's head to your computer's terminal by clicking the 'Terminal' tab on the main navigation menu."),s.style.display="none",e.setAttribute("class","flashing-button"),e.addEventListener("click",function(){return r.Engine.loadTerminalContent(),f(),!1});break;case d.TerminalIntro:r.Engine.loadTerminalContent(),E("The Terminal is used to interface with your home computer as well as all of the other machines around the world."),s.style.display="inline-block";break;case d.TerminalHelp:r.Engine.loadTerminalContent(),E("Let's try it out. Start by entering the 'help' command into the Terminal (Don't forget to press Enter after typing the command)"),s.style.display="none";break;case d.TerminalLs:r.Engine.loadTerminalContent(),E("The 'help' command displays a list of all available Terminal commands, how to use them, and a description of what they do.
Let's try another command. Enter the 'ls' command"),s.style.display="none";break;case d.TerminalScan:r.Engine.loadTerminalContent(),E("'ls' is a basic command that shows all of the contents (programs/scripts) on the computer. Right now, it shows that you have a program called 'NUKE.exe' on your computer. We'll get to what this does later.
Using your home computer's terminal, you can connect to other machines throughout the world. Let's do that now by first entering the 'scan' command."),s.style.display="none";break;case d.TerminalScanAnalyze1:r.Engine.loadTerminalContent(),E("The 'scan' command shows all available network connections. In other words, it displays a list of all servers that can be connected to from your current machine. A server is identified by either its IP or its hostname.
That's great and all, but there's so many servers. Which one should you go to? The 'scan-analyze' command gives some more detailed information about servers on the network. Try it now"),s.style.display="none";break;case d.TerminalScanAnalyze2:r.Engine.loadTerminalContent(),E("You just ran 'scan-analyze' with a depth of one. This command shows more detailed information about each server that you can connect to (servers that are a distance of one node away).
It is also possible to run 'scan-analyze' with a higher depth. Let's try a depth of two with the following command: 'scan-analyze 2'."),s.style.display="none";break;case d.TerminalConnect:r.Engine.loadTerminalContent(),E("Now you can see information about all servers that are up to two nodes away, as well as figure out how to navigate to those servers through the network. You can only connect to a server that is one node away. To connect to a machine, use the 'connect [ip/hostname]' command. You can type in the ip or the hostname, but dont use both.
From the results of the 'scan-analyze' command, we can see that the 'foodnstuff' server is only one node away. Let's connect so it now using: 'connect foodnstuff'"),s.style.display="none";break;case d.TerminalAnalyze:r.Engine.loadTerminalContent(),E("You are now connected to another machine! What can you do now? You can hack it!
In the year 2077, currency has become digital and decentralized. People and corporations store their money on servers and computers. Using your hacking abilities, you can hack servers to steal money and gain experience.
Before you try to hack a server, you should run diagnostics using the 'analyze' command"),s.style.display="none";break;case d.TerminalNuke:r.Engine.loadTerminalContent(),E("When the 'analyze' command finishes running it will show useful information about hacking the server.
For this server, the required hacking skill is only 1, which means you can hack it right now. However, in order to hack a server you must first gain root access. The 'NUKE.exe' program that we saw earlier on your home computer is a virus that will grant you root access to a machine if there are enough open ports.
The 'analyze' results shows that there do not need to be any open ports on this machine for the NUKE virus to work, so go ahead and run the virus using the 'run NUKE.exe' command."),s.style.display="none";break;case d.TerminalManualHack:r.Engine.loadTerminalContent(),E("You now have root access! You can hack the server using the 'hack' command. Try doing that now."),s.style.display="none";break;case d.TerminalHackingMechanics:r.Engine.loadTerminalContent(),E("You are now attempting to hack the server. Note that performing a hack takes time and only has a certain percentage chance of success. This time and success chance is determined by a variety of factors, including your hacking skill and the server's security level.
If your attempt to hack the server is successful, you will steal a certain percentage of the server's total money. This percentage is affected by your hacking skill and the server's security level.
The amount of money on a server is not limitless. So, if you constantly hack a server and deplete its money, then you will encounter diminishing returns in your hacking."),s.style.display="inline-block";break;case d.TerminalCreateScript:r.Engine.loadTerminalContent(),E("Hacking is the core mechanic of the game and is necessary for progressing. However, you don't want to be hacking manually the entire time. You can automate your hacking by writing scripts!
To create a new script or edit an existing one, you can use the 'nano' command. Scripts must end with the '.script' extension. Let's make a script now by entering 'nano foodnstuff.script' after the hack command finishes running (Sidenote: Pressing ctrl + c will end a command like hack early)"),s.style.display="none";break;case d.TerminalTypeScript:r.Engine.loadScriptEditorContent("foodnstuff.script",""),E("This is the script editor. You can use it to program your scripts. Scripts are written in the Netscript language, a programming language created for this game. There are details about the Netscript language in the documentation, which can be accessed in the 'Tutorial' tab on the main navigation menu. I highly suggest you check it out after this tutorial. For now, just copy and paste the following code into the script editor:
while(true) { hack('foodnstuff'); }
For anyone with basic programming experience, this code should be straightforward. This script will continuously hack the 'foodnstuff' server.
To save and close the script editor, press the button in the bottom left, or press ctrl + b."),s.style.display="none";break;case d.TerminalFree:r.Engine.loadTerminalContent(),E("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be run on any machine which you have root access to. Different servers have different amounts of RAM. You can also purchase more RAM for your home server.
To check how much RAM is available on this machine, enter the 'free' command."),s.style.display="none";break;case d.TerminalRunScript:r.Engine.loadTerminalContent(),E("We have 16GB of free RAM on this machine, which is enough to run our script. Let's run our script using 'run foodnstuff.script'."),s.style.display="none";break;case d.TerminalGoToActiveScriptsPage:r.Engine.loadTerminalContent(),E("Your script is now running! The script might take a few seconds to 'fully start up'. Your scripts will continuously run in the background and will automatically stop if the code ever completes (the 'foodnstuff.script' will never complete because it runs an infinite loop).
These scripts can passively earn you income and hacking experience. Your scripts will also earn money and experience while you are offline, although at a much slower rate.
Let's check out some statistics for our running scripts by clicking the 'Active Scripts' link in the main navigation menu."),s.style.display="none",n.setAttribute("class","flashing-button"),n.addEventListener("click",function(){return r.Engine.loadActiveScriptsContent(),f(),!1});break;case d.ActiveScriptsPage:r.Engine.loadActiveScriptsContent(),E("This page displays stats/information about all of your scripts that are running across every existing server. You can use this to gauge how well your scripts are doing. Let's go back to the Terminal now using the 'Terminal' link."),s.style.display="none",e.setAttribute("class","flashing-button"),e.addEventListener("click",function(){return r.Engine.loadTerminalContent(),f(),!1});break;case d.ActiveScriptsToTerminal:r.Engine.loadTerminalContent(),E("One last thing about scripts, each active script contains logs that detail what it's doing. We can check these logs using the 'tail' command. Do that now for the script we just ran by typing 'tail foodnstuff.script'"),s.style.display="none";break;case d.TerminalTailScript:r.Engine.loadTerminalContent(),E("The log for this script won't show much right now (it might show nothing at all) because it just started running...but check back again in a few minutes!
This pretty much covers the basics of hacking. To learn more about writing scripts using the Netscript language, select the 'Tutorial' link in the main navigation menu to look at the documentation. If you are an experienced JavaScript developer, I would highly suggest you check out the section on NetscriptJS/Netscript 2.0.
For now, let's move on to something else!"),s.style.display="inline-block";break;case d.GoToHacknetNodesPage:r.Engine.loadTerminalContent(),E("Hacking is not the only way to earn money. One other way to passively earn money is by purchasing and upgrading Hacknet Nodes. Let's go to the 'Hacknet Nodes' page through the main navigation menu now."),s.style.display="none",a.setAttribute("class","flashing-button"),a.addEventListener("click",function(){return r.Engine.loadHacknetNodesContent(),f(),!1});break;case d.HacknetNodesIntroduction:r.Engine.loadHacknetNodesContent(),E("From this page you can purchase new Hacknet Nodes and upgrade your existing ones. Let's purchase a new one now."),s.style.display="none";break;case d.HacknetNodesGoToWorldPage:r.Engine.loadHacknetNodesContent(),E("You just purchased a Hacknet Node! This Hacknet Node will passively earn you money over time, both online and offline. When you get enough money, you can upgrade your newly-purchased Hacknet Node below.
Let's go to the 'City' page through the main navigation menu."),s.style.display="none",i.setAttribute("class","flashing-button"),i.addEventListener("click",function(){return r.Engine.loadLocationContent(),f(),!1});break;case d.WorldDescription:r.Engine.loadLocationContent(),E("This page lists all of the different locations you can currently travel to. Each location has something that you can do. There's a lot of content out in the world, make sure you explore and discover!
Lastly, click on the 'Tutorial' link in the main navigation menu."),s.style.display="none",o.setAttribute("class","flashing-button"),o.addEventListener("click",function(){return r.Engine.loadTutorialContent(),f(),!1});break;case d.TutorialPageInfo:r.Engine.loadTutorialContent(),E("This page contains a lot of different documentation about the game's content and mechanics. I know it's a lot, but I highly suggest you read (or at least skim) through this before you start playing. That's the end of the tutorial. Hope you enjoy the game!"),s.style.display="inline-block",s.innerHTML="Finish Tutorial";break;case d.End:b();break;default:throw new Error("Invalid tutorial step")}!0===_.stepIsDone[_.currStep]&&(s.style.display="inline-block")}}function f(){_.currStep===d.GoToCharacterPage&&document.getElementById("stats-menu-link").removeAttribute("class"),_.currStep===d.CharacterGoToTerminalPage&&document.getElementById("terminal-menu-link").removeAttribute("class"),_.currStep===d.TerminalGoToActiveScriptsPage&&document.getElementById("active-scripts-menu-link").removeAttribute("class"),_.currStep===d.ActiveScriptsPage&&document.getElementById("terminal-menu-link").removeAttribute("class"),_.currStep===d.GoToHacknetNodesPage&&document.getElementById("hacknet-nodes-menu-link").removeAttribute("class"),_.currStep===d.HacknetNodesGoToWorldPage&&document.getElementById("city-menu-link").removeAttribute("class"),_.currStep===d.WorldDescription&&document.getElementById("tutorial-menu-link").removeAttribute("class"),_.stepIsDone[_.currStep]=!0,_.currStep Getting Started GuideDocumentation
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
cat "+s.LiteratureNames.HackersStartingHandbook}),n=Object(u.createElement)("a",{class:"a-link-button",float:"right",padding:"6px",innerText:"Got it!",clickListener:()=>{Object(p.removeElementById)(e)}});Object(m.createPopup)(e,[t,n]),a.Player.getHomeComputer().messages.push(s.LiteratureNames.HackersStartingHandbook)}function E(e){var t=document.getElementById("interactive-tutorial-text");if(null==t)throw new Error("Could not find text box");t.innerHTML=e,t.parentElement.scrollTop=0}},,,function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return a(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.displayStockMarketContent=t.processStockPrices=t.stockMarketCycle=t.initSymbolToStockMap=t.initStockMarket=t.deleteStockMarket=t.loadStockMarket=t.cancelOrder=t.placeOrder=t.SymbolToStockMap=t.StockMarket=void 0;const o=n(177),s=n(932),l=n(931),c=n(195),u=n(930),m=n(929),p=n(123),h=n(106),d=n(285),_=n(928),g=n(10),y=n(1),f=n(484),b=n(16),E=n(2),v=n(12),k=n(25),C=i(n(0)),P=i(n(26));function S(e,n,r,a,i,o=null){if(!(e instanceof c.Stock))return o?o.log("placeOrder",`Invalid stock: '${e}'`):v.dialogBoxCreate("ERROR: Invalid stock passed to placeOrder() function"),!1;if("number"!=typeof n||"number"!=typeof r)return o?o.log("placeOrder",`Invalid arguments: shares='${n}' price='${r}'`):v.dialogBoxCreate("ERROR: Invalid numeric value provided for either 'shares' or 'price' argument"),!1;const u=new s.Order(e.symbol,n,r,a,i);if(null==t.StockMarket.Orders){const e={};for(const n in t.StockMarket){const r=t.StockMarket[n];r instanceof c.Stock&&(e[r.symbol]=[])}t.StockMarket.Orders=e}t.StockMarket.Orders[e.symbol].push(u);const m={rerenderFn:D,stockMarket:t.StockMarket,symbolToStockMap:t.SymbolToStockMap};return l.processOrders(e,u.type,u.pos,m),D(),!0}function O(e,n=null){if(null==t.StockMarket.Orders)return!1;if(e.order&&e.order instanceof s.Order){const n=e.order,r=t.StockMarket.Orders[n.stockSymbol];for(let e=0;e=n.cap&&(i=.1,n.b=!1),isNaN(i)&&(i=.5);const o=Math.random(),s={rerenderFn:D,stockMarket:t.StockMarket,symbolToStockMap:t.SymbolToStockMap};o1?1:i<0?0:i},t.calculateHackingExpGain=function(e,t){null==e.baseDifficulty&&(e.baseDifficulty=e.hackDifficulty);let n=3;return(n+=e.baseDifficulty*t.hacking_exp_mult*.3)*r.BitNodeMultipliers.HackExpGain},t.calculatePercentMoneyHacked=function(e,t){const n=(100-e.hackDifficulty)/100*((t.hacking_skill-(e.requiredHackingSkill-1))/t.hacking_skill)*t.hacking_money_mult/240;return n<0?0:n>1?1:n*r.BitNodeMultipliers.ScriptHackMoney},t.calculateHackingTime=i,t.calculateGrowTime=function(e,t){return 3.2*i(e,t)},t.calculateWeakenTime=function(e,t){return 4*i(e,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompanyPositions=void 0;const r=n(1163),a=n(286);t.CompanyPositions={},r.companyPositionMetadata.forEach(e=>{!function(e){null!=t.CompanyPositions[e.name]&&console.warn(`Duplicate Company Position being defined: ${e.name}`),t.CompanyPositions[e.name]=new a.CompanyPosition(e)}(e)})},,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isString=void 0,t.isString=function(e){return"string"==typeof e||e instanceof String}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exceptionAlert=void 0;const r=n(12);t.exceptionAlert=function(e){console.error(e),r.dialogBoxCreate("Caught an exception: "+e+"
Filename: "+(e.fileName||"UNKNOWN FILE NAME")+"
Line Number: "+(e.lineNumber||"UNKNOWN LINE NUMBER")+"
This is a bug, please report to game developer with this message as well as details about how to reproduce the bug.
If you want to be safe, I suggest refreshing the game WITHOUT saving so that your safe doesn't get corrupted",!1)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OwnedAugmentationsOrderSetting=t.PurchaseAugmentationsOrderSetting=t.EditorSetting=t.CodeMirrorThemeSetting=t.CodeMirrorKeybindingSetting=t.AceKeybindingSetting=void 0,function(e){e.Ace="ace",e.Emacs="emacs",e.Vim="vim"}(t.AceKeybindingSetting||(t.AceKeybindingSetting={})),function(e){e.Default="default",e.Emacs="emacs",e.Sublime="sublime",e.Vim="vim"}(t.CodeMirrorKeybindingSetting||(t.CodeMirrorKeybindingSetting={})),function(e){e.Monokai="monokai",e.Day_3024="3024-day",e.Night_3024="3024-night",e.abcdef="abcdef",e.Ambiance_mobile="ambiance-mobile",e.Ambiance="ambiance",e.Base16_dark="base16-dark",e.Base16_light="base16-light",e.Bespin="bespin",e.Blackboard="blackboard",e.Cobalt="cobalt",e.Colorforth="colorforth",e.Darcula="darcula",e.Dracula="dracula",e.Duotone_dark="duotone-dark",e.Duotone_light="duotone-light",e.Eclipse="eclipse",e.Elegant="elegant",e.Erlang_dark="erlang-dark",e.Gruvbox_dark="gruvbox-dark",e.Hopscotch="hopscotch",e.Icecoder="icecoder",e.Idea="idea",e.Isotope="isotope",e.Lesser_dark="lesser-dark",e.Liquibyte="liquibyte",e.Lucario="lucario",e.Material="material",e.Mbo="mbo",e.Mdn_like="mdn-like",e.Midnight="midnight",e.Neat="neat",e.Neo="neo",e.Night="night",e.Oceanic_next="oceanic-next",e.Panda_syntax="panda-syntax",e.Paraiso_dark="paraiso-dark",e.Paraiso_light="paraiso-light",e.Pastel_on_dark="pastel-on-dark",e.Railscasts="railscasts",e.Rubyblue="rubyblue",e.Seti="seti",e.Shadowfox="shadowfox",e.Solarized="solarized",e.SolarizedDark="solarized dark",e.ssms="ssms",e.The_matrix="the-matrix",e.Tomorrow_night_bright="tomorrow-night-bright",e.Tomorrow_night_eighties="tomorrow-night-eighties",e.Ttcn="ttcn",e.Twilight="twilight",e.Vibrant_ink="vibrant-ink",e.xq_dark="xq-dark",e.xq_light="xq-light",e.Yeti="yeti",e.Zenburn="zenburn"}(t.CodeMirrorThemeSetting||(t.CodeMirrorThemeSetting={})),function(e){e.Ace="Ace",e.CodeMirror="CodeMirror"}(t.EditorSetting||(t.EditorSetting={})),function(e){e[e.Cost=0]="Cost",e[e.Default=1]="Default",e[e.Reputation=2]="Reputation"}(t.PurchaseAugmentationsOrderSetting||(t.PurchaseAugmentationsOrderSetting={})),function(e){e[e.Alphabetically=0]="Alphabetically",e[e.AcquirementTime=1]="AcquirementTime"}(t.OwnedAugmentationsOrderSetting||(t.OwnedAugmentationsOrderSetting={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PartTimeCompanyPositions=t.BusinessConsultantCompanyPositions=t.SoftwareConsultantCompanyPositions=t.MiscCompanyPositions=t.AgentCompanyPositions=t.SecurityCompanyPositions=t.BusinessCompanyPositions=t.NetworkEngineerCompanyPositions=t.SecurityEngineerCompanyPositions=t.ITCompanyPositions=t.SoftwareCompanyPositions=void 0,t.SoftwareCompanyPositions=["Software Engineering Intern","Junior Software Engineer","Senior Software Engineer","Lead Software Developer","Head of Software","Head of Engineering","Vice President of Technology","Chief Technology Officer"],t.ITCompanyPositions=["IT Intern","IT Analyst","IT Manager","Systems Administrator"],t.SecurityEngineerCompanyPositions=["Security Engineer"],t.NetworkEngineerCompanyPositions=["Network Engineer","Network Administrator"],t.BusinessCompanyPositions=["Business Intern","Business Analyst","Business Manager","Operations Manager","Chief Financial Officer","Chief Executive Officer"],t.SecurityCompanyPositions=["Police Officer","Police Chief","Security Guard","Security Officer","Security Supervisor","Head of Security"],t.AgentCompanyPositions=["Field Agent","Secret Agent","Special Operative"],t.MiscCompanyPositions=["Waiter","Employee"],t.SoftwareConsultantCompanyPositions=["Software Consultant","Senior Software Consultant"],t.BusinessConsultantCompanyPositions=["Business Consultant","Senior Business Consultant"],t.PartTimeCompanyPositions=["Part-time Waiter","Part-time Employee"]},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return a(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Reputation=void 0;const o=i(n(0)),s=n(2);t.Reputation=function(e){return o.createElement("span",{className:"reputation samefont"},"number"==typeof e?s.numeralWrapper.formatReputation(e):e)}},function(e,t,n){"use strict";n.r(t),n.d(t,"inviteToFaction",function(){return O}),n.d(t,"joinFaction",function(){return T}),n.d(t,"startHackingMission",function(){return M}),n.d(t,"displayFactionContent",function(){return x}),n.d(t,"purchaseAugmentationBoxCreate",function(){return w}),n.d(t,"hasAugmentationPrereqs",function(){return A}),n.d(t,"purchaseAugmentation",function(){return R}),n.d(t,"getNextNeurofluxLevel",function(){return N}),n.d(t,"processPassiveFactionRepGain",function(){return D});var r=n(0),a=n.n(r),i=n(26),o=n.n(i),s=n(762),l=n(15),c=n(99),u=n(198),m=n(4),p=n(23),h=n(10),d=n(17),_=n(114),g=n(19),y=n(93),f=n(1),b=n(18),E=n(120),v=n(16),k=n(12),C=n(761),P=n(31),S=n(58);function O(e){b.Settings.SuppressFactionInvites?(e.alreadyInvited=!0,f.Player.factionInvitations.push(e.name),v.routing.isOn(v.Page.Factions)&&d.Engine.loadFactionsContent()):Object(C.a)(e)}function T(e){e.isMember=!0,f.Player.factions.push(e.name);const t=e.getInfo();for(const e in t.enemies){const n=t.enemies[e];g.Factions[n]instanceof _.Faction&&(g.Factions[n].isBanned=!0)}for(var n=0;n0)for(let n=0;n{if(e instanceof Element)a.removeElement(e);else try{const t=document.getElementById(e);t instanceof Element&&a.removeElement(t)}catch(e){console.error(`createPopupCloseButton() threw: ${e}`)}return document.removeEventListener("keydown",i),!1}),document.addEventListener("keydown",i),n}},,function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return a(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.StdButton=void 0;const o=i(n(0));t.StdButton=function(e){const t=null!=e.tooltip&&""!==e.tooltip;let n,r=e.disabled?"std-button-disabled":"std-button";if(t&&(r+=" tooltip"),"string"==typeof e.addClasses&&(r+=` ${e.addClasses}`),t)if("string"==typeof e.tooltip){const t={__html:e.tooltip};n=o.createElement("span",{className:"tooltiptext",dangerouslySetInnerHTML:t})}else n=o.createElement("span",{className:"tooltiptext"},e.tooltip);return o.createElement("button",{className:r,id:e.id,onClick:e.onClick,style:e.style},e.text,t&&n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isScriptFilename=void 0,t.isScriptFilename=function(e){return e.endsWith(".js")||e.endsWith(".script")||e.endsWith(".ns")}},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n(0);const a=n.n(r).a.Component;class i extends a{corp(){return this.props.corp}eventHandler(){return this.props.eventHandler}routing(){return this.props.routing}}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createOptionElement=void 0;const r=n(5);t.createOptionElement=function(e,t=""){let n=t;return""===n&&(n=e),r.createElement("option",{text:e,value:n})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.substituteAliases=t.removeAlias=t.parseAliasDeclaration=t.printAliases=t.loadGlobalAliases=t.loadAliases=t.GlobalAliases=t.Aliases=void 0;const r=n(8);function a(e){return t.Aliases.hasOwnProperty(e)?t.Aliases[e]:null}function i(e){return t.GlobalAliases.hasOwnProperty(e)?t.GlobalAliases[e]:null}t.Aliases={},t.GlobalAliases={},t.loadAliases=function(e){t.Aliases=""===e?{}:JSON.parse(e)},t.loadGlobalAliases=function(e){t.GlobalAliases=""===e?{}:JSON.parse(e)},t.printAliases=function(){for(const e in t.Aliases)t.Aliases.hasOwnProperty(e)&&r.post("alias "+e+"="+t.Aliases[e]);for(const e in t.GlobalAliases)t.GlobalAliases.hasOwnProperty(e)&&r.post("global alias "+e+"="+t.GlobalAliases[e])},t.parseAliasDeclaration=function(e,n=!1){const r=e.match(/^([_|\w|!|%|,|@]+)="(.+)"$/);return null!=r&&3==r.length&&(n?function(e,n){e in t.Aliases&&delete t.Aliases[e],t.GlobalAliases[e]=n.trim()}(r[1],r[2]):function(e,n){e in t.GlobalAliases&&delete t.GlobalAliases[e],t.Aliases[e]=n.trim()}(r[1],r[2]),!0)},t.removeAlias=function(e){return t.Aliases.hasOwnProperty(e)?(delete t.Aliases[e],!0):!!t.GlobalAliases.hasOwnProperty(e)&&(delete t.GlobalAliases[e],!0)},t.substituteAliases=function(e){var t,n;const r=e.split(" ");if(r.length>0){if("unalias"===r[0]||"alias"===r[0])return r.join(" ");let e=!0,o=0;for(;e&&o<10;){o++,e=!1;const s=null===(t=a(r[0]))||void 0===t?void 0:t.split(" ");null!=s&&(e=!0,r.splice(0,1,...s));for(let t=0;t{t.delay=null,n()},e),t.delayResolve=n})}function s(e,t,n=null){var r="";null!=n&&(r=" (Line "+function(e,t){var n=t.scriptRef.codeCode();try{return((n=n.substring(0,e.start)).match(/\n/g)||[]).length+1}catch(e){return-1}}(n,e)+")");const a=i.AllServers[e.serverIp];if(null==a)throw new Error(`WorkerScript constructed with invalid server ip: ${this.serverIp}`);return"|"+a.hostname+"|"+e.name+"|"+t+r}function l(e,t,n){const r=e.scriptRef.threads;if(!n)return isNaN(r)||r<1?1:r;const a=0|n;if(isNaN(n)||a<1)throw s(e,`Invalid thread count passed to ${t}: ${n}. Threads must be a positive number.`);if(n>r)throw s(e,`Too many threads requested by ${t}. Requested: ${n}. Has: ${r}.`);return a}function c(e){if(!Object(a.isString)(e))return!1;return 4==e.split("|").length}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setTimeoutRef=void 0,t.setTimeoutRef=window.setTimeout.bind(window)},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.killWorkerScript=void 0;const r=n(250),a=n(125),i=n(157),o=n(199),s=n(27),l=n(410),c=n(293);function u(e,t=!0){const n=a.workerScripts.get(e);return n instanceof r.WorkerScript&&(m(n,t),!0)}function m(e,t=!0){e.env.stopFlag=!0,function(e){e instanceof r.WorkerScript&&e.delay&&(clearTimeout(e.delay),e.delayResolve&&e.delayResolve())}(e),function(e,t=!0){if(!(e instanceof r.WorkerScript))return console.error("Invalid argument passed into removeWorkerScript():"),void console.error(e);{const n=e.serverIp,r=e.name,o=s.AllServers[n];if(null==o)return void console.error(`Could not find server on which this script is running: ${n}`);o.ramUsed=c.roundToTwo(o.ramUsed-e.ramUsage),o.ramUsed<0&&(console.warn(`Server (${o.hostname}) RAM usage went negative (if it's due to floating pt imprecision, it's okay): ${o.ramUsed}`),o.ramUsed=0);for(let t=0;t{let e=x();return null!=e&&e.beautifyScript(),!1}});T=Object(S.createElement)("p",{display:"inline-block",margin:"10px",id:"script-editor-status-text"});const n=Object(S.createElement)("label",{for:"script-editor-ram-check",margin:"4px",marginTop:"8px",innerText:"Dynamic RAM Usage Checker",color:"white",tooltip:"Enable/Disable the dynamic RAM Usage display. You may want to disable it for very long scripts because there may be performance issues"});(O=Object(S.createElement)("input",{type:"checkbox",name:"script-editor-ram-check",id:"script-editor-ram-check",margin:"4px",marginTop:"8px"})).checked=!0;const r=Object(S.createElement)("a",{class:"std-button",display:"inline-block",href:"https://bitburner.readthedocs.io/en/latest/index.html",innerText:"Netscript Documentation",target:"_blank"}),a=Object(S.createElement)("button",{class:"std-button",display:"inline-block",innerText:"Save & Close (Ctrl/Cmd + b)",clickListener:()=>(A(),!1)});e.appendChild(t),e.appendChild(a),e.appendChild(T),e.appendChild(O),e.appendChild(n),e.appendChild(r);const i={saveAndCloseFn:A,quitFn:l.Engine.loadTerminalContent};p.a.init(i),h.a.init(i);const o=document.getElementById("script-editor-option-editor");if(null==o)return console.error("Could not find DOM Element for editor selector (id=script-editor-option-editor)"),!1;for(let e=0;e{const e=o.value;switch(e){case f.EditorSetting.Ace:{const e=h.a.getCode(),t=h.a.getFilename();p.a.create(),h.a.setInvisible(),p.a.openScript(t,e);break}case f.EditorSetting.CodeMirror:{const e=p.a.getCode(),t=p.a.getFilename();h.a.create(),p.a.setInvisible(),h.a.openScript(t,e);break}default:return void console.error(`Unrecognized Editor Setting: ${e}`)}y.Settings.Editor=e}),o.onchange()}function x(){switch(y.Settings.Editor){case f.EditorSetting.Ace:return p.a;case f.EditorSetting.CodeMirror:return h.a;default:throw new Error(`Invalid Editor Setting: ${y.Settings.Editor}`)}}async function w(){var e=document.getElementById("script-editor-filename").value;if(null==O||!O.checked||!Object(o.isScriptFilename)(e))return void(T.innerText="N/A");let t;try{t=x().getCode()}catch(e){return void(T.innerText="RAM: ERROR")}var n=t.repeat(1),r=await Object(i.calculateRamUsage)(n,m.Player.getCurrentServer().scripts);if(r>0)T.innerText="RAM: "+k.numeralWrapper.formatRAM(r);else switch(r){case a.RamCalculationErrorCode.ImportError:T.innerText="RAM: Import Error";break;case a.RamCalculationErrorCode.URLImportError:T.innerText="RAM: HTTP Import Error";break;case a.RamCalculationErrorCode.SyntaxError:default:T.innerText="RAM: Syntax Error"}}function A(){var e=document.getElementById("script-editor-filename").value;let t,n;try{t=x().getCode(),n=x().getCursor(),d.CursorPositions.saveCursor(e,n)}catch(e){return void Object(C.dialogBoxCreate)("Something went wrong when trying to save (getCurrentEditor().getCode() or getCurrentEditor().getCursor()). Please report to game developer with details")}if(u.a.isRunning&&u.a.currStep===u.d.TerminalTypeScript){if("foodnstuff.script"!==e)return void Object(C.dialogBoxCreate)("Leave the script name as 'foodnstuff'!");if(-1==(t=t.replace(/\s/g,"")).indexOf("while(true){hack('foodnstuff');}"))return void Object(C.dialogBoxCreate)("Please copy and paste the code from the tutorial!");let n=m.Player.getCurrentServer();for(var a=0;a=1&&(n=1);for(const n in e.dataMap)if(e.dataMap.hasOwnProperty(n)){if(0==e.dataMap[n][2]||null==e.dataMap[n][2])continue;const r=_.AllServers[n];if(null==r)continue;const a=Math.round(.5*e.dataMap[n][2]/e.onlineRunningTime*t);e.log(`Called on ${r.hostname} ${a} times while offline`);const i=Object(g.processSingleServerGrowth)(r,a,m.Player);e.log(`'${r.hostname}' grown by ${k.numeralWrapper.format(100*i-100,"0.000000%")} while offline`)}const r=n*(e.onlineExpGained/e.onlineRunningTime)*t;m.Player.gainHackingExp(r),e.offlineRunningTime+=t,e.offlineExpGained+=r;for(const n in e.dataMap)if(e.dataMap.hasOwnProperty(n)){if(0==e.dataMap[n][3]||null==e.dataMap[n][3])continue;const r=_.AllServers[n];if(null==r)continue;const a=Math.round(.5*e.dataMap[n][3]/e.onlineRunningTime*t);e.log(`Called weaken() on ${r.hostname} ${a} times while offline`),r.weaken(s.CONSTANTS.ServerWeakenAmount*a)}}function N(e,t,n){for(var r=0;rt&&(n=1),this.wanted=n,this.wanted<1&&(this.wanted=1)}else console.warn("ERROR: wantedLevelGains is NaN");"number"==typeof n?(t.gainMoney(n*e),t.recordMoneySource(n*e,"gang")):console.warn("ERROR: respectGains is NaN")},B.prototype.processTerritoryAndPowerGains=function(e=1){if(this.storedTerritoryAndPowerCycles+=e,this.storedTerritoryAndPowerCycles<100)return;this.storedTerritoryAndPowerCycles-=100;const t=this.facName;for(const e in N)if(N.hasOwnProperty(e))if(e==t)N[e].power+=this.calculatePower();else{const t=Math.random();if(t<.5){const t=.005*N[e].power;N[e].power+=Math.min(.85,t)}else{const n=.75*t*N[e].territory;N[e].power+=n}}this.territoryWarfareEngaged?this.territoryClashChance=1:this.territoryClashChance>0&&(this.territoryClashChance=Math.max(0,this.territoryClashChance-.01));for(let e=0;et!==R[e]),r=Object(_.getRandomInt)(0,n.length-1),a=R[e],i=n[r];if(!(a!==t&&i!==t||Math.random()=30)&&this.respect>=this.getRespectNeededToRecruitMember()},B.prototype.getRespectNeededToRecruitMember=function(){if(this.members.length<3)return 0;const e=this.members.length-2;return Math.round(.9*Math.pow(e,3)+Math.pow(e,2))},B.prototype.recruitMember=function(e){if(""===(e=String(e))||!this.canRecruitMember())return!1;if(this.members.filter(t=>t.name===e).length>=1)return!1;let t=new j(e);return this.members.push(t),c.routing.isOn(c.Page.Gang)&&(this.createGangMemberDisplayElement(t),this.updateGangContent()),!0},B.prototype.getWantedPenalty=function(){return this.respect/(this.respect+this.wanted)},B.prototype.processExperienceGains=function(e=1){for(var t=0;t=0;--e){const n=this.members[e];if("Territory Warfare"!==n.task)continue;const r=t/Math.pow(n.def,.6);Math.random()")):t.log(`Ascended Gang member ${e.name}`),c.routing.isOn(c.Page.Gang)&&this.displayGangMemberList(),n}catch(e){if(null!=t)throw e;Object(d.exceptionAlert)(e)}},B.prototype.getDiscount=function(){const e=this.getPower(),t=this.respect,n=Math.pow(t,.01)+t/5e6+Math.pow(e,.01)+e/1e6-1;return Math.max(1,n)},B.prototype.getAllTaskNames=function(){let e=[];const t=Object.keys(F);return e=this.isHackingGang?t.filter(e=>{let t=F[e];return null!=t&&("Unassigned"!==e&&t.isHacking)}):t.filter(e=>{let t=F[e];return null!=t&&("Unassigned"!==e&&t.isCombat)})},B.prototype.getAllUpgradeNames=function(){return Object.keys(H)},B.prototype.getUpgradeCost=function(e){return null==H[e]?1/0:H[e].getCost(this)},B.prototype.getUpgradeType=function(e){const t=H[e];if(null==t)return"";switch(t.type){case"w":return"Weapon";case"a":return"Armor";case"v":return"Vehicle";case"r":return"Rootkit";case"g":return"Augmentation";default:return""}},B.prototype.toJSON=function(){return Object(p.Generic_toJSON)("Gang",this)},B.fromJSON=function(e){return Object(p.Generic_fromJSON)(B,e.data)},p.Reviver.constructors.Gang=B,j.prototype.calculateSkill=function(e,t=1){return Math.max(Math.floor(t*(32*Math.log(e+534.5)-200)),1)},j.prototype.updateSkillLevels=function(){this.hack=this.calculateSkill(this.hack_exp,this.hack_mult*this.hack_asc_mult),this.str=this.calculateSkill(this.str_exp,this.str_mult*this.str_asc_mult),this.def=this.calculateSkill(this.def_exp,this.def_mult*this.def_asc_mult),this.dex=this.calculateSkill(this.dex_exp,this.dex_mult*this.dex_asc_mult),this.agi=this.calculateSkill(this.agi_exp,this.agi_mult*this.agi_asc_mult),this.cha=this.calculateSkill(this.cha_exp,this.cha_mult*this.cha_asc_mult)},j.prototype.calculatePower=function(){return(this.hack+this.str+this.def+this.dex+this.agi+this.cha)/95},j.prototype.assignToTask=function(e){return F.hasOwnProperty(e)?(this.task=e,!0):(this.task="Unassigned",!1)},j.prototype.unassignFromTask=function(){this.task="Unassigned"},j.prototype.getTask=function(){return this.task instanceof W&&(this.task=this.task.name),F.hasOwnProperty(this.task)?F[this.task]:F.Unassigned},j.prototype.calculateRespectGain=function(e){const t=this.getTask();if(null==t||!(t instanceof W)||0===t.baseRespect)return 0;var n=t.hackWeight/100*this.hack+t.strWeight/100*this.str+t.defWeight/100*this.def+t.dexWeight/100*this.dex+t.agiWeight/100*this.agi+t.chaWeight/100*this.cha;if((n-=4*t.difficulty)<=0)return 0;const r=Math.pow(100*N[e.facName].territory,t.territory.respect)/100;if(isNaN(r)||r<=0)return 0;var a=e.getWantedPenalty();return 11*t.baseRespect*n*r*a},j.prototype.calculateWantedLevelGain=function(e){const t=this.getTask();if(null==t||!(t instanceof W)||0===t.baseWanted)return 0;let n=t.hackWeight/100*this.hack+t.strWeight/100*this.str+t.defWeight/100*this.def+t.dexWeight/100*this.dex+t.agiWeight/100*this.agi+t.chaWeight/100*this.cha;if((n-=3.5*t.difficulty)<=0)return 0;const r=Math.pow(100*N[e.facName].territory,t.territory.wanted)/100;if(isNaN(r)||r<=0)return 0;if(t.baseWanted<0)return.4*t.baseWanted*n*r;{const e=7*t.baseWanted/Math.pow(3*n*r,.8);return Math.min(100,e)}},j.prototype.calculateMoneyGain=function(e){const t=this.getTask();if(null==t||!(t instanceof W)||0===t.baseMoney)return 0;var n=t.hackWeight/100*this.hack+t.strWeight/100*this.str+t.defWeight/100*this.def+t.dexWeight/100*this.dex+t.agiWeight/100*this.agi+t.chaWeight/100*this.cha;if((n-=3.2*t.difficulty)<=0)return 0;const r=Math.pow(100*N[e.facName].territory,t.territory.money)/100;if(isNaN(r)||r<=0)return 0;var a=e.getWantedPenalty();return 5*t.baseMoney*n*r*a},j.prototype.gainExperience=function(e=1){const t=this.getTask();if(null==t||!(t instanceof W)||t===F.Unassigned)return;const n=Math.pow(t.difficulty,.9)*e;this.hack_exp+=t.hackWeight/1500*n,this.str_exp+=t.strWeight/1500*n,this.def_exp+=t.defWeight/1500*n,this.dex_exp+=t.dexWeight/1500*n,this.agi_exp+=t.agiWeight/1500*n,this.cha_exp+=t.chaWeight/1500*n},j.prototype.recordEarnedRespect=function(e=1,t){this.earnedRespect+=this.calculateRespectGain(t)*e},j.prototype.ascend=function(){const e=this.getAscensionResults(),t=e.hack,n=e.str,r=e.def,a=e.dex,i=e.agi,o=e.cha;this.hack_asc_mult+=t,this.str_asc_mult+=n,this.def_asc_mult+=r,this.dex_asc_mult+=a,this.agi_asc_mult+=i,this.cha_asc_mult+=o,this.upgrades.length=0,this.hack_mult=1,this.str_mult=1,this.def_mult=1,this.dex_mult=1,this.agi_mult=1,this.cha_mult=1;for(let e=0;e{!function(e,t,n,r,a){F[e]=new W(e,t,n,r,a)}(e.name,e.desc,e.isHacking,e.isCombat,e.params)}),U.prototype.getCost=function(e){const t=e.getDiscount();return this.cost/t},U.prototype.createDescription=function(){const e=["Increases:"];null!=this.mults.str&&e.push(`* Strength by ${Math.round(100*(this.mults.str-1))}%`),null!=this.mults.def&&e.push(`* Defense by ${Math.round(100*(this.mults.def-1))}%`),null!=this.mults.dex&&e.push(`* Dexterity by ${Math.round(100*(this.mults.dex-1))}%`),null!=this.mults.agi&&e.push(`* Agility by ${Math.round(100*(this.mults.agi-1))}%`),null!=this.mults.cha&&e.push(`* Charisma by ${Math.round(100*(this.mults.cha-1))}%`),null!=this.mults.hack&&e.push(`* Hacking by ${Math.round(100*(this.mults.hack-1))}%`),this.desc=e.join(" ")},U.prototype.apply=function(e){null!=this.mults.str&&(e.str_mult*=this.mults.str),null!=this.mults.def&&(e.def_mult*=this.mults.def),null!=this.mults.dex&&(e.dex_mult*=this.mults.dex),null!=this.mults.agi&&(e.agi_mult*=this.mults.agi),null!=this.mults.cha&&(e.cha_mult*=this.mults.cha),null!=this.mults.hack&&(e.hack_mult*=this.mults.hack)},U.prototype.toJSON=function(){return Object(p.Generic_toJSON)("GangMemberUpgrade",this)},U.fromJSON=function(e){return Object(p.Generic_fromJSON)(U,e.data)},p.Reviver.constructors.GangMemberUpgrade=U;const H={};a.gangMemberUpgradesMetadata.forEach(e=>{!function(e,t,n,r){H[e]=new U(e,t,n,r)}(e.name,e.cost,e.upgType,e.mults)}),B.prototype.createGangMemberUpgradeBox=function(e,t=""){const n="gang-member-upgrade-popup-box";if(G.gangMemberUpgradeBoxOpened){if(null==G.gangMemberUpgradeBoxElements||null==G.gangMemberUpgradeBox||null==G.gangMemberUpgradeBoxContent)return void console.error("Refreshing Gang member upgrade box throws error because required elements are null");for(var r=2;r-1||this.members[r].task.indexOf(a)>-1){var i=this.members[r].createGangMemberUpgradePanel(this,e);G.gangMemberUpgradeBoxContent.appendChild(i),G.gangMemberUpgradeBoxElements.push(i)}}else{G.gangMemberUpgradeBoxFilter=Object(f.createElement)("input",{type:"text",placeholder:"Filter gang members",class:"text-input",value:t,onkeyup:()=>{var t=G.gangMemberUpgradeBoxFilter.value.toString();this.createGangMemberUpgradeBox(e,t)}}),G.gangMemberUpgradeBoxDiscount=Object(f.createElement)("p",{innerText:"Discount: -"+u.numeralWrapper.formatPercentage(1-1/this.getDiscount()),marginLeft:"6px",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."}),G.gangMemberUpgradeBoxElements=[G.gangMemberUpgradeBoxFilter,G.gangMemberUpgradeBoxDiscount];for(a=G.gangMemberUpgradeBoxFilter.value.toString(),r=0;r-1||this.members[r].task.indexOf(a)>-1)&&G.gangMemberUpgradeBoxElements.push(this.members[r].createGangMemberUpgradePanel(this,e));G.gangMemberUpgradeBox=Object(b.createPopup)(n,G.gangMemberUpgradeBoxElements),G.gangMemberUpgradeBoxContent=document.getElementById(n+"-content"),G.gangMemberUpgradeBoxOpened=!0}},j.prototype.createGangMemberUpgradePanel=function(e,t){var n=Object(f.createElement)("div",{border:"1px solid white"}),r=Object(f.createElement)("h1",{innerText:this.name+" ("+this.task+")"});n.appendChild(r);var a=Object(f.createElement)("pre",{fontSize:"14px",display:"inline-block",width:"20%",innerText:"Hack: "+this.hack+" (x"+Object(h.formatNumber)(this.hack_mult*this.hack_asc_mult,2)+")\nStr: "+this.str+" (x"+Object(h.formatNumber)(this.str_mult*this.str_asc_mult,2)+")\nDef: "+this.def+" (x"+Object(h.formatNumber)(this.def_mult*this.def_asc_mult,2)+")\nDex: "+this.dex+" (x"+Object(h.formatNumber)(this.dex_mult*this.dex_asc_mult,2)+")\nAgi: "+this.agi+" (x"+Object(h.formatNumber)(this.agi_mult*this.agi_asc_mult,2)+")\nCha: "+this.cha+" (x"+Object(h.formatNumber)(this.cha_mult*this.cha_asc_mult,2)+")\n"});const i=[];function o(e){const t=H[e];null!=t?i.push(Object(f.createElement)("div",{class:"gang-owned-upgrade",innerText:e,tooltip:t.desc})):console.error(`Could not find GangMemberUpgrade object for name ${e}`)}for(const e of this.upgrades)o(e);for(const e of this.augmentations)o(e);var s=Object(f.createElement)("div",{class:"gang-owned-upgrades-div",innerText:"Purchased Upgrades:"});for(const e of i)s.appendChild(e);n.appendChild(a),n.appendChild(s),n.appendChild(Object(f.createElement)("br",{}));const l=[],c=[],u=[],m=[],p=[];for(let n in H)if(H.hasOwnProperty(n)){let r=H[n];if(t.money.lt(r.getCost(e)))continue;if(this.upgrades.includes(n)||this.augmentations.includes(n))continue;switch(r.type){case"w":l.push(r);break;case"a":c.push(r);break;case"v":u.push(r);break;case"r":m.push(r);break;case"g":p.push(r);break;default:console.error(`ERROR: Invalid Gang Member Upgrade Type: ${r.type}`)}}const d=Object(f.createElement)("div",{width:"20%",display:"inline-block"}),_=Object(f.createElement)("div",{width:"20%",display:"inline-block"}),g=Object(f.createElement)("div",{width:"20%",display:"inline-block"}),y=Object(f.createElement)("div",{width:"20%",display:"inline-block"}),b=Object(f.createElement)("div",{width:"20%",display:"inline-block"});d.appendChild(Object(f.createElement)("h2",{innerText:"Weapons"})),_.appendChild(Object(f.createElement)("h2",{innerText:"Armor"})),g.appendChild(Object(f.createElement)("h2",{innerText:"Vehicles"})),y.appendChild(Object(f.createElement)("h2",{innerText:"Rootkits"})),b.appendChild(Object(f.createElement)("h2",{innerText:"Augmentations"}));const E=[l,c,u,m,p],v=[d,_,g,y,b];for(let n=0;n(a.buyUpgrade(n,t,e),!1)};i>=3?s.tooltipleft=n.desc:s.tooltip=n.desc,r.appendChild(Object(f.createElement)("a",s))}(r[i],a,this,n,e)}}return n.appendChild(d),n.appendChild(_),n.appendChild(g),n.appendChild(y),n.appendChild(b),n};const G={gangContentCreated:!1,gangContainer:null,managementButton:null,territoryButton:null,gangManagementSubpage:null,gangTerritorySubpage:null,gangDesc:null,gangInfo:null,gangRecruitMemberButton:null,gangRecruitRequirementText:null,gangExpandAllButton:null,gangCollapseAllButton:null,gangMemberFilter:null,gangManageEquipmentButton:null,gangMemberList:null,gangMemberPanels:{},gangMemberUpgradeBoxOpened:!1,gangMemberUpgradeBox:null,gangMemberUpgradeBoxContent:null,gangMemberUpgradeBoxFilter:null,gangMemberUpgradeBoxDiscount:null,gangMemberUpgradeBoxElements:null,gangTerritoryDescText:null,gangTerritoryWarfareCheckbox:null,gangTerritoryWarfareCheckboxLabel:null,gangTerritoryWarfareClashChance:null,gangTerritoryDeathNotifyCheckbox:null,gangTerritoryDeathNotifyCheckboxLabel:null,gangTerritoryInfoText:null};B.prototype.displayGangContent=function(e){if(!G.gangContentCreated||null==G.gangContainer){G.gangContentCreated=!0,G.gangContainer=Object(f.createElement)("div",{id:"gang-container",class:"generic-menupage-container"});var t=this.facName;G.gangContainer.appendChild(Object(f.createElement)("a",{class:"a-link-button",display:"inline-block",innerText:"Back",clickListener:()=>(i.Engine.loadFactionContent(),Object(l.displayFactionContent)(t),!1)})),G.managementButton=Object(f.createElement)("a",{id:"gang-management-subpage-button",class:"a-link-button-inactive",display:"inline-block",innerHTML:"Gang Management (Alt+1)",clickListener:()=>(G.gangManagementSubpage.style.display="block",G.gangTerritorySubpage.style.display="none",G.managementButton.classList.toggle("a-link-button-inactive"),G.managementButton.classList.toggle("a-link-button"),G.territoryButton.classList.toggle("a-link-button-inactive"),G.territoryButton.classList.toggle("a-link-button"),this.updateGangContent(),!1)}),G.territoryButton=Object(f.createElement)("a",{id:"gang-territory-subpage-button",class:"a-link-button",display:"inline-block",innerHTML:"Gang Territory (Alt+2)",clickListener:()=>(G.gangManagementSubpage.style.display="none",G.gangTerritorySubpage.style.display="block",G.managementButton.classList.toggle("a-link-button-inactive"),G.managementButton.classList.toggle("a-link-button"),G.territoryButton.classList.toggle("a-link-button-inactive"),G.territoryButton.classList.toggle("a-link-button"),this.updateGangContent(),!1)}),G.gangContainer.appendChild(G.managementButton),G.gangContainer.appendChild(G.territoryButton),G.gangManagementSubpage=Object(f.createElement)("div",{display:"block",id:"gang-management-subpage"});var n="";n=this.isHackingGang?"Ethical Hacking":"Vigilante Justice",G.gangDesc=Object(f.createElement)("p",{width:"70%",innerHTML:"This page is used to manage your gang members and get an overview of your gang's stats.
If a gang member is not earning much money or respect, the task that you have assigned to that member might be too difficult. Consider training that member's stats or choosing an easier task. The tasks closer to the top of the dropdown list are generally easier. Alternatively, the gang member's low production might be due to the fact that your wanted level is too high. Consider assigning a few members to the '"+n+"' task to lower your wanted level.
Installing Augmentations does NOT reset your progress with your Gang. Furthermore, after installing Augmentations, you will automatically be a member of whatever Faction you created your gang with.
You can also manage your gang programmatically through Netscript using the Gang API"}),G.gangManagementSubpage.appendChild(G.gangDesc),G.gangInfo=Object(f.createElement)("p",{id:"gang-info",width:"70%"}),G.gangManagementSubpage.appendChild(G.gangInfo),G.gangRecruitMemberButton=Object(f.createElement)("a",{id:"gang-management-recruit-member-btn",class:"a-link-button-inactive",innerHTML:"Recruit Gang Member",display:"inline-block",margin:"10px",clickListener:()=>{const e="recruit-gang-member-popup";let t;const n=Object(f.createElement)("p",{innerText:"Please enter a name for your new Gang member:"}),r=Object(f.createElement)("br"),a=Object(f.createElement)("input",{onkeyup:e=>{e.keyCode===g.KEY.ENTER&&t.click()},placeholder:"Name must be unique",type:"text",class:"text-input"});t=Object(f.createElement)("a",{class:"std-button",clickListener:()=>{let t=a.value;return""===t?(Object(m.dialogBoxCreate)("You must enter a name for your Gang member!"),!1):this.canRecruitMember()?this.recruitMember(t)?(Object(k.removeElementById)(e),!1):(Object(m.dialogBoxCreate)("You already have a gang member with this name!"),!1):(Object(m.dialogBoxCreate)("You cannot recruit another Gang member!"),!1)},innerText:"Recruit Gang Member"});const i=Object(f.createElement)("a",{class:"std-button",clickListener:()=>(Object(k.removeElementById)(e),!1),innerText:"Cancel"});Object(b.createPopup)(e,[n,r,a,t,i]),a.focus()}}),G.gangManagementSubpage.appendChild(G.gangRecruitMemberButton),G.gangRecruitRequirementText=Object(f.createElement)("p",{color:"red",id:"gang-recruit-requirement-text",margin:"10px"}),G.gangManagementSubpage.appendChild(G.gangRecruitRequirementText),G.gangManagementSubpage.appendChild(Object(f.createElement)("br",{})),G.gangExpandAllButton=Object(f.createElement)("a",{class:"a-link-button",display:"inline-block",innerHTML:"Expand All",clickListener:()=>{for(var e=G.gangManagementSubpage.getElementsByClassName("accordion-header"),t=0;t{for(var e=G.gangManagementSubpage.getElementsByClassName("accordion-header"),t=0;t{this.displayGangMemberList()}}),G.gangManageEquipmentButton=Object(f.createElement)("a",{class:"a-link-button",display:"inline-block",innerHTML:"Manage Equipment",clickListener:()=>{this.createGangMemberUpgradeBox(e)}}),G.gangManagementSubpage.appendChild(G.gangExpandAllButton),G.gangManagementSubpage.appendChild(G.gangCollapseAllButton),G.gangManagementSubpage.appendChild(G.gangMemberFilter),G.gangManagementSubpage.appendChild(G.gangManageEquipmentButton),G.gangMemberList=Object(f.createElement)("ul",{id:"gang-member-list"}),this.displayGangMemberList(),G.gangManagementSubpage.appendChild(G.gangMemberList),G.gangTerritorySubpage=Object(f.createElement)("div",{id:"gang-territory-subpage",display:"none"}),G.gangTerritoryDescText=Object(f.createElement)("p",{width:"70%",innerHTML:"This page shows how much territory your Gang controls. This statistic is listed as a percentage, which represents how much of the total territory you control.
Every ~20 seconds, your gang has a chance to 'clash' with other gangs. Your chance to win a clash depends on your gang's power, which is listed in the display below. Your gang's power slowly accumulates over time. The accumulation rate is determined by the stats of all Gang members you have assigned to the 'Territory Warfare' task. Gang members that are not assigned to this task do not contribute to your gang's power. Your gang also loses a small amount of power whenever you lose a clash
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.
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.
"}),G.gangTerritorySubpage.appendChild(G.gangTerritoryDescText),G.gangTerritoryWarfareCheckbox=Object(f.createElement)("input",{display:"inline-block",id:"gang-management-territory-warfare-checkbox",changeListener:()=>{this.territoryWarfareEngaged=G.gangTerritoryWarfareCheckbox.checked},margin:"2px",type:"checkbox"}),G.gangTerritoryWarfareCheckbox.checked=this.territoryWarfareEngaged,G.gangTerritoryWarfareCheckboxLabel=Object(f.createElement)("label",{color:"white",display:"inline-block",for:"gang-management-territory-warfare-checkbox",innerText:"Engage in Territory Warfare",tooltip:"Engaging in Territory Warfare sets your clash chance to 100%. Disengaging will cause your clash chance to gradually decrease until it reaches 0%"}),G.gangTerritorySubpage.appendChild(G.gangTerritoryWarfareCheckbox),G.gangTerritorySubpage.appendChild(G.gangTerritoryWarfareCheckboxLabel),G.gangTerritorySubpage.appendChild(Object(f.createElement)("br")),G.gangTerritoryWarfareClashChance=Object(f.createElement)("p",{display:"inline-block"}),G.gangTerritorySubpage.appendChild(G.gangTerritoryWarfareClashChance),G.gangTerritorySubpage.appendChild(Object(f.createElement)("div",{class:"help-tip",display:"inline-block",innerText:"?",clickListener:()=>{Object(m.dialogBoxCreate)("This percentage represents the chance you have of 'clashing' with with another gang. If you do not wish to gain/lose territory, then keep this percentage at 0% by not engaging in territory warfare.")}})),G.gangTerritoryDeathNotifyCheckbox=Object(f.createElement)("input",{display:"inline-block",id:"gang-management-notify-member-death-checkbox",changeListener:()=>{this.notifyMemberDeath=G.gangTerritoryDeathNotifyCheckbox.checked},margin:"2px",type:"checkbox"}),G.gangTerritoryDeathNotifyCheckbox.checked=this.notifyMemberDeath,G.gangTerritoryDeathNotifyCheckboxLabel=Object(f.createElement)("label",{color:"white",display:"inline-block",for:"gang-management-notify-member-death-checkbox",innerText:"Notify about Gang Member Deaths",tooltip:"If this is enabled, then you will receive a pop-up notifying you whenever one of your Gang Members dies in a territory clash."}),G.gangTerritorySubpage.appendChild(Object(f.createElement)("br")),G.gangTerritorySubpage.appendChild(G.gangTerritoryDeathNotifyCheckbox),G.gangTerritorySubpage.appendChild(G.gangTerritoryDeathNotifyCheckboxLabel),G.gangTerritorySubpage.appendChild(Object(f.createElement)("br"));var r=Object(f.createElement)("fieldset",{display:"block",margin:"6px",width:"50%"});G.gangTerritoryInfoText=Object(f.createElement)("p"),r.appendChild(G.gangTerritoryInfoText),G.gangTerritorySubpage.appendChild(r),G.gangContainer.appendChild(G.gangTerritorySubpage),G.gangContainer.appendChild(G.gangManagementSubpage),document.getElementById("entire-game-container").appendChild(G.gangContainer)}G.gangContainer.style.display="block",this.updateGangContent()},B.prototype.displayGangMemberList=function(){Object(E.removeChildrenFromElement)(G.gangMemberList),G.gangMemberPanels={};const e=this.members,t=G.gangMemberFilter.value.toString();for(var n=0;n-1||e[n].task.indexOf(t)>-1)&&this.createGangMemberDisplayElement(e[n])},B.prototype.updateGangContent=function(){if(G.gangContentCreated)if(G.gangMemberUpgradeBoxOpened&&(G.gangMemberUpgradeBoxDiscount.childNodes[0].nodeValue="Discount: -"+u.numeralWrapper.formatPercentage(1-1/this.getDiscount())),"block"===G.gangTerritorySubpage.style.display){G.gangTerritoryWarfareClashChance.innerText=`Territory Clash Chance: ${u.numeralWrapper.formatPercentage(this.territoryClashChance,3)}`,G.gangTerritoryWarfareCheckbox.checked=this.territoryWarfareEngaged,G.gangTerritoryInfoText.innerHTML="";const e=N[this.facName].power;let t=Object.keys(N).filter(e=>e!=this.facName);t.unshift(this.facName);for(const n of t)if(N.hasOwnProperty(n)){const t=N[n];let r,a=100*t.territory;if(r=a<=0?Object(h.formatNumber)(0,2):a>=100?Object(h.formatNumber)(100,2):Object(h.formatNumber)(a,2),n===this.facName){let e=`${n} Power: ${Object(h.formatNumber)(t.power,6)} `;e+=`Territory: ${r}%
`,G.gangTerritoryInfoText.innerHTML+=e}else{const a=e/(t.power+e);let i=`${n} Power: ${Object(h.formatNumber)(t.power,6)} `;i+=`Territory: ${r}% `,i+=`Chance to win clash with this gang: ${u.numeralWrapper.formatPercentage(a,3)}
`,G.gangTerritoryInfoText.innerHTML+=i}}}else{if(G.gangInfo instanceof Element){var e,t=s.Factions[this.facName];e=t instanceof o.Faction?t.playerReputation:"ERROR",Object(E.removeChildrenFromElement)(G.gangInfo),G.gangInfo.appendChild(Object(f.createElement)("p",{display:"inline-block",innerText:"Respect: "+u.numeralWrapper.formatRespect(this.respect)+" ("+u.numeralWrapper.formatRespect(5*this.respectGainRate)+" / sec)",tooltip:"Represents the amount of respect your gang has from other gangs and criminal organizations. Your respect affects the amount of money your gang members will earn, and also determines how much reputation you are earning with your gang's corresponding Faction."})),G.gangInfo.appendChild(Object(f.createElement)("br")),G.gangInfo.appendChild(Object(f.createElement)("p",{display:"inline-block",innerText:"Wanted Level: "+u.numeralWrapper.formatWanted(this.wanted)+" ("+u.numeralWrapper.formatWanted(5*this.wantedGainRate)+" / sec)",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 to make money and earn respect. Note that the minimum wanted level is 1."})),G.gangInfo.appendChild(Object(f.createElement)("br"));var n=this.getWantedPenalty();n=100*(1-n),G.gangInfo.appendChild(Object(f.createElement)("p",{display:"inline-block",innerText:`Wanted Level Penalty: -${Object(h.formatNumber)(n,2)}%`,tooltip:"Penalty for respect and money gain rates due to Wanted Level"})),G.gangInfo.appendChild(Object(f.createElement)("br"));const a=Object(f.createElement)("div");w.a.render(M.a.createElement("p",{style:{display:"inline-block"}},"Money gain rate: ",Object(S.MoneyRate)(5*this.moneyGainRate)),a),G.gangInfo.appendChild(a),G.gangInfo.appendChild(Object(f.createElement)("br"));var r=100*N[this.facName].territory;let l;l=r<=0?Object(h.formatNumber)(0,2):r>=100?Object(h.formatNumber)(100,2):Object(h.formatNumber)(r,2),G.gangInfo.appendChild(Object(f.createElement)("p",{display:"inline-block",innerText:`Territory: ${Object(h.formatNumber)(l,3)}%`,tooltip:"The percentage of total territory your Gang controls"})),G.gangInfo.appendChild(Object(f.createElement)("br"));const c=Object(f.createElement)("div");w.a.render(M.a.createElement("p",{style:{display:"inline-block"}},"Faction reputation: ",Object(O.Reputation)(e)),c),G.gangInfo.appendChild(c),G.gangInfo.appendChild(Object(f.createElement)("br"));const m=1e3/i.Engine._idleSpeed;this.storedCycles/m*1e3>5e3&&(G.gangInfo.appendChild(Object(f.createElement)("p",{innerText:`Bonus time: ${Object(h.convertTimeMsToTimeElapsedString)(this.storedCycles/m*1e3)}`,display:"inline-block",tooltip:"You gain bonus time while offline or when the game is inactive (e.g. when the tab is throttled by the browser). Bonus time makes the Gang mechanic progress faster, up to 5x the normal speed"})),G.gangInfo.appendChild(Object(f.createElement)("br")))}else console.error("gang-info DOM element DNE");const a=this.members.length,l=this.getRespectNeededToRecruitMember(),c=G.gangRecruitMemberButton;a>=30?(c.className="a-link-button-inactive",G.gangRecruitRequirementText.style.display="inline-block",G.gangRecruitRequirementText.innerHTML="You have reached the maximum amount of gang members"):this.canRecruitMember()?(c.className="a-link-button",G.gangRecruitRequirementText.style.display="none"):(c.className="a-link-button-inactive",G.gangRecruitRequirementText.style.display="inline-block",G.gangRecruitRequirementText.innerHTML=`${Object(h.formatNumber)(l,2)} respect needed to recruit next member`);for(let e=0;e")});G.gangMemberPanels[t].statsDiv=i;const o=Object(f.createElement)("pre",{display:"inline",id:t+"gang-member-stats-text"}),s=Object(f.createElement)("br"),l=Object(f.createElement)("button",{class:"accordion-button",innerText:"Ascend",clickListener:()=>{const t=`gang-management-ascend-member ${e.name}`,n=e.getAscensionResults(),r=Object(f.createElement)("pre",{innerText:["Are you sure you want to ascend this member? They will lose all of","their non-Augmentation upgrades and their stats will reset back to 1.","",`Furthermore, your gang will lose ${u.numeralWrapper.formatRespect(e.earnedRespect)} respect`,"","In return, they will gain the following permanent boost to stat multipliers:\n",`Hacking: +${u.numeralWrapper.formatPercentage(n.hack)}`,`Strength: +${u.numeralWrapper.formatPercentage(n.str)}`,`Defense: +${u.numeralWrapper.formatPercentage(n.def)}`,`Dexterity: +${u.numeralWrapper.formatPercentage(n.dex)}`,`Agility: +${u.numeralWrapper.formatPercentage(n.agi)}`,`Charisma: +${u.numeralWrapper.formatPercentage(n.cha)}`].join("\n")}),a=Object(f.createElement)("button",{class:"std-button",clickListener:()=>(this.ascendMember(e),this.updateGangMemberDisplayElement(e),Object(k.removeElementById)(t),!1),innerText:"Ascend"}),i=Object(f.createElement)("button",{class:"std-button",clickListener:()=>(Object(k.removeElementById)(t),!1),innerText:"Cancel"});Object(b.createPopup)(t,[r,a,i])}}),c=Object(f.createElement)("div",{class:"help-tip",clickListener:()=>{Object(m.dialogBoxCreate)(["Ascending a Gang Member resets the member's progress and stats in exchange","for a permanent boost to their stat multipliers.","
The additional stat multiplier that the Gang Member gains upon ascension","is based on the amount of multipliers the member has from non-Augmentation Equipment.","
Upon ascension, the member will lose all of its non-Augmentation Equipment and your","gang will lose respect equal to the total respect earned by the member."].join(" "))},innerText:"?",marginTop:"5px"});i.appendChild(o),i.appendChild(s),i.appendChild(l),i.appendChild(c);const p=Object(f.createElement)("div",{class:"gang-member-info-div",id:t+"gang-member-task"}),h=Object(f.createElement)("select",{class:"dropdown",id:t+"gang-member-task-selector"});let d=this.getAllTaskNames();d.unshift("---");for(var _=0;_{var t=h.options[h.selectedIndex].text;e.assignToTask(t),this.setGangMemberTaskDescription(e,t),this.updateGangContent()}),F.hasOwnProperty(e.task)){var E=e.task,v=0;for(let e=0;e"))}var a=document.getElementById(t+"gang-member-gain-info");if(a){const t=[["Money:",Object(S.MoneyRate)(5*e.calculateMoneyGain(this))],["Respect:",`${u.numeralWrapper.formatRespect(5*e.calculateRespectGain(this))} / sec`],["Wanted Level:",`${u.numeralWrapper.formatWanted(5*e.calculateWantedLevelGain(this))} / sec`],["Total Respect:",`${u.numeralWrapper.formatRespect(e.earnedRespect)}`]];w.a.render(Object(C.StatsTable)(t),a)}const i=document.getElementById(t+"gang-member-task-selector");if(i){let t=this.getAllTaskNames();if(t.unshift("---"),F.hasOwnProperty(e.task)){const n=e.task;let r=0;for(let e=0;e["+(_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_TIMESTAMPS?Object(_utils_helpers_getTimestamp__WEBPACK_IMPORTED_MODULE_36__.getTimestamp)()+" ":"")+_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().hostname+` ~${n}]> ${t}`),t.length>0&&(Terminal.resetTerminalInput(),Terminal.executeCommands(t))}if(e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.C&&e.ctrlKey&&(_engine__WEBPACK_IMPORTED_MODULE_11__.Engine._actionInProgress?(Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Cancelling..."),_engine__WEBPACK_IMPORTED_MODULE_11__.Engine._actionInProgress=!1,Terminal.finishAction(!0)):_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&Terminal.resetTerminalInput()),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.L&&e.ctrlKey&&(e.preventDefault(),Terminal.executeCommand("clear")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.UPARROW||_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.P&&e.ctrlKey){if(_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&e.preventDefault(),null==t)return;var n=Terminal.commandHistoryIndex;if(0==(a=Terminal.commandHistory.length))return;(n<0||n>a)&&(Terminal.commandHistoryIndex=a),0!=n&&--Terminal.commandHistoryIndex;var r=Terminal.commandHistory[Terminal.commandHistoryIndex];t.value=r,Object(_utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_31__.setTimeoutRef)(function(){t.selectionStart=t.selectionEnd=1e4},10)}if(e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.DOWNARROW||_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.M&&e.ctrlKey){if(_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&e.preventDefault(),null==t)return;var a;n=Terminal.commandHistoryIndex;if(0==(a=Terminal.commandHistory.length))return;if((n<0||n>a)&&(Terminal.commandHistoryIndex=a),n==a||n==a-1)Terminal.commandHistoryIndex=a,t.value="";else{++Terminal.commandHistoryIndex;r=Terminal.commandHistory[Terminal.commandHistoryIndex];t.value=r}}if(e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.TAB){if(e.preventDefault(),null==t)return;let n=t.value;if(""==n)return;const r=n.lastIndexOf(";");-1!==r&&(n=n.slice(r+1));const a=(n=(n=n.trim()).replace(/\s\s+/g," ")).split(" ");let i=a.length-2;i<-1&&(i=0);const o=Object(_Terminal_determineAllPossibilitiesForTabCompletion__WEBPACK_IMPORTED_MODULE_1__.determineAllPossibilitiesForTabCompletion)(_Player__WEBPACK_IMPORTED_MODULE_22__.Player,n,i,Terminal.currDir);if(0==o.length)return;let s="",l="";if(0==a.length)return;1==a.length?l=a[0]:2==a.length?(l=a[0],s=a[1]):3==a.length?(l=a[0]+" "+a[1],s=a[2]):(s=a.pop(),l=a.join(" ")),Object(_Terminal_tabCompletion__WEBPACK_IMPORTED_MODULE_3__.tabCompletion)(l,s,o),t.focus()}_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.ENABLE_BASH_HOTKEYS&&(e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.A&&e.ctrlKey&&(e.preventDefault(),Terminal.moveTextCursor("home")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.E&&e.ctrlKey&&(e.preventDefault(),Terminal.moveTextCursor("end")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.B&&e.ctrlKey&&(e.preventDefault(),Terminal.moveTextCursor("prevchar")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.B&&e.altKey&&(e.preventDefault(),Terminal.moveTextCursor("prevword")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.F&&e.ctrlKey&&(e.preventDefault(),Terminal.moveTextCursor("nextchar")),e.keyCode===_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.F&&e.altKey&&(e.preventDefault(),Terminal.moveTextCursor("nextword")),e.keyCode!==_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.H&&e.keyCode!==_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.D||!e.ctrlKey||(Terminal.modifyInput("backspace"),e.preventDefault()))}});let terminalCtrlPressed=!1,shiftKeyPressed=!1;$(document).ready(function(){_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_32__.routing.isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_32__.Page.Terminal)&&$(".terminal-input").focus()}),$(document).keydown(function(e){if(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_32__.routing.isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_32__.Page.Terminal))if(e.which==_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.CTRL)terminalCtrlPressed=!0;else if(e.shiftKey)shiftKeyPressed=!0;else if(terminalCtrlPressed||shiftKeyPressed||Terminal.contractOpen);else{var t=document.getElementById("terminal-input-text-box");null!=t&&t.focus(),terminalCtrlPressed=!1,shiftKeyPressed=!1}}),$(document).keyup(function(e){_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_32__.routing.isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_32__.Page.Terminal)&&(e.which==_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_34__.KEY.CTRL&&(terminalCtrlPressed=!1),e.shiftKey&&(shiftKeyPressed=!1))});let Terminal={hackFlag:!1,backdoorFlag:!1,analyzeFlag:!1,actionStarted:!1,actionTime:0,commandHistory:[],commandHistoryIndex:0,contractOpen:!1,currDir:"/",resetTerminalInput:function(e=!1){let t="";e&&(t=getTerminalInput());const n=Terminal.currDir;_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__.FconfSettings.WRAP_INPUT?(document.getElementById("terminal-input-td").innerHTML=`
`+``,document.getElementById("terminal-input-header").style.display="inline";const r=document.getElementById("terminal-input-text-box");if("number"==typeof r.selectionStart)r.selectionStart=r.selectionEnd=r.value.length;else if(void 0!==r.createTextRange){r.focus();var a=el.createTextRange();a.collapse(!1),a.select()}},modifyInput:function(e){try{var t=document.getElementById("terminal-input-text-box");if(null==t)return;t.focus();var n=t.value.length,r=t.selectionStart,a=t.value;switch(e.toLowerCase()){case"backspace":r>0&&r<=n+1&&(t.value=a.substr(0,r-1)+a.substr(r));break;case"deletewordbefore":for(var i=r-1;i>0;--i)if(" "===a.charAt(i))return void(t.value=a.substr(0,i)+a.substr(r));break;case"deletewordafter":for(i=r+1;i<=text.length+1;++i)if(" "===a.charAt(i))return void(t.value=a.substr(0,r)+a.substr(i))}}catch(e){console.error("Exception in Terminal.modifyInput: "+e)}},moveTextCursor:function(e){try{var t=document.getElementById("terminal-input-text-box");if(null==t)return;t.focus();var n=t.value.length,r=t.selectionStart;switch(e.toLowerCase()){case"home":t.setSelectionRange(0,0);break;case"end":t.setSelectionRange(n,n);break;case"prevchar":r>0&&t.setSelectionRange(r-1,r-1);break;case"prevword":for(var a=r-2;a>=0;--a)if(" "===t.value.charAt(a))return void t.setSelectionRange(a+1,a+1);t.setSelectionRange(0,0);break;case"nextchar":t.setSelectionRange(r+1,r+1);break;case"nextword":for(a=r+1;a<=n;++a)if(" "===t.value.charAt(a))return void t.setSelectionRange(a,a);t.setSelectionRange(n,n);break;default:console.warn("Invalid loc argument in Terminal.moveTextCursor()")}}catch(e){console.error("Exception in Terminal.moveTextCursor: "+e)}},startHack:function(){Terminal.hackFlag=!0,Terminal.actionTime=Object(_Hacking__WEBPACK_IMPORTED_MODULE_13__.calculateHackingTime)(_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer(),_Player__WEBPACK_IMPORTED_MODULE_22__.Player)/4,Terminal.startAction()},startBackdoor:function(){Terminal.backdoorFlag=!0,Terminal.actionTime=Object(_Hacking__WEBPACK_IMPORTED_MODULE_13__.calculateHackingTime)(_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer(),_Player__WEBPACK_IMPORTED_MODULE_22__.Player)/4,Terminal.startAction()},startAnalyze:function(){Terminal.analyzeFlag=!0,Terminal.actionTime=1,Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Analyzing system..."),Terminal.startAction()},startAction:function(){Terminal.actionStarted=!0,Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.hackProgressPost)("Time left:"),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.hackProgressBarPost)("["),document.getElementById("terminal-input-td").innerHTML='',$("input[class=terminal-input]").prop("disabled",!0)},finishAction:function(e=!1){Terminal.hackFlag?Terminal.finishHack(e):Terminal.backdoorFlag?Terminal.finishBackdoor(e):Terminal.analyzeFlag&&Terminal.finishAnalyze(e),$("#hack-progress-bar").attr("id","old-hack-progress-bar"),$("#hack-progress").attr("id","old-hack-progress"),Terminal.resetTerminalInput(),$("input[class=terminal-input]").prop("disabled",!1)},finishHack:function(e=!1){if(!e){var t=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer(),n=Object(_Hacking__WEBPACK_IMPORTED_MODULE_13__.calculateHackingChance)(t,_Player__WEBPACK_IMPORTED_MODULE_22__.Player),r=Math.random(),a=Object(_Hacking__WEBPACK_IMPORTED_MODULE_13__.calculateHackingExpGain)(t,_Player__WEBPACK_IMPORTED_MODULE_22__.Player),i=a/4;if(r50&&Terminal.commandHistory.splice(0,1)),Terminal.commandHistoryIndex=Terminal.commandHistory.length,e=e.match(/(?:'[^']*'|"[^"]*"|[^;"])*/g).map(_Alias__WEBPACK_IMPORTED_MODULE_5__.substituteAliases).map(e=>e.match(/(?:'[^']*'|"[^"]*"|[^;"])*/g)).flat();for(let t=0;t=1&&"\\"===(i=e.charAt(a-1))&&(o=!0);const s=e.charAt(a);if('"'===s)if(o||" "!==i)""===t?t='"':'"'===t&&(t="");else{const t=e.indexOf('"',a+1);if(-1!==t&&(t===e.length-1||" "===e.charAt(t+1))){n.push(e.substr(a+1,t-a-1)),r=a=t===e.length-1?t+1:t+2;continue}}else if("'"===s)if(o||" "!==i)""===t?t="'":"'"===t&&(t="");else{const t=e.indexOf("'",a+1);if(-1!==t&&(t===e.length-1||" "===e.charAt(t+1))){n.push(e.substr(a+1,t-a-1)),r=a=t===e.length-1?t+1:t+2;continue}}else if(" "===s&&""===t){let t=e.substr(r,a-r);isNumber(t)?n.push(parseFloat(t)):n.push(t),r=a+1}++a}if(r!==a){let t=e.substr(r,a-r);isNumber(t)?n.push(parseFloat(t)):n.push(t)}return n},executeCommand:function(command){if(Terminal.hackFlag||Terminal.backdoorFlag||Terminal.analyzeFlag)Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)(`Cannot execute command (${command}) while an action is in progress`);else{command.startsWith("./")&&(command="run "+command.slice(2));var commandArray=Terminal.parseCommandArguments(command);if(0!=commandArray.length)if(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.a.isRunning){var foodnstuffServ=Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29__.GetServerByHostname)("foodnstuff");if(null==foodnstuffServ)throw new Error("Could not get foodnstuff server");switch(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.a.currStep){case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalHelp:1===commandArray.length&&"help"==commandArray[0]?(Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(_Terminal_HelpText__WEBPACK_IMPORTED_MODULE_2__.TerminalHelpText),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalLs:1===commandArray.length&&"ls"==commandArray[0]?(Terminal.executeListCommand(commandArray),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalScan:1===commandArray.length&&"scan"==commandArray[0]?(Terminal.executeScanCommand(commandArray),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalScanAnalyze1:1==commandArray.length&&"scan-analyze"==commandArray[0]?(Terminal.executeScanAnalyzeCommand(1),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalScanAnalyze2:2==commandArray.length&&"scan-analyze"==commandArray[0]&&2===commandArray[1]?(Terminal.executeScanAnalyzeCommand(2),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalConnect:if(2==commandArray.length){if("connect"!=commandArray[0]||"foodnstuff"!=commandArray[1]&&commandArray[1]!=foodnstuffServ.ip)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Wrong command! Try again!");_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().isConnectedTo=!1,_Player__WEBPACK_IMPORTED_MODULE_22__.Player.currentServer=foodnstuffServ.ip,_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().isConnectedTo=!0,Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Connected to foodnstuff"),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()}else Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalAnalyze:if(1===commandArray.length&&"analyze"===commandArray[0]){if(1!==commandArray.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Incorrect usage of analyze command. Usage: analyze");Terminal.startAnalyze(),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()}else Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalNuke:2==commandArray.length&&"run"==commandArray[0]&&"NUKE.exe"==commandArray[1]?(foodnstuffServ.hasAdminRights=!0,Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("NUKE successful! Gained root access to foodnstuff"),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalManualHack:1==commandArray.length&&"hack"==commandArray[0]?(Terminal.startHack(),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalCreateScript:2==commandArray.length&&"nano"==commandArray[0]&&"foodnstuff.script"==commandArray[1]?(_engine__WEBPACK_IMPORTED_MODULE_11__.Engine.loadScriptEditorContent("foodnstuff.script",""),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalFree:1==commandArray.length&&"free"==commandArray[0]?(Terminal.executeFreeCommand(commandArray),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.TerminalRunScript:2==commandArray.length&&"run"==commandArray[0]&&"foodnstuff.script"==commandArray[1]?(Terminal.runScript(commandArray),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.d.ActiveScriptsToTerminal:if(2==commandArray.length&&"tail"==commandArray[0]&&"foodnstuff.script"==commandArray[1]){var runningScript=Object(_Script_ScriptHelpers__WEBPACK_IMPORTED_MODULE_26__.a)("foodnstuff.script",[],_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer());if(null==runningScript)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Error: No such script exists");Object(_utils_LogBox__WEBPACK_IMPORTED_MODULE_37__.logBoxCreate)(runningScript),Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__.b)()}else Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Bad command. Please follow the tutorial");break;default:return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Please follow the tutorial, or click 'Exit Tutorial' if you'd like to skip it")}}else{var s=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer();switch(commandArray[0].toLowerCase()){case"alias":if(1===commandArray.length)return void Object(_Alias__WEBPACK_IMPORTED_MODULE_5__.printAliases)();if(2===commandArray.length&&Object(_Alias__WEBPACK_IMPORTED_MODULE_5__.parseAliasDeclaration)(commandArray[1]))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`Set alias ${commandArray[1]}`);if(3===commandArray.length&&"-g"===commandArray[1]&&Object(_Alias__WEBPACK_IMPORTED_MODULE_5__.parseAliasDeclaration)(commandArray[2],!0))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`Set global alias ${commandArray[2]}`);Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)('Incorrect usage of alias command. Usage: alias [-g] [aliasname="value"]');break;case"analyze":if(1!==commandArray.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Incorrect usage of analyze command. Usage: analyze");Terminal.startAnalyze();break;case"backdoor":if(1!==commandArray.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Incorrect usage of backdoor command. Usage: backdoor");s.purchasedByPlayer?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Cannot use backdoor on your own machines! You are currently connected to your home PC or one of your purchased servers"):s.hasAdminRights?s.requiredHackingSkill>_Player__WEBPACK_IMPORTED_MODULE_22__.Player.hacking_skill?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Your hacking skill is not high enough to use backdoor on this machine. Try analyzing the machine to determine the required hacking skill"):s instanceof _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_14__.HacknetServer?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Cannot use backdoor on this type of Server"):Terminal.startBackdoor():Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("You do not have admin rights for this machine! Cannot backdoor");break;case"buy":_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_30__.SpecialServerIps.hasOwnProperty("Darkweb Server")?Object(_DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_10__.executeDarkwebTerminalCommand)(commandArray):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("You need to be able to connect to the Dark Web to use the buy command. (Maybe there's a TOR router you can buy somewhere)");break;case"cat":try{if(2!==commandArray.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect usage of cat command. Usage: cat [file]");const e=Terminal.getFilepath(commandArray[1]);if(!e.endsWith(".msg")&&!e.endsWith(".lit")&&!e.endsWith(".txt"))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Only .msg, .txt, and .lit files are viewable with cat (filename must end with .msg, .txt, or .lit)");if(e.endsWith(".msg")||e.endsWith(".lit"))for(let t=0;t2)Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect number of arguments. Usage: cd [dir]");else{let e=2===commandArray.length?commandArray[1]:"/",t;if("/"===e)t="/";else{if(e=Object(_Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__.removeTrailingSlash)(e),t=Object(_Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__.evaluateDirectoryPath)(e,Terminal.currDir),null==t||""===t)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Invalid path. Failed to change directories");const n=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer();if(!n.scripts.some(e=>e.filename.startsWith(t))&&!n.textFiles.some(e=>e.fn.startsWith(t)))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Invalid path. Failed to change directories")}Terminal.currDir=t,Terminal.resetTerminalInput()}break;case"check":try{if(commandArray.length<2)Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect number of arguments. Usage: check [script] [arg1] [arg2]...");else{const e=Terminal.getFilepath(commandArray[1]);if(!Object(_Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_27__.isScriptFilename)(e))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("tail can only be called on .script files (filename must end with .script)");let t=[];for(var i=2;i_Player__WEBPACK_IMPORTED_MODULE_22__.Player.hacking_skill?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Your hacking skill is not high enough to attempt hacking this machine. Try analyzing the machine to determine the required hacking skill"):s instanceof _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_14__.HacknetServer?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Cannot hack this type of Server"):Terminal.startHack();break;case"help":if(1!==commandArray.length&&2!==commandArray.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect usage of help command. Usage: help");if(1===commandArray.length)Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(_Terminal_HelpText__WEBPACK_IMPORTED_MODULE_2__.TerminalHelpText);else{var cmd=commandArray[1],txt=_Terminal_HelpText__WEBPACK_IMPORTED_MODULE_2__.HelpTexts[cmd];if(null==txt)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("No help topics match '"+cmd+"'");Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(txt)}break;case"home":if(1!==commandArray.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect usage of home command. Usage: home");_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().isConnectedTo=!1,_Player__WEBPACK_IMPORTED_MODULE_22__.Player.currentServer=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getHomeComputer().ip,_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().isConnectedTo=!0,Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Connected to home"),Terminal.currDir="/",Terminal.resetTerminalInput();break;case"hostname":if(1!==commandArray.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect usage of hostname command. Usage: hostname");Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().hostname);break;case"ifconfig":if(1!==commandArray.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect usage of ifconfig command. Usage: ifconfig");Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().ip);break;case"kill":Terminal.executeKillCommand(commandArray);break;case"killall":for(let e=s.runningScripts.length-1;e>=0;--e)Object(_Netscript_killWorkerScript__WEBPACK_IMPORTED_MODULE_20__.killWorkerScript)(s.runningScripts[e],s.ip,!1);_Netscript_WorkerScriptStartStopEventEmitter__WEBPACK_IMPORTED_MODULE_21__.WorkerScriptStartStopEventEmitter.emitEvent(),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Killing all running scripts");break;case"ls":Terminal.executeListCommand(commandArray);break;case"lscpu":Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().cpuCores+" Core(s)");break;case"mem":Terminal.executeMemCommand(commandArray);break;case"mv":if(3!==commandArray.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect number of arguments. Usage: mv [src] [dest]");try{const e=commandArray[1],t=commandArray[2];if(!Object(_Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_27__.isScriptFilename)(e)&&!e.endsWith(".txt"))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("'mv' can only be used on scripts and text files (.txt)");const n=Terminal.getFile(e);if(null==n)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)(`Source file ${e} does not exist`);const r=Terminal.getFilepath(e),a=Terminal.getFilepath(t),i=Terminal.getFile(t);if(Object(_Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_27__.isScriptFilename)(e)){if(!Object(_Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_27__.isScriptFilename)(t))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Source and destination files must have the same type");if(s.isRunning(r))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Cannot use 'mv' on a script that is running");if(null!=i){const e=s.removeFile(a);if(!e.res)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Something went wrong...please contact game dev (probably a bug)");Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Warning: The destination file was overwritten")}n.filename=a}else if(e.endsWith(".txt")){if(!t.endsWith(".txt"))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Source and destination files must have the same type");if(null!=i){const e=s.removeFile(a);if(!e.res)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Something went wrong...please contact game dev (probably a bug)");Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Warning: The destination file was overwritten")}n.fn=a}}catch(e){Terminal.postThrownError(e)}break;case"nano":Terminal.executeNanoCommand(commandArray);break;case"ps":if(1!==commandArray.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect usage of ps command. Usage: ps");for(let e=0;e',!1);Object(_Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_27__.isScriptFilename)(executableName)?Terminal.runScript(commandArray):executableName.endsWith(".cct")?Terminal.runContract(executableName):Terminal.runProgram(commandArray)}break;case"scan":Terminal.executeScanCommand(commandArray);break;case"scan-analyze":if(1===commandArray.length)Terminal.executeScanAnalyzeCommand(1);else{if(commandArray.length>3)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect usage of scan-analyze command. usage: scan-analyze [depth]");let e=!1;3===commandArray.length&&"-a"===commandArray[2]&&(e=!0);let t=parseInt(commandArray[1]);if(isNaN(t)||t<0)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect usage of scan-analyze command. depth argument must be positive numeric");if(t>3&&!_Player__WEBPACK_IMPORTED_MODULE_22__.Player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.DeepscanV1.name)&&!_Player__WEBPACK_IMPORTED_MODULE_22__.Player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.DeepscanV2.name))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("You cannot scan-analyze with that high of a depth. Maximum depth is 3");if(t>5&&!_Player__WEBPACK_IMPORTED_MODULE_22__.Player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.DeepscanV2.name))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("You cannot scan-analyze with that high of a depth. Maximum depth is 5");if(t>10)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("You cannot scan-analyze with that high of a depth. Maximum depth is 10");Terminal.executeScanAnalyzeCommand(t,e)}break;case"scp":Terminal.executeScpCommand(commandArray);break;case"sudov":if(1!==commandArray.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect number of arguments. Usage: sudov");s.hasAdminRights?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("You have ROOT access to this machine"):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("You do NOT have root access to this machine");break;case"tail":try{if(commandArray.length<2)Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Incorrect number of arguments. Usage: tail [script] [arg1] [arg2]...");else if("string"==typeof commandArray[1]){const e=Terminal.getFilepath(commandArray[1]);if(!Object(_Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_27__.isScriptFilename)(e))return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("tail can only be called on .script, .ns, .js files, or by pid");const t=[];for(let e=2;e5||3===t)return n();let r=null,a=Terminal.currDir;if(a.endsWith("/")||(a+="/"),t>=4){if("grep"!==e[t-2]||"|"!==e[t-3])return n();r=e[t-1]}if(t>=2&&"|"!==e[1]&&null!=(a=Object(_Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__.evaluateDirectoryPath)(e[1],Terminal.currDir))&&(a.endsWith("/")||(a+="/"),!Object(_Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__.isValidDirectoryPath)(a)))return n();"/"===a&&(a=null);const i=[],o=[],s=[],l=[],c=[],u=[];function m(e,t){let n=e;if(a){if(!e.startsWith(a))return;n=e.slice(a.length,e.length)}if(!r||n.includes(r))if(n.includes("/")){const e=Object(_Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__.getFirstParentDirectory)(n);if(r&&!e.includes(r))return;u.includes(e)||u.push(e)}else t.push(n)}const p=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer();for(const e of p.programs)m(e,i);for(const e of p.scripts)m(e.filename,o);for(const e of p.textFiles)m(e.fn,s);for(const e of p.contracts)m(e.fn,l);for(const e of p.messages)e instanceof _Message_Message__WEBPACK_IMPORTED_MODULE_17__.Message?m(e.filename,c):m(e,c);function h(e,t){const n=Math.max(...e.map(e=>e.length))+1,r=Math.floor(80/n);for(let a=0;ae.segments.length>0);for(let e=0;e{const r=Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29__.getServerOnNetwork)(t,n);return{hostname:r.hostname,ip:r.ip,hasRoot:r.hasAdminRights?"Y":"N"}});n.unshift({hostname:"Hostname",ip:"IP",hasRoot:"Root Access"});const r=Math.max(...n.map(e=>e.hostname.length)),a=Math.max(...n.map(e=>e.ip.length));for(const e of n){let t=e.hostname;t+=" ".repeat(r-e.hostname.length+1),t+=e.ip,t+=" ".repeat(a-e.ip.length+1),t+=e.hasRoot,Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(t)}},executeScanAnalyzeCommand:function(e=1,t=!1){Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~"),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(" ");var n={};for(const e in _Server_AllServers__WEBPACK_IMPORTED_MODULE_28__.AllServers)n[e]=0;const r=[],a=[0],i=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer();for(r.push(i);0!=r.length;){const i=r.pop(),u=a.pop(),m=i instanceof _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_14__.HacknetServer;if((t||!i.purchasedByPlayer||"home"==i.hostname)&&(!(n[i.ip]||u>e)&&(t||!m))){n[i.ip]=1;for(var o=i.serversOnNetwork.length-1;o>=0;--o)r.push(Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29__.getServerOnNetwork)(i,o)),a.push(u+1);if(0!=u){var s=Array(4*(u-1)+1).join("-");_Player__WEBPACK_IMPORTED_MODULE_22__.Player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.AutoLink.name)?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(""+s+"> "+i.hostname+"",!1):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(""+s+">"+i.hostname+"");var l=s+"--",c="NO";i.hasAdminRights&&(c="YES"),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`${l}Root Access: ${c}${m?"":", Required hacking skill: "+i.requiredHackingSkill}`),m||Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(l+"Number of open ports required to NUKE: "+i.numOpenPortsRequired),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(l+"RAM: "+_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_33__.numeralWrapper.formatRAM(i.maxRam)),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(" ")}}}var u=document.getElementsByClassName("scan-analyze-link");for(let e=0;e{if(!e.hasAdminRights)return e.openPortCount>=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().numOpenPortsRequired?(e.hasAdminRights=!0,void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("NUKE successful! Gained root access to "+_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer().hostname)):void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("NUKE unsuccessful. Not enough ports have been opened");Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("You already have root access to this computer. There is no reason to run NUKE.exe")}),a[_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.BruteSSHProgram.name]=(e=>{e.sshPortOpen?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("SSH Port (22) is already open!"):(e.sshPortOpen=!0,Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Opened SSH Port(22)!"),e.openPortCount++)}),a[_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.FTPCrackProgram.name]=(e=>{e.ftpPortOpen?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("FTP Port (21) is already open!"):(e.ftpPortOpen=!0,Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Opened FTP Port (21)!"),e.openPortCount++)}),a[_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.RelaySMTPProgram.name]=(e=>{e.smtpPortOpen?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("SMTP Port (25) is already open!"):(e.smtpPortOpen=!0,Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Opened SMTP Port (25)!"),e.openPortCount++)}),a[_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.HTTPWormProgram.name]=(e=>{e.httpPortOpen?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("HTTP Port (80) is already open!"):(e.httpPortOpen=!0,Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Opened HTTP Port (80)!"),e.openPortCount++)}),a[_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.SQLInjectProgram.name]=(e=>{e.sqlPortOpen?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("SQL Port (1433) is already open!"):(e.sqlPortOpen=!0,Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Opened SQL Port (1433)!"),e.openPortCount++)}),a[_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.ServerProfiler.name]=((e,t)=>{if(2!==t.length)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Must pass a server hostname or IP as an argument for ServerProfiler.exe");const n=Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29__.getServer)(t[1]);null!=n?n instanceof _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_14__.HacknetServer?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`${_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.ServerProfiler.name} cannot be run on a Hacknet Server.`):(Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(n.hostname+":"),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Server base security level: "+n.baseDifficulty),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Server current security level: "+n.hackDifficulty),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Server growth rate: "+n.serverGrowth),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`Netscript hack() execution time: ${Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_40__.convertTimeMsToTimeElapsedString)(1e3*Object(_Hacking__WEBPACK_IMPORTED_MODULE_13__.calculateHackingTime)(n,_Player__WEBPACK_IMPORTED_MODULE_22__.Player),!0)}`),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`Netscript grow() execution time: ${Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_40__.convertTimeMsToTimeElapsedString)(1e3*Object(_Hacking__WEBPACK_IMPORTED_MODULE_13__.calculateGrowTime)(n,_Player__WEBPACK_IMPORTED_MODULE_22__.Player),!0)}`),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`Netscript weaken() execution time: ${Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_40__.convertTimeMsToTimeElapsedString)(1e3*Object(_Hacking__WEBPACK_IMPORTED_MODULE_13__.calculateWeakenTime)(n,_Player__WEBPACK_IMPORTED_MODULE_22__.Player),!0)}`)):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Invalid server IP/hostname")}),a[_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.AutoLink.name]=(()=>{Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("This executable cannot be run."),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("AutoLink.exe lets you automatically connect to other servers when using 'scan-analyze'."),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("When using scan-analyze, click on a server's hostname to connect to it.")}),a[_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.DeepscanV1.name]=(()=>{Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("This executable cannot be run."),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5.")}),a[_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.DeepscanV2.name]=(()=>{Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("This executable cannot be run."),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10.")}),a[_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.Flight.name]=(()=>{const e=Math.round(30*_BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_6__.BitNodeMultipliers.DaedalusAugsRequirement);if(!(_Player__WEBPACK_IMPORTED_MODULE_22__.Player.augmentations.length>=e&&_Player__WEBPACK_IMPORTED_MODULE_22__.Player.money.gt(1e11)&&_Player__WEBPACK_IMPORTED_MODULE_22__.Player.hacking_skill>=2500))return Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`Augmentations: ${_Player__WEBPACK_IMPORTED_MODULE_22__.Player.augmentations.length} / ${e}`),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postElement)(react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_45___default.a.Fragment,null,"Money: ",Object(_ui_React_Money__WEBPACK_IMPORTED_MODULE_41__.Money)(_Player__WEBPACK_IMPORTED_MODULE_22__.Player.money.toNumber())," / ",Object(_ui_React_Money__WEBPACK_IMPORTED_MODULE_41__.Money)(1e11))),void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`Hacking skill: ${_Player__WEBPACK_IMPORTED_MODULE_22__.Player.hacking_skill} / 2500`);Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("We will contact you."),Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("-- Daedalus --")}),a[_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__.Programs.BitFlume.name]=(()=>{const e=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_38__.yesNoBoxGetYesButton)(),t=Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_38__.yesNoBoxGetNoButton)();e.innerHTML="Travel to BitNode Nexus",t.innerHTML="Cancel",e.addEventListener("click",function(){return Object(_RedPill__WEBPACK_IMPORTED_MODULE_23__.a)(_Player__WEBPACK_IMPORTED_MODULE_22__.Player.bitNodeN,!0),Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_38__.yesNoBoxClose)()}),t.addEventListener("click",function(){return Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_38__.yesNoBoxClose)()}),Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_38__.yesNoBoxCreate)("WARNING: USING THIS PROGRAM WILL CAUSE YOU TO LOSE ALL OF YOUR PROGRESS ON THE CURRENT BITNODE.
Do you want to travel to the BitNode Nexus? This allows you to reset the current BitNode and select a new one.")}),a.hasOwnProperty(n)?a[n](t,r):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Invalid executable. Cannot be run")},getFilepath:function(e){const t=Object(_Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__.evaluateFilePath)(e,Terminal.currDir);if(null==t)throw new Error(`Invalid file path specified: ${e}`);return Object(_Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__.isInRootDirectory)(t)?Object(_Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__.removeLeadingSlash)(t):t},getFile:function(e){return Object(_Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_27__.isScriptFilename)(e)?Terminal.getScript(e):e.endsWith(".lit")?Terminal.getLitFile(e):e.endsWith(".txt")?Terminal.getTextFile(e):null},getLitFile:function(e){const t=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer(),n=Terminal.getFilepath(e);for(const e of t.messages)if("string"==typeof e&&n===e)return e;return null},getScript:function(e){const t=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer(),n=Terminal.getFilepath(e);for(const e of t.scripts)if(n===e.filename)return e;return null},getTextFile:function(e){const t=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer(),n=Terminal.getFilepath(e);for(const e of t.textFiles)if(n===e.fn)return e;return null},postThrownError:function(e){if(e instanceof Error){const t="Error: ",n=e.toString();n.startsWith(t)?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)(n.slice(t.length)):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)(n)}},runScript:function(e){if(e.length<2)return void dialogBoxCreate(`Bug encountered with Terminal.runScript(). Command array has a length of less than 2: ${e}`);const t=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer();let n=1;const r=[],a=Terminal.getFilepath(e[1]);if(e.length>2)if(e.length>=4&&"-t"==e[2]){if(n=Math.round(parseFloat(e[3])),isNaN(n)||n<1)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Invalid number of threads specified. Number of threads must be greater than 0");for(let t=4;tl)return void Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("This machine does not have enough RAM to run this script with "+n+" threads. Script requires "+s+"GB of RAM");var c=new _Script_RunningScript__WEBPACK_IMPORTED_MODULE_24__.RunningScript(o,r);return c.threads=n,void(Object(_NetscriptWorker__WEBPACK_IMPORTED_MODULE_19__.e)(c,t)?Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`Running script with ${n} thread(s), pid ${c.pid} and args: ${Object(_utils_helpers_arrayToString__WEBPACK_IMPORTED_MODULE_35__.arrayToString)(r)}.`):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.postError)("Failed to start script"))}Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("ERROR: No such script")}else Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("ERROR: This script is already running. Cannot run multiple instances")},runContract:async function(e){if(Terminal.contractOpen)return Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("ERROR: There's already a Coding Contract in Progress");const t=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.getCurrentServer(),n=t.getContract(e);if(null==n)return Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("ERROR: No such contract");switch(Terminal.contractOpen=!0,await n.prompt()){case _CodingContracts__WEBPACK_IMPORTED_MODULE_7__.CodingContractResult.Success:var r=_Player__WEBPACK_IMPORTED_MODULE_22__.Player.gainCodingContractReward(n.reward,n.getDifficulty());Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`Contract SUCCESS - ${r}`),t.removeContract(n);break;case _CodingContracts__WEBPACK_IMPORTED_MODULE_7__.CodingContractResult.Failure:++n.tries,n.tries>=n.getMaxNumTries()?(Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Contract
FAILED
- Contract is now self-destructing"),t.removeContract(n)):Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)(`Contract
FAILED
- ${n.getMaxNumTries()-n.tries} tries remaining`);break;case _CodingContracts__WEBPACK_IMPORTED_MODULE_7__.CodingContractResult.Cancelled:default:Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_39__.post)("Contract cancelled")}Terminal.contractOpen=!1}}}).call(this,__webpack_require__(122))},,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HacknetServer=void 0;const r=n(10),a=n(680),i=n(38),o=n(153),s=n(401),l=n(25);class c extends a.BaseServer{constructor(e={hostname:"",ip:s.createRandomIp()}){super(e),this.cache=1,this.cores=1,this.hashCapacity=0,this.hashRate=0,this.level=1,this.onlineTimeSeconds=0,this.totalHashesGenerated=0,this.maxRam=1,this.updateHashCapacity()}calculateCacheUpgradeCost(e){return o.calculateCacheUpgradeCost(this.cache,e)}calculateCoreUpgradeCost(e,t){return o.calculateCoreUpgradeCost(this.cores,e,t)}calculateLevelUpgradeCost(e,t){return o.calculateLevelUpgradeCost(this.level,e,t)}calculateRamUpgradeCost(e,t){return o.calculateRamUpgradeCost(this.maxRam,e,t)}process(e=1){const t=e*r.CONSTANTS.MilliPerCycle/1e3;return this.hashRate*t}upgradeCache(e){this.cache=Math.min(i.HacknetServerConstants.MaxCache,Math.round(this.cache+e)),this.updateHashCapacity()}upgradeCore(e,t){this.cores=Math.min(i.HacknetServerConstants.MaxCores,Math.round(this.cores+e)),this.updateHashRate(t)}upgradeLevel(e,t){this.level=Math.min(i.HacknetServerConstants.MaxLevel,Math.round(this.level+e)),this.updateHashRate(t)}upgradeRam(e,t){for(let t=0;t{i=!0;let t=e.source.value;t.startsWith("./")&&(t=t.slice(2));let n=function(e){for(let t=0;t{n.push(e.id.name),r.push(e)}}),a+="var "+t+";\n(function (namespace) {\n",r.forEach(e=>{a+=Object(k.generate)(e),a+="\n"}),n.forEach(e=>{a+="namespace."+e+" = "+e,a+="\n"}),a+="})("+t+" || ("+t+" = {}));\n"}else{let t=[];e.specifiers.forEach(e=>{t.push(e.local.name)});let n=[];Object(M.b)(o,{FunctionDeclaration:e=>{t.includes(e.id.name)&&n.push(e)}}),n.forEach(e=>{a+=Object(k.generate)(e),a+="\n"})}}}),!i)return{code:e,lineOffset:0};var o=0;if("Program"!==n.type||null==n.body)throw new Error("Code could not be properly parsed");for(let e=n.body.length-1;e>=0;--e)"ImportDeclaration"===n.body[e].type&&(n.body.splice(e,1),++o);var s=(a.match(/\n/g)||[]).length-o;return e=Object(k.generate)(n),{code:e=a+e,lineOffset:s}}(t,e);n=a.code,i=a.lineOffset}catch(t){return Object(C.dialogBoxCreate)("Error processing Imports in "+e.name+": "+t),e.env.stopFlag=!0,e.running=!1,void Object(r.killWorkerScript)(e)}var o;try{o=new u.a(n,function(t,n){var r=Object(p.a)(e);for(let e in r){let a=r[e];if("function"==typeof a)if("hack"===e||"grow"===e||"weaken"===e||"sleep"===e||"prompt"===e||"manualHack"===e){let r=function(){let e=[];for(let n=0;n"+t),e.env.stopFlag=!0,e.running=!1,void Object(r.killWorkerScript)(e)}return new Promise(function(t,n){try{!function r(){try{if(e.env.stopFlag)return n(e);o.step()?Object(v.setTimeoutRef)(r,E.Settings.CodeInstructionRunTime):t(e)}catch(t){return t=t.toString(),Object(m.a)(t)||(t=Object(m.b)(e,t)),e.errorMessage=t,n(e)}}()}catch(t){return Object(O.isString)(t)?(e.errorMessage=t,n(e)):t instanceof a.WorkerScript?n(t):n(e)}})}function N(e,t,n){return D(e,t,n)?(t.runScript(e,_.Player.hacknet_node_money_mult),e.pid):0}function D(e,t,n){let l=1;e.threads&&!isNaN(e.threads)?l=e.threads:e.threads=1;const c=Object(S.roundToTwo)(Object(y.getRamUsageFromRunningScript)(e)*l);if(c>t.maxRam-t.ramUsed)return Object(C.dialogBoxCreate)(`Not enough RAM to run script ${e.filename} with args `+`${Object(P.arrayToString)(e.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 your changes to the script.)"),!1;t.ramUsed=Object(S.roundToTwo)(t.ramUsed+c);const u=Object(s.generateNextPid)();if(-1===u)throw new Error("Failed to start script because could not find available PID. This is most because you have too many scripts running.");const d=new a.WorkerScript(e,u,p.a);d.ramUsage=c,i.workerScripts.set(u,d),o.WorkerScriptStartStopEventEmitter.emitEvent();let _=null;if(d.name.endsWith(".js")||d.name.endsWith(".ns"))_=function(e){e.running=!0;let t=null;function n(n,r){return function(...a){if(e.env.stopFlag)throw e;if("sleep"===n)return r(...a);if(t)throw e.errorMessage=Object(m.b)(e,sprintf("Concurrent calls to Netscript functions not allowed! Did you forget to await hack(), grow(), or some other promise-returning function? (Currently running: %s tried to run: %s)",t,n),null),e;let i;t=n;try{i=r(...a)}catch(e){throw t=null,e}return i&&void 0!==i.finally?i.finally(function(){t=null}):(t=null,i)}}for(let t in e.env.vars)"function"==typeof e.env.vars[t]&&(e.env.vars[t]=n(t,e.env.vars[t]));return Object(h.a)(e.getServer().scripts,e).then(function(t){return void 0===t?e:[t,e]}).catch(t=>{if(t instanceof Error)throw e.errorMessage=Object(m.b)(e,t.message+(t.stack&&"\nstack:\n"+t.stack.toString()||"")),e;if(Object(m.a)(t))throw e.errorMessage=t,e;throw t})}(d);else if(!((_=R(d))instanceof Promise))return!1;return _.then(function(t){n&&n.running&&(n.scriptRef.onlineExpGained+=e.onlineExpGained,n.scriptRef.onlineMoneyMade+=e.onlineMoneyMade),t.running&&(Object(r.killWorkerScript)(d),t.log("","Script finished running"))}).catch(function(e){if(e instanceof Error)return Object(C.dialogBoxCreate)("Script runtime unknown error. This is a bug please contact game developer"),void console.error("Evaluating workerscript returns an Error. THIS SHOULDN'T HAPPEN: "+e.toString());if(e instanceof a.WorkerScript){if(!Object(m.a)(e.errorMessage))return void e.log("","Script killed");{const t=e.errorMessage.split("|");if(4!=t.length)return console.error("ERROR: Something wrong with Error text in evaluator..."),void console.error("Error text: "+errorText);const n=t[1],r=t[2],a=t[3];let i=`RUNTIME ERROR ${r}@${n} `;e.args.length>0&&(i+=`Args: ${Object(P.arrayToString)(e.args)} `),i+=" ",i+=a,Object(C.dialogBoxCreate)(i),e.log("","Script crashed with runtime error")}e.running=!1,e.env.stopFlag=!0}else{if(Object(m.a)(e))return Object(C.dialogBoxCreate)("Script runtime unknown error. This is a bug please contact game developer"),void console.error("ERROR: Evaluating workerscript returns only error message rather than WorkerScript object. THIS SHOULDN'T HAPPEN: "+e.toString());Object(C.dialogBoxCreate)("An unknown script died for an unknown reason. This is a bug please contact game dev"),console.error(e)}Object(r.killWorkerScript)(d)}),!0}function I(e=1){var t=e*c.Engine._idleSpeed/1e3;for(const e of i.workerScripts.values())e.scriptRef.onlineRunningTime+=t}function B(){let e=-1!==window.location.href.toLowerCase().indexOf("?noscripts");e&&console.info("Skipping the load of any scripts during startup");for(const t in b.AllServers)if(b.AllServers.hasOwnProperty(t)){const n=b.AllServers[t];n.ramUsed=0;for(let e=0;ec)return i.log(e,`Cannot run script '${n}' (t=${o}) on '${t.hostname}' because there is not enough available RAM!`),0;{i.log(e,`'${n}' on '${t.hostname}' with ${o} threads and args: ${Object(P.arrayToString)(r)}.`);let a=new g.RunningScript(s,r);return a.threads=o,N(a,t,i)}}return i.log(e,`Could not find script '${n}' on '${t.hostname}'`),0}},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return M}),n.d(t,"c",function(){return f}),n.d(t,"d",function(){return E}),n.d(t,"b",function(){return b});var r=n(10),a=n(17),i=n(71),o=n(1),s=n(12),l=n(13),c=n(70),u=n(134),m=n(22),p=n(65),h=n(35),d=(n(1162),n(0)),_=n.n(d),g=n(26),y=n.n(g);let f=!1,b=null;function E(e,t){f=e,b=e?t:null}e(document).keydown(function(e){if(f&&b&&0!=b.selectedNode.length)switch(e.keyCode){case 65:b.actionButtons[0].click();break;case 83:b.actionButtons[1].click();break;case 87:b.actionButtons[2].click();break;case 70:b.actionButtons[3].click();break;case 82:b.actionButtons[4].click();break;case 68:b.actionButtons[5].click()}});let v={Core:"CPU Core Node",Firewall:"Firewall Node",Database:"Database Node",Spam:"Spam Node",Transfer:"Transfer Node",Shield:"Shield Node"},k="Attacking",C="Scanning",P="Weakening",S="Fortifying",O="Overflowing";function T(e,t){this.type=e,this.atk=t.atk?t.atk:0,this.def=t.def?t.def:0,this.hp=t.hp?t.hp:0,this.maxhp=this.hp,this.plyrCtrl=!1,this.enmyCtrl=!1,this.pos=[0,0],this.el=null,this.action=null,this.targetedCount=0,this.conn=null}function M(e,t){this.faction=t,this.started=!1,this.time=18e4,this.playerCores=[],this.playerNodes=[],this.playerAtk=0,this.playerDef=0,this.enemyCores=[],this.enemyDatabases=[],this.enemyNodes=[],this.enemyAtk=0,this.enemyDef=0,this.miscNodes=[],this.selectedNode=[],this.actionButtons=[],this.availablePositions=[];for(var n=0;n<8;++n)for(var a=0;a<8;++a)this.availablePositions.push([n,a]);this.map=[];for(var i=0;i<8;++i)this.map.push([null,null,null,null,null,null,null,null]);this.jsplumbinstance=null,this.difficulty=e/r.CONSTANTS.HackingMissionRepToDiffConversion+1,this.reward=250+e/r.CONSTANTS.HackingMissionRepToRewardConversion}function x(e){e.selectedNode.length>0&&(e.selectedNode.forEach(function(t){t.deselect(e.actionButtons)}),e.selectedNode.length=0)}T.prototype.setPosition=function(e,t){this.pos=[e,t]},T.prototype.setControlledByPlayer=function(){this.plyrCtrl=!0,this.enmyCtrl=!1,this.el&&(this.el.classList.remove("hack-mission-enemy-node"),this.el.classList.add("hack-mission-player-node"))},T.prototype.setControlledByEnemy=function(){this.plyrCtrl=!1,this.enmyCtrl=!0,this.el&&(this.el.classList.remove("hack-mission-player-node"),this.el.classList.add("hack-mission-enemy-node"))},T.prototype.select=function(e){if(!this.enmyCtrl){this.el.classList.add("hack-mission-player-node-active");for(var t=0;t(this.start(),!1));var u=document.createElement("a");u.innerHTML="Forfeit Mission (Exit)",u.classList.add("a-link-button"),u.classList.add("hack-mission-header-element"),u.style.display="inline-block",u.addEventListener("click",()=>(this.finishMission(!1),!1));var m=document.createElement("p");m.setAttribute("id","hacking-mission-timer"),m.style.display="inline-block",m.style.margin="6px";var p=document.createElement("span");p.style.display="block",p.classList.add("hack-mission-action-buttons-container");for(var h=0;h<6;++h)this.actionButtons.push(document.createElement("a")),this.actionButtons[h].style.display="inline-block",this.actionButtons[h].classList.add("a-link-button-inactive"),this.actionButtons[h].classList.add("tooltip"),this.actionButtons[h].classList.add("hack-mission-header-element"),p.appendChild(this.actionButtons[h]);this.actionButtons[0].innerText="Attack(a)";var d=document.createElement("span");d.classList.add("tooltiptexthigh"),d.innerText="Lowers the targeted node's HP. The effectiveness of this depends on this node's Attack level, your hacking level, and the opponent's defense level.",this.actionButtons[0].appendChild(d),this.actionButtons[1].innerText="Scan(s)";var g=document.createElement("span");g.classList.add("tooltiptexthigh"),g.innerText="Lowers the targeted node's defense. The effectiveness of this depends on this node's Attack level, your hacking level, and the opponent's defense level.",this.actionButtons[1].appendChild(g),this.actionButtons[2].innerText="Weaken(w)";var f=document.createElement("span");f.classList.add("tooltiptexthigh"),f.innerText="Lowers the targeted node's attack. The effectiveness of this depends on this node's Attack level, your hacking level, and the opponent's defense level.",this.actionButtons[2].appendChild(f),this.actionButtons[3].innerText="Fortify(f)";var b=document.createElement("span");b.classList.add("tooltiptexthigh"),b.innerText="Raises this node's Defense level. The effectiveness of this depends on your hacking level",this.actionButtons[3].appendChild(b),this.actionButtons[4].innerText="Overflow(r)";var E=document.createElement("span");E.classList.add("tooltiptexthigh"),E.innerText="Raises this node's Attack level but lowers its Defense level. The effectiveness of this depends on your hacking level.",this.actionButtons[4].appendChild(E),this.actionButtons[5].innerText="Drop Connection(d)";var T=document.createElement("span");T.classList.add("tooltiptexthigh"),T.innerText="Removes this Node's current connection to some target Node, if it has one. This can also be done by simply clicking the white connection line.",this.actionButtons[5].appendChild(T);var M=document.createElement("p"),x=document.createElement("p");M.style.display="inline-block",x.style.display="inline-block",M.style.color="#00ccff",x.style.color="red",M.style.margin="4px",x.style.margin="4px",M.setAttribute("id","hacking-mission-player-stats"),x.setAttribute("id","hacking-mission-enemy-stats"),p.appendChild(M),p.appendChild(x),this.actionButtons[0].addEventListener("click",()=>{this.selectedNode.length>0?this.selectedNode[0].type===v.Core&&(this.setActionButtonsActive(this.selectedNode[0].type),this.setActionButton(k,!1),this.selectedNode.forEach(function(e){e.action=k})):console.error("Pressing Action button without selected node")}),this.actionButtons[1].addEventListener("click",()=>{if(this.selectedNode.length>0){var e=this.selectedNode[0].type;e!==v.Core&&e!==v.Transfer||(this.setActionButtonsActive(e),this.setActionButton(C,!1),this.selectedNode.forEach(function(e){e.action=C}))}else console.error("Pressing Action button without selected node")}),this.actionButtons[2].addEventListener("click",()=>{if(this.selectedNode.length>0){var e=this.selectedNode[0].type;e!==v.Core&&e!==v.Transfer||(this.setActionButtonsActive(e),this.setActionButton(P,!1),this.selectedNode.forEach(function(e){e.action=P}))}else console.error("Pressing Action button without selected node")}),this.actionButtons[3].addEventListener("click",()=>{this.selectedNode.length>0?(this.setActionButtonsActive(this.selectedNode[0].type),this.setActionButton(S,!1),this.selectedNode.forEach(function(e){e.action=S})):console.error("Pressing Action button without selected node")}),this.actionButtons[4].addEventListener("click",()=>{if(this.selectedNode.length>0){var e=this.selectedNode[0].type;e!==v.Core&&e!==v.Transfer||(this.setActionButtonsActive(e),this.setActionButton(O,!1),this.selectedNode.forEach(function(e){e.action=O}))}else console.error("Pressing Action button without selected node")}),this.actionButtons[5].addEventListener("click",()=>{this.selectedNode.length>0?this.selectedNode.forEach(function(e){if(e.conn){var t=e.conn.endpoints;t[0].detachFrom(t[1])}e.action=S}):console.error("Pressing Action button without selected node")});var w=document.createElement("p");e.appendChild(a),e.appendChild(i),e.appendChild(l),e.appendChild(u),e.appendChild(m),e.appendChild(p),e.appendChild(w)},M.prototype.setActionButtonsInactive=function(){for(var e=0;ePlayer Defense: "+Object(l.formatNumber)(this.playerDef,1),e=0;for(t=0;tEnemy Defense: "+Object(l.formatNumber)(this.enemyDef,1)},M.prototype.calculateDefenses=function(){for(var e=0,t=0;tPlayer Defense: "+Object(l.formatNumber)(this.playerDef,1),e=0;for(t=0;tEnemy Defense: "+Object(l.formatNumber)(this.enemyDef,1)},M.prototype.removeAvailablePosition=function(e,t){for(var n=0;nAtk: "+Object(l.formatNumber)(e.atk,1)+" Def: "+Object(l.formatNumber)(e.def,1),n.innerHTML=r,t.appendChild(n),document.getElementById("hacking-mission-map").appendChild(t)},M.prototype.updateNodeDomElement=function(e){if(null==e.el)return void console.error("Calling updateNodeDomElement on a Node without an element");let t,n="hacking-mission-node-"+e.pos[0]+"-"+e.pos[1],r=document.getElementById(n+"-txt");switch(e.type){case v.Core:t="CPU Core HP: "+Object(l.formatNumber)(e.hp,1);break;case v.Firewall:t="Firewall HP: "+Object(l.formatNumber)(e.hp,1);break;case v.Database:t="Database HP: "+Object(l.formatNumber)(e.hp,1);break;case v.Spam:t="Spam HP: "+Object(l.formatNumber)(e.hp,1);break;case v.Transfer:t="Transfer HP: "+Object(l.formatNumber)(e.hp,1);break;case v.Shield:default:t="Shield HP: "+Object(l.formatNumber)(e.hp,1)}t+=" Atk: "+Object(l.formatNumber)(e.atk,1)+" Def: "+Object(l.formatNumber)(e.def,1),e.action&&(t+=" "+e.action),r.innerHTML=t},M.prototype.getNodeFromElement=function(e){var t=(Object(p.isString)(e)?e:e.id).replace("hacking-mission-node-","").split("-");if(2!=t.length)return console.error("Parsing hacking mission node id. could not find coordinates"),null;var n=t[0],r=t[1];return isNaN(n)||isNaN(r)||n>=8||r>=8||n<0||r<0?(console.error(`Unexpected values (${n}, ${r}) for (x, y)`),null):this.map[n][r]},M.prototype.configurePlayerNodeElement=function(e){null==this.getNodeFromElement(e)&&console.error("Failed getting Node object");const t=()=>{!function(e,t){var n=e.getNodeFromElement(t);null==n&&console.error("Failed getting Node object"),n.plyrCtrl&&(x(e),n.select(e.actionButtons),e.selectedNode.push(n))}(this,e)};e.addEventListener("click",t);e.addEventListener("dblclick",()=>{!function(e,t){var n=e.getNodeFromElement(t);if(null==n&&console.error("Failed getting Node Object in multiselectNode()"),n.plyrCtrl){x(e);var r=n.type;r===v.Core?e.playerCores.forEach(function(t){t.select(e.actionButtons),e.selectedNode.push(t)}):e.playerNodes.forEach(function(t){t.type===r&&(t.select(e.actionButtons),e.selectedNode.push(t))})}}(this,e)}),e.firstChild&&e.firstChild.addEventListener("click",t)},M.prototype.configureEnemyNodeElement=function(e){for(var t=this.getNodeFromElement(e),n=0;n0&&this.map[t-1][n].plyrCtrl)||(!!(t<7&&this.map[t+1][n].plyrCtrl)||(!!(n>0&&this.map[t][n-1].plyrCtrl)||!!(n<7&&this.map[t][n+1].plyrCtrl)))},M.prototype.nodeReachableByEnemy=function(e){if(null==e)return!1;var t=e.pos[0],n=e.pos[1];return!!(t>0&&this.map[t-1][n].enmyCtrl)||(!!(t<7&&this.map[t+1][n].enmyCtrl)||(!!(n>0&&this.map[t][n-1].enmyCtrl)||!!(n<7&&this.map[t][n+1].enmyCtrl)))},M.prototype.start=function(){this.started=!0,this.initJsPlumb();var e=Object(h.clearEventListeners)("hack-mission-start-btn");e.classList.remove("a-link-button"),e.classList.add("a-link-button-inactive")},M.prototype.initJsPlumb=function(){var e=jsPlumb.getInstance({DragOptions:{cursor:"pointer",zIndex:2e3},PaintStyle:{gradient:{stops:[[0,"#FFFFFF"],[1,"#FFFFFF"]]},stroke:"#FFFFFF",strokeWidth:8}});this.jsplumbinstance=e;for(var t=0;t{if(!this.getNodeFromElement(e.source).enmyCtrl){var t=e.endpoints;t[0].detachFrom(t[1])}}),e.bind("connection",e=>{var t=this.getNodeFromElement(e.target);this.getNodeFromElement(e.source).enmyCtrl||(this.nodeReachable(t)?(this.getNodeFromElement(e.source).conn=e.connection,++(t=this.getNodeFromElement(e.target)).targetedCount):e.sourceEndpoint.detachFrom(e.targetEndpoint))}),e.bind("connectionDetached",e=>{this.getNodeFromElement(e.source).conn=null,this.getNodeFromElement(e.target).untarget()})},M.prototype.dropAllConnectionsFromNode=function(e){for(var t=this.jsplumbinstance.getAllConnections(),n=t.length-1;n>=0;--n)t[n].source==e.el&&t[n].endpoints[0].detachFrom(t[n].endpoints[1])},M.prototype.dropAllConnectionsToNode=function(e){for(var t=this.jsplumbinstance.getAllConnections(),n=t.length-1;n>=0;--n)t[n].target==e.el&&t[n].endpoints[0].detachFrom(t[n].endpoints[1]);e.beingTargeted=!1};var w=0;M.prototype.process=function(e=1){if(this.started&&!((w+=e)<2)){var t=!1;this.playerCores.forEach(e=>{t|=this.processNode(e,w)}),this.playerNodes.forEach(e=>{e.type!==v.Transfer&&e.type!==v.Shield&&e.type!==v.Firewall||(t|=this.processNode(e,w))}),this.enemyCores.forEach(e=>{this.enemyAISelectAction(e),t|=this.processNode(e,w)}),this.enemyNodes.forEach(e=>{e.type!==v.Transfer&&e.type!==v.Shield&&e.type!==v.Firewall||(this.enemyAISelectAction(e),t|=this.processNode(e,w))}),this.enemyDatabases.forEach(e=>{e.maxhp+=.1*w,e.hp+=.1*w}),t&&(this.calculateAttacks(),this.calculateDefenses()),0!==this.enemyDatabases.length?0!==this.playerCores.length?(this.miscNodes.forEach(e=>{e.def+=.1*w,e.maxhp+=.05*w,e.hp+=.1*w,e.hp>e.maxhp&&(e.hp=e.maxhp),this.updateNodeDomElement(e)}),this.time-=w*a.Engine._idleSpeed,this.time<=0?this.finishMission(!1):(this.updateTimer(),w=0)):this.finishMission(!1):this.finishMission(!0)}},M.prototype.processNode=function(e,t=1){if(null!=e.action){var n,a,i=null;e.conn&&(null==(i=null!=e.conn.target?this.getNodeFromElement(e.conn.target):this.getNodeFromElement(e.conn.targetId))||(i.plyrCtrl?(n=this.playerDef,a=this.enemyAtk):i.enmyCtrl?(n=this.enemyDef,a=this.playerAtk):(n=i.def,a=e.plyrCtrl?this.playerAtk:this.enemyAtk)));var s=!1,l=e.plyrCtrl,c=this.difficulty*r.CONSTANTS.HackingMissionDifficultyToHacking;switch(e.action){case k:if(null==i)break;if(null==e.conn)break;var u=this.calculateAttackDamage(a,n,l?o.Player.hacking_skill:c);i.hp-=u/5*t;break;case C:if(null==i)break;if(null==e.conn)break;var m=this.calculateScanEffect(a,n,l?o.Player.hacking_skill:c);i.def-=m/5*t,s=!0;break;case P:if(null==i)break;if(null==e.conn)break;m=this.calculateWeakenEffect(a,n,l?o.Player.hacking_skill:c);i.atk-=m/5*t,s=!0;break;case S:m=this.calculateFortifyEffect(o.Player.hacking_skill);e.def+=m/5*t,s=!0;break;case O:m=this.calculateOverflowEffect(o.Player.hacking_skill);if(e.def{0===e.targetedCount&&(e.def*=r.CONSTANTS.HackingMissionMiscDefenseIncrease)})}return this.updateNodeDomElement(e),i&&this.updateNodeDomElement(i),s}},M.prototype.enemyAISelectAction=function(e){if(null!=e)switch(e.type){case v.Core:if(null==e.conn){if(0===this.miscNodes.length){var t=Object(m.getRandomInt)(0,this.playerNodes.length-1);if(n=0===this.playerNodes.length?null:this.playerNodes[t],this.nodeReachableByEnemy(n))e.conn=this.jsplumbinstance.connect({source:e.el,target:n.el}),++n.targetedCount;else{if(t=Object(m.getRandomInt)(0,this.playerCores.length-1),0===this.playerCores.length)return;n=this.playerCores[t],this.nodeReachableByEnemy(n)&&(e.conn=this.jsplumbinstance.connect({source:e.el,target:n.el}),++n.targetedCount)}}else{t=Object(m.getRandomInt)(0,this.miscNodes.length-1);var n=this.miscNodes[t];this.nodeReachableByEnemy(n)&&(e.conn=this.jsplumbinstance.connect({source:e.el,target:n.el}),++n.targetedCount)}e.action=S}else{var r;null==(r=e.conn.target?this.getNodeFromElement(e.conn.target):this.getNodeFromElement(e.conn.targetId))&&console.error("Error getting Target node Object in enemyAISelectAction()"),r.def>this.enemyAtk+15?e.def<50?e.action=S:e.action=O:Math.abs(r.def-this.enemyAtk)<=15?e.action=C:e.action=k}break;case v.Transfer:e.def<125?e.action=S:e.action=O;break;case v.Firewall:case v.Shield:e.action=S}};M.prototype.calculateAttackDamage=function(e,t,n=0){return Math.max(.55*(e+n/80-t),1)},M.prototype.calculateScanEffect=function(e,t,n=0){return Math.max(.6*(e+n/25-.95*t),2)},M.prototype.calculateWeakenEffect=function(e,t,n=0){return Math.max(e+n/25-.95*t,2)},M.prototype.calculateFortifyEffect=function(e=0){return.9*e/130},M.prototype.calculateOverflowEffect=function(e=0){return.95*e/130},M.prototype.updateTimer=function(){var e=document.getElementById("hacking-mission-timer"),t=Math.round(this.time/1e3),n=Math.trunc(t/60);t%=60;var r=("0"+n).slice(-2)+":"+("0"+t).slice(-2);e.innerText="Time left: "+r},M.prototype.finishMission=function(e){if(f=!1,b=null,e){var t=1+this.faction.favor/100,n=this.reward*o.Player.faction_rep_mult*t;Object(s.dialogBoxCreate)(_.a.createElement(_.a.Fragment,null,"Mission won! You earned ",Object(c.Reputation)(n)," reputation with ",this.faction.name)),o.Player.gainIntelligenceExp(this.difficulty*r.CONSTANTS.IntelligenceHackingMissionBaseExpGain),this.faction.playerReputation+=n}else Object(s.dialogBoxCreate)("Mission lost/forfeited! You did not gain any faction reputation.");for(var l=document.getElementById("mission-container");l.firstChild;)l.removeChild(l.firstChild);document.getElementById("mainmenu-container").style.visibility="visible",document.getElementById("character-overview-wrapper").style.visibility="visible",a.Engine.loadFactionContent(),Object(i.displayFactionContent)(this.faction.name)}}).call(this,n(122))},,,,function(e,t,n){"use strict";(function(e){n.d(t,"b",function(){return g}),n.d(t,"a",function(){return y});var r=n(140),a=n(17),i=n(1),o=n(175),s=n(440),l=n(49),c=n(232),u=n(82),m=n(12),p=n(58),h=n(35),d=n(60);function _(e){return new Promise(function(t,n){var r=document.getElementById("red-pill-content"),a=document.createElement("p");r.appendChild(a),function e(t,n,r=0){return new Promise(function(a,i){Object(u.setTimeoutRef)(function(){if(r>=n.length){var o=n.substring(0,r);return t.innerHTML="> "+o,a(!0)}var o=n.substring(0,r);t.innerHTML="> "+o+" █ ";var s=e(t,n,r+1);s.then(function(e){a(e)},function(e){i(e)})},30)})}(a,e,0).then(function(e){t(e)},function(e){n(e)})})}let g=!1;function y(e,t=!1,n=!1){var r=document.getElementById("red-pill-content");return Object(d.removeChildrenFromElement)(r),g=!0,a.Engine.loadRedPillContent(),n?b(e,t,n):_("[ERROR] SEMPOOL INVALID").then(function(){return _("[ERROR] Segmentation Fault")}).then(function(){return _("[ERROR] SIGKILL RECVD")}).then(function(){return _("Dumping core...")}).then(function(){return _("0000 000016FA 174FEE40 29AC8239 384FEA88")}).then(function(){return _("0010 745F696E 2BBBE394 390E3940 248BEC23")}).then(function(){return _("0020 7124696B 0000FF69 74652E6F FFFF1111")}).then(function(){return _("----------------------------------------")}).then(function(){return _("Failsafe initiated...")}).then(function(){return _("Restarting BitNode-"+e+"...")}).then(function(){return _("...........")}).then(function(){return _("...........")}).then(function(){return _("[ERROR] FAILED TO AUTOMATICALLY REBOOT BITNODE")}).then(function(){return _("..............................................")}).then(function(){return _("..............................................")}).then(function(){return b(e,t)}).catch(function(e){console.error(e.toString())})}let f=[];function b(e,t=!1,n=!1){const a=document.getElementById("red-pill-content");Object(d.removeChildrenFromElement)(a),f=l.SourceFileFlags.slice(),t||f[e]<3&&++f[e];const i=document.createElement("pre"),o=[];for(let e=1;e<=12;++e)o.push(E(e));i.innerHTML=" O | O O | O O | O | | / __| \\ | | O O | O | | O / | O | | O | O | | | | |_/ |/ | \\_ \\_| | | | | O | | | O | | O__/ | / \\__ | | O | | | O | | | | | | | / /| O / \\| | | | | | | O | | | \\| | O / _/ | / O | |/ | | | O | | | |O / | | O / | O O | | \\ O| | | | | | |/ \\/ / __| | |/ \\ | \\ | |__ \\ \\/ \\| | | \\| O | |_/ |\\| \\ O \\__| \\_| | O |/ | | |_/ | | \\| / | \\_| | | \\| / \\| | / / \\ |/ | "+o[9]+" | | / | "+o[10]+" | "+o[8]+" | | | | | | | "+o[11]+" | | | / / \\ \\ | | | \\| | / "+o[6]+" / \\ "+o[7]+" \\ | |/ \\ | / / | | \\ \\ | / \\ \\JUMP "+o[4]+"3R | | | | | | R3"+o[5]+" PMUJ/ / \\|| | | | | | | | | ||/ \\| \\_ | | | | | | _/ |/ \\ \\| / \\ / \\ |/ / "+o[0]+" |/ "+o[1]+" | | "+o[2]+" \\| "+o[3]+" | | | | | | | | \\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/