using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LC_Enhanced_Movements.Patchers;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LC Enhanced Movements")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC Enhanced Movements")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("88de18e6-72cf-4b23-9e59-0611b36dbeb5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LC_Enhanced_Movements
{
[BepInPlugin("Studio_A.LC_Enhanced_MovementsBase", "LC Enhanced", "1.0.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class LC_Enhanced_MovementsBase : BaseUnityPlugin
{
private const string modGUID = "Studio_A.LC_Enhanced_MovementsBase";
private const string modName = "LC Enhanced";
private const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("Studio_A.LC_Enhanced_MovementsBase");
public static ConfigEntry<bool> useInsanity;
public static ConfigEntry<bool> canRegenerate;
public static ConfigEntry<bool> useResistance;
public static ConfigEntry<bool> canRegenerateWhilstMoving;
public static ConfigEntry<bool> canRegenerateWhilstSprinting;
public static ConfigEntry<float> speedInsanityMultiplier;
public static ConfigEntry<int> regenerateAmount;
public static ConfigEntry<int> regenerateSpeed;
public static ConfigEntry<int> maxResistance;
public static ConfigEntry<int> resistanceAmount;
private static LC_Enhanced_MovementsBase Instance;
public static ManualLogSource mls;
private void Awake()
{
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Expected O, but got Unknown
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Expected O, but got Unknown
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Expected O, but got Unknown
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Expected O, but got Unknown
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Expected O, but got Unknown
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0306: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_031c: Unknown result type (might be due to invalid IL or missing references)
//IL_0327: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Expected O, but got Unknown
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Expected O, but got Unknown
//IL_0342: Expected O, but got Unknown
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_035f: Unknown result type (might be due to invalid IL or missing references)
//IL_036a: Unknown result type (might be due to invalid IL or missing references)
//IL_0375: Unknown result type (might be due to invalid IL or missing references)
//IL_037c: Expected O, but got Unknown
//IL_037c: Unknown result type (might be due to invalid IL or missing references)
//IL_0383: Expected O, but got Unknown
//IL_0388: Expected O, but got Unknown
//IL_0383: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_0393: Unknown result type (might be due to invalid IL or missing references)
//IL_039a: Unknown result type (might be due to invalid IL or missing references)
//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Expected O, but got Unknown
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Expected O, but got Unknown
//IL_03d3: Expected O, but got Unknown
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
//IL_03de: Unknown result type (might be due to invalid IL or missing references)
//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0406: Unknown result type (might be due to invalid IL or missing references)
//IL_040e: Expected O, but got Unknown
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_0419: Expected O, but got Unknown
//IL_041e: Expected O, but got Unknown
//IL_0419: Unknown result type (might be due to invalid IL or missing references)
//IL_0424: Unknown result type (might be due to invalid IL or missing references)
//IL_0429: Unknown result type (might be due to invalid IL or missing references)
//IL_0430: Unknown result type (might be due to invalid IL or missing references)
//IL_043b: Unknown result type (might be due to invalid IL or missing references)
//IL_0446: Unknown result type (might be due to invalid IL or missing references)
//IL_0451: Unknown result type (might be due to invalid IL or missing references)
//IL_0458: Expected O, but got Unknown
//IL_0458: Unknown result type (might be due to invalid IL or missing references)
//IL_0460: Expected O, but got Unknown
//IL_0465: Expected O, but got Unknown
//IL_0460: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Studio_A.LC_Enhanced_MovementsBase");
mls.LogInfo((object)"LC Enhanced is awaken");
mls.LogInfo((object)"Patching Mod.base...");
harmony.PatchAll(typeof(LC_Enhanced_MovementsBase));
mls.LogInfo((object)"Mod.base has been patched!");
mls.LogInfo((object)"Patching Mod.PlayerControllerBPatch");
harmony.PatchAll(typeof(PlayerControllerBPatch));
mls.LogInfo((object)"Mod.PlayerControllerBPatch has been patched!");
useInsanity = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "useInsanity", true, "If insanity will enhance sprinting/moving");
canRegenerate = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "canRegenerate", true, "If the player can regenerate health");
useResistance = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "useResistance", true, "If the player can grow resistance over time (only if [canRegenerate]");
canRegenerateWhilstMoving = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement", "canRegenerateWhilstMoving", true, "If the player can regenerate while moving");
canRegenerateWhilstSprinting = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement", "canRegenerateWhilstSprinting", false, "If the player can regenerate while sprinting");
speedInsanityMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Movement", "speedInsanityMultiplier", 1.5f, "The amount of extra speed the player gets (if 1, nothing will change)");
regenerateAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Health", "regenerateAmount", 2, "The amount of health you regenerate over time");
regenerateSpeed = ((BaseUnityPlugin)this).Config.Bind<int>("Health", "regenerateSpeed", 120, "The amount of update/frame calls it has to wait before regenerating");
maxResistance = ((BaseUnityPlugin)this).Config.Bind<int>("Health", "maxResistance", 50, "The max amount of extra health");
resistanceAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Health", "resistanceAmount", 1, "The amount of extra health you get over time");
new BoolCheckBoxConfigItem(useInsanity, new BoolCheckBoxOptions
{
RequiresRestart = false,
Section = "General",
Name = "Use Insanity",
Description = "When enabled, insanity changes the amount of speed you get"
});
new BoolCheckBoxConfigItem(canRegenerate, new BoolCheckBoxOptions
{
RequiresRestart = false,
Section = "General",
Name = "Regenerate health",
Description = "If the player can regenerate health"
});
new BoolCheckBoxConfigItem(useResistance, new BoolCheckBoxOptions
{
RequiresRestart = false,
Section = "General",
Name = "Grow Resistance",
Description = "If the player can grow resistance over time (only if canRegenerate)"
});
new BoolCheckBoxConfigItem(canRegenerateWhilstMoving, new BoolCheckBoxOptions
{
RequiresRestart = false,
Section = "Movement",
Name = "Regenerate Whilst Moving",
Description = "If the player can regenerate while moving"
});
new BoolCheckBoxConfigItem(canRegenerateWhilstSprinting, new BoolCheckBoxOptions
{
RequiresRestart = false,
Section = "Movement",
Name = "Regenerate Whilst Sprinting",
Description = "If the player can regenerate while sprinting"
});
ConfigEntry<float> obj = speedInsanityMultiplier;
FloatSliderOptions val = new FloatSliderOptions
{
RequiresRestart = false,
Section = "Movement",
Name = "Speed Multiplier",
Description = "Change the amount of speed you get with Insanity"
};
((BaseRangeOptions<float>)val).Min = 1f;
((BaseRangeOptions<float>)val).Max = 100f;
new FloatSliderConfigItem(obj, val);
ConfigEntry<int> obj2 = regenerateAmount;
IntSliderOptions val2 = new IntSliderOptions
{
RequiresRestart = false,
Section = "Health",
Name = "Regenerate Amount",
Description = "How much the health player will regenerate"
};
((BaseRangeOptions<int>)val2).Min = 1;
((BaseRangeOptions<int>)val2).Max = 5;
new IntSliderConfigItem(obj2, val2);
ConfigEntry<int> obj3 = regenerateSpeed;
IntSliderOptions val3 = new IntSliderOptions
{
RequiresRestart = false,
Section = "Health",
Name = "Regenerate Speed",
Description = "The number of update/frame calls before regenerating"
};
((BaseRangeOptions<int>)val3).Min = 60;
((BaseRangeOptions<int>)val3).Max = 420;
new IntSliderConfigItem(obj3, val3);
ConfigEntry<int> obj4 = maxResistance;
IntSliderOptions val4 = new IntSliderOptions
{
RequiresRestart = false,
Section = "Health",
Name = "Max Resistance",
Description = "The maximum amount of extra health"
};
((BaseRangeOptions<int>)val4).Min = 10;
((BaseRangeOptions<int>)val4).Max = 250;
new IntSliderConfigItem(obj4, val4);
ConfigEntry<int> obj5 = resistanceAmount;
IntSliderOptions val5 = new IntSliderOptions
{
RequiresRestart = false,
Section = "Health",
Name = "Resistance Amount",
Description = "The amount of extra health gained over time"
};
((BaseRangeOptions<int>)val5).Min = 1;
((BaseRangeOptions<int>)val5).Max = 25;
new IntSliderConfigItem(obj5, val5);
mls.LogInfo((object)"Mod.version: 1.0.0.0");
mls.LogWarning((object)"Copyright, Studio A productions, you have been granted the right to use the mod 'LC Enhanced', but not modify it.");
}
}
}
namespace LC_Enhanced_Movements.Patchers
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
internal static int timepassed;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void clientPatch(ref float ___sprintMeter, ref float ___sprintMultiplier, ref float ___insanityLevel, ref float ___maxInsanityLevel, ref bool ___isSprinting, ref float ___sprintTime, ref float ___movementSpeed, ref float ___healthRegenerateTimer, ref int ___health, ref bool ___isWalking)
{
if (___isSprinting)
{
if (LC_Enhanced_MovementsBase.useInsanity.Value)
{
___movementSpeed = 5f + ___insanityLevel * LC_Enhanced_MovementsBase.speedInsanityMultiplier.Value / ___maxInsanityLevel;
}
timepassed = 0;
}
if ((!___isSprinting || !LC_Enhanced_MovementsBase.canRegenerateWhilstSprinting.Value) && (!___isWalking || !LC_Enhanced_MovementsBase.canRegenerateWhilstMoving.Value) && (___isWalking || ___isSprinting))
{
return;
}
if (timepassed == LC_Enhanced_MovementsBase.regenerateSpeed.Value)
{
timepassed = 0;
if (___health < 100)
{
___health += LC_Enhanced_MovementsBase.regenerateAmount.Value;
}
else if (LC_Enhanced_MovementsBase.useResistance.Value)
{
if (___health > LC_Enhanced_MovementsBase.maxResistance.Value)
{
___health += LC_Enhanced_MovementsBase.resistanceAmount.Value;
if (___health > LC_Enhanced_MovementsBase.maxResistance.Value)
{
___health = LC_Enhanced_MovementsBase.maxResistance.Value;
}
}
}
else
{
___health = 100;
}
}
else
{
timepassed++;
}
}
}
}