Decompiled source of OtisShrinkCurserecreation v1.0.0

OtisShrinkOverride.dll

Decompiled 5 hours 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 HarmonyLib;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("otisshrinkoverride")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("otisshrinkoverride")]
[assembly: AssemblyTitle("otisshrinkoverride")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 OtisGrowOverride
{
	[BepInPlugin("com.yourname.otisgrowoverride", "Otis Grow Override", "1.0.0")]
	public class GrowOverride : BaseUnityPlugin
	{
		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)"Otis Grow Override loaded");
			Harmony val = new Harmony("com.yourname.otisgrowoverride");
			val.PatchAll();
		}
	}
	[HarmonyPatch]
	public static class Patch_OtisCurse_Awake_Grow
	{
		private static Type TargetType()
		{
			return AccessTools.TypeByName("OtisCurse");
		}

		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(TargetType(), "Awake", (Type[])null, (Type[])null);
		}

		private static void Postfix(object __instance)
		{
			Type type = __instance.GetType();
			AccessTools.Field(type, "targetScale")?.SetValue(__instance, 0.2f);
			AccessTools.Field(type, "shrinkDuration")?.SetValue(__instance, 60f);
			AccessTools.Field(type, "shrinkTransitionTime")?.SetValue(__instance, 60f);
			AccessTools.Field(type, "targetSpeed")?.SetValue(__instance, 9f);
			AccessTools.Field(type, "targetJump")?.SetValue(__instance, 22f);
			AccessTools.Field(type, "targetPitch")?.SetValue(__instance, 2f);
			Debug.Log((object)"[OtisGrowOverride] Custom growth values applied via reflection in Awake()");
		}
	}
	[HarmonyPatch]
	public static class Patch_CurseResetPatch_NoReset_Grow
	{
		private static Type TargetType()
		{
			return AccessTools.TypeByName("LethalOtisMod.CurseResetPatch");
		}

		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(TargetType(), "ResetAllCurses", (Type[])null, (Type[])null);
		}

		private static bool Prefix()
		{
			Debug.Log((object)"[OtisGrowOverride] Blocked CurseResetPatch.ResetAllCurses — growth remains permanent.");
			return false;
		}
	}
}