Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

.envrc
.idea
# User-specific files
*.rsuser
*.suo
Expand Down
15 changes: 8 additions & 7 deletions Features/CODMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using EFT.HealthSystem;
using UnityEngine;

using AbstractIEffect = EFT.HealthSystem.ActiveHealthController.GClass2429;
using AbstractIEffect = EFT.HealthSystem.ActiveHealthController.GClass2746;

namespace dvize.DadGamerMode.Features
{
Expand All @@ -16,7 +16,7 @@ internal class CODModeComponent : MonoBehaviour
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;

Expand All @@ -36,7 +36,7 @@ private CODModeComponent()
}
internal static void Enable()
{
if (Singleton<IBotGame>.Instantiated)
if (Singleton<GameWorld>.Instantiated)
{
var gameWorld = Singleton<GameWorld>.Instance;
gameWorld.GetOrAddComponent<CODModeComponent>();
Expand All @@ -51,7 +51,7 @@ private void Start()
isRegenerating = false;
timeSinceLastHit = 0f;
newHealRate = 0f;
tmpDmg = new DamageInfo();
tmpDmg = new DamageInfoStruct();
currentHealth = null;
frameCount = 0;

Expand All @@ -74,9 +74,10 @@ private void HealthController_EffectAddedEvent(IEffect effect)
if (dadGamerPlugin.CODModeToggle.Value && !dadGamerPlugin.CODBleedingDamageToggle.Value)
{
//if (Singleton<ActiveHealthController.Class1917>.Instance.method_0(effect as AbstractIEffect))
if (!(effect is GInterface252) && !(effect is GInterface253))
if (!(effect is GInterface296) && !(effect is GInterface297))
{
//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?
Expand Down Expand Up @@ -146,7 +147,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;
Expand Down
2 changes: 1 addition & 1 deletion Features/Energy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private void ActiveHealthController_EnergyChangedEvent(float obj)

public static void Enable()
{
if (Singleton<IBotGame>.Instantiated)
if (Singleton<GameWorld>.Instantiated)
{
var gameWorld = Singleton<GameWorld>.Instance;
gameWorld.GetOrAddComponent<EnergyComponent>();
Expand Down
2 changes: 1 addition & 1 deletion Features/FallingDamage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private void Update()

internal static void Enable()
{
if (Singleton<IBotGame>.Instantiated)
if (Singleton<GameWorld>.Instantiated)
{
var gameWorld = Singleton<GameWorld>.Instance;
gameWorld.GetOrAddComponent<NoFallingDamageComponent>();
Expand Down
2 changes: 1 addition & 1 deletion Features/Hydration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private void ActiveHealthController_HydrationChangedEvent(float obj)

public static void Enable()
{
if (Singleton<IBotGame>.Instantiated)
if (Singleton<GameWorld>.Instantiated)
{
var gameWorld = Singleton<GameWorld>.Instance;
gameWorld.GetOrAddComponent<HydrationComponent>();
Expand Down
2 changes: 1 addition & 1 deletion Features/MagReloadSpeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private void OnToggleReloadUnloadSpeedChanged(object sender, EventArgs e)
}
public static void Enable()
{
if (Singleton<IBotGame>.Instantiated)
if (Singleton<GameWorld>.Instantiated)
{
var gameWorld = Singleton<GameWorld>.Instance;
gameWorld.GetOrAddComponent<MagReloadSpeed>();
Expand Down
2 changes: 1 addition & 1 deletion Features/MaxStamina.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private void Update()

public static void Enable()
{
if (Singleton<IBotGame>.Instantiated)
if (Singleton<GameWorld>.Instantiated)
{
var gameWorld = Singleton<GameWorld>.Instance;
gameWorld.GetOrAddComponent<MaxStaminaComponent>();
Expand Down
12 changes: 7 additions & 5 deletions Patches/ApplyDamage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using dvize.GodModeTest;
using EFT.HealthSystem;
using HarmonyLib;
using EFT;

namespace dvize.DadGamerMode.Patches
{
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions Patches/DestroyBodyPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ 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()
{
return AccessTools.Method(typeof(ActiveHealthController), nameof(ActiveHealthController.DestroyBodyPart));
}

[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
Expand Down
26 changes: 13 additions & 13 deletions Patches/InstantProductionPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ internal class InstantUpdatePatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(GClass1931), nameof(GClass1931.Update));
return AccessTools.Method(typeof(GClass2149), nameof(GClass2149.Update));
}

[PatchPrefix]
private static bool Prefix(GClass1931 __instance, float deltaTime)
private static bool Prefix(GClass2149 __instance, float deltaTime)
{
if (dadGamerPlugin.InstantProductionEnabled.Value)
{
Expand All @@ -28,7 +28,7 @@ private static bool Prefix(GClass1931 __instance, float deltaTime)
}

// Filter itemsToComplete by removing bitcoin farm
List<KeyValuePair<string, GClass1937>> itemsToComplete = new List<KeyValuePair<string, GClass1937>>(__instance.ProducingItems);
List<KeyValuePair<string, GClass2156>> itemsToComplete = new List<KeyValuePair<string, GClass2156>>(__instance.ProducingItems);
itemsToComplete.RemoveAll(x => x.Key == "5d5589c1f934db045e6c5492" || x.Key == "5d5c205bd582a50d042a3c0e"); //bitcoin and fuel?

foreach (var kvp in itemsToComplete)
Expand All @@ -48,18 +48,18 @@ private static bool Prefix(GClass1931 __instance, float deltaTime)
}

// Extension method to handle CompleteProduction
internal static class GClass1933Extensions
internal static class GClass2152Extensions
{
private static readonly FieldInfo Class1666Field;
private static readonly FieldInfo Class1782Field;
private static readonly FieldInfo ProgressField;

static GClass1933Extensions()
static GClass2152Extensions()
{
Class1666Field = AccessTools.Field(typeof(GClass1937), "class1666_0");
ProgressField = AccessTools.Field(typeof(GClass1937.Class1666), "double_1");
Class1782Field = AccessTools.Field(typeof(GClass2156), "class1782_0");
ProgressField = AccessTools.Field(typeof(GClass2156.Class1782), "double_1");
}

public static void CompleteProduction(this GClass1931 __instance, GClass1937 producingItem, ProductionBuildAbstractClass scheme)
public static void CompleteProduction(this GClass2149 __instance, GClass2156 producingItem, ProductionBuildAbstractClass scheme)
{
if (__instance == null || producingItem == null || scheme == null)
{
Expand All @@ -69,15 +69,15 @@ public static void CompleteProduction(this GClass1931 __instance, GClass1937 pro

try
{
var class1666Instance = Class1666Field.GetValue(producingItem);
if (class1666Instance == null)
var class1782Instance = Class1782Field.GetValue(producingItem);
if (class1782Instance == null)
{
dadGamerPlugin.Logger.LogError("CompleteProduction: class1666Instance is null.");
dadGamerPlugin.Logger.LogError("CompleteProduction: class1782Instance is null.");
return;
}

// Set the Progress field to 1.0 (complete)
ProgressField.SetValue(class1666Instance, 1.0);
ProgressField.SetValue(class1782Instance, 1.0);

Item item = __instance.CreateCompleteItem(scheme);
if (item == null)
Expand Down
6 changes: 3 additions & 3 deletions Patches/OnWeightUpdatedPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Slot> slots)
internal static bool Prefix(InventoryEquipment __instance, ref float __result, IEnumerable<Slot> slots)
{

//original functionality
__result = slots.Select(new Func<Slot, Item>(EquipmentClass.Class2102.class2102_0.method_1)).Sum(new Func<Item, float>(__instance.method_11));
__result = slots.Sum(new Func<Slot, float>(InventoryEquipment.Class2246.class2246_0.method_1));

// Get the total weight reduction setting
float totalWeightReduction = dadGamerPlugin.totalWeightReductionPercentage.Value;
Expand Down
2 changes: 1 addition & 1 deletion Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.2.0")]
[assembly: AssemblyFileVersion("1.10.2.0")]
[assembly: TarkovVersion(33420)]