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 Mystery Box v1.2.3
MysteryBox.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using ExitGames.Client.Photon; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MysteryBox")] [assembly: AssemblyTitle("MysteryBox")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace EmpressMysteryBox { [BepInPlugin("Empress.MysteryBox", "Empress Mystery Box", "3.1.9")] public class EmpressMysteryBoxMod : BaseUnityPlugin { [CompilerGenerated] private sealed class <WaitAndHijackStation>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EmpressMysteryBoxMod <>4__this; private float <timeout>5__1; private float <timer>5__2; private ChargingStation <station>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitAndHijackStation>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <station>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <timeout>5__1 = 60f; <timer>5__2 = 0f; goto IL_0085; case 1: <>1__state = -1; goto IL_0085; case 2: { <>1__state = -1; <station>5__3 = Object.FindObjectOfType<ChargingStation>(); if ((Object)(object)<station>5__3 != (Object)null) { if (((Object)((Component)<station>5__3).gameObject).name == "ChargingStation(Clone)") { GameObject gameObject = ((Component)<station>5__3).gameObject; Vector3 position = ((Component)<station>5__3).transform.position; ((Object)gameObject).name = $"ChargingStation_{((Vector3)(ref position)).sqrMagnitude}"; } if ((Object)(object)((Component)<station>5__3).gameObject.GetComponent<MysteryBoxLogic>() == (Object)null) { ((Component)<station>5__3).gameObject.AddComponent<MysteryBoxLogic>(); Log.LogInfo((object)"Charging Station Hijacked for Mystery Box."); } } else if (!BlockedMenuOrHub()) { Log.LogWarning((object)"No ChargingStation found in this level."); } return false; } IL_0085: if ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { if (<timer>5__2 > <timeout>5__1) { return false; } <timer>5__2 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } <>2__current = (object)new WaitForSeconds(1f); <>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(); } } public static EmpressMysteryBoxMod Instance; public static ManualLogSource Log; public const byte EventCode_MysteryBox = 110; private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); SceneManager.sceneLoaded += OnSceneLoaded; Log.LogInfo((object)"Empress Mystery Box loaded."); } private void Start() { if (PhotonNetwork.NetworkingClient != null) { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; } } private void OnDestroy() { if (PhotonNetwork.NetworkingClient != null) { PhotonNetwork.NetworkingClient.EventReceived -= OnEvent; } } private void OnEvent(EventData photonEvent) { if (photonEvent.Code != 110) { return; } try { if (!(photonEvent.CustomData is object[] array) || array.Length < 2) { return; } string text = (string)array[0]; int num = (int)array[1]; GameObject val = GameObject.Find(text); if (!((Object)(object)val != (Object)null)) { return; } MysteryBoxLogic component = val.GetComponent<MysteryBoxLogic>(); if ((Object)(object)component != (Object)null) { if (num == -1) { component.PlayRollVisuals(); } else { component.StopRollAndShowPrize(); } } } catch (Exception arg) { Log.LogError((object)$"Error processing MysteryBox event: {arg}"); } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { ((MonoBehaviour)this).StopAllCoroutines(); if (BlockedMenuOrHub()) { Log.LogInfo((object)"Lobby/Menu detected. Mystery Box disabled."); } else { ((MonoBehaviour)this).StartCoroutine(WaitAndHijackStation()); } } [IteratorStateMachine(typeof(<WaitAndHijackStation>d__8))] private IEnumerator WaitAndHijackStation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitAndHijackStation>d__8(0) { <>4__this = this }; } private static bool BlockedMenuOrHub() { try { if (SemiFunc.MenuLevel() || SemiFunc.RunIsLobbyMenu() || SemiFunc.RunIsTutorial()) { return true; } RunManager instance = RunManager.instance; Level val = instance?.levelCurrent; if ((Object)(object)instance == (Object)null || (Object)(object)val == (Object)null) { return true; } string text = (val.NarrativeName ?? "").Trim().ToLowerInvariant(); string text2 = (val.ResourcePath ?? "").Trim().ToLowerInvariant(); if (text.Contains("lobby") || text2.Contains("lobby")) { return true; } if (text.Contains("menu") || text2.Contains("menu")) { return true; } if (text.Contains("splash") || text2.Contains("splash")) { return true; } return false; } catch { return true; } } } public class LootEntry { public GameObject displayPrefab; public string networkPath; } public class MysteryBoxLogic : MonoBehaviour { [CompilerGenerated] private sealed class <PrizeCountdown>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject prize; public MysteryBoxLogic <>4__this; private float <limit>5__1; private float <timer>5__2; private PhysGrabObject <grab>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PrizeCountdown>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <grab>5__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <limit>5__1 = 10f; <timer>5__2 = 0f; break; case 1: <>1__state = -1; <grab>5__3 = null; break; } if (<timer>5__2 < <limit>5__1) { if ((Object)(object)prize == (Object)null) { return false; } <grab>5__3 = prize.GetComponent<PhysGrabObject>(); if ((Object)(object)<grab>5__3 != (Object)null && <grab>5__3.playerGrabbing.Count > 0) { return false; } <timer>5__2 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } if ((Object)(object)prize != (Object)null) { if (PhotonNetwork.IsConnected) { PhotonNetwork.Destroy(prize); } else { Object.Destroy((Object)(object)prize); } } 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 <RollAnimation>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MysteryBoxLogic <>4__this; private float <speed>5__1; private float <elapsed>5__2; private float <spinAngle>5__3; private Vector3 <visualPos>5__4; private LootEntry <randomItem>5__5; private MonoBehaviour[] <scripts>5__6; private MonoBehaviour[] <>s__7; private int <>s__8; private MonoBehaviour <s>5__9; private MonoBehaviour[] <>s__10; private int <>s__11; private MonoBehaviour <s>5__12; private Rigidbody[] <>s__13; private int <>s__14; private Rigidbody <rb>5__15; private Collider[] <>s__16; private int <>s__17; private Collider <c>5__18; private Joint[] <>s__19; private int <>s__20; private Joint <j>5__21; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RollAnimation>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <randomItem>5__5 = null; <scripts>5__6 = null; <>s__7 = null; <s>5__9 = null; <>s__10 = null; <s>5__12 = null; <>s__13 = null; <rb>5__15 = null; <>s__16 = null; <c>5__18 = null; <>s__19 = null; <j>5__21 = null; <>1__state = -2; } private bool MoveNext() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (lootPool.Count == 0) { <>4__this.PopulateLootPool(); } if (lootPool.Count == 0) { return false; } <speed>5__1 = 0.1f; <elapsed>5__2 = 0f; <spinAngle>5__3 = 0f; <visualPos>5__4 = <>4__this.chargeArea.position + Vector3.up * 0.5f; break; case 1: <>1__state = -1; <elapsed>5__2 += <speed>5__1; if (<elapsed>5__2 > 3f) { <speed>5__1 += 0.05f; } <randomItem>5__5 = null; break; } if ((Object)(object)<>4__this.ghostModel != (Object)null) { Object.Destroy((Object)(object)<>4__this.ghostModel); } <randomItem>5__5 = lootPool[Random.Range(0, lootPool.Count)]; if (<randomItem>5__5 != null && (Object)(object)<randomItem>5__5.displayPrefab != (Object)null) { <spinAngle>5__3 += 90f; <>4__this.ghostModel = Object.Instantiate<GameObject>(<randomItem>5__5.displayPrefab, <visualPos>5__4, Quaternion.Euler(0f, <spinAngle>5__3, 0f)); <scripts>5__6 = <>4__this.ghostModel.GetComponentsInChildren<MonoBehaviour>(true); <>s__7 = <scripts>5__6; for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++) { <s>5__9 = <>s__7[<>s__8]; ((Behaviour)<s>5__9).enabled = false; <s>5__9 = null; } <>s__7 = null; <>s__10 = <scripts>5__6; for (<>s__11 = 0; <>s__11 < <>s__10.Length; <>s__11++) { <s>5__12 = <>s__10[<>s__11]; Object.Destroy((Object)(object)<s>5__12); <s>5__12 = null; } <>s__10 = null; <>s__13 = <>4__this.ghostModel.GetComponentsInChildren<Rigidbody>(true); for (<>s__14 = 0; <>s__14 < <>s__13.Length; <>s__14++) { <rb>5__15 = <>s__13[<>s__14]; Object.Destroy((Object)(object)<rb>5__15); <rb>5__15 = null; } <>s__13 = null; <>s__16 = <>4__this.ghostModel.GetComponentsInChildren<Collider>(true); for (<>s__17 = 0; <>s__17 < <>s__16.Length; <>s__17++) { <c>5__18 = <>s__16[<>s__17]; Object.Destroy((Object)(object)<c>5__18); <c>5__18 = null; } <>s__16 = null; <>s__19 = <>4__this.ghostModel.GetComponentsInChildren<Joint>(true); for (<>s__20 = 0; <>s__20 < <>s__19.Length; <>s__20++) { <j>5__21 = <>s__19[<>s__20]; Object.Destroy((Object)(object)<j>5__21); <j>5__21 = null; } <>s__19 = null; <scripts>5__6 = null; } <>2__current = (object)new WaitForSeconds(<speed>5__1); <>1__state = 1; 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 <ScanRoutine>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MysteryBoxLogic <>4__this; private Collider[] <hits>5__1; private Collider[] <>s__2; private int <>s__3; private Collider <hit>5__4; private EnemyValuable <enemyVal>5__5; private PhysGrabObject <grab>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ScanRoutine>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <hits>5__1 = null; <>s__2 = null; <hit>5__4 = null; <enemyVal>5__5 = null; <grab>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00a2: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)<>4__this.chargeArea == (Object)null) { return false; } break; case 1: <>1__state = -1; break; } if ((!PhotonNetwork.IsConnected || PhotonNetwork.IsMasterClient) && !<>4__this.isBusy) { <hits>5__1 = Physics.OverlapBox(<>4__this.chargeArea.position, <>4__this.chargeArea.localScale / 2f, <>4__this.chargeArea.localRotation, LayerMask.op_Implicit(SemiFunc.LayerMaskGetPhysGrabObject())); <>s__2 = <hits>5__1; for (<>s__3 = 0; <>s__3 < <>s__2.Length; <>s__3++) { <hit>5__4 = <>s__2[<>s__3]; <enemyVal>5__5 = ((Component)<hit>5__4).GetComponentInParent<EnemyValuable>(); if ((Object)(object)<enemyVal>5__5 != (Object)null) { <grab>5__6 = ((Component)<enemyVal>5__5).GetComponent<PhysGrabObject>(); if ((Object)(object)<grab>5__6 != (Object)null && <grab>5__6.playerGrabbing.Count == 0) { EmpressMysteryBoxMod.Log.LogInfo((object)("Accepted Enemy Valuable: " + ((Object)((Component)<enemyVal>5__5).gameObject).name)); <>4__this.StartMysteryBoxEvent(<grab>5__6); break; } <grab>5__6 = null; } <enemyVal>5__5 = null; <hit>5__4 = null; } <>s__2 = null; <hits>5__1 = null; } <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; 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 <ServerProcessRoutine>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MysteryBoxLogic <>4__this; private LootEntry <win>5__1; private Vector3 <spawnPos>5__2; private GameObject <prize>5__3; private RaiseEventOptions <options>5__4; private object[] <data>5__5; private RaiseEventOptions <options>5__6; private object[] <data>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ServerProcessRoutine>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <win>5__1 = null; <prize>5__3 = null; <options>5__4 = null; <data>5__5 = null; <options>5__6 = null; <data>5__7 = null; <>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 //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00c0: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_023b: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_010c: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(4.5f); <>1__state = 1; return true; case 1: <>1__state = -1; if (lootPool.Count == 0) { <>4__this.PopulateLootPool(); } if (lootPool.Count > 0) { <win>5__1 = lootPool[Random.Range(0, lootPool.Count)]; <spawnPos>5__2 = <>4__this.chargeArea.position + Vector3.up * 0.5f; if (PhotonNetwork.IsConnected) { <prize>5__3 = PhotonNetwork.Instantiate(<win>5__1.networkPath, <spawnPos>5__2, Quaternion.identity, (byte)0, (object[])null); <options>5__4 = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; <data>5__5 = new object[2] { ((Object)((Component)<>4__this).gameObject).name, PunExtensions.GetPhotonView(<prize>5__3).ViewID }; PhotonNetwork.RaiseEvent((byte)110, (object)<data>5__5, <options>5__4, SendOptions.SendReliable); <options>5__4 = null; <data>5__5 = null; } else { <prize>5__3 = Object.Instantiate<GameObject>(<win>5__1.displayPrefab, <spawnPos>5__2, Quaternion.identity); <>4__this.StopRollAndShowPrize(); } <>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.PrizeCountdown(<prize>5__3)); <>1__state = 2; return true; } if (PhotonNetwork.IsConnected) { <options>5__6 = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; <data>5__7 = new object[2] { ((Object)((Component)<>4__this).gameObject).name, -999 }; PhotonNetwork.RaiseEvent((byte)110, (object)<data>5__7, <options>5__6, SendOptions.SendReliable); <options>5__6 = null; <data>5__7 = null; } else { <>4__this.StopRollAndShowPrize(); } break; case 2: <>1__state = -1; <win>5__1 = null; <prize>5__3 = null; break; } <>4__this.isBusy = 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(); } } private bool isBusy = false; private GameObject ghostModel; private Coroutine rollCoroutine; private static List<LootEntry> lootPool = new List<LootEntry>(); private Transform chargeArea; private void Start() { chargeArea = ((Component)this).transform.Find("Charge Area"); if (lootPool.Count == 0) { PopulateLootPool(); } ((MonoBehaviour)this).StartCoroutine(ScanRoutine()); } private void PopulateLootPool() { if ((Object)(object)StatsManager.instance == (Object)null || StatsManager.instance.itemDictionary == null || lootPool.Count > 0) { return; } try { foreach (Item value in StatsManager.instance.itemDictionary.Values) { if ((Object)(object)value == (Object)null) { continue; } Type type = ((object)value).GetType(); object obj = type.GetField("prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value) ?? type.GetProperty("prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value, null); if (obj != null) { Type type2 = obj.GetType(); string text = (type2.GetProperty("ResourcePath", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(obj, null) as string) ?? (type2.GetField("ResourcePath", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(obj) as string); object? obj2 = type2.GetProperty("Prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(obj, null); GameObject val = (GameObject)(((obj2 is GameObject) ? obj2 : null) ?? ((object)/*isinst with value type is only supported in some contexts*/)); if (!string.IsNullOrEmpty(text) && (Object)(object)val != (Object)null && (Object)(object)val.GetComponent<PhotonView>() != (Object)null) { lootPool.Add(new LootEntry { displayPrefab = val, networkPath = text }); } } } EmpressMysteryBoxMod.Log.LogInfo((object)$"Loot Pool Populated: {lootPool.Count} items."); } catch (Exception ex) { EmpressMysteryBoxMod.Log.LogError((object)("Error populating loot pool: " + ex.Message)); } } [IteratorStateMachine(typeof(<ScanRoutine>d__7))] private IEnumerator ScanRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ScanRoutine>d__7(0) { <>4__this = this }; } private void StartMysteryBoxEvent(PhysGrabObject obj) { //IL_0053: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) isBusy = true; if ((Object)(object)obj != (Object)null && (Object)(object)((Component)obj).gameObject != (Object)null) { if (PhotonNetwork.IsConnected) { PhotonNetwork.Destroy(((Component)obj).gameObject); } else { Object.Destroy((Object)(object)((Component)obj).gameObject); } } if (PhotonNetwork.IsConnected) { RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; object[] array = new object[2] { ((Object)((Component)this).gameObject).name, -1 }; PhotonNetwork.RaiseEvent((byte)110, (object)array, val, SendOptions.SendReliable); } else { PlayRollVisuals(); } ((MonoBehaviour)this).StartCoroutine(ServerProcessRoutine()); } [IteratorStateMachine(typeof(<ServerProcessRoutine>d__9))] private IEnumerator ServerProcessRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ServerProcessRoutine>d__9(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<PrizeCountdown>d__10))] private IEnumerator PrizeCountdown(GameObject prize) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PrizeCountdown>d__10(0) { <>4__this = this, prize = prize }; } public void PlayRollVisuals() { if (rollCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(rollCoroutine); } rollCoroutine = ((MonoBehaviour)this).StartCoroutine(RollAnimation()); } public void StopRollAndShowPrize() { if (rollCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(rollCoroutine); } if ((Object)(object)ghostModel != (Object)null) { Object.Destroy((Object)(object)ghostModel); } } [IteratorStateMachine(typeof(<RollAnimation>d__13))] private IEnumerator RollAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RollAnimation>d__13(0) { <>4__this = this }; } } }