Commit Graph

590 Commits

Author SHA1 Message Date
T.J. Eckman
df334ea6de
SINGULARITY: Added getCompanyPositions (#459)
Also workForCompany will throw an error if provided a bad company name, instead of returning false
2023-04-01 21:30:46 -04:00
David Walker
2b54c6c9b9
NETSCRIPT: Add ramOverride as a RunOption (#441)
Allows overriding the static ram calculation. Dynamic ram limit still applies.
2023-03-22 10:09:12 -04:00
Mughur
1f98eecb57
CORP: rework (#428)
* corp overhaul: Corp production quality now depends on materials

* corp overhaul: Product price can be set separately for each city

* corp overhaul: export uses relatives

* corp overhaul: ignore energy in quality

* corp overhaul: getProduct() is city dependant

* corp overhaul: bulkbuy available from start

* corp overhaul: add multibuy for leveled upgrads

* corp overhaul: changes to UI

* corp overhaul: base quality 1, reqmat changes

* corp overhaul: puchased material quality is 1

* corp overhaul: get rid of the text box from ta2

* corp overhaul: sold shares limitations

* corp overhaul: coffee -> tea, training -> intern

* corp overhaul: smartsupply has multiple options

* corp overhaul: restart, literature, investore, ui

* corp overhaul: nerf advertising

* corp overhaul: bunch of stuff
2023-03-18 03:12:43 +02:00
omuretsu
b9ffb9e42e Add triggers for faction invite check
Manually check for faction invites whenever a server is backdoored, and whenever the player uses ns.singularity.checkFactionInvites
2023-03-07 19:31:54 -05:00
Snarling
51bf0d1904
Stanek performance boost + bonus time rework (#410) 2023-03-07 14:45:22 -05:00
Snarling
e74dfe9b79
NETSCRIPTSLEEVE: Add cyclesWorked to ns.sleeve.getTask return (#409) 2023-03-07 05:30:15 -05:00
Snarling
759f86d6e5
NETSCRIPT: Rework script ram updates (#408) 2023-03-05 22:39:42 -05:00
T.J. Eckman
33f0150d25
BUGFIX: Memory Leak in NetscriptPorts (#399)
Co-authored-by: Snarling <84951833+Snarling@users.noreply.github.com>
2023-02-27 19:54:04 -05:00
Zelow79
028199aa7d
SLEEVE: Add sleeve.setToIdle function (#374) 2023-02-19 00:13:23 -05:00
David Walker
ed59f4bfe7
NETSCRIPT: Add growThreads to formulas, improve docs for hacking functions (#330) 2023-02-14 17:38:51 -05:00
Snarling
b9a2953fa6
Add totalExperience property to getOffice (#367) 2023-02-14 01:38:22 -05:00
Snarling
f16a4f1a4e
fix setTheme 2023-02-13 19:49:07 -05:00
Snarling
b4074328ec
UI: Added new locale-aware and configurable number formatting (#354) 2023-02-11 13:18:50 -05:00
omuretsu
867236e153 autoAssignJob streamlining 2023-01-29 08:14:12 -05:00
Christian Roy
d7439aae52
Fix setAutoAssignJob parameter validation. (#339) 2023-01-29 07:39:01 -05:00
Zelow79
5f923a348c
NETSCRIPT: Added cyclesWorked to certain sleeve.getTask returns, and added bladeburner.getActionSuccesses (#324) 2023-01-15 23:50:54 -05:00
zerbosh
65f22e7931
CORPORATION: prevent "Unassigned" as job in setAutoJobAssignment (#308) 2023-01-06 22:28:22 -05:00
zerbosh
b4743a9841
CORPORATION: added Checks to setAutoJobAssignment (#307) 2023-01-06 14:52:40 -05:00
David Walker
4eef9eec03
NETSCRIPT: More ns Proxy changes (#297) 2023-01-05 20:41:24 -05:00
David Walker
7b5080a42b
NETSCRIPT: Add undocumented function printRaw() (#277)
This is analagous to tprintRaw (enabled by ns.iKnowWhatImDoing()), but
for logs instead of the terminal. This provides a supported* method of
creating complicated UIs for scripts.

*No actual support, expressed or implied, is provided for use of this
function.
2023-01-05 20:30:34 -05:00
omuretsu
4ab29e9c60 Fix minimum corp employee stat
* minEmployeeDecay is now part of CorpConstants and has a value of 10. This replaces Office.minEne/minMor/minHap
* Also removed some unnecessary files in dist/ext for MathJax
* Rebuilt documentation to remove minHap/minMor/minEne from getOffice, and add minEmployeeDecay to corporation.getConstants
2023-01-03 11:55:50 -05:00
omuretsu
2cb989243f Format fix... 2023-01-02 13:59:31 -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
zerbosh
7d98c680e5
SLEEVE: added storedCycles to getSleeve() (#279) 2023-01-02 09:45:51 -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
8d793ea271
Internal refactoring of Router (#241) 2022-12-04 03:14:06 -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
e7fc0fbb03
Fix documentation for ns.sleeve (#227) 2022-11-24 08:19:51 -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
426ad5f296
Sleeve criming fix (#209)
Also simplify usage of findCrime
2022-11-10 11:05:42 -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
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
omuretsu
b057e2e5f2 Fix sleeves unable to commit crime 2022-11-03 08:39:34 -04:00
Snarling
5b2a96fa0c
CORPORATION: Happiness/Energy/Morale trend down even for productive corps (#157) 2022-10-25 10:32:20 -04:00
Snarling
5fe89d5599
CORPORATION: Reorganize Industry data (#154) 2022-10-24 21:54:54 -04:00
G4mingJon4s
6dc5990b63
CORPORATION: Added check to buy amount (#149) 2022-10-24 16:09:53 -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
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
omuretsu
e192ad53ec Actually format + lint 2022-10-12 10:18:56 -04:00
omuretsu
7a384d53f4 typefix netscriptFunctions (see desc)
* Types for InternalFunction and ExternalFunction have been modified to actually typecheck ns functions against docs.
* Internal functions are required to use unknown for any params on the inner function.
* Return types for internal function inner-function must match the respective external function.
* Added new typecheck assertion function for asserting dynamic object types, to allow unknownifying params that were previously hardcoded objec structures.
* Because type assertion for parameter types and return types is enforced by InternalAPI, removed all duplicate type declarations on NetscriptFunction params and returns.
2022-10-12 08:49:27 -04:00
omuretsu
41b6f0b87b add hoop before exposing 2022-10-11 21:02:04 -04:00
omuretsu
7d07f44b3e move to global scope 2022-10-11 20:01:10 -04:00
omuretsu
84b99c569a extra printRaw function 2022-10-11 16:07:45 -04:00
Olivier Gagnon
cbb7f58231 Make the main player object an alias, makes it easier to import 2022-10-09 18:42:14 -04:00
Olivier Gagnon
f4668b21ca functions to generate dummy contracts 2022-10-09 02:56:11 -04:00
Olivier Gagnon
0fdf74ceeb typo 2022-10-09 01:32:44 -04:00
Olivier Gagnon
f6f023eeb4 Fix tons of typos 2022-10-09 01:25:31 -04:00
Snarling
068533cd2f format, lint, more enums, revert fn rename 2022-10-05 14:52:48 -04:00
Snarling
aa80cf6451 See description
Reverted ToastVariant back to an enum internally. Still exposed to player as just possible strings.
Changed all 1-line documentation comments to actually be 1-line. Moved some because they were not providing documentation for the thing they were trying to.
2022-10-04 06:40:10 -04:00
Snarling
50f14b4f58 Commit1 2022-10-03 12:12:16 -04:00
Snarling
16fac67257 fix broken rebase 2022-09-27 16:23:53 -04:00
Snarling
38063f62a7 build fix, lint, remove some instanceof checks 2022-09-27 16:09:32 -04:00
Snarling
e5e6b05be0 format+lint+build fix 2022-09-27 15:35:42 -04:00
Snarling
bc7c15ad77 corp: classes are types 2022-09-27 15:35:42 -04:00
Snarling
2213d06159 Using bladeburner and action classes as types 2022-09-27 15:35:41 -04:00
Snarling
475a8812bb findSleevePurchasableAugs as a class member 2022-09-27 15:35:41 -04:00
Snarling
21a2d49de7 Finish removing player passing 2022-09-27 15:35:41 -04:00
Snarling
a21b1029d7 No more player/router context 2022-09-27 15:35:40 -04:00
Snarling
83d357e758 commit1 2022-09-27 15:35:40 -04:00
Duck McSouls
0a644aed58 Typo fix in ns.singularity.workForFaction()
Abbreviation of "you are" is "you're".  Also place a full stop at the end to complete the sentence.  Fixes #4118.
2022-09-23 20:32:53 +10:00
hydroflame
5101b345ec
Merge pull request #4069 from Mughur/corp
API: Corp functions now return copy of constant arrays instead of the original
2022-09-23 00:58:32 -03:00
hydroflame
ee67aa90f9
Merge pull request #4131 from Mughur/valuation
CORPORATION: Gave investors some economics classes
2022-09-23 00:58:06 -03:00
hydroflame
a8e640e309
Merge pull request #4084 from Rasmoh/expose_exports
CORPORATION API: FIX #3655 Expose exports from Material
2022-09-23 00:46:28 -03:00
Olivier Gagnon
4f64d3eeb1 use triple equal 2022-09-22 23:45:00 -04:00
hydroflame
9f922de50d
Merge pull request #4101 from Kelenius/UnhardcodeBBAndCorpDisabling
UI: Bitnode stats now show if BB/Corporation are disabled
2022-09-23 00:43:19 -03:00
hydroflame
23c889bafd
Merge pull request #4074 from phyzical/hotfix/4058
CORP API: Fix up param order for limitProductProduction to match docs
2022-09-23 00:36:24 -03:00
hydroflame
e49bd3d091
Merge branch 'dev' into feature/add-back-api-export 2022-09-23 00:34:19 -03:00
hydroflame
c449680256
Merge pull request #4104 from Mughur/dev
MISC: multiple hasAugmentation checks didn't check if the augment was installed
2022-09-23 00:32:16 -03:00
Mughur
d4c06eba24 Change corporatio valuation calculations 2022-09-23 05:05:18 +03:00
phyzical
4175960fc6
use bitnode multiplers in the output of crime stats 2022-09-20 17:56:05 +08:00
Mughur
4c5adc8dfb More hasAugmentation fixes 2022-09-14 21:21:49 +03:00
Kelenius
5350e1c3e9 Unhardcoded BN8 BB check; show if corp/BB are disabled in BN stats 2022-09-12 17:48:52 +03:00
phyzical
ca2f1a62a5
add singularity function for exporting game save 2022-09-07 16:11:51 +08:00
Rasmoh
cc0fd197c5 Expose exports from Material 2022-09-05 17:25:32 -07:00
phyzical
2a8ddb8147
fix up param order to match docs
hotfix/4058

File List:
src/NetscriptFunctions/Corporation.ts
2022-09-02 11:58:12 +08:00
Mughur
c467a49a38 corp functions now return copy instead of original 2022-08-31 12:05:36 +03:00
Olivier Gagnon
c9a0998cc1 Improve wrong arg user message and add ui.windowSize 2022-08-29 18:07:17 -04:00
hydroflame
a0475cc630
Merge pull request #4049 from MPJ-K/dev
NETSCRIPT: FIX #3963 Prevent bladeburner.setActionLevel from setting invalid action levels
2022-08-29 11:20:28 -03:00
hydroflame
c2796e164a
Merge pull request #4052 from Snarling/ns1wrapper
NETSCRIPT: FIX #4037 ns1 wraps deeper layers correctly.
2022-08-29 11:14:32 -03:00
Florian Schöffl
282dc28c8d
INFILTRATION: Corrected ns formula for infiltration rewards
In commit 
7c5097ee83d9e2d185960a9c96739a78981bd600 the author extracted the functionality for infiltration rewards into a NS function and made it accessible via formulas.

The exposed function does however not use the same input parameters as the Victory screen after infiltration since he uses the difficulty and not the starting difficulty.

Difficulty is clamped to [0;3], so the formulas api showed for high difficulty servers a vastly lower result.
2022-08-29 02:35:39 +02:00
Snarling
ef1f376c09 format, lint, remove unused "running" property on ws 2022-08-27 22:32:48 -04:00
Snarling
6f36e9cdc5 Fix/Unify NS1 wrapper 2022-08-27 20:56:12 -04:00
MPJ / Quadryo
197081dd3e
Fix #3963
Adds a previously missing `throw` to allow `bladeburner.setActionLevel()` to properly produce errors and prevent invalid action levels from being set.
2022-08-26 20:59:26 +02:00
hydroflame
2463fc2012
Merge pull request #4028 from Snarling/scpAndWriteDocFix
NETSCRIPT: Update netscript definition file for scp, write, read, and flags
2022-08-25 16:37:07 -03:00
Snarling
650db2dee7 Add type fix for flags 2022-08-24 19:09:18 -04:00
Alain Bryden
359def2b61
Don't stringify answer if already a string 2022-08-24 11:09:35 -03:00
Snarling
445e365959 debounce updateRAM 2022-08-23 16:38:30 -04:00
Olivier Gagnon
89aa23f4b3 Add dummy function to generate a mock server or player for formulas stuff 2022-08-23 16:01:34 -04:00
Olivier Gagnon
7cb48f4612 fix compile error 2022-08-23 12:04:09 -04:00
hydroflame
fe3e34408d
Merge branch 'dev' into dev 2022-08-23 13:01:13 -03:00