diff --git a/Features/Durability.cs b/Features/Durability.cs new file mode 100644 index 00000000..bf43f3f8 --- /dev/null +++ b/Features/Durability.cs @@ -0,0 +1,31 @@ +using EFT.Trainer.Extensions; +using JetBrains.Annotations; + +#nullable enable + +namespace EFT.Trainer.Features; + +[UsedImplicitly] +internal class Durability : ToggleFeature +{ + public override string Name => "durability"; + public override string Description => "Maintains maximum durability of the player's weapon."; + + public override bool Enabled { get; set; } = false; + + protected override void UpdateWhenEnabled() + { + var player = GameState.Current?.LocalPlayer; + if (!player.IsValid()) + return; + + if (player.HandsController is not Player.FirearmController controller) + return; + + if (controller.Item?.Repairable is not {} repairable) + return; + + repairable.MaxDurability = repairable.TemplateDurability; + repairable.Durability = repairable.MaxDurability; + } +} diff --git a/NLog.EFT.Trainer.csproj b/NLog.EFT.Trainer.csproj index 2810a7f0..7f7f50f2 100644 --- a/NLog.EFT.Trainer.csproj +++ b/NLog.EFT.Trainer.csproj @@ -134,6 +134,7 @@ + diff --git a/README.md b/README.md index 424a60c1..7da8015b 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ This is an attempt -for educational purposes only- to alter a Unity game at runt | `AutomaticGun` | `autogun` | Force all guns (even bolt action guns) to use automatic firing mode with customizable fire rate. | | `Commands` | `commands` | Popup window to enable/disable all features (use right-alt or setup your own key in [trainer.ini](#sample-trainerini-configuration-file)). | | `CrossHair` | `crosshair` | Crosshair with customizable size, color, thickness and auto-hide feature when aiming. | +| `Durability` | `durability` | Maintains maximum durability of the player's weapon. | | `Examine` | `examine` | All items already examined. | | `ExfiltrationPoints` | `exfil` | Exfiltration points with customizable colors given eligibility, status filter, distance. | | `FovChanger` | `fovchanger` | Change Field Of View (FOV). | @@ -105,6 +106,7 @@ This trainer hooks into the command system, so you can easily setup features usi | autogun | `on` or `off` | `off` | Enable/Disable automatic gun mode | | crosshair | `on` or `off` | `off` | Show/Hide crosshair | | dump | | | Dump game state for analysis | +| durability | `on` or `off` | `off` | Enable/Disable maximum durability | | examine | `on` or `off` | `off` | Enable/Disable all item examined | | exfil | `on` or `off` | `on` | Show/Hide exfiltration points | | fovchanger | `on` or `off` | `off` | Change FOV value |