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)