Decompiled source of Silksong Reduce Motion v0.3.0

reduced_motion_accessibility.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("reduced_motion_accessibility")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.3.0.0")]
[assembly: AssemblyInformationalVersion("0.3.0+f09a950a28a080ca28cbf29a52cb92b167461f95")]
[assembly: AssemblyProduct("Reduced Motion (Accessibility).")]
[assembly: AssemblyTitle("reduced_motion_accessibility")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.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 reduced_motion_accessibility
{
	[BepInPlugin("com.bigfootmech.silksong.reduced_motion_accessibility", "Reduced Motion (Accessibility).", "0.3.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(MenuStyles), "Start")]
		public class MenuParticleKill
		{
			[HarmonyPostfix]
			private static void Postfix(MenuStyles __instance)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Expected O, but got Unknown
				foreach (Transform item in ((Component)__instance).transform.Find("Hornet_Style"))
				{
					Transform val = item;
					if (((Object)val).name.StartsWith("lava_particles"))
					{
						((Component)val).gameObject.SetActive(false);
					}
				}
			}
		}

		[HarmonyPatch(typeof(InventoryCursor), "Awake")]
		public class InventoryCursorPreventJitter
		{
			[HarmonyPostfix]
			private static void Postfix(InventoryCursor __instance, ref Transform ___topLeft, ref Transform ___topRight, ref Transform ___bottomLeft, ref Transform ___bottomRight)
			{
				DisableAnimatorIfAvailable(___topLeft);
				DisableAnimatorIfAvailable(___topRight);
				DisableAnimatorIfAvailable(___bottomLeft);
				DisableAnimatorIfAvailable(___bottomRight);
			}

			private static void DisableAnimatorIfAvailable(Transform topLeft)
			{
				if ((Object)(object)topLeft == (Object)null)
				{
					return;
				}
				Transform child = topLeft.GetChild(0);
				if (!((Object)(object)child == (Object)null))
				{
					Animator component = ((Component)child).GetComponent<Animator>();
					if (!((Object)(object)component == (Object)null))
					{
						component.speed = 0f;
					}
				}
			}
		}

		[HarmonyPatch(typeof(InvMarker), "Awake")]
		public class MapMarkersStopFlash
		{
			[HarmonyPostfix]
			private static void Postfix(InvMarker __instance)
			{
				Transform parent = ((Component)__instance).transform.parent;
				Transform val = GrabExistingMarkerStartingAtPlayerOwnedPin(parent);
				SpriteRenderer component = ((Component)parent).GetComponent<SpriteRenderer>();
				SpriteRenderer component2 = ((Component)val).GetComponent<SpriteRenderer>();
				((Renderer)component).material = ((Renderer)component2).material;
			}

			private static Transform GrabExistingMarkerStartingAtPlayerOwnedPin(Transform markerCloneTfm)
			{
				return TryGetMarkerChild(markerCloneTfm.parent.parent.Find("Main Quest Pins"));
			}

			private static Transform TryGetMarkerChild(Transform questPinContainer)
			{
				Transform val = questPinContainer.Find("Quest_Pin_Citadel_Seeker");
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
				return questPinContainer.GetChild(0);
			}
		}

		private const string modGUID = "com.bigfootmech.silksong.reduced_motion_accessibility";

		internal static ManualLogSource Logger;

		private readonly Harmony harmony = new Harmony("com.bigfootmech.silksong.reduced_motion_accessibility");

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin com.bigfootmech.silksong.reduced_motion_accessibility is loaded!");
			harmony.PatchAll();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "reduced_motion_accessibility";

		public const string PLUGIN_NAME = "Reduced Motion (Accessibility).";

		public const string PLUGIN_VERSION = "0.3.0";
	}
}