Decompiled source of Oops All Size2 v2.0.0

oopsallsize2.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;
using UnityEngine.AI;

[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("oopsallsize2")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("oopsallsize2")]
[assembly: AssemblyTitle("oopsallsize2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace OopsAllSize2
{
	[BepInPlugin("com.yourname.oopsallsize2", "Oops All Size 2", "1.1.0")]
	public class MainPlugin : BaseUnityPlugin
	{
		public static ManualLogSource ModLogger;

		public static FloatField? sizeField;

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			ModLogger = ((BaseUnityPlugin)this).Logger;
			ModLogger.LogInfo((object)"OopsAllSize2 loaded with Plugin Configurator support!");
			SetupConfigUI();
			Harmony val = new Harmony("com.yourname.oopsallsize2");
			val.PatchAll();
		}

		private void SetupConfigUI()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			PluginConfigurator val = PluginConfigurator.Create("Oops All Size 2", "com.yourname.oopsallsize2");
			sizeField = new FloatField(val.rootPanel, "Enemy Size Multiplier", "SizeMultiplier", 2f, 0.1f, 100f);
		}
	}
	[HarmonyPatch(typeof(EnemyIdentifier), "Start")]
	public static class EnemySpawnPatch
	{
		private static void Postfix(EnemyIdentifier __instance)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance == (Object)null))
			{
				string text = ((Object)((Component)__instance).gameObject).name.ToLower();
				bool flag = text.Contains("spider") || text.Contains("malicious");
				float num = 2f;
				if (MainPlugin.sizeField != null)
				{
					num = MainPlugin.sizeField.value;
				}
				float num2 = (flag ? (num * 1.5f) : num);
				Transform transform = ((Component)__instance).transform;
				transform.localScale *= num2;
				Animator componentInChildren = ((Component)__instance).GetComponentInChildren<Animator>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					componentInChildren.speed *= num2;
				}
				NavMeshAgent component = ((Component)__instance).GetComponent<NavMeshAgent>();
				if ((Object)(object)component != (Object)null)
				{
					component.speed *= num2;
					component.acceleration *= num2;
				}
			}
		}
	}
	[HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")]
	public static class EnemyTankPatch
	{
		private static void Prefix(EnemyIdentifier __instance, ref float multiplier)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				string text = ((Object)((Component)__instance).gameObject).name.ToLower();
				bool flag = text.Contains("spider") || text.Contains("malicious");
				float num = 2f;
				if (MainPlugin.sizeField != null)
				{
					num = MainPlugin.sizeField.value;
				}
				float num2 = (flag ? (num * 1.5f) : num);
				if (num2 > 0f)
				{
					multiplier /= num2;
				}
			}
		}
	}
}