2024-03-21 11:04:53 +00:00
|
|
|
|
using Aki.Reflection.Patching;
|
|
|
|
|
using EFT;
|
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using Comfort.Common;
|
|
|
|
|
|
2024-03-21 15:21:57 +00:00
|
|
|
|
namespace Aki.SinglePlayer.Patches.MainMenu
|
2024-03-21 11:04:53 +00:00
|
|
|
|
{
|
2024-03-21 15:21:57 +00:00
|
|
|
|
public class AmmoUsedCounterPatch : ModulePatch
|
2024-03-21 11:04:53 +00:00
|
|
|
|
{
|
|
|
|
|
private static Player player;
|
|
|
|
|
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
|
|
|
|
return AccessTools.Method(typeof(GameWorld), nameof(GameWorld.OnGameStarted));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPostfix]
|
|
|
|
|
private static void PatchPostfix()
|
|
|
|
|
{
|
|
|
|
|
player = Singleton<GameWorld>.Instance.MainPlayer;
|
|
|
|
|
var firearmsController = player.HandsController as Player.FirearmController;
|
|
|
|
|
firearmsController.OnShot += Hook;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void Hook()
|
|
|
|
|
{
|
2024-03-21 11:09:00 +00:00
|
|
|
|
player.Profile.EftStats.SessionCounters.AddLong(1L, SessionCounterTypesAbstractClass.AmmoUsed);
|
2024-03-21 11:04:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|