Decompiled source of InfiniteCogflies v1.0.1

InfiniteCogflies.dll

Decompiled 2 months 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.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("InfiniteCogflies")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("InfiniteCogflies")]
[assembly: AssemblyTitle("InfiniteCogflies")]
[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 Silksong
{
	[BepInPlugin("com.fabbeyond.infinitecogflies", "InfiniteCogflies", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(ToolItemLimiter))]
		[HarmonyPatch("Break")]
		private class Patch_ToolItemLimiter
		{
			private static bool Prefix()
			{
				return false;
			}
		}

		public static Plugin instance;

		private ConfigEntry<bool> instantAttack;

		private void Start()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			instantAttack = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "instantAttack", false, (ConfigDescription)null);
			instance = this;
			Harmony val = new Harmony("com.fabbeyond.infinitecoglies");
			val.PatchAll();
		}

		private void Update()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)HeroController.instance != (Object)null)
			{
				Data toolData = PlayerData.instance.GetToolData("Cogwork Flier");
				toolData.AmountLeft = 8;
				PlayerData.instance.SetToolData("Cogwork Flier", toolData);
			}
			GameObject[] array = GameObject.FindGameObjectsWithTag("Knight Hatchling");
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				Scene scene = val.scene;
				if (((Scene)(ref scene)).name != "DontDestroyOnLoad")
				{
					Object.DontDestroyOnLoad((Object)(object)val);
				}
				if (instantAttack.Value)
				{
					ClockworkHatchling component = val.GetComponent<ClockworkHatchling>();
					FieldInfo field = typeof(ClockworkHatchling).GetField("cooldownTimer", BindingFlags.Instance | BindingFlags.NonPublic);
					field.SetValue(component, -1);
				}
			}
		}
	}
}