Decompiled source of UltraChaos v2.0.0
UltraChaos/UltraChaos.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; 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.Decorators; using PluginConfig.API.Fields; using PluginConfig.API.Functionals; using TMPro; using UltraChaos.Cheats; using UltraChaos.MonoBehaviours; using UltraChaos.PluginConfiguratorCOnfig; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceLocations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("UltraChaos")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UltraChaos")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7bfa6f27-545d-47ca-8120-0d9208b5fdfb")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace UltraChaos { [BepInPlugin("com.banana.ULTRARandomizer", "ULTRARandomizer", "2.0.0")] public class UltraChaosPlugin : BaseUnityPlugin { [CompilerGenerated] private sealed class <>c__DisplayClass10_0 { public Scene arg0; internal bool <ShuffleTransforms>b__0(Transform x) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return ((Component)x).gameObject.scene == arg0; } } [CompilerGenerated] private sealed class <>c__DisplayClass11_0 { public Scene arg0; internal bool <ShuffleTransformsScale>b__0(Transform x) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return ((Component)x).gameObject.scene != arg0; } } [CompilerGenerated] private sealed class <LoadPlushies>d__1 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public UltraChaosPlugin <>4__this; private AsyncOperationHandle<IResourceLocator> <handle>5__1; private IResourceLocator <result>5__2; private IEnumerator<object> <>s__3; private object <obj>5__4; private string <text>5__5; private AsyncOperationHandle<IList<IResourceLocation>> <locationHandle>5__6; private AsyncOperationHandle<SoundtrackSong> <shaderHandle>5__7; private SoundtrackSong <result2>5__8; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadPlushies>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num == -3 || (uint)(num - 2) <= 1u) { try { } finally { <>m__Finally1(); } } <handle>5__1 = default(AsyncOperationHandle<IResourceLocator>); <result>5__2 = null; <>s__3 = null; <obj>5__4 = null; <text>5__5 = null; <locationHandle>5__6 = default(AsyncOperationHandle<IList<IResourceLocation>>); <shaderHandle>5__7 = default(AsyncOperationHandle<SoundtrackSong>); <result2>5__8 = null; <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Invalid comparison between Unknown and I4 //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Invalid comparison between Unknown and I4 //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Invalid comparison between Unknown and I4 //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <handle>5__1 = Addressables.InitializeAsync(); goto IL_0067; case 1: <>1__state = -1; goto IL_0067; case 2: <>1__state = -3; goto IL_0128; case 3: { <>1__state = -3; goto IL_019c; } IL_0067: if (!<handle>5__1.IsDone) { <>2__current = null; <>1__state = 1; return true; } if ((int)<handle>5__1.Status == 1) { <result>5__2 = <handle>5__1.Result; <>s__3 = ((ResourceLocationMap)<result>5__2).Keys.GetEnumerator(); <>1__state = -3; goto IL_0294; } Debug.LogError((object)$"Addressables initialization failed: {<handle>5__1.OperationException}"); break; IL_0128: if (!<locationHandle>5__6.IsDone) { <>2__current = null; <>1__state = 2; return true; } if ((int)<locationHandle>5__6.Status == 1 && <locationHandle>5__6.Result.Count > 0) { <shaderHandle>5__7 = Addressables.LoadAssetAsync<SoundtrackSong>((object)<text>5__5); goto IL_019c; } goto IL_0272; IL_0294: if (<>s__3.MoveNext()) { <obj>5__4 = <>s__3.Current; <text>5__5 = (string)<obj>5__4; <locationHandle>5__6 = Addressables.LoadResourceLocationsAsync((object)<text>5__5, typeof(SoundtrackSong)); goto IL_0128; } <>m__Finally1(); <>s__3 = null; <result>5__2 = null; break; IL_019c: if (!<shaderHandle>5__7.IsDone) { <>2__current = null; <>1__state = 3; return true; } if ((int)<shaderHandle>5__7.Status == 1) { <result2>5__8 = <shaderHandle>5__7.Result; if ((Object)(object)<result2>5__8 != (Object)null) { cleanClips.AddRange(<shaderHandle>5__7.Result.clips); battleClips.AddRange(<shaderHandle>5__7.Result.clips); bossClips.AddRange(<shaderHandle>5__7.Result.clips); } <result2>5__8 = null; } else { Debug.LogError((object)$"Failed to load asset: {<shaderHandle>5__7.OperationException}"); } <shaderHandle>5__7 = default(AsyncOperationHandle<SoundtrackSong>); goto IL_0272; IL_0272: <text>5__5 = null; <text>5__5 = null; <locationHandle>5__6 = default(AsyncOperationHandle<IList<IResourceLocation>>); <obj>5__4 = null; goto IL_0294; } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__3 != null) { <>s__3.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadTypeAsync>d__25 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public UltraChaosPlugin <>4__this; private AsyncOperationHandle<IResourceLocator> <handle>5__1; private IResourceLocator <result>5__2; private IEnumerator<object> <>s__3; private object <obj>5__4; private string <text>5__5; private AsyncOperationHandle<IList<IResourceLocation>> <locationHandle>5__6; private AsyncOperationHandle<SpawnableObject> <shaderHandle>5__7; private SpawnableObject <result2>5__8; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadTypeAsync>d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num == -3 || (uint)(num - 2) <= 1u) { try { } finally { <>m__Finally1(); } } <handle>5__1 = default(AsyncOperationHandle<IResourceLocator>); <result>5__2 = null; <>s__3 = null; <obj>5__4 = null; <text>5__5 = null; <locationHandle>5__6 = default(AsyncOperationHandle<IList<IResourceLocation>>); <shaderHandle>5__7 = default(AsyncOperationHandle<SpawnableObject>); <result2>5__8 = null; <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Invalid comparison between Unknown and I4 //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Invalid comparison between Unknown and I4 //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Invalid comparison between Unknown and I4 //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Invalid comparison between Unknown and I4 //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Invalid comparison between Unknown and I4 //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Invalid comparison between Unknown and I4 //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <handle>5__1 = Addressables.InitializeAsync(); goto IL_0067; case 1: <>1__state = -1; goto IL_0067; case 2: <>1__state = -3; goto IL_0128; case 3: { <>1__state = -3; goto IL_019c; } IL_0067: if (!<handle>5__1.IsDone) { <>2__current = null; <>1__state = 1; return true; } if ((int)<handle>5__1.Status == 1) { <result>5__2 = <handle>5__1.Result; <>s__3 = ((ResourceLocationMap)<result>5__2).Keys.GetEnumerator(); <>1__state = -3; goto IL_033b; } Debug.LogError((object)$"Addressables initialization failed: {<handle>5__1.OperationException}"); break; IL_0128: if (!<locationHandle>5__6.IsDone) { <>2__current = null; <>1__state = 2; return true; } if ((int)<locationHandle>5__6.Status == 1 && <locationHandle>5__6.Result.Count > 0) { <shaderHandle>5__7 = Addressables.LoadAssetAsync<SpawnableObject>((object)<text>5__5); goto IL_019c; } goto IL_0319; IL_033b: if (<>s__3.MoveNext()) { <obj>5__4 = <>s__3.Current; <text>5__5 = (string)<obj>5__4; <locationHandle>5__6 = Addressables.LoadResourceLocationsAsync((object)<text>5__5, typeof(SpawnableObject)); goto IL_0128; } <>m__Finally1(); <>s__3 = null; <result>5__2 = null; break; IL_019c: if (!<shaderHandle>5__7.IsDone) { <>2__current = null; <>1__state = 3; return true; } if ((int)<shaderHandle>5__7.Status == 1) { <result2>5__8 = <shaderHandle>5__7.Result; if ((Object)(object)<result2>5__8 != (Object)null && (int)<result2>5__8.spawnableObjectType == 1 && !enemies.Contains(<result2>5__8)) { if ((int)<result2>5__8.enemyType == 35 && <result2>5__8.objectName.ToUpper() == "EARTHMOVER") { <result2>5__8.gameObject = earthmover; } if ((int)<result2>5__8.enemyType != 27 || <result2>5__8.objectName.ToUpper() == "LEVIATHAN") { } if (<result2>5__8.objectName == "THE CORPSE OF KING MINOS" && (int)<result2>5__8.enemyType == 11) { <result2>5__8.spawnOffset = -589f; } enemies.Add(<shaderHandle>5__7.Result); } <result2>5__8 = null; } else { Debug.LogError((object)$"Failed to load asset: {<shaderHandle>5__7.OperationException}"); } <shaderHandle>5__7 = default(AsyncOperationHandle<SpawnableObject>); goto IL_0319; IL_0319: <text>5__5 = null; <text>5__5 = null; <locationHandle>5__6 = default(AsyncOperationHandle<IList<IResourceLocation>>); <obj>5__4 = null; goto IL_033b; } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__3 != null) { <>s__3.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ShuffleTransforms>d__10 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Scene arg0; public UltraChaosPlugin <>4__this; private <>c__DisplayClass10_0 <>8__1; private List<Transform> <transforms>5__2; private Transform <playerTransform>5__3; private int <i>5__4; private int <randomIndex>5__5; private Vector3 <tempPosition>5__6; private Exception <e>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ShuffleTransforms>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <transforms>5__2 = null; <playerTransform>5__3 = null; <e>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_03df; } <>1__state = -1; <>8__1 = new <>c__DisplayClass10_0(); <>8__1.arg0 = arg0; <transforms>5__2 = Resources.FindObjectsOfTypeAll<Transform>().ToList(); <transforms>5__2 = <transforms>5__2.Where((Transform x) => ((Component)x).gameObject.scene == <>8__1.arg0).ToList(); Debug.Log((object)$"Found {<transforms>5__2.Count} root transforms in scene '{((Scene)(ref <>8__1.arg0)).name}'"); <playerTransform>5__3 = ((Component)MonoSingleton<NewMovement>.Instance).transform; <i>5__4 = 0; goto IL_03f1; IL_03f1: if (<i>5__4 < <transforms>5__2.Count) { try { Debug.Log((object)("Processing transform: " + ((Object)<transforms>5__2[<i>5__4]).name)); if (<>4__this.IsChildOfPlayer(<transforms>5__2[<i>5__4], <playerTransform>5__3)) { Debug.Log((object)("Skipping player-related transform: " + ((Object)<transforms>5__2[<i>5__4]).name)); } else if (!((Object)((Component)<transforms>5__2[<i>5__4]).gameObject).name.Contains("FirstRoom") && !((Object)((Component)<transforms>5__2[<i>5__4]).gameObject).name.Contains("OutOfBounds")) { if (!((Object)(object)((Component)<transforms>5__2[<i>5__4]).gameObject.GetComponent<RectTransform>() != (Object)null)) { <randomIndex>5__5 = Random.Range(<i>5__4, <transforms>5__2.Count); while (<i>5__4 == <randomIndex>5__5 || <>4__this.IsChildOfPlayer(<transforms>5__2[<randomIndex>5__5], <playerTransform>5__3) || (Object)(object)((Component)<transforms>5__2[<i>5__4]).gameObject.GetComponent<RectTransform>() != (Object)null || ((Object)((Component)<transforms>5__2[<i>5__4]).gameObject).name.Contains("FirstRoom") || ((Object)((Component)<transforms>5__2[<i>5__4]).gameObject).name.Contains("OutOfBounds")) { <randomIndex>5__5 = Random.Range(<i>5__4, <transforms>5__2.Count); } try { <tempPosition>5__6 = <transforms>5__2[<i>5__4].position; <transforms>5__2[<i>5__4].position = <transforms>5__2[<randomIndex>5__5].position; <transforms>5__2[<randomIndex>5__5].position = <tempPosition>5__6; Debug.Log((object)("Swapped " + ((Object)<transforms>5__2[<i>5__4]).name + " with " + ((Object)<transforms>5__2[<randomIndex>5__5]).name)); } catch (Exception ex) { <e>5__7 = ex; Debug.LogWarning((object)("Error while swapping transforms: " + <e>5__7.Message)); } goto IL_03b3; } Debug.Log((object)("Skipping RectTransform: " + ((Object)<transforms>5__2[<i>5__4]).name)); } } catch (Exception) { throw; } goto IL_03df; } return false; IL_03b3: if (<i>5__4 % 10 == 0) { <>2__current = null; <>1__state = 1; return true; } goto IL_03df; IL_03df: <i>5__4++; goto IL_03f1; } 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 <ShuffleTransformsScale>d__11 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Scene arg0; public UltraChaosPlugin <>4__this; private <>c__DisplayClass11_0 <>8__1; private List<Transform> <transforms>5__2; private Transform <playerTransform>5__3; private int <i>5__4; private int <randomIndex>5__5; private Vector3 <tempPosition>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ShuffleTransformsScale>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <transforms>5__2 = null; <playerTransform>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_03ab; } <>1__state = -1; <>8__1 = new <>c__DisplayClass11_0(); <>8__1.arg0 = arg0; <transforms>5__2 = Resources.FindObjectsOfTypeAll<Transform>().ToList(); <transforms>5__2.RemoveAll((Transform x) => ((Component)x).gameObject.scene != <>8__1.arg0); <playerTransform>5__3 = ((Component)MonoSingleton<NewMovement>.Instance).transform; <i>5__4 = 0; goto IL_03bd; IL_03bd: if (<i>5__4 < <transforms>5__2.Count) { try { Debug.Log((object)("Processing transform: " + ((Object)<transforms>5__2[<i>5__4]).name)); if (<>4__this.IsChildOfPlayer(<transforms>5__2[<i>5__4], <playerTransform>5__3)) { Debug.Log((object)("Skipping player-related transform: " + ((Object)<transforms>5__2[<i>5__4]).name)); } else if (!((Object)((Component)<transforms>5__2[<i>5__4]).gameObject).name.Contains("FirstRoom") && !((Object)((Component)<transforms>5__2[<i>5__4]).gameObject).name.Contains("OutOfBounds")) { if ((Object)(object)((Component)<transforms>5__2[<i>5__4]).gameObject.GetComponent<RectTransform>() != (Object)null) { Debug.Log((object)("Skipping RectTransform: " + ((Object)<transforms>5__2[<i>5__4]).name)); } else { if (!((Object)(object)((Component)<transforms>5__2[<i>5__4]).gameObject.GetComponentInChildren<RectTransform>(true) != (Object)null)) { <randomIndex>5__5 = Random.Range(<i>5__4, <transforms>5__2.Count); while (<i>5__4 == <randomIndex>5__5 || <>4__this.IsChildOfPlayer(<transforms>5__2[<randomIndex>5__5], <playerTransform>5__3) || (Object)(object)((Component)<transforms>5__2[<i>5__4]).gameObject.GetComponent<RectTransform>() != (Object)null || ((Object)((Component)<transforms>5__2[<i>5__4]).gameObject).name.Contains("FirstRoom") || ((Object)((Component)<transforms>5__2[<i>5__4]).gameObject).name.Contains("OutOfBounds")) { <randomIndex>5__5 = Random.Range(<i>5__4, <transforms>5__2.Count); } if (<i>5__4 != <randomIndex>5__5) { try { <tempPosition>5__6 = <transforms>5__2[<i>5__4].localScale; <transforms>5__2[<i>5__4].localScale = <transforms>5__2[<randomIndex>5__5].localScale; <transforms>5__2[<randomIndex>5__5].localScale = <tempPosition>5__6; } catch (Exception) { throw; } } goto IL_037f; } Debug.Log((object)("Skipping RectTransform: " + ((Object)<transforms>5__2[<i>5__4]).name)); } } } catch (Exception) { throw; } goto IL_03ab; } return false; IL_037f: if (<i>5__4 % 10 == 0) { <>2__current = null; <>1__state = 1; return true; } goto IL_03ab; IL_03ab: <i>5__4++; goto IL_03bd; } 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 const string MyGUID = "com.banana.ULTRARandomizer"; private const string PluginName = "ULTRARandomizer"; private const string VersionString = "1.0.0"; private static readonly Harmony Harmony = new Harmony("com.michi.ULTRARandomizer"); public static ManualLogSource Log = new ManualLogSource("ULTRARandomizer"); public static List<Material> materials = new List<Material>(); public static GameObject earthmover; public static GameObject leviathan; public static int currentMaxHealth; public static List<SpawnableObject> enemies = new List<SpawnableObject>(); public static List<Nail> nails = new List<Nail>(); public static List<RevolverBeam> Beams = new List<RevolverBeam>(); public static List<ExplosionController> explosions = new List<ExplosionController>(); public static List<AudioClip> Clips = new List<AudioClip>(); public static List<Projectile> projectiles = new List<Projectile>(); public static List<Font> fonts = new List<Font>(); public static List<TMP_FontAsset> fontsAssets = new List<TMP_FontAsset>(); public static List<string> lesTexts = new List<string>(); public static List<Sprite> lesImages = new List<Sprite>(); public static List<AudioClip> cleanClips = new List<AudioClip>(); public static List<AudioClip> bossClips = new List<AudioClip>(); public static List<AudioClip> battleClips = new List<AudioClip>(); public static List<AudioClip> targetClips = new List<AudioClip>(); public static bool RandomizeBeams; public static bool RandomizeEnemies; public static bool RandomizeExplosions; public static bool RandomizeProj; private List<string> FileNames = new List<string>(); private string resourceName = "UltraChaos.Keys.Sounds.txt"; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading UltraChaos..."); Fields.SetFields(); Harmony.PatchAll(); Log = ((BaseUnityPlugin)this).Logger; SceneManager.sceneLoaded += SceneManager_sceneLoaded; Assembly executingAssembly = Assembly.GetExecutingAssembly(); Object obj = AssetBundle.LoadFromStream(executingAssembly.GetManifestResourceStream("UltraChaos.Bundles.earthmover")).LoadAllAssets()[0]; earthmover = (GameObject)(object)((obj is GameObject) ? obj : null); Object obj2 = AssetBundle.LoadFromStream(executingAssembly.GetManifestResourceStream("UltraChaos.Bundles.leviathan")).LoadAllAssets()[0]; leviathan = (GameObject)(object)((obj2 is GameObject) ? obj2 : null); if ((Object)(object)earthmover == (Object)null || (Object)(object)leviathan == (Object)null) { Debug.Log((object)"Something went wrong with the asset bundles!"); } Debug.Log((object)"UltraChaos loaded!"); } [IteratorStateMachine(typeof(<LoadPlushies>d__1))] public IEnumerator LoadPlushies() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadPlushies>d__1(0) { <>4__this = this }; } public static void CopyOverNecessaryStuff(EnemyIdentifier basething, EnemyIdentifier clonedEnemy) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Invalid comparison between Unknown and I4 //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Invalid comparison between Unknown and I4 //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Invalid comparison between Unknown and I4 //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Invalid comparison between Unknown and I4 //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Invalid comparison between Unknown and I4 //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Expected O, but got Unknown CollectionExtensions.AddRangeToArray<GameObject>(clonedEnemy.activateOnDeath, basething.activateOnDeath); if ((int)clonedEnemy.enemyType != 12) { clonedEnemy.sandified = basething.sandified; } if ((int)clonedEnemy.enemyType != 36) { clonedEnemy.puppet = basething.puppet; } clonedEnemy.target = basething.target; clonedEnemy.usingDoor = basething.usingDoor; ((Component)clonedEnemy).transform.parent = ((Component)basething).transform.parent; clonedEnemy.madness = basething.madness; clonedEnemy.ignorePlayer = basething.ignorePlayer; clonedEnemy.ignoredByEnemies = basething.ignoredByEnemies; clonedEnemy.attackEnemies = basething.attackEnemies; clonedEnemy.dontCountAsKills = basething.dontCountAsKills; if ((int)clonedEnemy.enemyType == 12) { clonedEnemy.sandified = true; } if ((int)basething.enemyType == 21 && (int)clonedEnemy.enemyType == 21) { Idol component = ((Component)basething).GetComponent<Idol>(); ((Component)clonedEnemy).GetComponent<Idol>().target = component.target; ((Component)clonedEnemy).GetComponent<Idol>().target.Bless(false); } else if ((int)basething.enemyType == 21 && (int)clonedEnemy.enemyType != 21) { Idol component2 = ((Component)basething).GetComponent<Idol>(); component2.target.Unbless(false); } if (!basething.dontCountAsKills) { ActivateNextWave componentInParent = ((Component)basething).GetComponentInParent<ActivateNextWave>(); if ((Object)(object)componentInParent != (Object)null) { ((Component)clonedEnemy).transform.parent = ((Component)componentInParent).transform; } } if (Object.op_Implicit((Object)(object)((Component)clonedEnemy).GetComponent<Machine>())) { ((Component)clonedEnemy).GetComponent<Machine>().dontDie = false; } if (basething.isBoss || Object.op_Implicit((Object)(object)((Component)basething).GetComponent<BossHealthBar>())) { ((Component)clonedEnemy).gameObject.AddComponent<BossHealthBar>(); } if ((int)clonedEnemy.enemyType == 12) { clonedEnemy.enemyScanner = new EnemyScanner(clonedEnemy); if (clonedEnemy.enemyScanner == null) { Debug.Log((object)"Something went wrong!!!!"); } } } public static void CopyOverNecessaryStuffBeam(RevolverBeam basething, RevolverBeam clonedBeam) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) clonedBeam.target = basething.target; clonedBeam.alternateStartPoint = basething.alternateStartPoint; clonedBeam.sourceWeapon = basething.sourceWeapon; clonedBeam.ignoreEnemyType = basething.ignoreEnemyType; clonedBeam.attributes = basething.attributes; clonedBeam.beamType = basething.beamType; } private bool IsNumberNumberFormat(string name) { string pattern = "\\d+-\\d+"; return Regex.IsMatch(name, pattern); } public static void ChangeSpawned(EnemySpawnRadius spawner, EnemyIdentifier toSwapwith, EnemyIdentifier original) { FieldInfo field = ((object)spawner).GetType().GetField("spawnedObjects", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field2 = ((object)spawner).GetType().GetField("currentEnemies", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { List<GameObject> list = (List<GameObject>)field.GetValue(spawner); List<EnemyIdentifier> list2 = (List<EnemyIdentifier>)field2.GetValue(spawner); Log.LogInfo((object)list2.Count); if (list2.Contains(original)) { list2.Add(toSwapwith); list2.Remove(original); field2.SetValue(spawner, list2); Log.LogInfo((object)(List<EnemyIdentifier>)field2.GetValue(spawner)); } } } private void GetEnemies() { if (enemies.Count == 0) { ((MonoBehaviour)this).StartCoroutine(LoadTypeAsync()); } } public static bool IsGameplayScene() { string[] source = new string[6] { "Intro", "Bootstrap", "Main Menu", "Level 2-S", "Intermission1", "Intermission2" }; return !source.Contains(SceneHelper.CurrentScene); } private void GetAudio() { List<AudioClip> source = Resources.FindObjectsOfTypeAll<AudioClip>().ToList(); IEnumerable<AudioClip> source2 = source.Where((AudioClip clip) => IsNumberNumberFormat(((Object)clip).name)); targetClips.AddRange(source2.Where((AudioClip clip) => !targetClips.Contains(clip))); } private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1) { //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) if (!IsGameplayScene()) { return; } ((MonoBehaviour)this).StopAllCoroutines(); if (!Fields.globalEnabled.value) { return; } if (cleanClips.Count == 0 && bossClips.Count == 0 && battleClips.Count == 0) { ((MonoBehaviour)this).StartCoroutine(LoadPlushies()); } if (Object.op_Implicit((Object)(object)MonoSingleton<MusicManager>.Instance) && cleanClips.Count != 0 && bossClips.Count != 0 && battleClips.Count != 0 && Fields.ChangeMusic.value) { MonoSingleton<MusicManager>.Instance.cleanTheme.clip = cleanClips[Random.Range(0, cleanClips.Count)]; MonoSingleton<MusicManager>.Instance.bossTheme.clip = bossClips[Random.Range(0, bossClips.Count)]; MonoSingleton<MusicManager>.Instance.battleTheme.clip = battleClips[Random.Range(0, battleClips.Count)]; } if (Object.op_Implicit((Object)(object)MonoSingleton<CheatsManager>.Instance)) { MonoSingleton<CheatsManager>.Instance.RegisterCheat((ICheat)(object)new RandomizeEnemiesCheat(), "UltraRandomizer"); MonoSingleton<CheatsManager>.Instance.RegisterCheat((ICheat)(object)new RandomizeBeamsCheat(), "UltraRandomizer"); MonoSingleton<CheatsManager>.Instance.RegisterCheat((ICheat)(object)new RandomizeExpCheat(), "UltraRandomizer"); MonoSingleton<CheatsManager>.Instance.RegisterCheat((ICheat)(object)new RandomizeProjCheat(), "UltraRandomizer"); } ReplaceItems(); GetEnemies(); nails = Resources.FindObjectsOfTypeAll<Nail>().ToList(); nails.Distinct(); projectiles = Resources.FindObjectsOfTypeAll<Projectile>().ToList(); projectiles.Distinct(); if (Fields.randomizeMats.value) { ChangeMats(); } if (Fields.randomizeMeshes.value) { ChangeMeshes(); } if (Fields.doPlayerHealth.value) { ChangePlayerHealth(); } if (Fields.DoChangeEnemyHealth.value) { ChangeEnemyHealth(); } ChangeImages(); ChangeText(); Beams = Resources.FindObjectsOfTypeAll<RevolverBeam>().ToList(); Beams.Distinct(); explosions = Resources.FindObjectsOfTypeAll<ExplosionController>().ToList(); explosions.Distinct(); explosions.RemoveAll((ExplosionController biem) => ((Object)biem).name.ToLower().Contains("fire")); if (Fields.randomizeSounds.value) { Clips = Resources.FindObjectsOfTypeAll<AudioClip>().ToList(); Clips.Distinct(); AudioSource[] array = Resources.FindObjectsOfTypeAll<AudioSource>(); AudioSource[] array2 = array; foreach (AudioSource val in array2) { val.clip = Clips[Random.Range(0, Clips.Count)]; } } if (Fields.shufflepos.value) { ((MonoBehaviour)this).StartCoroutine(ShuffleTransforms(arg0)); } if (Fields.shufflescale.value) { ((MonoBehaviour)this).StartCoroutine(ShuffleTransformsScale(arg0)); } } [IteratorStateMachine(typeof(<ShuffleTransforms>d__10))] private IEnumerator ShuffleTransforms(Scene arg0) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ShuffleTransforms>d__10(0) { <>4__this = this, arg0 = arg0 }; } [IteratorStateMachine(typeof(<ShuffleTransformsScale>d__11))] private IEnumerator ShuffleTransformsScale(Scene arg0) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ShuffleTransformsScale>d__11(0) { <>4__this = this, arg0 = arg0 }; } private bool IsChildOfPlayer(Transform t, Transform playerTransform) { try { if ((Object)(object)t == (Object)(object)playerTransform) { return true; } if ((Object)(object)((Component)t).gameObject.GetComponent<Camera>() != (Object)null) { return true; } Transform parent = t.parent; while ((Object)(object)parent != (Object)null) { if ((Object)(object)parent == (Object)(object)playerTransform) { return true; } parent = parent.parent; } return false; } catch (Exception) { return true; } } private void ReplaceItems() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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) if (!Fields.ChangeItems.value) { return; } List<ItemIdentifier> list = Resources.FindObjectsOfTypeAll<ItemIdentifier>().ToList(); Scene activeScene = SceneManager.GetActiveScene(); List<ItemIdentifier> list2 = new List<ItemIdentifier>(); foreach (ItemIdentifier item in list) { if (((Component)item).gameObject.scene == activeScene) { list2.Add(item); } } foreach (ItemIdentifier item2 in list2) { try { ItemIdentifier val = Object.Instantiate<ItemIdentifier>(list[Random.Range(0, list.Count)], ((Component)item2).transform.position, ((Component)item2).transform.rotation); val.pickedUp = item2.pickedUp; val.infiniteSource = item2.infiniteSource; val.onPickUp = item2.onPickUp; val.onPutDown = item2.onPutDown; val.ipz = item2.ipz; val.itemType = item2.itemType; Object.Destroy((Object)(object)((Component)item2).gameObject); } catch (Exception) { throw; } } } public static void ChangeImages() { lesImages.AddRange(Resources.FindObjectsOfTypeAll<Sprite>()); if (!Fields.randomizeImages.value) { return; } Image[] array = Resources.FindObjectsOfTypeAll<Image>(); Image[] array2 = array; foreach (Image val in array2) { try { val.sprite = lesImages[Random.Range(0, lesImages.Count)]; } catch (Exception) { throw; } } } public static void ChangeText() { lesTexts.AddRange(GetTexts()); lesTexts = lesTexts.Distinct().ToList(); ChangeTMP(); ChangeNormalText(); } public static List<string> GetTexts() { //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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI[] array = Resources.FindObjectsOfTypeAll<TextMeshProUGUI>(); List<string> list = new List<string>(); TextMeshProUGUI[] array2 = array; Scene scene; foreach (TextMeshProUGUI val in array2) { scene = ((Component)val).gameObject.scene; if (!(((Scene)(ref scene)).name == "DontDestroyOnLoad")) { fontsAssets.Add(((TMP_Text)val).font); list.Add(((TMP_Text)val).text); } } Text[] array3 = Resources.FindObjectsOfTypeAll<Text>(); Text[] array4 = array3; foreach (Text val2 in array4) { scene = ((Component)val2).gameObject.scene; if (!(((Scene)(ref scene)).name == "DontDestroyOnLoad")) { fonts.Add(val2.font); list.Add(val2.text); } } return list; } public static void ChangeTMP() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI[] array = Resources.FindObjectsOfTypeAll<TextMeshProUGUI>(); for (int i = 0; i < array.Length; i++) { try { Scene scene = ((Component)array[i]).gameObject.scene; if (!(((Scene)(ref scene)).name == "DontDestroyOnLoad")) { if (Fields.randomizeText.value) { ((TMP_Text)array[i]).text = lesTexts[Random.Range(0, lesTexts.Count)]; } if (Fields.randomizeFonts.value) { ((TMP_Text)array[i]).font = fontsAssets[Random.Range(0, fontsAssets.Count)]; } } } catch (Exception) { throw; } } } public static void ChangeNormalText() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Text[] array = Resources.FindObjectsOfTypeAll<Text>(); for (int i = 0; i < array.Length; i++) { try { Scene scene = ((Component)array[i]).gameObject.scene; if (!(((Scene)(ref scene)).name == "DontDestroyOnLoad")) { if (Fields.randomizeText.value) { array[i].text = lesTexts[Random.Range(0, lesTexts.Count)]; } if (Fields.randomizeFonts.value) { array[i].font = fonts[Random.Range(0, fonts.Count)]; } } } catch (Exception) { throw; } } } public static void ChangeMats() { Material[] array = Resources.FindObjectsOfTypeAll<Material>(); Renderer[] array2 = Resources.FindObjectsOfTypeAll<Renderer>(); materials.AddRange(array); Renderer[] array3 = array2; foreach (Renderer val in array3) { if (Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent<ParticleSystem>()) || ((Component)val).gameObject.layer == 19) { continue; } try { Material val2 = materials[Random.Range(0, array.Length)]; Material[] array4 = (Material[])(object)new Material[val.materials.Length]; for (int j = 0; j < array4.Length; j++) { array4[j] = val2; } val.materials = array4; val.material = val2; } catch (Exception) { throw; } } } public static void ChangeMeshes() { MeshFilter[] array = Resources.FindObjectsOfTypeAll<MeshFilter>(); Mesh[] array2 = Resources.FindObjectsOfTypeAll<Mesh>(); MeshFilter[] array3 = array; foreach (MeshFilter val in array3) { if (!Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent<ParticleSystem>()) && ((Component)val).gameObject.layer != 19) { val.mesh = array2[Random.Range(0, array2.Length)]; } } } public void ChangePlayerHealth() { MonoSingleton<NewMovement>.Instance.hp = (int)Random.Range(Fields.minHealth.value, Fields.maxHealth.value); currentMaxHealth = MonoSingleton<NewMovement>.Instance.hp; } public void ChangeEnemyHealth() { EnemyIdentifier[] array = Resources.FindObjectsOfTypeAll<EnemyIdentifier>(); EnemyIdentifier[] array2 = array; foreach (EnemyIdentifier val in array2) { float health = val.Health; Log.LogInfo((object)val.Health); val.healthBuff = true; val.healthBuffModifier = CalculateHealthBuffModifier(val.health, 1f, Random.Range(0.01f, health)); Log.LogInfo((object)val.health); } } private float CalculateHealthBuffModifier(float enemyHealth, float num, float totalHealth) { return totalHealth / (enemyHealth * ((num > 1f) ? (0.75f + num / 4f) : num)); } public static void LoadRandomScene() { int num = Random.Range(1, 29); float num2 = Random.Range(0, 100); if (num2 < 82.86f) { SceneHelper.LoadScene(GetMissionName.GetSceneName(num), false); } else if (num2 < 88.57f) { int num3 = Random.Range(666, 668); SceneHelper.LoadScene(GetMissionName.GetSceneName(num3), false); } else { MonoSingleton<OptionsManager>.Instance.ChangeLevelAbrupt(GetSecretMissionName()); } } [IteratorStateMachine(typeof(<LoadTypeAsync>d__25))] public IEnumerator LoadTypeAsync() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadTypeAsync>d__25(0) { <>4__this = this }; } private static string GetSecretMissionName() { string[] array = new string[6] { "Level 0-S", "Level 1-S", "Level 2-S", "Level 4-S", "Level 5-S", "Level 7-S" }; int num = Random.Range(0, array.Length); return array[num]; } } public class CanExecute { public static bool CanExecuteText() { if (!Fields.globalEnabled.value) { return false; } if (!Fields.randomizeText.value) { return false; } if (UltraChaosPlugin.lesTexts.Count <= 0) { return false; } return true; } public static bool CanExecuteMusic() { if (!Fields.globalEnabled.value) { return false; } if (!Fields.ChangeMusic.value) { return false; } return true; } public static bool CanExecuteAudio() { if (!Fields.globalEnabled.value) { return false; } if (!Fields.randomizeSounds.value) { return false; } if (UltraChaosPlugin.Clips.Count <= 0) { return false; } return true; } public static bool CanExecuteLevel() { if (!Fields.globalEnabled.value) { return false; } if (!Fields.randomizeLevelOnExit.value) { return false; } return true; } public static bool CanExecuteEnemy() { if (!Fields.globalEnabled.value) { return false; } if (!UltraChaosPlugin.RandomizeEnemies) { return false; } return true; } } } namespace UltraChaos.PluginConfiguratorCOnfig { public class Fields { public static BoolField DoChangeEnemyHealth; public static BoolField RandomDamage; public static BoolField doPlayerHealth; public static BoolField randomizeMats; public static BoolField randomizeMeshes; public static BoolField randomizeText; public static BoolField randomizeSounds; public static BoolField randomizeFonts; public static BoolField dontKillYourself; public static BoolField ChangeMusic; public static BoolField ChangeItems; public static BoolField ChangeNails; public static BoolField RandomizeWeapons; public static BoolField weaponOrder; public static BoolField shufflepos; public static BoolField shufflescale; public static BoolField globalEnabled; public static BoolField randomizeImages; public static BoolField randomizeLevelOnExit; public static FloatField minHealth; public static FloatField maxHealth; public static PluginConfigurator rootPanel; public static ConfigPanel configPanel; public static ConfigPanel BeamsPanel; public static ConfigPanel ProjPanel; public static ConfigPanel ExplosionPanel; public static Dictionary<BoolField, SpawnableObject> enemies = new Dictionary<BoolField, SpawnableObject>(); public static Dictionary<BoolField, RevolverBeam> beams = new Dictionary<BoolField, RevolverBeam>(); public static Dictionary<BoolField, Projectile> projectiles = new Dictionary<BoolField, Projectile>(); public static Dictionary<BoolField, ExplosionController> explosions = new Dictionary<BoolField, ExplosionController>(); public static void SetFields() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Expected O, but got Unknown rootPanel = PluginConfigurator.Create("Randomizer", "com.bananastudio.randomizer"); globalEnabled = new BoolField(rootPanel.rootPanel, "enabled", "field.enabled", true, true); configPanel = new ConfigPanel(rootPanel.rootPanel, "enemy Randomizer", "panel.randomizer"); ConfigHeader val = new ConfigHeader(configPanel, "if an enemy doesnt appear try loading in a level", 24); DoChangeEnemyHealth = new BoolField(rootPanel.rootPanel, "randomize Enemy Health", "field.enemyhealthrandom", false); RandomDamage = new BoolField(rootPanel.rootPanel, "randomize Damage", "field.damagerandomizer", false); AddChaosCategory(new ConfigPanel(rootPanel.rootPanel, "C H A O S", "panel.chaos")); doPlayerHealth = new BoolField(rootPanel.rootPanel, "randomize Player Health", "field.playerhealthrandom", false); minHealth = new FloatField(rootPanel.rootPanel, "minimum health", "field.miniumumhealth", 0f, true); maxHealth = new FloatField(rootPanel.rootPanel, "maximum health", "field.maximumhealth", 100f, true); randomizeLevelOnExit = new BoolField(rootPanel.rootPanel, "randomize level on exit", "field.levelrandomize", false, true); ButtonField val2 = new ButtonField(rootPanel.rootPanel, "go to random level", "button.randomlevel"); ButtonField val3 = new ButtonField(configPanel, "Refresh", "button.refresh"); ButtonField val4 = new ButtonField(configPanel, "Disable All", "button.disable.enemies"); ButtonField val5 = new ButtonField(configPanel, "Enable All", "button.enable.enemies"); val3.onClick += new OnClick(Refresh_onClick); val2.onClick += new OnClick(RandomizeLevel_onClick); val4.onClick += new OnClick(DisableAll); val5.onClick += new OnClick(EnableAll); } private static void DisableAll() { foreach (KeyValuePair<BoolField, SpawnableObject> enemy in enemies) { enemy.Key.value = false; } } private static void EnableAll() { foreach (KeyValuePair<BoolField, SpawnableObject> enemy in enemies) { enemy.Key.value = true; } } private static void RandomizeLevel_onClick() { UltraChaosPlugin.LoadRandomScene(); } public static void AddChaosCategory(ConfigPanel panel) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown randomizeText = new BoolField(panel, "randomize Text", "field.randomizetext", false); randomizeMeshes = new BoolField(panel, "randomize meshes", "field.randomizemeshes", false); randomizeMats = new BoolField(panel, "randomize materials", "field.randomizemats", false); randomizeSounds = new BoolField(panel, "randomize sounds", "field.randomizesounds", false); BeamsPanel = new ConfigPanel(panel, "beam randomizer", "panel.beamrandomizer"); ButtonField val = new ButtonField(BeamsPanel, "refresh", "button.beams.refresh"); val.onClick += new OnClick(RefreshBeams_onClick); ExplosionPanel = new ConfigPanel(panel, "explosion randomizer", "panel.beamrandomizer"); ButtonField val2 = new ButtonField(ExplosionPanel, "refresh", "button.explosions.refresh"); val2.onClick += new OnClick(RefreshExplosions_onClick); randomizeFonts = new BoolField(panel, "randomize Fonts", "field.randomizefonts", false); ProjPanel = new ConfigPanel(panel, "projectile randomizer", "panel.projectilerandomizer"); ButtonField val3 = new ButtonField(ProjPanel, "refresh", "button.proj.refresh"); val3.onClick += new OnClick(RefreshProjs_onClick); dontKillYourself = new BoolField(panel, "dont kill yourself (basically wont change deco proj", "field.nokys", true); randomizeImages = new BoolField(panel, "randomize images", "field.random.images", false, false); ChangeMusic = new BoolField(panel, "randomize music", "field.random.music", false, true); ChangeItems = new BoolField(panel, "randomize items", "field.random.items", false, true); ChangeNails = new BoolField(panel, "randomize nails", "field.random.nails", false, true); RandomizeWeapons = new BoolField(panel, "randomize Weapons", "fields.random.weapons", false, true); weaponOrder = new BoolField(panel, "Random Weapon Order", "fields.random.weaponorder", false, true); shufflepos = new BoolField(panel, "Shuffle Positions", "fields.random.positions", false, true); shufflescale = new BoolField(panel, "Shuffle Scales", "fields.random.scales", false, true); } private static void RefreshExplosions_onClick() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown foreach (ExplosionController explosion in UltraChaosPlugin.explosions) { if (!explosions.ContainsValue(explosion)) { string name = ((Object)((Component)explosion).gameObject).name; BoolField key = new BoolField(ExplosionPanel, name, "field.explosion" + ((Object)explosion).name, true, false); explosions.Add(key, explosion); } } } private static void RefreshProjs_onClick() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown foreach (Projectile projectile in UltraChaosPlugin.projectiles) { if (!projectiles.ContainsValue(projectile)) { string name = ((Object)((Component)projectile).gameObject).name; BoolField key = new BoolField(ProjPanel, name, "field.proj" + ((Object)projectile).name, true, false); projectiles.Add(key, projectile); } } } private static void RefreshBeams_onClick() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown foreach (RevolverBeam beam in UltraChaosPlugin.Beams) { if (!beams.ContainsValue(beam)) { string name = ((Object)((Component)beam).gameObject).name; BoolField key = new BoolField(BeamsPanel, name, "field.beam" + ((Object)beam).name, true, false); beams.Add(key, beam); } } } private static void Refresh_onClick() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown foreach (SpawnableObject enemy in UltraChaosPlugin.enemies) { if (!enemies.ContainsValue(enemy)) { string objectName = enemy.objectName; bool flag = ((!(enemy.objectName.ToUpper() == "EARTHMOVER") && !(enemy.objectName.ToUpper() == "LEVIATHAN")) ? true : false); BoolField key = new BoolField(configPanel, objectName, "field.enemy" + ((Object)enemy).name, flag, false); enemies.Add(key, enemy); } } } } } namespace UltraChaos.Patches { [HarmonyPatch(typeof(AudioSource), "PlayOneShot", new Type[] { typeof(AudioClip) })] public class RandomSoundPlayOneShot { private static bool Prefix(ref AudioSource __instance, ref AudioClip clip) { if (!CanExecute.CanExecuteAudio()) { return false; } if ((Object)(object)clip == (Object)null) { Debug.LogWarning((object)"Original PlayOneShot clip is null. Skipping randomization."); return true; } if (!UltraChaosPlugin.Clips.Contains(clip)) { UltraChaosPlugin.Clips.Add(clip); } float length = clip.length; Debug.Log((object)$"Original PlayOneShot clip length: {length}"); if (UltraChaosPlugin.Clips == null || UltraChaosPlugin.Clips.Count == 0) { Debug.LogWarning((object)"No clips available for randomization. Skipping."); return true; } AudioClip val = UltraChaosPlugin.Clips[Random.Range(0, UltraChaosPlugin.Clips.Count)]; if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"Randomized PlayOneShot clip is null. Skipping."); return true; } clip = val; Debug.Log((object)("Randomized PlayOneShot clip selected: " + ((Object)val).name)); float length2 = val.length; if (length2 > 0f) { __instance.pitch = length / length2; Debug.Log((object)$"PlayOneShot pitch adjusted to: {__instance.pitch}"); } else { Debug.LogWarning((object)"Randomized PlayOneShot clip has zero length. Skipping pitch adjustment."); } return true; } } [HarmonyPatch(typeof(AudioSource), "PlayHelper")] public class RandomSoundPlayHelper { private static bool Prefix(AudioSource source) { if (!CanExecute.CanExecuteAudio()) { return false; } if (!UltraChaosPlugin.Clips.Contains(source.clip)) { UltraChaosPlugin.Clips.Add(source.clip); } float length = source.clip.length; AudioClip val2 = (source.clip = UltraChaosPlugin.Clips[Random.Range(0, UltraChaosPlugin.Clips.Count)]); float length2 = val2.length; if (length2 > 0f) { source.pitch = length / length2; } return true; } } [HarmonyPatch(typeof(AudioSource), "PlayOneShot", new Type[] { typeof(AudioClip), typeof(float) })] public class RandomSoundPlayOneShotWithVolume { private static bool Prefix(ref AudioSource __instance, ref AudioClip clip, ref float volumeScale) { if (!CanExecute.CanExecuteAudio()) { return false; } if ((Object)(object)clip == (Object)null) { Debug.LogWarning((object)"Original PlayOneShot clip is null. Skipping randomization."); return true; } if (!UltraChaosPlugin.Clips.Contains(clip)) { UltraChaosPlugin.Clips.Add(clip); } float length = clip.length; Debug.Log((object)$"Original PlayOneShot clip length: {length}"); if (UltraChaosPlugin.Clips == null || UltraChaosPlugin.Clips.Count == 0) { Debug.LogWarning((object)"No clips available for randomization. Skipping."); return true; } AudioClip val = UltraChaosPlugin.Clips[Random.Range(0, UltraChaosPlugin.Clips.Count)]; if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"Randomized PlayOneShot clip is null. Skipping."); return true; } clip = val; Debug.Log((object)("Randomized PlayOneShot clip selected: " + ((Object)val).name)); float length2 = val.length; if (length2 > 0f) { __instance.pitch = length / length2; Debug.Log((object)$"PlayOneShot pitch adjusted to: {__instance.pitch}"); } else { Debug.LogWarning((object)"Randomized PlayOneShot clip has zero length. Skipping pitch adjustment."); } return true; } } [HarmonyPatch(typeof(AudioSource), "Play", new Type[] { })] public class RandomSound { private static bool Prefix(ref AudioSource __instance) { if (!CanExecute.CanExecuteAudio()) { return false; } if (!UltraChaosPlugin.Clips.Contains(__instance.clip)) { UltraChaosPlugin.Clips.Add(__instance.clip); } float length = __instance.clip.length; AudioClip val = UltraChaosPlugin.Clips[Random.Range(0, UltraChaosPlugin.Clips.Count)]; __instance.clip = val; float length2 = val.length; if (length2 > 0f) { __instance.pitch = length / length2; } return true; } } [HarmonyPatch(typeof(EnemySimplifier))] internal class EnemySimplifierMaterial { [HarmonyPatch("ChangeMaterialNew")] private static bool Prefix(MaterialState stateToTarget, Material newMaterial) { if (!Fields.globalEnabled.value) { return true; } if (!Fields.randomizeMats.value) { return true; } newMaterial = UltraChaosPlugin.materials[Random.Range(0, UltraChaosPlugin.materials.Count)]; return false; } } [HarmonyPatch(typeof(EnemySpawnRadius), "SpawnEnemy")] internal class SpawnEnemiesRandom { private static bool Prefix(ref EnemySpawnRadius __instance, ref List<GameObject> ___spawnedObjects, ref List<EnemyIdentifier> ___currentEnemies, ref float ___cooldown, ref GoreZone ___gz) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) if (!CanExecute.CanExecuteEnemy()) { return true; } RaycastHit val2 = default(RaycastHit); for (int i = 0; i < 3; i++) { List<KeyValuePair<BoolField, SpawnableObject>> list = Fields.enemies.Where((KeyValuePair<BoolField, SpawnableObject> pair) => pair.Key.value).ToList(); if (list.Count == 0) { return true; } int index = Random.Range(0, list.Count); UltraChaosPlugin.Log.LogInfo((object)list.Count); SpawnableObject value = list[index].Value; Vector3 val = new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f)); Vector3 normalized = ((Vector3)(ref val)).normalized; if (!Physics.Raycast(((Component)__instance).transform.position + normalized * Random.Range(__instance.minimumDistance, __instance.maximumDistance), Vector3.down, ref val2, 25f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)))) { continue; } ___cooldown = __instance.spawnCooldown; GameObject val3 = Object.Instantiate<GameObject>(value.gameObject, ((RaycastHit)(ref val2)).point, Quaternion.identity); val3.transform.SetParent(((Component)___gz).transform, true); ___spawnedObjects.Add(val3); EnemyIdentifier componentInChildren = val3.GetComponentInChildren<EnemyIdentifier>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { ((Component)componentInChildren).gameObject.AddComponent<DontRandomize>(); ___currentEnemies.Add(componentInChildren); if (__instance.spawnAsPuppets) { componentInChildren.puppet = true; } } else { ___currentEnemies.Add(null); } val3.SetActive(true); return false; } ___cooldown = 1f; return false; } } [HarmonyPatch(typeof(EnemyIdentifier))] internal class EnemyRandomPatches { [HarmonyPatch("Start")] private static bool Prefix(ref EnemyIdentifier __instance) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) if (!CanExecute.CanExecuteEnemy()) { return true; } if (((Object)((Component)__instance).gameObject).name.EndsWith("Random")) { return true; } if (Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<DontRandomize>())) { return true; } Scene scene = ((Component)__instance).gameObject.scene; if (((Scene)(ref scene)).name == "6e981b1865c649749a610aafc471e198") { return true; } UltraChaosPlugin.Log.LogInfo((object)((Object)((Component)__instance).gameObject).name); List<KeyValuePair<BoolField, SpawnableObject>> list = Fields.enemies.Where((KeyValuePair<BoolField, SpawnableObject> pair) => pair.Key.value).ToList(); SpawnableObject val; if (list.Count == 0) { int index = Random.Range(0, UltraChaosPlugin.enemies.Count); UltraChaosPlugin.Log.LogInfo((object)UltraChaosPlugin.enemies.Count); val = UltraChaosPlugin.enemies[index]; } else { int index2 = Random.Range(0, list.Count); UltraChaosPlugin.Log.LogInfo((object)list.Count); val = list[index2].Value; } GameObject val2 = Object.Instantiate<GameObject>(val.gameObject, ((Component)__instance).transform.position + new Vector3(0f, val.spawnOffset, 0f), ((Component)__instance).gameObject.transform.rotation); EnemyIdentifier val3 = val2.GetComponent<EnemyIdentifier>(); if (val.objectName.ToUpper() == "EARTHMOVER") { EnemyIdentifier[] componentsInChildren = val2.GetComponentsInChildren<EnemyIdentifier>(); EnemyIdentifier[] array = componentsInChildren; foreach (EnemyIdentifier val4 in array) { ((Component)val4).gameObject.AddComponent<DontRandomize>(); } } if (!Object.op_Implicit((Object)(object)val3)) { EnemyIdentifier[] componentsInChildren2 = val2.GetComponentsInChildren<EnemyIdentifier>(true); val3 = ((componentsInChildren2.Length != 0) ? componentsInChildren2[0] : val2.AddComponent<EnemyIdentifier>()); } else if (Object.op_Implicit((Object)(object)val3)) { UltraChaosPlugin.CopyOverNecessaryStuff(__instance, val3); } EnemyIdentifier obj = val3; ((Object)obj).name = ((Object)obj).name + "Random"; Object.Destroy((Object)(object)((Component)__instance).gameObject); UltraChaosPlugin.Log.LogInfo((object)((Object)val3).name); return false; } } [HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")] public class RandoDamageo { public static bool Prefix(ref EnemyIdentifier __instance, ref float multiplier) { if (!Fields.globalEnabled.value) { return true; } if (!Fields.RandomDamage.value) { return true; } multiplier = Random.Range(0f, multiplier * 2f); UltraChaosPlugin.Log.LogInfo((object)multiplier); return true; } } [HarmonyPatch(typeof(BossHealthBar), "Awake")] public class randomBossname { public static bool Prefix(ref BossHealthBar __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (!CanExecute.CanExecuteText()) { return true; } if (string.IsNullOrEmpty(__instance.bossName) && __instance.source != null && !UltraChaosPlugin.lesTexts.Contains(__instance.source.FullName)) { UltraChaosPlugin.lesTexts.Add(__instance.source.FullName); } if (!UltraChaosPlugin.lesTexts.Contains(__instance.bossName)) { UltraChaosPlugin.lesTexts.Add(__instance.bossName); } if (UltraChaosPlugin.lesTexts.Count > 0) { __instance.bossName = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; } return true; } } [HarmonyPatch(typeof(UnlockBestiary), "Start")] public class DestroyBenjamin { public static bool Prefix(ref UnlockBestiary __instance) { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) if (!CanExecute.CanExecuteEnemy()) { return true; } if (((Object)((Component)__instance).gameObject).name != "Main") { return true; } if (((Object)((Component)__instance).gameObject).name.EndsWith("Random")) { return true; } List<KeyValuePair<BoolField, SpawnableObject>> list = Fields.enemies.Where((KeyValuePair<BoolField, SpawnableObject> pair) => pair.Key.value).ToList(); SpawnableObject val; if (list.Count == 0) { int index = Random.Range(0, UltraChaosPlugin.enemies.Count); UltraChaosPlugin.Log.LogInfo((object)UltraChaosPlugin.enemies.Count); val = UltraChaosPlugin.enemies[index]; } else { int index2 = Random.Range(0, list.Count); UltraChaosPlugin.Log.LogInfo((object)list.Count); val = list[index2].Value; } if (val.objectName.ToUpper() == "EARTHMOVER") { return true; } Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0.3906f, -9.6951f, 651.7464f); GameObject val3 = Object.Instantiate<GameObject>(val.gameObject, val2, val.gameObject.transform.rotation); ((Object)val3).name = ((Object)val3).name + "Random"; Object.Destroy((Object)(object)((Component)__instance).gameObject); val3.AddComponent<BossHealthBar>(); return false; } } [HarmonyPatch(typeof(FinalRank))] public class RandomLevelAfterPit { [HarmonyPrefix] [HarmonyPatch("LevelChange")] public static bool GoToRandomLevelChange() { if (!CanExecute.CanExecuteLevel()) { return true; } UltraChaosPlugin.LoadRandomScene(); return false; } [HarmonyPrefix] [HarmonyPatch("RanklessNextLevel")] public static bool GoToRandomLevelRankless() { if (!CanExecute.CanExecuteLevel()) { return true; } UltraChaosPlugin.LoadRandomScene(); return false; } } [HarmonyPatch(typeof(MusicManager))] public class randomoManageroMusico { [HarmonyPatch("OnEnable")] [HarmonyPrefix] public static bool Changethething(ref MusicManager __instance) { if (!CanExecute.CanExecuteMusic()) { return true; } AddAndRandomizeClips(__instance); return true; } private static void AddAndRandomizeClips(MusicManager instance) { RandomizeAudioClip(instance.cleanTheme, UltraChaosPlugin.cleanClips); RandomizeAudioClip(instance.bossTheme, UltraChaosPlugin.bossClips); RandomizeAudioClip(instance.battleTheme, UltraChaosPlugin.battleClips); } private static void RandomizeAudioClip(AudioSource audioSource, List<AudioClip> clips) { if (CanExecute.CanExecuteMusic()) { if ((Object)(object)audioSource != (Object)null && clips.Count > 0) { audioSource.clip = clips[Random.Range(0, clips.Count)]; } else { Debug.LogWarning((object)"AudioSource or AudioClip list is null or empty."); } } } } [HarmonyPatch(typeof(MusicChanger), "Change")] public class RandomMusic { public static bool Prefix(ref MusicChanger __instance) { if (!CanExecute.CanExecuteMusic()) { return true; } AudioClip clean = UltraChaosPlugin.cleanClips[Random.Range(0, UltraChaosPlugin.cleanClips.Count)]; AudioClip battle = UltraChaosPlugin.battleClips[Random.Range(0, UltraChaosPlugin.battleClips.Count)]; AudioClip boss = UltraChaosPlugin.bossClips[Random.Range(0, UltraChaosPlugin.bossClips.Count)]; __instance.clean = clean; __instance.battle = battle; __instance.boss = boss; return true; } } [HarmonyPatch(typeof(NewMovement), "Respawn")] public class PlayerPatches { private static void Postfix() { if (Fields.globalEnabled.value && Fields.doPlayerHealth.value) { MonoSingleton<NewMovement>.Instance.hp = (int)Random.Range(Fields.minHealth.value, Fields.maxHealth.value); UltraChaosPlugin.currentMaxHealth = MonoSingleton<NewMovement>.Instance.hp; } } } [HarmonyPatch] public class RandomDamage { [HarmonyPatch(typeof(NewMovement), "GetHurt")] public static bool Prefix(NewMovement __instance, ref int damage, bool invincible, float scoreLossMultiplier = 1f, bool explosion = false, bool instablack = false, float hardDamageMultiplier = 0.35f, bool ignoreInvincibility = false) { if (!Fields.globalEnabled.value) { return true; } if (!Fields.RandomDamage.value) { return true; } damage = Random.Range(0, __instance.hp); return true; } [HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")] [HarmonyPrefix] public static bool PrefixENemy(EnemyIdentifier __instance, ref float multiplier) { if (!Fields.globalEnabled.value) { return true; } if (!Fields.RandomDamage.value) { return true; } multiplier = Random.Range(0f, __instance.health); return true; } } [HarmonyPatch(typeof(NewMovement), "GetHealth")] public class CheckPatch { private static int HealthBefore; private static bool Prefix(ref NewMovement __instance, int health) { if (!Fields.globalEnabled.value) { return true; } if (!Fields.doPlayerHealth.value) { return true; } HealthBefore = __instance.hp; return true; } private static void Postfix(int health) { if (Fields.globalEnabled.value && Fields.doPlayerHealth.value) { if (HealthBefore + health <= UltraChaosPlugin.currentMaxHealth) { NewMovement instance = MonoSingleton<NewMovement>.Instance; instance.hp += health; } if (MonoSingleton<NewMovement>.Instance.hp > UltraChaosPlugin.currentMaxHealth) { MonoSingleton<NewMovement>.Instance.hp = UltraChaosPlugin.currentMaxHealth; } } } } [HarmonyPatch(typeof(HudMessageReceiver), "ShowHudMessage")] public class RandomHudMessage { public static void Postfix(ref HudMessageReceiver __instance) { if (CanExecute.CanExecuteText()) { UltraChaosPlugin.Log.LogInfo((object)"Prefix HudMessage"); UltraChaosPlugin.Log.LogInfo((object)("Prefix HudMessage " + __instance.text.text)); if (!UltraChaosPlugin.lesTexts.Contains(__instance.text.text)) { UltraChaosPlugin.lesTexts.Add(__instance.text.text); } __instance.text.text = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; } } } [HarmonyPatch(typeof(SubtitleController), "DisplaySubtitle", new Type[] { typeof(string), typeof(AudioSource), typeof(bool) })] public class RandoSubtitle { public static bool Prefix(ref Transform ___container, ref Subtitle ___subtitleLine, ref Subtitle ___previousSubtitle, ref SubtitleController __instance, string caption, AudioSource audioSource = null, bool ignoreSetting = false) { if (!CanExecute.CanExecuteText()) { return true; } UltraChaosPlugin.Log.LogInfo((object)caption); if (!UltraChaosPlugin.lesTexts.Contains(caption)) { UltraChaosPlugin.lesTexts.Add(caption); } caption = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; UltraChaosPlugin.Log.LogInfo((object)caption); Transform val = ___container; Subtitle val2 = ___subtitleLine; Subtitle val3 = ___previousSubtitle; Subtitle val4 = Object.Instantiate<Subtitle>(val2, val, true); ((Component)val4).GetComponentInChildren<TMP_Text>().text = caption; if ((Object)(object)audioSource != (Object)null) { val4.distanceCheckObject = audioSource; } ((Component)val4).gameObject.SetActive(true); if (!Object.op_Implicit((Object)(object)val3)) { val4.ContinueChain(); } else { val3.nextInChain = val4; } val3 = val4; return false; } } [HarmonyPatch(typeof(StyleHUD), "GetLocalizedName")] public class RandomStyleName { public static bool Prefix(ref string __result) { if (!CanExecute.CanExecuteText()) { return true; } __result = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; return false; } } [HarmonyPatch(typeof(HudMessage), "PlayMessage")] public class RandomHudMessagePlay { public static bool Prefix(ref HudMessage __instance) { if (!CanExecute.CanExecuteText()) { return true; } UltraChaosPlugin.Log.LogInfo((object)"Prefix HudMessage"); UltraChaosPlugin.Log.LogInfo((object)("Prefix HudMessage " + __instance.message)); if (!UltraChaosPlugin.lesTexts.Contains(__instance.message)) { UltraChaosPlugin.lesTexts.Add(__instance.message); } __instance.message = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; UltraChaosPlugin.Log.LogInfo((object)("Prefix HudMessage " + __instance.message2)); if (!UltraChaosPlugin.lesTexts.Contains(__instance.message2)) { UltraChaosPlugin.lesTexts.Add(__instance.message2); } __instance.message2 = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; return true; } } [HarmonyPatch(typeof(CheatsManager), "UpdateCheatState", new Type[] { typeof(CheatMenuItem), typeof(ICheat) })] public class RandomCheatNames { public static void Postfix(CheatMenuItem item, ICheat cheat) { if (CanExecute.CanExecuteText()) { if (!UltraChaosPlugin.lesTexts.Contains(item.longName.text)) { UltraChaosPlugin.lesTexts.Add(item.longName.text); } item.longName.text = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; } } } [HarmonyPatch(typeof(CheatBinds), "ResolveCheatKey")] public class RandomCheatNamesInfo { public static bool Prefix(ref string __result, string cheatIdentifier) { if (!CanExecute.CanExecuteText()) { return true; } __result = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; return false; } } [HarmonyPatch(typeof(LevelNamePopup), "NameAppear")] public class RandomLevelPopUP { public static bool Prefix(ref string ___layerString, ref string ___nameString, ref LevelNamePopup __instance) { if (!CanExecute.CanExecuteText()) { return true; } string item = ___layerString; ___nameString = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; ___layerString = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; string item2 = ___nameString; if (!UltraChaosPlugin.lesTexts.Contains(item)) { UltraChaosPlugin.lesTexts.Add(item); } if (!UltraChaosPlugin.lesTexts.Contains(item2)) { UltraChaosPlugin.lesTexts.Add(item2); } item = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; item2 = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; return true; } } [HarmonyPatch(typeof(ScanningStuff), "ScanBook")] public class RandomBookText { public static void Postfix(ref TMP_Text ___readingText, ref ScanningStuff __instance, string text, bool noScan, int instanceId) { if (CanExecute.CanExecuteText()) { if (!UltraChaosPlugin.lesTexts.Contains(text)) { UltraChaosPlugin.lesTexts.Add(text); } TMP_Text val = ___readingText; val.text = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; } } } [HarmonyPatch(typeof(EnemyInfoPage), "DisplayInfo", new Type[] { typeof(SpawnableObject) })] public class RandomInfo { public static void Postfix(ref TMP_Text ___enemyPageContent, ref TMP_Text ___enemyPageTitle, ref EnemyInfoPage __instance, SpawnableObject source) { if (CanExecute.CanExecuteText()) { if (!UltraChaosPlugin.lesTexts.Contains(source.description)) { UltraChaosPlugin.lesTexts.Add(source.description); } TMP_Text val = ___enemyPageContent; val.text = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; TMP_Text val2 = ___enemyPageTitle; val2.text = UltraChaosPlugin.lesTexts[Random.Range(0, UltraChaosPlugin.lesTexts.Count)]; } } } [HarmonyPatch(typeof(GunControl), "Start")] public class RandomWeaponOrder { public static void Postfix(GunControl __instance) { if (!Fields.globalEnabled.value || !Fields.weaponOrder.value) { return; } if ((Object)(object)__instance == (Object)null) { return; } List<GameObject> list = new List<GameObject>(); list.AddRange(__instance.slot1); list.AddRange(__instance.slot2); list.AddRange(__instance.slot3); list.AddRange(__instance.slot4); list.AddRange(__instance.slot5); list.AddRange(__instance.slot6); Random rng = new Random(); list = list.OrderBy((GameObject x) => rng.Next()).ToList(); __instance.slot1.Clear(); __instance.slot2.Clear(); __instance.slot3.Clear(); __instance.slot4.Clear(); __instance.slot5.Clear(); __instance.slot6.Clear(); for (int i = 0; i < list.Count; i++) { switch (i % 6) { case 0: __instance.slot1.Add(list[i]); break; case 1: __instance.slot2.Add(list[i]); break; case 2: __instance.slot3.Add(list[i]); break; case 3: __instance.slot4.Add(list[i]); break; case 4: __instance.slot5.Add(list[i]); break; case 5: __instance.slot6.Add(list[i]); break; } } __instance.slots.Clear(); __instance.slots.Add(__instance.slot1); __instance.slots.Add(__instance.slot2); __instance.slots.Add(__instance.slot3); __instance.slots.Add(__instance.slot4); __instance.slots.Add(__instance.slot5); __instance.slots.Add(__instance.slot6); } } [HarmonyPatch(typeof(RevolverBeam), "Start")] public class RandomBeam { private static bool Prefix(ref RevolverBeam __instance) { //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) if (!Fields.globalEnabled.value) { return true; } if (!UltraChaosPlugin.RandomizeBeams) { return true; } if (((Object)((Component)__instance).gameObject).name.EndsWith("Random")) { return true; } List<KeyValuePair<BoolField, RevolverBeam>> list = Fields.beams.Where((KeyValuePair<BoolField, RevolverBeam> pair) => pair.Key.value).ToList(); RevolverBeam val; if (list.Count == 0) { int index = Random.Range(0, UltraChaosPlugin.Beams.Count); UltraChaosPlugin.Log.LogInfo((object)UltraChaosPlugin.Beams.Count); val = UltraChaosPlugin.Beams[index]; } else { int index2 = Random.Range(0, list.Count); UltraChaosPlugin.Log.LogInfo((object)list.Count); val = list[index2].Value; } UltraChaosPlugin.Log.LogInfo((object)UltraChaosPlugin.enemies.Count); RevolverBeam val2 = Object.Instantiate<RevolverBeam>(val, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation); ((Object)val2).name = ((Object)val2).name + "Random"; UltraChaosPlugin.CopyOverNecessaryStuffBeam(__instance, val2); Object.Destroy((Object)(object)((Component)__instance).gameObject); UltraChaosPlugin.Log.LogInfo((object)((Object)val2).name); return false; } } [HarmonyPatch(typeof(Projectile))] internal class ProjectileRandomPatches { [HarmonyPatch("Start")] private static bool Prefix(ref Projectile __instance) { //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) if (!Fields.globalEnabled.value) { return true; } if (!UltraChaosPlugin.RandomizeProj) { return true; } if (((Object)((Component)__instance).gameObject).name.ToLower().Contains("deco") && Fields.dontKillYourself.value) { return true; } if (((Object)((Component)__instance).gameObject).name.EndsWith("Random")) { return true; } List<KeyValuePair<BoolField, Projectile>> list = Fields.projectiles.Where((KeyValuePair<BoolField, Projectile> pair) => pair.Key.value).ToList(); Projectile val; if (list.Count == 0) { int index = Random.Range(0, UltraChaosPlugin.projectiles.Count); UltraChaosPlugin.Log.LogInfo((object)UltraChaosPlugin.projectiles.Count); val = UltraChaosPlugin.projectiles[index]; } else { int index2 = Random.Range(0, list.Count); UltraChaosPlugin.Log.LogInfo((object)list.Count); val = list[index2].Value; } Projectile val2 = Object.Instantiate<Projectile>(val, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation); ((Component)val2).transform.forward = ((Component)__instance).transform.forward; ((Object)val2).name = ((Object)val2).name + "Random"; val2.safeEnemyType = __instance.safeEnemyType; val2.weaponType = __instance.weaponType; val2.turnSpeed = __instance.turnSpeed; val2.turningSpeedMultiplier = __instance.turningSpeedMultiplier; val2.sourceWeapon = __instance.sourceWeapon; val2.playerBullet = __instance.playerBullet; val2.friendly = __instance.friendly; val2.alreadyHitEnemies = __instance.alreadyHitEnemies; val2.target = val.target; Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } [HarmonyPatch(typeof(ExplosionController))] internal class ExplosionRandomPatches { [HarmonyPatch("Start")] private static bool Prefix(ref ExplosionController __instance) { //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (!Fields.globalEnabled.value) { return true; } if (!UltraChaosPlugin.RandomizeExplosions) { return true; } if (((Object)((Component)__instance).gameObject).name.EndsWith("Random")) { return true; } List<KeyValuePair<BoolField, ExplosionController>> list = Fields.explosions.Where((KeyValuePair<BoolField, ExplosionController> pair) => pair.Key.value).ToList(); ExplosionController val; if (list.Count == 0) { int index = Random.Range(0, UltraChaosPlugin.explosions.Count); UltraChaosPlugin.Log.LogInfo((object)UltraChaosPlugin.explosions.Count); val = UltraChaosPlugin.explosions[index]; } else { int index2 = Random.Range(0, list.Count); UltraChaosPlugin.Log.LogInfo((object)list.Count); val = list[index2].Value; } ExplosionController val2 = Object.Instantiate<ExplosionController>(val, ((Component)__instance).transform.position, ((Component)val).transform.rotation); ((Object)val2).name = ((Object)val2).name + "Random"; Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } [HarmonyPatch(typeof(PrefsManager), "GetInt")] public class randomWeapons { public static bool Prefix(ref int __result, string key) { if (!Fields.RandomizeWeapons.value) { return true; } if (key.Contains("weapon.")) { __result = Random.Range(0, 3); return false; } return true; } } [HarmonyPatch(typeof(Nail))] internal class NailRandomPatches { [HarmonyPatch("Start")] private static bool Prefix(ref Nail __instance) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) if (!Fields.globalEnabled.value) { return true; } if (!Fields.ChangeNails.value) { return true; } if (((Object)((Component)__instance).gameObject).name.EndsWith("Random")) { return true; } if (Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<DontRandomize>())) { return true; } UltraChaosPlugin.Log.LogInfo((object)((Object)((Component)__instance).gameObject).name); int index = Random.Range(0, UltraChaosPlugin.nails.Count); UltraChaosPlugin.Log.LogInfo((object)UltraChaosPlugin.nails.Count); Nail val = UltraChaosPlugin.nails[index]; GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, ((Component)__instance).transform.position, ((Component)__instance).gameObject.transform.rotation); Nail component = val2.GetComponent<Nail>(); component.sourceWeapon = __instance.sourceWeapon; component.originalVelocity = __instance.originalVelocity; component.nbc = __instance.nbc; component.weaponType = __instance.weaponType; Rigidbody val3 = default(Rigidbody); Rigidbody val4 = default(Rigidbody); if (((Component)component).TryGetComponent<Rigidbody>(ref val3) && ((Component)__instance).TryGetComponent<Rigidbody>(ref val4)) { val3.velocity = val4.velocity; } if (component.sawblade) { component.ForceCheckSawbladeRicochet(); } component.enemy = __instance.enemy; ((Object)component).name = ((Object)component).name + "Random"; Object.Destroy((Object)(object)((Component)__instance).gameObject); UltraChaosPlugin.Log.LogInfo((object)((Object)component).name); return false; } } } namespace UltraChaos.MonoBehaviours { internal class DontRandomize : MonoBehaviour { public string nothing = "this is literally nothing"; } internal class ULTRARandomizerComponent : MonoBehaviour { public void Awake() { } public void Start() { } public void Update() { } public void LateUpdate() { } } } namespace UltraChaos.Cheats { internal class RandomizeBeamsCheat : ICheat { [CompilerGenerated] private sealed class <Coroutine>d__19 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public CheatsManager manager; public RandomizeBeamsCheat <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Coroutine>d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -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(); } } private bool active; public string LongName => "Randomize Beams"; public string Identifier => "UltraRandomizer.randomize_beams"; public string ButtonEnabledOverride => "Beams Enabled"; public string ButtonDisabledOverride => "Beams Disabled"; public string Icon => "warning"; public bool IsActive => active; public bool DefaultState => false; public StatePersistenceMode PersistenceMode => (StatePersistenceMode)1; public void Disable() { active = false; UltraChaosPlugin.RandomizeBeams = active; } public void Enable(CheatsManager cheatsManager) { active = true; UltraChaosPlugin.RandomizeBeams = active; } public void Update() { } [IteratorStateMachine(typeof(<Coroutine>d__19))] public IEnumerator Coroutine(CheatsManager manager) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Coroutine>d__19(0) { <>4__this = this, manager = manager }; } } internal class RandomizeEnemiesCheat : ICheat { [CompilerGenerated] private sealed class <Coroutine>d__6 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public CheatsManager manager; public RandomizeEnemiesCheat <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Coroutine>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -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(); } } private bool active; public string LongName => "RandomizeEnemies"; public string Identifier => "UltraRandomizer.randomize_enemies"; public string ButtonEnabledOverride => "Enemies Enabled"; public string ButtonDisabledOverride => "Enemies Disabled"; public string Icon => "warning"; public bool IsActive => active; public bool DefaultState => false; public StatePersistenceMode PersistenceMode => (StatePersistenceMode)1; [IteratorStateMachine(typeof(<Coroutine>d__6))] public IEnumerator Coroutine(CheatsManager manager) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Coroutine>d__6(0) { <>4__this = this, manager = manager }; } public void Disable() { Debug.Log((object)"disables"); active = false; UltraChaosPlugin.RandomizeEnemies = active; } public void Enable(CheatsManager manager) { Debug.Log((object)"enabled"); active = true; UltraChaosPlugin.RandomizeEnemies = active; } public void Update() { } } internal class RandomizeExpCheat : ICheat { [CompilerGenerated] private sealed class <Coroutine>d__2 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public CheatsManager manager; public RandomizeExpCheat <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Coroutine>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -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(); } } private bool active; public string LongName => "Randomize Explosions"; public string Identifier => "UltraRandomizer.randomize_explosions"; public string ButtonEnabledOverride => "Explosions Enabled"; public string ButtonDisabledOverride => "Explosions Disabled"; public string Icon => "warning"; public bool IsActive => active; public bool DefaultState => false; public StatePersistenceMode PersistenceMode => (StatePersistenceMode)1; [IteratorStateMachine(typeof(<Coroutine>d__2))] public IEnumerator Coroutine(CheatsManager manager) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Coroutine>d__2(0) { <>4__this = this, manager = manager }; } public void Disable() { active = false; UltraChaosPlugin.RandomizeExplosions = active; } public void Enable(CheatsManager manager) { active = true; UltraChaosPlugin.RandomizeExplosions = active; } public void Update() { } } internal class RandomizeProjCheat : ICheat { [CompilerGenerated] private sealed class <Coroutine>d__17 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public CheatsManager manager; public RandomizeProjCheat <>4__this; object IEnumerator