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 Cult Summon v1.0.1
CultHalloweenPlugin.dll
Decompiled 7 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 System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; 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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CultHalloweenPlugin")] [assembly: AssemblyTitle("CultHalloweenPlugin")] [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 CultHalloweenPlugin { [BepInPlugin("Omniscye.CultHalloweenPlugin", "CultHalloweenPlugin", "1.0")] public class CultHalloweenPlugin : BaseUnityPlugin { internal static CultHalloweenPlugin Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } } namespace Empress.Cult { [BepInPlugin("empress.repo.cult.halloween", "Empress – Cult Halloween", "1.2.1")] public class CultHalloweenPlugin : BaseUnityPlugin { public const string PluginGuid = "empress.repo.cult.halloween"; public const string PluginName = "Empress – Cult Halloween"; public const string PluginVersion = "1.2.1"; internal static ManualLogSource Log; private Harmony _harmony; private static AssetBundle _bundle; private static GameObject _cultPrefab; private static AudioClip _musicClip; private static AudioClip _sfxClip; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("empress.repo.cult.halloween"); try { _harmony.PatchAll(typeof(CultHalloweenPlugin).Assembly); LoadBundle(); if ((Object)(object)_cultPrefab == (Object)null) { Log.LogWarning((object)"Cult prefab 'baa' not found in AssetBundle 'cult'. Place the bundle named 'cult' in the plugins folder."); } GameObject val = new GameObject("CultEventRouterHost"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)52; val.AddComponent<CultEventRouter>(); CultEventRouter.SetAssets(_cultPrefab, _musicClip, _sfxClip); SceneManager.sceneLoaded += OnSceneLoaded; Log.LogInfo((object)"Empress – Cult Halloween v1.2.1 loaded."); } catch (Exception arg) { Log.LogError((object)$"Init failed: {arg}"); } } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void OnSceneLoaded(Scene s, LoadSceneMode m) { } private static void LoadBundle() { if ((Object)(object)_bundle != (Object)null) { return; } try { string pluginPath = Paths.PluginPath; string[] array = Directory.GetFiles(pluginPath, "cult", SearchOption.AllDirectories).Concat(Directory.GetFiles(pluginPath, "cult.*", SearchOption.AllDirectories)).ToArray(); string[] array2 = array; foreach (string text in array2) { try { _bundle = AssetBundle.LoadFromFile(text); if (!Object.op_Implicit((Object)(object)_bundle)) { continue; } _cultPrefab = _bundle.LoadAsset<GameObject>("baa"); _musicClip = _bundle.LoadAsset<AudioClip>("music.ogg"); _sfxClip = _bundle.LoadAsset<AudioClip>("sfx.ogg"); if (Object.op_Implicit((Object)(object)_cultPrefab)) { if (!Object.op_Implicit((Object)(object)_cultPrefab.GetComponent<AudioSource>())) { _cultPrefab.AddComponent<AudioSource>(); } if (!Object.op_Implicit((Object)(object)_cultPrefab.GetComponent<NavMeshAgent>())) { _cultPrefab.AddComponent<NavMeshAgent>(); } if (!Object.op_Implicit((Object)(object)_cultPrefab.GetComponent<CultTotemController>())) { _cultPrefab.AddComponent<CultTotemController>(); } Log.LogInfo((object)("Loaded AssetBundle at " + text + " with prefab 'baa' and audio clips.")); return; } } catch (Exception ex) { Log.LogWarning((object)("Failed to load bundle at " + text + ": " + ex.Message)); } } Log.LogWarning((object)"No 'cult' AssetBundle found. Expected prefab 'baa' and clips 'music.ogg', 'sfx.ogg'."); } catch (Exception arg) { Log.LogError((object)$"LoadBundle failed: {arg}"); } } } [HarmonyPatch(typeof(PlayerAvatar))] internal static class ChatPatcher { private static readonly Dictionary<int, int> s_counts = new Dictionary<int, int>(); internal static bool Suppress; private static string Normalize(string s) { if (string.IsNullOrEmpty(s)) { return string.Empty; } s = s.Trim(); return Regex.Replace(s, "\\s+", " ").ToLowerInvariant(); } [HarmonyPostfix] [HarmonyPatch("ChatMessageSendRPC")] private static void PlayerAvatar_ChatMessageSendRPC_Postfix(PlayerAvatar __instance, string _message, bool crouching) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GameDirector.instance == (Object)null || (int)GameDirector.instance.currentState != 2 || Suppress || CultEventRouter.LevelUsed) { return; } string text = Normalize(_message); string text2 = Normalize("Lamb open the veil to Narinder"); int num = (((Object)(object)__instance != (Object)null && (Object)(object)__instance.photonView != (Object)null && __instance.photonView.Owner != null) ? __instance.photonView.Owner.ActorNumber : (-1)); if (num <= 0) { return; } if (text == text2) { int value; int num2 = ((!s_counts.TryGetValue(num, out value)) ? 1 : (value + 1)); s_counts[num] = num2; if (num2 < 3) { return; } s_counts[num] = 0; if (!Authority.IsAuthority()) { return; } Transform val = SpawnUtil.ClosestLevelPointTo(((Component)__instance).transform.position); if ((Object)(object)val == (Object)null) { val = ((Component)__instance).transform; } CultEventRouter.BroadcastSpawn(val.position, val.rotation, CultEventRouter.ChantType.Love); string text3; switch (Random.Range(0, 3)) { case 0: text3 = "REVIVE ALL"; CultEventRouter.HostScheduleReviveAll(30f); break; case 1: text3 = "KILL ALL BUT ONE"; CultEventRouter.HostScheduleKillAllButOne(30f); break; default: { int num3 = Random.Range(1, 4); text3 = $"SPAWN {num3} VALUABLE(S)"; CultEventRouter.HostScheduleSpawnValuables(30f, num3); break; } } try { ChatManager instance = ChatManager.instance; if ((Object)(object)instance != (Object)null) { Suppress = true; try { instance.PossessChat((PossessChatID)0, "<color=#ff4040>The cult chooses: " + text3 + "</color>", 0f, Color.white, 0f, false, 0, (UnityEvent)null); } finally { Suppress = false; } } } catch { } ManualLogSource log = CultHalloweenPlugin.Log; if (log != null) { log.LogInfo((object)("Cult outcome selected: " + text3)); } } else { s_counts[num] = 0; } } } public class CultEventRouter : MonoBehaviourPunCallbacks, IOnEventCallback { public enum Ev : byte { Spawn = 101, Chant, Despawn } public enum ChantType : byte { Love = 1, Hate } [CompilerGenerated] private sealed class <Co_KillAllButOne>d__22 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; private Vector3 <origin>5__1; private List<PlayerAvatar> <list>5__2; private PlayerAvatar <spare>5__3; private List<PlayerAvatar>.Enumerator <>s__4; private PlayerAvatar <p>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Co_KillAllButOne>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <list>5__2 = null; <spare>5__3 = null; <>s__4 = default(List<PlayerAvatar>.Enumerator); <p>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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(delay); <>1__state = 1; return true; case 1: <>1__state = -1; if (!Authority.IsAuthority()) { return false; } <origin>5__1 = (Object.op_Implicit((Object)(object)_active) ? _active.transform.position : Vector3.zero); <list>5__2 = GameDirector.instance?.PlayerList?.Where((PlayerAvatar p) => (Object)(object)p != (Object)null).ToList(); if (<list>5__2 != null && <list>5__2.Count > 0) { <spare>5__3 = <list>5__2[Random.Range(0, <list>5__2.Count)]; <>s__4 = <list>5__2.GetEnumerator(); try { while (<>s__4.MoveNext()) { <p>5__5 = <>s__4.Current; if ((Object)(object)<p>5__5 != (Object)(object)<spare>5__3 && !<p>5__5.deadSet) { <p>5__5.PlayerDeath(-1); } <p>5__5 = null; } } finally { ((IDisposable)<>s__4).Dispose(); } <>s__4 = default(List<PlayerAvatar>.Enumerator); <spare>5__3 = null; } BroadcastDespawnAndBlast(<origin>5__1, 12f, 18f, 1.5f); 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 <Co_ReviveAll>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; private Vector3 <origin>5__1; private List<PlayerAvatar> <players>5__2; private List<PlayerAvatar>.Enumerator <>s__3; private PlayerAvatar <p>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Co_ReviveAll>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <players>5__2 = null; <>s__3 = default(List<PlayerAvatar>.Enumerator); <p>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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(delay); <>1__state = 1; return true; case 1: <>1__state = -1; if (!Authority.IsAuthority()) { return false; } <origin>5__1 = (Object.op_Implicit((Object)(object)_active) ? _active.transform.position : Vector3.zero); <players>5__2 = GameDirector.instance?.PlayerList; if (<players>5__2 != null) { <>s__3 = <players>5__2.GetEnumerator(); try { while (<>s__3.MoveNext()) { <p>5__4 = <>s__3.Current; if (Object.op_Implicit((Object)(object)<p>5__4) && <p>5__4.deadSet) { <p>5__4.Revive(false); } <p>5__4 = null; } } finally { ((IDisposable)<>s__3).Dispose(); } <>s__3 = default(List<PlayerAvatar>.Enumerator); } BroadcastDespawnAndBlast(<origin>5__1, 12f, 18f, 1.5f); 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 <Co_SpawnValuables>d__24 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; public int count; private Vector3 <origin>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Co_SpawnValuables>d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_008a: 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(delay); <>1__state = 1; return true; case 1: <>1__state = -1; if (!Authority.IsAuthority()) { return false; } <origin>5__1 = (Object.op_Implicit((Object)(object)_active) ? _active.transform.position : Vector3.zero); SpawnRandomValuablesNear(<origin>5__1, count); BroadcastDespawnAndBlast(<origin>5__1, 12f, 18f, 1.5f); 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 static bool _hooked; private static GameObject _prefab; private static AudioClip _music; private static AudioClip _sfx; private static GameObject _active; private static AudioSource _audioLoop; private static bool _levelUsed; private static readonly string[] ValFolders = new string[7] { "01 Tiny", "02 Small", "03 Medium", "04 Big", "05 Wide", "06 Tall", "07 Very Tall" }; public static bool LevelUsed => _levelUsed; internal static void SetAssets(GameObject prefab, AudioClip music, AudioClip sfx) { _prefab = prefab; _music = music; _sfx = sfx; } private void OnEnable() { SceneManager.sceneLoaded += OnSceneLoaded; } private void OnDisable() { SceneManager.sceneLoaded -= OnSceneLoaded; if (_hooked) { PhotonNetwork.RemoveCallbackTarget((object)this); } _hooked = false; } public override void OnJoinedRoom() { EnsureHooked(); } public override void OnLeftRoom() { if (_hooked) { PhotonNetwork.RemoveCallbackTarget((object)this); } _hooked = false; LocalDespawn(); } private void OnSceneLoaded(Scene s, LoadSceneMode m) { _levelUsed = false; LocalDespawn(); if (PhotonNetwork.InRoom) { EnsureHooked(); } } private void EnsureHooked() { if (!_hooked) { PhotonNetwork.AddCallbackTarget((object)this); _hooked = true; } } public static void BroadcastSpawn(Vector3 pos, Quaternion rot, ChantType chant) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown if (!_levelUsed) { _levelUsed = true; CreateLocal(pos, rot, chant); if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady) { object[] array = new object[3] { pos, rot, (byte)chant }; PhotonNetwork.RaiseEvent((byte)101, (object)array, new RaiseEventOptions { Receivers = (ReceiverGroup)0 }, SendOptions.SendReliable); } } } public static void HostScheduleReviveAll(float delay) { if (Authority.IsAuthority()) { ((MonoBehaviour)Authority.Runner).StartCoroutine(Co_ReviveAll(delay)); } } [IteratorStateMachine(typeof(<Co_ReviveAll>d__20))] private static IEnumerator Co_ReviveAll(float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Co_ReviveAll>d__20(0) { delay = delay }; } public static void HostScheduleKillAllButOne(float delay) { if (Authority.IsAuthority()) { ((MonoBehaviour)Authority.Runner).StartCoroutine(Co_KillAllButOne(delay)); } } [IteratorStateMachine(typeof(<Co_KillAllButOne>d__22))] private static IEnumerator Co_KillAllButOne(float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Co_KillAllButOne>d__22(0) { delay = delay }; } public static void HostScheduleSpawnValuables(float delay, int count) { if (Authority.IsAuthority()) { ((MonoBehaviour)Authority.Runner).StartCoroutine(Co_SpawnValuables(delay, count)); } } [IteratorStateMachine(typeof(<Co_SpawnValuables>d__24))] private static IEnumerator Co_SpawnValuables(float delay, int count) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Co_SpawnValuables>d__24(0) { delay = delay, count = count }; } private static void SpawnRandomValuablesNear(Vector3 origin, int count) { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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_0182: Unknown result type (might be due to invalid IL or missing references) if (count <= 0) { return; } List<(GameObject, string)> list = new List<(GameObject, string)>(); string[] valFolders = ValFolders; foreach (string text in valFolders) { GameObject[] array = Resources.LoadAll<GameObject>("Valuables/" + text); if (array == null || array.Length == 0) { continue; } GameObject[] array2 = array; foreach (GameObject val in array2) { if (!((Object)(object)val == (Object)null)) { list.Add((val, "Valuables/" + text + "/" + ((Object)val).name)); } } } if (list.Count == 0) { ManualLogSource log = CultHalloweenPlugin.Log; if (log != null) { log.LogWarning((object)"[Cult] No valuables found under Resources/Valuables/<Category>. Provide exact paths if different."); } return; } NavMeshHit val3 = default(NavMeshHit); for (int k = 0; k < count; k++) { (GameObject, string) tuple = list[Random.Range(0, list.Count)]; Vector3 val2 = origin + Random.insideUnitSphere * 1.75f; val2.y = origin.y; if (NavMesh.SamplePosition(val2, ref val3, 2.5f, -1)) { val2 = ((NavMeshHit)(ref val3)).position; } Quaternion val4 = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady) { try { PhotonNetwork.InstantiateRoomObject(tuple.Item2, val2, val4, (byte)0, (object[])null); } catch (Exception ex) { ManualLogSource log2 = CultHalloweenPlugin.Log; if (log2 != null) { log2.LogWarning((object)("[Cult] RoomObject spawn failed for '" + tuple.Item2 + "': " + ex.Message)); } } } else { Object.Instantiate<GameObject>(tuple.Item1, val2, val4); } } } private static void CreateLocal(Vector3 pos, Quaternion rot, ChantType chant) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) LocalDespawn(); if (!((Object)(object)_prefab == (Object)null)) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(pos, ref val, 5f, -1)) { pos = ((NavMeshHit)(ref val)).position; } _active = Object.Instantiate<GameObject>(_prefab, pos, rot); ((Object)_active).name = "CultTotem"; NavMeshAgent component = _active.GetComponent<NavMeshAgent>(); if (Object.op_Implicit((Object)(object)component) && ((Behaviour)component).enabled) { component.Warp(pos); component.isStopped = true; } CultTotemController component2 = _active.GetComponent<CultTotemController>(); if (Object.op_Implicit((Object)(object)component2)) { component2.Init(_music, _sfx, chant); } ChantLocal(chant); } } private static void ChantLocal(ChantType chant) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) try { ChatManager instance = ChatManager.instance; if ((Object)(object)instance == (Object)null) { return; } ChatPatcher.Suppress = true; try { instance.PossessChatScheduleStart(0); for (int i = 0; i < 3; i++) { instance.PossessChat((PossessChatID)0, "I love Narinder", 0.025f, Color.red, 0f, false, 0, (UnityEvent)null); } instance.PossessChatScheduleEnd(); } finally { ChatPatcher.Suppress = false; } } catch { } } private static void BroadcastDespawnAndBlast(Vector3 origin, float radius, float force, float uplift) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown LocalBlastAndDespawn(origin, radius, force, uplift); if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady) { object[] array = new object[4] { origin, radius, force, uplift }; PhotonNetwork.RaiseEvent((byte)103, (object)array, new RaiseEventOptions { Receivers = (ReceiverGroup)0 }, SendOptions.SendReliable); } } private static void LocalBlastAndDespawn(Vector3 origin, float radius, float force, float uplift) { //IL_005c: 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) //IL_007c: Unknown result type (might be due to invalid IL or missing references) try { List<PlayerAvatar> list = GameDirector.instance?.PlayerList; if (list != null) { foreach (PlayerAvatar item in list) { if (Object.op_Implicit((Object)(object)item)) { Rigidbody componentInChildren = ((Component)item).GetComponentInChildren<Rigidbody>(); if (!((Object)(object)componentInChildren == (Object)null) && Vector3.Distance(origin, ((Component)item).transform.position) <= radius) { componentInChildren.AddExplosionForce(force, origin, radius, uplift, (ForceMode)1); } } } } } catch { } LocalDespawn(); } private static void LocalDespawn() { if (Object.op_Implicit((Object)(object)_active)) { Object.Destroy((Object)(object)_active); } _active = null; _audioLoop = null; } public void OnEvent(EventData photonEvent) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) //IL_006f: 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_00a8: 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_00d0: Unknown result type (might be due to invalid IL or missing references) try { switch ((Ev)photonEvent.Code) { case Ev.Spawn: if (!Authority.IsAuthority() && photonEvent.CustomData is object[] array2 && array2.Length >= 3) { Vector3 pos = (Vector3)array2[0]; Quaternion rot = (Quaternion)array2[1]; ChantType chant = (ChantType)(byte)array2[2]; CreateLocal(pos, rot, chant); } break; case Ev.Despawn: if (photonEvent.CustomData is object[] array && array.Length >= 4) { Vector3 origin = (Vector3)array[0]; float radius = (float)array[1]; float force = (float)array[2]; float uplift = (float)array[3]; LocalBlastAndDespawn(origin, radius, force, uplift); } break; } } catch { } } } [RequireComponent(typeof(AudioSource))] public class CultTotemController : MonoBehaviour { private AudioSource _src; private AudioClip _sfx; public void Init(AudioClip music, AudioClip sfx, CultEventRouter.ChantType chant) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) _src = ((Component)this).GetComponent<AudioSource>(); if (Object.op_Implicit((Object)(object)_src)) { _src.spatialBlend = 1f; _src.playOnAwake = false; _src.loop = true; _src.dopplerLevel = 0f; _src.rolloffMode = (AudioRolloffMode)0; _src.minDistance = 8f; _src.maxDistance = 18f; if (Object.op_Implicit((Object)(object)music)) { _src.clip = music; _src.volume = 0.35f; _src.Play(); } } _sfx = sfx; if (Object.op_Implicit((Object)(object)_sfx)) { AudioSource.PlayClipAtPoint(_sfx, ((Component)this).transform.position, 0.8f); } } } internal static class Authority { public class HostRunner : MonoBehaviour { } private static HostRunner _runner; public static HostRunner Runner { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)_runner == (Object)null) { GameObject val = new GameObject("CultHostRunner"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)52; _runner = val.AddComponent<HostRunner>(); } return _runner; } } public static bool IsAuthority() { return !GameManager.Multiplayer() || PhotonNetwork.IsMasterClient; } } internal static class SpawnUtil { public static Transform ClosestLevelPointTo(Vector3 pos) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) LevelGenerator instance = LevelGenerator.Instance; if ((Object)(object)instance != (Object)null && instance.Generated && instance.LevelPathPoints != null && instance.LevelPathPoints.Count > 0) { Transform result = null; float num = float.PositiveInfinity; foreach (LevelPoint levelPathPoint in instance.LevelPathPoints) { if (!((Object)(object)levelPathPoint == (Object)null)) { float num2 = Vector3.SqrMagnitude(((Component)levelPathPoint).transform.position - pos); if (num2 < num) { num = num2; result = ((Component)levelPathPoint).transform; } } } return result; } SpawnPoint[] array = Object.FindObjectsOfType<SpawnPoint>(); if (array != null && array.Length != 0) { return ((Component)array[Random.Range(0, array.Length)]).transform; } GameObject val = new GameObject("CultFallback"); val.transform.position = Vector3.up; return val.transform; } } }