0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:30:46 -05:00

88 Commits

Author SHA1 Message Date
Dev
1c2d88ad3a Made a number of classes public 2024-03-02 15:50:50 +00:00
Dev
19fe726cea Add comment 2024-02-27 19:53:29 +00:00
Dev
d9aff659ba Fix LoadOfflineRaidScreenForScav patch failing to find private field 2024-02-27 19:51:12 +00:00
Dev
0429799dea 28965 2024-02-27 18:57:49 +00:00
f7ded0abf3 Add handling of trader service requirements (!86)
This is primarily handled by the server, but the client does have precautionary code in it

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: SPT-AKI/Modules#86
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2024-02-25 23:08:20 +00:00
Kaeno
28e945a7dd Fix patch causing double quest progression 2024-02-16 20:49:44 +00:00
c7bc0b0514 Rework build process (!83)
Co-authored-by: CWXDEV <CWXDEV@outlook.com>
Reviewed-on: SPT-AKI/Modules#83
2024-02-16 10:13:58 +00:00
c8507fb600 Synchronize scav encyclopedia with PMC at raid start, and inspect any items in scav inventory (!81)
This makes SPT mimic live in how scav encyclopedia is handled

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: SPT-AKI/Modules#81
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2024-02-15 08:55:41 +00:00
Kaeno
42ec75f2eb Fix insurance screen not showing. 2024-02-12 14:21:41 +00:00
Kaeno
22b6bcb4f5 Fix for scavs not going straight into raid when pressing ready 2024-02-12 13:58:08 +00:00
a3684c8663 Profile is now on its own interface, added new interfaceType to patchConstants and fixed the two scav patches 2024-02-12 13:15:22 +00:00
Kaeno
c340023378 Some more fixes preventing scav raids from working also btr fix 2024-02-12 12:01:27 +00:00
Dev
87d9688ab2 Update class refs for new patch 2024-02-12 11:33:06 +00:00
d08754fb61 Work towards implementing LK services (!79)
- Move clearing trader service data to raid end instead of as part of BTR Manager
- Fix data type for TraderServices ItemsToPay property
- Add ItemsToReceive property to TraderServices (Used for LK amulet)
- Don't throw NRE when nothing is bound to OnTraderServicePurchased

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: SPT-AKI/Modules#79
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2024-02-12 09:22:45 +00:00
3853a413f6 Fix quest counters triggering while ending the HideoutGame (!78)
When exiting the hideout, the HideoutPlayer class ends up triggering a call in Player that calculates quest counter changes. This causes issues with quests that require not dying

The Player class however wraps these calls in a null check on the QuestController, so we can set it to null before ending the hideout session, and restore it afterwards to skip quest counter calculations

As Hideout Game end only triggers on start of a new raid, and not when you actually close the hideout, I can't think of any reason that quest counters should trigger in this scenario

Resolves: SPT-AKI/Issues#471

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: SPT-AKI/Modules#78
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2024-02-10 08:31:18 +00:00
2e11148618 Fix the server sell all price not matching the client displayed value (!77)
- Add a patch that's triggered when the item list for the scav post-raid screen is populated that stores the calculated item value
- Add a second patch that's triggered when the player confirms a Sell All, that uses a custom request object that contains the previously calculated sell price

I made these patches not directly depend on any GClass/Class names to avoid having to update them with new client versions, this did make the code a bit harder to follow, but I think it's still readable.

Requires server PR: SPT-AKI/Server#216
Resolves: SPT-AKI/Issues#410

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: SPT-AKI/Modules#77
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2024-02-08 09:11:22 +00:00
Dev
f2ddc36d88 Prevent null values from being processed during bundle loading 2024-01-27 14:23:50 +00:00
a124ace054 Fixed exception caused by BTR not being destroyed at correct time (!68)
Todo:

* Make BTR spawn at random time during raid instead of at start
* ~~Fix BTR trader services not working for subsequent raids in Streets~~ Drakia provided me with a fix and it's included in this PR

TL;DR - It's ready for testing

Co-authored-by: Nympfonic <arys.steam@gmail.com>
Reviewed-on: SPT-AKI/Modules#68
Co-authored-by: Arys <arys@noreply.dev.sp-tarkov.com>
Co-committed-by: Arys <arys@noreply.dev.sp-tarkov.com>
2024-01-26 08:28:29 +00:00
Dev
3c9bf227e0 Removed unused _playerFlaggedAsEnemyToBosses value 2024-01-25 09:43:52 +00:00
Dev
79efcf22ce Fix class rename that kills patch 2024-01-24 22:49:10 +00:00
Dev
2fbe050a14 28476 - update mappings most classes were offset by 2 2024-01-24 11:08:16 +00:00
136b051623 Implement BTR taxi service (!64)
- Move creation/init of the BTRManager to before the `ExtractionTimerPanel.SetTime` method, to fix BTR timer panel not functioning
- Add subserviceId to the `OnTraderServicePurchased` event
- Add BTR taxi service handling

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: SPT-AKI/Modules#64
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2024-01-20 21:43:02 +00:00
879d90b71f Player will receive notifications when purchasing BTR service or when they are blacklisted from the BTR (!63)
Todo:

* Taxi service
* Improve turret aim/firing
  * Switch targets when current target out of line of sight
* Allow certain aspects to be configured from server, for example: price multipliers, wait times at each location, etc.
* Perhaps, a persisting blacklist from the BTR for several raids afterwards
* Further code refactoring

Co-authored-by: Nympfonic <arys.steam@gmail.com>
Reviewed-on: SPT-AKI/Modules#63
Co-authored-by: Arys <arys@noreply.dev.sp-tarkov.com>
Co-committed-by: Arys <arys@noreply.dev.sp-tarkov.com>
2024-01-20 09:20:32 +00:00
e771501cd5 BTR Cover Fire service and roadkill trigger implemented (!62)
Todo:

* Taxi service
* Refinement of BTR turret aim/shooting
  * BTR should switch targets if it has no line of sight to current target
* Blacklist player from entering BTR after antagonising it
  * Perhaps make blacklist persist for 3 raids (apparently on Live?)
* Code refactor because it currently looks like doodoo

Co-authored-by: Nympfonic <arys.steam@gmail.com>
Reviewed-on: SPT-AKI/Modules#62
Co-authored-by: Arys <arys@noreply.dev.sp-tarkov.com>
Co-committed-by: Arys <arys@noreply.dev.sp-tarkov.com>
2024-01-19 08:47:52 +00:00
Kaeno
b89af9f1ee Fixes to scav extracts. Now allowing correct extracts as we were disabling some incorrectly 2024-01-18 14:19:58 +00:00
4dee774efc Refactor trader services into its own manager in Aki.Singleplayer (!61)
I've moved trader services handling from Aki.Debugging BTR code into Aki.SinglePlayer
This simplifies some of the code, and allows a more "generic" implementation.

I've also patched the GetTraderServicesDataFromServer and TryPurchaseTraderService methods to properly utilize the TraderServicesManager for storing service state

For now, this makes Aki.Debugging depend on Aki.SinglePlayer, this can be reverted once the BTR stuff is moved

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: SPT-AKI/Modules#61
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2024-01-15 09:09:31 +00:00
337a0733ae Publicized assembly refactor (!58)
Depends on SPT-AKI/SPT-AssemblyTool#3

* Refactored Modules for better consistency and general readability, along with preparing the code for a publicized assembly
* Added `PublicDeclaredFlags` to `PatchConstants` to cover a set of commonly used flags to get methods post-publicizing
* Added a replacement to LINQ's `.Single()` - `.SingleCustom()` which has improved logging to help with debugging Module code. Replaced all `.Single()` usages where applicable
* Replaced most method info fetching with `AccessTools` for consistency and better readability, especially in places where methods were being retrieved by their name anyways

**NOTE:**
As a side effect of publicizing all properties, some property access code such as `Player.Position` will now show "ambiguous reference" errors during compile, due to there being multiple interfaces with the Property name being defined on the class. The way to get around this is to use a cast to an explicit interface
Example:
```cs
Singleton<GameWorld>.Instance.MainPlayer.Position
```
will now need to be
```cs
((IPlayer)Singleton<GameWorld>.Instance.MainPlayer).Position
```

Co-authored-by: Terkoiz <terkoiz@spt.dev>
Reviewed-on: SPT-AKI/Modules#58
Co-authored-by: Terkoiz <terkoiz@noreply.dev.sp-tarkov.com>
Co-committed-by: Terkoiz <terkoiz@noreply.dev.sp-tarkov.com>
2024-01-13 22:08:29 +00:00
Dev
b82ef6dd30 Fix quests not updating their status mid-raid 2024-01-10 11:54:15 +00:00
Dev
59f9549ced Update modules with additional remappings 2024-01-05 09:27:59 +00:00
Dev
5fcc904a89 Small cleanup of MidRaidQuestChangePatch 2024-01-04 17:25:56 +00:00
Dev
24e820feb5 Add comments to new function 2024-01-04 17:24:11 +00:00
b94cf04971 fix ValidationUtil, remove unused field 2024-01-04 17:18:46 +00:00
b2872ad707 Feat: implement achievement popup with data being set to profile for server to save 2024-01-04 17:16:43 +00:00
Dev
45d053e300 Disable OfflineSpawnPointPatch as spawns work without it 2024-01-02 14:49:58 +00:00
Terkoiz
fc1bb34bc2 Fixed post-raid healing; Exposed SessionId from RequestHandler 2023-12-30 21:26:22 +02:00
e3bdf9c1fd Update for 28375 + fixes (!47)
- Update GClass references
- Fix incorrect method in InsuranceScreenPatch (Makes insurance screen actually show)
- Fix incorrect method in Scav offline raid screen patch (Makes "Ready" from the practice screen start the raid)
- Update hollowed.dll with one provided by Chomp

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: SPT-AKI/Modules#47
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2023-12-29 09:43:15 +00:00
Terkoiz
e953de545d Fixed PostRaidHealingPricePatch 2023-12-27 21:45:33 +02:00
Terkoiz
eaf0c40d46 Fixed a couple runtime errors 2023-12-27 20:51:47 +02:00
Terkoiz
4da61ffb64 Fixed compile-time errors 2023-12-27 17:10:25 +02:00
bf07137cf7 Improve Robustness of RaidChangesUtil and RaidTimeUtil (!45)
While continuing mod development with SPT 3.7.4 (namely for Questing Bots and SAIN), I found that the API I added to SPT 3.7.4 is unintuitive and clunky to use after the raid is done loading but before the countdown timer expires. With the current SPT code, calling `GetRemainingRaidSeconds()` or `GetRaidTimeRemainingFraction()` will result in an exception during this time unless you check `HasRaidStarted()` first.

These changes will prevent those methods from throwing an exception unless you try calling them before a raid has finished loading (which should rarely happen). This allows mods to more easily do things using `GetRemainingRaidSeconds()` or `GetRaidTimeRemainingFraction()` before the countdown timer expires (i.e. cache bots).

These changes only improve the robustness of the existing code and will not break any mods that use the existing API.

Co-authored-by: dwesterwick <dwesterwick@yahoo.com>
Co-authored-by: chomp <chomp@noreply.dev.sp-tarkov.com>
Reviewed-on: SPT-AKI/Modules#45
Co-authored-by: DanW <danw@noreply.dev.sp-tarkov.com>
Co-committed-by: DanW <danw@noreply.dev.sp-tarkov.com>
2023-12-27 11:25:15 +00:00
Merijn Hendriks
820619b0dc [critical] Fix .NET Framework version (!42)
## Preface

The current version of Aki uses .NET Framework 4.7.2, C# 7.3.

However, this is not correct. Unity 2019.4.31f uses .NET Framework 4.7.1, C# 7.0 (you can see this when creating a new blank project in this unity version, then check the Assembly-CSharp.csproj).

You can load netstandard2.0 assemblies into EFT, which support C# 7.3.

## The issue

.NET Core 2.1 support types like `Span<T>` and `ReadOnlySpan<T>` which previous versions of .NET (.NET Core 2.0 / .NET Framework 4.8.1 and below, C# 7.1 and below) need to support through the `System.Memory` nuget package. Right now, this conflicts.

If you attempt to load an assembly like this, EFT will simply crash because `Span<T>` and `ReadOnlySpan<T>` do not exist inside mono's `mscorlib`.

## Why fix this

This is important for a variety of reasons:

- Prevent modders from accessing not available APIs leading to unexpected crashes
- Prevent possible compatability issues with EFT later
- Support for `Span<T>` and `ReadOnlySpan<T>` through `System.Memory` which is important for high-performance code and client mods (one of which I'm working on).

I really want to stress that this is an important issue to fix and should be merged ASAP. Unity 2019.4 being lax doesn't mean the next LTS version won't prevent loading.

## Why was the wrong version in the first place?

It was a best guess made by me 2 years ago. There were more pressing issues back then and it didn't crash on me. It started becoming an issue 1 year ago when I tried to port Aki to C#, because self-signed certificate generation is supported only within 4.7.2 and newer.

For reference: https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.certificaterequest.createselfsigned?view=netframework-4.7.2

## What's affected?

All the `.csproj` files in this repo.

Merging this means that some mods might need to retarget from .NET Framework 4.7.2 to 4.7.1.

Co-authored-by: Dev <dev@dev.sp-tarkov.com>
Co-authored-by: Terkoiz <terkoiz@spt.dev>
Co-authored-by: Terkoiz <terkoiz@noreply.dev.sp-tarkov.com>
Co-authored-by: DanW <danw@noreply.dev.sp-tarkov.com>
Co-authored-by: Merijn Hendriks <merijn.d.hendriks@gmail.com>
Reviewed-on: SPT-AKI/Modules#42
Co-authored-by: Merijn Hendriks <senko-san@noreply.dev.sp-tarkov.com>
Co-committed-by: Merijn Hendriks <senko-san@noreply.dev.sp-tarkov.com>
2023-12-09 16:32:45 +00:00
e91bf951d2 Added HasRaidStarted Method to RaidTimeUtil (!41)
To avoid issues when somebody calls `GetRemainingRaidSeconds()` or `GetRaidTimeRemainingFraction()` when a raid isn't in progress, I throw an exception if `GameTimer` isn't running. However, this can be confusing for modders since `GameTimer` starts well after `GameWorld` is instantiated. Therefore, I added a new `HasRaidStarted()` method so it's more clear when these methods can be called. Additionally, I updated the documentation for those methods to warn the user that `HasRaidStarted()` must be true or they'll throw an exception.

Alternatively, I can change the return type from `float` to `float?` for those methods and return null if a raid hasn't started. However, I felt like a null response is less intuitive than an exception in this case.

Co-authored-by: dwesterwick <dwesterwick@yahoo.com>
Reviewed-on: SPT-AKI/Modules#41
Co-authored-by: DanW <danw@noreply.dev.sp-tarkov.com>
Co-committed-by: DanW <danw@noreply.dev.sp-tarkov.com>
2023-12-08 22:22:42 +00:00
647fd0af89 Created RaidTimeUtil class to allow modders to retrieve "real" raid-time information (!40)
Added `RaidTimeUtil` which provides the following public methods:
* `GetRemainingRaidSeconds()`: Get the seconds remaining in the raid
* `GetRaidTimeRemainingFraction()`: Get the fraction of time remaining in the raid (relative to the original escape time for the map)
* `GetElapsedRaidSeconds()`: Get the elapsed seconds in the raid (relative to the original escape time for the map)
* `GetSecondsSinceSpawning()`: Get the elapsed seconds since spawning into the raid

This will allow modders to do things based on raid time, even after changes have been made for Scav raids.

The new class required several properties to be added to the existing `RaidChangesUtil` because apparently I can never stop messing with that class...

Co-authored-by: dwesterwick <dwesterwick@yahoo.com>
Reviewed-on: SPT-AKI/Modules#40
Co-authored-by: DanW <danw@noreply.dev.sp-tarkov.com>
Co-committed-by: DanW <danw@noreply.dev.sp-tarkov.com>
2023-12-08 22:22:42 +00:00
Dev
a7c76768a1 Remove debug logging 2023-12-03 11:16:19 +00:00
cd460851b2 Updated ScavRaidChangesUtil with Improved RaidChangesUtil (!39)
Since my half-baked PR containing a new class, `ScavRaidChangesUtil`, was merged, I figured I should flesh it out a little more.

I renamed the class as `RaidChangesUtil` and changed its namespace from `ScavMode` to `InRaid`. The main reason is because the information in this class is still applicable for PMC raids, so the class name/namespace should reflect that. I also allow modders to get more information about the changes that were made and relevant raid information for them.

I didn't include methods to retrieve changes made to location exits (for train times) because I didn't see much value in spending the time on it right now. I can always add it sometime in the future.

The way I manage `HaveChangesBeenApplied` in the new class is a bit lazy, but I didn't think buffering the values was necessary considering the limited applications for this class. Please let me know if you think this should be improved.

I'll add a new class in the new namespace for getting current raid-time information in another PR.

Co-authored-by: dwesterwick <dwesterwick@yahoo.com>
Reviewed-on: SPT-AKI/Modules#39
Co-authored-by: DanW <danw@noreply.dev.sp-tarkov.com>
Co-committed-by: DanW <danw@noreply.dev.sp-tarkov.com>
2023-12-03 11:16:19 +00:00
a8ede7bb13 Add Util to Allow Modders to Access Changes for Scav Raids (!38)
Added `Utils.ScavMode.ScavRaidChangesUtil` class so mods can easily access the change in map settings (currently just escape time) for Scav raids. This will allow mods like Questing Bots, DONUTS, etc. easily be able to alter spawn settings based on "real" raid time. Currently, each mod has to cache original raid settings and calculate the difference in escape times, which is performing redundant work.

I'm not sure what your conventions are for naming and stuff, so feel free to hack this up.

Co-authored-by: dwesterwick <dwesterwick@yahoo.com>
Reviewed-on: SPT-AKI/Modules#38
Co-authored-by: DanW <danw@noreply.dev.sp-tarkov.com>
Co-committed-by: DanW <danw@noreply.dev.sp-tarkov.com>
2023-12-03 11:16:18 +00:00
Dev
4de8ee7b50 improve handling of serverResult.NewSurviveTimeSeconds 2023-12-03 11:16:18 +00:00
Dev
c979b89ddd Formatting improvements 2023-12-03 11:16:18 +00:00
Dev
ab2a9bbb40 Reworked ScavLateStart patch
Removed majority of logic from client code in favour of having it in server
Targets different method, method_43
Processes changes provided by server
2023-12-03 11:16:18 +00:00
Dev
d19084c8cf Call into server during raid creation to get a replacement value for _raidSettings.SelectedLocation.EscapeTimeLimit 2023-12-03 11:16:18 +00:00