diff --git a/.gitignore b/.gitignore index 44da7a6..f4650ef 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ ## ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +.envrc +.idea # User-specific files *.rsuser *.suo diff --git a/Features/CODMode.cs b/Features/CODMode.cs index 9d33787..a88aae1 100644 --- a/Features/CODMode.cs +++ b/Features/CODMode.cs @@ -5,7 +5,7 @@ using EFT.HealthSystem; using UnityEngine; -using AbstractIEffect = EFT.HealthSystem.ActiveHealthController.GClass2429; +using AbstractIEffect = EFT.HealthSystem.ActiveHealthController.GClass2813; namespace dvize.DadGamerMode.Features { @@ -13,10 +13,11 @@ internal class CODModeComponent : MonoBehaviour { private static Player player; private static ActiveHealthController healthController; + private static ActiveHealthController.Class2112 someClassWithEffectsCheck; private static float timeSinceLastHit = 0f; private static bool isRegenerating = false; private static float newHealRate; - private static DamageInfo tmpDmg; + private static DamageInfoStruct tmpDmg; private static HealthValue currentHealth; private static int frameCount = 0; @@ -36,7 +37,7 @@ private CODModeComponent() } internal static void Enable() { - if (Singleton.Instantiated) + if (Singleton.Instantiated) { var gameWorld = Singleton.Instance; gameWorld.GetOrAddComponent(); @@ -48,10 +49,11 @@ private void Start() { player = Singleton.Instance.MainPlayer; healthController = player.ActiveHealthController; + someClassWithEffectsCheck = new ActiveHealthController.Class2112(); isRegenerating = false; timeSinceLastHit = 0f; newHealRate = 0f; - tmpDmg = new DamageInfo(); + tmpDmg = new DamageInfoStruct(); currentHealth = null; frameCount = 0; @@ -73,10 +75,11 @@ private void HealthController_EffectAddedEvent(IEffect effect) //grabbed this from remove negative effects method if (dadGamerPlugin.CODModeToggle.Value && !dadGamerPlugin.CODBleedingDamageToggle.Value) { - //if (Singleton.Instance.method_0(effect as AbstractIEffect)) - if (!(effect is GInterface252) && !(effect is GInterface253)) + if (someClassWithEffectsCheck.method_1(effect as AbstractIEffect)) + //if (!(effect is GInterface308) && !(effect is GInterface309)) { - //GInterface257is Light Bleeding + //@sugonyak: outdated info below, too lazy to update it, sorry: + //GInterface257 is Light Bleeding //GInterface258 is Heavy Bleeding //GInterface260 is fracture //GInterface274 is pain +15? @@ -146,7 +149,7 @@ private void Disable() } } - private void Player_BeingHitAction(DamageInfo arg1, EBodyPart arg2, float arg3) + private void Player_BeingHitAction(DamageInfoStruct arg1, EBodyPart arg2, float arg3) { //Logger.LogDebug("DadGamerMode: Player_BeingHitAction called"); timeSinceLastHit = 0f; diff --git a/Features/Energy.cs b/Features/Energy.cs index 1baf5a7..3507eb8 100644 --- a/Features/Energy.cs +++ b/Features/Energy.cs @@ -40,7 +40,7 @@ private void ActiveHealthController_EnergyChangedEvent(float obj) public static void Enable() { - if (Singleton.Instantiated) + if (Singleton.Instantiated) { var gameWorld = Singleton.Instance; gameWorld.GetOrAddComponent(); diff --git a/Features/FallingDamage.cs b/Features/FallingDamage.cs index c55470f..c43c9ca 100644 --- a/Features/FallingDamage.cs +++ b/Features/FallingDamage.cs @@ -34,7 +34,7 @@ private void Update() internal static void Enable() { - if (Singleton.Instantiated) + if (Singleton.Instantiated) { var gameWorld = Singleton.Instance; gameWorld.GetOrAddComponent(); diff --git a/Features/Hydration.cs b/Features/Hydration.cs index ccb68e2..a1fe73e 100644 --- a/Features/Hydration.cs +++ b/Features/Hydration.cs @@ -45,7 +45,7 @@ private void ActiveHealthController_HydrationChangedEvent(float obj) public static void Enable() { - if (Singleton.Instantiated) + if (Singleton.Instantiated) { var gameWorld = Singleton.Instance; gameWorld.GetOrAddComponent(); diff --git a/Features/MagReloadSpeed.cs b/Features/MagReloadSpeed.cs index 5b28752..4aa6a03 100644 --- a/Features/MagReloadSpeed.cs +++ b/Features/MagReloadSpeed.cs @@ -57,7 +57,7 @@ private void OnToggleReloadUnloadSpeedChanged(object sender, EventArgs e) } public static void Enable() { - if (Singleton.Instantiated) + if (Singleton.Instantiated) { var gameWorld = Singleton.Instance; gameWorld.GetOrAddComponent(); diff --git a/Features/MaxStamina.cs b/Features/MaxStamina.cs index 1c60d86..4011ec5 100644 --- a/Features/MaxStamina.cs +++ b/Features/MaxStamina.cs @@ -38,7 +38,7 @@ private void Update() public static void Enable() { - if (Singleton.Instantiated) + if (Singleton.Instantiated) { var gameWorld = Singleton.Instance; gameWorld.GetOrAddComponent(); diff --git a/Patches/ApplyDamage.cs b/Patches/ApplyDamage.cs index 46bfb75..be1a477 100644 --- a/Patches/ApplyDamage.cs +++ b/Patches/ApplyDamage.cs @@ -4,6 +4,7 @@ using dvize.GodModeTest; using EFT.HealthSystem; using HarmonyLib; +using EFT; namespace dvize.DadGamerMode.Patches { @@ -18,14 +19,15 @@ protected override MethodBase GetTargetMethod() } [PatchPrefix] - private static bool Prefix(ActiveHealthController __instance, ref float damage, EBodyPart bodyPart, DamageInfo damageInfo) + private static bool Prefix(ActiveHealthController __instance, ref float damage, ref Player ___Player, EBodyPart bodyPart, DamageInfoStruct damageInfo) { try { - if (__instance.Player != null && - __instance.Player.IsYourPlayer) + + if (___Player != null && + ___Player.IsYourPlayer) { - healthController = __instance.Player.ActiveHealthController; + healthController = ___Player.ActiveHealthController; currentHealth = healthController.GetBodyPartHealth(bodyPart, false); //just set damage to 0 and not run apply damage for GodMode @@ -92,7 +94,7 @@ private static bool Prefix(ActiveHealthController __instance, ref float damage, else { //multiply damage by multiplier if a type of player - if (__instance.Player != null) + if (___Player != null) { damage = damage * dadGamerPlugin.enemyDamageMultiplier.Value; } diff --git a/Patches/DestroyBodyPart.cs b/Patches/DestroyBodyPart.cs index 0f22670..772a493 100644 --- a/Patches/DestroyBodyPart.cs +++ b/Patches/DestroyBodyPart.cs @@ -11,7 +11,7 @@ namespace dvize.DadGamerMode.Patches internal class DestroyBodyPartPatch : ModulePatch { private static readonly EBodyPart[] critBodyParts = { EBodyPart.Stomach, EBodyPart.Head, EBodyPart.Chest }; - private static DamageInfo tmpDmg; + private static DamageInfoStruct tmpDmg; private static ActiveHealthController healthController; protected override MethodBase GetTargetMethod() { @@ -19,13 +19,13 @@ protected override MethodBase GetTargetMethod() } [PatchPrefix] - private static bool Prefix(ActiveHealthController __instance, EBodyPart bodyPart, EDamageType damageType) + private static bool Prefix(ActiveHealthController __instance, ref Player ___Player, EBodyPart bodyPart, EDamageType damageType) { try { //only care about your player - if (__instance.Player != null - && __instance.Player.IsYourPlayer) + if (___Player != null + && ___Player.IsYourPlayer) { //if CODMode is enabled and bleeding damage is disabled diff --git a/Patches/InstantProductionPatch.cs b/Patches/InstantProductionPatch.cs index d68773c..b120ce5 100644 --- a/Patches/InstantProductionPatch.cs +++ b/Patches/InstantProductionPatch.cs @@ -14,11 +14,11 @@ internal class InstantUpdatePatch : ModulePatch { protected override MethodBase GetTargetMethod() { - return AccessTools.Method(typeof(GClass1931), nameof(GClass1931.Update)); + return AccessTools.Method(typeof(GClass2193), nameof(GClass2193.Update)); } [PatchPrefix] - private static bool Prefix(GClass1931 __instance, float deltaTime) + private static bool Prefix(GClass2193 __instance, float deltaTime) { if (dadGamerPlugin.InstantProductionEnabled.Value) { @@ -28,7 +28,7 @@ private static bool Prefix(GClass1931 __instance, float deltaTime) } // Filter itemsToComplete by removing bitcoin farm - List> itemsToComplete = new List>(__instance.ProducingItems); + List> itemsToComplete = new List>(__instance.ProducingItems); itemsToComplete.RemoveAll(x => x.Key == "5d5589c1f934db045e6c5492" || x.Key == "5d5c205bd582a50d042a3c0e"); //bitcoin and fuel? foreach (var kvp in itemsToComplete) @@ -48,18 +48,18 @@ private static bool Prefix(GClass1931 __instance, float deltaTime) } // Extension method to handle CompleteProduction - internal static class GClass1933Extensions + internal static class GClass2196Extensions { - private static readonly FieldInfo Class1666Field; + private static readonly FieldInfo Class1821Field; private static readonly FieldInfo ProgressField; - static GClass1933Extensions() + static GClass2196Extensions() { - Class1666Field = AccessTools.Field(typeof(GClass1937), "class1666_0"); - ProgressField = AccessTools.Field(typeof(GClass1937.Class1666), "double_1"); + Class1821Field = AccessTools.Field(typeof(GClass2200), "class1821_0"); + ProgressField = AccessTools.Field(typeof(GClass2200.Class1821), "double_1"); } - public static void CompleteProduction(this GClass1931 __instance, GClass1937 producingItem, ProductionBuildAbstractClass scheme) + public static void CompleteProduction(this GClass2193 __instance, GClass2200 producingItem, ProductionBuildAbstractClass scheme) { if (__instance == null || producingItem == null || scheme == null) { @@ -69,15 +69,15 @@ public static void CompleteProduction(this GClass1931 __instance, GClass1937 pro try { - var class1666Instance = Class1666Field.GetValue(producingItem); - if (class1666Instance == null) + var class1821Instance = Class1821Field.GetValue(producingItem); + if (class1821Instance == null) { - dadGamerPlugin.Logger.LogError("CompleteProduction: class1666Instance is null."); + dadGamerPlugin.Logger.LogError("CompleteProduction: class1821Instance is null."); return; } // Set the Progress field to 1.0 (complete) - ProgressField.SetValue(class1666Instance, 1.0); + ProgressField.SetValue(class1821Instance, 1.0); Item item = __instance.CreateCompleteItem(scheme); if (item == null) diff --git a/Patches/OnWeightUpdatedPatch.cs b/Patches/OnWeightUpdatedPatch.cs index 317e4cd..d66dc9a 100644 --- a/Patches/OnWeightUpdatedPatch.cs +++ b/Patches/OnWeightUpdatedPatch.cs @@ -19,15 +19,15 @@ internal class OnWeightUpdatedPatch : ModulePatch protected override MethodBase GetTargetMethod() { - return AccessTools.Method(typeof(EquipmentClass), nameof(EquipmentClass.method_10)); + return AccessTools.Method(typeof(InventoryEquipment), nameof(InventoryEquipment.smethod_1)); } [PatchPrefix] - internal static bool Prefix(EquipmentClass __instance, ref float __result, IEnumerable slots) + internal static bool Prefix(InventoryEquipment __instance, ref float __result, IEnumerable slots) { //original functionality - __result = slots.Select(new Func(EquipmentClass.Class2102.class2102_0.method_1)).Sum(new Func(__instance.method_11)); + __result = slots.Sum(new Func(InventoryEquipment.Class2294.class2294_0.method_1)); // Get the total weight reduction setting float totalWeightReduction = dadGamerPlugin.totalWeightReductionPercentage.Value; diff --git a/Plugin.cs b/Plugin.cs index ec7adac..fffba35 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -9,7 +9,7 @@ namespace dvize.GodModeTest { - [BepInPlugin("com.dvize.DadGamerMode", "dvize.DadGamerMode", "1.9.3")] + [BepInPlugin("com.dvize.DadGamerMode", "dvize.DadGamerMode", "1.10.2")] //[BepInDependency("com.SPT.core", "3.8.0")] public class dadGamerPlugin : BaseUnityPlugin { diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index ab4a285..dcae5db 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.9.3.0")] -[assembly: AssemblyFileVersion("1.9.3.0")] -[assembly: TarkovVersion(30626)] +[assembly: AssemblyVersion("1.11.0.0")] +[assembly: AssemblyFileVersion("1.11.0.0")] +[assembly: TarkovVersion(35392)]