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 Majoras Mask v1.0.0
BinaryView.dll
Decompiled 4 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.Events; [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+31d33a1e262fb9cd936a8fd3f583fdd7bc996e5a")] [assembly: AssemblyProduct("BinaryView")] [assembly: AssemblyTitle("BinaryView")] [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 ValuableMask { [BepInPlugin("omniscye.valuablemask", "ValuableMask", "1.2.1")] public class ValuableMaskPlugin : BaseUnityPlugin { internal static ValuableMaskPlugin Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { Instance = this; Logger.LogInfo((object)"ValuableMask v1.2.1 loaded."); } } public class ValuableMaskLatch : Trap { [CompilerGenerated] private sealed class <FloatRoutine>d__41 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int grabberViewId; public Vector3 originWorldPos; public ValuableMaskLatch <>4__this; private float <t>5__1; private Vector3 <startPos>5__2; private int <i>5__3; private int <i>5__4; private float <k>5__5; private float <phase>5__6; private Vector3 <shake>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FloatRoutine>d__41(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_005d: 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_0078: 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_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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this._origParent = ((Component)<>4__this).transform.parent; <>4__this._origLocalPos = ((Component)<>4__this).transform.localPosition; <>4__this._origLocalRot = ((Component)<>4__this).transform.localRotation; <>4__this._origLocalScale = ((Component)<>4__this).transform.localScale; <>4__this._rbHad = (Object)(object)<>4__this._rb != (Object)null; if (<>4__this._rbHad) { <>4__this._rbWasKinematic = <>4__this._rb.isKinematic; <>4__this._rbPrevConstraints = <>4__this._rb.constraints; <>4__this._rb.isKinematic = true; <>4__this._rb.constraints = (RigidbodyConstraints)126; } <>4__this._colsPrev = new bool[<>4__this._cols.Length]; <i>5__3 = 0; while (<i>5__3 < <>4__this._cols.Length) { <>4__this._colsPrev[<i>5__3] = <>4__this._cols[<i>5__3].enabled; <>4__this._cols[<i>5__3].enabled = false; <i>5__3++; } <>4__this._ptvPrevEnabled = new bool[<>4__this._ptv.Length]; <i>5__4 = 0; while (<i>5__4 < <>4__this._ptv.Length) { if (Object.op_Implicit((Object)(object)<>4__this._ptv[<i>5__4])) { <>4__this._ptvPrevEnabled[<i>5__4] = ((Behaviour)<>4__this._ptv[<i>5__4]).enabled; ((Behaviour)<>4__this._ptv[<i>5__4]).enabled = false; } <i>5__4++; } <>4__this.ForceReleaseFromAllGrabbers(); <>4__this._floatAnchor = originWorldPos + Vector3.up * <>4__this.floatHeight; <>4__this._floatTimer = 0f; if (Object.op_Implicit((Object)(object)<>4__this._audio) && Object.op_Implicit((Object)(object)<>4__this.startFloatClip)) { <>4__this._audio.PlayOneShot(<>4__this.startFloatClip); } <t>5__1 = 0f; <startPos>5__2 = ((Component)<>4__this).transform.position; ((Component)<>4__this).transform.SetParent((Transform)null, true); goto IL_03cd; case 1: <>1__state = -1; goto IL_03cd; case 2: { <>1__state = -1; break; } IL_03cd: if (!<>4__this._resolved && <t>5__1 < 0.25f) { <t>5__1 += Time.deltaTime; <k>5__5 = Mathf.Clamp01(<t>5__1 / 0.25f); ((Component)<>4__this).transform.position = Vector3.Lerp(<startPos>5__2, <>4__this._floatAnchor, <k>5__5); ((Component)<>4__this).transform.Rotate(Vector3.up, <>4__this.spinDegreesPerSecond * Time.deltaTime, (Space)0); <>2__current = null; <>1__state = 1; return true; } break; } if (!<>4__this._resolved) { <>4__this._floatTimer += Time.deltaTime; <phase>5__6 = <>4__this._floatTimer * <>4__this.shakeFrequency * MathF.PI * 2f; <shake>5__7 = ((Component)<>4__this).transform.right * (Mathf.Sin(<phase>5__6) * <>4__this.shakeAmplitude) + ((Component)<>4__this).transform.forward * (Mathf.Cos(<phase>5__6 * 0.5f) * (<>4__this.shakeAmplitude * 0.5f)); ((Component)<>4__this).transform.position = <>4__this._floatAnchor + <shake>5__7; ((Component)<>4__this).transform.Rotate(Vector3.up, <>4__this.spinDegreesPerSecond * Time.deltaTime, (Space)0); <>2__current = null; <>1__state = 2; 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 <MasterResolveRoutine>d__36 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ValuableMaskLatch <>4__this; private bool <explode>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MasterResolveRoutine>d__36(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.floatSeconds); <>1__state = 1; return true; case 1: <>1__state = -1; <explode>5__1 = Random.value < Mathf.Clamp01(<>4__this.explodeChance); if (<explode>5__1) { ((Trap)<>4__this).photonView.RPC("RPC_ExplodeNow", (RpcTarget)0, Array.Empty<object>()); } else { ((Trap)<>4__this).photonView.RPC("RPC_SafeNow", (RpcTarget)0, Array.Empty<object>()); } 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 <SingleplayerResolveRoutine>d__37 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ValuableMaskLatch <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SingleplayerResolveRoutine>d__37(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.floatSeconds); <>1__state = 1; return true; case 1: <>1__state = -1; if (Random.value < Mathf.Clamp01(<>4__this.explodeChance)) { <>4__this.RPC_ExplodeNow(); } else { <>4__this.RPC_SafeNow(); } 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(); } } [Header("Float & Shake")] public float floatSeconds = 5f; public float floatHeight = 1.1f; public float shakeAmplitude = 0.35f; public float shakeFrequency = 6f; public float spinDegreesPerSecond = 180f; [Header("Explosion")] [Range(0f, 1f)] public float explodeChance = 0.33f; public float explosionSize = 1f; public int explosionDamageMin = 50; public int explosionDamageMax = 100; public UnityEvent onDetonate; [Header("SFX")] public AudioClip startFloatClip; public AudioSource audioSource; private AudioSource _audio; private bool _grabPrev; private bool _armed; private bool _resolved; private Rigidbody _rb; private bool _rbHad; private bool _rbWasKinematic; private RigidbodyConstraints _rbPrevConstraints; private Collider[] _cols = Array.Empty<Collider>(); private bool[] _colsPrev; private PhotonTransformView[] _ptv = Array.Empty<PhotonTransformView>(); private bool[] _ptvPrevEnabled; private Transform _origParent; private Vector3 _origLocalPos; private Quaternion _origLocalRot; private Vector3 _origLocalScale; private Vector3 _floatAnchor; private float _floatTimer; private ParticleScriptExplosion _particleScriptExplosion; private ItemAttributes _itemAttributes; private PhysGrabObjectImpactDetector _impactDetector; public override void Start() { ((Trap)this).Start(); _audio = (AudioSource)(Object.op_Implicit((Object)(object)audioSource) ? ((object)audioSource) : ((object)((Component)this).GetComponent<AudioSource>())); if (!Object.op_Implicit((Object)(object)_audio)) { _audio = ((Component)this).gameObject.AddComponent<AudioSource>(); } _audio.playOnAwake = false; _audio.loop = false; _audio.spatialBlend = 1f; _audio.rolloffMode = (AudioRolloffMode)0; _audio.minDistance = 4f; _audio.maxDistance = 28f; _rb = ((Component)this).GetComponent<Rigidbody>(); _cols = ((Component)this).GetComponentsInChildren<Collider>(true); _ptv = ((Component)this).GetComponentsInChildren<PhotonTransformView>(true); _particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>(); _itemAttributes = ((Component)this).GetComponent<ItemAttributes>(); _impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>(); } public override void Update() { ((Trap)this).Update(); if (!SemiFunc.IsMultiplayer() || PhotonNetwork.IsMasterClient) { bool flag = Object.op_Implicit((Object)(object)base.physGrabObject) && base.physGrabObject.grabbed; if (flag && !_grabPrev) { BeginFloatSequence(broadcast: true); } _grabPrev = flag; } } private void BeginFloatSequence(bool broadcast) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (!_armed) { _armed = true; PhotonView val = FindGrabberPhotonViewRobust(); int num = (Object.op_Implicit((Object)(object)val) ? val.ViewID : (-1)); if (broadcast && SemiFunc.IsMultiplayer()) { base.photonView.RPC("RPC_BeginFloat", (RpcTarget)0, new object[2] { num, ((Component)this).transform.position }); ((MonoBehaviour)this).StartCoroutine(MasterResolveRoutine()); } else { ((MonoBehaviour)this).StartCoroutine(FloatRoutine(num, ((Component)this).transform.position)); ((MonoBehaviour)this).StartCoroutine(SingleplayerResolveRoutine()); } } } [IteratorStateMachine(typeof(<MasterResolveRoutine>d__36))] private IEnumerator MasterResolveRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MasterResolveRoutine>d__36(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<SingleplayerResolveRoutine>d__37))] private IEnumerator SingleplayerResolveRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SingleplayerResolveRoutine>d__37(0) { <>4__this = this }; } [PunRPC] private void RPC_BeginFloat(int grabberViewId, Vector3 originWorldPos) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!_resolved) { ((MonoBehaviour)this).StartCoroutine(FloatRoutine(grabberViewId, originWorldPos)); } } [PunRPC] private void RPC_ExplodeNow() { if (!_resolved) { _resolved = true; ((MonoBehaviour)this).StopAllCoroutines(); EndFloatRestore(); TryExplode(); } } [PunRPC] private void RPC_SafeNow() { if (!_resolved) { _resolved = true; ((MonoBehaviour)this).StopAllCoroutines(); EndFloatRestore(); } } [IteratorStateMachine(typeof(<FloatRoutine>d__41))] private IEnumerator FloatRoutine(int grabberViewId, Vector3 originWorldPos) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FloatRoutine>d__41(0) { <>4__this = this, grabberViewId = grabberViewId, originWorldPos = originWorldPos }; } private void EndFloatRestore() { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_origParent)) { ((Component)this).transform.SetParent(_origParent, true); } for (int i = 0; i < _ptv.Length; i++) { if (Object.op_Implicit((Object)(object)_ptv[i])) { ((Behaviour)_ptv[i]).enabled = _ptvPrevEnabled[i]; } } for (int j = 0; j < _cols.Length; j++) { _cols[j].enabled = _colsPrev[j]; } if (_rbHad) { _rb.isKinematic = _rbWasKinematic; _rb.constraints = _rbPrevConstraints; } ((Component)this).transform.localScale = _origLocalScale; } private void TryExplode() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (onDetonate != null && ((UnityEventBase)onDetonate).GetPersistentEventCount() > 0) { onDetonate.Invoke(); } else if (Object.op_Implicit((Object)(object)_particleScriptExplosion) && (Object)(object)_particleScriptExplosion.explosionPreset != (Object)null) { _particleScriptExplosion.Spawn(((Component)this).transform.position, explosionSize, explosionDamageMin, explosionDamageMax, 1f, false, false, 1f); } if (SemiFunc.IsMasterClientOrSingleplayer()) { if ((Object)(object)_itemAttributes != (Object)null && (Object)(object)StatsManager.instance != (Object)null) { StatsManager.instance.ItemRemove(_itemAttributes.instanceName); } if ((Object)(object)_impactDetector != (Object)null) { _impactDetector.DestroyObject(true); } } } private void ForceReleaseFromAllGrabbers() { if ((Object)(object)base.physGrabObject == (Object)null) { return; } foreach (PhysGrabber item in base.physGrabObject.playerGrabbing.ToList()) { if (!SemiFunc.IsMultiplayer()) { item.ReleaseObject(base.photonView.ViewID, 0.1f); continue; } item.photonView.RPC("ReleaseObjectRPC", (RpcTarget)0, new object[3] { false, 0.1f, base.photonView.ViewID }); } } private PhotonView FindGrabberPhotonViewRobust() { if (Object.op_Implicit((Object)(object)base.physGrabObject) && Object.op_Implicit((Object)(object)base.physGrabObject.lastPlayerGrabbing) && Object.op_Implicit((Object)(object)base.physGrabObject.lastPlayerGrabbing.photonView)) { return base.physGrabObject.lastPlayerGrabbing.photonView; } Transform parent = ((Component)this).transform.parent; while ((Object)(object)parent != (Object)null) { PhotonView component = ((Component)parent).GetComponent<PhotonView>(); if (Object.op_Implicit((Object)(object)component)) { return component; } parent = parent.parent; } return null; } } [BepInPlugin("omniscye.valuablemask.events", "ValuableMask.Events", "1.0.0")] public class ValuableMaskEventsPlugin : BaseUnityPlugin { internal static ValuableMaskEventsPlugin Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0022: Expected O, but got Unknown Instance = this; if (Harmony == null) { Harmony val = new Harmony("omniscye.valuablemask.events"); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); Logger.LogInfo((object)"ValuableMask.Events v1.0.0 loaded"); } } internal enum ValuableMaskEventKind { TeleportAllValuablesToMask, KillRandomPlayer, TeleportRandomPlayerToPoint, SpawnRandomItemsNearMask, GrantRandomPlayerUpgrade, TurnOffAllLighting, RandomizeAllPlayerColors, SwitchLevel, LowGravityGlobal, DropAllHeldItems } [HarmonyPatch(typeof(ValuableMaskLatch))] internal static class ValuableMaskLatchPatches { [HarmonyPostfix] [HarmonyPatch("RPC_BeginFloat")] private static void RPC_BeginFloat_Postfix(ValuableMaskLatch __instance) { if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<ValuableMaskEventRelay>())) { ((Component)__instance).gameObject.AddComponent<ValuableMaskEventRelay>(); } } [HarmonyPostfix] [HarmonyPatch("RPC_SafeNow")] private static void RPC_SafeNow_Postfix(ValuableMaskLatch __instance) { ValuableMaskEventRelay.TryFire(__instance, exploded: false); } [HarmonyPostfix] [HarmonyPatch("RPC_ExplodeNow")] private static void RPC_ExplodeNow_Postfix(ValuableMaskLatch __instance) { ValuableMaskEventRelay.TryFire(__instance, exploded: true); } } public class ValuableMaskEventRelay : MonoBehaviourPun { private bool fired; public static void TryFire(ValuableMaskLatch latch, bool exploded) { if (Object.op_Implicit((Object)(object)latch)) { ValuableMaskEventRelay valuableMaskEventRelay = ((Component)latch).GetComponent<ValuableMaskEventRelay>(); if (!Object.op_Implicit((Object)(object)valuableMaskEventRelay)) { valuableMaskEventRelay = ((Component)latch).gameObject.AddComponent<ValuableMaskEventRelay>(); } valuableMaskEventRelay.FireIfHost(latch, exploded); } } private void FireIfHost(ValuableMaskLatch latch, bool exploded) { //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if (fired || (SemiFunc.IsMultiplayer() && !PhotonNetwork.IsMasterClient)) { return; } fired = true; int num = Random.Range(0, 10); int num2 = -1; if (num == 1 || num == 2) { List<PlayerAvatar> list = SemiFunc.PlayerGetList(); list.RemoveAll((PlayerAvatar x) => (Object)(object)x == (Object)null); if (list.Count > 0) { PlayerAvatar val = list[Random.Range(0, list.Count)]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.photonView)) { num2 = val.photonView.ViewID; } } } ((MonoBehaviourPun)this).photonView.RPC("VM_DoEvent", (RpcTarget)0, new object[3] { num, ((Component)latch).transform.position, num2 }); } [PunRPC] private void VM_DoEvent(int evt, Vector3 maskPos, int targetPlayerViewId) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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) switch ((ValuableMaskEventKind)evt) { case ValuableMaskEventKind.TeleportAllValuablesToMask: if (SemiFunc.IsMasterClientOrSingleplayer()) { TeleportAllValuables(maskPos); } break; case ValuableMaskEventKind.KillRandomPlayer: if (SemiFunc.IsMasterClientOrSingleplayer()) { PlayerAvatar val = FindPlayerByViewId(targetPlayerViewId); if (Object.op_Implicit((Object)(object)val)) { val.PlayerDeath(-1); } } break; case ValuableMaskEventKind.TeleportRandomPlayerToPoint: { if (!SemiFunc.IsMasterClientOrSingleplayer()) { break; } PlayerAvatar val2 = FindPlayerByViewId(targetPlayerViewId); if (Object.op_Implicit((Object)(object)val2)) { Vector3 position = ((Component)val2).transform.position; LevelPoint val3 = SemiFunc.LevelPointGet(position, 8f, 60f); if (Object.op_Implicit((Object)(object)val3)) { val2.Spawn(((Component)val3).transform.position, ((Component)val3).transform.rotation); } } break; } case ValuableMaskEventKind.SpawnRandomItemsNearMask: if (SemiFunc.IsMasterClientOrSingleplayer()) { SpawnItems(maskPos, 3); } break; case ValuableMaskEventKind.GrantRandomPlayerUpgrade: if (SemiFunc.IsMasterClientOrSingleplayer()) { GrantRandomUpgrade(); } break; case ValuableMaskEventKind.TurnOffAllLighting: TurnOffAllLightsLocal(); break; case ValuableMaskEventKind.RandomizeAllPlayerColors: if (SemiFunc.IsMasterClientOrSingleplayer()) { RandomizeColors(); } break; case ValuableMaskEventKind.SwitchLevel: if (SemiFunc.IsMasterClientOrSingleplayer()) { RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)0); } break; case ValuableMaskEventKind.LowGravityGlobal: LowGravityLocal(20f); break; case ValuableMaskEventKind.DropAllHeldItems: if (SemiFunc.IsMasterClientOrSingleplayer()) { DropAllHeldItemsHost(); } break; } } private PlayerAvatar FindPlayerByViewId(int viewId) { if (viewId == -1) { return null; } List<PlayerAvatar> list = SemiFunc.PlayerGetList(); for (int i = 0; i < list.Count; i++) { PlayerAvatar val = list[i]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.photonView) && val.photonView.ViewID == viewId) { return val; } } return null; } private void TeleportAllValuables(Vector3 pos) { //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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) ValuableObject[] array = Object.FindObjectsOfType<ValuableObject>(true); int num = 0; float num2 = 1.5f; foreach (ValuableObject val in array) { if (Object.op_Implicit((Object)(object)val)) { PhysGrabObject component = ((Component)val).GetComponent<PhysGrabObject>(); if (Object.op_Implicit((Object)(object)component)) { float num3 = (float)(num % 24) * (MathF.PI / 12f); int num4 = num / 24; Vector3 val2 = new Vector3(Mathf.Cos(num3), 0f, Mathf.Sin(num3)) * (num2 + (float)num4 * 0.9f); Vector3 val3 = pos + val2 + Vector3.up * 0.2f; component.Teleport(val3, Quaternion.identity); num++; } } } } private void SpawnItems(Vector3 center, int amount) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00c2: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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) if (!Object.op_Implicit((Object)(object)ShopManager.instance)) { return; } List<Item> potentialItems = ShopManager.instance.potentialItems; if (potentialItems == null || potentialItems.Count == 0) { return; } for (int i = 0; i < amount; i++) { Item val = potentialItems[Random.Range(0, potentialItems.Count)]; if (!((Object)(object)val == (Object)null) && val.prefab != null) { float num = (float)i * (MathF.PI * 2f / (float)Mathf.Max(1, amount)); Vector3 val2 = center + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * 1.2f + Vector3.up * 0.1f; Quaternion identity = Quaternion.identity; if (SemiFunc.IsMultiplayer()) { PhotonNetwork.InstantiateRoomObject(val.prefab.ResourcePath, val2, identity, (byte)0, (object[])null); } else { Object.Instantiate<GameObject>(val.prefab.Prefab, val2, identity); } } } } private void GrantRandomUpgrade() { List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null || list.Count == 0) { return; } PlayerAvatar val = list[Random.Range(0, list.Count)]; if (Object.op_Implicit((Object)(object)val)) { string steamID = val.steamID; switch (Random.Range(0, 11)) { case 0: PunManager.instance.UpgradePlayerHealth(steamID, 1); break; case 1: PunManager.instance.UpgradePlayerEnergy(steamID, 1); break; case 2: PunManager.instance.UpgradePlayerExtraJump(steamID, 1); break; case 3: PunManager.instance.UpgradePlayerTumbleLaunch(steamID, 1); break; case 4: PunManager.instance.UpgradePlayerTumbleClimb(steamID, 1); break; case 5: PunManager.instance.UpgradePlayerTumbleWings(steamID, 1); break; case 6: PunManager.instance.UpgradePlayerSprintSpeed(steamID, 1); break; case 7: PunManager.instance.UpgradePlayerCrouchRest(steamID, 1); break; case 8: PunManager.instance.UpgradePlayerGrabStrength(steamID, 1); break; case 9: PunManager.instance.UpgradePlayerThrowStrength(steamID, 1); break; case 10: PunManager.instance.UpgradePlayerGrabRange(steamID, 1); break; } } } private void RandomizeColors() { List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null || list.Count == 0) { return; } int count = AssetManager.instance.playerColors.Count; if (count <= 0) { return; } for (int i = 0; i < list.Count; i++) { PlayerAvatar val = list[i]; if (Object.op_Implicit((Object)(object)val)) { int num = Random.Range(0, count); val.PlayerAvatarSetColor(num); } } } private void TurnOffAllLightsLocal() { Light[] array = Object.FindObjectsOfType<Light>(true); foreach (Light val in array) { if (Object.op_Implicit((Object)(object)val)) { ((Behaviour)val).enabled = false; } } } private void LowGravityLocal(float time) { if (Object.op_Implicit((Object)(object)PlayerController.instance)) { PlayerController.instance.AntiGravity(time); } } private void DropAllHeldItemsHost() { List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null || list.Count == 0) { return; } for (int i = 0; i < list.Count; i++) { PlayerAvatar val = list[i]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.physGrabber) && Object.op_Implicit((Object)(object)val.physGrabber.photonView)) { val.photonView.RPC("ReleaseObjectRPC", (RpcTarget)0, new object[3] { false, 0.1f, -1 }); } } } } }