Decompiled source of Split v1.0.5

Split.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using PluginConfig.API;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using Split.C2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Split")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Split")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3c90fb7d-7a4e-45b8-984f-2d6ebf4f779a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Split
{
	[BepInPlugin("com.Truok.Split", "Split", "1.0.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Splitt : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static OnClick <>9__22_0;

			public static OnClick <>9__22_1;

			internal void <Awake>b__22_0()
			{
				Application.OpenURL("https://thunderstore.io/c/ultrakill/p/d1g1tal0nedev/");
			}

			internal void <Awake>b__22_1()
			{
				Application.OpenURL("https://thunderstore.io/c/ultrakill/p/truokyt/");
			}
		}

		public static PluginConfigurator PluginConfig = PluginConfigurator.Create("Split General Config", "com.Truok.Split.Config");

		internal static ManualLogSource Log;

		internal readonly Harmony harmony = new Harmony("com.Truok.Split");

		public static ConfigPanel GeneralConfig = new ConfigPanel(PluginConfig.rootPanel, "General Config", "com.Truok.Split.ConfigGeneral");

		public static ConfigPanel TypesConfig = new ConfigPanel(PluginConfig.rootPanel, "Types Config", "com.Truok.Split.ConfigTypes");

		public static ConfigPanel Credits = new ConfigPanel(PluginConfig.rootPanel, "Credits", "com.Truok.Split.Credits");

		public static BoolField AllowInfSplit = new BoolField(GeneralConfig, "Allow Infinite Splitting", "com.Truok.Split.InfSplit", false);

		public static IntField SplitAmount = new IntField(GeneralConfig, "Split Amount", "com.Truok.Split.Amount", 2);

		public static IntField SplitChance = new IntField(GeneralConfig, "Split Chance", "com.Truok.Split.Chance", 100);

		public static BoolField RADIANTTYPE = new BoolField(TypesConfig, "Radiant Splitted", "com.Truok.Split.RT", false);

		public static IntField RADIANTChance = new IntField(TypesConfig, "Radiant Chance", "com.Truok.Split.RC", 100);

		public static BoolField SANDEDTYPE = new BoolField(TypesConfig, "Sanded Splitted", "com.Truok.Split.ST", false);

		public static IntField SANDEDChance = new IntField(TypesConfig, "Sanded Chance", "com.Truok.Split.SC", 100);

		public static BoolField BOMBTYPE = new BoolField(TypesConfig, "Bomber Splitted", "com.Truok.Split.BS", false);

		public static IntField BomberChance = new IntField(TypesConfig, "Bomber Chance", "com.Truok.Split.BC", 100);

		public static FloatField BomberTick = new FloatField(TypesConfig, "Bomber Tick Time", "com.Truok.Split.BTT", 10f);

		public static ButtonField TSs = new ButtonField(Credits, "truok ('Chrook'), Check Out Mods!", "com.Truok.Split.TSs");

		public static ButtonField TS = new ButtonField(Credits, "d1g1tal0nedev, Check Out Mods!", "com.Truok.Split.TS");

		public static Splitt Instance { get; private set; }

		private void Awake()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			ButtonField tS = TS;
			object obj = <>c.<>9__22_0;
			if (obj == null)
			{
				OnClick val = delegate
				{
					Application.OpenURL("https://thunderstore.io/c/ultrakill/p/d1g1tal0nedev/");
				};
				<>c.<>9__22_0 = val;
				obj = (object)val;
			}
			tS.onClick += (OnClick)obj;
			ButtonField tSs = TSs;
			object obj2 = <>c.<>9__22_1;
			if (obj2 == null)
			{
				OnClick val2 = delegate
				{
					Application.OpenURL("https://thunderstore.io/c/ultrakill/p/truokyt/");
				};
				<>c.<>9__22_1 = val2;
				obj2 = (object)val2;
			}
			tSs.onClick += (OnClick)obj2;
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Log = Logger.CreateLogSource("Split Debuger");
			Log.LogInfo((object)"Mod Is Loaded");
			harmony.PatchAll();
			((Component)this).gameObject.AddComponent<Class2>();
		}

		private void Update()
		{
			if (SplitChance.value > 100)
			{
				SplitChance.value = 100;
			}
			if (SplitChance.value < 0)
			{
				SplitChance.value = 0;
			}
		}
	}
}
namespace Split.Patches
{
	[HarmonyPatch(typeof(EnemyIdentifier))]
	internal class Patch : MonoBehaviour
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void Enemy(EnemyIdentifier __instance)
		{
			((Component)Splitt.Instance).GetComponent<Class2>().MSGTOMARICE(__instance);
		}
	}
}
namespace Split.C2
{
	internal class Class2 : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <NODIEMARICE>d__3 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public EnemyIdentifier __instance;

			public string path;

			public GameObject Prefab;

			public Class2 <>4__this;

			private int <i>5__1;

			private GameObject <NewEnmy>5__2;

			private EnemyIdentifier <newEnemyId>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <NODIEMARICE>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<NewEnmy>5__2 = null;
				<newEnemyId>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (Random.value <= (float)Splitt.SplitChance.value * 0.01f)
					{
						<i>5__1 = 1;
						while (<i>5__1 <= Splitt.SplitAmount.value)
						{
							<NewEnmy>5__2 = Object.Instantiate<GameObject>(Prefab, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation);
							<newEnemyId>5__3 = <NewEnmy>5__2.GetComponent<EnemyIdentifier>();
							<newEnemyId>5__3.dontCountAsKills = true;
							if (Splitt.BOMBTYPE.value && Random.value <= (float)Splitt.BomberChance.value * 0.01f)
							{
								((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.TickTickBomb(<newEnemyId>5__3));
							}
							if (Splitt.RADIANTTYPE.value && Random.value <= (float)Splitt.RADIANTChance.value * 0.01f)
							{
								<newEnemyId>5__3.BuffAll();
							}
							if (Splitt.SANDEDTYPE.value && Random.value <= (float)Splitt.SANDEDChance.value * 0.01f)
							{
								<newEnemyId>5__3.Sandify(false);
							}
							<NewEnmy>5__2 = null;
							<newEnemyId>5__3 = null;
							<i>5__1++;
						}
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <TickTickBomb>d__2 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public EnemyIdentifier __instance;

			public Class2 <>4__this;

			private GameObject <explosion>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TickTickBomb>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<explosion>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(Splitt.BomberTick.value);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<explosion>5__1 = Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.explosion, ((Component)__instance).transform.position, Quaternion.identity);
					<explosion>5__1.transform.SetParent(((Component)__instance).transform);
					<explosion>5__1.transform.SetParent((Transform)null, true);
					Object.Destroy((Object)(object)((Component)__instance).gameObject);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private GameObject NewEnmy;

		public void MSGTOMARICE(EnemyIdentifier __instance)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			if (__instance.dontCountAsKills && !Splitt.AllowInfSplit.value)
			{
				return;
			}
			__instance.onDeath.AddListener((UnityAction)delegate
			{
				//IL_0244: Unknown result type (might be due to invalid IL or missing references)
				//IL_0249: Unknown result type (might be due to invalid IL or missing references)
				//IL_026f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0274: Unknown result type (might be due to invalid IL or missing references)
				//IL_0308: Unknown result type (might be due to invalid IL or missing references)
				//IL_0318: Unknown result type (might be due to invalid IL or missing references)
				string empty = string.Empty;
				empty = ((!((Object)(object)((Component)((Component)__instance).transform.parent).GetComponent<GoreZone>() != (Object)null)) ? ((Object)((Component)__instance).transform.parent).name : ((Object)__instance).name);
				string text = Regex.Replace(empty, "[1-9]", "");
				text.Replace(" ", "");
				text.Replace("()", "");
				text.Replace(" ()", "");
				text.Replace("(Clone)", "");
				((Object)__instance).name = text + ".prefab";
				if (((Object)__instance).name.Contains("(Clone)"))
				{
					((Object)__instance).name = ((Object)__instance).name.Replace("(Clone)", "");
				}
				if (((Object)__instance).name.Contains(" "))
				{
					((Object)__instance).name = ((Object)__instance).name.Replace(" ", "");
				}
				if (((Object)__instance).name.Contains("()"))
				{
					((Object)__instance).name = ((Object)__instance).name.Replace("()", "");
				}
				string text2 = "Assets/Prefabs/Enemies/" + ((Object)__instance).name;
				if (text2.Contains("(Clone)"))
				{
					text2 = "Assets/Prefabs/Enemies/" + ((Object)__instance).name.Replace("(Clone)", "");
				}
				if (text2.Contains(" "))
				{
					text2 = "Assets/Prefabs/Enemies/" + ((Object)__instance).name.Replace(" ", "");
				}
				if (text2.Contains("()"))
				{
					text2 = "Assets/Prefabs/Enemies/" + ((Object)__instance).name.Replace("()", "");
				}
				GameObject val = Addressables.LoadAssetAsync<GameObject>((object)text2).WaitForCompletion();
				if ((Object)(object)val == (Object)null)
				{
					((Object)__instance).name = empty;
					val = Addressables.LoadAssetAsync<GameObject>((object)text2).WaitForCompletion();
				}
				Splitt.Log.LogInfo((object)text2);
				if (Random.value <= (float)Splitt.SplitChance.value * 0.01f)
				{
					for (int i = 1; i <= Splitt.SplitAmount.value; i++)
					{
						if (((Object)__instance).name == "Spider.prefab")
						{
							((MonoBehaviour)this).StartCoroutine(NODIEMARICE(__instance, text2, val));
						}
						else
						{
							GameObject val2 = Object.Instantiate<GameObject>(val, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation);
							EnemyIdentifier component = val2.GetComponent<EnemyIdentifier>();
							component.dontCountAsKills = true;
							if (Splitt.BOMBTYPE.value && Random.value <= (float)Splitt.BomberChance.value * 0.01f)
							{
								((MonoBehaviour)this).StartCoroutine(TickTickBomb(component));
							}
							if (Splitt.RADIANTTYPE.value && Random.value <= (float)Splitt.RADIANTChance.value * 0.01f)
							{
								component.BuffAll();
							}
							if (Splitt.SANDEDTYPE.value && Random.value <= (float)Splitt.SANDEDChance.value * 0.01f)
							{
								component.Sandify(false);
							}
						}
					}
				}
			});
		}

		[IteratorStateMachine(typeof(<TickTickBomb>d__2))]
		private IEnumerator TickTickBomb(EnemyIdentifier __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TickTickBomb>d__2(0)
			{
				<>4__this = this,
				__instance = __instance
			};
		}

		[IteratorStateMachine(typeof(<NODIEMARICE>d__3))]
		private IEnumerator NODIEMARICE(EnemyIdentifier __instance, string path, GameObject Prefab)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <NODIEMARICE>d__3(0)
			{
				<>4__this = this,
				__instance = __instance,
				path = path,
				Prefab = Prefab
			};
		}
	}
}