Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add maximum durability feature #486

Merged
merged 1 commit into from
Apr 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -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" />
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 |