diff --git a/Features/Durability.cs b/Features/Durability.cs index bf43f3f8..9dbbe726 100644 --- a/Features/Durability.cs +++ b/Features/Durability.cs @@ -1,4 +1,6 @@ -using EFT.Trainer.Extensions; +using System.Linq; +using EFT.InventoryLogic; +using EFT.Trainer.Extensions; using JetBrains.Annotations; #nullable enable @@ -9,7 +11,7 @@ namespace EFT.Trainer.Features; internal class Durability : ToggleFeature { public override string Name => "durability"; - public override string Description => "Maintains maximum durability of the player's weapon."; + public override string Description => "Maximum durability of items."; public override bool Enabled { get; set; } = false; @@ -19,13 +21,19 @@ protected override void UpdateWhenEnabled() if (!player.IsValid()) return; - if (player.HandsController is not Player.FirearmController controller) - return; + var allPlayerItems = player.Profile + .Inventory + .GetPlayerItems() + .ToArray(); - if (controller.Item?.Repairable is not {} repairable) - return; + foreach (var item in allPlayerItems) + { + var repairable = item?.GetItemComponent(); + if (repairable == null) + continue; - repairable.MaxDurability = repairable.TemplateDurability; - repairable.Durability = repairable.MaxDurability; + repairable.MaxDurability = repairable.TemplateDurability; + repairable.Durability = repairable.MaxDurability; + } } } diff --git a/README.md b/README.md index 7da8015b..f4c9cc7d 100644 --- a/README.md +++ b/README.md @@ -26,7 +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. | +| `Durability` | `durability` | Maximum durability of items. | | `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). |