Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RandomItemOnP v4.6.0
BepInEx/plugins/RandomItemOnP/RandomItemOnP.dll
Decompiled 5 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("RandomItemOnP")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RandomItemOnP")] [assembly: AssemblyTitle("RandomItemOnP")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public static class RIP_NetSync { private const byte EVT_START_SEQUENCE = 140; private const byte EVT_LIGHTNING = 146; private const byte EVT_CHAT = 141; private static bool _photonSearched = false; private static bool _photonReady = false; private static Type _tPhotonNetwork; private static object _networkingClient; private static EventInfo _evEventReceived; private static MethodInfo _miRaiseEvent; private static object _raiseOptAll; private static object _sendOptReliable; private static readonly HashSet<MonoBehaviour> _listeners = new HashSet<MonoBehaviour>(); private static Delegate _eventReceivedDel; public static void Register(MonoBehaviour beh) { EnsurePhoton(); _listeners.Add(beh); TryHookEvent(); Debug.Log((object)("[RIP_NetSync] Register: " + ((Object)beh).name + " (ready=" + _photonReady + ")")); } public static void Unregister(MonoBehaviour beh) { _listeners.Remove(beh); Debug.Log((object)("[RIP_NetSync] Unregister: " + ((Object)beh).name)); } public static bool IsReady() { EnsurePhoton(); return _photonReady; } public static bool AmMaster() { try { if (_tPhotonNetwork == null) { return false; } PropertyInfo property = _tPhotonNetwork.GetProperty("IsMasterClient", BindingFlags.Static | BindingFlags.Public); if (property != null) { return (bool)property.GetValue(null, null); } } catch { } return false; } public static void RequestStartSequence(Vector3 pos, float seconds) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (!IsReady()) { Dispatch_Local_StartSeq(pos, seconds); return; } object payload = new object[4] { pos.x, pos.y, pos.z, seconds }; Raise(140, payload, toAll: true); Debug.Log((object)("[RIP_NetSync] Broadcast event " + (byte)140 + " envoyé à tous.")); } public static void BroadcastLightningStorm(int seed, float duration) { if (!IsReady()) { Dispatch_Local_Lightning(seed, duration); return; } object payload = new object[2] { seed, duration }; Raise(146, payload, toAll: true); Debug.Log((object)("[RIP_NetSync] Broadcast event " + (byte)146 + " (lightning) à tous.")); } public static void BroadcastChat(string msg) { if (!IsReady()) { Dispatch_Local_Chat(msg); } else { Raise(141, msg, toAll: true); } } private static void EnsurePhoton() { if (_photonSearched) { return; } _photonSearched = true; try { _tPhotonNetwork = AppDomain.CurrentDomain.GetAssemblies().SelectMany(delegate(Assembly a) { try { return a.GetTypes(); } catch { return Array.Empty<Type>(); } }).FirstOrDefault((Type t) => t.FullName == "Photon.Pun.PhotonNetwork"); if (_tPhotonNetwork == null) { Debug.Log((object)"[RIP_NetSync] Photon non trouvé."); _photonReady = false; return; } _miRaiseEvent = _tPhotonNetwork.GetMethods(BindingFlags.Static | BindingFlags.Public).FirstOrDefault(delegate(MethodInfo m) { if (m.Name != "RaiseEvent") { return false; } ParameterInfo[] parameters = m.GetParameters(); return parameters.Length == 4 && parameters[0].ParameterType == typeof(byte); }); _networkingClient = _tPhotonNetwork.GetProperty("NetworkingClient", BindingFlags.Static | BindingFlags.Public)?.GetValue(null, null); if (_networkingClient == null) { Debug.Log((object)"[RIP_NetSync] Photon partiel — réseau désactivé."); _photonReady = false; return; } Type type = _networkingClient.GetType(); _evEventReceived = type.GetEvent("EventReceived", BindingFlags.Instance | BindingFlags.Public); Assembly assembly = type.Assembly; Type type2 = assembly.GetType("ExitGames.Client.Photon.RaiseEventOptions"); Type type3 = assembly.GetType("Photon.Realtime.ReceiverGroup"); Type type4 = assembly.GetType("ExitGames.Client.Photon.SendOptions"); Type type5 = assembly.GetType("ExitGames.Client.Photon.EventCaching"); _raiseOptAll = Activator.CreateInstance(type2); type2.GetProperty("Receivers")?.SetValue(_raiseOptAll, Enum.Parse(type3, "All"), null); type2.GetProperty("CachingOption")?.SetValue(_raiseOptAll, Enum.Parse(type5, "DoNotCache"), null); _sendOptReliable = type4.GetField("SendReliable", BindingFlags.Static | BindingFlags.Public)?.GetValue(null); _photonReady = _miRaiseEvent != null && _evEventReceived != null && _raiseOptAll != null && _sendOptReliable != null; Debug.Log((object)(_photonReady ? "[RIP_NetSync] [RIP] Photon détecté et prêt (RaiseEvent direct)." : "[RIP_NetSync] [RIP] Photon trouvé mais incomplet.")); } catch (Exception ex) { Debug.Log((object)("[RIP_NetSync] Init erreur: " + ex.Message)); _photonReady = false; } } private static void TryHookEvent() { if (!_photonReady || _networkingClient == null || _evEventReceived == null || (object)_eventReceivedDel != null) { return; } try { _ = _evEventReceived.EventHandlerType.GenericTypeArguments[0]; Type? eventHandlerType = _evEventReceived.EventHandlerType; MethodInfo method = typeof(RIP_NetSync).GetMethod("HandleEvent", BindingFlags.Static | BindingFlags.NonPublic); _eventReceivedDel = Delegate.CreateDelegate(eventHandlerType, method); _evEventReceived.AddEventHandler(_networkingClient, _eventReceivedDel); } catch (Exception ex) { Debug.Log((object)("[RIP_NetSync] Hook EventReceived erreur: " + ex.Message)); } } private static void HandleEvent(object eventData) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) try { Type type = eventData.GetType(); byte b = (byte)type.GetProperty("Code").GetValue(eventData, null); object value = type.GetProperty("CustomData").GetValue(eventData, null); switch (b) { case 140: if (value is object[] array && array.Length >= 4) { float num = Convert.ToSingle(array[0]); float num2 = Convert.ToSingle(array[1]); float num3 = Convert.ToSingle(array[2]); Dispatch_Local_StartSeq(seconds: Convert.ToSingle(array[3]), pos: new Vector3(num, num2, num3)); } break; case 146: if (value is object[] array2 && array2.Length >= 2) { int seed = Convert.ToInt32(array2[0]); float duration = Convert.ToSingle(array2[1]); Dispatch_Local_Lightning(seed, duration); } break; case 141: if (value is string msg) { Dispatch_Local_Chat(msg); } break; } } catch { } } private static void Raise(byte code, object payload, bool toAll) { if (!_photonReady || _miRaiseEvent == null) { return; } object raiseOptAll = _raiseOptAll; object sendOptReliable = _sendOptReliable; try { _miRaiseEvent.Invoke(null, new object[4] { code, payload, raiseOptAll, sendOptReliable }); } catch (Exception ex) { Debug.Log((object)("[RIP_NetSync] RaiseEvent erreur: " + ex.Message)); } } private static void Dispatch_Local_StartSeq(Vector3 pos, float seconds) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) MonoBehaviour[] array = _listeners.ToArray(); foreach (MonoBehaviour val in array) { if (!Object.op_Implicit((Object)(object)val)) { continue; } MethodInfo method = ((object)val).GetType().GetMethod("Net_StartSequence", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { try { method.Invoke(val, new object[2] { pos, seconds }); } catch { } } } } private static void Dispatch_Local_Lightning(int seed, float duration) { MonoBehaviour[] array = _listeners.ToArray(); foreach (MonoBehaviour val in array) { if (!Object.op_Implicit((Object)(object)val)) { continue; } MethodInfo method = ((object)val).GetType().GetMethod("Net_Lightning", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { try { method.Invoke(val, new object[2] { seed, duration }); } catch { } } } } private static void Dispatch_Local_Chat(string msg) { MonoBehaviour[] array = _listeners.ToArray(); foreach (MonoBehaviour val in array) { if (!Object.op_Implicit((Object)(object)val)) { continue; } MethodInfo method = ((object)val).GetType().GetMethod("Net_Chat", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { try { method.Invoke(val, new object[1] { msg }); } catch { } } } } } namespace RandomItemOnP { public class Class1 { } [BepInPlugin("erwan.RandomItemOnP", "Random Item On P (v4.6)", "4.6.0")] public class RandomItemOnP : BaseUnityPlugin { public static ManualLogSource Log; private void Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"[RandomItemOnP] Loaded v4.6 (Lightning, no Fury)."); GameObject val = new GameObject("RandomItemOnPBehaviour") { hideFlags = (HideFlags)61 }; val.AddComponent<RandomItemOnPBehaviour>(); Object.DontDestroyOnLoad((Object)val); } } public class RandomItemOnPBehaviour : MonoBehaviour { private class CountdownMarker { public Vector3 worldPos; public float endTime; public string label; } [CompilerGenerated] private sealed class <>c__DisplayClass77_0 { public Vector3 pos; public RandomItemOnPBehaviour <>4__this; internal void <LightningStorm>b__0() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) AudioSource.PlayClipAtPoint(<>4__this.thunderClip, pos, 0.9f); } } [CompilerGenerated] private sealed class <BlackoutEvent>d__73 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RandomItemOnPBehaviour <>4__this; private Dictionary<Light, float> <original>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BlackoutEvent>d__73(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <original>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown int num = <>1__state; RandomItemOnPBehaviour randomItemOnPBehaviour = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; randomItemOnPBehaviour.blackoutRunning = true; randomItemOnPBehaviour.SendChatAsPlayer("<color=#FFD700>BLACKOUT!</color>"); if (Object.op_Implicit((Object)(object)randomItemOnPBehaviour.blackoutClip) && Object.op_Implicit((Object)(object)Camera.main)) { AudioSource.PlayClipAtPoint(randomItemOnPBehaviour.blackoutClip, ((Component)Camera.main).transform.position, 0.9f); } Light[] array = Object.FindObjectsOfType<Light>(); <original>5__2 = new Dictionary<Light, float>(array.Length); Light[] array2 = array; foreach (Light val in array2) { if (Object.op_Implicit((Object)(object)val)) { <original>5__2[val] = val.intensity; } } array2 = array; foreach (Light val2 in array2) { if (Object.op_Implicit((Object)(object)val2)) { val2.intensity = Mathf.Max(0.05f, Mathf.Min(0.1f, val2.intensity * 0.1f)); } } <>2__current = (object)new WaitForSecondsRealtime(8f); <>1__state = 1; return true; } case 1: <>1__state = -1; foreach (KeyValuePair<Light, float> item in <original>5__2) { if (Object.op_Implicit((Object)(object)item.Key)) { item.Key.intensity = item.Value; } } randomItemOnPBehaviour.blackoutRunning = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <CameraShake>d__67 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float duration; public float frequency; public float amplitude; private Transform <t>5__2; private Vector3 <origin>5__3; private float <end>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CameraShake>d__67(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <t>5__2 = 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_0102: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: { <>1__state = -1; Camera main = Camera.main; if (!Object.op_Implicit((Object)(object)main)) { return false; } <t>5__2 = ((Component)main).transform; <origin>5__3 = <t>5__2.localPosition; <end>5__4 = Time.realtimeSinceStartup + duration; break; } case 1: <>1__state = -1; break; } if (Time.realtimeSinceStartup < <end>5__4) { float num = Time.realtimeSinceStartup * frequency; float num2 = (Mathf.PerlinNoise(num, 0f) - 0.5f) * 2f; float num3 = (Mathf.PerlinNoise(0f, num) - 0.5f) * 2f; <t>5__2.localPosition = <origin>5__3 + new Vector3(num2, num3, 0f) * amplitude * 0.25f; <>2__current = null; <>1__state = 1; return true; } <t>5__2.localPosition = <origin>5__3; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ConfettiStorm>d__74 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RandomItemOnPBehaviour <>4__this; public Vector3 center; private List<GameObject> <confettis>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ConfettiStorm>d__74(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <confettis>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; RandomItemOnPBehaviour randomItemOnPBehaviour = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; randomItemOnPBehaviour.confettiRunning = true; randomItemOnPBehaviour.SendChatAsPlayer("<color=#7CFC00>CONFETTI STORM!</color>"); if (Object.op_Implicit((Object)(object)randomItemOnPBehaviour.confettiClip)) { AudioSource.PlayClipAtPoint(randomItemOnPBehaviour.confettiClip, center, 0.8f); } int num2 = randomItemOnPBehaviour.rng.Next(40, 65); <confettis>5__2 = new List<GameObject>(num2); for (int i = 0; i < num2; i++) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)val).name = "Confetti"; val.transform.position = center + new Vector3(Random.Range(-2f, 2f), 2f + Random.Range(0f, 1.5f), Random.Range(-2f, 2f)); val.transform.localScale = Vector3.one * Random.Range(0.05f, 0.12f); Color val2 = Random.ColorHSV(0f, 1f, 0.8f, 1f, 0.8f, 1f); Renderer component = val.GetComponent<Renderer>(); Material val3 = TryBuildColoredMaterial(val2, component.sharedMaterial); if ((Object)(object)val3 != (Object)null) { component.material = val3; } else { Material material = component.material; if ((Object)(object)material != (Object)null) { if (material.HasProperty("_Color")) { material.SetColor("_Color", val2); } else if (material.HasProperty("_BaseColor")) { material.SetColor("_BaseColor", val2); } } } Rigidbody obj = val.AddComponent<Rigidbody>(); obj.mass = 0.02f; obj.drag = 0.4f; obj.angularDrag = 0.05f; obj.AddExplosionForce(Random.Range(80f, 140f), center, 3f, 0.5f, (ForceMode)1); obj.AddTorque(Random.onUnitSphere * Random.Range(0.1f, 0.6f), (ForceMode)1); Collider component2 = val.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.enabled = false; } <confettis>5__2.Add(val); } <>2__current = (object)new WaitForSecondsRealtime(3f); <>1__state = 1; return true; } case 1: <>1__state = -1; foreach (GameObject item in <confettis>5__2) { if (Object.op_Implicit((Object)(object)item)) { Object.Destroy((Object)(object)item); } } randomItemOnPBehaviour.confettiRunning = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <CrackRoutine>d__72 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RandomItemOnPBehaviour <>4__this; public float duration; public Vector3 center; private float <end>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CrackRoutine>d__72(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown int num = <>1__state; RandomItemOnPBehaviour randomItemOnPBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if (!Object.op_Implicit((Object)(object)randomItemOnPBehaviour.crackClip)) { return false; } <end>5__2 = Time.realtimeSinceStartup + duration; break; case 1: <>1__state = -1; break; } if (Time.realtimeSinceStartup < <end>5__2) { Vector3 val = center + Random.insideUnitSphere * 1f; AudioSource.PlayClipAtPoint(randomItemOnPBehaviour.crackClip, val, 0.85f); <>2__current = (object)new WaitForSeconds(1.1f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DestructionPulses>d__68 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float duration; public RandomItemOnPBehaviour <>4__this; public Vector3 center; private float <end>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DestructionPulses>d__68(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown int num = <>1__state; RandomItemOnPBehaviour randomItemOnPBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <end>5__2 = Time.realtimeSinceStartup + duration; break; case 1: <>1__state = -1; break; } if (Time.realtimeSinceStartup < <end>5__2) { randomItemOnPBehaviour.DoDestructionPulse(center, 8f, 650f); <>2__current = (object)new WaitForSeconds(0.8f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DoorMayhem>d__76 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RandomItemOnPBehaviour <>4__this; private float <end>5__2; private List<Component> <doors>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoorMayhem>d__76(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <doors>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Expected O, but got Unknown //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; RandomItemOnPBehaviour randomItemOnPBehaviour = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; randomItemOnPBehaviour.doorMayhemRunning = true; randomItemOnPBehaviour.SendChatAsPlayer("<color=#FFA500>DOOR MAYHEM!</color>"); if (Object.op_Implicit((Object)(object)randomItemOnPBehaviour.doorClip) && Object.op_Implicit((Object)(object)Camera.main)) { AudioSource.PlayClipAtPoint(randomItemOnPBehaviour.doorClip, ((Component)Camera.main).transform.position, 0.85f); } float num2 = 6f; <end>5__2 = Time.realtimeSinceStartup + num2; Component[] array = Object.FindObjectsOfType<Component>(); <doors>5__3 = new List<Component>(); Component[] array2 = array; foreach (Component val in array2) { if (Object.op_Implicit((Object)(object)val)) { string text = ((object)val).GetType().Name.ToLowerInvariant(); if (text.Contains("door") || text.Contains("gate")) { <doors>5__3.Add(val); } } } break; } case 1: <>1__state = -1; break; } if (Time.realtimeSinceStartup < <end>5__2) { if (Object.op_Implicit((Object)(object)randomItemOnPBehaviour.doorClip) && Random.value < 0.35f) { Vector3 val2 = (Object.op_Implicit((Object)(object)Camera.main) ? ((Component)Camera.main).transform.position : ((<doors>5__3.Count > 0) ? <doors>5__3[0].transform.position : Vector3.zero)); AudioSource.PlayClipAtPoint(randomItemOnPBehaviour.doorClip, val2, 0.65f); } foreach (Component item in <doors>5__3) { if (!Object.op_Implicit((Object)(object)item)) { continue; } Type type = ((object)item).GetType(); FieldInfo fieldInfo = type.GetField("isLocked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("locked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); try { if (fieldInfo != null) { fieldInfo.SetValue(item, false); } } catch { } PropertyInfo propertyInfo = type.GetProperty("IsLocked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetProperty("Locked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); try { if (propertyInfo != null && propertyInfo.CanWrite) { propertyInfo.SetValue(item, false, null); } } catch { } MethodInfo methodInfo = null; methodInfo = ((!(randomItemOnPBehaviour.rng.NextDouble() < 0.5)) ? (type.GetMethod("Close", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Shut", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) : (type.GetMethod("Open", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("ForceOpen", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Breach", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))); try { if (methodInfo != null) { methodInfo.Invoke(item, null); } } catch { } GameObject gameObject = item.gameObject; Rigidbody val3 = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<Rigidbody>() : null); if (Object.op_Implicit((Object)(object)val3)) { val3.AddForce(Random.onUnitSphere * 300f, (ForceMode)1); } } <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } randomItemOnPBehaviour.doorMayhemRunning = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <FlashRoutine>d__78 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RandomItemOnPBehaviour <>4__this; public float upTime; public float downTime; private float <t>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FlashRoutine>d__78(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; RandomItemOnPBehaviour randomItemOnPBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; randomItemOnPBehaviour.flashAlpha = 0f; <t>5__2 = 0f; goto IL_008c; case 1: <>1__state = -1; goto IL_008c; case 2: { <>1__state = -1; break; } IL_008c: if (<t>5__2 < upTime) { <t>5__2 += Time.deltaTime; randomItemOnPBehaviour.flashAlpha = Mathf.Lerp(0f, 0.85f, <t>5__2 / upTime); <>2__current = null; <>1__state = 1; return true; } <t>5__2 = 0f; break; } if (<t>5__2 < downTime) { <t>5__2 += Time.deltaTime; randomItemOnPBehaviour.flashAlpha = Mathf.Lerp(0.85f, 0f, <t>5__2 / downTime); <>2__current = null; <>1__state = 2; return true; } randomItemOnPBehaviour.flashAlpha = 0f; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <FlickerLights>d__66 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float duration; public Light[] lights; private Random <r>5__2; private float <end>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FlickerLights>d__66(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <r>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <r>5__2 = new Random(); <end>5__3 = Time.realtimeSinceStartup + duration; break; case 1: <>1__state = -1; break; } if (Time.realtimeSinceStartup < <end>5__3) { Light[] array = lights; foreach (Light val in array) { if (Object.op_Implicit((Object)(object)val)) { float num = ((val.intensity <= 0.01f) ? 1f : val.intensity); val.intensity = num * ((<r>5__2.NextDouble() < 0.5) ? 0.15f : 1.6f); } } <>2__current = (object)new WaitForSeconds(0.08f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LightningStorm>d__77 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RandomItemOnPBehaviour <>4__this; private float <total>5__2; private int <strikes>5__3; private Vector3 <center>5__4; private int <i>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LightningStorm>d__77(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Expected O, but got Unknown //IL_0246: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; RandomItemOnPBehaviour randomItemOnPBehaviour = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; if (randomItemOnPBehaviour.lightningRunning) { return false; } randomItemOnPBehaviour.lightningRunning = true; randomItemOnPBehaviour.SendChatAsPlayer("<color=#AACCFF>⚡ LIGHTNING STORM! ⚡</color>"); <total>5__2 = Random.Range(5f, 7.5f); <strikes>5__3 = Random.Range(4, 7); List<Transform> list = randomItemOnPBehaviour.FindPlayerTransforms(); <center>5__4 = ((list.Count > 0) ? list[0].position : (Object.op_Implicit((Object)(object)Camera.main) ? ((Component)Camera.main).transform.position : Vector3.zero)); <i>5__5 = 0; goto IL_02a5; } case 1: <>1__state = -1; <i>5__5++; goto IL_02a5; case 2: { <>1__state = -1; randomItemOnPBehaviour.lightningRunning = false; return false; } IL_02a5: if (<i>5__5 < <strikes>5__3) { <>c__DisplayClass77_0 CS$<>8__locals0 = new <>c__DisplayClass77_0 { <>4__this = randomItemOnPBehaviour }; float num2 = Random.Range(6f, 14f); float num3 = Random.Range(0f, (float)Math.PI * 2f); CS$<>8__locals0.pos = <center>5__4 + new Vector3(Mathf.Cos(num3), 0f, Mathf.Sin(num3)) * num2; CS$<>8__locals0.pos.y += 0.2f; ((MonoBehaviour)randomItemOnPBehaviour).StartCoroutine(randomItemOnPBehaviour.FlashRoutine(0.18f, 0.18f)); GameObject val = new GameObject("LightningFlash"); Light val2 = val.AddComponent<Light>(); val2.type = (LightType)2; val2.range = 12f; val2.intensity = 0f; val.transform.position = CS$<>8__locals0.pos + Vector3.up * 2f; ((MonoBehaviour)randomItemOnPBehaviour).StartCoroutine(randomItemOnPBehaviour.SurgeLight(val2, 8f, 0.2f)); if (Object.op_Implicit((Object)(object)randomItemOnPBehaviour.thunderClip)) { float delay = Random.Range(0.05f, 0.2f); ((MonoBehaviour)randomItemOnPBehaviour).StartCoroutine(randomItemOnPBehaviour.PlayAfter(delay, delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) AudioSource.PlayClipAtPoint(CS$<>8__locals0.<>4__this.thunderClip, CS$<>8__locals0.pos, 0.9f); })); } ((MonoBehaviour)randomItemOnPBehaviour).StartCoroutine(randomItemOnPBehaviour.CameraShake(0.5f, 0.35f, 18f)); Collider[] array = Physics.OverlapSphere(CS$<>8__locals0.pos, 4f, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { Rigidbody attachedRigidbody = array[i].attachedRigidbody; if ((Object)(object)attachedRigidbody != (Object)null) { attachedRigidbody.isKinematic = false; attachedRigidbody.AddExplosionForce(250f, CS$<>8__locals0.pos, 4f, 0.5f, (ForceMode)1); } } <>2__current = (object)new WaitForSeconds(Random.Range(0.5f, 1f)); <>1__state = 1; return true; } <>2__current = (object)new WaitForSeconds(Mathf.Max(0f, <total>5__2 - (float)<strikes>5__3 * 0.7f)); <>1__state = 2; return true; } } 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 <LoadClip>d__60 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string url; public AudioType type; public Action<AudioClip> assign; private UnityWebRequest <req>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadClip>d__60(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <req>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; <req>5__2 = UnityWebRequestMultimedia.GetAudioClip(url, type); <>1__state = -3; <>2__current = <req>5__2.SendWebRequest(); <>1__state = 1; result = true; break; case 1: { <>1__state = -3; if (<req>5__2.isNetworkError || <req>5__2.isHttpError) { result = false; <>m__Finally1(); break; } AudioClip content = DownloadHandlerAudioClip.GetContent(<req>5__2); assign?.Invoke(content); <>m__Finally1(); <req>5__2 = null; result = false; break; } } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } 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 (<req>5__2 != null) { ((IDisposable)<req>5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PlayAfter>d__80 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float delay; public Action play; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PlayAfter>d__80(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; try { play?.Invoke(); } catch { } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <Pulse>d__52 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GameObject go; public float duration; public float start; public float end; private float <t>5__2; private Renderer <mr>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Pulse>d__52(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <mr>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <t>5__2 = 0f; <mr>5__3 = go.GetComponent<Renderer>(); break; case 1: <>1__state = -1; break; } if (<t>5__2 < duration && Object.op_Implicit((Object)(object)go)) { <t>5__2 += Time.deltaTime; float num = Mathf.SmoothStep(0f, 1f, <t>5__2 / duration); float num2 = Mathf.Lerp(start, end, num); go.transform.localScale = Vector3.one * num2; if (Object.op_Implicit((Object)(object)<mr>5__3) && <mr>5__3.material.HasProperty("_Color")) { Color color = <mr>5__3.material.color; color.a = 1f - num; <mr>5__3.material.color = color; } <>2__current = null; <>1__state = 1; return true; } if (Object.op_Implicit((Object)(object)go)) { Object.Destroy((Object)(object)go); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <RareAlarmEvent>d__65 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RandomItemOnPBehaviour <>4__this; public Vector3 epicenter; private GameObject <audioGO>5__2; private AudioSource <src>5__3; private Dictionary<Light, float> <original>5__4; private Coroutine <flicker>5__5; private Coroutine <shake>5__6; private Coroutine <pulses>5__7; private Coroutine <cracks>5__8; private float <end>5__9; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RareAlarmEvent>d__65(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <audioGO>5__2 = null; <src>5__3 = null; <original>5__4 = null; <flicker>5__5 = null; <shake>5__6 = null; <pulses>5__7 = null; <cracks>5__8 = null; <>1__state = -2; } private bool MoveNext() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; RandomItemOnPBehaviour randomItemOnPBehaviour = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; randomItemOnPBehaviour.alarmRunning = true; randomItemOnPBehaviour.SendChatAsPlayer("<color=#FF0000>ATTENTION, ATTENTION, LA GRAVITÉ EST ALTÉRÉE !</color>"); <audioGO>5__2 = new GameObject("RandomItemOnP_AlarmAudio"); ((Object)<audioGO>5__2).hideFlags = (HideFlags)61; <src>5__3 = <audioGO>5__2.AddComponent<AudioSource>(); <src>5__3.spatialBlend = 0f; <src>5__3.loop = true; <src>5__3.volume = 0.7f; <src>5__3.clip = randomItemOnPBehaviour.alarmClip; if (Object.op_Implicit((Object)(object)<src>5__3.clip)) { <src>5__3.Play(); } Light[] array = Object.FindObjectsOfType<Light>(); <original>5__4 = new Dictionary<Light, float>(array.Length); Light[] array2 = array; foreach (Light val in array2) { if (Object.op_Implicit((Object)(object)val)) { <original>5__4[val] = val.intensity; } } float num2 = 10f; <flicker>5__5 = ((MonoBehaviour)randomItemOnPBehaviour).StartCoroutine(randomItemOnPBehaviour.FlickerLights(array, num2)); <shake>5__6 = ((MonoBehaviour)randomItemOnPBehaviour).StartCoroutine(randomItemOnPBehaviour.CameraShake(num2, 0.3f, 14f)); <pulses>5__7 = ((MonoBehaviour)randomItemOnPBehaviour).StartCoroutine(randomItemOnPBehaviour.DestructionPulses(epicenter, num2)); <cracks>5__8 = ((MonoBehaviour)randomItemOnPBehaviour).StartCoroutine(randomItemOnPBehaviour.CrackRoutine(epicenter, num2)); <end>5__9 = Time.realtimeSinceStartup + num2; break; } case 1: <>1__state = -1; break; } if (Time.realtimeSinceStartup < <end>5__9) { <>2__current = null; <>1__state = 1; return true; } if (Object.op_Implicit((Object)(object)<src>5__3)) { <src>5__3.Stop(); } Object.Destroy((Object)(object)<audioGO>5__2); if (<flicker>5__5 != null) { ((MonoBehaviour)randomItemOnPBehaviour).StopCoroutine(<flicker>5__5); } if (<shake>5__6 != null) { ((MonoBehaviour)randomItemOnPBehaviour).StopCoroutine(<shake>5__6); } if (<pulses>5__7 != null) { ((MonoBehaviour)randomItemOnPBehaviour).StopCoroutine(<pulses>5__7); } if (<cracks>5__8 != null) { ((MonoBehaviour)randomItemOnPBehaviour).StopCoroutine(<cracks>5__8); } foreach (KeyValuePair<Light, float> item in <original>5__4) { if (Object.op_Implicit((Object)(object)item.Key)) { item.Key.intensity = item.Value; } } randomItemOnPBehaviour.alarmRunning = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <RiskOrRewardSequence>d__46 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RandomItemOnPBehaviour <>4__this; public Vector3 spawnPos; private float <end>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RiskOrRewardSequence>d__46(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0110: 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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; RandomItemOnPBehaviour randomItemOnPBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <end>5__2 = Time.realtimeSinceStartup + 10f; randomItemOnPBehaviour.markers.Add(new CountdownMarker { worldPos = spawnPos, endTime = <end>5__2, label = "Spawning in" }); break; case 1: <>1__state = -1; break; } if (Time.realtimeSinceStartup < <end>5__2) { <>2__current = null; <>1__state = 1; return true; } randomItemOnPBehaviour.markers.RemoveAll((CountdownMarker m) => m.endTime <= Time.realtimeSinceStartup); if (!randomItemOnPBehaviour.repoReadyItems) { randomItemOnPBehaviour.repoReadyItems = randomItemOnPBehaviour.DiscoverItemsApi(); } if (!randomItemOnPBehaviour.repoReadyEnemies) { randomItemOnPBehaviour.repoReadyEnemies = randomItemOnPBehaviour.DiscoverEnemiesApi(); } int num2 = randomItemOnPBehaviour.rng.Next(100); bool flag = false; if (num2 < 80) { if (randomItemOnPBehaviour.rng.Next(100) < 3) { randomItemOnPBehaviour.DoJackpot(spawnPos); } else { randomItemOnPBehaviour.DoSpawnOneItem(spawnPos); } flag = true; if (!randomItemOnPBehaviour.alarmRunning && randomItemOnPBehaviour.rng.Next(100) < 2) { ((MonoBehaviour)randomItemOnPBehaviour).StartCoroutine(randomItemOnPBehaviour.RareAlarmEvent(spawnPos)); } } else if (num2 < 105) { if (!randomItemOnPBehaviour.MaybeTriggerNothingReplacement(spawnPos)) { randomItemOnPBehaviour.SendChat("Nothing happened..."); RandomItemOnP.Log.LogInfo((object)"[RandomItemOnP] → Nothing."); } } else if (randomItemOnPBehaviour.repoReadyEnemies && randomItemOnPBehaviour.TrySpawnEnemy(spawnPos)) { randomItemOnPBehaviour.SendChat("An enemy has appeared!"); flag = true; } else { randomItemOnPBehaviour.SendChat("No enemy spawner available. Nothing happened."); } if (flag) { randomItemOnPBehaviour.usedThisLevel = true; } randomItemOnPBehaviour.sequenceRunning = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SlowMo>d__50 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float timescale; public float realtime; private float <prev>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SlowMo>d__50(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <prev>5__2 = Time.timeScale; Time.timeScale = timescale; <>2__current = (object)new WaitForSecondsRealtime(realtime); <>1__state = 1; return true; case 1: <>1__state = -1; Time.timeScale = <prev>5__2; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SurgeLight>d__79 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Light L; public float time; public float peak; private float <t>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SurgeLight>d__79(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!Object.op_Implicit((Object)(object)L)) { return false; } <t>5__2 = 0f; break; case 1: <>1__state = -1; break; } if (<t>5__2 < time) { <t>5__2 += Time.deltaTime; float num = Mathf.Sin(<t>5__2 / time * (float)Math.PI); L.intensity = peak * num; <>2__current = null; <>1__state = 1; return true; } if (Object.op_Implicit((Object)(object)L)) { Object.Destroy((Object)(object)((Component)L).gameObject); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const int ChanceItem = 80; private const int ChanceNothing = 25; private const int ChanceEnemy = 15; private const int JackpotPercent = 3; private const int AlarmEventPercent = 2; private const int BlackoutPercent = 5; private const int ConfettiStormPercent = 6; private const int DoorMayhemPercent = 7; private const int LightningPercent = 5; private readonly Random rng = new Random(); private bool usedThisLevel; private bool sequenceRunning; private string currentLevel = ""; private object itemsList; private Type itemType; private MethodInfo spawnItemMethod; private PropertyInfo itemNameProp; private PropertyInfo rarityProp; private bool repoReadyItems; private object enemiesList; private Type enemyType; private MethodInfo spawnEnemyMethod; private PropertyInfo enemyNameProp; private bool repoReadyEnemies; private AudioClip spawnClip; private AudioClip alarmClip; private AudioClip crackClip; private AudioClip blackoutClip; private AudioClip confettiClip; private AudioClip doorClip; private AudioClip thunderClip; private readonly List<CountdownMarker> markers = new List<CountdownMarker>(); private GUIStyle _timerStyle; private Texture2D _overlayTex; private float flashAlpha; private bool alarmRunning; private bool blackoutRunning; private bool confettiRunning; private bool doorMayhemRunning; private bool lightningRunning; private void OnEnable() { SceneManager.sceneLoaded += OnSceneLoaded; } private void OnDisable() { SceneManager.sceneLoaded -= OnSceneLoaded; } private void Start() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) RandomItemOnP.Log.LogInfo((object)"[RandomItemOnP] Behaviour active."); Scene activeScene = SceneManager.GetActiveScene(); currentLevel = ((Scene)(ref activeScene)).name; usedThisLevel = (sequenceRunning = false); TryLoadCustomSounds(); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { currentLevel = ((Scene)(ref scene)).name; usedThisLevel = (sequenceRunning = false); repoReadyItems = (repoReadyEnemies = false); lightningRunning = false; flashAlpha = 0f; RandomItemOnP.Log.LogInfo((object)("[RandomItemOnP] New level: " + currentLevel + ". Usage reset.")); } private void Update() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (!Input.GetKeyDown((KeyCode)112) && !Input.GetKeyDown((KeyCode)288)) { return; } if (usedThisLevel) { SendChat("One use per level!"); return; } if (sequenceRunning) { SendChat("Already charging!"); return; } Camera main = Camera.main; if (Object.op_Implicit((Object)(object)main)) { Vector3 spawnPos = ((Component)main).transform.position + ((Component)main).transform.forward * 2f; sequenceRunning = true; ((MonoBehaviour)this).StartCoroutine(RiskOrRewardSequence(spawnPos)); } } [IteratorStateMachine(typeof(<RiskOrRewardSequence>d__46))] private IEnumerator RiskOrRewardSequence(Vector3 spawnPos) { //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 <RiskOrRewardSequence>d__46(0) { <>4__this = this, spawnPos = spawnPos }; } private bool MaybeTriggerNothingReplacement(Vector3 pos) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) bool flag = alarmRunning || blackoutRunning || confettiRunning || doorMayhemRunning || lightningRunning; int num = rng.Next(100); if (!flag && num < 5) { ((MonoBehaviour)this).StartCoroutine(BlackoutEvent()); return true; } num -= 5; if (!flag && num < 6) { ((MonoBehaviour)this).StartCoroutine(ConfettiStorm(pos)); return true; } num -= 6; if (!flag && num < 7) { ((MonoBehaviour)this).StartCoroutine(DoorMayhem()); return true; } num -= 7; if (!flag && num < 5) { ((MonoBehaviour)this).StartCoroutine(LightningStorm()); return true; } return false; } private void DoJackpot(Vector3 center) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) float num = 1.5f; for (int i = 0; i < 3; i++) { float num2 = (float)i * (float)Math.PI * 2f / 3f; Vector3 pos = center + new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)) * num; DoSpawnOneItem(pos); } SendChat("JACKPOT!"); } private void DoSpawnOneItem(Vector3 pos) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (!repoReadyItems) { return; } List<object> list = ToObjectList(itemsList); if (list != null && list.Count != 0) { var (choice, text) = PickWithRarity(list); TrySpawnItem(choice, pos); if (Object.op_Implicit((Object)(object)spawnClip)) { AudioSource.PlayClipAtPoint(spawnClip, pos); } SpawnColorFX(pos, text); if (text == "rare" || text == "legendary") { ((MonoBehaviour)this).StartCoroutine(SlowMo(0.4f, 1f)); } } } [IteratorStateMachine(typeof(<SlowMo>d__50))] private IEnumerator SlowMo(float timescale, float realtime) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SlowMo>d__50(0) { timescale = timescale, realtime = realtime }; } private void SpawnColorFX(Vector3 pos, string rarity) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); val.transform.position = pos; val.transform.localScale = Vector3.one * 0.25f; Renderer component = val.GetComponent<Renderer>(); component.material = new Material(Shader.Find("Standard")); Color white = Color.white; if (rarity == "rare") { ((Color)(ref white))..ctor(0.3f, 0.6f, 1f); } else if (rarity == "legendary") { ((Color)(ref white))..ctor(1f, 0.84f, 0f); } component.material.color = white; Collider component2 = val.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.enabled = false; } ((MonoBehaviour)this).StartCoroutine(Pulse(val, 0.25f, 0.8f, 0.35f)); } [IteratorStateMachine(typeof(<Pulse>d__52))] private IEnumerator Pulse(GameObject go, float start, float end, float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Pulse>d__52(0) { go = go, start = start, end = end, duration = duration }; } private void OnGUI() { //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (markers.Count > 0 && Object.op_Implicit((Object)(object)Camera.main)) { if (_timerStyle == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 24 }; val.normal.textColor = Color.yellow; _timerStyle = val; } foreach (CountdownMarker marker in markers) { float num = Mathf.Max(0f, marker.endTime - Time.realtimeSinceStartup); if (!(num <= 0f)) { Vector3 val2 = Camera.main.WorldToScreenPoint(marker.worldPos); if (val2.z > 0f) { GUI.Label(new Rect(val2.x - 100f, (float)Screen.height - val2.y - 20f, 200f, 40f), $"{marker.label} {Mathf.CeilToInt(num)}s", _timerStyle); } } } } if (flashAlpha > 0f) { if ((Object)(object)_overlayTex == (Object)null) { _overlayTex = new Texture2D(1, 1, (TextureFormat)5, false); ((Object)_overlayTex).hideFlags = (HideFlags)61; } _overlayTex.SetPixel(0, 0, new Color(1f, 1f, 1f, Mathf.Clamp01(flashAlpha))); _overlayTex.Apply(); GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)_overlayTex); } } private void SendChat(string msg) { SendChatRich(msg); } private void SendChatRich(string rich) { try { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name.Equals("REPOLib", StringComparison.OrdinalIgnoreCase)); if (assembly == null) { RandomItemOnP.Log.LogMessage((object)rich); return; } MethodInfo methodInfo = (from t in assembly.GetTypes() where t.Namespace != null && t.Namespace.StartsWith("REPOLib.Modules") select t).SelectMany((Type t) => t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)).FirstOrDefault(delegate(MethodInfo mi) { if (mi.GetParameters().Length != 1) { return false; } switch (mi.Name.ToLowerInvariant()) { case "sendchat": case "sendchatmessage": case "printtochat": case "sendmessage": return mi.GetParameters()[0].ParameterType == typeof(string); default: return false; } }); if (methodInfo != null) { methodInfo.Invoke(null, new object[1] { rich }); } else { RandomItemOnP.Log.LogMessage((object)rich); } } catch { RandomItemOnP.Log.LogMessage((object)rich); } } private string GetLocalPlayerName() { try { string text = (Type.GetType("Steamworks.SteamFriends, Steamworks.NET")?.GetMethod("GetPersonaName", BindingFlags.Static | BindingFlags.Public))?.Invoke(null, null)?.ToString(); if (!string.IsNullOrWhiteSpace(text)) { return text; } } catch { } return "SYSTEM"; } private void SendChatAsPlayer(string rich) { try { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name.Equals("REPOLib", StringComparison.OrdinalIgnoreCase)); if (assembly == null) { SendChatRich(rich); return; } MethodInfo methodInfo = (from t in assembly.GetTypes() where t.Namespace != null && t.Namespace.StartsWith("REPOLib.Modules") select t).SelectMany((Type t) => t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)).FirstOrDefault(delegate(MethodInfo mi) { ParameterInfo[] parameters = mi.GetParameters(); if (parameters.Length != 2) { return false; } bool num = mi.Name.ToLowerInvariant().Contains("chat"); bool flag = parameters[0].ParameterType == typeof(string) && parameters[1].ParameterType == typeof(string); return num && flag; }); if (methodInfo != null) { methodInfo.Invoke(null, new object[2] { GetLocalPlayerName(), rich }); } else { SendChatRich(rich); } } catch { SendChatRich(rich); } } private void TryLoadCustomSounds() { try { string folder = Path.Combine(Paths.PluginPath, "RandomItemOnP", "sounds"); LoadIfExists(folder, "spawn", delegate(AudioClip c) { spawnClip = c; }); LoadIfExists(folder, "alarm", delegate(AudioClip c) { alarmClip = c; }); LoadIfExists(folder, "crack", delegate(AudioClip c) { crackClip = c; }); LoadIfExists(folder, "blackout", delegate(AudioClip c) { blackoutClip = c; }); LoadIfExists(folder, "confetti", delegate(AudioClip c) { confettiClip = c; }); LoadIfExists(folder, "door", delegate(AudioClip c) { doorClip = c; }); LoadIfExists(folder, "thunder", delegate(AudioClip c) { thunderClip = c; }); } catch (Exception ex) { RandomItemOnP.Log.LogWarning((object)("[RandomItemOnP] Sound load error: " + ex.Message)); } } private void LoadIfExists(string folder, string baseName, Action<AudioClip> assign) { string text = Path.Combine(folder, baseName + ".wav"); string text2 = Path.Combine(folder, baseName + ".ogg"); if (File.Exists(text)) { ((MonoBehaviour)this).StartCoroutine(LoadClip("file://" + text, (AudioType)20, assign)); } else if (File.Exists(text2)) { ((MonoBehaviour)this).StartCoroutine(LoadClip("file://" + text2, (AudioType)14, assign)); } } [IteratorStateMachine(typeof(<LoadClip>d__60))] private IEnumerator LoadClip(string url, AudioType type, Action<AudioClip> assign) { //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 <LoadClip>d__60(0) { url = url, type = type, assign = assign }; } private bool DiscoverItemsApi() { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name.Equals("REPOLib", StringComparison.OrdinalIgnoreCase)); if (assembly == null) { return false; } Type type = assembly.GetType("REPOLib.Modules.Items"); if (type == null) { return false; } PropertyInfo property = type.GetProperty("AllItems", BindingFlags.Static | BindingFlags.Public); PropertyInfo property2 = type.GetProperty("RegisteredItems", BindingFlags.Static | BindingFlags.Public); object obj = null; Type elementType = null; if (property != null) { try { obj = property.GetValue(null, null); } catch { } if (obj != null && LooksLikeList(property.PropertyType, out elementType)) { RandomItemOnP.Log.LogInfo((object)"[RandomItemOnP] Using Items.AllItems"); } } if ((obj == null || elementType == null) && property2 != null) { try { obj = property2.GetValue(null, null); } catch { } if (obj != null && LooksLikeList(property2.PropertyType, out elementType)) { RandomItemOnP.Log.LogInfo((object)"[RandomItemOnP] Using Items.RegisteredItems"); } } if (obj == null || elementType == null) { return false; } MethodInfo methodInfo = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault(delegate(MethodInfo m) { if (!m.Name.Equals("SpawnItem", StringComparison.OrdinalIgnoreCase)) { return false; } ParameterInfo[] parameters = m.GetParameters(); if (parameters.Length < 2) { return false; } bool num = parameters[0].ParameterType == elementType || parameters[0].ParameterType == typeof(string); bool flag = parameters[1].ParameterType == typeof(Vector3); return num && flag; }); if (methodInfo == null) { return false; } PropertyInfo propertyInfo = elementType.GetProperty("name", BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public) ?? elementType.GetProperty("displayName", BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public) ?? elementType.GetProperty("itemName", BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public) ?? elementType.GetProperty("Name", BindingFlags.Instance | BindingFlags.Public); rarityProp = elementType.GetProperty("rarity", BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public) ?? elementType.GetProperty("tier", BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public) ?? elementType.GetProperty("quality", BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public); itemsList = obj; itemType = elementType; spawnItemMethod = methodInfo; itemNameProp = propertyInfo; return true; } private bool DiscoverEnemiesApi() { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name.Equals("REPOLib", StringComparison.OrdinalIgnoreCase)); if (assembly == null) { return false; } List<Type> list = (from t in assembly.GetTypes() where t.Namespace != null && t.Namespace.StartsWith("REPOLib", StringComparison.OrdinalIgnoreCase) && (t.Name.IndexOf("Enemy", StringComparison.OrdinalIgnoreCase) >= 0 || t.Name.IndexOf("Enemies", StringComparison.OrdinalIgnoreCase) >= 0 || t.Name.IndexOf("Mob", StringComparison.OrdinalIgnoreCase) >= 0 || t.Name.IndexOf("NPC", StringComparison.OrdinalIgnoreCase) >= 0) select t).ToList(); object obj = null; Type elementType = null; Type type = null; foreach (Type item in list) { PropertyInfo[] properties = item.GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { if (!propertyInfo.PropertyType.IsGenericType) { continue; } Type[] genericArguments = propertyInfo.PropertyType.GetGenericArguments(); if (genericArguments.Length != 1) { continue; } Type type2 = genericArguments[0]; string text = type2.Name.ToLowerInvariant(); if (text.Contains("enemy") || text.Contains("mob") || text.Contains("npc")) { object obj2 = null; try { obj2 = propertyInfo.GetValue(null, null); } catch { } if (obj2 != null) { obj = obj2; elementType = type2; type = item; break; } } } if (obj != null) { break; } } MethodInfo methodInfo = null; IEnumerable<Type> enumerable2; if (!(type != null)) { IEnumerable<Type> enumerable = list; enumerable2 = enumerable; } else { IEnumerable<Type> enumerable = new Type[1] { type }; enumerable2 = enumerable; } foreach (Type item2 in enumerable2) { MethodInfo methodInfo2 = item2.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault(delegate(MethodInfo m) { if (m.Name.IndexOf("spawn", StringComparison.OrdinalIgnoreCase) < 0) { return false; } ParameterInfo[] parameters = m.GetParameters(); if (parameters.Length < 2) { return false; } bool num = (elementType != null && parameters[0].ParameterType == elementType) || parameters[0].ParameterType == typeof(string); bool flag = parameters[1].ParameterType == typeof(Vector3); return num && flag; }); if (methodInfo2 != null) { methodInfo = methodInfo2; type = item2; break; } } if (methodInfo == null) { return false; } PropertyInfo propertyInfo2 = elementType?.GetProperty("name", BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public) ?? elementType?.GetProperty("displayName", BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public) ?? elementType?.GetProperty("Name", BindingFlags.Instance | BindingFlags.Public); enemiesList = obj; enemyType = elementType; spawnEnemyMethod = methodInfo; enemyNameProp = propertyInfo2; return true; } private bool TrySpawnEnemy(Vector3 pos) { //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) try { if (spawnEnemyMethod == null) { return false; } ParameterInfo[] parameters = spawnEnemyMethod.GetParameters(); object[] array = new object[parameters.Length]; object obj = null; List<object> list = ToObjectList(enemiesList); if (list != null && list.Count > 0 && enemyType != null) { object obj2 = list[rng.Next(list.Count)]; if (parameters[0].ParameterType == enemyType) { obj = obj2; } else { string name = GetName(obj2, enemyNameProp); if (!string.IsNullOrEmpty(name)) { obj = name; } } } if (obj == null && parameters[0].ParameterType == typeof(string)) { List<string> list2 = new List<string>(); if (list != null) { foreach (object item in list) { string name2 = GetName(item, enemyNameProp); if (!string.IsNullOrWhiteSpace(name2)) { list2.Add(name2); } if (list2.Count > 32) { break; } } } if (list2.Count > 0) { obj = list2[rng.Next(list2.Count)]; } } if (obj == null) { return false; } array[0] = obj; if (parameters.Length >= 2 && parameters[1].ParameterType == typeof(Vector3)) { array[1] = pos; } for (int i = 2; i < parameters.Length; i++) { Type parameterType = parameters[i].ParameterType; if (parameterType == typeof(Quaternion)) { array[i] = Quaternion.identity; } else if (parameterType == typeof(int)) { array[i] = 1; } else if (parameterType == typeof(float)) { array[i] = 1f; } else if (parameterType == typeof(bool)) { array[i] = true; } else { array[i] = null; } } spawnEnemyMethod.Invoke(null, array); return true; } catch { return false; } } private string GetName(object obj, PropertyInfo nameProp) { if (obj == null) { return null; } if (nameProp != null) { try { return nameProp.GetValue(obj)?.ToString(); } catch { } } return obj.ToString(); } [IteratorStateMachine(typeof(<RareAlarmEvent>d__65))] private IEnumerator RareAlarmEvent(Vector3 epicenter) { //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 <RareAlarmEvent>d__65(0) { <>4__this = this, epicenter = epicenter }; } [IteratorStateMachine(typeof(<FlickerLights>d__66))] private IEnumerator FlickerLights(Light[] lights, float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FlickerLights>d__66(0) { lights = lights, duration = duration }; } [IteratorStateMachine(typeof(<CameraShake>d__67))] private IEnumerator CameraShake(float duration, float amplitude, float frequency) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CameraShake>d__67(0) { duration = duration, amplitude = amplitude, frequency = frequency }; } [IteratorStateMachine(typeof(<DestructionPulses>d__68))] private IEnumerator DestructionPulses(Vector3 center, float duration) { //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 <DestructionPulses>d__68(0) { <>4__this = this, center = center, duration = duration }; } private void DoDestructionPulse(Vector3 center, float radius, float force) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 3; i++) { float num = radius * (0.6f + 0.2f * (float)i); float num2 = force * (1f - 0.2f * (float)i); Collider[] array = Physics.OverlapSphere(center, num, -1, (QueryTriggerInteraction)1); foreach (Collider val in array) { if (Object.op_Implicit((Object)(object)val)) { Rigidbody attachedRigidbody = val.attachedRigidbody; if ((Object)(object)attachedRigidbody != (Object)null) { attachedRigidbody.isKinematic = false; attachedRigidbody.AddExplosionForce(num2, center, num, 1.5f, (ForceMode)1); attachedRigidbody.AddTorque(Random.onUnitSphere * num2 * 0.2f, (ForceMode)1); } GameObject go = (Object.op_Implicit((Object)(object)attachedRigidbody) ? ((Component)attachedRigidbody).gameObject : ((Component)val).gameObject); TryCallBreakLikeMethods(go); TryViolentOpenDoor(go); } } } } private void TryCallBreakLikeMethods(GameObject go) { if (!Object.op_Implicit((Object)(object)go)) { return; } Component[] components = go.GetComponents<Component>(); foreach (Component val in components) { if (!Object.op_Implicit((Object)(object)val)) { continue; } Type type = ((object)val).GetType(); MethodInfo methodInfo = type.GetMethod("Break", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Shatter", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("DestroyItem", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Explode", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Kill", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Die", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("OnBreak", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); try { if (methodInfo != null) { methodInfo.Invoke(val, null); } } catch { } MethodInfo methodInfo2 = type.GetMethod("TakeDamage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(float) }, null) ?? type.GetMethod("TakeDamage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(int) }, null); try { if (methodInfo2 != null) { if (methodInfo2.GetParameters()[0].ParameterType == typeof(float)) { methodInfo2.Invoke(val, new object[1] { 9999f }); } else { methodInfo2.Invoke(val, new object[1] { 9999 }); } } } catch { } } } private void TryViolentOpenDoor(GameObject go) { //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)go)) { return; } Component[] components = go.GetComponents<Component>(); foreach (Component val in components) { if (!Object.op_Implicit((Object)(object)val)) { continue; } Type type = ((object)val).GetType(); string text = type.Name.ToLowerInvariant(); if (!text.Contains("door") && !text.Contains("gate")) { continue; } FieldInfo fieldInfo = type.GetField("isLocked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("locked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); try { if (fieldInfo != null) { fieldInfo.SetValue(val, false); } } catch { } PropertyInfo propertyInfo = type.GetProperty("IsLocked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetProperty("Locked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); try { if (propertyInfo != null && propertyInfo.CanWrite) { propertyInfo.SetValue(val, false, null); } } catch { } MethodInfo methodInfo = type.GetMethod("ForceOpen", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Open", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("BreakDoor", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Breach", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); try { if (methodInfo != null) { methodInfo.Invoke(val, null); } } catch { } HingeJoint[] components2 = go.GetComponents<HingeJoint>(); foreach (HingeJoint val2 in components2) { try { ((Joint)val2).breakForce = 1f; ((Joint)val2).breakTorque = 1f; if (Object.op_Implicit((Object)(object)((Joint)val2).connectedBody)) { ((Joint)val2).connectedBody.AddExplosionForce(300f, go.transform.position, 2f, 0.5f, (ForceMode)1); } } catch { } } Rigidbody component = go.GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component)) { component.AddForce(Random.onUnitSphere * 800f, (ForceMode)1); } } } [IteratorStateMachine(typeof(<CrackRoutine>d__72))] private IEnumerator CrackRoutine(Vector3 center, float duration) { //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 <CrackRoutine>d__72(0) { <>4__this = this, center = center, duration = duration }; } [IteratorStateMachine(typeof(<BlackoutEvent>d__73))] private IEnumerator BlackoutEvent() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BlackoutEvent>d__73(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<ConfettiStorm>d__74))] private IEnumerator ConfettiStorm(Vector3 center) { //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 <ConfettiStorm>d__74(0) { <>4__this = this, center = center }; } private static Material TryBuildColoredMaterial(Color color, Material fallbackBase) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Unlit/Color") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Standard"); Material val2 = null; try { if ((Object)(object)val != (Object)null) { val2 = new Material(val); } else if ((Object)(object)fallbackBase != (Object)null) { val2 = new Material(fallbackBase); } } catch { } if ((Object)(object)val2 != (Object)null) { if (val2.HasProperty("_Color")) { val2.SetColor("_Color", color); } else if (val2.HasProperty("_BaseColor")) { val2.SetColor("_BaseColor", color); } } return val2; } [IteratorStateMachine(typeof(<DoorMayhem>d__76))] private IEnumerator DoorMayhem() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoorMayhem>d__76(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<LightningStorm>d__77))] private IEnumerator LightningStorm() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LightningStorm>d__77(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<FlashRoutine>d__78))] private IEnumerator FlashRoutine(float upTime, float downTime) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FlashRoutine>d__78(0) { <>4__this = this, upTime = upTime, downTime = downTime }; } [IteratorStateMachine(typeof(<SurgeLight>d__79))] private IEnumerator SurgeLight(Light L, float peak, float time) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SurgeLight>d__79(0) { L = L, peak = peak, time = time }; } [IteratorStateMachine(typeof(<PlayAfter>d__80))] private IEnumerator PlayAfter(float delay, Action play) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PlayAfter>d__80(0) { delay = delay, play = play }; } private bool LooksLikeList(Type t, out Type elementType) { elementType = null; if (!t.IsGenericType || t.GetGenericArguments().Length != 1) { return false; } Type genericTypeDefinition = t.GetGenericTypeDefinition(); if (genericTypeDefinition == typeof(List<>) || genericTypeDefinition == typeof(IList<>) || genericTypeDefinition.FullName == "System.Collections.Generic.IReadOnlyList`1") { elementType = t.GetGenericArguments()[0]; return true; } return false; } private List<object> ToObjectList(object listObj) { if (listObj == null) { return null; } if (listObj is IList list) { List<object> list2 = new List<object>(list.Count); { foreach (object item in list) { list2.Add(item); } return list2; } } if (listObj is IEnumerable enumerable) { List<object> list3 = new List<object>(); { foreach (object item2 in enumerable) { list3.Add(item2); } return list3; } } return null; } private (object item, string rarity) PickWithRarity(List<object> list) { if (list == null || list.Count == 0) { return (null, "other"); } if (rarityProp == null) { return (list[rng.Next(list.Count)], "other"); } List<object> list2 = new List<object>(); List<object> list3 = new List<object>(); List<object> list4 = new List<object>(); List<object> list5 = new List<object>(); foreach (object item in list) { try { string text = rarityProp.GetValue(item)?.ToString()?.ToLowerInvariant() ?? ""; if (text.Contains("legend")) { list4.Add(item); } else if (text.Contains("rare")) { list3.Add(item); } else if (text.Contains("common")) { list2.Add(item); } else { list5.Add(item); } } catch { list5.Add(item); } } int num = 80; int num2 = 15; int num3 = 5; List<(List<object>, int, string)> list6 = new List<(List<object>, int, string)> { (list2, (list2.Count > 0) ? num : 0, "common"), (list3, (list3.Count > 0) ? num2 : 0, "rare"), (list4, (list4.Count > 0) ? num3 : 0, "legendary"), (list5, (list5.Count > 0) ? 20 : 0, "other") }; int num4 = list6.Sum<(List<object>, int, string)>(((List<object> l, int w, string tag) b) => b.w); if (num4 == 0) { return (list[rng.Next(list.Count)], "other"); } int num5 = rng.Next(num4); foreach (var item2 in list6) { if (num5 < item2.Item2) { return (item2.Item1[rng.Next(item2.Item1.Count)], item2.Item3); } num5 -= item2.Item2; } return (list[rng.Next(list.Count)], "other"); } private void TrySpawnItem(object choice, Vector3 pos) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) try { ParameterInfo[] parameters = spawnItemMethod.GetParameters(); object[] array = new object[parameters.Length]; if (parameters[0].ParameterType == itemType) { array[0] = choice; } else { string text = ((!(itemNameProp != null)) ? choice?.ToString() : itemNameProp.GetValue(choice)?.ToString()); if (string.IsNullOrEmpty(text)) { return; } array[0] = text; } if (parameters.Length >= 2 && parameters[1].ParameterType == typeof(Vector3)) { array[1] = pos; } for (int i = 2; i < parameters.Length; i++) { Type parameterType = parameters[i].ParameterType; if (parameterType == typeof(Quaternion)) { array[i] = Quaternion.identity; } else if (parameterType == typeof(int)) { array[i] = 1; } else if (parameterType == typeof(float)) { array[i] = 1f; } else if (parameterType == typeof(bool)) { array[i] = true; } else { array[i] = null; } } spawnItemMethod.Invoke(null, array); } catch (Exception ex) { RandomItemOnP.Log.LogError((object)("[RandomItemOnP] Spawn item failed: " + ex)); } } private List<Transform> FindPlayerTransforms() { List<Transform> list = new List<Transform>(); GameObject[] array = GameObject.FindGameObjectsWithTag("Player"); if (array != null) { GameObject[] array2 = array; foreach (GameObject val in array2) { if (Object.op_Implicit((Object)(object)val)) { list.Add(val.transform); } } } Component[] array3 = Object.FindObjectsOfType<Component>(); foreach (Component val2 in array3) { if (Object.op_Implicit((Object)(object)val2) && ((object)val2).GetType().Name.IndexOf("Player", StringComparison.OrdinalIgnoreCase) >= 0) { Transform transform = val2.transform; if (Object.op_Implicit((Object)(object)transform) && !list.Contains(transform)) { list.Add(transform); } } } return list; } } }