Commit Graph

5537 Commits

Author SHA1 Message Date
omuretsu
3f850d71ba fix graceful material load? 2023-01-02 15:06:44 -05:00
omuretsu
2cb989243f Format fix... 2023-01-02 13:59:31 -05:00
Mughur
1baa615def
MISC: small fixes (#270)
* infiltration gain bug fix
* fix corp division description
* avoid some issues with Infinity at super high NFG levels
Co-authored-by: Daniel Perez Alvarez <danielpza@protonmail.com>
2023-01-02 13:51:59 -05:00
omuretsu
80d751e32b fix getActionRepGain 2023-01-02 13:28:31 -05:00
omuretsu
0ec4ef31ab 2.2 2023-01-02 13:20:25 -05:00
omuretsu
93aab87a16 Fix inaccurate HP on SF prestige 2023-01-02 10:35:52 -05:00
David Walker
fe5344f232
UI: Make tooltips for CoffeeParty better reflect reality (#269) 2023-01-02 09:49:36 -05:00
zerbosh
aa50378e18
CORPORATION: Give Full Api Access on BN3 (#276) 2023-01-02 09:48:02 -05:00
Mughur
e90224c63d
CORP: Industry descriptions shows what each division uses and makes (#272) 2023-01-02 09:46:53 -05:00
zerbosh
7d98c680e5
SLEEVE: added storedCycles to getSleeve() (#279) 2023-01-02 09:45:51 -05:00
omuretsu
d00ed1f4ee sync overview updates
Using EventEmitter. Also get rid of ShownContext as it is no longer needed with this event based rerender.
2023-01-02 08:54:18 -05:00
omuretsu
90fc82b86f Fix bad memoization in blade overview 2023-01-02 08:00:45 -05:00
David Walker
71bae01fd4
BUG: Fix console error about bad ref use. (#278) 2023-01-01 04:10:06 -05:00
omuretsu
313f6ada94 Fix more overview issues
Previous changes had overview become empty when collapsing it, which broke the collapse animation. It also would have broken use of the player-visible hooks, because those would have been removed from the document on collapse.
Now a context is used to store whether the overview is being shown or not, and components that update themselves will only do so when they are being shown.
2022-12-30 15:42:58 -05:00
Snarling
62a2532d05
UI: Fix broken overview (#273)
Fixes the broken overview where improper hook use was causing React errors for certain prop changes.
Overview no longer rerenders itself on a timer. Instead individual items that need to check for state updates do so themselves on a timer.
2022-12-30 14:28:49 -05:00
Snarling
fb1f95c26e
VARIOUS: Various changes prior to release 2.2 (#271)
See PR #271 description
2022-12-29 20:28:53 -05:00
zerbosh
24ad342203
getCorporation() returns division names (#266) 2022-12-29 04:30:16 -05:00
Mughur
5c80655d62
NETSCRIPT: Added ns.corporation.issueNewShares function (#261) 2022-12-25 03:35:18 -05:00
Mughur
556fe8dd33
NETSCRIPT: Added ns.corporation.getConstants, replacing many other corporation getter functions (#260) 2022-12-25 03:33:13 -05:00
David Walker
018053d79e
NETSCRIPT: Reduce cost of two multipliers functions (#254) 2022-12-21 18:30:27 -05:00
David Walker
149d687fd6
UI: Memoize character overview (#247) 2022-12-21 18:27:51 -05:00
Mughur
addcee73fc
Tutorial: Remove NS1 tutorial, change getting started guide to .js (#258) 2022-12-21 17:49:12 -05:00
Mughur
b004b7203d
GENERAL: Reorganizing and grouping node multipliers (#259) 2022-12-21 17:39:12 -05:00
lucebac
5a86be8714
Update doc for ns.scp (#262) 2022-12-21 14:56:08 -05:00
David Walker
303c54c85c
NETSCRIPT: Fix a typo in scp (#256) 2022-12-19 14:39:03 -05:00
omuretsu
1dec0d00bd Add documentation for ns.pid 2022-12-13 09:09:12 -05:00
T.J. Eckman
52034ccedc
NETSCRIPT: Add ns.pid variable for accessing the current script's PID (#255) 2022-12-13 09:07:15 -05:00
David Walker
f943e5d603
INFILTRATION: Change "slash" to "attack", less potential confusion (#251) 2022-12-13 08:28:56 -05:00
hydroflame
45221ead06
MISC: Remove google analytics (#253) 2022-12-13 08:28:08 -05:00
hydroflame
f039760690
Update blood donation counter 2022-12-09 15:46:56 -05:00
omuretsu
2489ec43fe Sidebar tweaks 2022-12-04 23:04:33 -05:00
David Walker
a46d34bd60
UI: Break SidebarRoot into smaller components, and memoize (#246) 2022-12-04 21:05:55 -05:00
David Walker
8d793ea271
Internal refactoring of Router (#241) 2022-12-04 03:14:06 -05:00
G4mingJon4s
897a1fbc8e
Changed skill formatting from numeral to localeStr (#244) 2022-12-03 23:32:39 -05:00
G4mingJon4s
633296da15
Added check if factionWork is from faction of gang (#243) 2022-12-03 22:58:40 -05:00
David Walker
49f732d1ee
Revert "Revert "Add keycode table and switch to event.code in select places" (#224)" (#242) 2022-12-03 22:56:42 -05:00
omuretsu
680027cd4b Fix update text for dev branch 2022-12-01 16:37:51 -05:00
Snarling
5ff2cd5357
VERSION: Update game version to 2.2 (#240)
Includes some bug fixes:
* Fix sleeve shock internal/display discrepancy (0-100 vs 0-100)
* Special error message if ns function called without a this
* Change whitespace to pre-wrap for dialog box.
* Fix bug where idle sleeves do not consume cycles but still recover shock from those cycles. Now they do not recover during idle.
* attempted to tag commit as v2.2.0
2022-12-01 16:07:46 -05:00
quacksouls
6034e1c3fa
DOC: CORP: typo fixes in hire AdVert functions (#237) 2022-12-01 11:41:52 -05:00
Snarling
14e50e5533
Some corp fixes (#236) 2022-11-29 08:24:04 -05:00
Snarling
0fb7200b4b
STOCK: ns.stock.getOrganization added for getting org from stock symbol (#234)
Authored-by: SamuraiNinjaGuy <branmiller+bitburner@gmail.com>
2022-11-28 10:33:28 -05:00
Snarling
837c6bd1c2
CONTRACT: codingcontract.attempt always returns a string (#231)
* ns.codingcontract always returns a string (reward on success, empty on fail), simplifying usage and documentation of function.
* Because of the above, return value still works when used as a boolean, as long as no direct equality comparison to true/false.
* Documentation expanded and examples added.
Co-authored by @quacksouls
2022-11-28 09:15:09 -05:00
Snarling
6af36e3b29
NETSCRIPT: Faster API wrapping on script launch. (#229)
* ns API is wrapped once
* when a new workerscript is created, each layer of ns is stamped with a private workerscript field that allows the functions to work.
* Test has been refactored to account for new method of wrapping
* BREAKING: ns functions need access to `this` value of their parent ns layer (or any ns layer)
* Enums are passed directly to player (no cloning) but are frozen.
2022-11-28 09:11:55 -05:00
Burhanuddin Mustafa Lakdawala
675c2a0456
DOC: Update documentation for limitMaterialProduction and limitProductProduction (#221) 2022-11-26 21:06:47 -05:00
quacksouls
1ee71cea19
CORP: fix typos in research descriptions (#232)
Fix various typographical errors in the descriptions of research.
2022-11-26 21:05:01 -05:00
David Walker
70fadde222
Revert "Add keycode table and switch to event.code in select places" (#224)
Using code instead of key is strongly warned against at MDN and causes issues with nonstandard layouts:
https://developer.mozilla.org/en-US/docs/Web/API/Element/keydown_event#keyboardevent.code

This also fixes ScriptEditorRoot.tsx, where some code snuck in that
wasn't using *any* of the constants.

This reverts commit 016a9a873fba71388bdbaa1423134fd1f2335a15.
2022-11-26 08:51:09 -05:00
Burhanuddin Mustafa Lakdawala
f70a25d755
Fix spacing on 'Trade for reputation` button (#222) 2022-11-25 08:00:26 -05:00
Snarling
e17380549d
Add ctrl-a support for logs (#228)
And prevent double line returns when copying logs
2022-11-24 13:04:06 -05:00
TheMas3212
533d8a4332 GANG: Fix Gang UI to correctly report the bonus time multiplier as 25x
Add Tooltop to Corporation UI to explain bonus time (matching the one in
Gang UI)
Move corporation.process to the correct location
2022-11-25 00:45:30 +11:00
Snarling
e7fc0fbb03
Fix documentation for ns.sleeve (#227) 2022-11-24 08:19:51 -05:00
Snarling
6616f7ba15
DOCS: Update documentation for ns.args (#220) 2022-11-21 12:19:16 -05:00
Snarling
79fd5f6089
Fix ansi background spacing (#219) 2022-11-21 11:08:36 -05:00
omuretsu
387c0c2786 Fix save corruptions from invalid types 2022-11-20 12:39:08 -05:00
Snarling
65cd14e33b
DOC: Add ns documentation for possible sleeve tasks (#217)
* Add specific types for sleeve tasks
* Moved LocationName enum to overall enums file
* Add LocationName enum to those provided to player
* remove trailing s on CompanyPosNames enum (now CompanyPosName, in line with LocationName)
* Also regenerated all ns documentation. This leads to an expected error when checking for generated files, because PRs should not normally touch markdown files. Also leads to a lint failure in generated file bitburner.d.ts
* also removed some exporting from NetscriptDefinitions.d.ts for anything that wasn't imported somewhere else.
2022-11-20 12:07:22 -05:00
Snarling
88d51e9a7e
MISC: A bunch of enums stuff. (#212)
* Some game enums moved to utils/enums. Others can eventually be moved there as well.
* findEnumMember function for performing fuzzy matching of player input with enum members, without needing separate fuzzy functions for every enum.
* Also used findEnumMember for safely loading save games (allows case changes in enum values)
* Changed capitalization on some enums.
* BREAKING: removed classGains work formulas function
* Split ClassType enum into UniversityClassType and GymType.
* Added universityGains and gymGains work formulas functions
* Provided the new split enums to the player on ns.enums.
2022-11-20 08:37:11 -05:00
Snarling
c929806307
fix broken party math again 2022-11-20 07:56:58 -05:00
omuretsu
673c2d9f82 Fix broken partyMult default 2022-11-19 22:42:34 -05:00
Snarling
c669e473d1
SLEEVE: Fixed inconsistencies in how sleeve work rewards are handled. (#211) 2022-11-10 21:56:46 -05:00
Snarling
426ad5f296
Sleeve criming fix (#209)
Also simplify usage of findCrime
2022-11-10 11:05:42 -05:00
Snarling
82ba5f1f13
Ignore monaco cancellation errors (#208)
Also updated monaco-editor and @monaco-editor/react to latest versions since there were no conflicts.
2022-11-10 10:08:59 -05:00
Matt Garretson
3ec4f0c98c
Fix HP gaining logic from defense skill levels (#205) 2022-11-09 22:06:27 -05:00
Snarling
b275f88053
NETSCRIPT: Expose more enums for player use (#198)
* Add support for enums at other ns layers
* APIWrapper: simplified wrapping algorithm and modified to just use cloneDeep to copy enums instead of recursively wrapping enums as if they were new API layers
* Improve APIWrapper typing
* Changed some typings at RamCostGenerator to allow for enums at different levels without enums needing a ram cost
* Added enums to ns.corporation, removed getter functions that were being used instead.
* Add FactionWorkType for player use
* Add ClassType and CompanyWorkPos enums
* Change netscriptDefinitions to expect members of these new enums where appropriate.
2022-11-09 13:46:21 -05:00
Snarling
8e0e0eaa88
NETSCRIPT: ns.sleeve.getSleeve added. getPlayer and getSleeve can both be used for formulas. (#200)
* BREAKING CHANGE: Removed getSleeveStats and getSleeveInformation because this info is provided by getSleeve in a more usable form.
* BREAKING CHANGE: Removed tor, inBladeburner, and hasCorporation fields from ns.getPlayer. Functionality still exists via added functions ns.hasTorRouter, ns.corporation.hasCorporation, and ns.bladeburner.inBladeburner.
* Separated ns definitions for Person, Sleeve, and Player interfaces with both Player and Sleeve just extending Person.
Added getSleeve, which provides a Sleeve object similar to getPlayer.
* Renamed the sleeve ns layer's interface as sleeve lowercase because of name conflict. todo: May move all the ns layers interface names to lowercase for consistency
* Added ns.formulas.work.crimeSuccessChance and reworked to allow both sleeve and player calculations.
* Removed internal Person.getIntelligenceBonus function which was just a wrapper for calculateIntelligenceBonus. Any use of the former in formulas creates a conflict where ns-provided Person objects throw an error.
* Renamed helpers.player to helpers.person for netscript person validation. Reduced number of fields validated due to Person being a smaller interface.
* Fixed bug in bladeburner where Player multipliers and int were being used no matter which person was performing the task
* Fixed leak of Player.jobs at ns.getPlayer
* Person / Player / Sleeve classes now implement the netscript equivalent interfaces. Netscript helper for person no longer asserts that it's a real Person class member, only that it's a Person interface. Functions that use netscript persons have been changed to expect just a person interface to prevent needing this incorrect type assertion.
2022-11-09 07:26:26 -05:00
Snarling
6f08aee8f6
Fix zombie scripts (#203)
Also made installAugmentations synchronously perform reset, but added a short timeout to the callback script launch for balance.
2022-11-08 12:17:34 -05:00
Snarling
01b131526a
Rework coffee/party (#201)
* Removed unused partyEmployees and coffeeEmployees members of OfficeSpace
* Reworked formula for performance loss per market cycle.
* Rework both coffee and party formulas to allow easier recovery from low values.
2022-11-07 09:09:53 -05:00
quacksouls
8367b68f46
CORPORATION: typo fixes in modals to sell materials and products (#197) 2022-11-06 21:36:38 -05:00
Rai
c17af3ad35
UI: SoftResetButton.tsx Tooltip changed to make more sense (#186) 2022-11-06 17:30:01 -05:00
quacksouls
83730d89fd
UI: use newline to separate sentences in popup message (#188) 2022-11-06 17:27:40 -05:00
Snarling
9e869bc876
NETSCRIPT: Add ns.formulas.work.companyGains function (#195)
* added ns.formulas.work.companyGains.
* Removed Work/Formulas folder, added Work/Formulas.ts
* CompanyPosition.calculateJobPerformance now takes in a Person instead of taking in a full set of stats, and it takes INT into account.
* formulas.crimeGains takes in a person object.
* Renamed ns Player type to Person.
* added multWorkStats, which multiplies a WorkStats object with a multipliers object.
* Remove unused types in NetscriptDefinitons.d.ts
* reuse formulas code in other parts of game
* getSleeveInformation also returns skills

Co-authored-by: Alexey <alexey.kozhemiakin@gmail.com>
2022-11-06 17:27:04 -05:00
Snarling
5205ff2837
Remove unused error blocks (#194) 2022-11-04 08:08:06 -04:00
Snarling
7ef2675e2c
Make writePort synchronous (#193) 2022-11-04 07:56:20 -04:00
quacksouls
55b2cbb549
UI: cat: proper line breaks when showing .js, .script, or .txt files (#192)
Currently, the HTML line break sequence `<br /><br />` is hardcoded into the dialog box message when showing the content of these file types: ".js", ".script", and ".txt".  By default, the function `dialogBoxCreate()` currently assumes that its first parameter is not HTML, but a text string, so whatever is in the string will appear in the dialog box.  Use the newline character instead for line break.
2022-11-04 07:23:33 -04:00
omuretsu
6ac04717fe Add missing line breaks on showMessage 2022-11-03 11:31:25 -04:00
omuretsu
e42b1c2edd lint 2022-11-03 08:46:01 -04:00
omuretsu
b057e2e5f2 Fix sleeves unable to commit crime 2022-11-03 08:39:34 -04:00
LJ
9eb5f7ef23
NETSCRIPT: added portHandle.nextWrite() (#187) 2022-11-03 06:17:29 -04:00
Snarling
3ce4dcf612
DOC: Update documentation for workForFaction and workForCompany (#180)
* DOC: `ns.singularity.workForFaction()`: update doc and examples
* Additional Doc Fixes
* Remove unnecessary fluff in singularity.workForFaction examples
* Fix documentation for singularity.workForCompany similar to fixes already applied to workForFaction
* Correct some inaccuracies in workForFaction and workForCompany remarks sections
* Shorten some comment lines that are over 120 characters in NetscriptDefinitions.d.ts, for consistency.

Co-authored-by: Duck McSouls <quacksouls@gmail.com>
2022-11-01 12:24:25 -04:00
quacksouls
634611f9db
DOC: Improve CCT documentation for HammingCodes (#167) 2022-10-30 04:24:09 -04:00
LJ
0519b6adf7
De-uglify ns.print examples (#164) 2022-10-28 17:20:01 -04:00
omuretsu
4bf215f241 Fix documentation build error 2022-10-27 07:04:46 -04:00
jaculler
a40aa1bab2
Fix Tutorial Ram Text (#162)
This updates the tutorial (and tests) to match the updated value of 8GB starting ram.
2022-10-27 06:25:45 -04:00
Snarling
239834dba6
Connect to owned servers from anywhere (#159)
* purchasedByPlayer allows connect-from-anywhere as if the server was backdoored.
* Also added optional backdoorInstalled variable to type for BaseServer. This has no runtime effect, but it allows accessing that variable without TS needing us to verify whether it's instanceof Server first.
2022-10-25 17:48:46 -04:00
omuretsu
8837c01d21 Tolerate & recover from null player money 2022-10-25 14:56:47 -04:00
omuretsu
d0820c81ce Recover from null moneyTracker
There shouldn't be any way to get null, but it was reported to occur and this will recover when this happens.
2022-10-25 14:37:25 -04:00
Snarling
959307aa13
CORP: Better fix for MP validation (#158)
* Prevent negative profit selling
* Update validation strings for MP
* Allow negative MP formula price
2022-10-25 12:51:03 -04:00
Snarling
5b2a96fa0c
CORPORATION: Happiness/Energy/Morale trend down even for productive corps (#157) 2022-10-25 10:32:20 -04:00
Snarling
a79621612f
Only allow one reference to MP in sell price (#156) 2022-10-25 08:51:37 -04:00
quacksouls
3f0a7786f8
DOC: cleanup in doc of Netscript functions (#155)
* A bunch of typographical fixes in the documentation of various Netscript functions.  A main fix is standardizing the use of "hostname".
* Cross-reference the documentation of various Netscript functions.  This makes it clear that we are referring to a particular Netscript function.
* Clarify the return values of various Netscript functions.  Clarify the documentation of other functions.
2022-10-25 07:17:53 -04:00
Snarling
5fe89d5599
CORPORATION: Reorganize Industry data (#154) 2022-10-24 21:54:54 -04:00
Snarling
d7193ca8ff
fix negative time display (#153) 2022-10-24 20:09:10 -04:00
Snarling
df70458e4f
CORPORATION: Give Employees some RNG (#152)
Authored-by: zerbosh <115591472+zerbosh@users.noreply.github.com>
2022-10-24 16:33:25 -04:00
G4mingJon4s
6dc5990b63
CORPORATION: Added check to buy amount (#149) 2022-10-24 16:09:53 -04:00
G4mingJon4s
3861e56ced
CORPORATION: Check there is room to make a new product before opening popup. (#147) 2022-10-24 08:58:51 -04:00
quacksouls
e9e9ac1def
DOC: CCT: typo fixes (#145)
Fixes #144.  Some typographical fixes in the description of a Coding Contract.
2022-10-24 08:46:26 -04:00
Snarling
0a3ff56331
WIP: Remove corp employees as objects (#143)
* Removed employees as objects from corporations
* Remove employees from office JSON after loading / convert to new parameters
* Showed down morale/etc gain; added optional position to hireEmployee
* enum support for corp employee positions

Mostly authored-by: Kelenius <kelenius@ya.ru>
2022-10-24 08:44:01 -04:00
hydroflame
317c3c3fc4
Update NetscriptDefinitions.d.ts 2022-10-22 00:27:29 -04:00
hydroflame
7784c2f8b2
Update NetscriptDefinitions.d.ts 2022-10-22 00:23:10 -04:00
Snarling
d74c380e42
WIP: Crimes streamlining. (#138)
* streamline crimes

* Crimes object is now indexed by CrimeType enum instead of an entirely new set of keys that aren't used for anything else. This eliminated a lot of instances of iterating to find the right crime for a given CrimeType.
* Removed unused `None` CrimeType which allowed typing Crimes as a Record<CrimeType, Crime>.
* Added slums tooltip text as a crime property, to allow streamlining slums.
* Refactor slums location - removed repetitive code, rerenders 1/sec to update chances
* Fix bugged descriptive text when sleeve is committing a crime (was "is attempting to DRUGS", now uses correct text e.g. "to deal drugs").
* Remove unused and now unneeded NewCrimeType enum. Values were identical to existing CrimeType values after removing unused None.

* Add CrimeType enum in NetscriptDefinition.d.ts

* Also update broken ToastVariant type. Better support for enums in player scripts.
* Still todo is modifying some NS functions to expect CrimeType as input (rough crime names will continue to work to avoid breaking scripts)

* Expect enum use for crime functions

Affected functions:
* ns.singularity.commitCrime
* ns.singularity.getCrimeChance
* ns.singularity.getCrimeStats
* ns.sleeve.setToCommitCrime
* formulas.work.crimeGains (param type only)

- Affected functions still will fall back to rough names, except formulas.work.crimeGains which already only accepted the enum members.
- Some documentation changes:
  * examples updated to use uppercase expected form.
  * Note on sleeve.setToCommitCrime that it only accepts exact matches removed. It already, and still does, accept any rough crime name (but the enum is expected input).
  * note about needing to use isBusy to schedule crimes remove - crimes autoloop now.
  * Since expected string inputs are documented directly on the type, removed list of crimes from sleeve.setToCommitCrimes
2022-10-21 11:57:37 -04:00
Snarling
19e8946d9a
fix Stock Initializer (#137)
* stock symbols initializer is called by stockmarket initializer
* remove redundant second initStockMarketFn function
2022-10-20 00:38:19 -04:00
Snarling
1d0d4f8da6
fix grow doc (#136) 2022-10-19 17:25:54 -04:00