Decompiled source of SlipperyPlatforms v1.0.0

SlipperyPlatforms.dll

Decompiled 7 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BoplFixedMath;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SlipperyPlatforms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SlipperyPlatforms")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("72ce84ef-458a-4e65-b3ec-d600a77cdde2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SlipperyPlatforms;

[BepInPlugin("com.000diggity000.SlipperyPlatforms", "Slippery Platforms", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	internal static ConfigFile config = new ConfigFile(Path.Combine(Paths.ConfigPath, "SlipperyPlatformsConfig.cfg"), true);

	internal static ConfigEntry<float> IntensityConfig;

	private void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Slippery Platforms Loaded");
		Harmony val = new Harmony("com.000diggity000.SlipperyPlatforms");
		val.PatchAll(typeof(Patches));
		IntensityConfig = config.Bind<float>("SlipperyPlatforms", "Intensity", 8f, "Minimum is 0 and the maximum is 10");
		if (IntensityConfig.Value < 0f)
		{
			IntensityConfig.Value = 0f;
		}
		if (IntensityConfig.Value > 10f)
		{
			IntensityConfig.Value = 10f;
		}
	}
}
public class Patches
{
	[HarmonyPatch(typeof(PlayerPhysics), "Awake")]
	[HarmonyPrefix]
	public static void PatchMove(PlayerPhysics __instance, ref Fix ___PlatformSlipperyness01, ref Fix ___IcePlatformSlipperyness01)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		float value = Plugin.IntensityConfig.Value;
		value *= 0.05f;
		value += 0.5f;
		if (Plugin.IntensityConfig.Value == 0f)
		{
			___PlatformSlipperyness01 = (Fix)0.5f;
			___IcePlatformSlipperyness01 = (Fix)0.5f;
		}
		else if (Plugin.IntensityConfig.Value == 10f)
		{
			___PlatformSlipperyness01 = (Fix)1f;
			___IcePlatformSlipperyness01 = (Fix)1f;
		}
		else
		{
			___PlatformSlipperyness01 = (Fix)value;
			___IcePlatformSlipperyness01 = (Fix)value;
		}
	}
}