mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
35 lines
938 B
C#
35 lines
938 B
C#
using Aki.Reflection.Patching;
|
|
using EFT.HealthSystem;
|
|
using EFT;
|
|
using HarmonyLib;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
using Comfort.Common;
|
|
|
|
namespace Aki.Debugging.Patches.Stats
|
|
{
|
|
public class AmmoUsedPatch : ModulePatch
|
|
{
|
|
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()
|
|
{
|
|
player.Profile.EftStats.SessionCounters.AddLong(1L, SessionCounterTypesAbstractClass.AmmoUsed);
|
|
}
|
|
}
|
|
}
|