Commit Graph

684 Commits

Author SHA1 Message Date
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
Dev
3f07fc1bfc Cleanup of async method names
Add method comments
Reduction of code complexity inside `executeModsAsync()`
Add error message when loaded mod has no `main` property
2023-10-20 12:23:19 +01:00
Dev
33d3e6ce05 move log to correct place 2023-10-19 22:55:53 +01:00
Dev
3f8c681e7d Add mising standingForKill values 2023-10-19 22:39:26 +01:00
Dev
88a24151ef Remove empty object 2023-10-19 22:29:53 +01:00
Dev
234cd0b833 Randomise standing loss for dailies 2023-10-19 21:49:38 +01:00
Dev
83590dcc25 Get id if not found in profile 2023-10-19 21:44:10 +01:00
Dev
20b9a39cda Add missing IDs to json and pass throughout code 2023-10-19 21:36:17 +01:00
Dev
fa2a8c6513 Add missing id property to accept quest client response 2023-10-19 21:06:09 +01:00
Dev
11ae41dcff Fix missing text 2023-10-19 20:59:06 +01:00
Dev
489189bd81 Add missing properties to templates 2023-10-19 20:51:16 +01:00
Dev
79dc3cca1b Correct mistake in sending repeatable data to client on quest accept 2023-10-19 20:43:42 +01:00
Dev
d97beda4b7 Rework how repeatable quests are replaced 2023-10-19 20:04:47 +01:00
Dev
57b1fe0733 Improve bad replacement quest error messaging 2023-10-19 19:30:23 +01:00
Dev
914d505adc Add fence scav quest image 2023-10-19 18:52:47 +01:00
TheSparta
418d9f2a8f Import path alias on the whole project (!157)
- Ability to use @spt-aki path alias on the whole project.
- Swapped all imports from relative paths, for imports using the path alias.

Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/157
Co-authored-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
Co-committed-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
2023-10-19 17:21:17 +00:00
Dev
5af4abab91 Handle critical errors on mod load better - show player error in console instead of closing it on error 2023-10-19 15:25:52 +01:00
Dev
6589bcc0a2 Show human readable error when two mods have conflciting load order requirements
Improve cyclic error message text
2023-10-19 15:18:07 +01:00
Dev
2507837198 When launcher requests profiles and the exp is null, fall back to 0 - Fixes profile killing launcher listing ability
Use properties without quotes
Update nullguard to use Nullish coalescing
2023-10-19 11:37:07 +01:00
Dev
14c0b73482 Log build date on server start 2023-10-19 11:25:41 +01:00
Dev
1ee7ffe8b4 Blacklist mag_stanag_maopul_pmag_airsoft_6_30_fde from PMC equipment 2023-10-19 10:11:13 +01:00
Dev
e8d3fb805e updates to modLoadOrder 2023-10-18 17:36:36 +01:00
TheSparta
6231d73109 Implemented loadBefore and loadAfter (!156)
This PR adds the ability to set `loadBefore` and `loadAfter` on a mod's package.json, this allows for modders to define an array of mods their current mod needs to load before or after.

Examples:

if we have <u>__MOD1__</u> that has `loadAfter` = `[ "MOD2" ]` the loading order would be:

1 - MOD2
2 - MOD1

if we have <u>__MOD2__</u> that has `loadBefore` = `[ "MOD1" ]` the loading order would also be:
1 - MOD2
2 - MOD1

Begone zzzzzz, name your mods the way you want to.

Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/156
Co-authored-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
Co-committed-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
2023-10-18 14:44:29 +00:00
Dev
1adeed29ef Transfer ConditionCounter and quest status changes incurred during scav raid into pmc profile
Only add quests to scav profile when its a pickup/exploration/elimination quest
2023-10-17 22:04:19 +01:00
Dev
480967ab9a Incldue m4a1 with gas block item in modIsFrontOrRearSight() check 2023-10-17 20:45:40 +01:00
Dev
99cb77d3cf Save scav quests into scav profile when accepting them 2023-10-17 16:31:21 +01:00
Dev
650a3173c8 Implement Pickup quests for scav
It seems like these are scav-only
2023-10-17 16:28:48 +01:00
Dev
e10b62a5b1 Reduce PMC nvg usage during daytime from 20% to 10% 2023-10-17 09:14:17 +01:00
Dev
9ef63a11a4 Remove killa from streets 2023-10-16 22:02:02 +01:00
Dev
f70cbcced7 Set quest side to scav when generated for fence 2023-10-16 18:33:09 +01:00
Dev
b8738474e5 Rename cz to cs 2023-10-16 18:30:55 +01:00
Dev
4b70bfb60d Improve sourcemap handling in modCompilerService 2023-10-16 18:25:14 +01:00
Dev
6d19452455 Merge branch 'master' of https://dev.sp-tarkov.com/SPT-AKI/Server 2023-10-16 15:12:38 +01:00
Dev
b6edf71fc3 Reduce our custom item spawn chances by an order of magnitude 2023-10-16 15:08:00 +01:00
TheSparta
fe6865b2f0 Added sourcemap generation for typescript mods (!155)
This PR makes it so typescript generates inline sourcemaps when transpiling mods to javascript.

This will make it so stacktraces originating in the mod source code point to the typescript files, lines and columns.

Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/155
Co-authored-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
Co-committed-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
2023-10-15 16:15:34 +00:00
Dev
04235ca024 Reward more items for daillies/weeklies
Cleanup of `generateReward` item reward pool generation into its own function + return an easier array to work with
2023-10-15 11:46:33 +01:00
Dev
dc7f568819 Add missing rouble values and remove extra 0 2023-10-15 11:19:06 +01:00
Dev
7bc0d3f383 Prevent distance + melee kill quest combination 2023-10-15 10:49:23 +01:00
Dev
f155f5f0d0 Improve code comments 2023-10-15 10:44:12 +01:00
Dev
d44bda96cf make use of isbaseclasses to check for bad items instead of a non-optimal loop 2023-10-15 10:43:27 +01:00
Dev
fdd328b07a use function that only gets static price for daily rewards instead of function that falls back to flea price - improve price consistency 2023-10-15 10:39:35 +01:00
Dev
18c68fa353 make daily rewards found in raid 2023-10-15 10:38:50 +01:00
Dev
f23c8d484e Fix peacekeeper rewarding dollars instead of euros 2023-10-15 10:33:52 +01:00
Dev
cd74f05558 Cleanup of daily reward code doing the same item check multiple times 2023-10-15 10:28:52 +01:00
Dev
870f9a5092 Update daily reward scales 2023-10-15 10:14:46 +01:00
Dev
fbb1d7eb2f Adjust daily reward spread 2023-10-15 08:35:09 +01:00
TheSparta
1ab7c5946e Fixed stacktraces and source maps on the built exe (!153)
This PR fixes a long standing issue where stacktraces in the built executable didn't have line and column numbers, so you were left wondering where exactly in a given function an error occurred.

This also fixes source maps being generated but not actually included in the executable, this fix results in `source-map-support` actually doing it's job, so now stacktrace paths point to the typescript files, line and column number, instead of the transpiled javascript line and column number.

Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/153
Co-authored-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
Co-committed-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
2023-10-15 07:31:16 +00:00
Kaeno
e327f8101a Revert accidental debug setting for max repeatable quests (!154)
Co-authored-by: Kaeno <e>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/154
2023-10-15 06:34:41 +00:00
Dev
3546e0c6cb Update flea prices 2023-10-14 17:02:09 +01:00
Dev
5a0e16634e Fixed seasonal event items not appearing on flea during event
Don't rely on globals event value for event check, store event bools on SeasonaleventService class construction

Remove dupe function `getSeasonalEventItemsToBlock(), rely on `getAllSeasonalEventItems()`
2023-10-14 16:52:48 +01:00
Dev
11b885539d Fix halloween icons not loading 2023-10-14 16:05:12 +01:00
Dev
a9a1b3e07b Remove dupe mod slots from usec 2023-10-14 15:47:23 +01:00
Dev
3628fc41d3 Allow PMCs to respond to commands 2023-10-14 14:10:24 +01:00
Dev
7ad291fe4c Set lockedMoveCommands to true for new profiles 2023-10-14 14:01:21 +01:00
Dev
5dd2e10211 Configure additional scav property values on generation 2023-10-14 13:29:27 +01:00
Dev
79b9b2a7aa Update various property values on scav generation 2023-10-14 13:18:07 +01:00
Dev
f4359211ec Increase change of nosler ammo on scav 2023-10-14 12:30:17 +01:00
Dev
a8ce1f489d Merge branch 'master' of https://dev.sp-tarkov.com/SPT-AKI/Server 2023-10-14 12:29:31 +01:00
Dev
3c9dfba79d Fix overlapping weekly range data
Reduce range requirements for all quests
2023-10-14 12:20:20 +01:00
Kaeno
f0ab464613 add new gift to gifts.json (!152)
Co-authored-by: Kaeno <e>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/152
2023-10-14 10:50:52 +00:00
Dev
933e7512a6 Adjust daily rouble/item reward values
Disable melee requirement from daily scav quest
2023-10-14 11:44:02 +01:00
Dev
0b50385b84 Fix error on death because extract is undefined 2023-10-14 10:31:01 +01:00
Dev
f5b3377d12 Point local debug config to correct command 2023-10-14 10:10:10 +01:00
Refringe
7948e3473c Refactor of InsuranceController & New ItemHelper Methods (!151)
This commit is my second go-around at refactoring the `InsuranceController`, attempting to improving the code's modularity, maintainability, and efficiency while squashing a few bugs along the way.

1. **InsuranceController.ts**
    - Removed `ITemplateItem` import, as it is no longer used.
    - Introduced the `adoptOrphanedItems` method to manage orphaned items in the insurance list.
        - Since "normal" items are individually rolled for deletion, and can be nested within one another, there are situations where a parent item is deleted, leaving its children orphaned. This method moves those orphaned children from their missing parent into the root of the insurance container.
    - Overhauled `findItemsToDelete` method to improve its efficiency and readability:
        - Divided the original monolithic method into smaller, specialized methods like `populateItemsMap`, `populateParentAttachmentsMap`, `processRegularItems`, and `processAttachments`.
        - Changed the return type to `Set<string>` for better performance.
        - Introduced `EnrichedItem` interface (a simple extension of the `Item` interface) to add additional item data, like `name` and `maxPrice` to `Item` objects as they're processed throughout the class. This is done in place of repeatedly querying for this data, or complicating return types.
        - Enhanced logging capabilities to debug the item deletion process. Due to the *current* lack of testing available I've stepped up the amount of debug logging that is done. This will hopefully help us find issues in the future.
    - Modified the `rollForItemDelete` method, now renamed to `rollForDelete`, to include more detailed logging, return a boolean directly, and changed the `insuredItem` parameter to be optional.
    - Added new methods for dealing with some of the particulars that arise from item adoption and creating item maps.
    - Improved inline comments and documentation for better code maintainability.

2. **ItemHelper.ts**
    - Added the `isRaidModdable` method to check if an item is *actually* modifiable in-raid, which takes into account not just the item, but the item that it's attached to.
    - Added the `getAttachmentMainParent` method to fetch the main parent item of a given attachment, useful for item hierarchy traversal. For example, if you pass it an item ID of a suppressor, it will traverse up the muzzle brake, barrel, upper receiver, and return the gun that the suppressor is ultimately attached to, even if that gun is located within other multiple containers.
    - Added the `isAttachmentAttached` method to check if an item is an attachment that is currently attached to its parent.

**Fixes:**
 - Resolved an issue that caused item attachments from being property grouped together for deletion rolls. This issue prevented valuable attachments from being taken first.
 - Resolved an issue that caused child items being orphaned when their parent was removed due to an insurance roll. Probable cause of the bug that made the client spaz out and send repeated insurance packages to the profile---Though I'm still unable to reproduce.
 - Probably more...

Co-authored-by: Refringe <brownelltyler@gmail.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/151
Co-authored-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
Co-committed-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
2023-10-14 09:05:49 +00:00
TheSparta
723f8db572 Updated dependencies + A few other things (!150)
Initially this was going to be an update to dependencies but it seems i got a little carried away!

Anyways this PR removes 2 unused dependencies (`jshint` and `utf-8-validate`), and 2 other, `del` and `fs-extra` that were replaced by the built-in `fs/promises`.

It also renames all `tsconfig` and `Dockerfile` files, in a way that when viewed in a file tree sorted alphabetically they will be next to each other.

It also updates the typescript target to `ES2022`, and changes moduleResolution from `Node` to `Node10` (this isn't an update, they are the same thing but `Node` is now deprecated).

It also adds the `node:` discriminator to every import from built-in modules.

It also has major changes to the build script, `del` and `fs-extra` were only being used in the build script, it's now using `fs/promises` instead, cleaned up the code from some functions, adds better documentation to a few functions, and renames some gulp tasks and npm scripts to better represent what they actually do.

And finally it updates dependencies, except for `atomically` which can't be updated unless the project switches to ESM.

Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/150
Co-authored-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
Co-committed-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
2023-10-14 09:01:41 +00:00
Dev
8c972908d2 Fix daily bolt action requirement id being incorrect
Removed incorrec sniper rifle requirement from daily weapon category pool
2023-10-14 09:56:32 +01:00
Dev
87e2948806 Remove scripts content from imported mods package data 2023-10-14 09:48:24 +01:00
Dev
035fce63c3 Make use of Set data structure inside createRandomLoot() to improve performance via .has instead of .includes 2023-10-13 20:18:39 +01:00
Dev
292791aca4 make itemHasBaseClass() more robust against bad input 2023-10-13 16:54:17 +01:00
Dev
8e377594da Split up code inside validateQuestAssortUnlocksExist() to improve readability 2023-10-13 09:45:47 +01:00
Dev
45788e1489 Fix scav case erroring on item generation 2023-10-13 09:28:04 +01:00
Dev
38371f47fb Merge branch 'master' of https://dev.sp-tarkov.com/SPT-AKI/Server 2023-10-13 09:13:27 +01:00
Dev
1bce472cf5 Adjust rogue/raider/follower weapon dura values 2023-10-13 09:13:07 +01:00
ElRabbito
1e0b768786 Fixing playerscav.json error causing exceptions when karma is below -5 (!149)
That error caused game freeze because of server exception after played scav death or after successful extraction of played scav

Co-authored-by: ElRabbito <you@example.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/149
Co-authored-by: ElRabbito <elrabbito@noreply.dev.sp-tarkov.com>
Co-committed-by: ElRabbito <elrabbito@noreply.dev.sp-tarkov.com>
2023-10-12 19:51:10 +00:00
Dev
10b4c5bcd6 Add streets coop extract 2023-10-12 20:45:53 +01:00