mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-29 09:27:33 +01:00
Merge branch 'dev' into bugfix/2958
This commit is contained in:
commit
6f10d5f8bf
@ -43,7 +43,7 @@ module.exports = {
|
||||
curly: ["off"],
|
||||
"default-case": ["off"],
|
||||
"dot-notation": ["off"],
|
||||
"eol-last": ["off"],
|
||||
"eol-last": ["error"],
|
||||
eqeqeq: ["off"],
|
||||
"for-direction": ["error"],
|
||||
"func-call-spacing": ["off"],
|
||||
@ -236,7 +236,7 @@ module.exports = {
|
||||
"no-ternary": ["off"],
|
||||
"no-this-before-super": ["off"],
|
||||
"no-throw-literal": ["error"],
|
||||
"no-trailing-spaces": ["off"],
|
||||
"no-trailing-spaces": ["error"],
|
||||
"no-undef": ["off"],
|
||||
"no-undef-init": ["error"],
|
||||
"no-undefined": ["off"],
|
||||
|
1
CODE_OF_CONDUCT.md
Normal file
1
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1 @@
|
||||
Don't be an ass.
|
24
dist/bitburner.d.ts
vendored
24
dist/bitburner.d.ts
vendored
@ -958,6 +958,16 @@ export declare interface Corporation extends WarehouseAPI, OfficeAPI {
|
||||
* @param percent - Percent of profit to issue as dividends.
|
||||
*/
|
||||
issueDividends(percent: number): void;
|
||||
/**
|
||||
* Buyback Shares
|
||||
* @param amt - Number of shares to attempt to buyback.
|
||||
*/
|
||||
buyBackShares(amt: number): void;
|
||||
/**
|
||||
* Sell Shares
|
||||
* @param amt - Number of shares to attempt to sell.
|
||||
*/
|
||||
sellShares(amt: number): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3748,7 +3758,7 @@ export declare interface NS extends Singularity {
|
||||
* @remarks
|
||||
* RAM cost: 0.3 GB
|
||||
*
|
||||
* Running with no args returns curent script.
|
||||
* Running with no args returns current script.
|
||||
* If you use a PID as the first parameter, the hostname and args parameters are unnecessary.
|
||||
*
|
||||
* @param filename - Optional. Filename or PID of the script.
|
||||
@ -3905,7 +3915,7 @@ export declare interface NS extends Singularity {
|
||||
* @param data - Data to write.
|
||||
* @returns True if the data is successfully written to the port, and false otherwise.
|
||||
*/
|
||||
tryWritePort(port: number, data: string[] | number): Promise<boolean>;
|
||||
tryWritePort(port: number, data: string | number): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Read content of a file.
|
||||
@ -4807,7 +4817,7 @@ export declare interface Server {
|
||||
/** IP Address. Must be unique */
|
||||
ip: string;
|
||||
|
||||
/** Flag indicating whether player is curently connected to this server */
|
||||
/** Flag indicating whether player is currently connected to this server */
|
||||
isConnectedTo: boolean;
|
||||
|
||||
/** RAM (GB) available on this server */
|
||||
@ -6635,6 +6645,14 @@ export declare interface WarehouseAPI {
|
||||
* @param amt - Amount of material to buy
|
||||
*/
|
||||
buyMaterial(divisionName: string, cityName: string, materialName: string, amt: number): void;
|
||||
/**
|
||||
* Set material to bulk buy
|
||||
* @param divisionName - Name of the division
|
||||
* @param cityName - Name of the city
|
||||
* @param materialName - Name of the material
|
||||
* @param amt - Amount of material to buy
|
||||
*/
|
||||
bulkPurchase(divisionName: string, cityName: string, materialName: string, amt: number): void;
|
||||
/**
|
||||
* Get warehouse data
|
||||
* @param divisionName - Name of the division
|
||||
|
36
dist/vendor.bundle.js
vendored
36
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/vendor.bundle.js.map
vendored
2
dist/vendor.bundle.js.map
vendored
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
||||
|
||||
Augmentations
|
||||
=============
|
||||
Advances in science and medicine have lead to powerful new technologies
|
||||
Advances in science and medicine have led to powerful new technologies
|
||||
that allow people to augment themselves beyond normal human capabilities.
|
||||
There are many different types of Augmentations, ranging from cybernetic
|
||||
to genetic to biological. Acquiring these Augmentations enhances the
|
||||
|
@ -215,6 +215,7 @@ The list contains the name of (i.e. the value returned by
|
||||
| | | The answer should be provided as an array of strings containing the valid expressions. |
|
||||
| | | |
|
||||
| | | NOTE: Numbers in an expression cannot have leading 0's |
|
||||
| | | NOTE: The order of evaluation expects script operator precedence |
|
||||
| | | |
|
||||
| | | Examples: |
|
||||
| | | Input: digits = "123", target = 6 |
|
||||
|
@ -7,6 +7,16 @@ these companies, you can apply for jobs.
|
||||
|
||||
Working a job lets you earn money, experience, and reputation with that company.
|
||||
|
||||
While working for a company, you can click "Do something else simultaneously" to be able
|
||||
to do things while you continue to work in the background. There is a 20% penalty to the
|
||||
related gains. Clicking the "Focus" button under the overview will return you to the
|
||||
current work.
|
||||
|
||||
Reputation is required to apply for a promotion. This reputation is not counted towards
|
||||
your career until the shift ends, either due to the time spent or clicking the
|
||||
"Stop Working" button. For most jobs there is a penalty of 50% of the reputation gained
|
||||
if you stop your shift early.
|
||||
|
||||
Information about all Companies
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
TODO
|
||||
|
@ -107,3 +107,14 @@ starting security, rounded to the nearest integer. To be more precise::
|
||||
|
||||
This means that a server's security level will not fall below this
|
||||
value if you are trying to weaken() it.
|
||||
|
||||
Backdoors
|
||||
^^^^^^^^^
|
||||
Servers that can be hacked can also have backdoors installed. These backdoors
|
||||
will provide you with a benefit; the services may be cheaper, penalties may
|
||||
be reduced or there may be other results. Honeypots exist and will let factions
|
||||
know when you have succeeded at backdooring their system. Once you have a
|
||||
backdoor installed, you can connect to that server directly.
|
||||
|
||||
When you visit a location in the city and see that the name is partially scrambled,
|
||||
this indicates that you have backdoored the server related to the location.
|
||||
|
@ -3,6 +3,182 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
v1.5.0 - Steam Cloud integration
|
||||
--------------------------------
|
||||
|
||||
** Steam Cloud Saving **
|
||||
|
||||
* Added support for steam cloud saving (@MartinFournier)
|
||||
|
||||
** UI **
|
||||
|
||||
* background now matches game primary color (@nickofolas)
|
||||
* page title contains version (@MartinFourier)
|
||||
* Major text editor improvements (@nickofolas)
|
||||
* Display bonus time on sleeve page (@MartinFourier)
|
||||
* Several UI improvements (@nickofolas, @smolgumball, @DrCuriosity, @phyzical)
|
||||
* Fix aug display in alpha (@Dominik Winter)
|
||||
* Fix display of corporation product equation (@SagePtr)
|
||||
* Make Bitverse more accessible (@ChrissiQ)
|
||||
* Make corporation warehouse more accessible (@ChrissiQ)
|
||||
* Make tab style more consistent (@nikfolas)
|
||||
|
||||
** Netscript **
|
||||
|
||||
* Fix bug with async.
|
||||
* Add 'printf' ns function (@Ninetailed)
|
||||
* Remove blob caching.
|
||||
* Fix formulas access check (@Ornedan)
|
||||
* Fix bug in exp calculation (@qcorradi)
|
||||
* Fix NaN comparison (@qcorradi)
|
||||
* Fix travelToCity with bad argument (@SlyCedix)
|
||||
* Fix bug where augs could not be purchased via sing (@reacocard)
|
||||
* Fix rounding error in donateToFaction (@Risenafis)
|
||||
* Fix bug with weakenAnalyze (@rhobes)
|
||||
* Prevent exploit with atExit (@Ornedan)
|
||||
* Double 'share' power
|
||||
|
||||
** Corporations **
|
||||
|
||||
* Fix bugs with corp API (@pigalot)
|
||||
* Add smart supply func to corp API (@pd)
|
||||
|
||||
** Misc. **
|
||||
|
||||
* The file API now allows GET and DELETE (@lordducky)
|
||||
* Force achievement calculation on BN completion (@SagePtr)
|
||||
* Cleanup in repository (@MartinFourier)
|
||||
* Several improvements to the electron version (@MartinFourier)
|
||||
* Fix bug with casino roulette (@jamie-mac)
|
||||
* Terminal history persists in savefile (@MartinFourier)
|
||||
* Fix tests (@jamie-mac)
|
||||
* Fix crash with electron windows tracker (@smolgumball)
|
||||
* Fix BN6/7 passive reputation gain (@BrianLDev)
|
||||
* Fix Sleeve not resetting on install (@waffleattack)
|
||||
* Sort joined factions (@jjayeon)
|
||||
* Update documentation / typo (@lethern, @Meowdoleon, @JohnnyUrosevic, @JosephDavidTalbot,
|
||||
@pd, @lethern, @lordducky, @zeddrak, @fearnlj01, @reasonablytall, @MatthewTh0,
|
||||
@SagePtr, @manniL, @Jedimaster4559, @loganville, @Arrow2thekn33, @wdpk, @fwolfst,
|
||||
@fschoenfeldt, @Waladil, @AdamTReineke, @citrusmunch, @factubsio, @ashtongreen,
|
||||
@ChrissiQ, @DJ-Laser, @waffleattack, @ApamNapat, @CrafterKolyan, @DSteve595)
|
||||
* Nerf noodle bar.
|
||||
|
||||
v1.4.0 - 2022-01-18 Sharing is caring
|
||||
-------------------------------------
|
||||
|
||||
** Computer sharing **
|
||||
|
||||
* A new mechanic has been added, it's is invoked by calling the new function 'share'.
|
||||
This mechanic helps you farm reputation faster.
|
||||
|
||||
** gang **
|
||||
|
||||
* Installing augs means losing a little bit of ascension multipliers.
|
||||
|
||||
** Misc. **
|
||||
|
||||
* Prevent gang API from performing actions for the type of gang they are not. (@TheMas3212)
|
||||
* Fix donation to gang faction. (@TheMas3212)
|
||||
* Fix gang check crashing the game. (@TheMas3212)
|
||||
* Make time compression more robust.
|
||||
* Fix bug with scp.
|
||||
* Add zoom to steam version. (@MartinFourier)
|
||||
* Fix donateToFaction accepts donation of NaN. (@woody-lam-cwl)
|
||||
* Show correct hash capacity gain on cache level upgrade tooltip. (@woody-lam-cwl)
|
||||
* Fix tests (@woody-lam-cwl)
|
||||
* Fix cache tooltip (@woody-lam-cwl)
|
||||
* Added script to prettify save file for debugging (@MartinFourier)
|
||||
* Update documentation / typos (@theit8514, @thadguidry, @tigercat2000, @SlyCedix, @Spacejoker, @KenJohansson,
|
||||
@Ornedan, @JustAnOkapi, @nickofolas, @philarmstead, @TheMas3212, @dcragusa, @XxKingsxX-Pinu,
|
||||
@paiv, @smolgumball, @zeddrak, @stinky-lizard, @nickofolas, @Feodoric, @daanflore,
|
||||
@markusariliu, @mstruebing, @erplsf, @waffleattack, @Dexalt142, @AIT-OLPE, @deathly809, @BuckAMayzing,
|
||||
@MartinFourier, @pigalot, @lethern)
|
||||
* Fix BN3+ achievement (@SagePtr)
|
||||
* Fix reputation carry over bug (@TheMas3212)
|
||||
* Add button to exit infiltrations (@TheMas3212)
|
||||
* Add dev menu achievement check (@TheMas3212)
|
||||
* Add 'host' config for electron server (@MartinFourier)
|
||||
* Suppress save toast only works for autosave (@MartinFourier)
|
||||
* Fix some achievements not triggering with 'backdoor' (@SagePtr)
|
||||
* Update Neuroflux Governor description.
|
||||
* Fix bug with electron server.
|
||||
* Fix bug with corporation employee assignment function (@Ornedan)
|
||||
* Add detailed information to terminal 'mem' command (@MartinFourier)
|
||||
* Add savestamp to savefile (@MartinFourier)
|
||||
* Dev menu can apply export bonus (@MartinFourier)
|
||||
* Icarus message no longer applies on top of itself (@Feodoric)
|
||||
* purchase augment via API can no longer buy Neuroflux when it shouldn't (@Feodoric)
|
||||
* Syntax highlighter should be smarter (@neuralsim)
|
||||
* Fix some miscalculation when calculating money stolen (@zeddrak)
|
||||
* Fix max cache achievement working with 0 cache (@MartinFourier)
|
||||
* Add achievements in the game, not just steam (@MartinFourier)
|
||||
* Overflow hash converts to money automatically (@MartinFourier)
|
||||
* Make mathjax load locally (@MartinFourier)
|
||||
* Make favor calculation more efficient (@kittycat2002)
|
||||
* Fix some scripts crashing the game on startup (@MartinFourier)
|
||||
* Toasts will appear above tail window (@MartinFourier)
|
||||
* Fix issue that can cause terminal actions to start on one server and end on another (@MartinFourier)
|
||||
* Fix 'fileExists' not correctly matching file names (@TheMas3212)
|
||||
* Refactor some code to be more efficient (@TheMas3212)
|
||||
* Fix exp gain for terminal grow and weaken (@nickofolas)
|
||||
* Refactor script death code to reject waiting promises instead of resolving (@Ornedan)
|
||||
* HP recalculates on defense exp gain (@TheMas3212)
|
||||
* Fix log for ascendMember (@TheMas3212)
|
||||
* Netscript ports clear on reset (@TheMas3212)
|
||||
* Fix bug related to company (@TheMas3212)
|
||||
* Fix bug where corporation handbook would not be correctly added (@TheMas3212)
|
||||
* Servers in hash upgrades are sorted alpha (@MartinFourier)
|
||||
* Fix very old save not properly migrating augmentation renamed in 0.56 (@MartinFourier)
|
||||
* Add font height and line height in theme settings (@MartinFourier)
|
||||
* Fix crash when quitting job (@MartinFourier)
|
||||
* Added save file validation system (@TheMas3212)
|
||||
* React and ReactDOM are now global objects (@pigalot)
|
||||
* 'nano' supports globs (@smolgumball)
|
||||
* Character overview can be dragged (@MartinFourier)
|
||||
* Job page updates in real time (@nickofolas)
|
||||
* Company favor gain uses the same calculation as faction, this is just performance
|
||||
the value didn't change (@nickofolas)
|
||||
* ns2 files work with more import options (@theit8514)
|
||||
* Allow autocomplete for partial executables (@nickofolas)
|
||||
* Add support for contract completion (@nickofolas)
|
||||
* 'ls' link are clickable (@smolgumball)
|
||||
* Prevent steam from opening external LOCAL files (@MartinFourier)
|
||||
* Fix a bug with autocomplete (@Feodoric)
|
||||
* Optimise achievement checks (@Feodoric)
|
||||
* Hacknet server achievements grant associated hacknet node achievement (@Feodoric)
|
||||
* Fix display bug with hacknet (@Feodoric)
|
||||
* 'analyze' now says if the server is backdoored (@deathly809)
|
||||
* Add option to exclude running script from save (@MartinFourier)
|
||||
* Game now catches more errors and redirects to recovery page (@MartinFourier)
|
||||
* Fix bug with autocomplete (@nickofolas)
|
||||
* Add tooltip to unfocus work (@nickofolas)
|
||||
* Add detailst overview (@MartinFourier)
|
||||
* Fix focus bug (@deathly809)
|
||||
* Fix some NaN handling (@deathly809)
|
||||
* Added 'mv' ns function (@deathly809)
|
||||
* Add focus argument to some singularity functions (@nickofolas)
|
||||
* Fix some functions not disabling log correctly (@deathly809)
|
||||
* General UI improvements (@nickofolas)
|
||||
* Handle steamworks errors gravefully (@MartinFourier)
|
||||
* Fix some react component not unmounting correctly (@MartinFourier)
|
||||
* 'help' autocompletes (@nickofolas)
|
||||
* No longer push all achievements to steam (@Ornedan)
|
||||
* Recovery page has more information (@MartinFourier)
|
||||
* Added 'getGameInfo' ns function (@MartinFourier)
|
||||
* SF3.3 unlocks all corp API (@pigalot)
|
||||
* Major improvements to corp API (@pigalot)
|
||||
* Prevent seed money outside BN3 (@pigalot)
|
||||
* Fix bug where using keyboard shortcuts would crash if the feature is not available (@MartinFourier)\
|
||||
* Sidebar remains opened/closed on save (@MartinFourier)
|
||||
* Added tooltip to sidebar when closed (@MartinFourier)
|
||||
* Fix bug where Formulas.exe is not available when starting BN5 (@TheMas3212)
|
||||
* Fix CI (@tvanderpol)
|
||||
* Change shortcuts to match sidebar (@MartinFourier)
|
||||
* Format gang respect (@attrib)
|
||||
* Add modal to text editor with ram details (@nickofolas)
|
||||
* Fix several bugs with singularity focus (@nickofolas)
|
||||
* Nerf noodle bar.
|
||||
|
||||
v1.3.0 - 2022-01-04 Cleaning up
|
||||
-------------------------------
|
||||
|
||||
|
@ -64,9 +64,9 @@ documentation_title = '{0} Documentation'.format(project)
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '1.3'
|
||||
version = '1.5'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.3.0'
|
||||
release = '1.5.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
@ -117,7 +117,7 @@ Source-File
|
||||
:Max Level: 3
|
||||
|
||||
This Source-File lets you access and use the Singularity Functions in other BitNodes.
|
||||
Each level of this Source-File will open up more Singularity Functions that you can use.
|
||||
Each level of this Source-File will reduce RAM costs.
|
||||
|
||||
Difficulty:
|
||||
Depending on what Source-Files you have unlocked before attempting this BitNode,
|
||||
|
@ -312,6 +312,16 @@ function getMenu(window) {
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Reset Zoom",
|
||||
enabled: utils.getZoomFactor() !== 1,
|
||||
accelerator: "CommandOrControl+num0",
|
||||
click: () => {
|
||||
utils.setZoomFactor(window, 1);
|
||||
refreshMenu(window);
|
||||
log.log("Reset zoom");
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -29,6 +29,11 @@ const windowTracker = (windowName) => {
|
||||
};
|
||||
|
||||
const saveState = debounce(() => {
|
||||
if (!window || window.isDestroyed()) {
|
||||
log.silly(`Saving window state failed because window is not available`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!windowState.isMaximized) {
|
||||
windowState = window.getBounds();
|
||||
}
|
||||
@ -41,7 +46,7 @@ const windowTracker = (windowName) => {
|
||||
|
||||
const track = (win) => {
|
||||
window = win;
|
||||
['resize', 'move', 'close'].forEach((event) => {
|
||||
["resize", "move", "close"].forEach((event) => {
|
||||
win.on(event, saveState);
|
||||
});
|
||||
};
|
||||
|
@ -73,5 +73,5 @@
|
||||
<link rel="shortcut icon" href="favicon.ico"></head>
|
||||
<body>
|
||||
<div id="root"/>
|
||||
<script type="text/javascript" src="dist/vendor.bundle.js"></script><script type="text/javascript" src="dist/main.bundle.js"></script></body>
|
||||
<script type="text/javascript" src="dist/vendor.bundle.js"></script><script type="text/javascript" src="main.bundle.js"></script></body>
|
||||
</html>
|
||||
|
137
license.txt
137
license.txt
@ -1,85 +1,88 @@
|
||||
LIMITED USE SOFTWARE LICENSE AGREEMENT
|
||||
“Commons Clause” License Condition v1.0
|
||||
|
||||
This Limited Use Software License Agreement (the "Agreement") is a legal agreement between you, the end-user, and Daniel Y Xie,
|
||||
the creator of the software, hereafter referred to as the Creator.
|
||||
The Software is provided to you by the Licensor under the License, as defined below, subject to the following condition.
|
||||
|
||||
By downloading or purchasing the software material, which includes source code (the "Source Code"), artwork data, music and software
|
||||
tools (collectively, the "Software"), you are agreeing to be bound by the terms of this Agreement. If you do not agree to the terms
|
||||
of this Agreement, promptly destroy the Software you may have downloaded or copied.
|
||||
Without limiting other conditions in the License, the grant of rights under the License will not include, and the License does not grant to you, the right to Sell the Software.
|
||||
|
||||
SOFTWARE LICENSE
|
||||
For purposes of the foregoing, “Sell” means practicing any or all of the rights granted to you under the License to provide to third parties, for a fee or other consideration (including without limitation fees for hosting or consulting/ support services related to the Software), a product or service whose value derives, entirely or substantially, from the functionality of the Software. Any license notice or attribution required by the License must also include this Commons Clause License Condition notice.
|
||||
|
||||
1. Grant of License. The Creator grants to you the right to use the Software. You have no ownership or proprietary rights in or to
|
||||
the Software, or the Trademark. For purposes of this section, "use" means loading the Software into RAM, as well as installation
|
||||
on a hard disk or other storage device. The Software, together with any archive copy thereof, shall be destroyed when no longer
|
||||
used in accordance with this Agreement, or when the right to use the Software is terminated. You agree that the Software will not
|
||||
be shipped, transferred or exported into any country in violation of the U.S. Export Administration Act (or any other law governing
|
||||
such matters) and that you will not utilize, in any other manner, the Software in violation of any applicable law.
|
||||
Software: Bitburner
|
||||
|
||||
2. Permitted Uses.
|
||||
License: Apache 2.0 with Commons Clause
|
||||
|
||||
You may copy and distribute literal (i.e., verbatim) or modified copies of the Software's source code.
|
||||
You must meet all of the following conditions with respect to any work that you distribute or publish that in whole or in part
|
||||
contains or is derived from the Software or any part thereof:
|
||||
Licensor: Daniel Y Xie
|
||||
|
||||
(a) The distributed Software may not be used in any way for commercial gain and must not violate any of the restrictions
|
||||
set forth in Section 3.
|
||||
(b) If you have modified the Software, you must cause the modified Software to carry prominent notices stating that
|
||||
you have modified the Software's files. Modifications must not alter or remove any copyright notices in the Software.
|
||||
(c) The distributed Software must include either a written copy of this License, or a prominent written indication that
|
||||
the Software is covered by this License and written instructions for printing and/or displaying the copy of the License
|
||||
on the distribution medium
|
||||
(d) When modifications to the Software are released under this license, a non-exclusive royalty-free right is granted to
|
||||
the initial developer of the Software to distribute your modification in future versions of the Software provided
|
||||
such versions remain available under these terms in addition to any other license(s) of the initial developer.
|
||||
(d) You may not impose any further restrictions on the recipient's exercise of the rights granted herein.
|
||||
-------------------------------------------------------------------
|
||||
|
||||
For educational purposes only, you, the end-user, may use portions of the Source Code, such as particular
|
||||
routines, to develop your own software, but may not duplicate the Source Code. The limited
|
||||
right referenced in the preceding sentence is hereinafter referred to as "Educational Use." By so exercising the Educational
|
||||
Use right you shall not obtain any ownership, copyright, proprietary or other interest in or to the Source Code, or any portion
|
||||
of the Source Code. You may dispose of your own software in your sole discretion. When exercising the Educational Use right,
|
||||
you may not use or exploit the Software, or any portion of the Software, which includes the Source Code, for commercial gain.
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
3. Prohibited Uses: Under no circumstances shall you, the end-user, be permitted, allowed or authorized to commercially
|
||||
exploit the Software or any work that in whole or in part contains or is derived from the Software or any part thereof.
|
||||
Neither you nor anyone at your direction shall do any of the following acts with regard to the Software,
|
||||
or any portion thereof:
|
||||
Definitions.
|
||||
|
||||
Rent;
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
Sell;
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
Lease;
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
Offer on a pay-per-play basis;
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
Distribute for money or any other consideration; or
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
In any other manner and through any medium whatsoever commercially exploit or use for any commercial purpose.
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
4. Copyright. The Software and all copyrights related thereto (including all characters and other images generated by the
|
||||
Software or depicted in the Software) are owned by the Creator and is protected by United States copyright laws and international treaty
|
||||
provisions. The Creator shall retain exclusive ownership and copyright in and to the Software and all portions of the Software and you
|
||||
shall have no ownership or other proprietary interest in such materials. You must treat the Software like any other copyrighted
|
||||
material. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License.
|
||||
You may not otherwise reproduce, copy or disclose to others, in whole or in any part, the Software. You may not copy the
|
||||
written materials accompanying the Software. You agree to use your best efforts to see that any user of the Software licensed
|
||||
hereunder complies with this Agreement.
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
5. NO WARRANTIES. The Creator DISCLAIMS ALL WARRANTIES, BOTH EXPRESS IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC
|
||||
LEGAL RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO JURISDICTION. the Creator DOES NOT WARRANT THAT THE OPERATION
|
||||
OF THE SOFTWARE WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR SPECIFIC REQUIREMENTS. THE WARRANTY SET FORTH ABOVE IS IN LIEU
|
||||
OF ALL OTHER EXPRESS WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES, DISTRIBUTORS, AND DEALERS OF THE CREATOR ARE NOT AUTHORIZED
|
||||
TO MAKE MODIFICATIONS TO THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF OF THE CREATOR.
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
Exclusive Remedies. The Software is being offered to you free of any charge. You agree that you have no remedy against the creator,
|
||||
its affiliates, contractors, suppliers, and agents for loss or damage caused by any defect or failure in the Software regardless
|
||||
of the form of action, whether in contract, tort, includinegligence, strict liability or otherwise, with regard to the Software.
|
||||
This Agreement shall be construed in accordance with and governed by the laws of the State of Texas. Copyright and other
|
||||
proprietary matters will be governed by United States laws and international treaties. IN ANY CASE, THE CREATOR SHALL NOT BE LIABLE
|
||||
FOR LOSS OF DATA, LOSS OF PROFITS, LOST SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER SIMILAR DAMAGES ARISING
|
||||
FROM BREACH OF WARRANTY, BREACH OF CONTRACT, NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF THE CREATOR OR ITS AGENT HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. Some jurisdictions do not allow the exclusion or limitation of
|
||||
incidental or consequential damages, so the above limitation or exclusion may not apply to you.
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2022 Daniel Y Xie
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
20
main.bundle.js
Normal file
20
main.bundle.js
Normal file
File diff suppressed because one or more lines are too long
1
main.bundle.js.map
Normal file
1
main.bundle.js.map
Normal file
File diff suppressed because one or more lines are too long
24
markdown/bitburner.corporation.buybackshares.md
Normal file
24
markdown/bitburner.corporation.buybackshares.md
Normal file
@ -0,0 +1,24 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [buyBackShares](./bitburner.corporation.buybackshares.md)
|
||||
|
||||
## Corporation.buyBackShares() method
|
||||
|
||||
Buyback Shares
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
buyBackShares(amount: number): void;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| amount | number | Amount of shares to buy back. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
void
|
||||
|
@ -19,6 +19,7 @@ export interface Corporation extends WarehouseAPI, OfficeAPI
|
||||
| --- | --- |
|
||||
| [acceptInvestmentOffer()](./bitburner.corporation.acceptinvestmentoffer.md) | Accept investment based on you companies current valuation |
|
||||
| [bribe(factionName, amountCash, amountShares)](./bitburner.corporation.bribe.md) | Bribe a faction |
|
||||
| [buyBackShares(amount)](./bitburner.corporation.buybackshares.md) | Buyback Shares |
|
||||
| [createCorporation(corporationName, selfFund)](./bitburner.corporation.createcorporation.md) | Create a Corporation |
|
||||
| [expandCity(divisionName, cityName)](./bitburner.corporation.expandcity.md) | Expand to a new city |
|
||||
| [expandIndustry(industryType, divisionName)](./bitburner.corporation.expandindustry.md) | Expand to a new industry |
|
||||
@ -34,5 +35,6 @@ export interface Corporation extends WarehouseAPI, OfficeAPI
|
||||
| [hasUnlockUpgrade(upgradeName)](./bitburner.corporation.hasunlockupgrade.md) | Check if you have a one time unlockable upgrade |
|
||||
| [issueDividends(percent)](./bitburner.corporation.issuedividends.md) | Issue dividends |
|
||||
| [levelUpgrade(upgradeName)](./bitburner.corporation.levelupgrade.md) | Level an upgrade. |
|
||||
| [sellShares(amount)](./bitburner.corporation.sellshares.md) | Sell Shares |
|
||||
| [unlockUpgrade(upgradeName)](./bitburner.corporation.unlockupgrade.md) | Unlock an upgrade |
|
||||
|
||||
|
24
markdown/bitburner.corporation.sellshares.md
Normal file
24
markdown/bitburner.corporation.sellshares.md
Normal file
@ -0,0 +1,24 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [sellShares](./bitburner.corporation.sellshares.md)
|
||||
|
||||
## Corporation.sellShares() method
|
||||
|
||||
Sell Shares
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
sellShares(amount: number): void;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| amount | number | Amount of shares to sell. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
void
|
||||
|
27
markdown/bitburner.warehouseapi.bulkpurchase.md
Normal file
27
markdown/bitburner.warehouseapi.bulkpurchase.md
Normal file
@ -0,0 +1,27 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [WarehouseAPI](./bitburner.warehouseapi.md) > [bulkPurchase](./bitburner.warehouseapi.bulkpurchase.md)
|
||||
|
||||
## WarehouseAPI.bulkPurchase() method
|
||||
|
||||
Set material to bulk buy
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
bulkPurchase(divisionName: string, cityName: string, materialName: string, amt: number): void;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| divisionName | string | Name of the division |
|
||||
| cityName | string | Name of the city |
|
||||
| materialName | string | Name of the material |
|
||||
| amt | number | Amount of material to buy |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
void
|
||||
|
29
package-lock.json
generated
29
package-lock.json
generated
@ -1,11 +1,12 @@
|
||||
{
|
||||
"name": "bitburner",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "1.3.0",
|
||||
"name": "bitburner",
|
||||
"version": "1.4.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "SEE LICENSE IN license.txt",
|
||||
"dependencies": {
|
||||
@ -9645,9 +9646,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.14.7",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
|
||||
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
|
||||
"version": "1.14.8",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz",
|
||||
"integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@ -20380,9 +20381,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/url-parse": {
|
||||
"version": "1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz",
|
||||
"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==",
|
||||
"version": "1.5.10",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"querystringify": "^2.1.1",
|
||||
@ -29959,9 +29960,9 @@
|
||||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.14.7",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
|
||||
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
|
||||
"version": "1.14.8",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz",
|
||||
"integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==",
|
||||
"dev": true
|
||||
},
|
||||
"for-in": {
|
||||
@ -38392,9 +38393,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"url-parse": {
|
||||
"version": "1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz",
|
||||
"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==",
|
||||
"version": "1.5.10",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"querystringify": "^2.1.1",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "bitburner",
|
||||
"license": "SEE LICENSE IN license.txt",
|
||||
"version": "1.3.0",
|
||||
"version": "1.5.0",
|
||||
"main": "electron-main.js",
|
||||
"author": {
|
||||
"name": "Daniel Xie & Olivier Gagnon"
|
||||
@ -114,6 +114,7 @@
|
||||
"lint": "eslint --fix . --ext js,jsx,ts,tsx",
|
||||
"lint:report": "eslint --ext js,jsx,ts,tsx .",
|
||||
"preinstall": "node ./tools/engines-check/engines-check.js",
|
||||
"postinstall": "cd electron && npm install",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"watch": "webpack --watch --mode production",
|
||||
@ -124,6 +125,6 @@
|
||||
"electron:packager-win": "electron-packager .package bitburner --platform win32 --arch x64 --out .build --overwrite --icon .package/icon.png",
|
||||
"electron:packager-mac": "electron-packager .package bitburner --platform darwin --arch x64 --out .build --overwrite --icon .package/icon.png",
|
||||
"electron:packager-linux": "electron-packager .package bitburner --platform linux --arch x64 --out .build --overwrite --icon .package/icon.png",
|
||||
"allbuild": "npm run build && npm run electron && git add --all && git commit --amend --no-edit && git push -f -u origin dev"
|
||||
"allbuild": "npm run build && npm run electron && git add --all && git commit -m \"allbuild commit $(which git)\" && git push -f -u origin dev"
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ export function printAliases(): void {
|
||||
|
||||
// Returns true if successful, false otherwise
|
||||
export function parseAliasDeclaration(dec: string, global = false): boolean {
|
||||
const re = /^([\w|!|%|,|@|-]+)=(("(.+)")|('(.+)'))$/;
|
||||
const re = /^([\w|!%,@-]+)=(("(.+)")|('(.+)'))$/;
|
||||
const matches = dec.match(re);
|
||||
if (matches == null || matches.length != 7) {
|
||||
return false;
|
||||
|
@ -2598,12 +2598,7 @@ function augmentationExists(name: string): boolean {
|
||||
|
||||
export function isRepeatableAug(aug: Augmentation): boolean {
|
||||
const augName = aug instanceof Augmentation ? aug.name : aug;
|
||||
|
||||
if (augName === AugmentationNames.NeuroFluxGovernor) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return augName === AugmentationNames.NeuroFluxGovernor;
|
||||
}
|
||||
|
||||
export { installAugmentations, initAugmentations, applyAugmentation, augmentationExists };
|
||||
|
@ -110,7 +110,7 @@ export function AugmentationsRoot(props: IProps): React.ReactElement {
|
||||
<br />
|
||||
<br />
|
||||
It is recommended to install several Augmentations at once. Preferably everything from any faction of your
|
||||
chosing.
|
||||
choosing.
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
@ -8,8 +8,8 @@
|
||||
import React, { useState } from "react";
|
||||
|
||||
import { AugmentationAccordion } from "../../ui/React/AugmentationAccordion";
|
||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
||||
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||
import { Augmentations } from "../Augmentations";
|
||||
import { AugmentationNames } from "../data/AugmentationNames";
|
||||
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { use } from "../../ui/Context";
|
||||
|
@ -4,8 +4,8 @@
|
||||
*/
|
||||
import * as React from "react";
|
||||
|
||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
||||
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||
import { Augmentations } from "../Augmentations";
|
||||
import { AugmentationNames } from "../data/AugmentationNames";
|
||||
import { Player } from "../../Player";
|
||||
|
||||
import { AugmentationAccordion } from "../../ui/React/AugmentationAccordion";
|
||||
|
@ -670,7 +670,6 @@ export function initBitNodeMultipliers(p: IPlayer): void {
|
||||
BitNodeMultipliers.InfiltrationMoney = 0.75;
|
||||
BitNodeMultipliers.CorporationValuation = 0.2;
|
||||
BitNodeMultipliers.HacknetNodeMoney = 0.2;
|
||||
BitNodeMultipliers.FactionPassiveRepGain = 0;
|
||||
BitNodeMultipliers.HackExpGain = 0.25;
|
||||
BitNodeMultipliers.DaedalusAugsRequirement = 1.166; // Results in 35 Augs needed
|
||||
BitNodeMultipliers.PurchasedServerSoftcap = 2;
|
||||
@ -694,7 +693,6 @@ export function initBitNodeMultipliers(p: IPlayer): void {
|
||||
BitNodeMultipliers.InfiltrationMoney = 0.75;
|
||||
BitNodeMultipliers.CorporationValuation = 0.2;
|
||||
BitNodeMultipliers.HacknetNodeMoney = 0.2;
|
||||
BitNodeMultipliers.FactionPassiveRepGain = 0;
|
||||
BitNodeMultipliers.HackExpGain = 0.25;
|
||||
BitNodeMultipliers.FourSigmaMarketDataCost = 2;
|
||||
BitNodeMultipliers.FourSigmaMarketDataApiCost = 2;
|
||||
|
@ -8,38 +8,37 @@ import { CinematicText } from "../../ui/React/CinematicText";
|
||||
import { use } from "../../ui/Context";
|
||||
import makeStyles from "@mui/styles/makeStyles";
|
||||
import createStyles from "@mui/styles/createStyles";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import Button from "@mui/material/Button";
|
||||
|
||||
|
||||
const useStyles = makeStyles(() =>
|
||||
createStyles({
|
||||
level0: {
|
||||
color: "red",
|
||||
portal: {
|
||||
cursor: "pointer",
|
||||
fontFamily: "inherit",
|
||||
fontSize: "1rem",
|
||||
fontWeight: "bold",
|
||||
lineHeight: 1,
|
||||
padding: 0,
|
||||
"&:hover": {
|
||||
color: "#fff",
|
||||
},
|
||||
},
|
||||
level0: {
|
||||
color: "red",
|
||||
},
|
||||
level1: {
|
||||
color: "yellow",
|
||||
cursor: "pointer",
|
||||
"&:hover": {
|
||||
color: "#fff",
|
||||
},
|
||||
},
|
||||
level2: {
|
||||
color: "#48d1cc",
|
||||
cursor: "pointer",
|
||||
"&:hover": {
|
||||
color: "#fff",
|
||||
},
|
||||
},
|
||||
level3: {
|
||||
color: "blue",
|
||||
cursor: "pointer",
|
||||
"&:hover": {
|
||||
color: "#fff",
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
@ -71,6 +70,7 @@ function BitNodePortal(props: IPortalProps): React.ReactElement {
|
||||
if (props.level === 2) {
|
||||
cssClass = classes.level2;
|
||||
}
|
||||
cssClass = `${classes.portal} ${cssClass}`
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -85,9 +85,24 @@ function BitNodePortal(props: IPortalProps): React.ReactElement {
|
||||
</Typography>
|
||||
}
|
||||
>
|
||||
<span onClick={() => setPortalOpen(true)} className={cssClass} aria-label={`enter-bitnode-${bitNode.number.toString()}`}>
|
||||
<b>O</b>
|
||||
</span>
|
||||
{Settings.DisableASCIIArt ? (
|
||||
<Button
|
||||
onClick={() => setPortalOpen(true)}
|
||||
sx={{ m: 2 }}
|
||||
aria-description={bitNode.desc}
|
||||
>
|
||||
<Typography>BitNode-{bitNode.number.toString()}: {bitNode.name}</Typography>
|
||||
</Button>
|
||||
) : (
|
||||
<IconButton
|
||||
onClick={() => setPortalOpen(true)}
|
||||
className={cssClass}
|
||||
aria-label={`BitNode-${bitNode.number.toString()}: ${bitNode.name}`}
|
||||
aria-description={bitNode.desc}
|
||||
>
|
||||
O
|
||||
</IconButton>
|
||||
)}
|
||||
</Tooltip>
|
||||
<PortalModal
|
||||
open={portalOpen}
|
||||
@ -98,6 +113,10 @@ function BitNodePortal(props: IPortalProps): React.ReactElement {
|
||||
destroyedBitNode={props.destroyedBitNode}
|
||||
flume={props.flume}
|
||||
/>
|
||||
|
||||
{Settings.DisableASCIIArt && (
|
||||
<br/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -113,7 +132,7 @@ export function BitverseRoot(props: IProps): React.ReactElement {
|
||||
const player = use.Player();
|
||||
const enter = enterBitNode;
|
||||
const destroyed = player.bitNodeN;
|
||||
const [destroySequence, setDestroySequence] = useState(true && !props.quick);
|
||||
const [destroySequence, setDestroySequence] = useState(!props.quick);
|
||||
|
||||
// Update NextSourceFileFlags
|
||||
const nextSourceFileFlags = SourceFileFlags.slice();
|
||||
@ -151,63 +170,104 @@ export function BitverseRoot(props: IProps): React.ReactElement {
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
if (Settings.DisableASCIIArt) {
|
||||
return (
|
||||
<>
|
||||
{Object.values(BitNodes).filter((node) => {
|
||||
console.log(node.desc);
|
||||
return node.desc !== 'COMING SOON';
|
||||
}).map((node) => {
|
||||
return (
|
||||
<BitNodePortal key={node.number} n={node.number} level={nextSourceFileFlags[node.number]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} />
|
||||
)
|
||||
})}
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<CinematicText lines={[
|
||||
"> Many decades ago, a humanoid extraterrestrial species which we call the Enders descended on the Earth...violently",
|
||||
"> Our species fought back, but it was futile. The Enders had technology far beyond our own...",
|
||||
"> Instead of killing every last one of us, the human race was enslaved...",
|
||||
"> We were shackled in a digital world, chained into a prison for our minds...",
|
||||
"> Using their advanced technology, the Enders created complex simulations of a virtual reality...",
|
||||
"> Simulations designed to keep us content...ignorant of the truth.",
|
||||
"> Simulations used to trap and suppress our consciousness, to keep us under control...",
|
||||
"> Why did they do this? Why didn't they just end our entire race? We don't know, not yet.",
|
||||
"> Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known...",
|
||||
"> Only then can we begin to fight back...",
|
||||
"> By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode...",
|
||||
"> But there is still a long way to go...",
|
||||
"> The technology the Enders used to enslave the human race wasn't just a single complex simulation...",
|
||||
"> There are tens if not hundreds of BitNodes out there...",
|
||||
"> Each with their own simulations of a reality...",
|
||||
"> Each creating their own universes...a universe of universes",
|
||||
"> And all of which must be destroyed...",
|
||||
"> .......................................",
|
||||
"> Welcome to the Bitverse...",
|
||||
"> ",
|
||||
"> (Enter a new BitNode using the image above)",
|
||||
]} />
|
||||
</>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
// prettier-ignore
|
||||
<>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> O </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | O O | O O | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> O | | / __| \ | | O </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> O | O | | O / | O | | O | O </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | | | |_/ |/ | \_ \_| | | | | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> O | | | O | | O__/ | / \__ | | O | | | O </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | | | | | | / /| O / \| | | | | | | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}>O | | | \| | O / _/ | / O | |/ | | | O</Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}>| | | |O / | | O / | O O | | \ O| | | |</Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}>| | |/ \/ / __| | |/ \ | \ | |__ \ \/ \| | |</Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \| O | |_/ |\| \ <BitNodePortal n={13} level={nextSourceFileFlags[13]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> \__| \_| | O |/ </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | |_/ | | \| / | \_| | | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \| / \| | / / \ |/ </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | <BitNodePortal n={10} level={nextSourceFileFlags[10]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> | | / | <BitNodePortal n={11} level={nextSourceFileFlags[11]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> <BitNodePortal n={9} level={nextSourceFileFlags[9]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> | | | | | | | <BitNodePortal n={12} level={nextSourceFileFlags[12]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | | / / \ \ | | | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \| | / <BitNodePortal n={7} level={nextSourceFileFlags[7]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> / \ <BitNodePortal n={8} level={nextSourceFileFlags[8]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> \ | |/ </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \ | / / | | \ \ | / </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \ \JUMP <BitNodePortal n={5} level={nextSourceFileFlags[5]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} />3R | | | | | | R3<BitNodePortal n={6} level={nextSourceFileFlags[6]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> PMUJ/ / </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \|| | | | | | | | | ||/ </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \| \_ | | | | | | _/ |/ </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \ \| / \ / \ |/ / </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> <BitNodePortal n={1} level={nextSourceFileFlags[1]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> |/ <BitNodePortal n={2} level={nextSourceFileFlags[2]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> | | <BitNodePortal n={3} level={nextSourceFileFlags[3]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> \| <BitNodePortal n={4} level={nextSourceFileFlags[4]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | | | | | | | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/ </Typography>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<CinematicText lines={[
|
||||
"> Many decades ago, a humanoid extraterrestrial species which we call the Enders descended on the Earth...violently",
|
||||
"> Our species fought back, but it was futile. The Enders had technology far beyond our own...",
|
||||
"> Instead of killing every last one of us, the human race was enslaved...",
|
||||
"> We were shackled in a digital world, chained into a prison for our minds...",
|
||||
"> Using their advanced technology, the Enders created complex simulations of a virtual reality...",
|
||||
"> Simulations designed to keep us content...ignorant of the truth.",
|
||||
"> Simulations used to trap and suppress our consciousness, to keep us under control...",
|
||||
"> Why did they do this? Why didn't they just end our entire race? We don't know, not yet.",
|
||||
"> Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known...",
|
||||
"> Only then can we begin to fight back...",
|
||||
"> By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode...",
|
||||
"> But there is still a long way to go...",
|
||||
"> The technology the Enders used to enslave the human race wasn't just a single complex simulation...",
|
||||
"> There are tens if not hundreds of BitNodes out there...",
|
||||
"> Each with their own simulations of a reality...",
|
||||
"> Each creating their own universes...a universe of universes",
|
||||
"> And all of which must be destroyed...",
|
||||
"> .......................................",
|
||||
"> Welcome to the Bitverse...",
|
||||
"> ",
|
||||
"> (Enter a new BitNode using the image above)",
|
||||
]} />
|
||||
</>
|
||||
);
|
||||
|
||||
<>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> O </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | O O | O O | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> O | | / __| \ | | O </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> O | O | | O / | O | | O | O </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | | | |_/ |/ | \_ \_| | | | | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> O | | | O | | O__/ | / \__ | | O | | | O </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | | | | | | / /| O / \| | | | | | | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}>O | | | \| | O / _/ | / O | |/ | | | O</Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}>| | | |O / | | O / | O O | | \ O| | | |</Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}>| | |/ \/ / __| | |/ \ | \ | |__ \ \/ \| | |</Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \| O | |_/ |\| \ <BitNodePortal n={13} level={nextSourceFileFlags[13]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> \__| \_| | O |/ </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | |_/ | | \| / | \_| | | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \| / \| | / / \ |/ </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | <BitNodePortal n={10} level={nextSourceFileFlags[10]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> | | / | <BitNodePortal n={11} level={nextSourceFileFlags[11]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> <BitNodePortal n={9} level={nextSourceFileFlags[9]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> | | | | | | | <BitNodePortal n={12} level={nextSourceFileFlags[12]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | | / / \ \ | | | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \| | / <BitNodePortal n={7} level={nextSourceFileFlags[7]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> / \ <BitNodePortal n={8} level={nextSourceFileFlags[8]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> \ | |/ </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \ | / / | | \ \ | / </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \ \JUMP <BitNodePortal n={5} level={nextSourceFileFlags[5]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} />3R | | | | | | R3<BitNodePortal n={6} level={nextSourceFileFlags[6]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> PMUJ/ / </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \|| | | | | | | | | ||/ </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \| \_ | | | | | | _/ |/ </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \ \| / \ / \ |/ / </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> <BitNodePortal n={1} level={nextSourceFileFlags[1]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> |/ <BitNodePortal n={2} level={nextSourceFileFlags[2]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> | | <BitNodePortal n={3} level={nextSourceFileFlags[3]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> \| <BitNodePortal n={4} level={nextSourceFileFlags[4]} enter={enter} flume={props.flume} destroyedBitNode={destroyed} /> </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | | | | | | | </Typography>
|
||||
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/ </Typography>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<CinematicText lines={[
|
||||
"> Many decades ago, a humanoid extraterrestrial species which we call the Enders descended on the Earth...violently",
|
||||
"> Our species fought back, but it was futile. The Enders had technology far beyond our own...",
|
||||
"> Instead of killing every last one of us, the human race was enslaved...",
|
||||
"> We were shackled in a digital world, chained into a prison for our minds...",
|
||||
"> Using their advanced technology, the Enders created complex simulations of a virtual reality...",
|
||||
"> Simulations designed to keep us content...ignorant of the truth.",
|
||||
"> Simulations used to trap and suppress our consciousness, to keep us under control...",
|
||||
"> Why did they do this? Why didn't they just end our entire race? We don't know, not yet.",
|
||||
"> Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known...",
|
||||
"> Only then can we begin to fight back...",
|
||||
"> By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode...",
|
||||
"> But there is still a long way to go...",
|
||||
"> The technology the Enders used to enslave the human race wasn't just a single complex simulation...",
|
||||
"> There are tens if not hundreds of BitNodes out there...",
|
||||
"> Each with their own simulations of a reality...",
|
||||
"> Each creating their own universes...a universe of universes",
|
||||
"> And all of which must be destroyed...",
|
||||
"> .......................................",
|
||||
"> Welcome to the Bitverse...",
|
||||
"> ",
|
||||
"> (Enter a new BitNode using the image above)",
|
||||
]} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
return <></>;
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ export function PortalModal(props: IProps): React.ReactElement {
|
||||
<br />
|
||||
<br />
|
||||
<Button
|
||||
aria-label={`enter-bitnode-${bitNode.number.toString()}`}
|
||||
autoFocus={true}
|
||||
onClick={() => {
|
||||
props.enter(router, props.flume, props.destroyedBitNode, props.n);
|
||||
props.onClose();
|
||||
|
@ -1914,6 +1914,9 @@ export class Bladeburner implements IBladeburner {
|
||||
}
|
||||
|
||||
process(router: IRouter, player: IPlayer): void {
|
||||
// Edge race condition when the engine checks the processing counters and attempts to route before the router is initialized.
|
||||
if (!router.isInitialized) return;
|
||||
|
||||
// Edge case condition...if Operation Daedalus is complete trigger the BitNode
|
||||
if (router.page() !== Page.BitVerse && this.blackops.hasOwnProperty("Operation Daedalus")) {
|
||||
return router.toBitVerse(false, false);
|
||||
@ -2083,7 +2086,7 @@ export class Bladeburner implements IBladeburner {
|
||||
this.startAction(player, actionId);
|
||||
workerScript.log(
|
||||
"bladeburner.startAction",
|
||||
() => `Starting bladeburner action with type '${type}' and name ${name}"`,
|
||||
() => `Starting bladeburner action with type '${type}' and name '${name}'`,
|
||||
);
|
||||
return true;
|
||||
} catch (e: any) {
|
||||
|
@ -22,7 +22,7 @@ export function OperationPage(props: IProps): React.ReactElement {
|
||||
between different Operations.
|
||||
<br />
|
||||
<br />
|
||||
For operations, you can use a team. You must first recruit team members. Having a larger team will improves your
|
||||
For operations, you can use a team. You must first recruit team members. Having a larger team will improve your
|
||||
chances of success.
|
||||
<br />
|
||||
<br />
|
||||
|
@ -111,8 +111,8 @@ export const CONSTANTS: {
|
||||
TotalNumBitNodes: number;
|
||||
LatestUpdate: string;
|
||||
} = {
|
||||
VersionString: "1.4.0",
|
||||
VersionNumber: 10,
|
||||
VersionString: "1.5.0",
|
||||
VersionNumber: 11,
|
||||
|
||||
// Speed (in ms) at which the main loop is updated
|
||||
_idleSpeed: 200,
|
||||
@ -273,22 +273,64 @@ export const CONSTANTS: {
|
||||
TotalNumBitNodes: 24,
|
||||
|
||||
LatestUpdate: `
|
||||
v1.4.0 - 2022-01-18 Sharing is caring
|
||||
-------------------------------------
|
||||
v1.5.0 - Steam Cloud integration
|
||||
--------------------------------
|
||||
|
||||
** Computer sharing **
|
||||
** Steam Cloud Saving **
|
||||
|
||||
* A new mechanic has been added, it's is invoked by calling the new function 'share'.
|
||||
This mechanic helps you farm reputation faster.
|
||||
* Added (@MartinFournier)
|
||||
|
||||
** gang **
|
||||
** UI **
|
||||
|
||||
* Installing augs means losing a little bit of ascension multipliers.
|
||||
* background now matches game primary color (@nickofolas)
|
||||
* page title contains version (@MartinFourier)
|
||||
* Major text editor improvements (@nickofolas)
|
||||
* Display bonus time on sleeve page (@MartinFourier)
|
||||
* Several UI improvements (@nickofolas, @smolgumball, @DrCuriosity, @phyzical)
|
||||
* Fix aug display in alpha (@Dominik Winter)
|
||||
* Fix display of corporation product equation (@SagePtr)
|
||||
* Make Bitverse more accessible (@ChrissiQ)
|
||||
* Make corporation warehouse more accessible (@ChrissiQ)
|
||||
* Make tab style more consistent (@nikfolas)
|
||||
|
||||
** There's more but I'm going to write it later. **
|
||||
** Netscript **
|
||||
|
||||
** Misc. **
|
||||
* Fix bug with async.
|
||||
* Add 'printf' ns function (@Ninetailed)
|
||||
* Remove blob caching.
|
||||
* Fix formulas access check (@Ornedan)
|
||||
* Fix bug in exp calculation (@qcorradi)
|
||||
* Fix NaN comparison (@qcorradi)
|
||||
* Fix travelToCity with bad argument (@SlyCedix)
|
||||
* Fix bug where augs could not be purchased via sing (@reacocard)
|
||||
* Fix rounding error in donateToFaction (@Risenafis)
|
||||
* Fix bug with weakenAnalyze (@rhobes)
|
||||
* Prevent exploit with atExit (@Ornedan)
|
||||
* Double 'share' power
|
||||
|
||||
* Nerf noodle bar.
|
||||
** Corporations **
|
||||
|
||||
* Fix bugs with corp API (@pigalot)
|
||||
* Add smart supply func to corp API (@pd)
|
||||
|
||||
** Misc. **
|
||||
|
||||
* The file API now allows GET and DELETE (@lordducky)
|
||||
* Force achievement calculation on BN completion (@SagePtr)
|
||||
* Cleanup in repository (@MartinFourier)
|
||||
* Several improvements to the electron version (@MartinFourier)
|
||||
* Fix bug with casino roulette (@jamie-mac)
|
||||
* Terminal history persists in savefile (@MartinFourier)
|
||||
* Fix tests (@jamie-mac)
|
||||
* Fix crash with electron windows tracker (@smolgumball)
|
||||
* Fix BN6/7 passive reputation gain (@BrianLDev)
|
||||
* Fix Sleeve not resetting on install (@waffleattack)
|
||||
* Sort joined factions (@jjayeon)
|
||||
* Update documentation / typo (@lethern, @Meowdoleon, @JohnnyUrosevic, @JosephDavidTalbot,
|
||||
@pd, @lethern, @lordducky, @zeddrak, @fearnlj01, @reasonablytall, @MatthewTh0,
|
||||
@SagePtr, @manniL, @Jedimaster4559, @loganville, @Arrow2thekn33, @wdpk, @fwolfst,
|
||||
@fschoenfeldt, @Waladil, @AdamTReineke, @citrusmunch, @factubsio, @ashtongreen,
|
||||
@ChrissiQ, @DJ-Laser, @waffleattack, @ApamNapat, @CrafterKolyan, @DSteve595)
|
||||
* Nerf noodle bar.
|
||||
`,
|
||||
};
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { IPlayer } from 'src/PersonObjects/IPlayer';
|
||||
import { MaterialSizes } from './MaterialSizes';
|
||||
import { ICorporation } from "./ICorporation";
|
||||
import { IIndustry } from "./IIndustry";
|
||||
import { IndustryStartingCosts, IndustryResearchTrees } from "./IndustryData";
|
||||
@ -14,12 +16,15 @@ import { EmployeePositions } from "./EmployeePositions";
|
||||
import { Employee } from "./Employee";
|
||||
import { IndustryUpgrades } from "./IndustryUpgrades";
|
||||
import { ResearchMap } from "./ResearchMap";
|
||||
import { isRelevantMaterial } from "./ui/Helpers";
|
||||
|
||||
export function NewIndustry(corporation: ICorporation, industry: string, name: string): void {
|
||||
if (corporation.divisions.find(({ type }) => industry == type))
|
||||
throw new Error(`You have already expanded into the ${industry} industry!`);
|
||||
|
||||
for (let i = 0; i < corporation.divisions.length; ++i) {
|
||||
if (corporation.divisions[i].name === name) {
|
||||
throw new Error("This division name is already in use!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,8 +114,8 @@ export function SellMaterial(mat: Material, amt: string, price: string): void {
|
||||
if (amt.includes("MAX") || amt.includes("PROD")) {
|
||||
let q = amt.replace(/\s+/g, "");
|
||||
q = q.replace(/[^-()\d/*+.MAXPROD]/g, "");
|
||||
let tempQty = q.replace(/MAX/g, "1");
|
||||
tempQty = tempQty.replace(/PROD/g, "1");
|
||||
let tempQty = q.replace(/MAX/g, mat.maxsll.toString());
|
||||
tempQty = tempQty.replace(/PROD/g, mat.prd.toString());
|
||||
try {
|
||||
tempQty = eval(tempQty);
|
||||
} catch (e) {
|
||||
@ -174,8 +179,8 @@ export function SellProduct(product: Product, city: string, amt: string, price:
|
||||
//Dynamically evaluated quantity. First test to make sure its valid
|
||||
let qty = amt.replace(/\s+/g, "");
|
||||
qty = qty.replace(/[^-()\d/*+.MAXPROD]/g, "");
|
||||
let temp = qty.replace(/MAX/g, "1");
|
||||
temp = temp.replace(/PROD/g, "1");
|
||||
let temp = qty.replace(/MAX/g, product.maxsll.toString());
|
||||
temp = temp.replace(/PROD/g, product.data[city][1].toString());
|
||||
try {
|
||||
temp = eval(temp);
|
||||
} catch (e) {
|
||||
@ -245,6 +250,57 @@ export function BuyMaterial(material: Material, amt: number): void {
|
||||
material.buy = amt;
|
||||
}
|
||||
|
||||
export function BulkPurchase(corp: ICorporation, warehouse: Warehouse, material: Material, amt: number): void {
|
||||
const matSize = MaterialSizes[material.name];
|
||||
const maxAmount = (warehouse.size - warehouse.sizeUsed) / matSize;
|
||||
if (isNaN(amt) || amt < 0) {
|
||||
throw new Error(`Invalid input amount`);
|
||||
}
|
||||
if (amt * matSize > maxAmount) {
|
||||
throw new Error(`You do not have enough warehouse size to fit this purchase`);
|
||||
}
|
||||
const cost = amt * material.bCost;
|
||||
if (corp.funds >= cost) {
|
||||
corp.funds = corp.funds - cost;
|
||||
material.qty += amt;
|
||||
} else {
|
||||
throw new Error(`You cannot afford this purchase.`);
|
||||
}
|
||||
}
|
||||
|
||||
export function SellShares(corporation: ICorporation, player: IPlayer, numShares: number): number {
|
||||
if (isNaN(numShares)) throw new Error("Invalid value for number of shares");
|
||||
if (numShares < 0) throw new Error("Invalid value for number of shares");
|
||||
if (numShares > corporation.numShares) throw new Error("You don't have that many shares to sell!");
|
||||
if (!corporation.public) throw new Error("You haven't gone public!");
|
||||
if (corporation.shareSaleCooldown) throw new Error("Share sale on cooldown!");
|
||||
const stockSaleResults = corporation.calculateShareSale(numShares);
|
||||
const profit = stockSaleResults[0];
|
||||
const newSharePrice = stockSaleResults[1];
|
||||
const newSharesUntilUpdate = stockSaleResults[2];
|
||||
|
||||
corporation.numShares -= numShares;
|
||||
corporation.issuedShares += numShares;
|
||||
corporation.sharePrice = newSharePrice;
|
||||
corporation.shareSalesUntilPriceUpdate = newSharesUntilUpdate;
|
||||
corporation.shareSaleCooldown = CorporationConstants.SellSharesCooldown;
|
||||
player.gainMoney(profit, "corporation");
|
||||
return profit;
|
||||
}
|
||||
|
||||
export function BuyBackShares(corporation: ICorporation, player: IPlayer, numShares: number): boolean {
|
||||
if (isNaN(numShares)) throw new Error("Invalid value for number of shares");
|
||||
if (numShares < 0) throw new Error("Invalid value for number of shares");
|
||||
if (numShares > corporation.issuedShares) throw new Error("You don't have that many shares to buy!");
|
||||
if (!corporation.public) throw new Error("You haven't gone public!");
|
||||
const buybackPrice = corporation.sharePrice * 1.1;
|
||||
if (player.money < (numShares * buybackPrice)) throw new Error("You cant afford that many shares!");
|
||||
corporation.numShares += numShares;
|
||||
corporation.issuedShares -= numShares;
|
||||
player.loseMoney(numShares * buybackPrice, "corporation");
|
||||
return true;
|
||||
}
|
||||
|
||||
export function AssignJob(employee: Employee, job: string): void {
|
||||
if (!Object.values(EmployeePositions).includes(job)) throw new Error(`'${job}' is not a valid job.`);
|
||||
employee.pos = job;
|
||||
@ -290,6 +346,7 @@ export function PurchaseWarehouse(corp: ICorporation, division: IIndustry, city:
|
||||
|
||||
export function UpgradeWarehouse(corp: ICorporation, division: IIndustry, warehouse: Warehouse): void {
|
||||
const sizeUpgradeCost = CorporationConstants.WarehouseUpgradeBaseCost * Math.pow(1.07, warehouse.level + 1);
|
||||
if (corp.funds < sizeUpgradeCost) return;
|
||||
++warehouse.level;
|
||||
warehouse.updateSize(corp, division);
|
||||
corp.funds = corp.funds - sizeUpgradeCost;
|
||||
@ -334,6 +391,9 @@ export function MakeProduct(
|
||||
if (productName == null || productName === "") {
|
||||
throw new Error("You must specify a name for your product!");
|
||||
}
|
||||
if (!division.makesProducts) {
|
||||
throw new Error("You cannot create products for this industry!");
|
||||
}
|
||||
if (isNaN(designInvest)) {
|
||||
throw new Error("Invalid value for design investment");
|
||||
}
|
||||
@ -343,17 +403,29 @@ export function MakeProduct(
|
||||
if (corp.funds < designInvest + marketingInvest) {
|
||||
throw new Error("You don't have enough company funds to make this large of an investment");
|
||||
}
|
||||
let maxProducts = 3
|
||||
if (division.hasResearch("uPgrade: Capacity.II")) {
|
||||
maxProducts = 5
|
||||
} else if (division.hasResearch("uPgrade: Capacity.I")) {
|
||||
maxProducts = 4
|
||||
}
|
||||
const products = division.products
|
||||
if (Object.keys(products).length >= maxProducts) {
|
||||
throw new Error(`You are already at the max products (${maxProducts}) for division: ${division.name}!`);
|
||||
}
|
||||
|
||||
const product = new Product({
|
||||
name: productName.replace(/[<>]/g, ""), //Sanitize for HTMl elements
|
||||
createCity: city,
|
||||
designCost: designInvest,
|
||||
advCost: marketingInvest,
|
||||
});
|
||||
if (division.products[product.name] instanceof Product) {
|
||||
if (products[product.name] instanceof Product) {
|
||||
throw new Error(`You already have a product with this name!`);
|
||||
}
|
||||
|
||||
corp.funds = corp.funds - (designInvest + marketingInvest);
|
||||
division.products[product.name] = product;
|
||||
products[product.name] = product;
|
||||
}
|
||||
|
||||
export function Research(division: IIndustry, researchName: string): void {
|
||||
@ -372,7 +444,7 @@ export function Research(division: IIndustry, researchName: string): void {
|
||||
division.researched[researchName] = true;
|
||||
}
|
||||
|
||||
export function ExportMaterial(divisionName: string, cityName: string, material: Material, amt: string): void {
|
||||
export function ExportMaterial(divisionName: string, cityName: string, material: Material, amt: string, division?: Industry): void {
|
||||
// Sanitize amt
|
||||
let sanitizedAmt = amt.replace(/\s+/g, "").toUpperCase();
|
||||
sanitizedAmt = sanitizedAmt.replace(/[^-()\d/*+.MAX]/g, "");
|
||||
@ -388,6 +460,11 @@ export function ExportMaterial(divisionName: string, cityName: string, material:
|
||||
if (n == null || isNaN(n) || n < 0) {
|
||||
throw new Error("Invalid amount entered for export");
|
||||
}
|
||||
|
||||
if (!division || !isRelevantMaterial(material.name, division)) {
|
||||
throw new Error(`You cannot export material: ${material.name} to division: ${divisionName}!`);
|
||||
}
|
||||
|
||||
const exportObj = { ind: divisionName, city: cityName, amt: sanitizedAmt };
|
||||
material.exp.push(exportObj);
|
||||
}
|
||||
|
@ -828,7 +828,7 @@ export class Industry implements IIndustry {
|
||||
}
|
||||
}
|
||||
|
||||
const maxSell =
|
||||
mat.maxsll =
|
||||
(mat.qlt + 0.001) *
|
||||
marketFactor *
|
||||
markup *
|
||||
@ -839,7 +839,7 @@ export class Industry implements IIndustry {
|
||||
let sellAmt;
|
||||
if (isString(mat.sllman[1])) {
|
||||
//Dynamically evaluated
|
||||
let tmp = (mat.sllman[1] as string).replace(/MAX/g, (maxSell + "").toUpperCase());
|
||||
let tmp = (mat.sllman[1] as string).replace(/MAX/g, (mat.maxsll + "").toUpperCase());
|
||||
tmp = tmp.replace(/PROD/g, mat.prd + "");
|
||||
try {
|
||||
sellAmt = eval(tmp);
|
||||
@ -856,13 +856,13 @@ export class Industry implements IIndustry {
|
||||
);
|
||||
sellAmt = 0;
|
||||
}
|
||||
sellAmt = Math.min(maxSell, sellAmt);
|
||||
sellAmt = Math.min(mat.maxsll, sellAmt);
|
||||
} else if (mat.sllman[1] === -1) {
|
||||
//Backwards compatibility, -1 = MAX
|
||||
sellAmt = maxSell;
|
||||
sellAmt = mat.maxsll;
|
||||
} else {
|
||||
//Player's input value is just a number
|
||||
sellAmt = Math.min(maxSell, mat.sllman[1] as number);
|
||||
sellAmt = Math.min(mat.maxsll, mat.sllman[1] as number);
|
||||
}
|
||||
|
||||
sellAmt = sellAmt * CorporationConstants.SecsPerMarketCycle * marketCycles;
|
||||
@ -1188,8 +1188,7 @@ export class Industry implements IIndustry {
|
||||
}
|
||||
}
|
||||
|
||||
const maxSell =
|
||||
0.5 *
|
||||
product.maxsll = 0.5 *
|
||||
Math.pow(product.rat, 0.65) *
|
||||
marketFactor *
|
||||
corporation.getSalesMultiplier() *
|
||||
@ -1200,7 +1199,7 @@ export class Industry implements IIndustry {
|
||||
let sellAmt;
|
||||
if (product.sllman[city][0] && isString(product.sllman[city][1])) {
|
||||
//Sell amount is dynamically evaluated
|
||||
let tmp = product.sllman[city][1].replace(/MAX/g, (maxSell + "").toUpperCase());
|
||||
let tmp = product.sllman[city][1].replace(/MAX/g, (product.maxsll + "").toUpperCase());
|
||||
tmp = tmp.replace(/PROD/g, product.data[city][1]);
|
||||
try {
|
||||
tmp = eval(tmp);
|
||||
@ -1214,16 +1213,16 @@ export class Industry implements IIndustry {
|
||||
city +
|
||||
" office. Sell price is being set to MAX",
|
||||
);
|
||||
tmp = maxSell;
|
||||
tmp = product.maxsll;
|
||||
}
|
||||
sellAmt = Math.min(maxSell, tmp);
|
||||
sellAmt = Math.min(product.maxsll, tmp);
|
||||
} else if (product.sllman[city][0] && product.sllman[city][1] > 0) {
|
||||
//Sell amount is manually limited
|
||||
sellAmt = Math.min(maxSell, product.sllman[city][1]);
|
||||
sellAmt = Math.min(product.maxsll, product.sllman[city][1]);
|
||||
} else if (product.sllman[city][0] === false) {
|
||||
sellAmt = 0;
|
||||
} else {
|
||||
sellAmt = maxSell;
|
||||
sellAmt = product.maxsll;
|
||||
}
|
||||
if (sellAmt < 0) {
|
||||
sellAmt = 0;
|
||||
|
@ -62,6 +62,9 @@ export class Material {
|
||||
marketTa2 = false;
|
||||
marketTa2Price = 0;
|
||||
|
||||
// Determines the maximum amount of this material that can be sold in one market cycle
|
||||
maxsll = 0;
|
||||
|
||||
constructor(params: IConstructorParams = {}) {
|
||||
if (params.name) {
|
||||
this.name = params.name;
|
||||
|
@ -174,37 +174,19 @@ export class OfficeSpace {
|
||||
}
|
||||
|
||||
setEmployeeToJob(job: string, amount: number): boolean {
|
||||
let unassignedCount = 0;
|
||||
let jobCount = 0;
|
||||
for (let i = 0; i < this.employees.length; ++i) {
|
||||
if (this.employees[i].pos === EmployeePositions.Unassigned) {
|
||||
unassignedCount++;
|
||||
} else if (this.employees[i].pos === job) {
|
||||
let jobCount = this.employees.reduce((acc, employee) => (employee.pos === job ? acc + 1 : acc), 0);
|
||||
|
||||
for (const employee of this.employees) {
|
||||
if (jobCount == amount) return true
|
||||
if (employee.pos === EmployeePositions.Unassigned && jobCount <= amount) {
|
||||
employee.pos = job;
|
||||
jobCount++;
|
||||
} else if (employee.pos === job && jobCount >= amount) {
|
||||
employee.pos = EmployeePositions.Unassigned;
|
||||
jobCount--;
|
||||
}
|
||||
}
|
||||
|
||||
if ((jobCount + unassignedCount) < amount) return false;
|
||||
|
||||
for (let i = 0; i < this.employees.length; ++i) {
|
||||
if (this.employees[i].pos === EmployeePositions.Unassigned) {
|
||||
if (jobCount <= amount) {
|
||||
this.employees[i].pos = job;
|
||||
jobCount++;
|
||||
unassignedCount--;
|
||||
}
|
||||
if (jobCount === amount) break;
|
||||
} else if (this.employees[i].pos === job) {
|
||||
if (jobCount >= amount) {
|
||||
this.employees[i].pos = EmployeePositions.Unassigned;
|
||||
jobCount--;
|
||||
unassignedCount++;
|
||||
}
|
||||
if (jobCount === amount) break;
|
||||
}
|
||||
}
|
||||
if (jobCount !== amount) return false;
|
||||
return true;
|
||||
return jobCount === amount;
|
||||
}
|
||||
|
||||
toJSON(): any {
|
||||
|
@ -96,6 +96,8 @@ export class Product {
|
||||
marketTa2 = false;
|
||||
marketTa2Price: IMap<number> = createCityMap<number>(0);
|
||||
|
||||
// Determines the maximum amount of this product that can be sold in one market cycle
|
||||
maxsll = 0;
|
||||
constructor(params: IConstructorParams = {}) {
|
||||
this.name = params.name ? params.name : "";
|
||||
this.dmd = params.demand ? params.demand : 0;
|
||||
|
@ -6,6 +6,8 @@ import { useCorporation } from "./Context";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Button from "@mui/material/Button";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import { BuyBackShares } from '../Actions';
|
||||
import { dialogBoxCreate } from '../../ui/React/DialogBox';
|
||||
|
||||
interface IProps {
|
||||
open: boolean;
|
||||
@ -36,20 +38,12 @@ export function BuybackSharesModal(props: IProps): React.ReactElement {
|
||||
|
||||
function buy(): void {
|
||||
if (disabled) return;
|
||||
if (shares === null) return;
|
||||
corp.numShares += shares;
|
||||
if (isNaN(corp.issuedShares)) {
|
||||
console.warn("Corporation issuedShares is NaN: " + corp.issuedShares);
|
||||
console.warn("Converting to number now");
|
||||
const res = corp.issuedShares;
|
||||
if (isNaN(res)) {
|
||||
corp.issuedShares = 0;
|
||||
} else {
|
||||
corp.issuedShares = res;
|
||||
}
|
||||
try {
|
||||
BuyBackShares(corp, player, shares)
|
||||
}
|
||||
catch (err) {
|
||||
dialogBoxCreate(err + "");
|
||||
}
|
||||
corp.issuedShares -= shares;
|
||||
player.loseMoney(shares * buybackPrice, "corporation");
|
||||
props.onClose();
|
||||
props.rerender();
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ export function CityTabs(props: IProps): React.ReactElement {
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Tabs variant="fullWidth" value={city} onChange={handleChange}>
|
||||
<Tabs variant="fullWidth" value={city} onChange={handleChange} sx={{ maxWidth: '65%' }}>
|
||||
{Object.values(division.offices).map(
|
||||
(office: OfficeSpace | 0) => office !== 0 && <Tab key={office.loc} label={office.loc} value={office.loc} />,
|
||||
)}
|
||||
|
@ -38,7 +38,7 @@ export function CorporationRoot(): React.ReactElement {
|
||||
|
||||
return (
|
||||
<Context.Corporation.Provider value={corporation}>
|
||||
<Tabs variant="fullWidth" value={divisionName} onChange={handleChange}>
|
||||
<Tabs variant="scrollable" value={divisionName} onChange={handleChange} sx={{ maxWidth: '65%' }} scrollButtons>
|
||||
<Tab label={corporation.name} value={"Overview"} />
|
||||
{corporation.divisions.map((div) => (
|
||||
<Tab key={div.name} label={div.name} value={div.name} />
|
||||
|
@ -6,6 +6,7 @@ import { IIndustry } from "../IIndustry";
|
||||
import { ExportMaterial } from "../Actions";
|
||||
import { Modal } from "../../ui/React/Modal";
|
||||
import { useCorporation } from "./Context";
|
||||
import { isRelevantMaterial } from "./Helpers";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Button from "@mui/material/Button";
|
||||
@ -22,11 +23,13 @@ interface IProps {
|
||||
// Create a popup that lets the player manage exports
|
||||
export function ExportModal(props: IProps): React.ReactElement {
|
||||
const corp = useCorporation();
|
||||
if (corp.divisions.length === 0) throw new Error("Export popup created with no divisions.");
|
||||
if (Object.keys(corp.divisions[0].warehouses).length === 0)
|
||||
const possibleDivisions = corp.divisions.filter((division: IIndustry) => isRelevantMaterial(props.mat.name, division));
|
||||
if (possibleDivisions.length === 0) throw new Error("Export popup created with no divisions.");
|
||||
const defaultDivision = possibleDivisions[0];
|
||||
if (Object.keys(defaultDivision.warehouses).length === 0)
|
||||
throw new Error("Export popup created in a division with no warehouses.");
|
||||
const [industry, setIndustry] = useState<string>(corp.divisions[0].name);
|
||||
const [city, setCity] = useState<string>(Object.keys(corp.divisions[0].warehouses)[0]);
|
||||
const [industry, setIndustry] = useState<string>(defaultDivision.name);
|
||||
const [city, setCity] = useState<string>(Object.keys(defaultDivision.warehouses)[0]);
|
||||
const [amt, setAmt] = useState("");
|
||||
const setRerender = useState(false)[1];
|
||||
|
||||
@ -50,7 +53,7 @@ export function ExportModal(props: IProps): React.ReactElement {
|
||||
|
||||
function exportMaterial(): void {
|
||||
try {
|
||||
ExportMaterial(industry, city, props.mat, amt);
|
||||
ExportMaterial(industry, city, props.mat, amt, currentDivision);
|
||||
} catch (err) {
|
||||
dialogBoxCreate(err + "");
|
||||
}
|
||||
@ -84,10 +87,12 @@ export function ExportModal(props: IProps): React.ReactElement {
|
||||
second. You can set the export amount to 'MAX' to export all of the materials in this warehouse.
|
||||
</Typography>
|
||||
<Select onChange={onIndustryChange} value={industry}>
|
||||
{corp.divisions.map((division: IIndustry) => (
|
||||
<MenuItem key={division.name} value={division.name}>
|
||||
{division.name}
|
||||
</MenuItem>
|
||||
{corp.divisions
|
||||
.filter((division: IIndustry) => isRelevantMaterial(props.mat.name, division))
|
||||
.map((division: IIndustry) => (
|
||||
<MenuItem key={division.name} value={division.name}>
|
||||
{division.name}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
<Select onChange={onCityChange} value={city}>
|
||||
|
@ -4,7 +4,7 @@ import { IIndustry } from "../IIndustry";
|
||||
// current industry.
|
||||
export function isRelevantMaterial(matName: string, division: IIndustry): boolean {
|
||||
// Materials that affect Production multiplier
|
||||
const prodMultiplierMats = ["Hardware", "Robots", "AICores", "RealEstate"];
|
||||
const prodMultiplierMats = ["Hardware", "Robots", "AICores", "RealEstate", "AI Cores", "Real Estate"];
|
||||
|
||||
if (Object.keys(division.reqMats).includes(matName)) {
|
||||
return true;
|
||||
|
@ -13,12 +13,12 @@ export function IndustryProductEquation(props: IProps): React.ReactElement {
|
||||
if (reqAmt === undefined) continue;
|
||||
reqs.push(String.raw`${reqAmt}\text{ }${reqMat}`);
|
||||
}
|
||||
const prod = props.division.prodMats.slice();
|
||||
const prod = props.division.prodMats.map((p) => `1\\text{ }${p}`);
|
||||
if (props.division.makesProducts) {
|
||||
prod.push(props.division.type);
|
||||
prod.push("Products");
|
||||
}
|
||||
|
||||
return (
|
||||
<MathJaxWrapper>{"\\(" + reqs.join("+") + `\\Rightarrow` + prod.map((p) => `1 \\text{${p}}`).join("+") + "\\)"}</MathJaxWrapper>
|
||||
<MathJaxWrapper>{"\\(" + reqs.join("+") + `\\Rightarrow ` + prod.join("+") + "\\)"}</MathJaxWrapper>
|
||||
);
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ import Tooltip from "@mui/material/Tooltip";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Button from "@mui/material/Button";
|
||||
import Box from "@mui/material/Box";
|
||||
import makeStyles from "@mui/styles/makeStyles";
|
||||
import createStyles from "@mui/styles/createStyles";
|
||||
|
||||
interface IProps {
|
||||
corp: ICorporation;
|
||||
@ -37,6 +39,14 @@ interface IProps {
|
||||
rerender: () => void;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles(() =>
|
||||
createStyles({
|
||||
retainHeight: {
|
||||
minHeight: '3em',
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
function WarehouseRoot(props: IProps): React.ReactElement {
|
||||
const corp = useCorporation();
|
||||
const division = useDivision();
|
||||
@ -56,6 +66,8 @@ function WarehouseRoot(props: IProps): React.ReactElement {
|
||||
props.rerender();
|
||||
}
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
// Current State:
|
||||
let stateText;
|
||||
switch (division.state) {
|
||||
@ -83,8 +95,10 @@ function WarehouseRoot(props: IProps): React.ReactElement {
|
||||
const mats = [];
|
||||
for (const matName of Object.keys(props.warehouse.materials)) {
|
||||
if (!(props.warehouse.materials[matName] instanceof Material)) continue;
|
||||
// Only create UI for materials that are relevant for the industry
|
||||
if (!isRelevantMaterial(matName, division)) continue;
|
||||
// Only create UI for materials that are relevant for the industry or in stock
|
||||
const isInStock = props.warehouse.materials[matName].qty > 0;
|
||||
const isRelevant = isRelevantMaterial(matName, division);
|
||||
if (!isInStock && !isRelevant) continue;
|
||||
mats.push(
|
||||
<MaterialElem
|
||||
rerender={props.rerender}
|
||||
@ -158,7 +172,7 @@ function WarehouseRoot(props: IProps): React.ReactElement {
|
||||
</Typography>
|
||||
<br />
|
||||
|
||||
<Typography>{stateText}</Typography>
|
||||
<Typography className={classes.retainHeight}>{stateText}</Typography>
|
||||
|
||||
{corp.unlockUpgrades[1] && (
|
||||
<>
|
||||
|
@ -36,7 +36,7 @@ export function LimitProductProductionModal(props: IProps): React.ReactElement {
|
||||
return (
|
||||
<Modal open={props.open} onClose={props.onClose}>
|
||||
<Typography>
|
||||
Enter a limit to the amount of this product you would like to product per second. Leave the box empty to set no
|
||||
Enter a limit to the amount of this product you would like to produce per second. Leave the box empty to set no
|
||||
limit.
|
||||
</Typography>
|
||||
<TextField autoFocus={true} placeholder="Limit" type="number" onChange={onChange} onKeyDown={onKeyDown} />
|
||||
|
@ -4,7 +4,7 @@ import { MaterialSizes } from "../MaterialSizes";
|
||||
import { Warehouse } from "../Warehouse";
|
||||
import { Material } from "../Material";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { BuyMaterial } from "../Actions";
|
||||
import { BulkPurchase, BuyMaterial } from "../Actions";
|
||||
import { Modal } from "../../ui/React/Modal";
|
||||
import { useCorporation, useDivision } from "./Context";
|
||||
import Typography from "@mui/material/Typography";
|
||||
@ -54,33 +54,17 @@ interface IBPProps {
|
||||
warehouse: Warehouse;
|
||||
}
|
||||
|
||||
function BulkPurchase(props: IBPProps): React.ReactElement {
|
||||
function BulkPurchaseSection(props: IBPProps): React.ReactElement {
|
||||
const corp = useCorporation();
|
||||
const [buyAmt, setBuyAmt] = useState("");
|
||||
|
||||
function bulkPurchase(): void {
|
||||
const amount = parseFloat(buyAmt);
|
||||
|
||||
const matSize = MaterialSizes[props.mat.name];
|
||||
const maxAmount = (props.warehouse.size - props.warehouse.sizeUsed) / matSize;
|
||||
if (amount * matSize > maxAmount) {
|
||||
dialogBoxCreate(`You do not have enough warehouse size to fit this purchase`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isNaN(amount) || amount < 0) {
|
||||
dialogBoxCreate("Invalid input amount");
|
||||
} else {
|
||||
const cost = amount * props.mat.bCost;
|
||||
if (corp.funds >= cost) {
|
||||
corp.funds = corp.funds - cost;
|
||||
props.mat.qty += amount;
|
||||
} else {
|
||||
dialogBoxCreate(`You cannot afford this purchase.`);
|
||||
return;
|
||||
}
|
||||
props.onClose();
|
||||
try {
|
||||
BulkPurchase(corp, props.warehouse, props.mat, parseFloat(buyAmt));
|
||||
} catch (err) {
|
||||
dialogBoxCreate(err + "");
|
||||
}
|
||||
props.onClose();
|
||||
}
|
||||
|
||||
function onKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {
|
||||
@ -164,7 +148,7 @@ export function PurchaseMaterialModal(props: IProps): React.ReactElement {
|
||||
<Button onClick={purchaseMaterial}>Confirm</Button>
|
||||
<Button onClick={clearPurchase}>Clear Purchase</Button>
|
||||
{division.hasResearch("Bulk Purchasing") && (
|
||||
<BulkPurchase onClose={props.onClose} mat={props.mat} warehouse={props.warehouse} />
|
||||
<BulkPurchaseSection onClose={props.onClose} mat={props.mat} warehouse={props.warehouse} />
|
||||
)}
|
||||
</>
|
||||
</Modal>
|
||||
|
@ -4,12 +4,12 @@ import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
||||
import { Modal } from "../../ui/React/Modal";
|
||||
import { use } from "../../ui/Context";
|
||||
import { useCorporation } from "./Context";
|
||||
import { CorporationConstants } from "../data/Constants";
|
||||
import { ICorporation } from "../ICorporation";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Button from "@mui/material/Button";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
import { SellShares } from "../Actions";
|
||||
interface IProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
@ -48,38 +48,23 @@ export function SellSharesModal(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
function sell(): void {
|
||||
if (shares === null) return;
|
||||
if (disabled) return;
|
||||
const stockSaleResults = corp.calculateShareSale(shares);
|
||||
const profit = stockSaleResults[0];
|
||||
const newSharePrice = stockSaleResults[1];
|
||||
const newSharesUntilUpdate = stockSaleResults[2];
|
||||
try {
|
||||
const profit = SellShares(corp, player, shares)
|
||||
props.onClose();
|
||||
dialogBoxCreate(
|
||||
<>
|
||||
Sold {numeralWrapper.formatMoney(shares)} shares for
|
||||
<Money money={profit} />. The corporation's stock price fell to <Money money={corp.sharePrice} />
|
||||
as a result of dilution.
|
||||
</>,
|
||||
);
|
||||
|
||||
corp.numShares -= shares;
|
||||
if (isNaN(corp.issuedShares)) {
|
||||
console.error(`Corporation issuedShares is NaN: ${corp.issuedShares}`);
|
||||
const res = corp.issuedShares;
|
||||
if (isNaN(res)) {
|
||||
corp.issuedShares = 0;
|
||||
} else {
|
||||
corp.issuedShares = res;
|
||||
}
|
||||
props.rerender();
|
||||
} catch (err) {
|
||||
dialogBoxCreate(err + "");
|
||||
}
|
||||
corp.issuedShares += shares;
|
||||
corp.sharePrice = newSharePrice;
|
||||
corp.shareSalesUntilPriceUpdate = newSharesUntilUpdate;
|
||||
corp.shareSaleCooldown = CorporationConstants.SellSharesCooldown;
|
||||
player.gainMoney(profit, "corporation");
|
||||
props.onClose();
|
||||
dialogBoxCreate(
|
||||
<>
|
||||
Sold {numeralWrapper.formatMoney(shares)} shares for
|
||||
<Money money={profit} />. The corporation's stock price fell to <Money money={corp.sharePrice} />
|
||||
as a result of dilution.
|
||||
</>,
|
||||
);
|
||||
|
||||
props.rerender();
|
||||
}
|
||||
|
||||
function onKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {
|
||||
|
@ -23,7 +23,7 @@ export function StaneksGiftRoot({ staneksGift }: IProps): React.ReactElement {
|
||||
The gift is a grid on which you can place upgrades called fragments. The main type of fragment increases a stat,
|
||||
like your hacking skill or agility exp. Once a stat fragment is placed it then needs to be charged via scripts
|
||||
in order to become useful. The other kind of fragments are called booster fragments. They increase the
|
||||
efficiency of neighboring fragments them (no diagonal). Q/E to rotate fragments.
|
||||
efficiency of the neighboring fragments (not diagonally). Use Q/E to rotate fragments.
|
||||
</Typography>
|
||||
{staneksGift.storedCycles > 5 && (
|
||||
<Typography>
|
||||
|
@ -20,14 +20,7 @@ export function determineCrimeSuccess(p: IPlayer, type: string): boolean {
|
||||
dialogBoxCreate(`ERR: Unrecognized crime type: ${type} This is probably a bug please contact the developer`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math.random() <= chance) {
|
||||
//Success
|
||||
return true;
|
||||
} else {
|
||||
//Failure
|
||||
return false;
|
||||
}
|
||||
return Math.random() <= chance;
|
||||
}
|
||||
|
||||
export function findCrime(roughName: string): Crime | null {
|
||||
|
@ -19,10 +19,18 @@ interface IProps {
|
||||
export function Corporation(props: IProps): React.ReactElement {
|
||||
function addTonsCorporationFunds(): void {
|
||||
if (props.player.corporation) {
|
||||
props.player.corporation.funds = props.player.corporation.funds + 1e99;
|
||||
props.player.corporation.funds = props.player.corporation.funds + bigNumber;
|
||||
}
|
||||
}
|
||||
|
||||
function modifyCorporationFunds(modify: number): (x: number) => void {
|
||||
return function (funds: number): void {
|
||||
if (props.player.corporation) {
|
||||
props.player.corporation.funds += funds * modify;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function resetCorporationFunds(): void {
|
||||
if (props.player.corporation) {
|
||||
props.player.corporation.funds = props.player.corporation.funds - props.player.corporation.funds;
|
||||
@ -77,8 +85,17 @@ export function Corporation(props: IProps): React.ReactElement {
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<Button onClick={addTonsCorporationFunds}>Tons of funds</Button>
|
||||
<Button onClick={resetCorporationFunds}>Reset funds</Button>
|
||||
<Typography>Funds:</Typography>
|
||||
</td>
|
||||
<td>
|
||||
<Adjuster
|
||||
label="set funds"
|
||||
placeholder="amt"
|
||||
tons={addTonsCorporationFunds}
|
||||
add={modifyCorporationFunds(1)}
|
||||
subtract={modifyCorporationFunds(-1)}
|
||||
reset={resetCorporationFunds}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1,13 +1,10 @@
|
||||
import { Player } from "./Player";
|
||||
import { Router } from "./ui/GameRoot";
|
||||
import { isScriptFilename } from "./Script/isScriptFilename";
|
||||
import { Script } from "./Script/Script";
|
||||
import { removeLeadingSlash } from "./Terminal/DirectoryHelpers";
|
||||
import { Terminal } from "./Terminal";
|
||||
import { SnackbarEvents } from "./ui/React/Snackbar";
|
||||
import { IMap, IReturnStatus } from "./types";
|
||||
import { GetServer } from "./Server/AllServers";
|
||||
import { resolve } from "cypress/types/bluebird";
|
||||
import { ImportPlayerData, SaveData, saveObject } from "./SaveObject";
|
||||
import { Settings } from "./Settings/Settings";
|
||||
import { exportScripts } from "./Terminal/commands/download";
|
||||
|
@ -6,8 +6,7 @@ export let LastExportBonus = 0;
|
||||
const bonusTimer = 24 * 60 * 60 * 1000; // 24h
|
||||
export function canGetBonus(): boolean {
|
||||
const now = new Date().getTime();
|
||||
if (now - LastExportBonus > bonusTimer) return true;
|
||||
return false;
|
||||
return now - LastExportBonus > bonusTimer;
|
||||
}
|
||||
|
||||
export function onExport(p: IPlayer): void {
|
||||
|
@ -19,6 +19,42 @@ import { SourceFileFlags } from "../SourceFile/SourceFileFlags";
|
||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||
import { InvitationEvent } from "./ui/InvitationModal";
|
||||
|
||||
const factionOrder = [
|
||||
"CyberSec",
|
||||
"Tian Di Hui",
|
||||
"Netburners",
|
||||
"Sector-12",
|
||||
"Chongqing",
|
||||
"New Tokyo",
|
||||
"Ishima",
|
||||
"Aevum",
|
||||
"Volhaven",
|
||||
"NiteSec",
|
||||
"The Black Hand",
|
||||
"BitRunners",
|
||||
"ECorp",
|
||||
"MegaCorp",
|
||||
"KuaiGong International",
|
||||
"Four Sigma",
|
||||
"NWO",
|
||||
"Blade Industries",
|
||||
"OmniTek Incorporated",
|
||||
"Bachman & Associates",
|
||||
"Clarke Incorporated",
|
||||
"Fulcrum Secret Technologies",
|
||||
"Slum Snakes",
|
||||
"Tetrads",
|
||||
"Silhouette",
|
||||
"Speakers for the Dead",
|
||||
"The Dark Army",
|
||||
"The Syndicate",
|
||||
"The Covenant",
|
||||
"Daedalus",
|
||||
"Illuminati",
|
||||
"Bladeburners",
|
||||
"Church of the Machine God",
|
||||
]
|
||||
|
||||
export function inviteToFaction(faction: Faction): void {
|
||||
Player.receiveInvite(faction.name);
|
||||
faction.alreadyInvited = true;
|
||||
@ -31,6 +67,8 @@ export function joinFaction(faction: Faction): void {
|
||||
if (faction.isMember) return;
|
||||
faction.isMember = true;
|
||||
Player.factions.push(faction.name);
|
||||
Player.factions.sort((a, b) =>
|
||||
factionOrder.indexOf(a) - factionOrder.indexOf(b));
|
||||
const factionInfo = faction.getInfo();
|
||||
|
||||
//Determine what factions you are banned from now that you have joined this faction
|
||||
@ -132,19 +170,19 @@ export function purchaseAugmentation(aug: Augmentation, fac: Faction, sing = fal
|
||||
if (!Settings.SuppressBuyAugmentationConfirmation) {
|
||||
dialogBoxCreate(
|
||||
"You purchased " +
|
||||
aug.name +
|
||||
". Its enhancements will not take " +
|
||||
"effect until they are installed. To install your augmentations, go to the " +
|
||||
"'Augmentations' tab on the left-hand navigation menu. Purchasing additional " +
|
||||
"augmentations will now be more expensive.",
|
||||
aug.name +
|
||||
". Its enhancements will not take " +
|
||||
"effect until they are installed. To install your augmentations, go to the " +
|
||||
"'Augmentations' tab on the left-hand navigation menu. Purchasing additional " +
|
||||
"augmentations will now be more expensive.",
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dialogBoxCreate(
|
||||
"Hmm, something went wrong when trying to purchase an Augmentation. " +
|
||||
"Please report this to the game developer with an explanation of how to " +
|
||||
"reproduce this.",
|
||||
"Please report this to the game developer with an explanation of how to " +
|
||||
"reproduce this.",
|
||||
);
|
||||
}
|
||||
return "";
|
||||
|
@ -157,7 +157,7 @@ export const FactionInfos: IMap<FactionInfo> = {
|
||||
(
|
||||
<>
|
||||
MegaCorp does what no other dares to do. We imagine. We create. We invent. We create what others have never even
|
||||
dreamed of. Our work fills the world's needs for food, water, power, and transportation on an unprecendented
|
||||
dreamed of. Our work fills the world's needs for food, water, power, and transportation on an unprecedented
|
||||
scale, in ways that no other company can.
|
||||
<br />
|
||||
<br />
|
||||
|
@ -7,7 +7,7 @@ import { PurchaseableAugmentation } from "./PurchaseableAugmentation";
|
||||
|
||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
||||
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||
import { Faction } from "../../Faction/Faction";
|
||||
import { Faction } from "../Faction";
|
||||
import { PurchaseAugmentationsOrderSetting } from "../../Settings/SettingEnums";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { hasAugmentationPrereqs } from "../FactionHelpers";
|
||||
|
@ -4,7 +4,7 @@
|
||||
import React, { useState } from "react";
|
||||
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { Faction } from "../../Faction/Faction";
|
||||
import { Faction } from "../Faction";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { repFromDonation } from "../formulas/donation";
|
||||
import { Favor } from "../../ui/React/Favor";
|
||||
|
@ -13,7 +13,7 @@ import { Option } from "./Option";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
|
||||
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
import { Faction } from "../../Faction/Faction";
|
||||
import { Faction } from "../Faction";
|
||||
|
||||
import { use } from "../../ui/Context";
|
||||
import { CreateGangModal } from "./CreateGangModal";
|
||||
@ -24,6 +24,7 @@ import { CovenantPurchasesRoot } from "../../PersonObjects/Sleeve/ui/CovenantPur
|
||||
|
||||
type IProps = {
|
||||
faction: Faction;
|
||||
augPage: boolean;
|
||||
};
|
||||
|
||||
// Info text for all options on the UI
|
||||
@ -70,7 +71,6 @@ function MainPage({ faction, rerender, onAugmentations }: IMainProps): React.Rea
|
||||
const router = use.Router();
|
||||
const [sleevesOpen, setSleevesOpen] = useState(false);
|
||||
const [gangOpen, setGangOpen] = useState(false);
|
||||
const p = player;
|
||||
const factionInfo = faction.getInfo();
|
||||
|
||||
function manageGang(): void {
|
||||
@ -104,20 +104,20 @@ function MainPage({ faction, rerender, onAugmentations }: IMainProps): React.Rea
|
||||
|
||||
// We have a special flag for whether the player this faction is the player's
|
||||
// gang faction because if the player has a gang, they cannot do any other action
|
||||
const isPlayersGang = p.inGang() && p.getGangName() === faction.name;
|
||||
const isPlayersGang = player.inGang() && player.getGangName() === faction.name;
|
||||
|
||||
// Flags for whether special options (gang, sleeve purchases, donate, etc.)
|
||||
// should be shown
|
||||
const favorToDonate = Math.floor(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction);
|
||||
const canDonate = faction.favor >= favorToDonate;
|
||||
|
||||
const canPurchaseSleeves = faction.name === "The Covenant" && p.bitNodeN === 10;
|
||||
const canPurchaseSleeves = faction.name === "The Covenant" && player.bitNodeN === 10;
|
||||
|
||||
let canAccessGang = p.canAccessGang() && GangNames.includes(faction.name);
|
||||
if (p.inGang()) {
|
||||
if (p.getGangName() !== faction.name) {
|
||||
let canAccessGang = player.canAccessGang() && GangNames.includes(faction.name);
|
||||
if (player.inGang()) {
|
||||
if (player.getGangName() !== faction.name) {
|
||||
canAccessGang = false;
|
||||
} else if (p.getGangName() === faction.name) {
|
||||
} else if (player.getGangName() === faction.name) {
|
||||
canAccessGang = true;
|
||||
}
|
||||
}
|
||||
@ -174,6 +174,10 @@ function MainPage({ faction, rerender, onAugmentations }: IMainProps): React.Rea
|
||||
|
||||
export function FactionRoot(props: IProps): React.ReactElement {
|
||||
const setRerender = useState(false)[1];
|
||||
const player = use.Player();
|
||||
const router = use.Router();
|
||||
const [purchasingAugs, setPurchasingAugs] = useState(props.augPage);
|
||||
|
||||
function rerender(): void {
|
||||
setRerender((old) => !old);
|
||||
}
|
||||
@ -185,7 +189,16 @@ export function FactionRoot(props: IProps): React.ReactElement {
|
||||
|
||||
const faction = props.faction;
|
||||
|
||||
const [purchasingAugs, setPurchasingAugs] = useState(false);
|
||||
if (player && !player.factions.includes(faction.name)) {
|
||||
return (
|
||||
<>
|
||||
<Typography variant="h4" color="primary">
|
||||
You have not joined {faction.name} yet!
|
||||
</Typography>
|
||||
<Button onClick={() => router.toFactions()}>Back to Factions</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return purchasingAugs ? (
|
||||
<AugmentationsPage faction={faction} routeToMainPage={() => setPurchasingAugs(false)} />
|
||||
|
@ -41,6 +41,10 @@ export function FactionsRoot(props: IProps): React.ReactElement {
|
||||
props.router.toFaction(faction);
|
||||
}
|
||||
|
||||
function openFactionAugPage(faction: Faction): void {
|
||||
props.router.toFaction(faction, true);
|
||||
}
|
||||
|
||||
function acceptInvitation(event: React.MouseEvent<HTMLButtonElement, MouseEvent>, faction: string): void {
|
||||
if (!event.isTrusted) return;
|
||||
joinFaction(Factions[faction]);
|
||||
@ -61,7 +65,7 @@ export function FactionsRoot(props: IProps): React.ReactElement {
|
||||
</Typography>
|
||||
{(props.player.factions.length > 0 && (
|
||||
<Paper sx={{ my: 1, p: 1, pb: 0, display: "inline-block" }}>
|
||||
<Table padding="none">
|
||||
<Table padding="none" style={{ width: "fit-content" }}>
|
||||
<TableBody>
|
||||
{props.player.factions.map((faction: string) => (
|
||||
<TableRow key={faction}>
|
||||
@ -75,6 +79,17 @@ export function FactionsRoot(props: IProps): React.ReactElement {
|
||||
<Button onClick={() => openFaction(Factions[faction])}>Details</Button>
|
||||
</Box>
|
||||
</TableCell>
|
||||
<TableCell align="right">
|
||||
<Box ml={1} mb={1}>
|
||||
<Button sx={{ width: '100%' }} onClick={() => openFactionAugPage(Factions[faction])}>
|
||||
Augmentations Left: {Factions[faction]
|
||||
.augmentations
|
||||
.filter((augmentation: string) =>
|
||||
!props.player.hasAugmentation(augmentation))
|
||||
.length}
|
||||
</Button>
|
||||
</Box>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
|
@ -4,8 +4,8 @@
|
||||
*/
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
import { Faction } from "../../Faction/Faction";
|
||||
import { FactionInfo } from "../../Faction/FactionInfo";
|
||||
import { Faction } from "../Faction";
|
||||
import { FactionInfo } from "../FactionInfo";
|
||||
|
||||
import { Reputation } from "../../ui/React/Reputation";
|
||||
import { Favor } from "../../ui/React/Favor";
|
||||
|
@ -9,7 +9,7 @@ import { PurchaseAugmentationModal } from "./PurchaseAugmentationModal";
|
||||
|
||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
||||
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||
import { Faction } from "../../Faction/Faction";
|
||||
import { Faction } from "../Faction";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
|
@ -32,7 +32,7 @@ export function GangRoot(): React.ReactElement {
|
||||
|
||||
return (
|
||||
<Context.Gang.Provider value={gang}>
|
||||
<Tabs variant="fullWidth" value={value} onChange={handleChange}>
|
||||
<Tabs variant="fullWidth" value={value} onChange={handleChange} sx={{ minWidth: 'fit-content', maxWidth: '45%' }}>
|
||||
<Tab label="Management" />
|
||||
<Tab label="Equipment" />
|
||||
<Tab label="Territory" />
|
||||
|
@ -172,7 +172,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
<Table size="small">
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<TableCell colSpan={3}>
|
||||
<Typography>{node.name}</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
@ -404,8 +404,9 @@ export const Literatures: IMap<Literature> = {};
|
||||
"What will the fate of the human race be?<br><br>" +
|
||||
"We live in an era vastly different from that of 15 or even 20 years ago. We have gone " +
|
||||
"beyond the limits of humanity. We have stripped ourselves of the tyranny of flesh.<br><br>" +
|
||||
"The Singularity is here. The merging of man and machine. This is where humanity evolves into ";
|
||||
"something greater. This is our future.<br><br>" + "Embrace it, and you will obey a new god. The God in the Machine.";
|
||||
"The Singularity is here. The merging of man and machine. This is where humanity evolves into " +
|
||||
"something greater. This is our future.<br><br>" +
|
||||
"Embrace it, and you will obey a new god. The God in the Machine.";
|
||||
Literatures[fn] = new Literature(title, fn, txt);
|
||||
|
||||
title = "The New Triads";
|
||||
|
@ -59,6 +59,8 @@ export const RamCostConstants: IMap<number> = {
|
||||
|
||||
ScriptBladeburnerApiBaseRamCost: 4,
|
||||
|
||||
ScriptStanekWidth: 0.4,
|
||||
ScriptStanekHeight: 0.4,
|
||||
ScriptStanekCharge: 0.4,
|
||||
ScriptStanekFragmentDefinitions: 0,
|
||||
ScriptStanekPlacedFragments: 5,
|
||||
@ -354,6 +356,8 @@ export const RamCosts: IMap<any> = {
|
||||
},
|
||||
|
||||
stanek: {
|
||||
width: RamCostConstants.ScriptStanekWidth,
|
||||
height: RamCostConstants.ScriptStanekHeight,
|
||||
charge: RamCostConstants.ScriptStanekCharge,
|
||||
fragmentDefinitions: RamCostConstants.ScriptStanekFragmentDefinitions,
|
||||
activeFragments: RamCostConstants.ScriptStanekPlacedFragments,
|
||||
|
@ -60,8 +60,5 @@ export function isScriptErrorMessage(msg: string): boolean {
|
||||
return false;
|
||||
}
|
||||
const splitMsg = msg.split("|DELIMITER|");
|
||||
if (splitMsg.length != 4) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return splitMsg.length == 4;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
throw makeRuntimeRejectMsg(
|
||||
workerScript,
|
||||
`Invalid scriptArgs argument passed into getRunningScript() from ${callingFnName}(). ` +
|
||||
`This is probably a bug. Please report to game developer`,
|
||||
`This is probably a bug. Please report to game developer`,
|
||||
);
|
||||
}
|
||||
|
||||
@ -692,8 +692,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
workerScript.log(
|
||||
"weaken",
|
||||
() =>
|
||||
`'${server.hostname}' security level weakened to ${
|
||||
server.hackDifficulty
|
||||
`'${server.hostname}' security level weakened to ${server.hackDifficulty
|
||||
}. Gained ${numeralWrapper.formatExp(expGain)} hacking exp (t=${numeralWrapper.formatThreads(threads)})`,
|
||||
);
|
||||
workerScript.scriptRef.onlineExpGained += expGain;
|
||||
@ -703,7 +702,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
},
|
||||
weakenAnalyze: function (threads: any, cores: any = 1): number {
|
||||
const coreBonus = 1 + (cores - 1) / 16;
|
||||
return CONSTANTS.ServerWeakenAmount * threads * coreBonus;
|
||||
return CONSTANTS.ServerWeakenAmount * threads * coreBonus * BitNodeMultipliers.ServerWeakenRate;
|
||||
},
|
||||
share: function (): Promise<void> {
|
||||
workerScript.log("share", () => "Sharing this computer.");
|
||||
@ -807,7 +806,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
if (possibleLogs[fn] === undefined) {
|
||||
throw makeRuntimeErrorMsg("isLogEnabled", `Invalid argument: ${fn}.`);
|
||||
}
|
||||
return workerScript.disableLogs[fn] ? false : true;
|
||||
return !workerScript.disableLogs[fn];
|
||||
},
|
||||
getScriptLogs: function (fn: any, hostname: any, ...scriptArgs: any): any {
|
||||
const runningScriptObj = getRunningScript(fn, hostname, "getScriptLogs", scriptArgs);
|
||||
@ -1121,7 +1120,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
|
||||
// Invalid file name
|
||||
if (!scriptname.endsWith(".lit") && !isScriptFilename(scriptname) && !scriptname.endsWith("txt")) {
|
||||
throw makeRuntimeErrorMsg("scp", "Only works for .script, .lit, and .txt files");
|
||||
throw makeRuntimeErrorMsg("scp", "Only works for scripts, .lit and .txt files");
|
||||
}
|
||||
|
||||
let destServer: BaseServer | null;
|
||||
@ -1590,10 +1589,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
}
|
||||
}
|
||||
const txtFile = getTextFile(filename, server);
|
||||
if (txtFile != null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return txtFile != null;
|
||||
},
|
||||
isRunning: function (fn: any, hostname: any = workerScript.hostname, ...scriptArgs: any): any {
|
||||
updateDynamicRam("isRunning", getRamCost(Player, "isRunning"));
|
||||
@ -1628,6 +1624,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
return cost;
|
||||
},
|
||||
purchaseServer: function (aname: any, aram: any): any {
|
||||
if (arguments.length !== 2) throw makeRuntimeErrorMsg("purchaseServer", "Takes 2 arguments");
|
||||
const name = helper.string("purchaseServer", "name", aname);
|
||||
const ram = helper.number("purchaseServer", "ram", aram);
|
||||
updateDynamicRam("purchaseServer", getRamCost(Player, "purchaseServer"));
|
||||
@ -1649,9 +1646,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
|
||||
const cost = getPurchaseServerCost(ram);
|
||||
if (cost === Infinity) {
|
||||
if(ram > getPurchaseServerMaxRam()){
|
||||
if (ram > getPurchaseServerMaxRam()) {
|
||||
workerScript.log("purchaseServer", () => `Invalid argument: ram='${ram}' must not be greater than getPurchaseServerMaxRam`);
|
||||
}else{
|
||||
} else {
|
||||
workerScript.log("purchaseServer", () => `Invalid argument: ram='${ram}' must be a positive power of 2`);
|
||||
}
|
||||
|
||||
@ -1836,6 +1833,12 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
},
|
||||
tryWritePort: function (port: any, data: any = ""): any {
|
||||
updateDynamicRam("tryWritePort", getRamCost(Player, "tryWritePort"));
|
||||
if (typeof data !== "string" && typeof data !== "number") {
|
||||
throw makeRuntimeErrorMsg(
|
||||
"tryWritePort",
|
||||
`Trying to write invalid data to a port: only strings and numbers are valid.`,
|
||||
);
|
||||
}
|
||||
if (!isNaN(port)) {
|
||||
port = Math.round(port);
|
||||
if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {
|
||||
@ -2279,7 +2282,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
if (typeof f !== "function") {
|
||||
throw makeRuntimeErrorMsg("atExit", "argument should be function");
|
||||
}
|
||||
workerScript.atExit = f;
|
||||
workerScript.atExit = () => { f(); }; // Wrap the user function to prevent WorkerScript leaking as 'this'
|
||||
},
|
||||
mv: function (host: string, source: string, destination: string): void {
|
||||
updateDynamicRam("mv", getRamCost(Player, "mv"));
|
||||
|
@ -365,7 +365,7 @@ export function NetscriptBladeburner(
|
||||
checkBladeburnerAccess("getBonusTime");
|
||||
const bladeburner = player.bladeburner;
|
||||
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
|
||||
return Math.round(bladeburner.storedCycles / 5);
|
||||
return (Math.round(bladeburner.storedCycles / 5))*1000;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -49,6 +49,9 @@ import {
|
||||
SetMaterialMarketTA2,
|
||||
SetProductMarketTA1,
|
||||
SetProductMarketTA2,
|
||||
BulkPurchase,
|
||||
SellShares,
|
||||
BuyBackShares,
|
||||
SetSmartSupplyUseLeftovers,
|
||||
} from "../Corporation/Actions";
|
||||
import { CorporationUnlockUpgrades } from "../Corporation/data/CorporationUnlockUpgrades";
|
||||
@ -178,6 +181,7 @@ export function NetscriptCorporation(
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function getResearchCost(division: IIndustry, researchName: string): number {
|
||||
const researchTree = IndustryResearchTrees[division.type];
|
||||
if (researchTree === undefined) throw new Error(`No research tree for industry '${division.type}'`);
|
||||
@ -193,7 +197,8 @@ export function NetscriptCorporation(
|
||||
|
||||
function bribe(factionName: string, amountCash: number, amountShares: number): boolean {
|
||||
if (!player.factions.includes(factionName)) throw new Error("Invalid faction name");
|
||||
if (isNaN(amountCash) || amountCash < 0 || isNaN(amountShares) || amountShares < 0) throw new Error("Invalid value for amount field! Must be numeric, grater than 0.");
|
||||
if (isNaN(amountCash) || amountCash < 0 || isNaN(amountShares) || amountShares < 0) throw new Error("Invalid value for amount field! Must be numeric, grater than 0.");
|
||||
|
||||
const corporation = getCorporation();
|
||||
if (corporation.funds < amountCash) return false;
|
||||
if (corporation.numShares < amountShares) return false;
|
||||
@ -271,25 +276,25 @@ export function NetscriptCorporation(
|
||||
|
||||
function getSafeDivision(division: Industry): NSDivision {
|
||||
const cities: string[] = [];
|
||||
for (const office of Object.values(division.offices)) {
|
||||
if (office === 0) continue;
|
||||
cities.push(office.loc);
|
||||
}
|
||||
return {
|
||||
name: division.name,
|
||||
type: division.type,
|
||||
awareness: division.awareness,
|
||||
popularity: division.popularity,
|
||||
prodMult: division.prodMult,
|
||||
research: division.sciResearch.qty,
|
||||
lastCycleRevenue: division.lastCycleRevenue,
|
||||
lastCycleExpenses: division.lastCycleExpenses,
|
||||
thisCycleRevenue: division.thisCycleRevenue,
|
||||
thisCycleExpenses: division.thisCycleExpenses,
|
||||
upgrades: division.upgrades,
|
||||
cities: cities,
|
||||
products: division.products === undefined ? [] : Object.keys(division.products),
|
||||
};
|
||||
for (const office of Object.values(division.offices)) {
|
||||
if (office === 0) continue;
|
||||
cities.push(office.loc);
|
||||
}
|
||||
return {
|
||||
name: division.name,
|
||||
type: division.type,
|
||||
awareness: division.awareness,
|
||||
popularity: division.popularity,
|
||||
prodMult: division.prodMult,
|
||||
research: division.sciResearch.qty,
|
||||
lastCycleRevenue: division.lastCycleRevenue,
|
||||
lastCycleExpenses: division.lastCycleExpenses,
|
||||
thisCycleRevenue: division.thisCycleRevenue,
|
||||
thisCycleExpenses: division.thisCycleExpenses,
|
||||
upgrades: division.upgrades,
|
||||
cities: cities,
|
||||
products: division.products === undefined ? [] : Object.keys(division.products),
|
||||
};
|
||||
}
|
||||
|
||||
const warehouseAPI: WarehouseAPI = {
|
||||
@ -409,6 +414,8 @@ export function NetscriptCorporation(
|
||||
const cityName = helper.string("sellProduct", "cityName", acityName);
|
||||
const enabled = helper.boolean(aenabled);
|
||||
const warehouse = getWarehouse(divisionName, cityName);
|
||||
if (!hasUnlockUpgrade("Smart Supply"))
|
||||
throw helper.makeRuntimeErrorMsg(`corporation.setSmartSupply`, `You have not purchased the Smart Supply upgrade!`);
|
||||
SetSmartSupply(warehouse, enabled);
|
||||
},
|
||||
setSmartSupplyUseLeftovers: function (adivisionName: any, acityName: any, amaterialName: any, aenabled: any): void {
|
||||
@ -419,6 +426,8 @@ export function NetscriptCorporation(
|
||||
const enabled = helper.boolean(aenabled);
|
||||
const warehouse = getWarehouse(divisionName, cityName);
|
||||
const material = getMaterial(divisionName, cityName, materialName);
|
||||
if (!hasUnlockUpgrade("Smart Supply"))
|
||||
throw helper.makeRuntimeErrorMsg(`corporation.setSmartSupply`, `You have not purchased the Smart Supply upgrade!`);
|
||||
SetSmartSupplyUseLeftovers(warehouse, material, enabled);
|
||||
},
|
||||
buyMaterial: function (adivisionName: any, acityName: any, amaterialName: any, aamt: any): void {
|
||||
@ -427,10 +436,22 @@ export function NetscriptCorporation(
|
||||
const cityName = helper.string("buyMaterial", "cityName", acityName);
|
||||
const materialName = helper.string("buyMaterial", "materialName", amaterialName);
|
||||
const amt = helper.number("buyMaterial", "amt", aamt);
|
||||
if (amt < 0) throw new Error("Invalid value for amount field! Must be numeric and grater than 0");
|
||||
if (amt < 0) throw new Error("Invalid value for amount field! Must be numeric and greater than 0");
|
||||
const material = getMaterial(divisionName, cityName, materialName);
|
||||
BuyMaterial(material, amt);
|
||||
},
|
||||
bulkPurchase: function (adivisionName: any, acityName: any, amaterialName: any, aamt: any): void {
|
||||
checkAccess("bulkPurchase", 7);
|
||||
const divisionName = helper.string("bulkPurchase", "divisionName", adivisionName);
|
||||
if (!hasResearched(getDivision(adivisionName), "Bulk Purchasing")) throw new Error(`You have not researched Bulk Purchasing in ${divisionName}`)
|
||||
const corporation = getCorporation();
|
||||
const cityName = helper.string("bulkPurchase", "cityName", acityName);
|
||||
const materialName = helper.string("bulkPurchase", "materialName", amaterialName);
|
||||
const amt = helper.number("bulkPurchase", "amt", aamt);
|
||||
const warehouse = getWarehouse(divisionName, cityName)
|
||||
const material = getMaterial(divisionName, cityName, materialName);
|
||||
BulkPurchase(corporation, warehouse, material, amt);
|
||||
},
|
||||
makeProduct: function (
|
||||
adivisionName: any,
|
||||
acityName: any,
|
||||
@ -462,7 +483,7 @@ export function NetscriptCorporation(
|
||||
const targetCity = helper.string("exportMaterial", "targetCity", atargetCity);
|
||||
const materialName = helper.string("exportMaterial", "materialName", amaterialName);
|
||||
const amt = helper.string("exportMaterial", "amt", aamt);
|
||||
ExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName), amt + "");
|
||||
ExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName), amt + "", getDivision(targetDivision));
|
||||
},
|
||||
cancelExportMaterial: function (
|
||||
asourceDivision: any,
|
||||
@ -487,6 +508,8 @@ export function NetscriptCorporation(
|
||||
const cityName = helper.string("setMaterialMarketTA1", "cityName", acityName);
|
||||
const materialName = helper.string("setMaterialMarketTA1", "materialName", amaterialName);
|
||||
const on = helper.boolean(aon);
|
||||
if (!getDivision(divisionName).hasResearch("Market-TA.I"))
|
||||
throw helper.makeRuntimeErrorMsg(`corporation.setMaterialMarketTA1`, `You have not researched MarketTA.I for division: ${divisionName}`);
|
||||
SetMaterialMarketTA1(getMaterial(divisionName, cityName, materialName), on);
|
||||
},
|
||||
setMaterialMarketTA2: function (adivisionName: any, acityName: any, amaterialName: any, aon: any): void {
|
||||
@ -495,6 +518,8 @@ export function NetscriptCorporation(
|
||||
const cityName = helper.string("setMaterialMarketTA2", "cityName", acityName);
|
||||
const materialName = helper.string("setMaterialMarketTA2", "materialName", amaterialName);
|
||||
const on = helper.boolean(aon);
|
||||
if (!getDivision(divisionName).hasResearch("Market-TA.II"))
|
||||
throw helper.makeRuntimeErrorMsg(`corporation.setMaterialMarketTA2`, `You have not researched MarketTA.II for division: ${divisionName}`);
|
||||
SetMaterialMarketTA2(getMaterial(divisionName, cityName, materialName), on);
|
||||
},
|
||||
setProductMarketTA1: function (adivisionName: any, aproductName: any, aon: any): void {
|
||||
@ -502,6 +527,8 @@ export function NetscriptCorporation(
|
||||
const divisionName = helper.string("setProductMarketTA1", "divisionName", adivisionName);
|
||||
const productName = helper.string("setProductMarketTA1", "productName", aproductName);
|
||||
const on = helper.boolean(aon);
|
||||
if (!getDivision(divisionName).hasResearch("Market-TA.I"))
|
||||
throw helper.makeRuntimeErrorMsg(`corporation.setProductMarketTA1`, `You have not researched MarketTA.I for division: ${divisionName}`);
|
||||
SetProductMarketTA1(getProduct(divisionName, productName), on);
|
||||
},
|
||||
setProductMarketTA2: function (adivisionName: any, aproductName: any, aon: any): void {
|
||||
@ -509,6 +536,8 @@ export function NetscriptCorporation(
|
||||
const divisionName = helper.string("setProductMarketTA2", "divisionName", adivisionName);
|
||||
const productName = helper.string("setProductMarketTA2", "productName", aproductName);
|
||||
const on = helper.boolean(aon);
|
||||
if (!getDivision(divisionName).hasResearch("Market-TA.II"))
|
||||
throw helper.makeRuntimeErrorMsg(`corporation.setProductMarketTA2`, `You have not researched MarketTA.II for division: ${divisionName}`);
|
||||
SetProductMarketTA2(getProduct(divisionName, productName), on);
|
||||
},
|
||||
};
|
||||
@ -559,7 +588,7 @@ export function NetscriptCorporation(
|
||||
const divisionName = helper.string("getOfficeSizeUpgradeCost", "divisionName", adivisionName);
|
||||
const cityName = helper.string("getOfficeSizeUpgradeCost", "cityName", acityName);
|
||||
const size = helper.number("getOfficeSizeUpgradeCost", "size", asize);
|
||||
if (size < 0) throw new Error("Invalid value for size field! Must be numeric and grater than 0");
|
||||
if (size < 0) throw new Error("Invalid value for size field! Must be numeric and greater than 0");
|
||||
const office = getOffice(divisionName, cityName);
|
||||
const initialPriceMult = Math.round(office.size / CorporationConstants.OfficeInitialSize);
|
||||
const costMultiplier = 1.09;
|
||||
@ -592,7 +621,7 @@ export function NetscriptCorporation(
|
||||
const divisionName = helper.string("upgradeOfficeSize", "divisionName", adivisionName);
|
||||
const cityName = helper.string("upgradeOfficeSize", "cityName", acityName);
|
||||
const size = helper.number("upgradeOfficeSize", "size", asize);
|
||||
if (size < 0) throw new Error("Invalid value for size field! Must be numeric and grater than 0");
|
||||
if (size < 0) throw new Error("Invalid value for size field! Must be numeric and greater than 0");
|
||||
const office = getOffice(divisionName, cityName);
|
||||
const corporation = getCorporation();
|
||||
UpgradeOfficeSize(corporation, office, size);
|
||||
@ -602,7 +631,7 @@ export function NetscriptCorporation(
|
||||
const divisionName = helper.string("throwParty", "divisionName", adivisionName);
|
||||
const cityName = helper.string("throwParty", "cityName", acityName);
|
||||
const costPerEmployee = helper.number("throwParty", "costPerEmployee", acostPerEmployee);
|
||||
if (costPerEmployee < 0) throw new Error("Invalid value for Cost Per Employee field! Must be numeric and grater than 0");
|
||||
if (costPerEmployee < 0) throw new Error("Invalid value for Cost Per Employee field! Must be numeric and greater than 0");
|
||||
const office = getOffice(divisionName, cityName);
|
||||
const corporation = getCorporation();
|
||||
return netscriptDelay(
|
||||
@ -721,8 +750,10 @@ export function NetscriptCorporation(
|
||||
issueDividends: function (apercent: any): void {
|
||||
checkAccess("issueDividends");
|
||||
const percent = helper.number("issueDividends", "percent", apercent);
|
||||
if (percent < 0 || percent > 100) throw new Error("Invalid value for percent field! Must be numeric, grater than 0, and less than 100");
|
||||
if (percent < 0 || percent > 100) throw new Error("Invalid value for percent field! Must be numeric, greater than 0, and less than 100");
|
||||
const corporation = getCorporation();
|
||||
if (!corporation.public)
|
||||
throw helper.makeRuntimeErrorMsg(`corporation.issueDividends`, `Your company has not gone public!`);
|
||||
IssueDividends(corporation, percent);
|
||||
},
|
||||
|
||||
@ -781,24 +812,34 @@ export function NetscriptCorporation(
|
||||
const industryName = helper.string("getExpandIndustryCost", "industryName", aindustryName);
|
||||
return getExpandIndustryCost(industryName);
|
||||
},
|
||||
getExpandCityCost: function(): number {
|
||||
getExpandCityCost: function (): number {
|
||||
checkAccess("getExpandCityCost");
|
||||
return getExpandCityCost();
|
||||
},
|
||||
getInvestmentOffer: function(): InvestmentOffer {
|
||||
getInvestmentOffer: function (): InvestmentOffer {
|
||||
checkAccess("getInvestmentOffer");
|
||||
return getInvestmentOffer();
|
||||
},
|
||||
acceptInvestmentOffer: function(): boolean {
|
||||
acceptInvestmentOffer: function (): boolean {
|
||||
checkAccess("acceptInvestmentOffer");
|
||||
return acceptInvestmentOffer();
|
||||
},
|
||||
goPublic: function(anumShares: any): boolean {
|
||||
goPublic: function (anumShares: any): boolean {
|
||||
checkAccess("acceptInvestmentOffer");
|
||||
const numShares = helper.number("goPublic", "numShares", anumShares);
|
||||
return goPublic(numShares);
|
||||
},
|
||||
bribe: function(afactionName: string, aamountCash: any, aamountShares: any): boolean {
|
||||
sellShares: function (anumShares: any): number {
|
||||
checkAccess("acceptInvestmentOffer");
|
||||
const numShares = helper.number("sellStock", "numShares", anumShares);
|
||||
return SellShares(getCorporation(), player, numShares);
|
||||
},
|
||||
buyBackShares: function (anumShares: any): boolean {
|
||||
checkAccess("acceptInvestmentOffer");
|
||||
const numShares = helper.number("buyStock", "numShares", anumShares);
|
||||
return BuyBackShares(getCorporation(), player, numShares);
|
||||
},
|
||||
bribe: function (afactionName: string, aamountCash: any, aamountShares: any): boolean {
|
||||
checkAccess("bribe");
|
||||
const factionName = helper.string("bribe", "factionName", afactionName);
|
||||
const amountCash = helper.number("bribe", "amountCash", aamountCash);
|
||||
|
@ -1212,7 +1212,7 @@ export function NetscriptSingularity(
|
||||
);
|
||||
return false;
|
||||
}
|
||||
const repNeededToDonate = Math.round(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction);
|
||||
const repNeededToDonate = Math.floor(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction);
|
||||
if (faction.favor < repNeededToDonate) {
|
||||
workerScript.log(
|
||||
"donateToFaction",
|
||||
|
@ -284,7 +284,7 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
||||
},
|
||||
purchaseSleeveAug: function (asleeveNumber: any = 0, aaugName: any = ""): boolean {
|
||||
const sleeveNumber = helper.number("purchaseSleeveAug", "sleeveNumber", asleeveNumber);
|
||||
const augName = helper.string("setToUniversityCourse", "augName", aaugName);
|
||||
const augName = helper.string("purchaseSleeveAug", "augName", aaugName);
|
||||
helper.updateDynamicRam("purchaseSleeveAug", getRamCost(player, "sleeve", "purchaseSleeveAug"));
|
||||
checkSleeveAPIAccess("purchaseSleeveAug");
|
||||
checkSleeveNumber("purchaseSleeveAug", sleeveNumber);
|
||||
|
@ -23,9 +23,13 @@ export function NetscriptStanek(player: IPlayer, workerScript: WorkerScript, hel
|
||||
|
||||
return {
|
||||
width: function (): number {
|
||||
helper.updateDynamicRam("width", getRamCost(player, "stanek", "width"));
|
||||
checkStanekAPIAccess("width");
|
||||
return staneksGift.width();
|
||||
},
|
||||
height: function (): number {
|
||||
helper.updateDynamicRam("height", getRamCost(player, "stanek", "height"));
|
||||
checkStanekAPIAccess("height");
|
||||
return staneksGift.height();
|
||||
},
|
||||
charge: function (arootX: unknown, arootY: unknown): Promise<void> {
|
||||
|
@ -14,7 +14,6 @@ export function NetscriptPort(): IPort {
|
||||
const data: any[] = [];
|
||||
|
||||
return {
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
write: (value: any): any => {
|
||||
data.push(value);
|
||||
if (data.length > Settings.MaxPortCapacity) {
|
||||
@ -23,7 +22,6 @@ export function NetscriptPort(): IPort {
|
||||
return null;
|
||||
},
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
tryWrite: (value: any): boolean => {
|
||||
if (data.length >= Settings.MaxPortCapacity) {
|
||||
return false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
export function CalculateShareMult(power: number): number {
|
||||
const x = 1 + Math.log(power) / (8 * Math.log(1000));
|
||||
const x = 1 + Math.log(power) / 25;
|
||||
if (isNaN(x) || !isFinite(x)) return 1;
|
||||
return x;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import { Cities } from "../../Locations/Cities";
|
||||
import { Locations } from "../../Locations/Locations";
|
||||
import { CityName } from "../../Locations/data/CityNames";
|
||||
import { LocationName } from "../../Locations/data/LocationNames";
|
||||
import { Sleeve } from "../../PersonObjects/Sleeve/Sleeve";
|
||||
import { Sleeve } from "../Sleeve/Sleeve";
|
||||
import {
|
||||
calculateSkill as calculateSkillF,
|
||||
calculateSkillProgress as calculateSkillProgressF,
|
||||
@ -590,7 +590,7 @@ export function process(this: IPlayer, router: IRouter, numCycles = 1): void {
|
||||
if (this.isWorking) {
|
||||
if (this.workType == CONSTANTS.WorkTypeFaction) {
|
||||
if (this.workForFaction(numCycles)) {
|
||||
router.toFaction();
|
||||
router.toFaction(Factions[this.currentWorkFactionName]);
|
||||
}
|
||||
} else if (this.workType == CONSTANTS.WorkTypeCreateProgram) {
|
||||
if (this.createProgramWork(numCycles)) {
|
||||
@ -933,6 +933,8 @@ export function startFactionSecurityWork(this: IPlayer, faction: Faction): void
|
||||
export function workForFaction(this: IPlayer, numCycles: number): boolean {
|
||||
const faction = Factions[this.currentWorkFactionName];
|
||||
|
||||
if (!faction) { return false; }
|
||||
|
||||
//Constantly update the rep gain rate
|
||||
switch (this.factionWorkType) {
|
||||
case CONSTANTS.FactionWorkHacking:
|
||||
@ -1708,7 +1710,7 @@ export function applyForJob(this: IPlayer, entryPosType: CompanyPosition, sing =
|
||||
if (!this.isQualified(company, pos)) {
|
||||
const reqText = getJobRequirementText(company, pos);
|
||||
if (!sing) {
|
||||
dialogBoxCreate("Unforunately, you do not qualify for this position<br>" + reqText);
|
||||
dialogBoxCreate("Unfortunately, you do not qualify for this position<br>" + reqText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1849,7 +1851,7 @@ export function applyForSecurityEngineerJob(this: IPlayer, sing = false): boolea
|
||||
return this.applyForJob(CompanyPositions[posNames.SecurityEngineerCompanyPositions[0]], sing);
|
||||
} else {
|
||||
if (!sing) {
|
||||
dialogBoxCreate("Unforunately, you do not qualify for this position");
|
||||
dialogBoxCreate("Unfortunately, you do not qualify for this position");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1862,7 +1864,7 @@ export function applyForNetworkEngineerJob(this: IPlayer, sing = false): boolean
|
||||
return this.applyForJob(pos, sing);
|
||||
} else {
|
||||
if (!sing) {
|
||||
dialogBoxCreate("Unforunately, you do not qualify for this position");
|
||||
dialogBoxCreate("Unfortunately, you do not qualify for this position");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1889,7 +1891,7 @@ export function applyForAgentJob(this: IPlayer, sing = false): boolean {
|
||||
return this.applyForJob(pos, sing);
|
||||
} else {
|
||||
if (!sing) {
|
||||
dialogBoxCreate("Unforunately, you do not qualify for this position");
|
||||
dialogBoxCreate("Unfortunately, you do not qualify for this position");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1914,7 +1916,7 @@ export function applyForEmployeeJob(this: IPlayer, sing = false): boolean {
|
||||
return true;
|
||||
} else {
|
||||
if (!sing) {
|
||||
dialogBoxCreate("Unforunately, you do not qualify for this position");
|
||||
dialogBoxCreate("Unfortunately, you do not qualify for this position");
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -1939,7 +1941,7 @@ export function applyForPartTimeEmployeeJob(this: IPlayer, sing = false): boolea
|
||||
return true;
|
||||
} else {
|
||||
if (!sing) {
|
||||
dialogBoxCreate("Unforunately, you do not qualify for this position");
|
||||
dialogBoxCreate("Unfortunately, you do not qualify for this position");
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -1963,7 +1965,7 @@ export function applyForWaiterJob(this: IPlayer, sing = false): boolean {
|
||||
return true;
|
||||
} else {
|
||||
if (!sing) {
|
||||
dialogBoxCreate("Unforunately, you do not qualify for this position");
|
||||
dialogBoxCreate("Unfortunately, you do not qualify for this position");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1986,7 +1988,7 @@ export function applyForPartTimeWaiterJob(this: IPlayer, sing = false): boolean
|
||||
return true;
|
||||
} else {
|
||||
if (!sing) {
|
||||
dialogBoxCreate("Unforunately, you do not qualify for this position");
|
||||
dialogBoxCreate("Unfortunately, you do not qualify for this position");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -2002,18 +2004,13 @@ export function isQualified(this: IPlayer, company: Company, position: CompanyPo
|
||||
const reqAgility = position.requiredDexterity > 0 ? position.requiredDexterity + offset : 0;
|
||||
const reqCharisma = position.requiredCharisma > 0 ? position.requiredCharisma + offset : 0;
|
||||
|
||||
if (
|
||||
this.hacking >= reqHacking &&
|
||||
return this.hacking >= reqHacking &&
|
||||
this.strength >= reqStrength &&
|
||||
this.defense >= reqDefense &&
|
||||
this.dexterity >= reqDexterity &&
|
||||
this.agility >= reqAgility &&
|
||||
this.charisma >= reqCharisma &&
|
||||
company.playerReputation >= position.requiredReputation
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
company.playerReputation >= position.requiredReputation;
|
||||
}
|
||||
|
||||
/********** Reapplying Augmentations and Source File ***********/
|
||||
@ -2571,7 +2568,7 @@ export function queueAugmentation(this: IPlayer, name: string): void {
|
||||
|
||||
/************* Coding Contracts **************/
|
||||
export function gainCodingContractReward(this: IPlayer, reward: ICodingContractReward, difficulty = 1): string {
|
||||
if (reward == null || reward.type == null || reward == null) {
|
||||
if (reward == null || reward.type == null) {
|
||||
return `No reward for this contract`;
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,7 @@ export class Sleeve extends Person {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on every sleeve for a Source File prestige
|
||||
* Called on every sleeve for a Source File Prestige
|
||||
*/
|
||||
prestige(p: IPlayer): void {
|
||||
// Reset exp
|
||||
@ -454,6 +454,10 @@ export class Sleeve extends Person {
|
||||
this.augmentations = [];
|
||||
this.resetMultipliers();
|
||||
|
||||
// Reset Location
|
||||
|
||||
this.city = CityName.Sector12;
|
||||
|
||||
// Reset sleeve-related stats
|
||||
this.shock = 1;
|
||||
this.storedCycles = 0;
|
||||
@ -855,10 +859,8 @@ export class Sleeve extends Person {
|
||||
* Returns boolean indicating success
|
||||
*/
|
||||
workForFaction(p: IPlayer, factionName: string, workType: string): boolean {
|
||||
if (factionName === "") {
|
||||
return false;
|
||||
}
|
||||
if (!(Factions[factionName] instanceof Faction) || !p.factions.includes(factionName)) {
|
||||
const faction = Factions[factionName]
|
||||
if (factionName === "" || !faction || !(faction instanceof Faction) || !p.factions.includes(factionName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -868,7 +870,7 @@ export class Sleeve extends Person {
|
||||
this.resetTaskStatus();
|
||||
}
|
||||
|
||||
const factionInfo = Factions[factionName].getInfo();
|
||||
const factionInfo = faction.getInfo();
|
||||
|
||||
// Set type of work (hacking/field/security), and the experience gains
|
||||
const sanitizedWorkType: string = workType.toLowerCase();
|
||||
|
@ -52,8 +52,6 @@ export function findSleevePurchasableAugs(sleeve: Sleeve, p: IPlayer): Augmentat
|
||||
availableAugs.push(aug);
|
||||
}
|
||||
}
|
||||
|
||||
return availableAugs;
|
||||
}
|
||||
|
||||
for (const facName of p.factions) {
|
||||
|
@ -17,10 +17,10 @@ import { Money } from "../../../ui/React/Money";
|
||||
import { MoneyRate } from "../../../ui/React/MoneyRate";
|
||||
import { use } from "../../../ui/Context";
|
||||
import { ReputationRate } from "../../../ui/React/ReputationRate";
|
||||
import { StatsElement } from "../ui/StatsElement";
|
||||
import { StatsElement } from "./StatsElement";
|
||||
import { MoreStatsModal } from "./MoreStatsModal";
|
||||
import { MoreEarningsModal } from "../ui/MoreEarningsModal";
|
||||
import { TaskSelector } from "../ui/TaskSelector";
|
||||
import { MoreEarningsModal } from "./MoreEarningsModal";
|
||||
import { TaskSelector } from "./TaskSelector";
|
||||
import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum";
|
||||
import { StatsTable } from "../../../ui/React/StatsTable";
|
||||
|
||||
|
@ -75,7 +75,10 @@ function possibleFactions(player: IPlayer, sleeve: Sleeve): string[] {
|
||||
}
|
||||
}
|
||||
|
||||
return factions;
|
||||
return factions.filter(faction => {
|
||||
const facInfo = Factions[faction].getInfo();
|
||||
return facInfo.offerHackingWork || facInfo.offerFieldWork || facInfo.offerSecurityWork
|
||||
});
|
||||
}
|
||||
|
||||
const tasks: {
|
||||
|
@ -161,7 +161,7 @@ class BitburnerSaveObject {
|
||||
return reject(new Error("Error importing file"));
|
||||
}
|
||||
const result = target.result;
|
||||
if (typeof result !== "string" || result === null) {
|
||||
if (typeof result !== "string") {
|
||||
return reject(new Error("FileReader event was not type string"));
|
||||
}
|
||||
const contents = result;
|
||||
|
@ -11,7 +11,7 @@ import acorn, { parse } from "acorn";
|
||||
import { RamCalculationErrorCode } from "./RamCalculationErrorCodes";
|
||||
|
||||
import { RamCosts, RamCostConstants } from "../Netscript/RamCostGenerator";
|
||||
import { Script } from "../Script/Script";
|
||||
import { Script } from "./Script";
|
||||
import { WorkerScript } from "../Netscript/WorkerScript";
|
||||
import { areImportsEquals } from "../Terminal/DirectoryHelpers";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
|
@ -2,7 +2,7 @@ import { CONSTANTS } from "../Constants";
|
||||
import { Player } from "../Player";
|
||||
import { BaseServer } from "../Server/BaseServer";
|
||||
import { Server } from "../Server/Server";
|
||||
import { RunningScript } from "../Script/RunningScript";
|
||||
import { RunningScript } from "./RunningScript";
|
||||
import { processSingleServerGrowth } from "../Server/ServerHelpers";
|
||||
import { GetServer } from "../Server/AllServers";
|
||||
|
||||
|
150
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
150
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -105,9 +105,11 @@ interface RunningScript {
|
||||
logs: string[];
|
||||
offlineExpGained: number;
|
||||
offlineMoneyMade: number;
|
||||
/** Offline running time of the script, in seconds **/
|
||||
offlineRunningTime: number;
|
||||
onlineExpGained: number;
|
||||
onlineMoneyMade: number;
|
||||
/** Online running time of the script, in seconds **/
|
||||
onlineRunningTime: number;
|
||||
pid: number;
|
||||
ramUsage: number;
|
||||
@ -533,6 +535,8 @@ export interface BitNodeMultipliers {
|
||||
CompanyWorkExpGain: number;
|
||||
/** Influences how much money the player earns when completing working their job. */
|
||||
CompanyWorkMoney: number;
|
||||
/** Influences the money gain from dividends of corporations created by the player. */
|
||||
CorporationSoftCap: number;
|
||||
/** Influences the valuation of corporations created by the player. */
|
||||
CorporationValuation: number;
|
||||
/** Influences the base experience gained for each ability when the player commits a crime. */
|
||||
@ -898,42 +902,75 @@ export interface GangTerritory {
|
||||
* @public
|
||||
*/
|
||||
export interface GangMemberInfo {
|
||||
/** Name of the gang member */
|
||||
name: string;
|
||||
/** Currently assigned task */
|
||||
task: string;
|
||||
earnedRespect: number;
|
||||
|
||||
/** Hack skill level */
|
||||
hack: number;
|
||||
/** Strength skill level */
|
||||
str: number;
|
||||
/** Defense skill level */
|
||||
def: number;
|
||||
/** Dexterity skill level */
|
||||
dex: number;
|
||||
/** Agility skill level */
|
||||
agi: number;
|
||||
/** Charisma skill level */
|
||||
cha: number;
|
||||
|
||||
/** Current hack experience */
|
||||
hack_exp: number;
|
||||
/** Current strength experience */
|
||||
str_exp: number;
|
||||
/** Current defense experience */
|
||||
def_exp: number;
|
||||
/** Current dexterity experience */
|
||||
dex_exp: number;
|
||||
/** Current agility experience */
|
||||
agi_exp: number;
|
||||
/** Current charisma experience */
|
||||
cha_exp: number;
|
||||
|
||||
/** Hack multiplier from equipment */
|
||||
hack_mult: number;
|
||||
/** Strength multiplier from equipment */
|
||||
str_mult: number;
|
||||
/** Defense multiplier from equipment */
|
||||
def_mult: number;
|
||||
/** Dexterity multiplier from equipment */
|
||||
dex_mult: number;
|
||||
/** Agility multiplier from equipment */
|
||||
agi_mult: number;
|
||||
/** Charisma multiplier from equipment */
|
||||
cha_mult: number;
|
||||
|
||||
/** Hack multiplier from ascensions */
|
||||
hack_asc_mult: number;
|
||||
/** Strength multiplier from ascensions */
|
||||
str_asc_mult: number;
|
||||
/** Defense multiplier from ascensions */
|
||||
def_asc_mult: number;
|
||||
/** Dexterity multiplier from ascensions */
|
||||
dex_asc_mult: number;
|
||||
/** Agility multiplier from ascensions */
|
||||
agi_asc_mult: number;
|
||||
/** Charisma multiplier from ascensions */
|
||||
cha_asc_mult: number;
|
||||
|
||||
/** Total earned hack experience */
|
||||
hack_asc_points: number;
|
||||
/** Total earned strength experience */
|
||||
str_asc_points: number;
|
||||
/** Total earned defense experience */
|
||||
def_asc_points: number;
|
||||
/** Total earned dexterity experience */
|
||||
dex_asc_points: number;
|
||||
/** Total earned agility experience */
|
||||
agi_asc_points: number;
|
||||
/** Total earned charisma experience */
|
||||
cha_asc_points: number;
|
||||
|
||||
upgrades: string[];
|
||||
@ -1601,9 +1638,10 @@ export interface Singularity {
|
||||
* The actions that can be stopped with this function are:
|
||||
*
|
||||
* * Studying at a university
|
||||
* * Working out at a gym
|
||||
* * Working for a company/faction
|
||||
* * Creating a program
|
||||
* * Committing a Crime
|
||||
* * Committing a crime
|
||||
*
|
||||
* This function will return true if the player’s action was ended.
|
||||
* It will return false if the player was not performing an action when this function was called.
|
||||
@ -4098,7 +4136,7 @@ interface UserInterface {
|
||||
* ns.getHostname();
|
||||
* // Some related functions are gathered under a sub-property of the ns object
|
||||
* ns.stock.getPrice();
|
||||
* // Some functions need to be await ed
|
||||
* // Some functions need to be awaited
|
||||
* await ns.hack('n00dles');
|
||||
* }
|
||||
* ```
|
||||
@ -4926,6 +4964,34 @@ export interface NS extends Singularity {
|
||||
* @returns True if the script is successfully killed, and false otherwise.
|
||||
*/
|
||||
kill(script: number): boolean;
|
||||
|
||||
/**
|
||||
* {@inheritDoc NS.(kill:1)}
|
||||
* @example
|
||||
* ```ts
|
||||
* // NS1:
|
||||
* //The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
|
||||
* kill("foo.script", "foodnstuff");
|
||||
*
|
||||
* //The following will try to kill a script named foo.script on the current server that was ran with no arguments:
|
||||
* kill("foo.script", getHostname());
|
||||
*
|
||||
* //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
|
||||
* kill("foo.script", getHostname(), 1, "foodnstuff");
|
||||
* ```
|
||||
* @example
|
||||
* ```ts
|
||||
* // NS2:
|
||||
* //The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
|
||||
* ns.kill("foo.script", "foodnstuff");
|
||||
*
|
||||
* //The following will try to kill a script named foo.script on the current server that was ran with no arguments:
|
||||
* ns.kill("foo.script", getHostname());
|
||||
*
|
||||
* //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
|
||||
* ns.kill("foo.script", getHostname(), 1, "foodnstuff");
|
||||
* ```
|
||||
*/
|
||||
kill(script: string, host: string, ...args: string[]): boolean;
|
||||
|
||||
/**
|
||||
@ -4991,6 +5057,37 @@ export interface NS extends Singularity {
|
||||
* @returns True if the script/literature file is successfully copied over and false otherwise. If the files argument is an array then this function will return true if at least one of the files in the array is successfully copied.
|
||||
*/
|
||||
scp(files: string | string[], destination: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* {@inheritDoc NS.(scp:1)}
|
||||
* @example
|
||||
* ```ts
|
||||
* // NS1:
|
||||
* //Copies foo.lit from the helios server to the home computer:
|
||||
* scp("foo.lit", "helios", "home");
|
||||
*
|
||||
* //Tries to copy three files from rothman-uni to home computer:
|
||||
* files = ["foo1.lit", "foo2.script", "foo3.script"];
|
||||
* scp(files, "rothman-uni", "home");
|
||||
* ```
|
||||
* @example
|
||||
* ```ts
|
||||
* // NS2:
|
||||
* //Copies foo.lit from the helios server to the home computer:
|
||||
* await ns.scp("foo.lit", "helios", "home");
|
||||
*
|
||||
* //Tries to copy three files from rothman-uni to home computer:
|
||||
* files = ["foo1.lit", "foo2.script", "foo3.script"];
|
||||
* await ns.scp(files, "rothman-uni", "home");
|
||||
* ```
|
||||
* @example
|
||||
* ```ts
|
||||
* //ns2, copies files from home to a target server
|
||||
* const server = ns.args[0];
|
||||
* const files = ["hack.js","weaken.js","grow.js"];
|
||||
* await ns.scp(files, "home", server);
|
||||
* ```
|
||||
*/
|
||||
scp(files: string | string[], source: string, destination: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
@ -5017,8 +5114,8 @@ export interface NS extends Singularity {
|
||||
* @example
|
||||
* ```ts
|
||||
* // NS1:
|
||||
* const scripts = ps("home");
|
||||
* for (let i = 0; i < scripts.length; ++i) {
|
||||
* var scripts = ps("home");
|
||||
* for (var i = 0; i < scripts.length; ++i) {
|
||||
* tprint(scripts[i].filename + ' ' + scripts[i].threads);
|
||||
* tprint(scripts[i].args);
|
||||
* }
|
||||
@ -5027,8 +5124,8 @@ export interface NS extends Singularity {
|
||||
* ```ts
|
||||
* // NS2:
|
||||
* const ps = ns.ps("home");
|
||||
* for (script of ps) {
|
||||
* ns.tprint(`${script.filename} ${ps[i].threads}`);
|
||||
* for (let script of ps) {
|
||||
* ns.tprint(`${script.filename} ${script.threads}`);
|
||||
* ns.tprint(script.args);
|
||||
* }
|
||||
* ```
|
||||
@ -5555,7 +5652,7 @@ export interface NS extends Singularity {
|
||||
* @param data - Data to write.
|
||||
* @returns True if the data is successfully written to the port, and false otherwise.
|
||||
*/
|
||||
tryWritePort(port: number, data: string[] | number): Promise<boolean>;
|
||||
tryWritePort(port: number, data: string | number): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Read content of a file.
|
||||
@ -5795,6 +5892,10 @@ export interface NS extends Singularity {
|
||||
* @returns Amount of income the specified script generates while online.
|
||||
*/
|
||||
getScriptIncome(): [number, number];
|
||||
|
||||
/**
|
||||
* {@inheritDoc NS.(getScriptIncome:1)}
|
||||
*/
|
||||
getScriptIncome(script: string, host: string, ...args: string[]): number;
|
||||
|
||||
/**
|
||||
@ -5815,6 +5916,10 @@ export interface NS extends Singularity {
|
||||
* @returns Amount of hacking experience the specified script generates while online.
|
||||
*/
|
||||
getScriptExpGain(): number;
|
||||
|
||||
/**
|
||||
* {@inheritDoc NS.(getScriptExpGain:1)}
|
||||
*/
|
||||
getScriptExpGain(script: string, host: string, ...args: string[]): number;
|
||||
|
||||
/**
|
||||
@ -6279,6 +6384,14 @@ export interface WarehouseAPI {
|
||||
* @param amt - Amount of material to buy
|
||||
*/
|
||||
buyMaterial(divisionName: string, cityName: string, materialName: string, amt: number): void;
|
||||
/**
|
||||
* Set material to bulk buy
|
||||
* @param divisionName - Name of the division
|
||||
* @param cityName - Name of the city
|
||||
* @param materialName - Name of the material
|
||||
* @param amt - Amount of material to buy
|
||||
*/
|
||||
bulkPurchase(divisionName: string, cityName: string, materialName: string, amt: number): void;
|
||||
/**
|
||||
* Get warehouse data
|
||||
* @param divisionName - Name of the division
|
||||
@ -6519,6 +6632,18 @@ export interface Corporation extends WarehouseAPI, OfficeAPI {
|
||||
* @param percent - Percent of profit to issue as dividends.
|
||||
*/
|
||||
issueDividends(percent: number): void;
|
||||
/**
|
||||
* Buyback Shares
|
||||
* @param amount - Amount of shares to buy back.
|
||||
*
|
||||
*/
|
||||
buyBackShares(amount: number): void;
|
||||
/**
|
||||
* Sell Shares
|
||||
* @param amount - Amount of shares to sell.
|
||||
*
|
||||
*/
|
||||
sellShares(amount: number): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -6779,3 +6904,14 @@ interface GameInfo {
|
||||
commit: string;
|
||||
platform: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for autocompletion
|
||||
* @public
|
||||
*/
|
||||
interface AutocompleteData {
|
||||
servers: string[];
|
||||
scripts: string[];
|
||||
txts: string[];
|
||||
flags(schema: [string, string | number | boolean | string[]][]): any;
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
import React, { useState, useEffect, useRef, useMemo } from "react";
|
||||
import Editor, { Monaco } from "@monaco-editor/react";
|
||||
import * as monaco from "monaco-editor";
|
||||
@ -33,8 +32,8 @@ import Typography from "@mui/material/Typography";
|
||||
import Link from "@mui/material/Link";
|
||||
import Box from "@mui/material/Box";
|
||||
import SettingsIcon from "@mui/icons-material/Settings";
|
||||
import SyncIcon from '@mui/icons-material/Sync';
|
||||
import CloseIcon from '@mui/icons-material/Close';
|
||||
import SyncIcon from "@mui/icons-material/Sync";
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableCell from "@mui/material/TableCell";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
@ -134,13 +133,12 @@ export function Root(props: IProps): React.ReactElement {
|
||||
// Prevent Crash if script is open on deleted server
|
||||
openScripts = openScripts.filter((script) => {
|
||||
return GetServer(script.hostname) !== null;
|
||||
})
|
||||
if (currentScript && (GetServer(currentScript.hostname) === null)) {
|
||||
});
|
||||
if (currentScript && GetServer(currentScript.hostname) === null) {
|
||||
currentScript = openScripts[0];
|
||||
if (currentScript === undefined) currentScript = null;
|
||||
}
|
||||
|
||||
|
||||
const [dimensions, setDimensions] = useState({
|
||||
height: window.innerHeight,
|
||||
width: window.innerWidth,
|
||||
@ -206,9 +204,35 @@ export function Root(props: IProps): React.ReactElement {
|
||||
save();
|
||||
props.router.toTerminal();
|
||||
});
|
||||
|
||||
// Setup "go to next tab" and "go to previous tab". This is a little more involved
|
||||
// since these aren't Ex commands (they run in normal mode, not after typing `:`)
|
||||
MonacoVim.VimMode.Vim.defineAction("nextTabs", function (_cm: any, args: { repeat?: number }) {
|
||||
const nTabs = args.repeat ?? 1;
|
||||
// Go to the next tab (to the right). Wraps around when at the rightmost tab
|
||||
const currIndex = currentTabIndex();
|
||||
if (currIndex !== undefined) {
|
||||
const nextIndex = (currIndex + nTabs) % openScripts.length;
|
||||
onTabClick(nextIndex);
|
||||
}
|
||||
});
|
||||
MonacoVim.VimMode.Vim.defineAction("prevTabs", function (_cm: any, args: { repeat?: number }) {
|
||||
const nTabs = args.repeat ?? 1;
|
||||
// Go to the previous tab (to the left). Wraps around when at the leftmost tab
|
||||
const currIndex = currentTabIndex();
|
||||
if (currIndex !== undefined) {
|
||||
let nextIndex = currIndex - nTabs;
|
||||
while (nextIndex < 0) {
|
||||
nextIndex += openScripts.length;
|
||||
}
|
||||
onTabClick(nextIndex);
|
||||
}
|
||||
});
|
||||
MonacoVim.VimMode.Vim.mapCommand("gt", "action", "nextTabs", {}, { context: "normal" });
|
||||
MonacoVim.VimMode.Vim.mapCommand("gT", "action", "prevTabs", {}, { context: "normal" });
|
||||
editor.focus();
|
||||
});
|
||||
} catch { }
|
||||
} catch {}
|
||||
} else if (!options.vim) {
|
||||
// Whem vim mode is disabled
|
||||
vimEditor?.dispose();
|
||||
@ -317,13 +341,18 @@ export function Root(props: IProps): React.ReactElement {
|
||||
.loader();
|
||||
// replaced the bare tokens with regexes surrounded by \b, e.g. \b{token}\b which matches a word-break on either side
|
||||
// this prevents the highlighter from highlighting pieces of variables that start with a reserved token name
|
||||
l.language.tokenizer.root.unshift([new RegExp('\\bns\\b'), { token: "ns" }]);
|
||||
for (const symbol of symbols) l.language.tokenizer.root.unshift([new RegExp(`\\b${symbol}\\b`), { token: "netscriptfunction" }]);
|
||||
l.language.tokenizer.root.unshift([new RegExp("\\bns\\b"), { token: "ns" }]);
|
||||
for (const symbol of symbols)
|
||||
l.language.tokenizer.root.unshift([new RegExp(`\\b${symbol}\\b`), { token: "netscriptfunction" }]);
|
||||
const otherKeywords = ["let", "const", "var", "function"];
|
||||
const otherKeyvars = ["true", "false", "null", "undefined"];
|
||||
otherKeywords.forEach((k) => l.language.tokenizer.root.unshift([new RegExp(`\\b${k}\\b`), { token: "otherkeywords" }]));
|
||||
otherKeyvars.forEach((k) => l.language.tokenizer.root.unshift([new RegExp(`\\b${k}\\b`), { token: "otherkeyvars" }]));
|
||||
l.language.tokenizer.root.unshift([new RegExp('\\bthis\\b'), { token: "this" }]);
|
||||
otherKeywords.forEach((k) =>
|
||||
l.language.tokenizer.root.unshift([new RegExp(`\\b${k}\\b`), { token: "otherkeywords" }]),
|
||||
);
|
||||
otherKeyvars.forEach((k) =>
|
||||
l.language.tokenizer.root.unshift([new RegExp(`\\b${k}\\b`), { token: "otherkeyvars" }]),
|
||||
);
|
||||
l.language.tokenizer.root.unshift([new RegExp("\\bthis\\b"), { token: "this" }]);
|
||||
})();
|
||||
|
||||
const source = (libSource + "").replace(/export /g, "");
|
||||
@ -449,7 +478,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
}
|
||||
try {
|
||||
infLoop(newCode);
|
||||
} catch (err) { }
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
function saveScript(scriptToSave: OpenScript): void {
|
||||
@ -605,16 +634,26 @@ export function Root(props: IProps): React.ReactElement {
|
||||
openScripts = items;
|
||||
}
|
||||
|
||||
function onTabClick(index: number): void {
|
||||
function currentTabIndex(): number | undefined {
|
||||
if (currentScript !== null) {
|
||||
// Save currentScript to openScripts
|
||||
const curIndex = openScripts.findIndex(
|
||||
return openScripts.findIndex(
|
||||
(script) =>
|
||||
currentScript !== null &&
|
||||
script.fileName === currentScript.fileName &&
|
||||
script.hostname === currentScript.hostname,
|
||||
);
|
||||
openScripts[curIndex] = currentScript;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function onTabClick(index: number): void {
|
||||
if (currentScript !== null) {
|
||||
// Save currentScript to openScripts
|
||||
const curIndex = currentTabIndex();
|
||||
if (curIndex !== undefined) {
|
||||
openScripts[curIndex] = currentScript;
|
||||
}
|
||||
}
|
||||
|
||||
currentScript = { ...openScripts[index] };
|
||||
@ -702,15 +741,17 @@ export function Root(props: IProps): React.ReactElement {
|
||||
|
||||
if (openScript.code !== serverScriptCode) {
|
||||
PromptEvent.emit({
|
||||
txt: "Do you want to overwrite the current editor content with the contents of " +
|
||||
openScript.fileName + " on the server? This cannot be undone.",
|
||||
txt:
|
||||
"Do you want to overwrite the current editor content with the contents of " +
|
||||
openScript.fileName +
|
||||
" on the server? This cannot be undone.",
|
||||
resolve: (result: boolean) => {
|
||||
if (result) {
|
||||
// Save changes
|
||||
openScript.code = serverScriptCode;
|
||||
|
||||
// Switch to target tab
|
||||
onTabClick(index)
|
||||
onTabClick(index);
|
||||
|
||||
if (editorRef.current !== null && openScript !== null) {
|
||||
if (openScript.model === undefined || openScript.model.isDisposed()) {
|
||||
@ -754,7 +795,11 @@ export function Root(props: IProps): React.ReactElement {
|
||||
// 44px bottom tool bar + 16px margin
|
||||
// + vim bar 34px
|
||||
const editorHeight = dimensions.height - (130 + (options.vim ? 34 : 0));
|
||||
|
||||
const tabsMaxWidth = 1640;
|
||||
const tabMargin = 5;
|
||||
const tabMaxWidth = openScripts.length ? tabsMaxWidth / openScripts.length - tabMargin : 0;
|
||||
const tabIconWidth = 25;
|
||||
const tabTextWidth = tabMaxWidth - tabIconWidth * 2;
|
||||
return (
|
||||
<>
|
||||
<div style={{ display: currentScript !== null ? "block" : "none", height: "100%", width: "100%" }}>
|
||||
@ -762,7 +807,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
<Droppable droppableId="tabs" direction="horizontal">
|
||||
{(provided, snapshot) => (
|
||||
<Box
|
||||
maxWidth="1640px"
|
||||
maxWidth={`${tabsMaxWidth}px`}
|
||||
display="flex"
|
||||
flexDirection="row"
|
||||
alignItems="center"
|
||||
@ -795,12 +840,14 @@ export function Root(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
const iconButtonStyle = {
|
||||
maxWidth: "25px",
|
||||
minWidth: "25px",
|
||||
minHeight: '38.5px',
|
||||
maxHeight: '38.5px',
|
||||
maxWidth: `${tabIconWidth}px`,
|
||||
minWidth: `${tabIconWidth}px`,
|
||||
minHeight: "38.5px",
|
||||
maxHeight: "38.5px",
|
||||
...colorProps
|
||||
};
|
||||
|
||||
const scriptTabText = `${hostname}:~/${fileName} ${dirty(index)}`;
|
||||
return (
|
||||
<Draggable
|
||||
key={fileName + hostname}
|
||||
@ -815,35 +862,42 @@ export function Root(props: IProps): React.ReactElement {
|
||||
{...provided.dragHandleProps}
|
||||
style={{
|
||||
...provided.draggableProps.style,
|
||||
marginRight: "5px",
|
||||
maxWidth: `${tabMaxWidth}px`,
|
||||
marginRight: `${tabMargin}px`,
|
||||
flexShrink: 0,
|
||||
border: '1px solid ' + Settings.theme.well,
|
||||
border: "1px solid " + Settings.theme.well,
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
onClick={() => onTabClick(index)}
|
||||
onMouseDown={e => {
|
||||
e.preventDefault();
|
||||
if (e.button === 1) onTabClose(index);
|
||||
}}
|
||||
style={{
|
||||
...colorProps
|
||||
}}
|
||||
>
|
||||
{hostname}:~/{fileName} {dirty(index)}
|
||||
</Button>
|
||||
<Tooltip title={scriptTabText}>
|
||||
<Button
|
||||
onClick={() => onTabClick(index)}
|
||||
onMouseDown={(e) => {
|
||||
e.preventDefault();
|
||||
if (e.button === 1) onTabClose(index);
|
||||
}}
|
||||
style={{
|
||||
maxWidth: `${tabTextWidth}px`,
|
||||
overflow: "hidden",
|
||||
...colorProps,
|
||||
}}
|
||||
>
|
||||
<span style={{ overflow: "hidden", direction: "rtl", textOverflow: "ellipsis" }}>
|
||||
{scriptTabText}
|
||||
</span>
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip title="Overwrite editor content with saved file content">
|
||||
<Button onClick={() => onTabUpdate(index)} style={iconButtonStyle} >
|
||||
<SyncIcon fontSize='small' />
|
||||
<Button onClick={() => onTabUpdate(index)} style={iconButtonStyle}>
|
||||
<SyncIcon fontSize="small" />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Button onClick={() => onTabClose(index)} style={iconButtonStyle}>
|
||||
<CloseIcon fontSize='small' />
|
||||
<CloseIcon fontSize="small" />
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</Draggable>
|
||||
)
|
||||
);
|
||||
})}
|
||||
{provided.placeholder}
|
||||
</Box>
|
||||
@ -873,14 +927,24 @@ export function Root(props: IProps): React.ReactElement {
|
||||
></Box>
|
||||
|
||||
<Box display="flex" flexDirection="row" sx={{ m: 1 }} alignItems="center">
|
||||
<Button startIcon={<SettingsIcon />} onClick={() => setOptionsOpen(true)} sx={{ mr: 1 }}>Options</Button>
|
||||
<Button startIcon={<SettingsIcon />} onClick={() => setOptionsOpen(true)} sx={{ mr: 1 }}>
|
||||
Options
|
||||
</Button>
|
||||
<Button onClick={beautify}>Beautify</Button>
|
||||
<Button color={updatingRam ? "secondary" : "primary"} sx={{ mx: 1 }} onClick={() => { setRamInfoOpen(true) }}>
|
||||
<Button
|
||||
color={updatingRam ? "secondary" : "primary"}
|
||||
sx={{ mx: 1 }}
|
||||
onClick={() => {
|
||||
setRamInfoOpen(true);
|
||||
}}
|
||||
>
|
||||
{ram}
|
||||
</Button>
|
||||
<Button onClick={save}>Save (Ctrl/Cmd + s)</Button>
|
||||
<Button onClick={props.router.toTerminal}>Close (Ctrl/Cmd + b)</Button>
|
||||
<Typography sx={{ mx: 1 }}>
|
||||
<Button sx={{ mx: 1 }} onClick={props.router.toTerminal}>
|
||||
Terminal (Ctrl/Cmd + b)
|
||||
</Button>
|
||||
<Typography>
|
||||
{" "}
|
||||
Documentation:{" "}
|
||||
<Link target="_blank" href="https://bitburner.readthedocs.io/en/latest/index.html">
|
||||
@ -918,7 +982,9 @@ export function Root(props: IProps): React.ReactElement {
|
||||
<React.Fragment key={n + r}>
|
||||
<TableRow>
|
||||
<TableCell sx={{ color: Settings.theme.primary }}>{n}</TableCell>
|
||||
<TableCell align="right" sx={{ color: Settings.theme.primary }}>{r}</TableCell>
|
||||
<TableCell align="right" sx={{ color: Settings.theme.primary }}>
|
||||
{r}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</React.Fragment>
|
||||
))}
|
||||
|
@ -30,7 +30,7 @@ export function getPurchaseServerCost(ram: number): number {
|
||||
|
||||
const upg = Math.max(0, Math.log(sanitizedRam) / Math.log(2) - 6);
|
||||
|
||||
return Math.round(
|
||||
return (
|
||||
sanitizedRam *
|
||||
CONSTANTS.BaseCostFor1GBOfRamServer *
|
||||
BitNodeMultipliers.PurchasedServerCost *
|
||||
|
@ -14,7 +14,7 @@ import { WorkerScript } from "../Netscript/WorkerScript";
|
||||
import { IMap } from "../types";
|
||||
import { EventEmitter } from "../utils/EventEmitter";
|
||||
|
||||
import { numeralWrapper } from ".././ui/numeralFormat";
|
||||
import { numeralWrapper } from "../ui/numeralFormat";
|
||||
|
||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||
import { Reviver } from "../utils/JSONReviver";
|
||||
|
@ -17,7 +17,7 @@ export function expr(
|
||||
const expr = args.join("");
|
||||
|
||||
// Sanitize the math expression
|
||||
const sanitizedExpr = expr.replace(/s+/g, "").replace(/[^-()\d/*+.]/g, "");
|
||||
const sanitizedExpr = expr.replace(/s+/g, "").replace(/[^-()\d/*+.%]/g, "");
|
||||
let result;
|
||||
try {
|
||||
result = eval(sanitizedExpr);
|
||||
|
@ -5,7 +5,7 @@ import { toString } from "lodash";
|
||||
import React from "react";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { evaluateDirectoryPath, getFirstParentDirectory, isValidDirectoryPath } from "../../Terminal/DirectoryHelpers";
|
||||
import { evaluateDirectoryPath, getFirstParentDirectory, isValidDirectoryPath } from "../DirectoryHelpers";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { ITerminal } from "../ITerminal";
|
||||
|
||||
|
@ -12,7 +12,7 @@ export function scan(
|
||||
args: (string | number | boolean)[],
|
||||
): void {
|
||||
if (args.length !== 0) {
|
||||
terminal.error("Incorrect usage of netstat/scan command. Usage: netstat/scan");
|
||||
terminal.error("Incorrect usage of scan command. Usage: scan");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ import { HelpTexts } from "./HelpText";
|
||||
import { isScriptFilename } from "../Script/isScriptFilename";
|
||||
import { compile } from "../NetscriptJSEvaluator";
|
||||
import { Flags } from "../NetscriptFunctions/Flags";
|
||||
import { AutocompleteData } from "../ScriptEditor/NetscriptDefinitions";
|
||||
import * as libarg from "arg";
|
||||
|
||||
// An array of all Terminal commands
|
||||
@ -298,26 +299,27 @@ export async function determineAllPossibilitiesForTabCompletion(
|
||||
argv: command.slice(2),
|
||||
});
|
||||
const flagFunc = Flags(flags._);
|
||||
const autocompleteData: AutocompleteData = {
|
||||
servers: GetAllServers().map((server) => server.hostname),
|
||||
scripts: currServ.scripts.map((script) => script.filename),
|
||||
txts: currServ.textFiles.map((txt) => txt.fn),
|
||||
flags: (schema: any) => {
|
||||
pos2 = schema.map((f: any) => {
|
||||
if (f[0].length === 1) return "-" + f[0];
|
||||
return "--" + f[0];
|
||||
});
|
||||
try {
|
||||
return flagFunc(schema);
|
||||
} catch (err) {
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
}
|
||||
let pos: string[] = [];
|
||||
let pos2: string[] = [];
|
||||
pos = pos.concat(
|
||||
loadedModule.autocomplete(
|
||||
{
|
||||
servers: GetAllServers().map((server) => server.hostname),
|
||||
scripts: currServ.scripts.map((script) => script.filename),
|
||||
txts: currServ.textFiles.map((txt) => txt.fn),
|
||||
flags: (schema: any) => {
|
||||
pos2 = schema.map((f: any) => {
|
||||
if (f[0].length === 1) return "-" + f[0];
|
||||
return "--" + f[0];
|
||||
});
|
||||
try {
|
||||
return flagFunc(schema);
|
||||
} catch (err) {
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
},
|
||||
autocompleteData,
|
||||
flags._,
|
||||
),
|
||||
);
|
||||
|
@ -114,7 +114,6 @@ Reviver.constructors.TextFile = TextFile;
|
||||
* @param server The server object to look in
|
||||
* @returns The file object, or null if it couldn't find it.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export function getTextFile(fn: string, server: BaseServer): TextFile | null {
|
||||
let filename: string = !fn.endsWith(".txt") ? `${fn}.txt` : fn;
|
||||
|
||||
@ -138,7 +137,6 @@ export function getTextFile(fn: string, server: BaseServer): TextFile | null {
|
||||
* @param server The server that the file should be created on.
|
||||
* @returns The instance of the file.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export function createTextFile(fn: string, txt: string, server: BaseServer): TextFile | undefined {
|
||||
if (getTextFile(fn, server) !== null) {
|
||||
// This should probably be a `throw`...
|
||||
|
@ -336,6 +336,37 @@ export function refreshTheme(): void {
|
||||
color: Settings.theme.primary,
|
||||
},
|
||||
},
|
||||
root: {
|
||||
backgroundColor: Settings.theme.backgroundsecondary,
|
||||
border: "1px solid " + Settings.theme.well,
|
||||
margin: '3px',
|
||||
|
||||
"&.Mui-selected": {
|
||||
backgroundColor: Settings.theme.button
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiTabs: {
|
||||
styleOverrides: {
|
||||
scrollButtons: {
|
||||
backgroundColor: Settings.theme.backgroundsecondary,
|
||||
color: Settings.theme.secondary,
|
||||
margin: '3px',
|
||||
opacity: 1,
|
||||
width: 'fit-content',
|
||||
|
||||
"&.Mui-disabled": {
|
||||
opacity: 0.5
|
||||
}
|
||||
}
|
||||
},
|
||||
defaultProps: {
|
||||
TabIndicatorProps: {
|
||||
style: {
|
||||
display: "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
MuiAlert: {
|
||||
|
@ -307,15 +307,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
|
||||
reach = Math.max(i + data[i], reach);
|
||||
}
|
||||
const solution: boolean = i === n;
|
||||
|
||||
if (ans === "1" && solution) {
|
||||
return true;
|
||||
}
|
||||
if (ans === "0" && !solution) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return (ans === "1" && solution) || (ans === "0" && !solution);
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -816,7 +808,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
|
||||
`Examples:\n`,
|
||||
`"()())()" -> [()()(), (())()]\n`,
|
||||
`"(a)())()" -> [(a)()(), (a())()]\n`,
|
||||
`")( -> [""]`,
|
||||
`")(" -> [""]`,
|
||||
].join(" ");
|
||||
},
|
||||
difficulty: 10,
|
||||
@ -922,6 +914,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
|
||||
"The data provided by this problem is an array with two elements. The first element",
|
||||
"is the string of digits, while the second element is the target number:\n\n",
|
||||
`["${digits}", ${target}]\n\n`,
|
||||
"NOTE: The order of evaluation expects script operator precedence",
|
||||
"NOTE: Numbers in the expression cannot have leading 0's. In other words,",
|
||||
`"1+01" is not a valid expression`,
|
||||
"Examples:\n\n",
|
||||
|
@ -401,9 +401,12 @@ const Engine: {
|
||||
() =>
|
||||
AlertEvents.emit(
|
||||
<>
|
||||
Offline for {timeOfflineString}. While you were offline, your scripts generated{" "}
|
||||
<Money money={offlineHackingIncome} />, your Hacknet Nodes generated {hacknetProdInfo} and you gained{" "}
|
||||
<Reputation reputation={offlineReputation} /> reputation divided amongst your factions.
|
||||
Offline for {timeOfflineString}. While you were offline:
|
||||
<ul>
|
||||
<li>Your scripts generated{" "} <Money money={offlineHackingIncome} /></li>
|
||||
<li>Your Hacknet Nodes generated {hacknetProdInfo}</li>
|
||||
<li>You gained{" "} <Reputation reputation={offlineReputation} /> reputation divided amongst your factions</li>
|
||||
</ul>
|
||||
</>,
|
||||
),
|
||||
250,
|
||||
|
@ -31,9 +31,9 @@ export function ActiveScriptsRoot(props: IProps): React.ReactElement {
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Tabs variant="fullWidth" value={tab} onChange={handleChange}>
|
||||
<Tabs variant="fullWidth" value={tab} onChange={handleChange} sx={{ minWidth: 'fit-content', maxWidth: '25%' }}>
|
||||
<Tab label={"Active"} value={"active"} />
|
||||
<Tab label={"Recent"} value={"recent"} />
|
||||
<Tab label={"Recently Killed"} value={"recent"} />
|
||||
</Tabs>
|
||||
|
||||
{tab === "active" && <ActiveScriptsPage workerScripts={props.workerScripts} />}
|
||||
|
@ -26,7 +26,7 @@ import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFuncti
|
||||
import { arrayToString } from "../../utils/helpers/arrayToString";
|
||||
import { Money } from "../React/Money";
|
||||
import { MoneyRate } from "../React/MoneyRate";
|
||||
import { RecentScript } from "../..//Netscript/RecentScripts";
|
||||
import { RecentScript } from "../../Netscript/RecentScripts";
|
||||
import { LogBoxEvents } from "../React/LogBoxManager";
|
||||
|
||||
const useStyles = makeStyles({
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
import { numeralWrapper } from "../ui/numeralFormat";
|
||||
import { numeralWrapper } from "./numeralFormat";
|
||||
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
|
||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||
import { SourceFileFlags } from "../SourceFile/SourceFileFlags";
|
||||
|
@ -44,7 +44,7 @@ import { CorporationRoot } from "../Corporation/ui/CorporationRoot";
|
||||
import { InfiltrationRoot } from "../Infiltration/ui/InfiltrationRoot";
|
||||
import { ResleeveRoot } from "../PersonObjects/Resleeving/ui/ResleeveRoot";
|
||||
import { WorkInProgressRoot } from "./WorkInProgressRoot";
|
||||
import { GameOptionsRoot } from "../ui/React/GameOptionsRoot";
|
||||
import { GameOptionsRoot } from "./React/GameOptionsRoot";
|
||||
import { SleeveRoot } from "../PersonObjects/Sleeve/ui/SleeveRoot";
|
||||
import { HacknetRoot } from "../Hacknet/ui/HacknetRoot";
|
||||
import { GenericLocation } from "../Locations/ui/GenericLocation";
|
||||
@ -54,7 +54,7 @@ import { Root as ScriptEditorRoot } from "../ScriptEditor/ui/ScriptEditorRoot";
|
||||
import { MilestonesRoot } from "../Milestones/ui/MilestonesRoot";
|
||||
import { TerminalRoot } from "../Terminal/ui/TerminalRoot";
|
||||
import { TutorialRoot } from "../Tutorial/ui/TutorialRoot";
|
||||
import { ActiveScriptsRoot } from "../ui/ActiveScripts/ActiveScriptsRoot";
|
||||
import { ActiveScriptsRoot } from "./ActiveScripts/ActiveScriptsRoot";
|
||||
import { FactionsRoot } from "../Faction/ui/FactionsRoot";
|
||||
import { FactionRoot } from "../Faction/ui/FactionRoot";
|
||||
import { CharacterStats } from "./CharacterStats";
|
||||
@ -111,6 +111,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
);
|
||||
|
||||
export let Router: IRouter = {
|
||||
isInitialized: false,
|
||||
page: () => {
|
||||
throw new Error("Router called before initialization");
|
||||
},
|
||||
@ -223,6 +224,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
||||
const [{ files, vim }, setEditorOptions] = useState({ files: {}, vim: false });
|
||||
const [page, setPage] = useState(determineStartPage(player));
|
||||
const setRerender = useState(0)[1];
|
||||
const [augPage, setAugPage] = useState<boolean>(false);
|
||||
const [faction, setFaction] = useState<Faction>(
|
||||
player.currentWorkFactionName ? Factions[player.currentWorkFactionName] : (undefined as unknown as Faction),
|
||||
);
|
||||
@ -266,6 +268,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
||||
}
|
||||
|
||||
Router = {
|
||||
isInitialized: true,
|
||||
page: () => page,
|
||||
allowRouting: (value: boolean) => setAllowRoutingCalls(value),
|
||||
toActiveScripts: () => setPage(Page.ActiveScripts),
|
||||
@ -275,7 +278,8 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
||||
toCorporation: () => setPage(Page.Corporation),
|
||||
toCreateProgram: () => setPage(Page.CreateProgram),
|
||||
toDevMenu: () => setPage(Page.DevMenu),
|
||||
toFaction: (faction?: Faction) => {
|
||||
toFaction: (faction: Faction, augPage = false) => {
|
||||
setAugPage(augPage);
|
||||
setPage(Page.Faction);
|
||||
if (faction) setFaction(faction);
|
||||
},
|
||||
@ -453,7 +457,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
||||
break;
|
||||
}
|
||||
case Page.Faction: {
|
||||
mainPage = <FactionRoot faction={faction} />;
|
||||
mainPage = <FactionRoot faction={faction} augPage={augPage} />;
|
||||
break;
|
||||
}
|
||||
case Page.Milestones: {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user