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 d__11 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public EndGameStatsUI <>4__this; private int 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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; 5__1 = 0; goto IL_0102; case 2: <>1__state = -1; ((Behaviour)<>4__this.statTexts[5__1]).enabled = true; 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 (5__1 < 5) { ((Behaviour)<>4__this.playerTexts[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 playerTexts = new List(); private List statTexts = new List(); private TextMeshProUGUI RoundNumber; private TextMeshProUGUI RoundTime; private TextMeshProUGUI WinnerText; private Image uiBase; public void Awake() { Instance = this; uiBase = ((Component)this).gameObject.GetComponentInChildren(); TextMeshProUGUI[] componentsInChildren = ((Component)this).GetComponentsInChildren(); 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(d__11))] private IEnumerator DisplayStats() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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("Assets\\Prefabs\\PerfectDOSVGA437.ttf"); TPMineExplosion = val.LoadAsset("Assets\\Prefabs\\TPMineExplosion.prefab"); TPMine = val.LoadAsset("Assets\\Custom\\TPMineComplete.prefab"); EndOfGameStatsBlue = val.LoadAsset("Assets\\Custom\\EndGameStats_blue.prefab"); EndOfGameStatsOrange = val.LoadAsset("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().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)) ? ("" + nameOfUserWhoTyped + ": " + chatMessage + "'") : ("" + chatMessage + "")); 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(); 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(); if (!componentInChildren.isLocked) { componentInChildren.LockDoor(30f); } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe(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(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(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(ref key, default(ForPrimitives)); DoorLock componentInChildren = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]).gameObject.GetComponentInChildren(); if (!componentInChildren.isLocked) { componentInChildren.LockDoor(30f); } } } [HarmonyPatch(typeof(Landmine))] internal class LandminePatch { [CompilerGenerated] private sealed class d__3 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Landmine mine; public PlayerControllerB player; private Random 5__1; private Vector3 5__2; private Vector3 5__3; private int 5__4; private GameObject 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 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; 5__4 = 0; break; case 1: <>1__state = -1; 5__5 = null; 5__4++; break; } if (5__4 < 3) { 5__5 = Object.Instantiate(ModBase.TPMineExplosion, ((Component)mine).transform.position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); 5__5.SetActive(true); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } 5__1 = new Random(); 5__2 = RoundManager.Instance.insideAINodes[5__1.Next(0, RoundManager.Instance.insideAINodes.Length)].transform.position; 5__3 = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(5__2, 10f, default(NavMeshHit), 5__1, -1, 1f); player.TeleportPlayer(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(ModBase.TPMine, ((Component)__instance).transform.position, Quaternion.identity); val.GetComponentInChildren().Spawn(true); HNSValues.TPMines.Add(((NetworkBehaviour)val.GetComponentInChildren()).NetworkObjectId); if (((NetworkBehaviour)__instance).NetworkObject.IsSpawned) { ((NetworkBehaviour)__instance).NetworkObject.Despawn(true); } Landmine componentInChildren = val.GetComponentInChildren(); 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(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(d__3))] public static IEnumerator TPPlayerToRandomPos(Landmine mine, PlayerControllerB player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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(ref key, default(ForPrimitives)); Landmine componentInChildren = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]).gameObject.GetComponentInChildren(); 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 b__0() { return !hnsPlayer.IsDisguised; } } [CompilerGenerated] private sealed class d__7 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private <>c__DisplayClass7_0 <>8__1; private PlayerControllerB 5__2; private RaycastHit 5__3; private GrabbableObject 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 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(5__4); } else { <>1__state = -1; if (StartOfRound.Instance.inShipPhase) { goto IL_01a1; } <>8__1 = new <>c__DisplayClass7_0(); 5__2 = GameNetworkManager.Instance.localPlayerController; <>8__1.hnsPlayer = 5__2.AsHNSPlayer(); if (<>8__1.hnsPlayer.Role == PlayerRole.Seeker || !Physics.Raycast(((Component)5__2.gameplayCamera).transform.position, ((Component)5__2.gameplayCamera).transform.forward, ref 5__3, 5f, 1073742656) || ((Component)((RaycastHit)(ref 5__3)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref 5__3)).collider).tag == "PhysicsProp")) { goto IL_0192; } if (((Component)((RaycastHit)(ref 5__3)).collider).gameObject.TryGetComponent(out 5__4) && 5__4.grabbable) { 5__4.grabbable = false; <>2__current = (object)new WaitUntil((Func)(() => !<>8__1.hnsPlayer.IsDisguised)); <>1__state = 1; return true; } } 5__4 = null; goto IL_0192; IL_01a1: return false; IL_0192: <>8__1 = null; 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(); GameObject val = Object.Instantiate((ConfigProcessor.Config.EndGameUIStyle == EndGameUIStyle.Blue) ? ModBase.EndOfGameStatsBlue : ModBase.EndOfGameStatsOrange); val.AddComponent(); 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(); 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(d__7))] private static IEnumerator WaitForUndisguiseCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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, "/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, "/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(); 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().ShowLocalMessage("At least 2 players are required to start.", 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(); 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[] array2 = array; foreach (DoorLock val in array2) { ((Component)val).gameObject.AddComponent(); } 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(this GameObject go, out T component) where T : Component { component = go.GetComponent(); return (Object)(object)component != (Object)null; } public static bool TryGetComponentsInChildren(this GameObject go, out T[] components) where T : Component { components = go.GetComponentsInChildren(); return components.Length != 0; } } public static class PlayerControllerBExtensions { public static HNSPlayerComponent AsHNSPlayer(this PlayerControllerB player) { return ((Component)player).gameObject.GetComponent(); } } } 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 d__19 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public int duration; public CustomUI <>4__this; private float 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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; 5__1 = 1f; ((Graphic)<>4__this.canvasText).canvasRenderer.SetAlpha(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 (5__1 > 0f) { 5__1 -= 0.01f; ((Graphic)<>4__this.canvasText).canvasRenderer.SetAlpha(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 d__14 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Action action; public int duration; public CustomUI <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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)(() => !<>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 d__8 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public CustomUI <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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)(() => (Object)(object)((Component)<>4__this.ownerPlayer).gameObject.GetComponent() != (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(); 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(); canvasObject.SetActive(false); val.renderMode = (RenderMode)0; canvasObject.AddComponent(); CanvasGroup val2 = canvasObject.AddComponent(); val2.blocksRaycasts = false; canvasObject.AddComponent(); canvasTextObject = new GameObject(); ((Object)canvasTextObject).name = "CustomUICanvasText"; Text val3 = (canvasText = canvasTextObject.AddComponent()); Transform transform = canvasTextObject.transform; Rect rect = ((Component)val).GetComponent().rect; float num = ((Rect)(ref rect)).width / 2f - 10f; rect = ((Component)val).GetComponent().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(d__8))] private IEnumerator WaitForHNSComponent() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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(ref num, default(ForPrimitives)); for (int i = 0; i < array.Length; i++) { ((FastBufferWriter)(ref val)).WriteValueSafe(ref array[i], default(ForPrimitives)); } ((FastBufferWriter)(ref val)).WriteValueSafe(ref fadeDuration, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientReceivesBroadcastMsg", val, (NetworkDelivery)2); if (includeServer) { CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent(); 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(ref num, default(ForPrimitives)); for (int i = 0; i < array.Length; i++) { ((FastBufferWriter)(ref val)).WriteValueSafe(ref array[i], default(ForPrimitives)); } ((FastBufferWriter)(ref val)).WriteValueSafe(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(); 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(ref num, default(ForPrimitives)); char c = default(char); for (int i = 0; i < num; i++) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref c, default(ForPrimitives)); text += c; } int duration = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe(ref duration, default(ForPrimitives)); CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent(); 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("{0}\nPress H to {1}\nHold H to lock rotation: {2} \nRound {3}: Hiders left: {4}", localHNSComponent.IsDisguised ? $"Disguised as {localHNSComponent.DisguiseName}:" : "Undisguised.", localHNSComponent.IsDisguised ? "Undisguise, X to taunt" : "Disguise", localHNSComponent.DisguiseUnRotatable ? "LOCKED" : "UNLOCKED", GameManager.RoundCount, GameManager.Instance.HidersCount), overrideUpdate: false); } else { SetText($"Round {GameManager.RoundCount}: Hiders left: {GameManager.Instance.HidersCount}", overrideUpdate: false); } Show(show: true); } else if (localHNSComponent.Role == PlayerRole.Seeker && TimeOfDay.Instance.shipLeavingAlertCalled) { SetText($"Round {GameManager.RoundCount}: Hiders left: {GameManager.Instance.HidersCount}\nShip leaving at: {GameManager.Instance.ShipLeavingTime}", overrideUpdate: false); Show(show: true); } } public void WaitUntilFadeThenDo(Action action, int duration = -1) { ((MonoBehaviour)this).StartCoroutine(WaitForFade(action, duration)); } [IteratorStateMachine(typeof(d__14))] private IEnumerator WaitForFade(Action action, int duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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(d__19))] private IEnumerator FadeTextOutCoroutine(int duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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(); 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 d__32 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerControllerB player; public NetworkObject nObject; public GameObject weapon; public bool delay; private Traverse 5__1; private MethodInfo 5__2; private IEnumerator 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 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)(() => 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"); 5__1 = Traverse.Create((object)player); 5__1.Field("currentlyGrabbingObject").SetValue((object)weapon.GetComponent()); 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) }); 5__2 = typeof(PlayerControllerB).GetMethod("GrabObject", BindingFlags.Instance | BindingFlags.NonPublic); 5__3 = (IEnumerator)5__2.Invoke(player, null); ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(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 d__18 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SeekerWeapon weapon; public GamemodeOption gamemode; public GameManager <>4__this; private GameObject 5__1; private GameObject 5__2; private NetworkObject 5__3; private NetworkObject 5__4; private PlayerControllerB 5__5; private FastBufferWriter 5__6; private FastBufferWriter 5__7; private Traverse 5__8; private MethodInfo 5__9; private IEnumerator 5__10; private Traverse 5__11; private MethodInfo 5__12; private IEnumerator 5__13; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__8 = null; 5__9 = null; 5__10 = null; 5__11 = null; 5__12 = null; 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; 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; if (weapon == SeekerWeapon.Both) { 5__1 = Object.Instantiate(StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName == "Shovel").spawnPrefab, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position, Quaternion.identity); 5__2 = Object.Instantiate(StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName == "Shotgun").spawnPrefab, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position, Quaternion.identity); } else if (weapon == SeekerWeapon.Shovel) { 5__1 = Object.Instantiate(StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName == "Shovel").spawnPrefab, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position, Quaternion.identity); } else { 5__2 = Object.Instantiate(StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName == "Shotgun").spawnPrefab, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position, Quaternion.identity); } if ((Object)(object)5__1 != (Object)null) { 5__3 = 5__1.GetComponent(); 5__3.Spawn(false); 5__6 = new FastBufferWriter(8, (Allocator)2, -1); ref FastBufferWriter reference = ref 5__6; ulong networkObjectId = 5__3.NetworkObjectId; ((FastBufferWriter)(ref reference)).WriteValueSafe(ref networkObjectId, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ShotgunSpawned", 5__6, (NetworkDelivery)2); } if ((Object)(object)5__2 != (Object)null) { 5__4 = 5__2.GetComponent(); 5__4.Spawn(false); 5__7 = new FastBufferWriter(8, (Allocator)2, -1); ref FastBufferWriter reference2 = ref 5__7; ulong networkObjectId = 5__4.NetworkObjectId; ((FastBufferWriter)(ref reference2)).WriteValueSafe(ref networkObjectId, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ShotgunSpawned", 5__7, (NetworkDelivery)2); } 5__5 = GameNetworkManager.Instance.localPlayerController; if (5__5.AsHNSPlayer().Role == PlayerRole.Seeker) { ModBase.mls.LogInfo((object)"Grabbing weapon(s) on server"); if ((Object)(object)5__1 != (Object)null) { 5__8 = Traverse.Create((object)5__5); 5__8.Field("currentlyGrabbingObject").SetValue((object)5__1.GetComponent()); object? value = typeof(PlayerControllerB).GetField("currentlyGrabbingObject", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(5__5); ((GrabbableObject)((value is GrabbableObject) ? value : null)).InteractItem(); typeof(PlayerControllerB).GetMethod("GrabObjectServerRpc", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(5__5, new object[1] { (object)new NetworkObjectReference(5__3) }); 5__9 = typeof(PlayerControllerB).GetMethod("GrabObject", BindingFlags.Instance | BindingFlags.NonPublic); 5__10 = (IEnumerator)5__9.Invoke(5__5, null); ((MonoBehaviour)<>4__this).StartCoroutine(5__10); 5__8 = null; 5__9 = null; 5__10 = null; } <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } break; case 1: <>1__state = -1; if (!((Object)(object)5__2 != (Object)null)) { break; } if (gamemode == GamemodeOption.DelayedWeapon) { <>2__current = (object)new WaitUntil((Func)(() => 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: 5__11 = Traverse.Create((object)5__5); 5__11.Field("currentlyGrabbingObject").SetValue((object)5__2.GetComponent()); value2 = typeof(PlayerControllerB).GetField("currentlyGrabbingObject", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(5__5); ((GrabbableObject)((value2 is GrabbableObject) ? value2 : null)).InteractItem(); typeof(PlayerControllerB).GetMethod("GrabObjectServerRpc", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(5__5, new object[1] { (object)new NetworkObjectReference(5__4) }); 5__12 = typeof(PlayerControllerB).GetMethod("GrabObject", BindingFlags.Instance | BindingFlags.NonPublic); 5__13 = (IEnumerator)5__12.Invoke(5__5, null); ((MonoBehaviour)<>4__this).StartCoroutine(5__13); 5__11 = null; 5__12 = null; 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 hiders = new List(); private GameState gameState = GameState.WaitingForPlayers; private GameResult gameResult = GameResult.None; private bool shipLeavingEarly = false; private bool twoPlayerMode; private string shipLeavingTime = ""; private List activePlayers = new List(); 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 Hiders => hiders.AsReadOnly(); public PlayerControllerB Seeker => seeker; public int Result => (int)gameResult; public ReadOnlyCollection 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().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(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(d__18))] private IEnumerator GrantSeekerWeapons(SeekerWeapon weapon, GamemodeOption gamemode) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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(); 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(); } } NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientRefreshPlayerComps", val, (NetworkDelivery)2); Instance.activePlayers = StartOfRound.Instance.allPlayerScripts.ToList().FindAll((PlayerControllerB x) => ((Component)x).gameObject.TryGetComponent(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(); } if (ConfigProcessor.Config.UIShow) { CustomUI component = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent(); HNSPlayerComponent hNSPlayerComponent = GameNetworkManager.Instance.localPlayerController.AsHNSPlayer(); component.ShowLocalMessage((hNSPlayerComponent.Role == PlayerRole.Seeker) ? "You are a seeker." : "You are a hider.", 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(ref id, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(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(ref num, default(ForPrimitives)); PlayerRole playerRole = default(PlayerRole); ((FastBufferReader)(ref reader)).ReadValue(ref playerRole, default(ForEnums)); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[num]; val.AsHNSPlayer().Role = playerRole; ModBase.mls.LogInfo((object)(val.playerUsername + " " + ((Component)val).gameObject.GetComponent().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(ref seekerSuit, default(ForEnums)); Suit hiderSuit = default(Suit); ((FastBufferReader)(ref reader)).ReadValue(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(ref seekerSuit, default(ForEnums)); ((FastBufferWriter)(ref val)).WriteValueSafe(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().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(); HNSPlayerComponent hNSPlayerComponent = GameNetworkManager.Instance.localPlayerController.AsHNSPlayer(); Object.FindObjectsOfType().ToList().ForEach(delegate(HNSPlayerComponent x) { ModBase.mls.LogWarning((object)(x.Player.playerUsername + " " + x.Role)); }); switch (result) { case GameResult.Draw: component.ShowLocalMessage("The game result was a draw!", 5); break; case GameResult.SeekerWin: if (hNSPlayerComponent.Role == PlayerRole.Seeker) { component.ShowLocalMessage("You won as the seeker!", 5); } else { component.ShowLocalMessage("The seeker won this round!", 5); } break; case GameResult.HiderWin: if (hNSPlayerComponent.Role == PlayerRole.Hider) { component.ShowLocalMessage("You won as one of the hiders!", 5); } else { component.ShowLocalMessage("The hiders won this round!", 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(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[] array2 = array; foreach (ShotgunItem val in array2) { ((NetworkBehaviour)val).NetworkObject.Despawn(true); } Shovel[] array3 = Object.FindObjectsOfType(); 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().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(); 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(); HNSPlayerComponent hNSPlayerComponent = GameNetworkManager.Instance.localPlayerController.AsHNSPlayer(); component.ShowLocalMessage((hNSPlayerComponent.Role == PlayerRole.Seeker) ? "You are a seeker." : "You are a hider.", 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(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().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(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 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 disguiseAudios = new List(); 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(); disguiseTauntAudio = ((Component)player).gameObject.AddComponent(); 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 rotation = ((Component)disguise).transform.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; rotation = ((Component)player).transform.rotation; eulerAngles.y = ((Quaternion)(ref rotation)).eulerAngles.y; ((Component)disguise).transform.rotation = Quaternion.Euler(eulerAngles); } } } public void SetDisguised(GrabbableObject disguise) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0073: Unknown result type (might be due to invalid IL or missing references) if (!IsDisguised) { FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(16, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe(ref player.playerClientId, default(ForPrimitives)); ulong networkObjectId = ((NetworkBehaviour)disguise).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe(ref networkObjectId, default(ForPrimitives)); if (NetworkManager.Singleton.IsServer) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_DisguiseClient", val, (NetworkDelivery)2); SetPlayerDisguised(disguise); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.hnsmod_ServerDisguiseClient", 0uL, val, (NetworkDelivery)2); } } else { disguise.grabbable = true; } } private void SetPlayerDisguised(GrabbableObject disguise) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a5: 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_00b2: 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) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) player.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); this.disguise = disguise; this.disguise.grabbable = false; origRotationOffset = this.disguise.itemProperties.rotationOffset; disguiseAudios = AudiosInGrabbable(disguise); Quaternion rotation = ((Component)disguise).transform.rotation; Quaternion val = Quaternion.FromToRotation(((Component)player).transform.forward, ((Component)disguise).transform.forward); Vector3 val2 = val * ((Component)player).transform.right; Quaternion val3 = Quaternion.FromToRotation(val2, ((Component)disguise).transform.right); Quaternion val4 = val3 * val; rotOffset = val4; this.disguise.parentObject = ((Component)player).transform; SetPlayerMeshes(enable: false); } public void SetUndisguised() { //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_0074: 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) if (IsDisguised) { FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe(ref player.playerClientId, default(ForPrimitives)); if (NetworkManager.Singleton.IsServer) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_UnDisguiseClient", val, (NetworkDelivery)2); SetPlayerUnDisguised(); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.hnsmod_ServerUnDisguiseClient", 0uL, val, (NetworkDelivery)2); } } } private void SetPlayerUnDisguised() { //IL_0012: 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) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_006b: Unknown result type (might be due to invalid IL or missing references) disguise.startFallingPosition = ((Component)disguise).transform.localPosition; disguise.FallToGround(false, false, ((Component)disguise).transform.localPosition + Vector3.up * 0.5f); disguise.parentObject = null; disguise.itemProperties.rotationOffset = origRotationOffset; SetRotationLock(enable: false); disguise.grabbable = true; disguiseAudios.Clear(); disguise = null; SetPlayerMeshes(enable: true); } public void ToggleDisguiseRotation() { SetDisguiseRotationLock(!disguiseLocked); } private void SetDisguiseRotationLock(bool enable) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0059: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(9, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe(ref player.playerClientId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref enable, default(ForPrimitives)); if (NetworkManager.Singleton.IsServer) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientLockDisguiseRot", val, (NetworkDelivery)2); SetRotationLock(enable); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.hnsmod_ServerLockDisguiseRot", 0uL, val, (NetworkDelivery)2); } } private void SetRotationLock(bool enable) { if (IsDisguised) { disguiseLocked = enable; } } public static void DisguiseClient(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)).ReadValueSafe(ref num, default(ForPrimitives)); ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe(ref key, default(ForPrimitives)); GrabbableObject component = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]).gameObject.GetComponent(); StartOfRound.Instance.allPlayerScripts[num].AsHNSPlayer().SetPlayerDisguised(component); } public void SetPlayerMeshes(bool enable) { ((Renderer)player.thisPlayerModel).enabled = enable; if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player) { ((Renderer)player.thisPlayerModelArms).enabled = enable; } else { ((Behaviour)player.usernameBillboardText).enabled = enable; } ((Renderer)player.thisPlayerModelLOD1).enabled = enable; ((Renderer)player.thisPlayerModelLOD2).enabled = enable; ((Renderer)player.playerBetaBadgeMesh).enabled = enable; ((Renderer)((Component)player.playerBadgeMesh).gameObject.GetComponent()).enabled = enable; if (ModBase.MoreCompanyPresent) { SetMCMeshes(enable); } } private void SetMCMeshes(bool enable) { CosmeticApplication val = default(CosmeticApplication); if (!((Component)((Component)player).transform.Find("ScavengerModel").Find("metarig")).gameObject.TryGetComponent(ref val)) { return; } foreach (CosmeticInstance spawnedCosmetic in val.spawnedCosmetics) { MeshRenderer[] componentsInChildren = ((Component)spawnedCosmetic).gameObject.GetComponentsInChildren(); foreach (MeshRenderer val2 in componentsInChildren) { ((Renderer)val2).enabled = enable; } } } private List AudiosInGrabbable(GrabbableObject grabbableObject) { List list = new List(); list.Add(grabbableObject.itemProperties.dropSFX); list.Add(grabbableObject.itemProperties.grabSFX); list.Add(grabbableObject.itemProperties.pocketSFX); list.Add(grabbableObject.itemProperties.throwSFX); Type type = ((object)grabbableObject).GetType(); FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(AudioClip[])) { AudioClip[] array = fieldInfo.GetValue(grabbableObject) as AudioClip[]; foreach (AudioClip item in array) { list.Add(item); } } else if (fieldInfo.FieldType == typeof(AudioClip)) { object? value = fieldInfo.GetValue(grabbableObject); AudioClip val = (AudioClip)((value is AudioClip) ? value : null); if ((Object)(object)val != (Object)null) { list.Add(val); } } } ModBase.mls.LogInfo((object)$"Got {list.Count} audio clips associated with {grabbableObject.itemProperties.itemName}."); return list; } public void PlayRandomTaunt() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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) if (DisguiseHasAudio && !disguiseTauntAudio.isPlaying) { int idx = new Random().Next(0, disguiseAudios.Count); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe(ref player.playerClientId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref idx, default(ForPrimitives)); if (NetworkManager.Singleton.IsServer) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientPlayTaunt", val, (NetworkDelivery)2); PlayTaunt(idx); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.hnsmod_ServerPlayTaunt", 0uL, val, (NetworkDelivery)2); } } } private void PlayTaunt(int idx) { ArgumentOutOfRangeException ex2 = default(ArgumentOutOfRangeException); try { disguiseTauntAudio.PlayOneShot(disguiseAudios.ElementAt(idx)); } catch (Exception ex) when (((Func)delegate { // Could not convert BlockContainer to single expression ex2 = ex as ArgumentOutOfRangeException; return ex2 != null; }).Invoke()) { ModBase.mls.LogError((object)$"The server and client's audio list count doesn't match! Playing random audio. {ex2.Message}"); disguiseTauntAudio.PlayOneShot(disguiseAudios.ElementAt(new Random().Next(0, disguiseAudios.Count))); } } public static void ServerDisguiseClient(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)).ReadValueSafe(ref num, default(ForPrimitives)); ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe(ref key, default(ForPrimitives)); StartOfRound.Instance.allPlayerScripts[num].AsHNSPlayer().SetDisguised(((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]).gameObject.GetComponent()); } public static void UnDisguiseClient(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 num = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num, default(ForPrimitives)); StartOfRound.Instance.allPlayerScripts[num].AsHNSPlayer().SetPlayerUnDisguised(); } public static void ServerUnDisguiseClient(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 num = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num, default(ForPrimitives)); StartOfRound.Instance.allPlayerScripts[num].AsHNSPlayer().SetUndisguised(); } public static void ClientLockDisguiseRotation(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)).ReadValueSafe(ref num, default(ForPrimitives)); bool rotationLock = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotationLock, default(ForPrimitives)); StartOfRound.Instance.allPlayerScripts[num].AsHNSPlayer().SetRotationLock(rotationLock); } public static void ServerLockDisguiseRotation(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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0080: Unknown result type (might be due to invalid IL or missing references) ulong num = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num, default(ForPrimitives)); bool rotationLock = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotationLock, default(ForPrimitives)); StartOfRound.Instance.allPlayerScripts[num].AsHNSPlayer().SetRotationLock(rotationLock); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(9, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref rotationLock, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientLockDisguiseRot", val, (NetworkDelivery)2); } public static void ClientPlayTaunt(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)).ReadValueSafe(ref num, default(ForPrimitives)); int idx = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe(ref idx, default(ForPrimitives)); StartOfRound.Instance.allPlayerScripts[num].AsHNSPlayer().PlayTaunt(idx); } public static void ServerPlayTaunt(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) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) ulong num = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num, default(ForPrimitives)); int idx = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe(ref idx, default(ForPrimitives)); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref idx, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientPlayTaunt", val, (NetworkDelivery)2); StartOfRound.Instance.allPlayerScripts[num].AsHNSPlayer().PlayTaunt(idx); } } public static class HNSValues { public static List TPMines = new List(); public static bool FirstWeaponReceived = false; } internal static class Utils { public static string CalcTime(float timeNormalized, float numberOfHours) { int num = (int)(timeNormalized * (60f * numberOfHours)) + 360; int num2 = (int)Mathf.Floor((float)(num / 60)); if (num2 >= 24) { return "12:00 AM"; } string text = ((num2 >= 12) ? "PM" : "AM"); if (num2 > 12) { num2 %= 12; } int num3 = num % 60; return $"{num2:00}:{num3:00}".TrimStart(new char[1] { '0' }) + text; } public static int CalcHour(float timeNormalized, float numberOfHours) { int num = (int)(timeNormalized * (60f * numberOfHours)) + 360; return (int)Mathf.Floor((float)(num / 60)); } public static T Retrieve(this List list) where T : StatBase { return (T)list.FirstOrDefault((StatBase x) => x is T); } public static T RetrieveFor(this List list, PlayerControllerB player) where T : StatBase { return (T)list.FirstOrDefault((StatBase x) => x is T && (Object)(object)x.Player == (Object)(object)player); } public static List RetrieveAll(this List list) where T : StatBase { return list.FindAll((StatBase x) => x is T); } public static bool WasWinnerThisRound(this PlayerControllerB player) { return ((Component)player).gameObject.GetComponent().Role == (PlayerRole)GameManager.Instance.Result; } } } namespace LCHideAndSeekMod.Core.PlayerStats { internal sealed class ClosestToSeekerStat : StatBase, INetworkSerializable { public string comment = "Got closest to the seeker."; public int tier = 1; public bool deleteOnDeath = false; private float distance; private int typeID = 1; public float Distance => distance; public ClosestToSeekerStat(PlayerControllerB player, float distance) : base(player) { this.distance = distance; } public override string GetComment() { return comment; } public override int GetTier() { return tier; } public override bool GetDeleteOnDeath() { return deleteOnDeath; } public override int NetworkSize() { return 4 + base.NetworkSize() + 4; } public override bool IsBetterThan(StatBase other) { return !(other is ClosestToSeekerStat) || distance <= ((ClosestToSeekerStat)other).distance; } public unsafe override void NetworkSerialize(BufferSerializer serializer) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer*)(&serializer))->SerializeValue(ref typeID, default(ForPrimitives)); base.NetworkSerialize(serializer); ((BufferSerializer*)(&serializer))->SerializeValue(ref distance, default(ForPrimitives)); } } internal class LongestHiderStat : StatBase, INetworkSerializable { public string comment = "Hid for the longest time."; public int tier = 2; public bool deleteOnDeath = false; private int seconds; private int typeID = 2; public int Seconds => seconds; public LongestHiderStat(PlayerControllerB player, int seconds) : base(player) { this.seconds = seconds; } public override string GetComment() { return comment; } public override int GetTier() { return tier; } public override bool GetDeleteOnDeath() { return deleteOnDeath; } public override int NetworkSize() { return base.NetworkSize() + 8; } public override bool IsBetterThan(StatBase other) { return !(other is LongestHiderStat) || seconds >= ((LongestHiderStat)other).seconds; } public unsafe override void NetworkSerialize(BufferSerializer serializer) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer*)(&serializer))->SerializeValue(ref typeID, default(ForPrimitives)); base.NetworkSerialize(serializer); ((BufferSerializer*)(&serializer))->SerializeValue(ref seconds, default(ForPrimitives)); } } internal class MiscStat : StatBase, INetworkSerializable { public string comment; public int tier = 0; public bool deleteOnDeath = false; private int typeID = 5; private static string[] DeadComments = new string[5] { "Ventured too far and got caught in the wild.", "Gave it their all, but the seeker was relentless.", "Played with heart, but luck wasn't on their side.", "Gave it their best shot, but the seeker prevailed.", "Embraced the challenge, even if it ended in capture." }; private static string[] AliveComments = new string[5] { "Your hiding spots were pure genius.", "You watched the game unfold from the perfect vantage point.", "Your presence was felt, but never seen.", "You blended in so well, even the walls were jealous.", "You moved like a shadow in the night." }; private static List availableDeadComments = new List(); private static List availableAliveComments = new List(); public MiscStat(PlayerControllerB player) : base(player) { if (player.isPlayerDead) { int index = Random.Range(0, availableDeadComments.Count); comment = DeadComments[availableDeadComments[index]]; availableDeadComments.Remove(availableDeadComments[index]); } else { int num = Random.Range(0, availableAliveComments.Count); comment = AliveComments[availableAliveComments[num]]; availableAliveComments.Remove(num); } } public static void Reset() { availableAliveComments.Clear(); availableDeadComments.Clear(); for (int i = 0; i < AliveComments.Length; i++) { availableAliveComments.Add(i); } for (int j = 0; j < DeadComments.Length; j++) { availableDeadComments.Add(j); } } public MiscStat(PlayerControllerB player, string comment) : base(player) { this.comment = comment; } public override int GetTier() { return tier; } public override string GetComment() { return comment; } public override bool GetDeleteOnDeath() { return deleteOnDeath; } public override int NetworkSize() { return base.NetworkSize() + 8 + comment.Length * 2; } public override bool IsBetterThan(StatBase other) { throw new NotImplementedException(); } public unsafe override void NetworkSerialize(BufferSerializer serializer) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer*)(&serializer))->SerializeValue(ref typeID, default(ForPrimitives)); base.NetworkSerialize(serializer); int length = comment.Length; ((BufferSerializer*)(&serializer))->SerializeValue(ref length, default(ForPrimitives)); string text = comment; foreach (char c in text) { char c2 = c; ((BufferSerializer*)(&serializer))->SerializeValue(ref c2, default(ForPrimitives)); } } } internal class MostVCTimeStat : StatBase, INetworkSerializable { public string comment = "Talked the most in voice chat."; public int tier = 2; public bool deleteOnDeath = false; public int seconds; private int typeID = 3; public MostVCTimeStat(PlayerControllerB player, int seconds) : base(player) { this.seconds = seconds; } public override string GetComment() { return comment; } public override int GetTier() { return tier; } public override bool GetDeleteOnDeath() { return deleteOnDeath; } public override int NetworkSize() { return base.NetworkSize() + 8; } public override bool IsBetterThan(StatBase other) { return !(other is MostVCTimeStat) || seconds >= ((MostVCTimeStat)other).seconds; } public unsafe override void NetworkSerialize(BufferSerializer serializer) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer*)(&serializer))->SerializeValue(ref typeID, default(ForPrimitives)); base.NetworkSerialize(serializer); ((BufferSerializer*)(&serializer))->SerializeValue(ref seconds, default(ForPrimitives)); } } internal class PlayerStatManager : MonoBehaviour { public delegate void StatsUpdatedDelegate(); [CompilerGenerated] private sealed class <>c__DisplayClass31_0 { public PlayerControllerB player; internal bool b__1(RoundsWonStat x) { return (Object)(object)x.Player == (Object)(object)player; } } [CompilerGenerated] private sealed class d__31 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerStatManager <>4__this; private IEnumerator <>s__1; private <>c__DisplayClass31_0 <>8__2; private RoundsWonStat 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = null; <>8__2 = null; 5__3 = null; <>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)(() => !<>4__this.manager.GameRunning)); <>1__state = 1; return true; case 1: <>1__state = -1; <>s__1 = <>4__this.manager.Players.GetEnumerator(); try { while (<>s__1.MoveNext()) { <>8__2 = new <>c__DisplayClass31_0(); <>8__2.player = <>s__1.Current; if (<>8__2.player.WasWinnerThisRound()) { 5__3 = roundsWonStats.Find((RoundsWonStat x) => (Object)(object)x.Player == (Object)(object)<>8__2.player); if (5__3 == null) { roundsWonStats.Add(new RoundsWonStat(<>8__2.player, 1)); } else { roundsWonStats.Remove(5__3); roundsWonStats.Add(new RoundsWonStat(<>8__2.player, 5__3.Count + 1)); } 5__3 = null; } <>8__2 = null; } } finally { if (<>s__1 != null) { <>s__1.Dispose(); } } <>s__1 = null; <>4__this.playerStats = <>4__this.playerStats.Union(roundsWonStats).ToList(); <>4__this.roundWonCoroutine = null; 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 d__16 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerStatManager <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; <>4__this.matchSeconds++; break; } if (<>4__this.manager.GameRunning) { <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__35 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerStatManager <>4__this; private Dictionary 5__1; private IEnumerator <>s__2; private PlayerControllerB 5__3; private Dictionary.Enumerator <>s__4; private KeyValuePair 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__35(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>s__2 = null; 5__3 = null; <>s__4 = default(Dictionary.Enumerator); 5__5 = default(KeyValuePair); <>1__state = -2; } private bool MoveNext() { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = new Dictionary(); break; case 1: <>1__state = -1; break; } if (<>4__this.manager.GameRunning) { <>s__2 = <>4__this.manager.Hiders.GetEnumerator(); try { while (<>s__2.MoveNext()) { 5__3 = <>s__2.Current; if (5__1.ContainsKey(5__3)) { 5__1[5__3]++; } else { 5__1.Add(5__3, 1); } 5__3 = null; } } finally { if (<>s__2 != null) { <>s__2.Dispose(); } } <>s__2 = null; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } <>s__4 = 5__1.GetEnumerator(); try { while (<>s__4.MoveNext()) { 5__5 = <>s__4.Current; <>4__this.playerStats.Add(new LongestHiderStat(5__5.Key, 5__5.Value)); 5__5 = default(KeyValuePair); } } finally { ((IDisposable)<>s__4).Dispose(); } <>s__4 = default(Dictionary.Enumerator); <>4__this.lastHiderCoroutine = null; 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 d__30 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerStatManager <>4__this; private Dictionary 5__1; private IEnumerator <>s__2; private PlayerControllerB 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>s__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = new Dictionary(); break; case 1: <>1__state = -1; break; } if (<>4__this.manager.GameRunning) { <>s__2 = <>4__this.manager.Players.GetEnumerator(); try { while (<>s__2.MoveNext()) { 5__3 = <>s__2.Current; if ((Object)(object)5__3 == (Object)(object)GameNetworkManager.Instance.localPlayerController && 5__3.currentVoiceChatAudioSource.isPlaying) { if (5__1.ContainsKey(5__3)) { 5__1[5__3]++; } else { 5__1.Add(5__3, 1); } } else if (5__3.voicePlayerState.IsSpeaking) { if (5__1.ContainsKey(5__3)) { 5__1[5__3]++; } else { 5__1.Add(5__3, 1); } } 5__3 = null; } } finally { if (<>s__2 != null) { <>s__2.Dispose(); } } <>s__2 = null; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } <>4__this.vcCoroutine = null; 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 d__37 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerStatManager <>4__this; private int 5__1; private int 5__2; private int 5__3; private int 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__37(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_00af; } <>1__state = -1; 5__1 = 0; goto IL_00ea; IL_00af: if (5__3 < 10) { 5__2 = 5__4 - <>4__this.manager.Hiders.Count; 5__3++; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } if (5__2 > 1 && 5__2 > 5__1) { 5__1 = 5__2; } goto IL_00ea; IL_00ea: if (<>4__this.manager.GameRunning) { 5__2 = 0; 5__3 = 0; 5__4 = <>4__this.manager.Hiders.Count; goto IL_00af; } if (5__1 > 0) { <>4__this.playerStats.Add(new SeekerKillInIntervalStat(<>4__this.manager.Seeker, 5__1)); } <>4__this.seekerKillCoroutine = null; 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 d__26 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerStatManager <>4__this; private FastBufferWriter 5__1; private List.Enumerator <>s__2; private StatBase 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__2 = default(List.Enumerator); 5__3 = null; <>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 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func)(() => !<>4__this.IsBusy)); <>1__state = 1; return true; case 1: { <>1__state = -1; 5__1 = new FastBufferWriter(4 + <>4__this.playerStats.Sum((StatBase x) => x.NetworkSize()), (Allocator)2, -1); ref FastBufferWriter reference = ref 5__1; int count = <>4__this.playerStats.Count; ((FastBufferWriter)(ref reference)).WriteValueSafe(ref count, default(ForPrimitives)); <>s__2 = <>4__this.playerStats.GetEnumerator(); try { while (<>s__2.MoveNext()) { 5__3 = <>s__2.Current; ModBase.mls.LogInfo((object)$"SERIALIZING STAT! {5__3.Player.playerUsername} {5__3.GetType().Name} {5__3.GetComment()}"); ((FastBufferWriter)(ref 5__1)).WriteValueSafe(ref 5__3, default(ForNetworkSerializable)); 5__3 = null; } } finally { ((IDisposable)<>s__2).Dispose(); } <>s__2 = default(List.Enumerator); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientReceivePlayerStats", 5__1, (NetworkDelivery)2); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__17 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerStatManager <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func)(() => Utils.CalcHour(TimeOfDay.Instance.normalizedTimeOfDay, TimeOfDay.Instance.numberOfHours) >= 10)); <>1__state = 1; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } if (<>4__this.manager.GameRunning) { <>4__this.DetermineClosestToSeeker(); <>4__this.DetermineLongestHider(); <>4__this.DetermineWhoWonRound(); <>4__this.DetermineSeekerKills(); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__18 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerStatManager <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__18(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 WaitWhile((Func)(() => <>4__this.IsBusy)); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.ProcessStats(); 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(); } } public static PlayerStatManager Instance; private GameManager manager; private List playerStats = new List(); private Coroutine lastHiderCoroutine; private Coroutine roundWonCoroutine; private Coroutine vcCoroutine; private Coroutine seekerKillCoroutine; private static List roundsWonStats = new List(); private int matchSeconds = 0; public ReadOnlyCollection Stats { get { return playerStats.AsReadOnly(); } set { if (!NetworkManager.Singleton.IsServer) { playerStats = value.ToList(); } } } public bool IsBusy => lastHiderCoroutine != null || roundWonCoroutine != null || vcCoroutine != null || seekerKillCoroutine != null; public string MatchTime { get { int num = matchSeconds / 60; int num2 = matchSeconds % 60; return ((num < 10) ? ("0" + num) : num.ToString()) + ((num2 < 10) ? (":0" + num2) : (":" + num2)); } } public event StatsUpdatedDelegate StatProcessingDone; public void Awake() { Instance = this; manager = GameManager.Instance; } public void Start() { playerStats = playerStats.Union(roundsWonStats).ToList(); ((MonoBehaviour)this).StartCoroutine(TryDeterminePlayerStats()); ((MonoBehaviour)this).StartCoroutine(CountMatchTime()); manager.GameEnded += delegate { ((MonoBehaviour)this).StartCoroutine(WaitUntilThisIsWorking()); }; } private void LogInfo(string msg) { ModBase.mls.LogInfo((object)$"[PLAYER STAT MANAGER]: {msg}"); } [IteratorStateMachine(typeof(d__16))] private IEnumerator CountMatchTime() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__17))] private IEnumerator TryDeterminePlayerStats() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__18))] private IEnumerator WaitUntilThisIsWorking() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__18(0) { <>4__this = this }; } private void ProcessStats() { LogInfo($"-----BEGIN PROCESSING STAT LIST ({playerStats.Count})-----"); RemoveOnDeathStats(); RemoveDuplicates(); KeepBestForAll(); AddMiscStatsAtEndOfGame(); SelectTopFive(); this.StatProcessingDone?.Invoke(); ((MonoBehaviour)this).StartCoroutine(NetworkTransferStats()); LogInfo($"-----END ({playerStats.Count})-----"); } private void SelectTopFive() { playerStats = playerStats.OrderByDescending((StatBase x) => x.GetTier()).Take(5).ToList(); } private void KeepBestForAll() { foreach (PlayerControllerB player in manager.Players) { StatBase best = (from x in playerStats.FindAll((StatBase x) => (Object)(object)x.Player == (Object)(object)player) orderby x.GetTier() descending select x).FirstOrDefault(); LogInfo(string.Format("BEST FOR: {0}, {1}", player.playerUsername, (best == null) ? "NULL" : best.GetComment())); playerStats.RemoveAll((StatBase x) => (Object)(object)x.Player == (Object)(object)player && x != best); } } private void KeepBest() where T : StatBase { List list = playerStats.RetrieveAll(); StatBase statBase = list.FirstOrDefault(); if (list.Count == 1) { return; } foreach (T item in list) { if (item != statBase) { if (item.IsBetterThan(statBase)) { playerStats.Remove(statBase); statBase = item; } else { playerStats.Remove(item); } } } } private void RemoveDuplicates() { KeepBest(); KeepBest(); KeepBest(); KeepBest(); } private void RemoveOnDeathStats() { playerStats.RemoveAll((StatBase x) => x.GetDeleteOnDeath()); playerStats.RemoveAll((StatBase x) => x.Player.disconnectedMidGame); } private void AddMiscStatsAtEndOfGame() { foreach (PlayerControllerB player in manager.Players) { if (!playerStats.Any((StatBase x) => (Object)(object)x.Player == (Object)(object)player)) { playerStats.Add(new MiscStat(player)); } } } [IteratorStateMachine(typeof(d__26))] private IEnumerator NetworkTransferStats() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__26(0) { <>4__this = this }; } public static void ClientSetPlayerStats(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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num, default(ForPrimitives)); List list = new List(); int num2 = default(int); ulong num3 = default(ulong); float distance = default(float); int seconds = default(int); int seconds2 = default(int); int count = default(int); int num4 = default(int); char c = default(char); int kills = default(int); for (int i = 0; i < num; i++) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref num2, default(ForPrimitives)); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num3, default(ForPrimitives)); switch (num2) { case 1: ((FastBufferReader)(ref reader)).ReadValueSafe(ref distance, default(ForPrimitives)); list.Add(new ClosestToSeekerStat(StartOfRound.Instance.allPlayerScripts[(uint)num3], distance)); break; case 2: ((FastBufferReader)(ref reader)).ReadValueSafe(ref seconds, default(ForPrimitives)); list.Add(new LongestHiderStat(StartOfRound.Instance.allPlayerScripts[(uint)num3], seconds)); break; case 3: ((FastBufferReader)(ref reader)).ReadValueSafe(ref seconds2, default(ForPrimitives)); list.Add(new MostVCTimeStat(StartOfRound.Instance.allPlayerScripts[(uint)num3], seconds2)); break; case 4: ((FastBufferReader)(ref reader)).ReadValueSafe(ref count, default(ForPrimitives)); list.Add(new RoundsWonStat(StartOfRound.Instance.allPlayerScripts[(uint)num3], count)); break; case 5: { string text = ""; ((FastBufferReader)(ref reader)).ReadValueSafe(ref num4, default(ForPrimitives)); for (int j = 0; j < num4; j++) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref c, default(ForPrimitives)); text += c; } list.Add(new MiscStat(StartOfRound.Instance.allPlayerScripts[(uint)num3], text)); break; } case 6: ((FastBufferReader)(ref reader)).ReadValueSafe(ref kills, default(ForPrimitives)); list.Add(new SeekerKillInIntervalStat(StartOfRound.Instance.allPlayerScripts[(uint)num3], kills)); break; } if ((Object)(object)Instance == (Object)null) { Instance = new PlayerStatManager(); } Instance.Stats = list.AsReadOnly(); } } private void DetermineWhoVoiceChattedMost() { if (vcCoroutine == null) { vcCoroutine = ((MonoBehaviour)this).StartCoroutine(CountPlayerVCHeld()); } } private void DetermineWhoWonRound() { if (roundWonCoroutine == null) { roundWonCoroutine = ((MonoBehaviour)this).StartCoroutine(AddToCounterAfterRoundEnd()); } } [IteratorStateMachine(typeof(d__30))] private IEnumerator CountPlayerVCHeld() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__30(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__31))] private IEnumerator AddToCounterAfterRoundEnd() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__31(0) { <>4__this = this }; } private Tuple FindClosestHider(PlayerControllerB seeker, ReadOnlyCollection hiders) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB item = null; float num = float.MaxValue; foreach (PlayerControllerB hider in hiders) { float num2 = Vector3.Distance(((Component)seeker).transform.position, ((Component)hider).transform.position); if (num2 < num) { num = num2; item = hider; } } return new Tuple(item, num); } private void DetermineClosestToSeeker() { Tuple tuple = FindClosestHider(manager.Seeker, manager.Hiders); PlayerControllerB item = tuple.Item1; float item2 = tuple.Item2; if (item2 < 20f) { ClosestToSeekerStat closestToSeekerStat = playerStats.RetrieveFor(item); if (closestToSeekerStat == null) { playerStats.Add(new ClosestToSeekerStat(item, item2)); } else if ((Object)(object)closestToSeekerStat.Player == (Object)(object)item && item2 < closestToSeekerStat.Distance) { playerStats.Remove(closestToSeekerStat); playerStats.Add(new ClosestToSeekerStat(item, item2)); } } } private void DetermineLongestHider() { if (lastHiderCoroutine == null) { lastHiderCoroutine = ((MonoBehaviour)this).StartCoroutine(CountPlayerHideSeconds()); } } [IteratorStateMachine(typeof(d__35))] private IEnumerator CountPlayerHideSeconds() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__35(0) { <>4__this = this }; } private void DetermineSeekerKills() { if (seekerKillCoroutine == null) { seekerKillCoroutine = ((MonoBehaviour)this).StartCoroutine(CountSeekerKills()); } } [IteratorStateMachine(typeof(d__37))] private IEnumerator CountSeekerKills() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__37(0) { <>4__this = this }; } public static void Reset() { roundsWonStats.Clear(); } } internal class RoundsWonStat : StatBase, INetworkSerializable { private string comment; public int tier = 1; public bool deleteOnDeath = false; private int count; private int typeID = 4; public string Comment => comment; public int Count => count; public RoundsWonStat(PlayerControllerB player, int count) : base(player) { this.count = count; comment = $"Won {this.count} rounds in a row."; } public override string GetComment() { return comment; } public override int GetTier() { return tier; } public override bool GetDeleteOnDeath() { return deleteOnDeath; } public override int NetworkSize() { return base.NetworkSize() + 8; } public override bool IsBetterThan(StatBase other) { return !(other is RoundsWonStat) || count <= ((RoundsWonStat)other).count; } public unsafe override void NetworkSerialize(BufferSerializer serializer) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer*)(&serializer))->SerializeValue(ref typeID, default(ForPrimitives)); base.NetworkSerialize(serializer); ((BufferSerializer*)(&serializer))->SerializeValue(ref count, default(ForPrimitives)); } } internal class SeekerKillInIntervalStat : StatBase, INetworkSerializable { public string comment; public int tier = 3; public int kills; public bool deleteOnDeath = true; private int typeID = 6; public SeekerKillInIntervalStat(PlayerControllerB player, int kills) : base(player) { this.kills = kills; comment = $"Killed {this.kills} enemies in 10 seconds."; } public override string GetComment() { return comment; } public override int GetTier() { return tier; } public override bool GetDeleteOnDeath() { return deleteOnDeath; } public override bool IsBetterThan(StatBase other) { return !(other is SeekerKillInIntervalStat) || kills >= ((SeekerKillInIntervalStat)other).kills; } public override int NetworkSize() { return base.NetworkSize() + 8; } public unsafe override void NetworkSerialize(BufferSerializer serializer) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer*)(&serializer))->SerializeValue(ref typeID, default(ForPrimitives)); base.NetworkSerialize(serializer); ((BufferSerializer*)(&serializer))->SerializeValue(ref kills, default(ForPrimitives)); } } internal abstract class StatBase : INetworkSerializable { private PlayerControllerB player; private readonly int typeID = 0; public PlayerControllerB Player => player; public StatBase(PlayerControllerB player) { this.player = player; } public abstract string GetComment(); public abstract int GetTier(); public abstract bool GetDeleteOnDeath(); public abstract bool IsBetterThan(StatBase other); public virtual int NetworkSize() { return 8; } public unsafe virtual void NetworkSerialize(BufferSerializer serializer) where T : IReaderWriter { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer*)(&serializer))->SerializeValue(ref player.playerClientId, default(ForPrimitives)); } } } namespace LCHideAndSeekMod.Core.Configuration { internal class ClientConfiguration { private bool uiShow; private bool displayWarning; private bool alwaysShowClock; private bool quickRefreshClock; private EndGameUIStyle uiStyle; public bool UIShow { get { return uiShow; } set { uiShow = value; } } public bool DisplayWarning { get { return displayWarning; } set { displayWarning = value; } } public bool AlwaysShowClock { get { return alwaysShowClock; } set { alwaysShowClock = value; } } public bool QuickRefreshClock { get { return quickRefreshClock; } set { quickRefreshClock = value; } } public EndGameUIStyle EndGameUIStyle { get { return uiStyle; } set { uiStyle = value; } } public ClientConfiguration(bool uiShow = true, bool displayWarning = true, bool alwaysShowClock = true, bool quickRefreshClock = true, EndGameUIStyle uiStyle = EndGameUIStyle.Blue) { this.uiShow = uiShow; this.displayWarning = displayWarning; this.alwaysShowClock = alwaysShowClock; this.quickRefreshClock = quickRefreshClock; this.uiStyle = uiStyle; } } public class ServerConfiguration : INetworkSerializable { private static readonly Func CanChangeSetting = () => (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer); private bool startShipEarly; private bool canSeekerDie; private bool letSeekerSwitchCam; private bool useCustomSuits; private bool spawnTPMines; private bool chanceBasedSeeker; private bool canKeysLockDoors; private bool statsEnabled; private bool disguiseEnabled; private bool teleportToEntrance; private int doorHitsRequired; private SeekerWeapon seekerWeapon; private GamemodeOption gamemodeOption; private Suit seekerSuit; private Suit hiderSuit; private MineSpawnAmount mineAmount; private ScrapSpawnAmount scrapAmount; public int NetworkSize => 38; public bool StartShipEarly { get { return startShipEarly; } set { if (CanChangeSetting()) { startShipEarly = value; } } } public bool CanSeekerDie { get { return canSeekerDie; } set { if (CanChangeSetting()) { canSeekerDie = value; } } } public bool LetSeekerSwitchCam { get { return letSeekerSwitchCam; } set { if (CanChangeSetting()) { letSeekerSwitchCam = value; } } } public bool UseCustomSuits { get { return useCustomSuits; } set { if (CanChangeSetting()) { useCustomSuits = value; } } } public Suit SeekerSuit { get { return seekerSuit; } set { if (CanChangeSetting()) { seekerSuit = value; } } } public Suit HiderSuit { get { return hiderSuit; } set { if (CanChangeSetting()) { hiderSuit = value; } } } public bool SpawnTPMines { get { return spawnTPMines; } set { if (CanChangeSetting()) { spawnTPMines = value; } } } public bool ChanceBasedSeeker { get { return chanceBasedSeeker; } set { if (CanChangeSetting()) { chanceBasedSeeker = value; } } } public int DoorHits { get { return doorHitsRequired; } set { if (CanChangeSetting()) { doorHitsRequired = value; } } } public bool DoorLockEnabled { get { return canKeysLockDoors; } set { if (CanChangeSetting()) { canKeysLockDoors = value; } } } public SeekerWeapon SeekerWeapon { get { return seekerWeapon; } set { if (CanChangeSetting()) { seekerWeapon = value; } } } public GamemodeOption GamemodeOption { get { return gamemodeOption; } set { if (CanChangeSetting()) { gamemodeOption = value; } } } public bool StatsEnabled { get { return statsEnabled; } set { if (CanChangeSetting()) { statsEnabled = value; } } } public bool DisguiseEnabled { get { return disguiseEnabled; } set { if (CanChangeSetting()) { disguiseEnabled = value; } } } public bool TPToEntranceEnabled { get { return teleportToEntrance; } set { if (CanChangeSetting()) { teleportToEntrance = value; } } } public MineSpawnAmount MineAmount { get { return mineAmount; } set { if (CanChangeSetting()) { mineAmount = value; } } } public ScrapSpawnAmount ScrapAmount { get { return scrapAmount; } set { if (CanChangeSetting()) { scrapAmount = value; } } } public ServerConfiguration() { } public ServerConfiguration(bool startShipEarly = true, bool canSeekerDie = true, bool letSeekerSwitchCams = false, bool useCustomSuits = true, bool spawnTPMines = true, bool chanceBasedSeeker = true, bool canKeysLockDoors = true, int doorHitsRequired = 3, SeekerWeapon seekerWeapon = SeekerWeapon.Shotgun, GamemodeOption gamemodeOption = GamemodeOption.InstantWeapon, Suit seekerSuit = Suit.Purple, Suit hiderSuit = Suit.Orange, bool statsEnabled = false, bool disguiseEnabled = true, bool teleportToEntrance = true, MineSpawnAmount mineAmount = MineSpawnAmount.SlightlyMore, ScrapSpawnAmount scrapAmount = ScrapSpawnAmount.SlightlyMore) { this.startShipEarly = startShipEarly; this.canSeekerDie = canSeekerDie; letSeekerSwitchCam = letSeekerSwitchCams; this.useCustomSuits = useCustomSuits; this.spawnTPMines = spawnTPMines; this.chanceBasedSeeker = chanceBasedSeeker; this.canKeysLockDoors = canKeysLockDoors; this.doorHitsRequired = doorHitsRequired; this.seekerWeapon = seekerWeapon; this.gamemodeOption = gamemodeOption; this.seekerSuit = seekerSuit; this.hiderSuit = hiderSuit; this.statsEnabled = statsEnabled; this.disguiseEnabled = disguiseEnabled; this.teleportToEntrance = teleportToEntrance; this.mineAmount = mineAmount; this.scrapAmount = scrapAmount; } public unsafe void NetworkSerialize(BufferSerializer serializer) where T : IReaderWriter { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0095: 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_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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer*)(&serializer))->SerializeValue(ref startShipEarly, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref canSeekerDie, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref letSeekerSwitchCam, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref useCustomSuits, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref spawnTPMines, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref chanceBasedSeeker, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref canKeysLockDoors, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref doorHitsRequired, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref seekerWeapon, default(ForEnums)); ((BufferSerializer*)(&serializer))->SerializeValue(ref gamemodeOption, default(ForEnums)); ((BufferSerializer*)(&serializer))->SerializeValue(ref seekerSuit, default(ForEnums)); ((BufferSerializer*)(&serializer))->SerializeValue(ref hiderSuit, default(ForEnums)); ((BufferSerializer*)(&serializer))->SerializeValue(ref statsEnabled, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref disguiseEnabled, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref teleportToEntrance, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref mineAmount, default(ForEnums)); ((BufferSerializer*)(&serializer))->SerializeValue(ref scrapAmount, default(ForEnums)); } public override string ToString() { return $"StartShipEarly: {startShipEarly}\nCanSeekerDie: {canSeekerDie}\nLetSeekerSwitchCam: {letSeekerSwitchCam}\nUseCustomSuits: {useCustomSuits}\nSpawnTPMines: {spawnTPMines}\nChanceBasedSeeker: {chanceBasedSeeker}\nCanKeysLockDoors: {canKeysLockDoors}\nDoorHitsRequired: {doorHitsRequired}\nSeekerWeapon: {seekerWeapon}\nGamemodeOption: {gamemodeOption}\nSeekerSuit: {seekerSuit}\nHiderSuit: {hiderSuit}\nStatsEnabled: {statsEnabled}\nDisguiseEnabled: {disguiseEnabled}\nTpToEntrance: {teleportToEntrance}\nMineAmount: {mineAmount}\nScrapAmount: {scrapAmount}"; } } internal class ConfigProcessor { [CompilerGenerated] private sealed class d__12 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ulong clientId; public ConfigProcessor <>4__this; private FastBufferWriter 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_008e: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; ModBase.mls.LogInfo((object)("TRANSFERING CONFIG TO: " + clientId)); ModBase.mls.LogInfo((object)<>4__this.serverConfig.ToString()); 5__1 = new FastBufferWriter(<>4__this.serverConfig.NetworkSize, (Allocator)2, -1); ((FastBufferWriter)(ref 5__1)).WriteValueSafe(ref <>4__this.serverConfig, default(ForNetworkSerializable)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Tibnan.hnsmod_ClientReceiveServerConfig", clientId, 5__1, (NetworkDelivery)2); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__13 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ConfigProcessor <>4__this; private FastBufferWriter 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return false; } <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; return true; case 1: <>1__state = -1; ModBase.mls.LogInfo((object)"TRANSFERRING CONFIG TO ALL"); ModBase.mls.LogInfo((object)<>4__this.serverConfig.ToString()); 5__1 = new FastBufferWriter(<>4__this.serverConfig.NetworkSize, (Allocator)2, -1); ((FastBufferWriter)(ref 5__1)).WriteValueSafe(ref <>4__this.serverConfig, default(ForNetworkSerializable)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("Tibnan.hnsmod_ClientReceiveServerConfig", 5__1, (NetworkDelivery)2); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static ConfigFile ModConfig; private ClientConfiguration clientConfig = new ClientConfiguration(); private ServerConfiguration serverConfig = new ServerConfiguration(); private ServerConfiguration ownConfig = new ServerConfiguration(); public static ConfigProcessor Config; private static Coroutine networkSyncCoroutine; public ref ClientConfiguration ClientConfig => ref clientConfig; public ref ServerConfiguration ServerConfig => ref serverConfig; public bool StartShipEarly { get { return serverConfig.StartShipEarly; } set { serverConfig.StartShipEarly = value; } } public bool UIShow { get { return clientConfig.UIShow; } set { clientConfig.UIShow = value; } } public bool DisplayWarning { get { return clientConfig.DisplayWarning; } set { clientConfig.DisplayWarning = value; } } public bool AlwaysShowClock { get { return clientConfig.AlwaysShowClock; } set { clientConfig.AlwaysShowClock = value; } } public bool QuickRefreshClock { get { return clientConfig.QuickRefreshClock; } set { clientConfig.QuickRefreshClock = value; } } public bool CanSeekerDie { get { return serverConfig.CanSeekerDie; } set { serverConfig.CanSeekerDie = value; } } public bool LetSeekerSwitchCam { get { return serverConfig.LetSeekerSwitchCam; } set { serverConfig.LetSeekerSwitchCam = value; } } public bool UseCustomSuits { get { return serverConfig.UseCustomSuits; } set { serverConfig.UseCustomSuits = value; } } public Suit SeekerSuit { get { return serverConfig.SeekerSuit; } set { serverConfig.SeekerSuit = value; } } public Suit HiderSuit { get { return serverConfig.HiderSuit; } set { serverConfig.HiderSuit = value; } } public EndGameUIStyle EndGameUIStyle { get { return clientConfig.EndGameUIStyle; } set { clientConfig.EndGameUIStyle = value; } } public bool SpawnTPMines { get { return serverConfig.SpawnTPMines; } set { serverConfig.SpawnTPMines = value; } } public bool ChanceBasedSeeker { get { return serverConfig.ChanceBasedSeeker; } set { serverConfig.ChanceBasedSeeker = value; } } public int DoorHits { get { return serverConfig.DoorHits; } set { serverConfig.DoorHits = value; } } public bool DoorLockEnabled { get { return serverConfig.DoorLockEnabled; } set { serverConfig.DoorLockEnabled = value; } } public SeekerWeapon SeekerWeapon { get { return serverConfig.SeekerWeapon; } set { serverConfig.SeekerWeapon = value; } } public GamemodeOption GamemodeOption { get { return serverConfig.GamemodeOption; } set { serverConfig.GamemodeOption = value; } } public bool StatsEnabled { get { return serverConfig.StatsEnabled; } set { serverConfig.StatsEnabled = value; } } public bool DisguiseEnabled { get { return serverConfig.DisguiseEnabled; } set { serverConfig.DisguiseEnabled = value; } } public bool TPToEntranceEnabled { get { return serverConfig.TPToEntranceEnabled; } set { serverConfig.TPToEntranceEnabled = value; } } public MineSpawnAmount MineSpawnAmount { get { return serverConfig.MineAmount; } set { serverConfig.MineAmount = value; } } public ScrapSpawnAmount ScrapSpawnAmount { get { return serverConfig.ScrapAmount; } set { serverConfig.ScrapAmount = value; } } public static void AddConfigItems() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_06e0: Expected O, but got Unknown //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Expected O, but got Unknown //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Expected O, but got Unknown //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_0708: Expected O, but got Unknown //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Expected O, but got Unknown //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Expected O, but got Unknown //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0732: Expected O, but got Unknown //IL_0739: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Expected O, but got Unknown //IL_0747: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Expected O, but got Unknown //IL_0755: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Expected O, but got Unknown //IL_0763: Unknown result type (might be due to invalid IL or missing references) //IL_076a: Expected O, but got Unknown //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Expected O, but got Unknown //IL_077f: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Expected O, but got Unknown //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Expected O, but got Unknown //IL_07fd: Unknown result type (might be due to invalid IL or missing references) //IL_0804: Expected O, but got Unknown ModConfig = new ConfigFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LCHideNSeekConfig"), true); ConfigEntry leaveConfig = ModConfig.Bind("Gameplay", "Start Ship Early", true, "Makes the ship leave early when only 1 hider is left."); leaveConfig.SettingChanged += delegate { Config.ServerConfig.StartShipEarly = leaveConfig.Value; Config.StartDelayedSync(); }; ConfigEntry UIShowConfig = ModConfig.Bind("Gameplay", "Show Custom UI Elements", true, "Shows UI elements related to current player role and game status."); UIShowConfig.SettingChanged += delegate { Config.ClientConfig.UIShow = UIShowConfig.Value; }; ConfigEntry displayWarn = ModConfig.Bind("Gameplay", "Display Gamemode Warning", true, "Displays a warning when entering the game."); displayWarn.SettingChanged += delegate { Config.ClientConfig.DisplayWarning = displayWarn.Value; }; ConfigEntry alwaysShowClock = ModConfig.Bind("Gameplay", "Always Show Clock", true, "Always shows the clock, even in the facility."); alwaysShowClock.SettingChanged += delegate { Config.ClientConfig.AlwaysShowClock = alwaysShowClock.Value; }; ConfigEntry quickRefreshClock = ModConfig.Bind("Gameplay", "Swift Clock Refresh", true, "Refresh the clock every second instead of every 4 seconds."); quickRefreshClock.SettingChanged += delegate { Config.ClientConfig.QuickRefreshClock = quickRefreshClock.Value; }; ConfigEntry seekerDeathConfig = ModConfig.Bind("Gameplay", "Allow Seeker Death", true, "Allows the seeker to die."); seekerDeathConfig.SettingChanged += delegate { Config.ServerConfig.CanSeekerDie = seekerDeathConfig.Value; Config.StartDelayedSync(); }; ConfigEntry seekerCamSwitchConfig = ModConfig.Bind("Gameplay", "Allow Seeker To Change Camera", false, "Allows the seeker to switch the map screen camera."); seekerCamSwitchConfig.SettingChanged += delegate { Config.ServerConfig.LetSeekerSwitchCam = seekerCamSwitchConfig.Value; Config.StartDelayedSync(); }; ConfigEntry useCustomClothes = ModConfig.Bind("Suits", "Use Custom Suits", true, "Use custom suit selection for roles using the enum dropdown menu. If disabled, the default suits will be used."); useCustomClothes.SettingChanged += delegate { Config.ServerConfig.UseCustomSuits = useCustomClothes.Value; Config.StartDelayedSync(); }; ConfigEntry seekerSuitConfig = ModConfig.Bind("Suits", "Seeker Suit", Suit.Purple, "The suit the seeker will use in game."); seekerSuitConfig.SettingChanged += delegate { Config.ServerConfig.SeekerSuit = seekerSuitConfig.Value; Config.StartDelayedSync(); }; ConfigEntry hiderSuitConfig = ModConfig.Bind("Suits", "Hider Suit", Suit.Orange, "The suit the hiders will use in game."); hiderSuitConfig.SettingChanged += delegate { Config.ServerConfig.HiderSuit = hiderSuitConfig.Value; Config.StartDelayedSync(); }; ConfigEntry spawnTPMineConfig = ModConfig.Bind("Gameplay", "Spawn Teleport Mines", true, "Enables teleport mine spawning in the facility."); spawnTPMineConfig.SettingChanged += delegate { Config.ServerConfig.SpawnTPMines = spawnTPMineConfig.Value; Config.StartDelayedSync(); }; ConfigEntry chanceBasedSeekerConfig = ModConfig.Bind("Gameplay", "Chance Based Seeker Choosing", true, "Enables the seeker to be chosen based on a calculated chance. This ensures a more fair gameplay, but has not been tested thoroughly. If disabled, the old fully random system will be used."); chanceBasedSeekerConfig.SettingChanged += delegate { Config.ServerConfig.ChanceBasedSeeker = chanceBasedSeekerConfig.Value; Config.StartDelayedSync(); }; ConfigEntry doorHitConfig = ModConfig.Bind("Gameplay", "Door Health", 3, "The amount of shotgun hits required to open a locked door."); doorHitConfig.SettingChanged += delegate { Config.ServerConfig.DoorHits = doorHitConfig.Value; Config.StartDelayedSync(); }; ConfigEntry doorLockConfig = ModConfig.Bind("Gameplay", "Can Keys Lock Doors", true, "Allows keys to lock doors."); doorLockConfig.SettingChanged += delegate { Config.ServerConfig.DoorLockEnabled = doorLockConfig.Value; Config.StartDelayedSync(); }; ConfigEntry endOfGameUIConfig = ModConfig.Bind("Gameplay", "End Game Stat UI Style", EndGameUIStyle.Orange, "The UI style to use for the end of game screen."); endOfGameUIConfig.SettingChanged += delegate { Config.ClientConfig.EndGameUIStyle = endOfGameUIConfig.Value; }; ConfigEntry seekerWeaponConfig = ModConfig.Bind("Gamemode Options", "Seeker Weapon", SeekerWeapon.Shotgun, "The weapon the seeker will use in game."); seekerWeaponConfig.SettingChanged += delegate { Config.ServerConfig.SeekerWeapon = seekerWeaponConfig.Value; Config.StartDelayedSync(); }; ConfigEntry gamemodeConfig = ModConfig.Bind("Gamemode Options", "Weapon Grant Time", GamemodeOption.InstantWeapon, "This determines how the weapon(s) are distributed to the seeker. If set to DelayedWeapon, the seeker is only allowed to use the shovel until 12:00, otherwise the weapon(s) are given to the seeker at the start of the game."); gamemodeConfig.SettingChanged += delegate { Config.ServerConfig.GamemodeOption = gamemodeConfig.Value; Config.StartDelayedSync(); }; ConfigEntry statConfig = ModConfig.Bind("Gameplay", "EXPERIMENTAL: Enable Statistics", false, "EXPERIMENTAL: Enables statistics at the end of the game screen. Visual or logic errors may occur."); statConfig.SettingChanged += delegate { Config.ServerConfig.StatsEnabled = statConfig.Value; Config.StartDelayedSync(); }; ConfigEntry disguiseConfig = ModConfig.Bind("Gameplay", "Disguising", true, "Enables hiders the ability to disguise themselves as items using the key H."); disguiseConfig.SettingChanged += delegate { Config.ServerConfig.DisguiseEnabled = disguiseConfig.Value; Config.StartDelayedSync(); }; ConfigEntry tpToEntranceConfig = ModConfig.Bind("Gameplay", "Teleport to Entrance", true, "Teleports players to the entrance when the ship lands."); tpToEntranceConfig.SettingChanged += delegate { Config.ServerConfig.TPToEntranceEnabled = tpToEntranceConfig.Value; Config.StartDelayedSync(); }; ConfigEntry mineSpawnConfig = ModConfig.Bind("Gameplay", "Mine Spawn Amount", MineSpawnAmount.SlightlyMore, "Sets the amount of both landmines and teleport mines to spawn."); mineSpawnConfig.SettingChanged += delegate { Config.ServerConfig.MineAmount = mineSpawnConfig.Value; Config.StartDelayedSync(); }; ConfigEntry scrapSpawnConfig = ModConfig.Bind("Gameplay", "Scrap Spawn Amount", ScrapSpawnAmount.SlightlyMore, "Sets the amount of scrap to spawn in the level."); scrapSpawnConfig.SettingChanged += delegate { Config.ServerConfig.ScrapAmount = scrapSpawnConfig.Value; Config.StartDelayedSync(); }; Config = new ConfigProcessor { clientConfig = new ClientConfiguration(UIShowConfig.Value, displayWarn.Value, alwaysShowClock.Value, quickRefreshClock.Value, endOfGameUIConfig.Value), serverConfig = new ServerConfiguration(leaveConfig.Value, seekerDeathConfig.Value, seekerCamSwitchConfig.Value, useCustomClothes.Value, spawnTPMineConfig.Value, chanceBasedSeekerConfig.Value, doorLockConfig.Value, doorHitConfig.Value, seekerWeaponConfig.Value, gamemodeConfig.Value, seekerSuitConfig.Value, hiderSuitConfig.Value, statConfig.Value, disguiseConfig.Value, tpToEntranceConfig.Value, mineSpawnConfig.Value, scrapSpawnConfig.Value), ownConfig = new ServerConfiguration(leaveConfig.Value, seekerDeathConfig.Value, seekerCamSwitchConfig.Value, useCustomClothes.Value, spawnTPMineConfig.Value, chanceBasedSeekerConfig.Value, doorLockConfig.Value, doorHitConfig.Value, seekerWeaponConfig.Value, gamemodeConfig.Value, seekerSuitConfig.Value, hiderSuitConfig.Value, statConfig.Value, disguiseConfig.Value, tpToEntranceConfig.Value, mineSpawnConfig.Value, scrapSpawnConfig.Value) }; BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(leaveConfig, false); BoolCheckBoxConfigItem val2 = new BoolCheckBoxConfigItem(UIShowConfig, false); BoolCheckBoxConfigItem val3 = new BoolCheckBoxConfigItem(displayWarn, false); BoolCheckBoxConfigItem val4 = new BoolCheckBoxConfigItem(alwaysShowClock, false); BoolCheckBoxConfigItem val5 = new BoolCheckBoxConfigItem(quickRefreshClock, false); BoolCheckBoxConfigItem val6 = new BoolCheckBoxConfigItem(seekerDeathConfig, false); BoolCheckBoxConfigItem val7 = new BoolCheckBoxConfigItem(seekerCamSwitchConfig, false); BoolCheckBoxConfigItem val8 = new BoolCheckBoxConfigItem(useCustomClothes, false); BoolCheckBoxConfigItem val9 = new BoolCheckBoxConfigItem(spawnTPMineConfig, false); BoolCheckBoxConfigItem val10 = new BoolCheckBoxConfigItem(chanceBasedSeekerConfig, false); BoolCheckBoxConfigItem val11 = new BoolCheckBoxConfigItem(doorLockConfig, false); BoolCheckBoxConfigItem val12 = new BoolCheckBoxConfigItem(statConfig, false); BoolCheckBoxConfigItem val13 = new BoolCheckBoxConfigItem(disguiseConfig, false); BoolCheckBoxConfigItem val14 = new BoolCheckBoxConfigItem(tpToEntranceConfig, false); EnumDropDownConfigItem val15 = new EnumDropDownConfigItem(seekerSuitConfig, false); EnumDropDownConfigItem val16 = new EnumDropDownConfigItem(hiderSuitConfig, false); EnumDropDownConfigItem val17 = new EnumDropDownConfigItem(endOfGameUIConfig, false); EnumDropDownConfigItem val18 = new EnumDropDownConfigItem(seekerWeaponConfig, false); EnumDropDownConfigItem val19 = new EnumDropDownConfigItem(gamemodeConfig, false); EnumDropDownConfigItem val20 = new EnumDropDownConfigItem(mineSpawnConfig, false); EnumDropDownConfigItem val21 = new EnumDropDownConfigItem(scrapSpawnConfig, false); IntInputFieldConfigItem val22 = new IntInputFieldConfigItem(doorHitConfig, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val5); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val7); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val15); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val16); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val9); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val10); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val22); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val11); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val17); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val18); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val19); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val12); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val13); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val14); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val20); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val21); } private void StartDelayedSync() { if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer) { if (networkSyncCoroutine == null) { networkSyncCoroutine = ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(Config.TransferConfigToAll()); return; } ((MonoBehaviour)GameNetworkManager.Instance).StopCoroutine(networkSyncCoroutine); networkSyncCoroutine = ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(Config.TransferConfigToAll()); } } [IteratorStateMachine(typeof(d__12))] public IEnumerator TransferConfigTo(ulong clientId) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this, clientId = clientId }; } [IteratorStateMachine(typeof(d__13))] public IEnumerator TransferConfigToAll() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this }; } public static void ClientSetServerConfig(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) ServerConfiguration serverConfiguration = default(ServerConfiguration); ((FastBufferReader)(ref reader)).ReadValueSafe(ref serverConfiguration, default(ForNetworkSerializable)); ModBase.mls.LogInfo((object)"READING NETWORK CONFIGURATION:"); ModBase.mls.LogInfo((object)serverConfiguration.ToString()); Config.ServerConfig = serverConfiguration; } public static void Reset() { ModBase.mls.LogInfo((object)"Dropping network configuration and using local configuration."); Config.serverConfig = Config.ownConfig; } } }