Clone flea items prior to passing them off to the createSingleOfferForItem method
This change results in more armor on the flea having 100% durability, and less having identical non-max durability values
Resolves: https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/447
Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/223
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
- Fix data type for TraderServiceModel
- Add LK Service price/item data
Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/221
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Updated `getItemQualityModifierForOfferItems()` to return root items quality modifer when its a weapon
Fixed `getItemQualityModifierForOfferItems()` assuming quality started at 1
Bundle up profile save time and display in one line + do not log to file
Don't log when each profile is saved
Do not log to file how much fuel is left in generator
The rewardItem.target has to be set after the item IDs are regenerated, so it gets the new root item ID
Resolves: https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/470
Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/219
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Only check if progress was only `great than` craft time, not `great than or equal to`
Didn't take into account developer accounts have reduce craft timers
Fewer assorts on discount assort
Fewer weapons/armors on discount assort
Higher min dura for presets
Higher max dura for presets
Reduce price limit for marksmen rifles
Added small optimisations to skip full rows when looking for a free slot to put item in
Added small optimisation to skip looking for a free slot when entire container is full
Fixed error messages not properly being passed back up chain
Removed unused legacy function `placeItemInInventoryLegacy()`
Dont return stash layout as result in `fillContainerMapWithItem()`
Added small optimisation to `fillContainerMapWithItem()`, check if all slots of failled before trying to fit item
If the item handed in for a quest has a numeric `location` property, this indicates it's inside a magazine or other "sequential" container.
Re-calculate the `location` property of all children in the items parent in this case, to avoid gaps which break the profile
Resolves: https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/455
Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/218
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Split item generation values up, separate value for item/equipment/weapon
Fixed more assorts being generated than were being deleted each partial refresh
Added assort item options to discount assort config
Larger number of weapon presets
Larger stack size for ammos (override stack size of ammo by parent id, not item id)
Removed ammo boxes from blacklist + add max limit of 2
Removed fence debug logging
Make weapon picker check if weapon is on blacklist before adding
Fixed incorrect weapon mod removal check
Reduced chances mods are removed from weapons
Notable coding Changes:
- Added `getRootItemParentID` method in `InsuranceService` to standardize the determination of the root insurance container.
- Added `IInsuranceEquipmentPkg` model for structuring insurance packages, a type used to store insurance item data before it's saved in the profile.
- Added `HashUtil` in `InsuranceController` and `InsuranceService` for generating an ID for the root insurance container in the case that the root ID cannot be found.
- Updated and normalized item map generation and usage across `InsuranceService` and `InsuranceController`.
- Updated `ItemHelper` with new methods `adoptOrphanedItems` and `generateItemsMap`, facilitating better management of item relationships and efficient item look-ups.
- Updated `InsuranceController.findItemsToDelete` and related methods to use the new `rootItemParentID` parameter to ensure that all root level items share the same parent ID.
- Updated logic in `InsuranceService` for creating insurance packages and handling orphaned items.
Uh-huh, but what would you say you do here?
- Resolves an issue that arose when `lostondeath.json` equipment configuration options were set to `false`. On death, the equipment's children items would be sent back to the player through insurance, duplicating them.
- Resolves an issue that prevented items from appearing in an insurance return even though they passed an insurance roll.
- Improved debug logging.
Remaining Oopses:
- We do not have data on items that were dropped in a raid. This means we have to pull item data from the profile at the start of the raid to return to the player in insurance. Because of this, the item positioning may differ from the position the item was in when the player died. Apart from removing all positioning, this is the best we can do.
Resolves#425
In the project/assets/database/locales/server/en.json file, in the "launcher-profile_spteasystart" key, the description of the profile being created has changed from level 69 to level 15. The description of this key has been corrected in other localizations
Co-authored-by: Krinkels <krinkels@krinkels.org>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/217
Co-authored-by: Krinkels <krinkels@noreply.dev.sp-tarkov.com>
Co-committed-by: Krinkels <krinkels@noreply.dev.sp-tarkov.com>
Expanded `condition` config system to separate out current and max durability
Added missing armor config settings
Rewrote weapon durability method `randomiseWeaponDurabilityValues()` to do work similar to `randomiseArmorDurabilityValues()`
Fixed various items being classified as ARMORED_EQUIPMENT and using the wrong category config values
Moved ARMORED_EQUIPMENT to bottom of config so its chosen last, fixes vests being flagged as wrong item
Resolved by having the client send the sell price instead of trying to calculate it on the server. Same route, just with an extra parameter passed in
Removed unnecessary value calculation code, and renamed method to match new behaviour
Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/216
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
[The wiki specifies](https://escapefromtarkov.fandom.com/wiki/Scavs#Scav_karma) that, between 6 and 8, Fence rep is reset to 6 before penalties are applied (i.e. killing someone at 7.5 rep leaves you at 5.9), but the current fix just subtracts a flat 1 reputation instead (i.e. a kill at 7.5 leaves you at 6.4)
this should change that.
Co-authored-by: Azrael <Azrael@noneofyourbusiness.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/215
Co-authored-by: Azrael1123 <azrael1123@noreply.dev.sp-tarkov.com>
Co-committed-by: Azrael1123 <azrael1123@noreply.dev.sp-tarkov.com>
Made several improvements to the `InsuranceController` to ensure a more reliable and logical handling of insured items and their attachments.
- Updates `parentAttachmentsMap` declaration to `let` for mutability, enabling dynamic updates during processing.
- Updates `parentAttachmentsMap` to initially include all attachments (including attachments that should not be in-raid moddable).
- Updates `processRegularItems` logic to include `parentAttachmentsMap` in its parameters and logic. Now better ensures that attachments are correctly identified and processed alongside their parent items.
- Adds `removeNonModdableAttachments` method to filter out non-moddable attachments from processing.
- Updates deletion logic to better handle cases where items, such as armour vests and their non-removable plates, are processed to prevent orphaned items post-deletion.
Resolves#401
Resolved an issue that caused insurance packages that were created/lost in the same raid with different traders to be removed all at once instead of one-by-one after they were processed. This shouldn't have been causing any notable issues as the packages were already cached/queued up for processing elsewhere in the code, but it was never the original intent to have them removed before they were processed. The fix was simply to also match the trader ID when the package removal takes place.
Possibly related to #401#425
- Implemented deep cloning of input Items to prevent mutation.
- Reordered parameters: Items (required) now precede PMC data (optional).
- Updated method calls to bring them inline with these changes.
Two changes:
Calcualte the quality of an item and its mods, not just root item
Calcualte the average price of an offer using item + mods, not just root item
**Description**
This pull request changes the WebSocket connection `handle lost` log message in the `wsOnConnection` method of the `GameSocket` class. The original log message was:
```typescript
this.logger.debug(this.localisationService.getText("websocket-socket_lost_deleting_handle");
>>> [WS] Socket lost, deleting handle, status: %s
```
Which was inconsistent with most other languages. It can be understood from context that the socket was lost, therefor deleted and closed. Instead now;
```typescript
this.logger.debug(this.localisationService.getText("websocket-socket_lost_deleting_handle");
>>> [WS] Socket lost, deleting handle
```
This is achieved through editing the languages one by one and removing the "`status: %s`" component.
**Related**
- Closes: https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/421
Co-authored-by: Deadly <info.saddiki@gmail.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/214
Co-authored-by: Deadly Alden <deadly@noreply.dev.sp-tarkov.com>
Co-committed-by: Deadly Alden <deadly@noreply.dev.sp-tarkov.com>
- Resolves an issue in bot generation caused by a missing parameter when calling the `shouldModBeSpawned` method.
- Adds a optional chaining operator within a condition to safeguard against undefined errors.
Contributed by: barlog_m
Thank you! :D
Resolves an issue where the error message in `getItemsToListOnFleaFromInventory` did not propagate as expected due to the pass-by-value behaviour in JavaScript. The solution was to refactor the method to return an object that includes both the items and the error message.
Fixed some instances of:
- Unordered imports
- Reassigning function parameters
- Modifying values in assignment/return statements
- Array.forEach being used instead of for...of
- Simplified control logic
Better handling of item rewards that need to be split into root + child (ammo boxes)
Use `addItemsToStash()`
move `recipe.isEncoded` check to earlier in function
make use of `getItem()` inside `splitStack()` instead of direct db access
Keep completed dailies inside "activeQuests" array until dailies are refreshed
Adjust post-raid quest handling to ensure previously completed/failed quests keep their original status
Make function calculate drain rate for the whole period since last update ran, not just the interval period in config
Look up max fuel storage of item instead of assuming its expeditionary or the other fuel container
Reduce nesting by inventing an if
Changed 762x51 BCP FMJ and TCW SP to be weighed heavier to help prevent occurrences of the better ammo in the 762x51 array from spawning while low level.
Co-authored-by: VforValens <8889280+VforValens@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/209
Co-authored-by: Valens <valens@noreply.dev.sp-tarkov.com>
Co-committed-by: Valens <valens@noreply.dev.sp-tarkov.com>
Fix rightside_plate to be right_side_plate matching all other entries for config/bots.json, bots/types/arenafighter, bear, and usec.json's
Co-authored-by: VforValens <8889280+VforValens@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/208
Co-authored-by: Valens <valens@noreply.dev.sp-tarkov.com>
Co-committed-by: Valens <valens@noreply.dev.sp-tarkov.com>
Changes server accelerated time calculation to be fully independent of client calculations.
Local testing over most of a day showed time acceleration continuing through relogging as a client, and calculated times being synced to about +- 2 seconds between server and client with no drift.
-----------
In #202 I referenced the client side formula for accelerate time:
`In Raid Time = Today's Date + Location Time + Time Since Client Connection * Acceleration`
At the time I didn't know where Location Time was set and conservatively tried to match the server calculations to the client. Since then I've confirmed that it is set after calling `client/game/start` and holds the accelerated server timestamp from that call. With this in mind, I'm more confident changing the server calculations and here we are.
Previously each time you started your client, the accelerated time would start counting from your irl time at launch. This change moves that to the server, so you could leave your server running to have a more live-like experience where you won't be sure of the in raid accelerated time until you log in.
Added benefit of significantly simplifying the `getInRaidTime()` code.
Future work could be done to add save/load support to the server's timestamp to further emulate the live experience where timers won't reset to your irl time unless you wipe the data. I'd personally lean towards saving it at a server level, not a profile level, to allow multiple profiles to share a single 'wipe'.
-----------
Co-authored-by: OkaMoez <43766412+OkaMoez@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/205
Co-authored-by: OkaMoez <okamoez@noreply.dev.sp-tarkov.com>
Co-committed-by: OkaMoez <okamoez@noreply.dev.sp-tarkov.com>
Generate an items children and store in fence assort base
Better handle presets
Fix `removeRandomItemFromAssorts()` not removing all of an items mods from memory
Correctly calculate an items price including its children
This change brings the server in raid time calculation (accelerated time/time you see when choosing a map) to parity with the client.
The time returned by `getInRaidTime()` effectively is the same, but the server can stop using `acceleration - 1` and the adjacent comment has an answer.
-----
The Tarkov client calculates current raid time via the following formula in `Session.GetCurrentLocationTime()`:
`In Raid Time = Today's Date + Connection Time + Time Since Client Connection * Acceleration`
The server currently uses the following:
`In Raid Time = Current Date and Time + Time Since Client Connection * (Acceleration - 1)`
The `Current Time` and `-1` used in the server calculation effectively cancel each other out if `acceleration > 1`. Removing both should have no effect on the calculated time (not date).
The client side using `Today's Date + Connection Time` is kinda weird. Using `acceleration = 1`, you'd see the calculated date move 2 days after 24 hours. That said, I don't see the date portion of the raid time being used, so that might not matter. Either way, I've matched the formula to avoid any edge cases causing desync.
Co-authored-by: OkaMoez <43766412+OkaMoez@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/202
Co-authored-by: OkaMoez <okamoez@noreply.dev.sp-tarkov.com>
Co-committed-by: OkaMoez <okamoez@noreply.dev.sp-tarkov.com>
(cherry picked from commit afb64c1ebf)
Added the vest and headwear classes to be eligible for armor enhancement
Co-authored-by: Snow <Notarealemail@email.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/200
Co-authored-by: snowythefox811 <snowythefox811@noreply.dev.sp-tarkov.com>
Co-committed-by: snowythefox811 <snowythefox811@noreply.dev.sp-tarkov.com>
(cherry picked from commit 35eb9feebf)
#### TL;DR
Previously, Ragfair offers involving ammo boxes weren't generated with cartridges inside of them. This copies a lot of the logic from `InventoryHelper.hydrateAmmoBoxWithAmmo()` to add ammo to offers when they are generated. Made to fix#312.
#### Testing
Purchased various ammo boxes from Flea:
![image](/attachments/340fb349-2589-4b1a-81fa-f8d63f6f1a36)
Purchased ammo boxes are listed as full:
![image](/attachments/f52057d3-efe0-40e7-b64e-8d257a818fa5)
Unloading them produces correct ammunition:
![image](/attachments/33c71f7b-d452-473e-9705-cbad1ecc3f7d)
Co-authored-by: Spoony <Spoony@example.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/198
Co-authored-by: Spoony <spoony@noreply.dev.sp-tarkov.com>
Co-committed-by: Spoony <spoony@noreply.dev.sp-tarkov.com>