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 Lethal Company Hide n Seek v1.4.1
LCHideAndSeekMod.dll
Decompiled 3 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LCHideAndSeekMod.Core; using LCHideAndSeekMod.Core.Configuration; using LCHideAndSeekMod.Core.PlayerStats; using LCHideAndSeekMod.Enums; using LCHideAndSeekMod.Extensions; using LethalConfig; using LethalConfig.ConfigItems; using MoreCompany.Cosmetics; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LCHideAndSeekMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LCHideAndSeekMod")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2c31fa94-da26-4c78-be27-a22e4a8196e8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] public class EndGameStatsUI : MonoBehaviour { [CompilerGenerated] private sealed class <DisplayStats>d__11 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public EndGameStatsUI <>4__this; private int <i>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DisplayStats>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; ((Behaviour)<>4__this.uiBase).enabled = true; ((Behaviour)<>4__this.WinnerText).enabled = true; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; <i>5__1 = 0; goto IL_0102; case 2: <>1__state = -1; ((Behaviour)<>4__this.statTexts[<i>5__1]).enabled = true; <i>5__1++; goto IL_0102; case 3: <>1__state = -1; ((Behaviour)<>4__this.RoundNumber).enabled = true; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 4; return true; case 4: <>1__state = -1; ((Behaviour)<>4__this.RoundTime).enabled = true; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 5; return true; case 5: { <>1__state = -1; <>4__this.HideAll(); return false; } IL_0102: if (<i>5__1 < 5) { ((Behaviour)<>4__this.playerTexts[<i>5__1]).enabled = true; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; } <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 3; 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 EndGameStatsUI Instance; private List<TextMeshProUGUI> playerTexts = new List<TextMeshProUGUI>(); private List<TextMeshProUGUI> statTexts = new List<TextMeshProUGUI>(); private TextMeshProUGUI RoundNumber; private TextMeshProUGUI RoundTime; private TextMeshProUGUI WinnerText; private Image uiBase; public void Awake() { Instance = this; uiBase = ((Component)this).gameObject.GetComponentInChildren<Image>(); TextMeshProUGUI[] componentsInChildren = ((Component)this).GetComponentsInChildren<TextMeshProUGUI>(); for (int i = 0; i < 5; i++) { ((TMP_Text)componentsInChildren[i]).maxVisibleLines = 4; playerTexts.Add(componentsInChildren[i]); } for (int num = 9; num > 4; num--) { ((TMP_Text)componentsInChildren[num]).maxVisibleLines = 4; statTexts.Add(componentsInChildren[num]); } RoundNumber = componentsInChildren[10]; RoundTime = componentsInChildren[11]; WinnerText = componentsInChildren[12]; HideAll(); } private void HideAll() { ((Behaviour)uiBase).enabled = false; foreach (TextMeshProUGUI playerText in playerTexts) { ((Behaviour)playerText).enabled = false; } foreach (TextMeshProUGUI statText in statTexts) { ((Behaviour)statText).enabled = false; } ((Behaviour)RoundNumber).enabled = false; ((Behaviour)RoundTime).enabled = false; ((Behaviour)WinnerText).enabled = false; } public void Display() { FillWithStats(); ((MonoBehaviour)this).StartCoroutine(DisplayStats()); } private void FillWithStats() { for (int i = 0; i < PlayerStatManager.Instance.Stats.Count; i++) { StatBase statBase = PlayerStatManager.Instance.Stats.ElementAt(i); ((TMP_Text)playerTexts.ElementAt(i)).text = statBase.Player.playerUsername; ((TMP_Text)statTexts.ElementAt(i)).text = $"Tier {statBase.GetTier()}: {statBase.GetComment()}"; } ((TMP_Text)RoundNumber).text = Convert.ToString(GameManager.RoundCount - 1); ((TMP_Text)RoundTime).text = PlayerStatManager.Instance.MatchTime; int result = GameManager.Instance.Result; ((TMP_Text)WinnerText).text = result switch { 1 => "Seekers Win!", 0 => "Hiders Win!", _ => "Draw!", }; } [IteratorStateMachine(typeof(<DisplayStats>d__11))] private IEnumerator DisplayStats() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DisplayStats>d__11(0) { <>4__this = this }; } public void OnDisable() { try { foreach (TextMeshProUGUI playerText in playerTexts) { ((TMP_Text)playerText).text = ""; } foreach (TextMeshProUGUI statText in statTexts) { ((TMP_Text)statText).text = ""; } ((TMP_Text)RoundNumber).text = ""; ((TMP_Text)RoundTime).text = ""; ((TMP_Text)WinnerText).text = ""; } catch (Exception) { } } } namespace LCHideAndSeekMod { [BepInPlugin("Tibnan.LCHideAndSeekMod", "LCHideAndSeekMod", "1.4.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ModBase : BaseUnityPlugin { public const string Guid = "Tibnan.LCHideAndSeekMod"; private const string modName = "LCHideAndSeekMod"; public const string Version = "1.4.1"; public static ManualLogSource mls; private readonly Harmony harmony = new Harmony("Tibnan.LCHideAndSeekMod"); public static ModBase Instance; public static Font ModFont; public static GameObject TPMineExplosion; public static GameObject TPMine; public static GameObject EndOfGameStatsBlue; public static GameObject EndOfGameStatsOrange; public static AnimationCurve MineSpawnCurve; private static bool moreCompanyPresent; public static bool MoreCompanyPresent => moreCompanyPresent; public void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("LCHideAndSeekMod"); harmony.PatchAll(Assembly.GetExecutingAssembly()); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lchns")); ModFont = val.LoadAsset<Font>("Assets\\Prefabs\\PerfectDOSVGA437.ttf"); TPMineExplosion = val.LoadAsset<GameObject>("Assets\\Prefabs\\TPMineExplosion.prefab"); TPMine = val.LoadAsset<GameObject>("Assets\\Custom\\TPMineComplete.prefab"); EndOfGameStatsBlue = val.LoadAsset<GameObject>("Assets\\Custom\\EndGameStats_blue.prefab"); EndOfGameStatsOrange = val.LoadAsset<GameObject>("Assets\\Custom\\EndGameStats_orange.prefab"); moreCompanyPresent = Harmony.HasAnyPatches("me.swipez.melonloader.morecompany"); ConfigProcessor.AddConfigItems(); mls.LogInfo((object)"LC Hide and Seek mod loaded."); } } } namespace LCHideAndSeekMod.Patches { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void AddPrefabs(ref GameNetworkManager __instance) { ((Component)__instance).gameObject.GetComponent<NetworkManager>().AddNetworkPrefab(ModBase.TPMine); } [HarmonyPatch("Disconnect")] [HarmonyPrefix] public static void Reset() { HNSValues.TPMines.Clear(); GameManager.Instance = new GameManager(); GameManager.RoundCount = 1; PlayerStatManager.Instance = null; ConfigProcessor.Reset(); PlayerStatManager.Reset(); HNSValues.FirstWeaponReceived = false; } } [HarmonyPatch(typeof(GrabbableObject))] public class GrabbableObjectPatch { [HarmonyPatch("LateUpdate")] [HarmonyPrefix] public static bool StopLateUpdate(GrabbableObject __instance) { if (!StartOfRound.Instance.inShipPhase) { return GameManager.Instance.Hiders.All((PlayerControllerB x) => (Object)(object)x.AsHNSPlayer().DisguiseObject != (Object)(object)__instance); } return true; } } [HarmonyPatch(typeof(HUDManager))] public class HUDManagerPatch { [HarmonyPatch("ApplyPenalty")] [HarmonyPrefix] public static bool StopPenalty(HUDManager __instance) { ((Behaviour)__instance.endgameStatsAnimator).enabled = false; __instance.endgameStatsAnimator.Rebind(); ((Behaviour)__instance.endgameStatsAnimator).enabled = true; return false; } [HarmonyPatch("AddChatMessage")] [HarmonyPrefix] public static bool CheckWhisperMessage(ref string chatMessage, ref string nameOfUserWhoTyped, ref int playerWhoSent, ref bool dontRepeat) { if (chatMessage.StartsWith("/w ")) { if (!StartOfRound.Instance.inShipPhase && (GameNetworkManager.Instance.localPlayerController.AsHNSPlayer().Role == PlayerRole.Seeker || (playerWhoSent != -1 && StartOfRound.Instance.allPlayerScripts[playerWhoSent].AsHNSPlayer().Role == PlayerRole.Seeker))) { return false; } chatMessage = chatMessage.Remove(0, 3); string text = chatMessage.TakeWhile((char c) => c != ' ').ToArray().Aggregate("", (string a, char b) => a + b); chatMessage = chatMessage.Replace(text, ""); ModBase.mls.LogInfo((object)("Target player: " + text)); if (GameNetworkManager.Instance.localPlayerController.playerUsername.ToLower().Contains(text) || playerWhoSent == -1) { AddWhisperMessage(chatMessage, nameOfUserWhoTyped, playerWhoSent, dontRepeat: true); } return false; } return true; } [HarmonyPatch("AddPlayerChatMessageClientRpc")] [HarmonyPostfix] public static void ForceSendMessage(ref string chatMessage, ref int playerId) { //IL_0020: 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) if (playerId != -1 && Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[playerId]).transform.position) > 25f) { typeof(HUDManager).GetMethod("AddChatMessage", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(HUDManager.Instance, new object[4] { chatMessage, StartOfRound.Instance.allPlayerScripts[playerId].playerUsername, playerId, true }); } } private static void AddWhisperMessage(string chatMessage, string nameOfUserWhoTyped, int playerWhoSent, bool dontRepeat) { if ((!dontRepeat || !(HUDManager.Instance.lastChatMessage == chatMessage)) && (int)GameNetworkManager.Instance.localPlayerController.playerClientId != playerWhoSent) { HUDManager.Instance.lastChatMessage = chatMessage; HUDManager.Instance.PingHUDElement(HUDManager.Instance.Chat, 4f, 1f, 0.2f); if (HUDManager.Instance.ChatMessageHistory.Count >= 4) { ((TMP_Text)HUDManager.Instance.chatText).text.Remove(0, HUDManager.Instance.ChatMessageHistory[0].Length); HUDManager.Instance.ChatMessageHistory.Remove(HUDManager.Instance.ChatMessageHistory[0]); } StringBuilder stringBuilder = new StringBuilder(chatMessage); stringBuilder.Replace("[playerNum0]", StartOfRound.Instance.allPlayerScripts[0].playerUsername); stringBuilder.Replace("[playerNum1]", StartOfRound.Instance.allPlayerScripts[1].playerUsername); stringBuilder.Replace("[playerNum2]", StartOfRound.Instance.allPlayerScripts[2].playerUsername); stringBuilder.Replace("[playerNum3]", StartOfRound.Instance.allPlayerScripts[3].playerUsername); chatMessage = stringBuilder.ToString(); string item = ((!string.IsNullOrEmpty(nameOfUserWhoTyped)) ? ("<color=#00FF00>" + nameOfUserWhoTyped + ": " + chatMessage + "'</color>") : ("<color=#7069ff>" + chatMessage + "</color>")); HUDManager.Instance.ChatMessageHistory.Add(item); ((TMP_Text)HUDManager.Instance.chatText).text = ""; for (int i = 0; i < HUDManager.Instance.ChatMessageHistory.Count; i++) { TextMeshProUGUI chatText = HUDManager.Instance.chatText; ((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n" + HUDManager.Instance.ChatMessageHistory[i]; } } } [HarmonyPatch("Update")] [HarmonyPrefix] public static bool Update(ref HUDElement ___Clock) { if (ConfigProcessor.Config.AlwaysShowClock) { ___Clock.targetAlpha = 1f; } if (ConfigProcessor.Config.QuickRefreshClock) { TimeOfDay.Instance.RefreshClockUI(); } return true; } [HarmonyPatch("DisplayDaysLeft")] [HarmonyPrefix] public static bool StopDisplayDaysLeft(HUDManager __instance) { return false; } } [HarmonyPatch(typeof(KeyItem))] internal class KeyItemPatch { [HarmonyPatch("ItemActivate")] [HarmonyPrefix] public static bool LockDoorAndStopActivate(KeyItem __instance) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) if (!((NetworkBehaviour)__instance).IsOwner || !ConfigProcessor.Config.DoorLockEnabled) { return true; } RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.forward), ref val, 3f, 2816)) { DoorLock component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<DoorLock>(); if ((Object)(object)component != (Object)null && !component.isLocked && !component.isPickingLock) { component.LockDoor(30f); ((GrabbableObject)__instance).playerHeldBy.DespawnHeldObject(); if (NetworkManager.Singleton.IsServer) { SendDoorLock(((NetworkBehaviour)component).NetworkObjectId); } else { RequestDoorLock(((NetworkBehaviour)component).NetworkObjectId); } return false; } } return true; } public static void SendDoorLock(ulong id) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) DoorLock componentInChildren = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[id]).gameObject.GetComponentInChildren<DoorLock>(); if (!componentInChildren.isLocked) { componentInChildren.LockDoor(30f); } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref id, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_DoorLocked", val, (NetworkDelivery)2); } public static void RequestDoorLock(ulong id) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValue<ulong>(ref id, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.hnsmod_ServerLockDoor", 0uL, val, (NetworkDelivery)2); } public static void ServerTransmitDoorLock(ulong _, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) ulong id = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref id, default(ForPrimitives)); SendDoorLock(id); } public static void ClientLockDoor(ulong _, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); DoorLock componentInChildren = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]).gameObject.GetComponentInChildren<DoorLock>(); if (!componentInChildren.isLocked) { componentInChildren.LockDoor(30f); } } } [HarmonyPatch(typeof(Landmine))] internal class LandminePatch { [CompilerGenerated] private sealed class <TPPlayerToRandomPos>d__3 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Landmine mine; public PlayerControllerB player; private Random <rnd>5__1; private Vector3 <vec>5__2; private Vector3 <tpPos>5__3; private int <i>5__4; private GameObject <explosion>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TPPlayerToRandomPos>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <rnd>5__1 = null; <explosion>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_003b: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <i>5__4 = 0; break; case 1: <>1__state = -1; <explosion>5__5 = null; <i>5__4++; break; } if (<i>5__4 < 3) { <explosion>5__5 = Object.Instantiate<GameObject>(ModBase.TPMineExplosion, ((Component)mine).transform.position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); <explosion>5__5.SetActive(true); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } <rnd>5__1 = new Random(); <vec>5__2 = RoundManager.Instance.insideAINodes[<rnd>5__1.Next(0, RoundManager.Instance.insideAINodes.Length)].transform.position; <tpPos>5__3 = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(<vec>5__2, 10f, default(NavMeshHit), <rnd>5__1, -1, 1f); player.TeleportPlayer(<tpPos>5__3, false, 0f, false, true); if (NetworkManager.Singleton.IsServer && ((NetworkBehaviour)mine).NetworkObject.IsSpawned) { ((NetworkBehaviour)mine).NetworkObject.Despawn(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(); } } [HarmonyPatch("Start")] [HarmonyPostfix] public static void RollTPMineChance(Landmine __instance) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) if (ConfigProcessor.Config.SpawnTPMines && NetworkManager.Singleton.IsServer && !HNSValues.TPMines.Contains(((NetworkBehaviour)__instance).NetworkObjectId) && new Random().Next(1, 3) == 2) { GameObject val = Object.Instantiate<GameObject>(ModBase.TPMine, ((Component)__instance).transform.position, Quaternion.identity); val.GetComponentInChildren<NetworkObject>().Spawn(true); HNSValues.TPMines.Add(((NetworkBehaviour)val.GetComponentInChildren<Landmine>()).NetworkObjectId); if (((NetworkBehaviour)__instance).NetworkObject.IsSpawned) { ((NetworkBehaviour)__instance).NetworkObject.Despawn(true); } Landmine componentInChildren = val.GetComponentInChildren<Landmine>(); Animator mineAnimator = componentInChildren.mineAnimator; mineAnimator.speed *= 10f; componentInChildren.mineAudio.volume = 0.25f; componentInChildren.mineFarAudio.volume = 0.25f; FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(8, (Allocator)2, -1); ulong networkObjectId = ((NetworkBehaviour)componentInChildren).NetworkObjectId; ((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_TPMineSpawned", val2, (NetworkDelivery)2); } } [HarmonyPatch("PressMineServerRpc")] [HarmonyPostfix] public static void StopExplosionSpawnIfSpecial(Landmine __instance) { if (HNSValues.TPMines.Contains(((NetworkBehaviour)__instance).NetworkObjectId)) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(TPPlayerToRandomPos(__instance, StartOfRound.Instance.allPlayerScripts.OrderBy((PlayerControllerB x) => Vector3.Distance(((Component)__instance).transform.position, ((Component)x).transform.position)).First())); } } [HarmonyPatch("SetOffMineAnimation")] [HarmonyPrefix] public static bool StopExplosion(Landmine __instance) { return !HNSValues.TPMines.Contains(((NetworkBehaviour)__instance).NetworkObjectId); } [IteratorStateMachine(typeof(<TPPlayerToRandomPos>d__3))] public static IEnumerator TPPlayerToRandomPos(Landmine mine, PlayerControllerB player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TPPlayerToRandomPos>d__3(0) { mine = mine, player = player }; } public static void AddMineToList(ulong _, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); Landmine componentInChildren = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]).gameObject.GetComponentInChildren<Landmine>(); Animator mineAnimator = componentInChildren.mineAnimator; mineAnimator.speed *= 10f; componentInChildren.mineAudio.volume = 0.25f; componentInChildren.mineFarAudio.volume = 0.25f; HNSValues.TPMines.Add(((NetworkBehaviour)componentInChildren).NetworkObjectId); } } [HarmonyPatch(typeof(ManualCameraRenderer))] internal class ManualCameraRendererPatch { [HarmonyPatch("SwitchRadarTargetForward")] [HarmonyPrefix] public static bool StopSwitchForward() { return GameNetworkManager.Instance.localPlayerController.AsHNSPlayer().Role != PlayerRole.Seeker || ConfigProcessor.Config.LetSeekerSwitchCam; } [HarmonyPatch("SwitchRadarTargetAndSync")] [HarmonyPrefix] public static bool StopSwitch() { return GameNetworkManager.Instance.localPlayerController.AsHNSPlayer().Role != PlayerRole.Seeker || ConfigProcessor.Config.LetSeekerSwitchCam; } [HarmonyPatch("SwitchRadarTargetServerRpc")] [HarmonyPrefix] public static bool StopSwitchRPC() { return GameNetworkManager.Instance.localPlayerController.AsHNSPlayer().Role != PlayerRole.Seeker || ConfigProcessor.Config.LetSeekerSwitchCam; } } [HarmonyPatch(typeof(PlayerControllerB))] public static class PlayerControllerBPatch { [CompilerGenerated] private sealed class <>c__DisplayClass7_0 { public HNSPlayerComponent hnsPlayer; internal bool <WaitForUndisguiseCoroutine>b__0() { return !hnsPlayer.IsDisguised; } } [CompilerGenerated] private sealed class <WaitForUndisguiseCoroutine>d__7 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private <>c__DisplayClass7_0 <>8__1; private PlayerControllerB <player>5__2; private RaycastHit <hit>5__3; private GrabbableObject <item>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForUndisguiseCoroutine>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <player>5__2 = null; <item>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0097: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; <>8__1.hnsPlayer.SetDisguised(<item>5__4); } else { <>1__state = -1; if (StartOfRound.Instance.inShipPhase) { goto IL_01a1; } <>8__1 = new <>c__DisplayClass7_0(); <player>5__2 = GameNetworkManager.Instance.localPlayerController; <>8__1.hnsPlayer = <player>5__2.AsHNSPlayer(); if (<>8__1.hnsPlayer.Role == PlayerRole.Seeker || !Physics.Raycast(((Component)<player>5__2.gameplayCamera).transform.position, ((Component)<player>5__2.gameplayCamera).transform.forward, ref <hit>5__3, 5f, 1073742656) || ((Component)((RaycastHit)(ref <hit>5__3)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref <hit>5__3)).collider).tag == "PhysicsProp")) { goto IL_0192; } if (((Component)((RaycastHit)(ref <hit>5__3)).collider).gameObject.TryGetComponent<GrabbableObject>(out <item>5__4) && <item>5__4.grabbable) { <item>5__4.grabbable = false; <>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.hnsPlayer.IsDisguised)); <>1__state = 1; return true; } } <item>5__4 = null; goto IL_0192; IL_01a1: return false; IL_0192: <>8__1 = null; <player>5__2 = null; goto IL_01a1; } 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 controlsAdded; private static bool holdCompleted; [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPostfix] public static void Setup(PlayerControllerB __instance) { //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Expected O, but got Unknown //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Expected O, but got Unknown //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Expected O, but got Unknown //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Expected O, but got Unknown //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Expected O, but got Unknown //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Expected O, but got Unknown //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown ((Component)__instance).gameObject.AddComponent<CustomUI>(); GameObject val = Object.Instantiate<GameObject>((ConfigProcessor.Config.EndGameUIStyle == EndGameUIStyle.Blue) ? ModBase.EndOfGameStatsBlue : ModBase.EndOfGameStatsOrange); val.AddComponent<EndGameStatsUI>(); if (NetworkManager.Singleton.IsServer) { MethodInfo method = typeof(StartOfRound).GetMethod("SpawnUnlockable", BindingFlags.Instance | BindingFlags.NonPublic); for (int i = 1; i < 8; i++) { if (i < 4) { method.Invoke(StartOfRound.Instance, new object[2] { i, false }); } else { method.Invoke(StartOfRound.Instance, new object[2] { i + 20, false }); } } NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ServerLockDoor", new HandleNamedMessageDelegate(KeyItemPatch.ServerTransmitDoorLock)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ServerDisguiseClient", new HandleNamedMessageDelegate(HNSPlayerComponent.ServerDisguiseClient)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ServerUnDisguiseClient", new HandleNamedMessageDelegate(HNSPlayerComponent.ServerUnDisguiseClient)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ServerLockDisguiseRot", new HandleNamedMessageDelegate(HNSPlayerComponent.ServerLockDisguiseRotation)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ServerPlayTaunt", new HandleNamedMessageDelegate(HNSPlayerComponent.ServerPlayTaunt)); } else { NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ClientReceivesRoleMSG", new HandleNamedMessageDelegate(GameManager.SetRole)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ClientRefreshPlayerComps", new HandleNamedMessageDelegate(GameManager.RefreshPlayerComps)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ShowRoles", new HandleNamedMessageDelegate(GameManager.ShowRoles)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_EndGame", new HandleNamedMessageDelegate(GameManager.EndGameClient)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ShotgunSpawned", new HandleNamedMessageDelegate(GameManager.GrabWeaponIfSeeker)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ClientReceivesBroadcastMsg", new HandleNamedMessageDelegate(CustomUI.ProcessBroadcastMessage)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_RecalcTime", new HandleNamedMessageDelegate(GameManager.RecalcTime)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ClientSwitchSuits", new HandleNamedMessageDelegate(GameManager.ClientSwitchSuits)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_TPMineSpawned", new HandleNamedMessageDelegate(LandminePatch.AddMineToList)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_DoorLocked", new HandleNamedMessageDelegate(KeyItemPatch.ClientLockDoor)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ClientReceivePlayerStats", new HandleNamedMessageDelegate(PlayerStatManager.ClientSetPlayerStats)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ClientReceiveServerConfig", new HandleNamedMessageDelegate(ConfigProcessor.ClientSetServerConfig)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_DisguiseClient", new HandleNamedMessageDelegate(HNSPlayerComponent.DisguiseClient)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_UnDisguiseClient", new HandleNamedMessageDelegate(HNSPlayerComponent.UnDisguiseClient)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ClientLockDisguiseRot", new HandleNamedMessageDelegate(HNSPlayerComponent.ClientLockDisguiseRotation)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Tibnan.hnsmod_ClientPlayTaunt", new HandleNamedMessageDelegate(HNSPlayerComponent.ClientPlayTaunt)); } EditControls(); if (ConfigProcessor.Config.DisplayWarning) { HUDManager.Instance.DisplayTip("Caution", string.Format("Playing Hide n Seek. Several core gameplay features disabled.\nVersion: {0}", "1.4.1"), false, false, "LC_Tip1"); } } [HarmonyPatch("KillPlayer")] [HarmonyPrefix] public static bool StopKillPlayer() { HNSPlayerComponent component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<HNSPlayerComponent>(); if (component.Role == PlayerRole.Hider) { component.SetUndisguised(); } return component.Role == PlayerRole.Hider || (component.Role == PlayerRole.Seeker && ConfigProcessor.Config.CanSeekerDie); } private static void OnDiscard(CallbackContext context) { if (ConfigProcessor.Config.DisguiseEnabled && !holdCompleted && !StartOfRound.Instance.inShipPhase) { HNSPlayerComponent hNSPlayerComponent = GameNetworkManager.Instance.localPlayerController.AsHNSPlayer(); if (hNSPlayerComponent.Role != PlayerRole.Seeker) { hNSPlayerComponent.SetUndisguised(); } } } private static void LockDisguiseRotation(CallbackContext context) { if (ConfigProcessor.Config.DisguiseEnabled) { holdCompleted = true; if (!StartOfRound.Instance.inShipPhase) { GameNetworkManager.Instance.localPlayerController.AsHNSPlayer().ToggleDisguiseRotation(); } } } private static void OnItemGrab(CallbackContext context) { if (!ConfigProcessor.Config.DisguiseEnabled || holdCompleted) { holdCompleted = false; } else { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(WaitForUndisguiseCoroutine()); } } [IteratorStateMachine(typeof(<WaitForUndisguiseCoroutine>d__7))] private static IEnumerator WaitForUndisguiseCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForUndisguiseCoroutine>d__7(0); } private static void PlayTauntAudio(CallbackContext ctx) { if (!StartOfRound.Instance.inShipPhase) { GameNetworkManager.Instance.localPlayerController.AsHNSPlayer().PlayRandomTaunt(); } } private static void EditControls() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (controlsAdded) { return; } InputActionMap val = IngamePlayerSettings.Instance.playerInput.actions.FindActionMap("Movement", false); val.Disable(); try { InputAction val2 = InputActionSetupExtensions.AddAction(val, "Disguise", (InputActionType)1, (string)null, (string)null, (string)null, (string)null, (string)null); BindingSyntax val3 = InputActionSetupExtensions.AddBinding(val2, "<Keyboard>/h", (string)null, (string)null, (string)null); ((BindingSyntax)(ref val3)).WithInteraction("Hold(duration=0.5)"); val2.canceled += OnDiscard; val2.canceled += OnItemGrab; val2.performed += LockDisguiseRotation; InputAction val4 = InputActionSetupExtensions.AddAction(val, "Taunt", (InputActionType)1, (string)null, (string)null, (string)null, (string)null, (string)null); InputActionSetupExtensions.AddBinding(val4, "<Keyboard>/x", (string)null, (string)null, (string)null); val4.performed += PlayTauntAudio; } catch (Exception ex) { ModBase.mls.LogError((object)$"Error when editing controls for player: {ex.Message}"); } finally { val.Enable(); } controlsAdded = true; } [HarmonyPatch("BeginGrabObject")] [HarmonyPrefix] public static bool StopGrabObject(PlayerControllerB __instance) { HNSPlayerComponent hNSPlayerComponent = __instance.AsHNSPlayer(); return StartOfRound.Instance.inShipPhase || !hNSPlayerComponent.IsDisguised; } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("SpawnEnemyFromVent")] [HarmonyPrefix] public static bool StopSpawnEnemyFromVent(RoundManager __instance) { return false; } [HarmonyPatch("SpawnEnemyOnServer")] [HarmonyPrefix] public static bool StopSpawnEnemyOnServer(RoundManager __instance) { return false; } [HarmonyPatch("SpawnDaytimeEnemiesOutside")] [HarmonyPrefix] public static bool StopSpawnDaytimeEnemiesOutside(RoundManager __instance) { return false; } [HarmonyPatch("BeginEnemySpawning")] [HarmonyPrefix] public static bool StopBeginEnemySpawning(RoundManager __instance) { return false; } [HarmonyPatch("SpawnEnemiesOutside")] [HarmonyPrefix] public static bool StopSpawnEnemiesOutside(RoundManager __instance) { return false; } [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPrefix] public static void RandomizeSpawnAmounts(RoundManager __instance) { if (NetworkManager.Singleton.IsServer && ConfigProcessor.Config.ScrapSpawnAmount != 0) { __instance.scrapAmountMultiplier = (float)ConfigProcessor.Config.ScrapSpawnAmount; } } [HarmonyPatch("SpawnMapObjects")] [HarmonyPrefix] public static void RandomizeLandmineAmounts(RoundManager __instance) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if (NetworkManager.Singleton.IsServer && ConfigProcessor.Config.MineSpawnAmount != 0) { AnimationCurve val = new AnimationCurve(); val.AddKey(1f, (float)ConfigProcessor.Config.MineSpawnAmount); __instance.currentLevel.spawnableMapObjects.ToList().Find((SpawnableMapObject x) => ((Object)x.prefabToSpawn).name.ToLower().Contains("landmine")).numberToSpawn = val; } } } [HarmonyPatch(typeof(ShotgunItem))] internal class ShotgunItemPatch { [HarmonyPatch("ShootGun")] [HarmonyPostfix] public static void ResetShells(ShotgunItem __instance) { __instance.shellsLoaded = 2; } [HarmonyPatch("ShootGun")] [HarmonyPostfix] public static void TryHitDoor(ShotgunItem __instance, ref Vector3 shotgunPosition, ref Vector3 shotgunForward) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(shotgunPosition, shotgunForward), ref val, 10f, 2816, (QueryTriggerInteraction)2)) { DoorLockShotgunInteract componentInChildren = ((Component)((RaycastHit)(ref val)).transform).GetComponentInChildren<DoorLockShotgunInteract>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.Hit(((GrabbableObject)__instance).playerHeldBy); } } } } [HarmonyPatch(typeof(StartMatchLever))] internal class StartMatchLeverPatch { [HarmonyPatch("LeverAnimation")] [HarmonyPrefix] public static bool CheckPlayerCount(StartMatchLever __instance) { ModBase.mls.LogWarning((object)("Checking player count... " + (StartOfRound.Instance.connectedPlayersAmount + 1))); bool flag = StartOfRound.Instance.connectedPlayersAmount > 0; if (!flag) { ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>().ShowLocalMessage("<color=red>At least 2 players are required to start.</color>", 2); } return flag; } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("StartGame")] [HarmonyPostfix] public static void StartHNS(StartOfRound __instance) { StartOfRound.Instance.currentLevel.Enemies.ForEach(delegate(SpawnableEnemyWithRarity x) { x.enemyType.spawningDisabled = true; }); if (NetworkManager.Singleton.IsServer) { GameManager.StartGame(StartOfRound.Instance.connectedPlayersAmount); } } [HarmonyPatch("EndOfGameClientRpc")] [HarmonyPostfix] public static void ResetPlayers(StartOfRound __instance) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { HNSPlayerComponent component = ((Component)val).gameObject.GetComponent<HNSPlayerComponent>(); if ((Object)(object)component != (Object)null) { component.Role = PlayerRole.None; } } TimeOfDay.Instance.timeUntilDeadline = 3240f; HNSValues.TPMines.Clear(); HNSValues.FirstWeaponReceived = false; } [HarmonyPatch("ShipLeaveAutomatically")] [HarmonyPrefix] public static void GrabShipLeaveTime(ref bool leavingOnMidnight) { GameManager.Instance.ShipLeavingEarly = true; } [HarmonyPatch("OnShipLandedMiscEvents")] [HarmonyPostfix] public static void AddDoorComponents() { ModBase.mls.LogInfo((object)"Adding door interact components."); DoorLock[] array = Object.FindObjectsOfType<DoorLock>(); DoorLock[] array2 = array; foreach (DoorLock val in array2) { ((Component)val).gameObject.AddComponent<DoorLockShotgunInteract>(); } if (ConfigProcessor.Config.TPToEntranceEnabled) { RoundManager.FindMainEntranceScript(false).TeleportPlayer(); } } [HarmonyPatch("ReviveDeadPlayers")] [HarmonyPostfix] public static void SwitchSuits() { UnlockableSuit.SwitchSuitForAllPlayers(0, false); if (ConfigProcessor.Config.StatsEnabled) { try { EndGameStatsUI.Instance.Display(); } catch (Exception) { } } } [HarmonyPatch("OnClientConnect")] [HarmonyPostfix] public static void SendServerConfiguration(ref ulong clientId) { if (NetworkManager.Singleton.IsServer) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(ConfigProcessor.Config.TransferConfigTo(clientId)); } } } [HarmonyPatch(typeof(TerminalAccessibleObject))] public class TerminalAccessibleObjectPatch { [HarmonyPatch("Update")] [HarmonyPrefix] public static bool BlockOriginal(TerminalAccessibleObject __instance) { return (Object)(object)__instance.mapRadarObject != (Object)null; } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { private protected static readonly Regex randomRegex = new Regex("(?i)r(a)?n(d)?o(m)?|rand|rnd"); [HarmonyPatch("OnSubmit")] [HarmonyPrefix] public static bool CheckForModKeyword(Terminal __instance) { if (StartOfRound.Instance.inShipPhase) { string text = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded).ToLower(); ModBase.mls.LogInfo((object)"PARSED SENTENCE:"); ModBase.mls.LogInfo((object)text); if (randomRegex.IsMatch(text)) { int num = new Random().Next(1, 13); while (num == 11 || num == 3) { num = new Random().Next(1, 13); } StartOfRound.Instance.ChangeLevelServerRpc(num, __instance.groupCredits); __instance.screenText.text = ""; __instance.QuitTerminal(true); return false; } return true; } return true; } } [HarmonyPatch(typeof(TimeOfDay))] internal class TimeOfDayPatch { [HarmonyPatch("UpdateProfitQuotaCurrentTime")] [HarmonyPrefix] public static bool StopUpdateProfitQuotaCurrentTime(TimeOfDay __instance) { return false; } [HarmonyPatch("SetShipLeaveEarlyClientRpc")] [HarmonyPrefix] public static bool StopShipLeaveEarly() { return !GameManager.Instance.ShipLeavingEarly; } } } namespace LCHideAndSeekMod.Extensions { public static class GameObjectExtensions { public static bool TryGetComponent<T>(this GameObject go, out T component) where T : Component { component = go.GetComponent<T>(); return (Object)(object)component != (Object)null; } public static bool TryGetComponentsInChildren<T>(this GameObject go, out T[] components) where T : Component { components = go.GetComponentsInChildren<T>(); return components.Length != 0; } } public static class PlayerControllerBExtensions { public static HNSPlayerComponent AsHNSPlayer(this PlayerControllerB player) { return ((Component)player).gameObject.GetComponent<HNSPlayerComponent>(); } } } namespace LCHideAndSeekMod.Enums { public enum EndGameUIStyle { Orange, Blue } public enum GamemodeOption { DelayedWeapon, InstantWeapon } public enum GameResult { HiderWin, SeekerWin, None, Draw } public enum GameState { WaitingForPlayers, InGame, GameOver } public enum MineSpawnAmount { Standard = 0, SlightlyMore = 5, More = 10, MuchMore = 20 } public enum ScrapSpawnAmount { Standard = 0, SlightlyMore = 3, More = 5, MuchMore = 7 } public enum SeekerWeapon { Shotgun, Shovel, Both } public enum Suit { Orange, Green, Hazard, Pajama, Purple, Bee, Bunny } public enum WhisperFailReason { NoError, SendingAsSeeker, SendingToSeeker, TargetNotFound, SendingToSelf } } namespace LCHideAndSeekMod.Core { internal class CustomUI : NetworkBehaviour { [CompilerGenerated] private sealed class <FadeTextOutCoroutine>d__19 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public int duration; public CustomUI <>4__this; private float <alpha>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FadeTextOutCoroutine>d__19(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_0067: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <alpha>5__1 = 1f; ((Graphic)<>4__this.canvasText).canvasRenderer.SetAlpha(<alpha>5__1); <>2__current = (object)new WaitForSeconds((float)duration); <>1__state = 1; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } if (<alpha>5__1 > 0f) { <alpha>5__1 -= 0.01f; ((Graphic)<>4__this.canvasText).canvasRenderer.SetAlpha(<alpha>5__1); <>2__current = null; <>1__state = 2; return true; } <>4__this.Show(show: false); ((Graphic)<>4__this.canvasText).canvasRenderer.SetAlpha(1f); <>4__this.updateOverridden = 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 <WaitForFade>d__14 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Action action; public int duration; public CustomUI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForFade>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.FadeOut(duration); <>2__current = (object)new WaitUntil((Func<bool>)(() => !<>4__this.canvasObject.activeInHierarchy)); <>1__state = 1; return true; case 1: <>1__state = -1; action(); 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 <WaitForHNSComponent>d__8 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public CustomUI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForHNSComponent>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)((Component)<>4__this.ownerPlayer).gameObject.GetComponent<HNSPlayerComponent>() != (Object)null)); <>1__state = 1; return true; case 1: <>1__state = -1; ModBase.mls.LogInfo((object)"Assigning hns comp to ui"); <>4__this.localHNSComponent = ((Component)<>4__this.ownerPlayer).gameObject.GetComponent<HNSPlayerComponent>(); 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 GameObject canvasObject; private GameObject canvasTextObject; private Text canvasText; private Coroutine fadeCoroutine; private PlayerControllerB ownerPlayer; private bool updateOverridden = false; private HNSPlayerComponent localHNSComponent; private void Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) canvasObject = new GameObject(); canvasObject.transform.parent = ((Component)this).transform; ((Object)canvasObject).name = "CustomUICanvas"; Canvas val = canvasObject.AddComponent<Canvas>(); canvasObject.SetActive(false); val.renderMode = (RenderMode)0; canvasObject.AddComponent<CanvasScaler>(); CanvasGroup val2 = canvasObject.AddComponent<CanvasGroup>(); val2.blocksRaycasts = false; canvasObject.AddComponent<GraphicRaycaster>(); canvasTextObject = new GameObject(); ((Object)canvasTextObject).name = "CustomUICanvasText"; Text val3 = (canvasText = canvasTextObject.AddComponent<Text>()); Transform transform = canvasTextObject.transform; Rect rect = ((Component)val).GetComponent<RectTransform>().rect; float num = ((Rect)(ref rect)).width / 2f - 10f; rect = ((Component)val).GetComponent<RectTransform>().rect; transform.localPosition = new Vector3(num, ((Rect)(ref rect)).height / 2f - 75f, 0f); val3.text = ""; val3.font = ModBase.ModFont; val3.alignment = (TextAnchor)7; ((Graphic)val3).rectTransform.sizeDelta = new Vector2(500f, 400f); val3.fontSize = 22; ((Component)val3).transform.parent = canvasObject.transform; val3.supportRichText = true; ownerPlayer = GameNetworkManager.Instance.localPlayerController; ((MonoBehaviour)this).StartCoroutine(WaitForHNSComponent()); } [IteratorStateMachine(typeof(<WaitForHNSComponent>d__8))] private IEnumerator WaitForHNSComponent() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForHNSComponent>d__8(0) { <>4__this = this }; } public static void BroadcastMessage(string msg, int fadeDuration = 0, bool includeServer = true) { //IL_0036: 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_0056: 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_007e: 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_009b: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { char[] array = msg.ToCharArray(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4 + 2 * array.Length + 4, (Allocator)2, -1); int num = array.Length; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); for (int i = 0; i < array.Length; i++) { ((FastBufferWriter)(ref val)).WriteValueSafe<char>(ref array[i], default(ForPrimitives)); } ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref fadeDuration, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientReceivesBroadcastMsg", val, (NetworkDelivery)2); if (includeServer) { CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); component.ShowLocalMessage(msg, fadeDuration); } } } public static void BroadcastMessage(string msg, int fadeDuration = 0, bool includeServer = true, params ulong[] clients) { //IL_0036: 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_0056: 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_007e: 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_00ae: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { char[] array = msg.ToCharArray(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4 + 2 * array.Length + 4, (Allocator)2, -1); int num = array.Length; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); for (int i = 0; i < array.Length; i++) { ((FastBufferWriter)(ref val)).WriteValueSafe<char>(ref array[i], default(ForPrimitives)); } ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref fadeDuration, default(ForPrimitives)); foreach (ulong num2 in clients) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.hnsmod_ClientReceivesBroadcastMsg", num2, val, (NetworkDelivery)2); } if (includeServer) { CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); component.ShowLocalMessage(msg, fadeDuration); } } } public static void ProcessBroadcastMessage(ulong _, FastBufferReader reader) { //IL_000d: 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_0027: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) string text = ""; int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); char c = default(char); for (int i = 0; i < num; i++) { ((FastBufferReader)(ref reader)).ReadValueSafe<char>(ref c, default(ForPrimitives)); text += c; } int duration = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref duration, default(ForPrimitives)); CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); component.ShowLocalMessage(text, duration); } private void Update() { if (updateOverridden || !(ConfigProcessor.Config?.UIShow ?? false) || !GameManager.Instance.GameRunning) { return; } if (localHNSComponent.Role == PlayerRole.Hider) { if (ConfigProcessor.Config.DisguiseEnabled) { SetText(string.Format("<color=white>{0}\nPress H to {1}\nHold H to lock rotation: {2} \nRound {3}: Hiders left: {4}</color>", localHNSComponent.IsDisguised ? $"Disguised as {localHNSComponent.DisguiseName}:" : "Undisguised.", localHNSComponent.IsDisguised ? "Undisguise, X to taunt" : "Disguise", localHNSComponent.DisguiseUnRotatable ? "<color=red>LOCKED</color>" : "<color=green>UNLOCKED</color>", GameManager.RoundCount, GameManager.Instance.HidersCount), overrideUpdate: false); } else { SetText($"<color=white>Round {GameManager.RoundCount}: Hiders left: {GameManager.Instance.HidersCount}</color>", overrideUpdate: false); } Show(show: true); } else if (localHNSComponent.Role == PlayerRole.Seeker && TimeOfDay.Instance.shipLeavingAlertCalled) { SetText($"<color=red>Round {GameManager.RoundCount}: Hiders left: {GameManager.Instance.HidersCount}\nShip leaving at: {GameManager.Instance.ShipLeavingTime}</color>", overrideUpdate: false); Show(show: true); } } public void WaitUntilFadeThenDo(Action action, int duration = -1) { ((MonoBehaviour)this).StartCoroutine(WaitForFade(action, duration)); } [IteratorStateMachine(typeof(<WaitForFade>d__14))] private IEnumerator WaitForFade(Action action, int duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForFade>d__14(0) { <>4__this = this, action = action, duration = duration }; } public void SetText(string text, bool overrideUpdate = true) { canvasText.text = text; updateOverridden = overrideUpdate; } public void Show(bool show) { canvasObject.SetActive(show); } public void FadeOut(int duration = -1) { if (duration != -1) { if (fadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(fadeCoroutine); } fadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeTextOutCoroutine(duration)); } } public void ShowLocalMessage(string msg, int duration = 0) { SetText(msg); Show(show: true); FadeOut(duration); } [IteratorStateMachine(typeof(<FadeTextOutCoroutine>d__19))] private IEnumerator FadeTextOutCoroutine(int duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FadeTextOutCoroutine>d__19(0) { <>4__this = this, duration = duration }; } } internal class DoorLockShotgunInteract : MonoBehaviour { private int health; private DoorLock mainScript; private void Awake() { mainScript = ((Component)this).gameObject.GetComponentInChildren<DoorLock>(); health = ConfigProcessor.Config.DoorHits; } public void Hit(PlayerControllerB playerWhoHit) { if ((Object)(object)playerWhoHit == (Object)(object)GameNetworkManager.Instance.localPlayerController && mainScript.isLocked && health >= 1) { health--; if (health < 1) { mainScript.UnlockDoorSyncWithServer(); mainScript.OpenOrCloseDoor(playerWhoHit); health = ConfigProcessor.Config.DoorHits; } } } } internal class GameManager : MonoBehaviour { public delegate void GameEndedHandler(); [CompilerGenerated] private sealed class <GrabWeapon>d__32 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerControllerB player; public NetworkObject nObject; public GameObject weapon; public bool delay; private Traverse <trav>5__1; private MethodInfo <mInfo>5__2; private IEnumerator <coroutine>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GrabWeapon>d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <trav>5__1 = null; <mInfo>5__2 = null; <coroutine>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!delay) { break; } if (ConfigProcessor.Config.GamemodeOption == GamemodeOption.DelayedWeapon) { <>2__current = (object)new WaitUntil((Func<bool>)(() => Utils.CalcHour(TimeOfDay.Instance.normalizedTimeOfDay, TimeOfDay.Instance.numberOfHours) >= 12)); <>1__state = 1; return true; } <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } ModBase.mls.LogInfo((object)"Trying to grab spawned weapon on client"); <trav>5__1 = Traverse.Create((object)player); <trav>5__1.Field("currentlyGrabbingObject").SetValue((object)weapon.GetComponent<GrabbableObject>()); object? value = typeof(PlayerControllerB).GetField("currentlyGrabbingObject", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(player); ((GrabbableObject)((value is GrabbableObject) ? value : null)).InteractItem(); typeof(PlayerControllerB).GetMethod("GrabObjectServerRpc", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(player, new object[1] { (object)new NetworkObjectReference(nObject) }); <mInfo>5__2 = typeof(PlayerControllerB).GetMethod("GrabObject", BindingFlags.Instance | BindingFlags.NonPublic); <coroutine>5__3 = (IEnumerator)<mInfo>5__2.Invoke(player, null); ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(<coroutine>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 <GrantSeekerWeapons>d__18 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SeekerWeapon weapon; public GamemodeOption gamemode; public GameManager <>4__this; private GameObject <shovel>5__1; private GameObject <shotgun>5__2; private NetworkObject <shovelNO>5__3; private NetworkObject <shotgunNO>5__4; private PlayerControllerB <player>5__5; private FastBufferWriter <writer>5__6; private FastBufferWriter <writer>5__7; private Traverse <trav>5__8; private MethodInfo <mInfo>5__9; private IEnumerator <coroutine>5__10; private Traverse <trav>5__11; private MethodInfo <mInfo>5__12; private IEnumerator <coroutine>5__13; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GrantSeekerWeapons>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <shovel>5__1 = null; <shotgun>5__2 = null; <shovelNO>5__3 = null; <shotgunNO>5__4 = null; <player>5__5 = null; <trav>5__8 = null; <mInfo>5__9 = null; <coroutine>5__10 = null; <trav>5__11 = null; <mInfo>5__12 = null; <coroutine>5__13 = null; <>1__state = -2; } private bool MoveNext() { //IL_0539: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Expected O, but got Unknown //IL_03c0: Unknown result type (might be due to invalid IL or missing references) object? value2; switch (<>1__state) { default: return false; case 0: <>1__state = -1; <shovel>5__1 = null; <shotgun>5__2 = null; <shovelNO>5__3 = null; <shotgunNO>5__4 = null; if (weapon == SeekerWeapon.Both) { <shovel>5__1 = Object.Instantiate<GameObject>(StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName == "Shovel").spawnPrefab, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position, Quaternion.identity); <shotgun>5__2 = Object.Instantiate<GameObject>(StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName == "Shotgun").spawnPrefab, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position, Quaternion.identity); } else if (weapon == SeekerWeapon.Shovel) { <shovel>5__1 = Object.Instantiate<GameObject>(StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName == "Shovel").spawnPrefab, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position, Quaternion.identity); } else { <shotgun>5__2 = Object.Instantiate<GameObject>(StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName == "Shotgun").spawnPrefab, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position, Quaternion.identity); } if ((Object)(object)<shovel>5__1 != (Object)null) { <shovelNO>5__3 = <shovel>5__1.GetComponent<NetworkObject>(); <shovelNO>5__3.Spawn(false); <writer>5__6 = new FastBufferWriter(8, (Allocator)2, -1); ref FastBufferWriter reference = ref <writer>5__6; ulong networkObjectId = <shovelNO>5__3.NetworkObjectId; ((FastBufferWriter)(ref reference)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ShotgunSpawned", <writer>5__6, (NetworkDelivery)2); } if ((Object)(object)<shotgun>5__2 != (Object)null) { <shotgunNO>5__4 = <shotgun>5__2.GetComponent<NetworkObject>(); <shotgunNO>5__4.Spawn(false); <writer>5__7 = new FastBufferWriter(8, (Allocator)2, -1); ref FastBufferWriter reference2 = ref <writer>5__7; ulong networkObjectId = <shotgunNO>5__4.NetworkObjectId; ((FastBufferWriter)(ref reference2)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ShotgunSpawned", <writer>5__7, (NetworkDelivery)2); } <player>5__5 = GameNetworkManager.Instance.localPlayerController; if (<player>5__5.AsHNSPlayer().Role == PlayerRole.Seeker) { ModBase.mls.LogInfo((object)"Grabbing weapon(s) on server"); if ((Object)(object)<shovel>5__1 != (Object)null) { <trav>5__8 = Traverse.Create((object)<player>5__5); <trav>5__8.Field("currentlyGrabbingObject").SetValue((object)<shovel>5__1.GetComponent<GrabbableObject>()); object? value = typeof(PlayerControllerB).GetField("currentlyGrabbingObject", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(<player>5__5); ((GrabbableObject)((value is GrabbableObject) ? value : null)).InteractItem(); typeof(PlayerControllerB).GetMethod("GrabObjectServerRpc", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(<player>5__5, new object[1] { (object)new NetworkObjectReference(<shovelNO>5__3) }); <mInfo>5__9 = typeof(PlayerControllerB).GetMethod("GrabObject", BindingFlags.Instance | BindingFlags.NonPublic); <coroutine>5__10 = (IEnumerator)<mInfo>5__9.Invoke(<player>5__5, null); ((MonoBehaviour)<>4__this).StartCoroutine(<coroutine>5__10); <trav>5__8 = null; <mInfo>5__9 = null; <coroutine>5__10 = null; } <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } break; case 1: <>1__state = -1; if (!((Object)(object)<shotgun>5__2 != (Object)null)) { break; } if (gamemode == GamemodeOption.DelayedWeapon) { <>2__current = (object)new WaitUntil((Func<bool>)(() => Utils.CalcHour(TimeOfDay.Instance.normalizedTimeOfDay, TimeOfDay.Instance.numberOfHours) >= 12)); <>1__state = 2; return true; } goto IL_04b1; case 2: { <>1__state = -1; goto IL_04b1; } IL_04b1: <trav>5__11 = Traverse.Create((object)<player>5__5); <trav>5__11.Field("currentlyGrabbingObject").SetValue((object)<shotgun>5__2.GetComponent<GrabbableObject>()); value2 = typeof(PlayerControllerB).GetField("currentlyGrabbingObject", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(<player>5__5); ((GrabbableObject)((value2 is GrabbableObject) ? value2 : null)).InteractItem(); typeof(PlayerControllerB).GetMethod("GrabObjectServerRpc", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(<player>5__5, new object[1] { (object)new NetworkObjectReference(<shotgunNO>5__4) }); <mInfo>5__12 = typeof(PlayerControllerB).GetMethod("GrabObject", BindingFlags.Instance | BindingFlags.NonPublic); <coroutine>5__13 = (IEnumerator)<mInfo>5__12.Invoke(<player>5__5, null); ((MonoBehaviour)<>4__this).StartCoroutine(<coroutine>5__13); <trav>5__11 = null; <mInfo>5__12 = null; <coroutine>5__13 = null; break; } 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 GameObject obj; private PlayerControllerB seeker; private List<PlayerControllerB> hiders = new List<PlayerControllerB>(); private GameState gameState = GameState.WaitingForPlayers; private GameResult gameResult = GameResult.None; private bool shipLeavingEarly = false; private bool twoPlayerMode; private string shipLeavingTime = ""; private List<PlayerControllerB> activePlayers = new List<PlayerControllerB>(); public static GameManager Instance = new GameManager(); public static int RoundCount = 1; public bool GameRunning => gameState == GameState.InGame; public int HidersCount { get { if (NetworkManager.Singleton.IsServer) { return hiders.Count; } return hiders.Count((PlayerControllerB x) => !x.isPlayerDead && !x.disconnectedMidGame); } } public string ShipLeavingTime { get { return shipLeavingTime; } set { shipLeavingTime = value; } } public bool ShipLeavingEarly { get { return shipLeavingEarly; } set { shipLeavingEarly = value; } } public bool SeekerInTerminal => seeker.inTerminalMenu; public ReadOnlyCollection<PlayerControllerB> Hiders => hiders.AsReadOnly(); public PlayerControllerB Seeker => seeker; public int Result => (int)gameResult; public ReadOnlyCollection<PlayerControllerB> Players => activePlayers.AsReadOnly(); public event GameEndedHandler GameEnded; public void Update() { switch (gameState) { case GameState.WaitingForPlayers: break; case GameState.InGame: hiders.RemoveAll(delegate(PlayerControllerB x) { if (x.disconnectedMidGame) { activePlayers.Remove(x); } return x.isPlayerDead || x.disconnectedMidGame; }); if (seeker.isPlayerDead || seeker.disconnectedMidGame) { gameResult = GameResult.HiderWin; if (hiders.Count < 1) { gameResult = GameResult.Draw; } gameState = GameState.GameOver; } else if (hiders.Count < 1) { gameResult = GameResult.SeekerWin; gameState = GameState.GameOver; } if (StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.shipLeftAutomatically) { gameResult = GameResult.HiderWin; gameState = GameState.GameOver; } if (ConfigProcessor.Config.StartShipEarly && hiders.Count == 1 && !shipLeavingEarly && !twoPlayerMode) { MakeShipLeaveEarly(); } break; case GameState.GameOver: Instance.StopGame(); break; } } private void MakeShipLeaveEarly() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) TimeOfDay.Instance.SetShipLeaveEarlyClientRpc(TimeOfDay.Instance.normalizedTimeOfDay + 0.2f, 0); shipLeavingTime = Utils.CalcTime(TimeOfDay.Instance.normalizedTimeOfDay + 0.2f, TimeOfDay.Instance.numberOfHours); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.hnsmod_RecalcTime", seeker.actualClientId, val, (NetworkDelivery)2); shipLeavingEarly = true; } private void StopGame() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if ((gameState == GameState.GameOver && Object.FindObjectOfType<StartMatchLever>().triggerScript.interactable) || StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.shipLeftAutomatically) { ModBase.mls.LogInfo((object)("SENDING END MESSAGE WITH RESULT " + gameResult)); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe<GameResult>(ref gameResult, default(ForEnums)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_EndGame", val, (NetworkDelivery)2); StartOfRound.Instance.EndGameClientRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId); gameState = GameState.WaitingForPlayers; EndGame(gameResult); } } [IteratorStateMachine(typeof(<GrantSeekerWeapons>d__18))] private IEnumerator GrantSeekerWeapons(SeekerWeapon weapon, GamemodeOption gamemode) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GrantSeekerWeapons>d__18(0) { <>4__this = this, weapon = weapon, gamemode = gamemode }; } public static void StartGame(int playerCount) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) Instance.obj = new GameObject("HNSManager"); Instance = Instance.obj.AddComponent<GameManager>(); Instance.twoPlayerMode = playerCount == 1; if (ConfigProcessor.Config.StatsEnabled) { MiscStat.Reset(); } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if ((val2.isPlayerControlled || val2.isPlayerDead) && (Object)(object)val2.AsHNSPlayer() == (Object)null) { ((Component)val2).gameObject.AddComponent<HNSPlayerComponent>(); } } NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientRefreshPlayerComps", val, (NetworkDelivery)2); Instance.activePlayers = StartOfRound.Instance.allPlayerScripts.ToList().FindAll((PlayerControllerB x) => ((Component)x).gameObject.TryGetComponent<HNSPlayerComponent>(out HNSPlayerComponent _)); foreach (PlayerControllerB activePlayer in Instance.activePlayers) { ModBase.mls.LogError((object)(activePlayer.playerUsername + " " + activePlayer.AsHNSPlayer().Role.ToString() + " CHANCE BEFORE SEEKER CHOOSE: " + activePlayer.AsHNSPlayer().SeekerChance)); } Instance.ChooseSeeker(); ModBase.mls.LogWarning((object)("Choosing seeker: " + Instance.seeker.playerUsername + " " + Instance.seeker.AsHNSPlayer().Role.ToString() + " " + Instance.seeker.AsHNSPlayer().SeekerChance)); SendRoleMessage(Instance.seeker.playerClientId, PlayerRole.Seeker); Instance.activePlayers.ForEach(delegate(PlayerControllerB x) { HNSPlayerComponent hNSPlayerComponent2 = x.AsHNSPlayer(); if (hNSPlayerComponent2.Role != PlayerRole.Seeker) { hNSPlayerComponent2.Role = PlayerRole.Hider; Instance.hiders.Add(x); SendRoleMessage(x.playerClientId, PlayerRole.Hider); } }); Instance.AdjustChances(); ((MonoBehaviour)Instance).StartCoroutine(Instance.GrantSeekerWeapons(ConfigProcessor.Config.SeekerWeapon, ConfigProcessor.Config.GamemodeOption)); Instance.SwitchSuits(ConfigProcessor.Config.SeekerSuit, ConfigProcessor.Config.HiderSuit); Instance.gameState = GameState.InGame; StartOfRound.Instance.mapScreen.SwitchRadarTargetClientRpc((int)Instance.seeker.playerClientId); if (ConfigProcessor.Config.StatsEnabled) { ((Component)Instance).gameObject.AddComponent<PlayerStatManager>(); } if (ConfigProcessor.Config.UIShow) { CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); HNSPlayerComponent hNSPlayerComponent = GameNetworkManager.Instance.localPlayerController.AsHNSPlayer(); component.ShowLocalMessage((hNSPlayerComponent.Role == PlayerRole.Seeker) ? "<color=red>You are a seeker.</color>" : "<color=white>You are a hider.</color>", 10); } NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ShowRoles", val, (NetworkDelivery)2); } private static void SendRoleMessage(ulong id, PlayerRole role) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_002b: 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) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref id, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<PlayerRole>(ref role, default(ForEnums)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientReceivesRoleMSG", val, (NetworkDelivery)2); } public static void SetRole(ulong _, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) ulong num = default(ulong); ((FastBufferReader)(ref reader)).ReadValue<ulong>(ref num, default(ForPrimitives)); PlayerRole playerRole = default(PlayerRole); ((FastBufferReader)(ref reader)).ReadValue<PlayerRole>(ref playerRole, default(ForEnums)); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[num]; val.AsHNSPlayer().Role = playerRole; ModBase.mls.LogInfo((object)(val.playerUsername + " " + ((Component)val).gameObject.GetComponent<HNSPlayerComponent>().Role)); if (playerRole == PlayerRole.Seeker) { Instance.seeker = val; } else { Instance.hiders.Add(val); } } public static void ClientSwitchSuits(ulong _, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) Suit seekerSuit = default(Suit); ((FastBufferReader)(ref reader)).ReadValue<Suit>(ref seekerSuit, default(ForEnums)); Suit hiderSuit = default(Suit); ((FastBufferReader)(ref reader)).ReadValue<Suit>(ref hiderSuit, default(ForEnums)); Instance.SwitchSuits(seekerSuit, hiderSuit, issuedByServer: true); } private void SwitchSuits(Suit seekerSuit, Suit hiderSuit, bool issuedByServer = false) { //IL_0098: 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_00ac: 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_00c9: Unknown result type (might be due to invalid IL or missing references) if (!(ConfigProcessor.Config.UseCustomSuits || issuedByServer)) { return; } int num = (int)seekerSuit; UnlockableSuit.SwitchSuitForPlayer(seeker, (num > 3) ? (num + 20) : num, true); num = (int)hiderSuit; foreach (PlayerControllerB hider in hiders) { UnlockableSuit.SwitchSuitForPlayer(hider, (num > 3) ? (num + 20) : num, true); } if (NetworkManager.Singleton.IsServer) { FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe<Suit>(ref seekerSuit, default(ForEnums)); ((FastBufferWriter)(ref val)).WriteValueSafe<Suit>(ref hiderSuit, default(ForEnums)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientSwitchSuits", val, (NetworkDelivery)2); } } private void ChooseSeeker() { activePlayers.RemoveAll((PlayerControllerB x) => x.disconnectedMidGame); if (ConfigProcessor.Config.ChanceBasedSeeker) { float num = activePlayers.Sum((PlayerControllerB x) => ((Component)x).gameObject.GetComponent<HNSPlayerComponent>().SeekerChance); float num2 = Random.Range(0.065f, num); float num3 = 0f; foreach (PlayerControllerB activePlayer in activePlayers) { num3 += activePlayer.AsHNSPlayer().SeekerChance; if (num3 >= num2) { seeker = activePlayer; break; } } } else { seeker = activePlayers.ElementAt(new Random().Next(0, activePlayers.Count)); } seeker.AsHNSPlayer().Role = PlayerRole.Seeker; } private void AdjustChances() { if (!ConfigProcessor.Config.ChanceBasedSeeker) { return; } foreach (PlayerControllerB activePlayer in activePlayers) { HNSPlayerComponent hNSPlayerComponent = activePlayer.AsHNSPlayer(); if (hNSPlayerComponent.Role == PlayerRole.Seeker) { hNSPlayerComponent.SeekerChance -= 0.3f; if (hNSPlayerComponent.SeekerChance < 0f) { hNSPlayerComponent.SeekerChance = 0f; } } else { hNSPlayerComponent.SeekerChance += 0.065f; } ModBase.mls.LogWarning((object)("CHANCE AFTER ADJUSTMENT: " + activePlayer.playerUsername + " " + hNSPlayerComponent.Role.ToString() + " " + hNSPlayerComponent.SeekerChance)); } } private void ShowEndGameMessage(GameResult result) { CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); HNSPlayerComponent hNSPlayerComponent = GameNetworkManager.Instance.localPlayerController.AsHNSPlayer(); Object.FindObjectsOfType<HNSPlayerComponent>().ToList().ForEach(delegate(HNSPlayerComponent x) { ModBase.mls.LogWarning((object)(x.Player.playerUsername + " " + x.Role)); }); switch (result) { case GameResult.Draw: component.ShowLocalMessage("<color=yellow>The game result was a draw!</color>", 5); break; case GameResult.SeekerWin: if (hNSPlayerComponent.Role == PlayerRole.Seeker) { component.ShowLocalMessage("<color=green>You won as the seeker!</color>", 5); } else { component.ShowLocalMessage("<color=red>The seeker won this round!</color>", 5); } break; case GameResult.HiderWin: if (hNSPlayerComponent.Role == PlayerRole.Hider) { component.ShowLocalMessage("<color=green>You won as one of the hiders!</color>", 5); } else { component.ShowLocalMessage("<color=red>The hiders won this round!</color>", 5); } break; case GameResult.None: break; } } public static void EndGameClient(ulong _, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) GameResult result = default(GameResult); ((FastBufferReader)(ref reader)).ReadValueSafe<GameResult>(ref result, default(ForEnums)); Instance.gameState = GameState.WaitingForPlayers; Instance.gameResult = result; Instance.EndGame(result); } private void EndGame(GameResult result) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_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_00a9: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerControllerB activePlayer in Instance.activePlayers) { if ((Object)(object)activePlayer != (Object)null && !activePlayer.isPlayerDead) { if (NetworkManager.Singleton.IsServer) { activePlayer.AsHNSPlayer().SetUndisguised(); } activePlayer.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); activePlayer.TeleportPlayer(StartOfRound.Instance.playerSpawnPositions[(uint)activePlayer.playerClientId].position, false, 0f, false, true); } } if (NetworkManager.Singleton.IsServer) { ShotgunItem[] array = Object.FindObjectsOfType<ShotgunItem>(); ShotgunItem[] array2 = array; foreach (ShotgunItem val in array2) { ((NetworkBehaviour)val).NetworkObject.Despawn(true); } Shovel[] array3 = Object.FindObjectsOfType<Shovel>(); Shovel[] array4 = array3; foreach (Shovel val2 in array4) { ((NetworkBehaviour)val2).NetworkObject.Despawn(true); } this.GameEnded?.Invoke(); } if (ConfigProcessor.Config.UIShow) { Instance.ShowEndGameMessage(result); ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>().WaitUntilFadeThenDo(delegate { RoundCount++; }, 5); } else { RoundCount++; } hiders.Clear(); shipLeavingTime = ""; } public static void RefreshPlayerComps(ulong _, FastBufferReader __) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((val.isPlayerControlled || val.isPlayerDead) && (Object)(object)val.AsHNSPlayer() == (Object)null) { ((Component)val).gameObject.AddComponent<HNSPlayerComponent>(); if (!Instance.activePlayers.Contains(val)) { Instance.activePlayers.Add(val); } } } } public static void ShowRoles(ulong _, FastBufferReader __) { if (ConfigProcessor.Config.UIShow) { CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<CustomUI>(); HNSPlayerComponent hNSPlayerComponent = GameNetworkManager.Instance.localPlayerController.AsHNSPlayer(); component.ShowLocalMessage((hNSPlayerComponent.Role == PlayerRole.Seeker) ? "<color=red>You are a seeker.</color>" : "<color=white>You are a hider.</color>", 10); } Instance.gameState = GameState.InGame; } public static void GrabWeaponIfSeeker(ulong _, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); NetworkObject val = NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]; GameObject gameObject = ((Component)val).gameObject; ModBase.mls.LogError((object)((Object)gameObject).name); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (((Component)localPlayerController).gameObject.GetComponent<HNSPlayerComponent>().Role == PlayerRole.Seeker) { if (!HNSValues.FirstWeaponReceived) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(GrabWeapon(localPlayerController, val, gameObject, delay: false)); HNSValues.FirstWeaponReceived = true; } else { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(GrabWeapon(localPlayerController, val, gameObject, delay: true)); } } } [IteratorStateMachine(typeof(<GrabWeapon>d__32))] private static IEnumerator GrabWeapon(PlayerControllerB player, NetworkObject nObject, GameObject weapon, bool delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GrabWeapon>d__32(0) { player = player, nObject = nObject, weapon = weapon, delay = delay }; } public static void RecalcTime(ulong _, FastBufferReader __) { Instance.shipLeavingTime = Utils.CalcTime(TimeOfDay.Instance.normalizedTimeOfDay + 0.2f, TimeOfDay.Instance.numberOfHours); } } public enum PlayerRole { Hider, Seeker, None } public class HNSPlayerComponent : MonoBehaviour { public PlayerRole Role = PlayerRole.None; private float seekerChance = 0.5f; private GrabbableObject disguise; private Vector3 origRotationOffset; private Quaternion rotOffset; private bool disguiseLocked = false; private AudioSource disguiseTauntAudio; private List<AudioClip> disguiseAudios = new List<AudioClip>(); private PlayerControllerB player; public float SeekerChance { get { return seekerChance; } set { seekerChance = value; } } public bool IsDisguised => (Object)(object)disguise != (Object)null; public bool DisguiseUnRotatable => disguiseLocked; public string DisguiseName => disguise.itemProperties.itemName; public GrabbableObject DisguiseObject => disguise; public bool DisguiseHasAudio => disguiseAudios.Count > 0; public PlayerControllerB Player => player; public void Awake() { player = ((Component)this).GetComponent<PlayerControllerB>(); disguiseTauntAudio = ((Component)player).gameObject.AddComponent<AudioSource>(); disguiseTauntAudio.maxDistance = 35f; disguiseTauntAudio.dopplerLevel = 0f; disguiseTauntAudio.priority = 129; disguiseTauntAudio.volume = 0.632f; disguiseTauntAudio.rolloffMode = (AudioRolloffMode)2; disguiseTauntAudio.velocityUpdateMode = (AudioVelocityUpdateMode)1; disguiseTauntAudio.spatialBlend = 1f; disguiseTauntAudio.spread = 25f; disguiseTauntAudio.playOnAwake = false; disguiseTauntAudio.outputAudioMixerGroup = player.itemAudio.outputAudioMixerGroup; } public void Update() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00b6: 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) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) if (!player.isPlayerDead && IsDisguised) { disguise.targetFloorPosition = ((Component)player).transform.position; ((Component)disguise).transform.position = ((Component)player).transform.position + Vector3.up * disguise.itemProperties.verticalOffset; if (!disguiseLocked) { Quaternion rotat