Commit Graph

53 Commits

Author SHA1 Message Date
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
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
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
Olivier Gagnon
cbb7f58231 Make the main player object an alias, makes it easier to import 2022-10-09 18:42:14 -04:00
Snarling
475a8812bb findSleevePurchasableAugs as a class member 2022-09-27 15:35:41 -04:00
Snarling
83d357e758 commit1 2022-09-27 15:35:40 -04:00
Snarling
931ea730a5 Move entire ns object to top-level 2022-08-09 18:09:26 -04:00
Snarling
01e63b10a1 move ctx.log to NetscriptHelpers 2022-08-09 18:09:26 -04:00
Snarling
208495e269 Initial commit 2022-08-09 18:09:24 -04:00
Olivier Gagnon
3b35b07860 remove unused fields on sleeves 2022-07-28 03:08:39 -04:00
Olivier Gagnon
4549b0d467 finish sleeve rework 2022-07-28 02:46:34 -04:00
Olivier Gagnon
32bd629317 lint 2022-07-27 00:08:07 -04:00
Olivier Gagnon
326d9fd7ef Move player skills and exp to their struct 2022-07-26 23:54:17 -04:00
Olivier Gagnon
6498a720bb Merge branch 'dev' of github.com:danielyxie/bitburner into dev 2022-07-21 02:42:52 -04:00
Olivier Gagnon
693baf26df add sleeve aug price and rep function 2022-07-21 02:42:48 -04:00
hydroflame
68ecc9613c
Merge pull request #3739 from borisflagell/FIX#3732-v2
API: FIX#3732  Cannot assign two sleeve on "Take on contracts" regardless of contract type.
2022-07-21 02:31:12 -04:00
hydroflame
2fd3451780
Merge pull request #3724 from borisflagell/FIX#3661
API: Fix #3661 Add missing memory property to Sleeve API
2022-07-21 02:26:55 -04:00
Olivier Gagnon
5629c16def extract multipliers in its own type 2022-07-14 18:43:33 -04:00
Olivier Gagnon
f7805c4a51 convert faction work to new work system 2022-07-12 01:54:19 -04:00
borisflagell
c5b68610a1 fix typo in thrown error message 2022-05-27 17:59:37 +02:00
borisflagell
0abd760d35 API FIX:#3732 Cannot assign two sleeve on "Take on contracts" regardless of contract type.
ns.sleeve.setToBladeburnerAction() was not testing the contract value.
2022-05-24 15:38:05 +02:00
borisflagell
ff75097149 API: Fix #3661 Add missing memory property to Sleeve API
fixes #3661

Add the missing memory stat to NS.SleeveSkills Interface.
Update ns.Sleeve.GetSleeveStats accordingly.
(fixing commit issue)
2022-05-24 15:09:22 +02:00
borisflagell
051393fac9 API: FIX#2884 Add the missing className property to Sleeve'sAPI
fixes #2884.
2022-05-23 19:20:33 +02:00
Olivier Gagnon
7eb4494ac1 fix mc 2022-05-20 15:58:33 -04:00
Olivier Gagnon
c6806caca2 Wrap most of the API 2022-05-07 19:08:07 -04:00
rderfler
77073836cb Merge remote-tracking branch 'upstream/dev' into dev 2022-05-06 22:44:24 -04:00
rderfler
7cf21629a7 Address review
Add ns function setToBladeburnerAction
Formatting updates
fix sleeves using player stamina
Correct supporting sleeve causing error
2022-04-30 15:25:36 -04:00
phyzical
82610c0c44 Merge branch 'feature/add-infiltration-faction' into feature/refactor-augmentation 2022-04-15 14:26:00 +08:00
phyzical
db97125d22 remove level, base cost and rep requirment from base augmentation obj
* added in place calculations for cost and level of augmentations given player context
* removed redundant logic for dynamically calculating cost,rep and level against the augmentation object
* replaced references to startingCost to baseCost as it is now always whatever it started at
2022-04-15 01:39:38 +08:00
phyzical
c3a3994658 rename augmentation to static augmentation 2022-04-15 01:19:51 +08:00
Olivier Gagnon
69c5e42e30 remove redundant naming scheme 2022-04-14 12:13:01 -04:00
TheMas3212
de3359dfad
switch to checkEnum 2022-04-15 02:07:47 +10:00
TheMas3212
e07b92a408
fix 2993 sleeve.travel with invalid city names 2022-04-15 02:00:34 +10:00
Olivier Gagnon
62d15ff3a1 rm SourceFileFlags 2022-04-14 01:22:50 -04:00
Heinous Tugboat
dd19d6451d Updates sleeve functions so names match 2022-04-09 18:40:01 -04:00
hydroflame
b6d68f7353
Merge branch 'dev' into bugfix/fix-tests 2022-04-06 20:16:51 -04:00
Olivier Gagnon
4fc352a792 fix a few test 2022-04-06 20:12:54 -04:00
phyzical
8eccdf16e1 add logic to block working for gang faction 2022-04-04 18:10:21 +08:00
phyzical
18af3f8413 moved updateRam to first call to avoid lack of mocks for tests
* added wrapper funcs to simplify updateRam
* added static parser tests and skiped what isnt worker still for next person to try and fix
2022-03-31 21:41:19 +08:00
Olivier Gagnon
bbbaa89f74 unknown-ify singularity API 2022-03-29 20:05:40 -04:00
phyzical
7fdbc81594 used the getSleeveStats as it seems to be a miss connection between whats displayed and whats used
i.e sleeve.shock of 100 is actually a shock value of 0 for the use
2022-03-20 20:56:33 +08:00
parax
f04ee5a65c Linted file 2022-03-18 21:37:59 -06:00
parax
8b52e2ef3d Fixed: purchaseSleeveAug checks shock value 2022-03-18 20:30:54 -06:00
Nathan Solomon
df30a45388
Fixing Broken Error Message 2022-02-01 15:45:50 -06:00
Olivier Gagnon
c59a267437 change sf4 2022-01-04 19:09:34 -05:00
Olivier Gagnon
35fa4a4117 fix sleeve function not returning cha 2021-12-08 18:27:14 -05:00
Olivier Gagnon
c05518e162 workerscript log takes a function now, hopefully this will increase performance. 2021-11-26 18:30:58 -05:00
Olivier Gagnon
88b4a7d862 bugfix 2021-11-05 17:12:52 -04:00
Olivier Gagnon
c5fb5155f3 work on making sure all the functions are accounted for 2021-11-03 18:16:10 -04:00