Commit Graph

658 Commits

Author SHA1 Message Date
Refringe
f5c379e189
Mocks some logger methods to prevent actual execution. 2023-10-30 11:46:10 -04:00
Refringe
4e33befaa0
Creates a temporary testing account and profile for each test suite. This is really slow... May have to think this one through. 2023-10-29 22:21:21 -04:00
Refringe
cc39c1847c
Enables typeschecking vitest feature. 2023-10-29 22:19:49 -04:00
Refringe
5ed94b6e63
Removes some trailing spaces. 2023-10-29 22:19:05 -04:00
Refringe
1d914783ae
Renamed tsconfig.test.json to tsconfig.profiler.json, as it's not actually used for testing. 2023-10-29 22:01:48 -04:00
TheSparta
b31a48066b Removed usage of global.container
Importing container from tsyringe directly seems to work fine.
2023-10-29 22:20:35 +00:00
TheSparta
ba32350751 Refactored tests CustomEnvironment.
- Instead of importing everything and registering to the container, it now uses `@spt-aki/di/Container` instead.
2023-10-29 22:20:34 +00:00
TheSparta
8490590c31 Removed @tests path alias from .swcrc 2023-10-29 22:20:34 +00:00
TheSparta
f354811ca8 A few changes to Watermark and Error Handling
- Made it so Watermark doesn't initialize on the constructor, this makes it possible for tests to use `@spt-aki/di/Container`;
- Removed unnecessary calls to `ErrorHandler.handleCriticalError`, all you really need to do is `throw new Error()` and it'll get caught automatically.
2023-10-29 22:20:33 +00:00
Refringe
ad5e0815b6 Migrated from Jest to Vitest
Basically the same, except it plays nicer with Typescript and ESM.

I have it mostly working, except for a type error:
`TypeError: Int32Array is not a constructor`

But I'm too damn tired it debug it at the moment.
2023-10-29 22:20:32 +00:00
Refringe
00ac9e190a Additional Tests & New Setup
- Adds additional ItemHelper tests
- Attempts to bring container registration into the environment to debug how we can register everything but not actually start the server.
2023-10-29 22:20:32 +00:00
Refringe
f009d13d2a Successfully importing database and passing global container. 2023-10-29 22:20:31 +00:00
TheSparta
1eceb797e2 fixed tests tsyringe resolve 2023-10-29 22:20:30 +00:00
TheSparta
abbd60d7e2 Switched from ts-jest to @swc/jest 2023-10-29 22:20:30 +00:00
Refringe
ca0547ed1a Trying to get the @spt-aki path alias working in a custom Jest Env. 2023-10-29 22:20:29 +00:00
Dev
fe703b34ec Remove unused file 2023-10-29 20:46:50 +00:00
Dev
199d7be0aa Add empty array to prevent undefined issue during bot gen 2023-10-29 20:46:15 +00:00
Dev
220a89b915 Default value to false if not found intead of letting it be undefined 2023-10-29 20:45:35 +00:00
Dev
6f62d0b400 Rename variable for clarity
Remove redundant `BlocksX` check
2023-10-29 20:44:41 +00:00
Dev
65aff3d74b Incldue Raider pocket loot on bloodhounds
Remove bloodhound last name
2023-10-29 17:32:41 +00:00
Dev
8223124882 Sort mod_barrel after mod_handguard to prevent weapon gen errors with certain combinations of barrel + gas blocks causing all handgaurds to be incompatible
Also force gas block to be processed AFTER barrel + handguard
2023-10-29 16:35:03 +00:00
Dev
1cd13ce21f Adjust weekly boss elimination requirements 2023-10-29 13:03:02 +00:00
Dev
fd7e59d1d2 Adjust servers handling of item stacks, when item has a StackMaxSize value of 1, use that instead of items db property StackMaxRandom 2023-10-28 19:39:45 +01:00
Dev
6d30d86ea4 Correctly handle when crafts are completed, null craft data instead of removing entire production key/value pair 2023-10-28 17:57:14 +01:00
Dev
cc86ecce2b Send correct data to client to inform it craft has been cancelled 2023-10-28 17:48:37 +01:00
Dev
ce50c88b87 Improve error message text 2023-10-28 16:16:39 +01:00
Dev
0316278b15 First pass at handling the cancellation of a hideout craft.
Doesnt explode server with unhandled exception error
Does remove craft from profile
Doesnt remove it from client screen until client refresh
2023-10-28 15:53:13 +01:00
Dev
f4fce0612e Force handguards that take a sub-handguard to set handguard spawn chance to 100% - fixes split handguards appearing without the lower part
Only adds lower when weapon has no launcher attached

Adjust sub stock adding code to trigger when stock has a subslot that starts with `mod_stock`, this means `mod_stock_akms` and `mod_stock_000` will be included
2023-10-26 20:31:05 +01:00
DrakiaXYZ
170a185928 Add a new /singleplayer/log route (!160)
Add a new /singleplayer/log route for logging data to the server console from the client

Supports:
- All server log levels
- `Custom` log level with text/background color
- Specifying the source of the log line (ex. Plugin name)

Example output:
![Example](https://i.imgur.com/c0XBYLm.png)

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/160
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2023-10-26 09:44:17 +00:00
Dev
1f90ae0bb0 Add undefined check to updateProfileBaseStats() 2023-10-25 18:13:33 +01:00
Dev
0e3d25df03 Improve getTrader()
Error when no profile found
Reduce returns to 1
fold two checks into one
Remove magic string reliance on TradersInfo exist check
More comments
2023-10-25 12:18:27 +01:00
Dev
729b180e85 Add request object type 2023-10-25 11:54:11 +01:00
Dev
b29f0a0904 Coop extract gifts from fence are now Found in Raid 2023-10-25 10:14:19 +01:00
Dev
90efc36360 Fix incorrect value names in getEliminationKillCount 2023-10-24 17:06:02 +01:00
Dev
a5dbfef7d0 Localise some error text 2023-10-24 16:40:34 +01:00
Dev
657dd358c2 Give method an access type protected 2023-10-24 15:12:18 +01:00
Dev
1cf63ad1ad Split pmc kill requirement for elimination into separate min/max counts from other bot types 2023-10-24 15:01:31 +01:00
Dev
c3777af231 Add guards to dynamic spawn point generation
Rename some variables for clarity
2023-10-24 11:15:23 +01:00
Refringe
8541e5f028 Refactor Currency Handling in PaymentService.payMoney() Method (!159)
This commit includes a series of changes aimed at improving the logic and readability of the `payMoney` method in the PaymentService class. The method is pivotal for handling in-game payments, specifically in cases involving multiple types of currencies and barter trades. The changes resolve an issue that prevented barter payments that included both a currency and another item.

## Changes:

- Replaced `barterPrice` variable with a `currencyAmounts` mapping that efficiently tracks each type of currency involved in the trade.
- Updated how the `costOfPurchaseInCurrency` variable is calculated to factor in multiple currencies.
- Introduced a new variable `totalCurrencyAmount` to sum up the total amount of all currencies, which is checked to determine whether any (non)currency payment is necessary.
- Added some inline comments for readability.

Resolves #176

Co-authored-by: Refringe <brownelltyler@gmail.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/159
Co-authored-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
Co-committed-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
2023-10-24 09:27:46 +00:00
Dev
250b9dca3f Merge branch 'master' of https://dev.sp-tarkov.com/SPT-AKI/Server 2023-10-23 19:29:35 +01:00
Dev
7b0298cda2 Adjsut 2 bot gen errors to be warnings 2023-10-23 19:19:05 +01:00
TheSparta
7aee78eb49 Fixes Insured items on secured containers (!158)
This PR fixes both https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/174 and https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/175.

Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/158
Co-authored-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
Co-committed-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
2023-10-23 16:45:40 +00:00
Dev
69ee8983b2 Improve logging text 2023-10-22 13:14:38 +01:00
Dev
3c709311d8 Correctly save statusTimer values into profile 2023-10-21 21:24:14 +01:00
Dev
ec7d3e1699 Fix bad injection 2023-10-21 20:22:11 +01:00
Dev
54d47585f2 Show sessionid/profile id when profile data is saved 2023-10-21 20:19:45 +01:00
Dev
018b0a8f70 Fix profile creation error 2023-10-21 20:13:29 +01:00
Dev
573d91a9c2 Persist ConditionCounters data between pscav runs
Move values around to help with readability
2023-10-21 18:23:58 +01:00
Dev
de2f70fb79 Remove replaced repeatable quest from PMC and scav profile 2023-10-21 17:39:44 +01:00
Dev
0c31c0ab8f Add additional pmc responses 2023-10-20 14:06:39 +01:00