Skip to content

Commit

Permalink
Add maximum durability feature
Browse files Browse the repository at this point in the history
  • Loading branch information
sailro committed Apr 20, 2024
1 parent 887efe9 commit 0c2807d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Features/Durability.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
1 change: 1 addition & 0 deletions NLog.EFT.Trainer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
<Compile Include="Features\Ammunition.cs" />
<Compile Include="Features\BaseMapToggleFeature.cs" />
<Compile Include="Features\FovChanger.cs" />
<Compile Include="Features\Durability.cs" />
<Compile Include="Features\NoMalfunctions.cs" />
<Compile Include="Features\AutomaticGun.cs" />
<Compile Include="Features\Bones.cs" />
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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). |
Expand Down Expand Up @@ -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 |
Expand Down

0 comments on commit 0c2807d

Please sign in to comment.