Decompiled source of ResurrectMinigames v1.0.0

ResurrectMinigames.dll

Decompiled 2 days ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("TestMods")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestMods")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d13a6e10-2312-4429-ac98-d94221197f97")]
[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")]
[BepInPlugin("com.sealofapproval.testmods", "Test Mods", "1.0.0")]
public class ResurrectMinigames : BaseUnityPlugin
{
	private bool stop;

	private bool stop2;

	private bool stop3;

	private void Update()
	{
		if ((Object)(object)HeroController.instance != (Object)null)
		{
			string sceneName = GameManager.instance.sceneName;
			if (sceneName == "Coral_33" && !stop)
			{
				((MonoBehaviour)this).StartCoroutine(ResurrectLumble());
			}
			else if (sceneName != "Coral_33")
			{
				stop = false;
			}
			if (sceneName == "Bone_12" && !stop2)
			{
				((MonoBehaviour)this).StartCoroutine(ResurrectLoddie());
			}
			else if (sceneName != "Bone_12")
			{
				stop2 = false;
			}
			if (sceneName == "Bone_08" && !stop3)
			{
				((MonoBehaviour)this).StartCoroutine(LoddieExterior());
			}
			else if (sceneName != "Bone_08")
			{
				stop3 = false;
			}
		}
	}

	private IEnumerator ResurrectLumble()
	{
		stop = true;
		PlayerData instance = PlayerData.instance;
		if (instance.dicePilgrimState != 1 && instance.dicePilgrimState != 2 && !instance.dicePilgrimDefeated && instance.dicePilgrimBank <= 90000)
		{
			yield break;
		}
		instance.dicePilgrimState = 0;
		instance.dicePilgrimBank = 999999;
		GameObject obj = GameObject.Find("Black Thread States");
		Transform val = null;
		Transform[] componentsInChildren = obj.GetComponentsInChildren<Transform>(true);
		foreach (Transform val2 in componentsInChildren)
		{
			if (((Object)val2).name == "Normal World")
			{
				val = val2;
				break;
			}
		}
		Transform dice = null;
		componentsInChildren = ((Component)val).GetComponentsInChildren<Transform>(true);
		foreach (Transform val3 in componentsInChildren)
		{
			if (((Object)val3).name == "Dice Game Control")
			{
				dice = val3;
				break;
			}
		}
		Transform val4 = null;
		componentsInChildren = ((Component)val).GetComponentsInChildren<Transform>(true);
		foreach (Transform val5 in componentsInChildren)
		{
			if (((Object)val5).name == "Dice Game Control")
			{
				val4 = val5;
				if (instance.garmondFinalQuestReady && !instance.garmondBlackThreadDefeated)
				{
					Extensions.SetPositionY(val5, 3f);
				}
			}
			else if (!(((Object)val5).name == "tent_piece") && (!((Object)(object)dice != (Object)null) || !val5.IsChildOf(dice)))
			{
				((Component)val5).gameObject.SetActive(false);
				((Component)val).gameObject.SetActive(true);
			}
		}
		componentsInChildren = ((Component)val4).GetComponentsInChildren<Transform>(true);
		foreach (Transform val6 in componentsInChildren)
		{
			if (((Object)val6).name == "Play Point" && instance.garmondFinalQuestReady && !instance.garmondBlackThreadDefeated)
			{
				((Component)val6).gameObject.SetActive(false);
			}
		}
		if (instance.act3_wokeUp)
		{
			GameObject val7 = GameObject.Find("Black Thread States/Black Thread World/black_thread_strand (4)");
			GameObject val8 = GameObject.Find("Black Thread States/Black Thread World/black_thread_strand (5)");
			GameObject obj2 = GameObject.Find("Black Thread States/Black Thread World/Group/collapse_chunk__0001_bone1 (2)");
			GameObject val9 = GameObject.Find("greymoor_cage_bits_0001_2 (2)");
			val7.SetActive(false);
			val8.SetActive(false);
			Extensions.SetPosition2D(obj2.transform, -33.55f, -7.53f);
			Extensions.SetPositionY(val9.transform, 58.84f);
		}
		yield return (object)new WaitForSeconds(1f);
		Transform val10 = null;
		componentsInChildren = ((Component)dice).GetComponentsInChildren<Transform>(true);
		foreach (Transform val11 in componentsInChildren)
		{
			if (((Object)val11).name == "Dice Game Corpse")
			{
				val10 = val11;
				break;
			}
		}
		if (((Component)val10).gameObject.activeSelf)
		{
			((Component)val10).gameObject.SetActive(false);
		}
	}

	private IEnumerator ResurrectLoddie()
	{
		stop2 = true;
		((BaseUnityPlugin)this).Logger.LogError((object)"Started!");
		PlayerData instance = PlayerData.instance;
		if (!instance.spinnerDefeated)
		{
			yield break;
		}
		instance.PinGalleryWallet = 999999;
		GameObject val = GameObject.Find("Black Thread States");
		Transform val2 = null;
		Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(true);
		foreach (Transform val3 in componentsInChildren)
		{
			if (((Object)val3).name == "Black Thread World")
			{
				val2 = val3;
				break;
			}
		}
		Transform normal = null;
		componentsInChildren = val.GetComponentsInChildren<Transform>(true);
		foreach (Transform val4 in componentsInChildren)
		{
			if (((Object)val4).name == "Normal World")
			{
				normal = val4;
				break;
			}
		}
		Transform val5 = null;
		Transform val6 = null;
		Transform val7 = null;
		Transform val8 = null;
		Transform val9 = null;
		Transform val10 = null;
		componentsInChildren = ((Component)val2).GetComponentsInChildren<Transform>(true);
		foreach (Transform val11 in componentsInChildren)
		{
			string name = ((Object)val11).name;
			if (name == "collapse_pieces")
			{
				val5 = val11;
			}
			else
			{
				if ((Object)(object)val5 != (Object)null && val11.IsChildOf(val5))
				{
					continue;
				}
				if (name == "black_thread_strand (4)")
				{
					val7 = val11;
					Extensions.SetPositionX(((Component)val11).transform, 9.51f);
				}
				else
				{
					if ((Object)(object)val7 != (Object)null && val11.IsChildOf(val7))
					{
						continue;
					}
					switch (name)
					{
					case "RestBench (1)":
						val8 = val11;
						continue;
					case "Vignette Cutout (5)":
					case "hornet_rag_basic_shake (22)":
						continue;
					}
					if ((Object)(object)val8 != (Object)null && val11.IsChildOf(val8))
					{
						continue;
					}
					switch (name)
					{
					case "Ladybugs_Act_3":
						val6 = val11;
						continue;
					case "jail_extra_0005_cage_bench_back (1)":
					case "black_fader_moon (30)":
					case "Enviro Region Simple (4)":
					case "Slab__0005_stone_wall (206)":
					case "jail_door_0007_2 (4)":
					case "jail_extra_0001_table (3)":
					case "ant_fog (6)":
					case "ant_fog (7)":
					case "ant_fog (8)":
					case "ant_fog (9)":
					case "terrain collider non slider (2)":
					case "terrain collider":
					case "black_fader_moon (17)":
						continue;
					}
					if (!((Object)(object)val6 != (Object)null) || !val11.IsChildOf(val6))
					{
						if (name == "pushable_rock_set")
						{
							val9 = val11;
						}
						else if (name == "pushable_rock_set (1)")
						{
							val10 = val11;
						}
						else if ((!((Object)(object)val9 != (Object)null) || !val11.IsChildOf(val9)) && (!((Object)(object)val10 != (Object)null) || !val11.IsChildOf(val10)) && !(name == "Black Thread World"))
						{
							((Component)val11).gameObject.SetActive(false);
						}
					}
				}
			}
		}
		componentsInChildren = ((Component)val5).GetComponentsInChildren<Transform>(true);
		foreach (Transform val12 in componentsInChildren)
		{
			string name2 = ((Object)val12).name;
			string text = "collapse_chunks_0006_1 ";
			if (!(name2 == "collapse_pieces") && !(name2 == text + "(28)") && !(name2 == text + "(29)") && !(name2 == text + "(30)") && !(name2 == "sc_junk_piles_small_0001_1 (3)"))
			{
				if (name2 == text + "(44)")
				{
					Extensions.SetPosition2D(((Component)val12).transform, 37.26f, 22.93f);
				}
				else if (!(name2 == text + "(51)") && !(name2 == text + "(74)") && !(name2 == "Slab__0005_stone_wall (210)") && !(name2 == text + "(75)") && !(name2 == text + "(80)") && !(name2 == "sc_junk_piles_small_0001_1 (4)"))
				{
					((Component)val12).gameObject.SetActive(false);
				}
			}
		}
		Transform val13 = null;
		componentsInChildren = ((Component)val6).GetComponentsInChildren<Transform>(true);
		foreach (Transform val14 in componentsInChildren)
		{
			if (((Object)val14).name == "lady_bug_tents")
			{
				val13 = val14;
				break;
			}
		}
		componentsInChildren = ((Component)val13).GetComponentsInChildren<Transform>(true);
		foreach (Transform val15 in componentsInChildren)
		{
			if (((Object)val15).name == "lady_bug__0015_1")
			{
				Extensions.SetPositionZ(((Component)val15).transform, 0.1f);
			}
		}
		string text2 = "CameraLockArea";
		Transform val16 = null;
		Transform val17 = null;
		componentsInChildren = ((Component)normal).GetComponentsInChildren<Transform>(true);
		foreach (Transform val18 in componentsInChildren)
		{
			string name3 = ((Object)val18).name;
			if (name3 == "Normal World")
			{
				continue;
			}
			if (name3 == "mid_plat")
			{
				val17 = val18;
			}
			else
			{
				if ((Object)(object)val17 != (Object)null && val18.IsChildOf(val17))
				{
					continue;
				}
				if (name3 == "Pin Gallery States")
				{
					val16 = val18;
				}
				else if ((!((Object)(object)val16 != (Object)null) || !val18.IsChildOf(val16)) && !(name3 == text2) && !(name3 == text2 + " (1)") && !(name3 == text2 + " (2)") && !(name3 == text2 + " (3)") && !(name3 == text2 + " (4)") && !(name3 == text2 + " (5)") && !(name3 == text2 + " (6)"))
				{
					switch (name3)
					{
					case "Vignette Cutout (4)":
					case "Fixed Joint - Slab Chain Lamp (1)":
					case "Fixed Joint - Slab Chain Lamp":
					case "hornet_rag_basic_shake (19)":
						continue;
					}
					((Component)val18).gameObject.SetActive(false);
				}
			}
		}
		Transform val19 = null;
		componentsInChildren = ((Component)val16).GetComponentsInChildren<Transform>(true);
		foreach (Transform val20 in componentsInChildren)
		{
			if (((Object)val20).name == "Here")
			{
				val19 = val20;
			}
		}
		Transform val21 = null;
		Transform val22 = null;
		Transform val23 = null;
		Transform val24 = null;
		Transform val25 = null;
		Transform val26 = null;
		Transform val27 = null;
		componentsInChildren = ((Component)val19).GetComponentsInChildren<Transform>(true);
		foreach (Transform val28 in componentsInChildren)
		{
			string name4 = ((Object)val28).name;
			switch (name4)
			{
			case "Lady Bug Large":
				val26 = val28;
				continue;
			case "Here":
			case "Vignette Cutout":
				continue;
			}
			if ((Object)(object)val26 != (Object)null && val28.IsChildOf(val26))
			{
				continue;
			}
			switch (name4)
			{
			case "Pin Challenge":
				val27 = val28;
				continue;
			case "black_fader_moon (33)":
			case "black_fader_moon (28)":
				continue;
			}
			if ((Object)(object)val27 != (Object)null && val28.IsChildOf(val27))
			{
				continue;
			}
			switch (name4)
			{
			case "RestBench":
				val22 = val28;
				continue;
			case "Challenge Disqualify Collider":
			case "Challenge Disqualify Collider (1)":
			case "Darkness Region":
				continue;
			}
			if ((Object)(object)val22 != (Object)null && val28.IsChildOf(val22))
			{
				continue;
			}
			switch (name4)
			{
			case "Fail Pole":
				val23 = val28;
				continue;
			case "jail_extra_0005_cage_bench_back (1)":
			case "Challenge Disqualify Collider (2)":
			case "Position Pole":
				continue;
			}
			if ((Object)(object)val23 != (Object)null && val28.IsChildOf(val23))
			{
				continue;
			}
			if (name4 == "Fail Pole (1)")
			{
				val24 = val28;
				continue;
			}
			if ((Object)(object)val24 != (Object)null && val28.IsChildOf(val24))
			{
				continue;
			}
			if (name4 == "Fail Pole (2)")
			{
				val25 = val28;
				continue;
			}
			if ((Object)(object)val25 != (Object)null && val28.IsChildOf(val25))
			{
				continue;
			}
			switch (name4)
			{
			case "Lady Bug Small Idle":
				val21 = val28;
				continue;
			case "Position Pole (1)":
			case "Position Pole (2)":
				continue;
			}
			if (!((Object)(object)val21 != (Object)null) || !val28.IsChildOf(val21))
			{
				switch (name4)
				{
				case "Vignette Cutout (1)":
				case "haze2 (5)":
				case "haze2 (6)":
				case "haze2 (7)":
				case "haze2 (8)":
				case "haze2 (9)":
				case "GradeMarker (1)":
					continue;
				}
				((Component)val28).gameObject.SetActive(false);
			}
		}
		yield return (object)new WaitForSeconds(0.1f);
		((Component)normal).gameObject.SetActive(true);
	}

	private IEnumerator LoddieExterior()
	{
		stop3 = true;
		if (!PlayerData.instance.act3_wokeUp)
		{
			yield break;
		}
		Transform val = null;
		Transform[] componentsInChildren = GameObject.Find("Black Thread States Thread Only Variant").GetComponentsInChildren<Transform>(true);
		foreach (Transform val2 in componentsInChildren)
		{
			if (((Object)val2).name == "Black Thread World")
			{
				val = val2;
				break;
			}
		}
		Transform val3 = null;
		componentsInChildren = ((Component)val).GetComponentsInChildren<Transform>(true);
		foreach (Transform val4 in componentsInChildren)
		{
			if (((Object)val4).name == "Is Here (1)")
			{
				val3 = val4;
				break;
			}
		}
		Transform val5 = null;
		componentsInChildren = ((Component)val3).GetComponentsInChildren<Transform>(true);
		foreach (Transform val6 in componentsInChildren)
		{
			if (((Object)val6).name == "lady_bug_tents_outer")
			{
				val5 = val6;
				break;
			}
		}
		componentsInChildren = ((Component)val5).GetComponentsInChildren<Transform>(true);
		foreach (Transform val7 in componentsInChildren)
		{
			if (((Object)val7).name == "lady_bug__0011_1 (9)")
			{
				Extensions.SetPositionX(((Component)val7).transform, 34.49f);
			}
			if (((Object)val7).name == "lady_bug__0001_1")
			{
				Extensions.SetPositionX(((Component)val7).transform, 28.48f);
			}
		}
	}
}