mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
Start of adding missing stats
This commit is contained in:
parent
065c446e83
commit
37ae603982
39
project/Aki.Debugging/Patches/Stats/AmmoUsedPatch.cs
Normal file
39
project/Aki.Debugging/Patches/Stats/AmmoUsedPatch.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using EFT.HealthSystem;
|
||||
using EFT;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using EFT.InventoryLogic;
|
||||
using Comfort.Common;
|
||||
using EFT.UI;
|
||||
using EFT.Ballistics;
|
||||
using static EFT.Player.FirearmController;
|
||||
|
||||
|
||||
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, GClass2200.AmmoUsed);
|
||||
}
|
||||
}
|
||||
}
|
34
project/Aki.Debugging/Patches/Stats/ArmorDamagePatch.cs
Normal file
34
project/Aki.Debugging/Patches/Stats/ArmorDamagePatch.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using EFT;
|
||||
using EFT.InventoryLogic;
|
||||
using EFT.UI;
|
||||
using HarmonyLib;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Aki.Debugging.Patches.Stats
|
||||
{
|
||||
public class ArmorDamagePatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return AccessTools.Method(typeof(Player), nameof(Player.ApplyDamageInfo));
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
private static void PatchPostfix(DamageInfo damageInfo)
|
||||
{
|
||||
if (!damageInfo.Player.iPlayer.IsYourPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (damageInfo.Weapon is Weapon weapon && weapon.Chambers[0].ContainedItem is BulletClass bullet)
|
||||
{
|
||||
float newDamage = (float)Math.Round(bullet.Damage - damageInfo.Damage);
|
||||
damageInfo.Player.iPlayer.Profile.EftStats.SessionCounters.AddFloat(newDamage, GClass2200.CauseArmorDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user