Decompiled source of Cut Content Restorer v1.0.0

CutContentRestorer.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using CutContentRestorer;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnhollowerBaseLib;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(CutContent), "CutContentRestorer", "1.0.0", "Digit4lSpace", null)]
[assembly: MelonGame("Stress Level Zero", "BONEWORKS")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("CutContentRestorer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CutContentRestorer")]
[assembly: AssemblyTitle("CutContentRestorer")]
[assembly: NeutralResourcesLanguage("en-US")]
[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 CutContentRestorer
{
	public class CutContent : MelonMod
	{
		[CompilerGenerated]
		private sealed class <HandleScene>d__12 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public CutContent <>4__this;

			public string sceneName;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: Unknown result type (might be due to invalid IL or missing references)
				//IL_022c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				CutContent cutContent = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					GameObject[] array = Il2CppArrayBase<GameObject>.op_Implicit(Resources.FindObjectsOfTypeAll<GameObject>());
					GameObject[] array2 = array;
					foreach (GameObject val in array2)
					{
						if (cutContent._gunStuff.Value && cutContent._generalGunObjects.Contains(((Object)val).name))
						{
							val.SetActive(true);
						}
						if (cutContent._generalObjects.Contains(((Object)val).name))
						{
							val.SetActive(true);
						}
					}
					if (!cutContent._sceneObjects.TryGetValue(sceneName, out (string[], string[]) value))
					{
						return false;
					}
					if (sceneName == "sandbox_blankBox" && !cutContent._blankBox.Value)
					{
						return false;
					}
					if (sceneName == "scene_arena")
					{
						cutContent.ArenaCampaignStuff(array);
					}
					if (sceneName == "zombie_warehouse")
					{
						cutContent.ZombieWarehouseStuff(array);
					}
					if (sceneName == "scene_redactedChamber")
					{
						cutContent.RedactedChamberStuff(array);
					}
					int num2 = 0;
					array2 = array;
					Scene scene;
					foreach (GameObject val2 in array2)
					{
						scene = val2.scene;
						if (!(((Scene)(ref scene)).name != sceneName))
						{
							if (value.Item1.Contains(((Object)val2).name))
							{
								val2.SetActive(true);
								num2++;
								((MelonBase)cutContent).LoggerInstance.Msg(((Object)val2).name + " Enabled.");
							}
							else if (value.Item2.Contains(((Object)val2).name))
							{
								val2.SetActive(false);
								((MelonBase)cutContent).LoggerInstance.Msg(((Object)val2).name + " Disabled.");
							}
						}
					}
					if (sceneName == "scene_throneRoom" && !cutContent._throneRoomExitPortal.Value)
					{
						array2 = array;
						foreach (GameObject val3 in array2)
						{
							if (((Object)val3).name == "TRIGGER_EXIT")
							{
								scene = val3.scene;
								if (((Scene)(ref scene)).name == "scene_throneRoom")
								{
									val3.SetActive(false);
								}
							}
						}
					}
					((MelonBase)cutContent).LoggerInstance.Msg($"Enabled {num2} objects in {sceneName}!");
					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 MelonPreferences_Category _category;

		private MelonPreferences_Entry<bool> _gunStuff;

		private MelonPreferences_Entry<bool> _blankBox;

		private MelonPreferences_Entry<bool> _throneRoomExitPortal;

		private Dictionary<string, (string[] enable, string[] disable)> _sceneObjects;

		private string[] _generalGunObjects = new string[7] { "highlight_boxy", "boxy top", "EjectText", "FireModeText", "ControllerOptionSelect", "Border", "Cursor" };

		private string[] _generalObjects = new string[1] { "brett_backpack_straps" };

		public override void OnApplicationStart()
		{
			_category = MelonPreferences.CreateCategory("CutContentRestorer");
			_gunStuff = _category.CreateEntry<bool>("GunStuff", true, "Enable gun stuff", (string)null, false, false, (ValueValidator)null, (string)null);
			_blankBox = _category.CreateEntry<bool>("BlankBox", true, "Enable BlankBox stuff", (string)null, false, false, (ValueValidator)null, (string)null);
			_throneRoomExitPortal = _category.CreateEntry<bool>("ThroneRoomExitPortal", true, "Enable Throne Room Exit Portal", (string)null, false, false, (ValueValidator)null, (string)null);
			MelonPreferences.Save();
			_sceneObjects = new Dictionary<string, (string[], string[])>
			{
				["scene_introStart"] = (new string[4] { "Measurement Device", "panel_global", "button_Zombies", "button_DebugLines" }, new string[0]),
				["scene_mainMenu"] = (new string[9] { "prop_bigButton", "button_updatesNext", "button_updatesBack", "grid_Window", "button_PROFILE", "LIGHTBAKEOFF", "CLAMP_greyBox", "prop_LEVELMODULE_greybox", "BASICDESKSETUP" }, new string[0]),
				["scene_museum"] = (new string[15]
				{
					"plateCover_top_null", "prop_onOffSlider", "PIPECLIMBER", "poster_monogon_A", "poster_monogon_B", "poster_monogon_C", "poster_monogon_D", "poster_monogon_E", "poster_monogon_F", "poster_monogon_G",
					"poster_monogon_H", "poster_monogon_J", "poster_monogon_K", "ChristmasTree", "holoRing_Text"
				}, new string[0]),
				["scene_streets"] = (new string[4] { "CombineLock", "plateCover_top_null", "prop_onOffSlider", "holoRing_Text" }, new string[0]),
				["scene_runoff"] = (new string[4] { "skele_Geo", "plateCover_top_null", "prop_onOffSlider", "holoRing_Text" }, new string[0]),
				["scene_sewerStation"] = (new string[4] { "plateCover_top_null", "prop_onOffSlider", "Pipes", "holoRing_Text" }, new string[0]),
				["scene_warehouse"] = (new string[4] { "FireSafetyDoor01", "ROOM_EXIT", "plateCover_top_null", "prop_onOffSlider" }, new string[2] { "plane_4x4 (4)", "plane_4x4 (1)" }),
				["scene_subwayStation"] = (new string[3] { "plateCover_top_null", "prop_onOffSlider", "holoRing_Text" }, new string[0]),
				["scene_tower"] = (new string[3] { "plateCover_top_null", "prop_onOffSlider", "holoRing_Text" }, new string[0]),
				["scene_towerBoss"] = (new string[6] { "skele_Geo", "VoiD Leak Stage (1)", "grid_30m_ballistic", "STAIRS (1)", "plateCover_top_null", "prop_onOffSlider" }, new string[0]),
				["scene_arena"] = (new string[17]
				{
					"OLD_SECTION_WINDMILL-HOUSES", "grid_Castle (1)", "CARGOCART (1)", "CARGOCART", "ARCHBLOCK (36)", "OCTAGON", "concretebarrier_turbo", "Ifonche_02", "Ifonche_01", "WoodF2",
					"dest_BoneworksCrate_1m", "kitbash_smallCons_16stair", "WoodG2 (24)", "JamaRocks", "crate_military_white_ARENA Variant", "Tawern Interior", "BrettEnemy"
				}, new string[2] { "mesh_kitbash_smallCons_16stair-1729422 (1)", "Door001" }),
				["scene_throneRoom"] = (new string[12]
				{
					"chamber_42x42x42_r", "texter_slzLogo", "TRIGGER_EXIT", "punching_bag", "skele_Geo", "handle", "handle (2)", "kitbash_platform_4m_4m", "stair_metal_10", "stair_metal_10 (2)",
					"stair_metal_10 (1)", "stair_metal_10 (3)"
				}, new string[4] { "texter_02", "texter_Chamber", "ELEVATORCART", "pillar_quarterxquarterx4 (1)" }),
				["arena_fantasy"] = (new string[9] { "WeaponSpawn", "MagSpawn", "BALLOON_Revolver", "prop_ammoBox_hvy", "dest_BoneworksCrate_1m", "Ifonche_02", "Ifonche_01", "WoodF2", "kitbash_smallCons_16stair" }, new string[1] { "mesh_kitbash_smallCons_16stair-1729422 (1)" }),
				["zombie_warehouse"] = (new string[9] { "plateCover_top_null", "prop_onOffSlider", "image_Action", "prop_arenaBell (2)", "dest_plant_C", "ZipStick", "ZipStick (1)", "SAVESPOT*REMOVE THIS*ZONEDEBUG", "holoRing_Text" }, new string[2] { "red_couch", "CUREMACHINE (1)" }),
				["sandbox_museumBasement"] = (new string[29]
				{
					"HALFPIPE", "chamber_piece_40mx40m (21)", "chamber_piece_40mx40m (22)", "prop_batteryHolderA", "prop_batteryHolderA (1)", "prop_batteryHolderA (2)", "prop_batteryA", "prop_batteryA (1)", "prop_batteryA (2)", "GravityStaff",
					"Balloon Spawn Launcher", "Decal_GroundMarking_Circle", "p_dest_glassPane (5)", "p_dest_glassPane (1)", "p_dest_glassPane (2)", "p_dest_glassPane (4)", "p_dest_glassPane (3)", "testiKey", "CONCRETEPALLETE", "ZoneDebugger",
					"rifle_M16_Ironsights", "Knife_Chef", "env_monomat_dispSys", "COREBOMB", "DEVMANIPTOOL", "prop_crown", "prop_powerPuncher (1)", "prop_powerPuncher", "rifle_M16_LaserForegrip"
				}, new string[0]),
				["sandbox_blankBox"] = (new string[29]
				{
					"HALFPIPE", "chamber_piece_40mx40m (21)", "chamber_piece_40mx40m (22)", "prop_batteryHolderA", "prop_batteryHolderA (1)", "prop_batteryHolderA (2)", "prop_batteryA", "prop_batteryA (1)", "prop_batteryA (2)", "GravityStaff",
					"Balloon Spawn Launcher", "Decal_GroundMarking_Circle", "p_dest_glassPane (5)", "p_dest_glassPane (1)", "p_dest_glassPane (2)", "p_dest_glassPane (4)", "p_dest_glassPane (3)", "testiKey", "CONCRETEPALLETE", "ZoneDebugger",
					"rifle_M16_Ironsights", "Knife_Chef", "env_monomat_dispSys", "COREBOMB", "DEVMANIPTOOL", "prop_crown", "prop_powerPuncher (1)", "prop_powerPuncher", "rifle_M16_LaserForegrip"
				}, new string[0]),
				["scene_redactedChamber"] = (new string[24]
				{
					"texter_04", "texter_awareness", "texter_body", "texter_weapons", "texter_testing", "place_room", "STAIRS (1)", "DECALS_RECURSION1", "place_deskStation", "-------HIDDEN-------",
					"lamp_worklight_stand", "confetti_Poof_ball", "LevelSelector", "LevelPillar", "enemy_roller", "QuickMenu", "TimeMachine", "prop_BigLever", "SM_Chair1", "prop_onOffLever",
					"floor", "Construction", "UI", "electronics"
				}, new string[3] { "texter_TestChamber", "texter_interaction", "texter_physical" }),
				["scene_Tuscany"] = (new string[12]
				{
					"BIGTARGET", "BIGTARGET (1)", "BIGTARGET (2)", "BIGTARGET (3)", "Boats", "Boat3", "Tapestry", "Books", "book_B_wormholes", "book_C_livingStressFree",
					"book_L_MakeGames", "book_I_texturingForMorons"
				}, new string[0]),
				["scene_hoverJunkers"] = (new string[2] { "Television", "holoRing_Text" }, new string[0])
			};
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			MelonCoroutines.Start(HandleScene(sceneName));
		}

		private void ArenaCampaignStuff(GameObject[] allObjects)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3);
			obj.transform.position = new Vector3(1.568f, -0.003f, 120.2837f);
			obj.transform.rotation = Quaternion.Euler(-90.00001f, 0f, -90.00001f);
			obj.transform.localScale = new Vector3(10.8033f, 10.80591f, 0.03490543f);
			((Renderer)obj.GetComponent<MeshRenderer>()).enabled = false;
			((MelonBase)this).LoggerInstance.Msg("Tavern floor Void clip fixed!");
			foreach (GameObject val in allObjects)
			{
				if (((Object)val).name == "TRIGGER_EXIT")
				{
					Scene scene = val.scene;
					if (((Scene)(ref scene)).name == "scene_arena")
					{
						val.transform.position = new Vector3(41.91f, -0.86f, 131.99f);
						val.transform.rotation = Quaternion.Euler(180f, 89.99999f, 180f);
						((MelonBase)this).LoggerInstance.Msg("Arena portal moved!");
					}
				}
			}
		}

		private void ZombieWarehouseStuff(GameObject[] allObjects)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] array = allObjects;
			Scene scene;
			foreach (GameObject val in array)
			{
				if (!(((Object)val).name == "prop_onOffLever (1)"))
				{
					continue;
				}
				scene = val.scene;
				if (!(((Scene)(ref scene)).name == "zombie_warehouse") || !(((Object)val.transform.parent).name == "CUREMACHINE (1)"))
				{
					continue;
				}
				foreach (GameObject val2 in allObjects)
				{
					if (((Object)val2).name == "OLD")
					{
						scene = val2.scene;
						if (((Scene)(ref scene)).name == "zombie_warehouse")
						{
							val.transform.SetParent(val2.transform);
							val.transform.localPosition = new Vector3(-0.074f, 0.289f, 0.564f);
							val.SetActive(true);
						}
					}
				}
			}
			array = allObjects;
			foreach (GameObject val3 in array)
			{
				if (!(((Object)val3).name == "OLD"))
				{
					continue;
				}
				scene = val3.scene;
				if (((Scene)(ref scene)).name == "zombie_warehouse")
				{
					val3.SetActive(true);
					for (int k = 0; k < val3.transform.childCount; k++)
					{
						((Component)val3.transform.GetChild(k)).gameObject.SetActive(true);
					}
					((MelonBase)this).LoggerInstance.Msg("Old Cure Machine enabled!");
				}
			}
		}

		private void RedactedChamberStuff(GameObject[] allObjects)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject val in allObjects)
			{
				Scene scene;
				if (((Object)val).name == "dest_explodingBarrel")
				{
					scene = val.scene;
					if (((Scene)(ref scene)).name == "scene_redactedChamber")
					{
						val.transform.position = new Vector3(-11.453f, -0.86f, 2.492f);
						val.transform.rotation = Quaternion.Euler(0f, -135.393f, 0f);
					}
				}
				if (((Object)val).name == "dest_pallet_A")
				{
					scene = val.scene;
					if (((Scene)(ref scene)).name == "scene_redactedChamber")
					{
						val.transform.position = new Vector3(-10.896f, -0.86f, -1.656f);
					}
				}
				if (((Object)val).name == "Container (1)")
				{
					scene = val.scene;
					if (((Scene)(ref scene)).name == "scene_redactedChamber")
					{
						val.transform.position = new Vector3(-8.89f, 2.65f, -6.99f);
					}
				}
				if (((Object)val).name == "Hexagonal_Container")
				{
					scene = val.scene;
					if (((Scene)(ref scene)).name == "scene_redactedChamber")
					{
						val.transform.position = new Vector3(-8.89f, 0.9f, -6.99f);
					}
				}
			}
		}

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