Decompiled source of Forget Them Feet v1.1.2

Mods/BBS_ForgetThemFeet.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BBS_ForgetThemFeet;
using Il2Cpp;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "BBS_ForgetThemFeet", "1.1.2", "Caleb Orchard", null)]
[assembly: MelonGame("DefaultCompany", "BabySteps")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BBS_ForgetThemFeet")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+256cd9ef49b0a20102200d9a4c27bd3de8c1b8a8")]
[assembly: AssemblyProduct("BBS_ForgetThemFeet")]
[assembly: AssemblyTitle("BBS_ForgetThemFeet")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BBS_ForgetThemFeet
{
	public class Core : MelonMod
	{
		private PlayerMovement pm;

		private bool hasHiddenFeet = false;

		private float nextWarningTime = 0f;

		private MelonPreferences_Category cfg;

		private MelonPreferences_Entry<float> colorR;

		private MelonPreferences_Entry<float> colorG;

		private MelonPreferences_Entry<float> colorB;

		private MelonPreferences_Entry<float> scaleMultiplier;

		public override void OnInitializeMelon()
		{
			cfg = MelonPreferences.CreateCategory("ForgetThemFeet");
			colorR = cfg.CreateEntry<float>("MudColor_R", 0.537f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			colorG = cfg.CreateEntry<float>("MudColor_G", 0.318f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			colorB = cfg.CreateEntry<float>("MudColor_B", 0.161f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			scaleMultiplier = cfg.CreateEntry<float>("ScaleMultiplier", 1.05f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			cfg.SaveToFile(true);
		}

		public override void OnUpdate()
		{
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			if (hasHiddenFeet)
			{
				return;
			}
			try
			{
				if ((Object)(object)pm == (Object)null || (Object)(object)((Component)pm).gameObject == (Object)null)
				{
					GameObject val = GameObject.Find("Dudest");
					if ((Object)(object)val == (Object)null)
					{
						return;
					}
					pm = val.GetComponent<PlayerMovement>();
				}
				if ((Object)(object)pm == (Object)null || (Object)(object)((Component)pm).gameObject == (Object)null || pm.feet == null || ((Il2CppArrayBase<FootData>)(object)pm.feet).Count == 0)
				{
					return;
				}
				Color color = default(Color);
				((Color)(ref color))..ctor(colorR.Value, colorG.Value, colorB.Value);
				float value = scaleMultiplier.Value;
				bool flag = false;
				for (int i = 0; i < ((Il2CppArrayBase<FootData>)(object)pm.feet).Count; i++)
				{
					FootData val2 = ((Il2CppArrayBase<FootData>)(object)pm.feet)[i];
					if (val2 == null)
					{
						continue;
					}
					BoxCollider coll = val2.coll;
					Transform val3 = ((coll != null) ? ((Component)coll).transform : null);
					if ((Object)(object)val3 == (Object)null)
					{
						continue;
					}
					Transform parent = val3.parent;
					if ((Object)(object)parent == (Object)null)
					{
						continue;
					}
					Transform val4 = null;
					for (int j = 0; j < parent.childCount; j++)
					{
						Transform child = parent.GetChild(j);
						if ((Object)(object)child != (Object)null && ((Object)child).name.Contains("_mudMesh"))
						{
							val4 = child;
							break;
						}
					}
					if (!((Object)(object)val4 == (Object)null))
					{
						((Component)val4).gameObject.layer = 0;
						MeshRenderer component = ((Component)val4).GetComponent<MeshRenderer>();
						if ((Object)(object)component != (Object)null)
						{
							((Renderer)component).material.color = color;
						}
						Transform obj = val4;
						obj.localScale *= value;
						flag = true;
					}
				}
				if (flag)
				{
					hasHiddenFeet = true;
				}
			}
			catch (Exception ex)
			{
				pm = null;
				if (Time.unscaledTime >= nextWarningTime)
				{
					MelonLogger.Warning("ForgetThemFeet retrying after transient setup error: " + ex.Message);
					nextWarningTime = Time.unscaledTime + 2f;
				}
			}
		}
	}
}