Commit Graph

329 Commits

Author SHA1 Message Date
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
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
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
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
0b50385b84 Fix error on death because extract is undefined 2023-10-14 10:31:01 +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
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
3c3fd56e65 Send gift to player after taking coop extract 2023-10-12 20:04:50 +01:00
Dev
3598418f6e Disable filtering out healing items from backpack loot 2023-10-12 14:33:09 +01:00
Dev
29ffe86caa Remove redundant item added check from value check 2023-10-12 13:25:13 +01:00
Dev
db619a30b3 Add boss item blacklist and wire into:
airdrops
scav cases
sealed weapon containers
daily quests

Default boss item filter to on
2023-10-12 11:00:04 +01:00
Refringe
52172f2953 InsuranceController Quality and Maintainability (!148)
This pull request aims to refactor the InsuranceController class to improve its code quality and maintainability. The changes include restructuring methods, adding detailed comments, and enhancing the overall logic for processing insured items.

Specific changes include:

- Updating the `findItemstoDelete()` method (and the entire class, really) to keep track of which items are tagged using a Set. This *ensures* that an item can only be attempted to be deleted once, as Sets cannot contain duplicates.

- Changing the method in which we remove insurance packages from the profile. We were iterating over them using a `for` in reverse order and then removing them with a splice and the current index. On paper this should work, but funny things were happening... Sometimes. I've created a new method that removes packages from a profile by matching against the package systemData date, time, and location. This should give us a specific insurance package (as we don't have an ID to use). In addition to this we're fetching a new instance of the profile to edit, instead of modifying packages that are being iterated over as they're being iterated over.

-----

I was unable to reproduce the issue where insurance packages were not being removed from the profile, but hopefully these simplified approaches lead to less funny business.

Co-authored-by: Refringe <brownelltyler@gmail.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/148
Co-authored-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
Co-committed-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
2023-10-12 08:38:22 +00:00
Dev
968911e3de Refactored repeatable quest system
Moved quest generation code into its own class
Moved shared methods used by controller and generator into helper class
2023-10-11 17:43:57 +01:00
Dev
0986bd0932 Make separate bossKill min/max properties + adjust various difficulty values 2023-10-11 17:05:06 +01:00
Dev
c2a6ca678e Add support for daily quests to request specific weapon kill requirements on elimination quests 2023-10-11 17:04:18 +01:00
Dev
2f2e7c2e32 Variable rename to aid in readability 2023-10-11 10:47:54 +01:00
Dev
a19e322373 Remove debug logging inside addMissingHideoutBonusesToProfile() 2023-10-11 09:01:45 +01:00
Dev
68a8d34489 Protect against a missing upd object inside changeItemStack() 2023-10-10 22:37:38 +01:00
Dev
f67c4293d8 Merge used profile mods onto a single record for each mod by name, choosing newest 2023-10-10 17:01:29 +01:00
Dev
76d8b944d5 Store `AvailableAfter value in statusTimer of timelocked quest
Send locked quest to client when requested
Delete `availableAfter` property when accepting a quest
2023-10-10 16:18:55 +01:00
Dev
8edc43e9de Do not send timelocked quests to client until timer is passed 2023-10-10 14:46:23 +01:00
chomp
0b67a9a0e9 0.13.5.0 (!147)
Co-authored-by: Dev <dev@dev.sp-tarkov.com>
Co-authored-by: Terkoiz <terkoiz@noreply.dev.sp-tarkov.com>
Co-authored-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
Co-authored-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
Co-authored-by: Kaeno <e>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/147
2023-10-10 11:03:20 +00:00
gasmo
8d911ccc19 Fix ballooning recursive function (!120)
The `BotEquipmentModPoolService.generatePool()` method is recursive, but it does not check if the pool it creates already contains data for sub items when it finds them and calls itself on them. This creates substantial bloat in the function that is undetectable to end users, but causes some additional delay when it is called.

I noticed this when using a server mod that allows for less restrictions on mod combinations (as it would hit the system recursion limit and error out) but the bloat still affects vanilla - it takes ~1 minute for all the recursive calls to end, whereas this fix reduces that to <10 seconds.

To fix this, I've moved a block of code into the conditional block that checks if the item we're adding (and its' sub items) are already in the pool before it calls itself.

This is my first pull request, so let me know if I've fudged up somewhere and I'll do my best to fix it.

I submitted a previous request about this, but I removed my name from the commits so I had to delete the branch.

Co-authored-by: gasmo <burr.cameron@gmail.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/120
Co-authored-by: gasmo <gasmo@noreply.dev.sp-tarkov.com>
Co-committed-by: gasmo <gasmo@noreply.dev.sp-tarkov.com>
2023-08-18 14:17:54 +00:00
Dev
1b387f706d Revert "Update JSONs + add new params to interfaces"
This reverts commit 3bf644c0e4.
2023-08-10 16:02:33 +01:00
Dev
3bf644c0e4 Update JSONs + add new params to interfaces 2023-08-10 16:00:49 +01:00
Dev
96ef616d48 Add comments 2023-08-10 14:30:29 +01:00
Dev
91ec0144ed Esxpose two endpoints for launcher to get mod-related data 2023-08-10 14:29:09 +01:00
Dev
e591ea9e8f make setFenceAssort and setFenceDiscountAssort public 2023-08-09 22:04:35 +01:00
Dev
285f65bb8d Only remove item from fence assort if he has items to remove
Add empty assort check to remove function too
2023-08-09 19:20:41 +01:00
Dev
96de45e580 Expose SPT friend nickname in core config 2023-08-09 16:01:51 +01:00
Dev
99715f90cd Update JSONs and include end of wipe gift
Add additional method to send localised messages from SYSTEM to player
2023-08-09 14:22:16 +01:00
Dev
7a1301d436 Fix request logger throwing errors when logging non-json data 2023-08-09 12:16:41 +01:00
Dev
dea27097b3 Improve server start message selection 2023-08-09 12:07:31 +01:00
Dev
643cf9a268 Regenerate item cache on game start
Fixes 'item missing from cache' errors seen when using multiple mods that add items to the game
2023-08-09 12:04:31 +01:00
Dev
b3f5ea8287 FIx null excpetion when a weapon reward is picked that has no presets
We only want the default preset, so use that function instead
2023-08-09 11:52:20 +01:00
chomp
c1a4c544bc Add JSONC support to server configs + use by modders (!112)
Replaced calls (where possible) to JSON.parse/stringify with use of `jsonUtil` functions
`VFS.ts` was tricky, it can't be updated as it'd create a circular dependency

Also add json5 to package.json for modders to have access to

Co-authored-by: Dev <dev@dev.sp-tarkov.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/112
2023-08-09 10:49:45 +00:00
Dev
6262d74acc Pass the location insurance was lost into sendLostInsuranceMessage()
make use of mailSendService.sendLocalisedNpcMessageToPlayer()
Make use of new `insuranceFailedLabs` array in prapors json data
2023-08-07 22:43:00 +01:00