Decompiled source of HostFixes v1.0.18
HostFixes.dll
Decompiled 4 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using Netcode.Transports.Facepunch; using Steamworks; using Steamworks.Data; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CharlesE2")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Fixes for hosting a Lethal Company Lobby.")] [assembly: AssemblyFileVersion("1.0.18.0")] [assembly: AssemblyInformationalVersion("1.0.18+f24dc4a33c139293a4a3c36406a58e10870edca8")] [assembly: AssemblyProduct("Host Fixes")] [assembly: AssemblyTitle("HostFixes")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.18.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace HostFixes { internal class Patches { [HarmonyPatch(typeof(Terminal), "Start")] internal static class TerminalStart_Patch { [HarmonyTranspiler] public static IEnumerable<CodeInstruction> FixHostSales(IEnumerable<CodeInstruction> instructions) { bool flag = false; int num = -1; List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Call && list[i].operand is MethodInfo methodInfo && methodInfo.Name == "InitializeItemSalesPercentages") { num = i; flag = true; break; } } if (flag) { list.RemoveAt(num); list.RemoveAt(num - 1); } else { Plugin.Log.LogError((object)"Could not patch Terminal.Start"); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesServerRpc")] internal static class Fix_SyncShipUnlockablesServerRpc_Crash { public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { bool flag = false; int num = -1; List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Call && list[i].operand is MethodInfo methodInfo && methodInfo.Name == "FindObjectsOfType") { num = i; flag = true; break; } } if (flag) { list.Insert(num + 1, Transpilers.EmitDelegate<Func<IEnumerable<PlaceableShipObject>, IEnumerable<PlaceableShipObject>>>((Func<IEnumerable<PlaceableShipObject>, IEnumerable<PlaceableShipObject>>)((IEnumerable<PlaceableShipObject> placeableShipObject) => placeableShipObject.Where((PlaceableShipObject placeableShipObject) => (Object)(object)placeableShipObject.parentObject != (Object)null)))); } else { Plugin.Log.LogError((object)"Could not patch SyncShipUnlockablesServerRpc's Crash"); } return list.AsEnumerable(); } } [HarmonyWrapSafe] [HarmonyPatch(typeof(FacepunchTransport), "Steamworks.ISocketManager.OnConnecting")] private class Identity_Fix { public static void Prefix(ref Connection connection, ref ConnectionInfo info) { //IL_000b: 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) Plugin.SteamIdtoConnectionIdMap[((NetIdentity)(ref info.identity)).SteamId.Value] = ((Connection)(ref connection)).Id; Plugin.ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id] = ((NetIdentity)(ref info.identity)).SteamId.Value; } } [HarmonyWrapSafe] [HarmonyPatch(typeof(FacepunchTransport), "Steamworks.ISocketManager.OnDisconnected")] private class SteamIdDictionary_Cleanup { public static void Prefix(ref Connection connection, ref ConnectionInfo info) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) NetworkManager singleton = NetworkManager.Singleton; if (singleton != null && singleton.IsListening) { if (!Plugin.SteamIdtoConnectionIdMap.Remove(((NetIdentity)(ref info.identity)).SteamId.Value)) { Plugin.Log.LogError((object)$"steamId: ({((NetIdentity)(ref info.identity)).SteamId.Value}) was not in steamIdtoConnectionIdMap."); } if (!Plugin.ConnectionIdtoSteamIdMap.Remove(((Connection)(ref connection)).Id)) { Plugin.Log.LogError((object)$"connectionId: ({((Connection)(ref connection)).Id}) was not in connectionIdtoSteamIdMap."); } if (!Plugin.playerSteamNames.Remove(((NetIdentity)(ref info.identity)).SteamId.Value)) { Plugin.Log.LogError((object)$"steamId: ({((NetIdentity)(ref info.identity)).SteamId.Value}) was not in playerSteamNames."); } } } } [HarmonyWrapSafe] [HarmonyPatch(typeof(NetworkConnectionManager), "OnClientDisconnectFromServer")] private class ClientIdToSteamId_Cleanup { public static void Prefix(ulong clientId) { if (NetworkManager.Singleton.IsHost && Plugin.ClientIdToSteamIdMap.TryGetValue(clientId, out var value)) { if (!Plugin.SteamIdtoClientIdMap.Remove(value)) { Plugin.Log.LogError((object)$"({value}) was not in steamIdtoClientIdMap."); } Plugin.ClientIdToSteamIdMap.Remove(clientId); } } } [HarmonyWrapSafe] [HarmonyPatch(typeof(StartOfRound), "OnClientConnect")] private class OnClientConnect { public static void Postfix(StartOfRound __instance, ulong clientId) { if (((NetworkBehaviour)__instance).IsServer && clientId != 0L && !GameNetworkManager.Instance.disableSteam && StartOfRound.Instance.ClientPlayerList.TryGetValue(clientId, out var value)) { StartOfRound.Instance.allPlayerScripts[value].playerSteamId = Plugin.ClientIdToSteamIdMap[clientId]; } } } [HarmonyWrapSafe] [HarmonyPatch(typeof(GameNetworkManager), "ConnectionApproval")] private class MapSteamIdToClientId { public static void Postfix(GameNetworkManager __instance, ref ConnectionApprovalRequest request, ref ConnectionApprovalResponse response) { if (__instance.disableSteam) { return; } ulong num = NetworkManager.Singleton.ConnectionManager.ClientIdToTransportId(request.ClientNetworkId); if (Plugin.ConnectionIdtoSteamIdMap.TryGetValue((uint)num, out var value)) { Plugin.SteamIdtoClientIdMap[value] = request.ClientNetworkId; Plugin.ClientIdToSteamIdMap[request.ClientNetworkId] = value; StartOfRound instance = StartOfRound.Instance; if (instance != null && instance.KickedClientIds.Contains(value)) { response.Reason = "You cannot rejoin after being kicked."; response.Approved = false; } } else { Plugin.Log.LogError((object)$"[ConnectionApproval] Could not get steamId from transportId ({num})"); } } } [HarmonyWrapSafe] [HarmonyPatch(typeof(Terminal), "Awake")] private class HostInitialization { public static void Postfix(Terminal __instance) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Plugin.TerminalAwakeWait(__instance)); } } [HarmonyWrapSafe] [HarmonyPatch(typeof(NetworkConnectionManager), "Initialize")] private class SetupIdMap { public static void Prefix() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!GameNetworkManager.Instance.disableSteam) { Plugin.SteamIdtoClientIdMap[SteamId.op_Implicit(SteamClient.SteamId)] = 0uL; Plugin.ClientIdToSteamIdMap[0uL] = SteamId.op_Implicit(SteamClient.SteamId); Plugin.SteamIdtoConnectionIdMap[SteamId.op_Implicit(SteamClient.SteamId)] = 0u; Plugin.ConnectionIdtoSteamIdMap[0u] = SteamId.op_Implicit(SteamClient.SteamId); } } } [HarmonyWrapSafe] [HarmonyPatch(typeof(NetworkManager), "OnEnable")] private class RegisterNetworkManagerEvents { public static void Postfix() { NetworkManager.Singleton.OnServerStopped -= Plugin.ServerStopped; NetworkManager.Singleton.OnServerStopped += Plugin.ServerStopped; } } [HarmonyWrapSafe] [HarmonyPatch(typeof(HUDManager), "AddPlayerChatMessageClientRpc")] private class AddPlayerChatMessageClientRpc_Patch { public static bool Prefix(HUDManager __instance, int playerId) { NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening) { return false; } if (!networkManager.IsHost && (playerId < 0 || playerId > StartOfRound.Instance.allPlayerScripts.Length)) { return false; } return true; } } [HarmonyWrapSafe] [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] private class SwitchToItemSlot_Patch { public static void Prefix(PlayerControllerB __instance, ref int slot) { slot = Mathf.Clamp(slot, 0, __instance.ItemSlots.Length - 1); } } [HarmonyWrapSafe] [HarmonyPatch(typeof(PlayerControllerB), "NextItemSlot")] private class NextItemSlot_Patch { public static void Prefix(PlayerControllerB __instance) { __instance.currentItemSlot = Mathf.Clamp(__instance.currentItemSlot, 0, __instance.ItemSlots.Length - 1); } } [HarmonyWrapSafe] [HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")] private class OnPlayerDC_Patch { public static void Postfix(ulong clientId) { if (Plugin.votedToLeaveEarlyPlayers.Remove(clientId)) { TimeOfDay.Instance.votesForShipToLeaveEarly = Plugin.votedToLeaveEarlyPlayers.Count; } } } [HarmonyWrapSafe] [HarmonyPatch(typeof(StartOfRound), "OpenShipDoors")] private class OpenShipDoors_Patch { public static void Prefix() { Plugin.votedToLeaveEarlyPlayers.Clear(); } } } [BepInPlugin("HostFixes", "Host Fixes", "1.0.18")] public class Plugin : BaseUnityPlugin { internal class ConnectionEvents { internal static void ConnectionAttempt(Lobby _, Friend member) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0035: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsHost && !playerSteamNames.TryAdd(member.Id.Value, ((Friend)(ref member)).Name)) { Log.LogError((object)$"SteamId: ({member.Id.Value}) Name: ({((Friend)(ref member)).Name}) is already in the playerSteamNames list."); } } internal static void ConnectionCleanup(Lobby _, Friend member) { //IL_0016: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsHost && !GameNetworkManager.Instance.steamIdsInLobby.Remove(SteamId.op_Implicit(member.Id.Value))) { Log.LogError((object)$"({member.Id.Value}) already removed from steamIdsInLobby."); } } internal static void LobbyCreated(Result result, Lobby lobby) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) if ((int)result == 1) { Dictionary<ulong, string> playerSteamNames = Plugin.playerSteamNames; ulong value = ((Lobby)(ref lobby)).Owner.Id.Value; Friend owner = ((Lobby)(ref lobby)).Owner; if (!playerSteamNames.TryAdd(value, ((Friend)(ref owner)).Name)) { Log.LogError((object)"Host is already in playerSteamNames."); } } } } public class HostFixesServerReceiveRpcs { public void BuyItemsServerRpc(int[] boughtItems, int newGroupCredits, int numItemsInShip, Terminal instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[BuyItemsServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } if (!configCheckPrices.Value) { instance.BuyItemsServerRpc(boughtItems, newGroupCredits, numItemsInShip); return; } string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; int num = 0; if (instance.numberOfItemsInDropship + boughtItems.Length > 12) { Log.LogWarning((object)"Trying to buy too many items."); return; } Dictionary<int, int> dictionary = (from item in boughtItems group item by item).ToDictionary((IGrouping<int, int> item) => item.Key, (IGrouping<int, int> item) => item.Count()); foreach (int key in dictionary.Keys) { try { num += (int)((float)instance.buyableItemsList[key].creditsWorth * ((float)instance.itemSalesPercentages[key] / 100f) * (float)dictionary[key]); } catch { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to buy an item that was not in the host's shop. Item #{key}"); return; } } if (instance.groupCredits - num != newGroupCredits) { Log.LogWarning((object)($"Player #{value} ({playerUsername}) credits spent on items does not match item price. " + $"Spent credits: {instance.groupCredits - num} Cost Of items: {num}")); } else { instance.BuyItemsServerRpc(boughtItems, newGroupCredits, numItemsInShip); } } public void PlayTerminalAudioServerRpc(int clipIndex, Terminal instance, ServerRpcParams _) { if (!terminalSoundPlaying) { ((MonoBehaviour)Instance).StartCoroutine(TerminalSoundCooldown()); instance.PlayTerminalAudioServerRpc(clipIndex); } } public void BuyShipUnlockableServerRpc(int unlockableID, int newGroupCreditsAmount, StartOfRound instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[BuyShipUnlockableServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } Terminal val = Object.FindObjectOfType<Terminal>(); if (senderClientId == 0L) { instance.BuyShipUnlockableServerRpc(unlockableID, newGroupCreditsAmount); } else if (!buyShipUnlockableOnCooldown) { ((MonoBehaviour)Instance).StartCoroutine(BuyShipUnlockableCooldown()); string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; int value2; if (unlockableID < 0 || unlockableID > StartOfRound.Instance.unlockablesList.unlockables.Count) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to buy unlockable that is out of unlockables list. ({unlockableID})."); } else if (StartOfRound.Instance.unlockablesList.unlockables[unlockableID].alreadyUnlocked) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to unlock an unlockable multiple times"); } else if (!unlockablePrices.TryGetValue(unlockableID, out value2)) { Log.LogError((object)$"Could not find price of ship unlockable #{unlockableID}"); } else if (senderClientId != 0L && val.groupCredits - value2 != newGroupCreditsAmount) { Log.LogWarning((object)($"Player #{value} ({playerUsername}) calculated credit amount does not match sent credit amount for unlockable. " + $"Current credits: {val.groupCredits} Unlockable cost: {value2} Sent credit Amount: {newGroupCreditsAmount}")); } else if (newGroupCreditsAmount < val.groupCredits) { instance.BuyShipUnlockableServerRpc(unlockableID, newGroupCreditsAmount); } else { Log.LogWarning((object)($"Player #{senderClientId} ({playerUsername}) attempted to increase credits while buying ship unlockables." + $" Attempted credit value: {newGroupCreditsAmount} Old credit value: {val.groupCredits}")); } } } public void ChangeLevelServerRpc(int levelID, int newGroupCreditsAmount, StartOfRound instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[ChangeLevelServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; if (changeLevelCooldown.TryGetValue(value, out var value2) && value2) { return; } ((MonoBehaviour)Instance).StartCoroutine(ChangeLevelCooldown(value)); if (StartOfRound.Instance.allPlayerScripts[value].isPlayerDead) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to change the moon while they are dead on the server."); return; } if (newGroupCreditsAmount < 0) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to set credits to a negative number ({newGroupCreditsAmount})."); return; } if (!configCheckPrices.Value) { instance.ChangeLevelServerRpc(levelID, newGroupCreditsAmount); return; } Terminal val = Object.FindObjectOfType<Terminal>(); if (moons == null) { moons = (from moon in val.terminalNodes.allKeywords.First((TerminalKeyword keyword) => ((Object)keyword).name == "Route").compatibleNouns group moon by moon.noun into moon select moon.First() into moon select moon.result.terminalOptions.First((CompatibleNoun option) => ((Object)option.noun).name == "Confirm")).ToDictionary((CompatibleNoun option) => option.result.buyRerouteToMoon, (CompatibleNoun option) => option.result.itemCost); } try { int num = moons[levelID]; if (senderClientId != 0L && val.groupCredits - num != newGroupCreditsAmount) { Log.LogWarning((object)($"Player #{value} ({playerUsername}) calculated credit amount does not match sent credit amount for moon. " + $"Current credits: {val.groupCredits} Moon cost: {num} Sent credit Amount: {newGroupCreditsAmount}")); return; } if (newGroupCreditsAmount > val.groupCredits) { Log.LogWarning((object)($"Player #{value} ({playerUsername}) attempted to increase credits from changing levels. " + $"Attempted Credit Value: {newGroupCreditsAmount} Old Credit Value: {val.groupCredits}")); return; } } catch (KeyNotFoundException) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) sent levelID ({levelID}) that is not in the moons array."); return; } instance.ChangeLevelServerRpc(levelID, newGroupCreditsAmount); } public void AddPlayerChatMessageServerRpc(string chatMessage, int playerId, HUDManager instance, ServerRpcParams serverRpcParams) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(chatMessage)) { return; } ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)($"[AddPlayerChatMessageServerRpc] Failed to get the playerId from senderClientId: ({senderClientId}) " + "Message: (" + chatMessage + ")")); return; } string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; if (StartOfRound.Instance.allPlayerScripts[value].isPlayerDead) { Log.LogWarning((object)($"Player #{value} ({playerUsername}) tried sending a chat message while they are dead on the server. " + "Message: (" + chatMessage + ")")); return; } if (playerId < 0 || playerId > StartOfRound.Instance.allPlayerScripts.Length) { Log.LogWarning((object)($"Player #{value} ({playerUsername}) tried to chat with a playerId ({playerId}) that is not a valid player. " + "Message: (" + chatMessage + ")")); return; } string text; try { text = Regex.Replace(chatMessage, "<(\\S+?)>", "($+)"); } catch (Exception ex) { Log.LogError((object)$"Player #{value} ({playerUsername}) Regex Exception: {ex} Chat Message: ({chatMessage})"); return; } if (string.IsNullOrWhiteSpace(text)) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) Chat message was empty after sanitization. Original Message: ({chatMessage})"); return; } if (playerId == value) { instance.AddPlayerChatMessageServerRpc(text, playerId); return; } Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to send message as another player #({playerId}) Message: ({chatMessage})"); } public void AddTextMessageServerRpc(string chatMessage, HUDManager instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[AddTextMessageServerRpc] Failed to get the playerId from senderClientId: ({senderClientId}) Message: ({chatMessage})"); return; } string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; ulong playerSteamId = StartOfRound.Instance.allPlayerScripts[value].playerSteamId; if (GameNetworkManager.Instance.disableSteam) { HUDManager.Instance.AddTextMessageServerRpc(chatMessage); } else if (!chatMessage.EndsWith(" started the ship.")) { if (!playerSteamNames.TryGetValue(playerSteamId, out string value2)) { Log.LogError((object)$"Failed to get steam username from playerlist for steamId: {playerSteamId} Message: ({chatMessage})"); } else if (senderClientId == 0L || chatMessage.Equals(playerUsername + " joined the ship.") || chatMessage.Equals(value2 + " joined the ship.") || chatMessage.Equals(value2 + "... joined the ship.") || chatMessage.Equals(playerUsername + " was left behind.") || chatMessage.StartsWith($"[morecompanycosmetics];{value};")) { instance.AddTextMessageServerRpc(chatMessage); } else { Log.LogWarning((object)$"Player #{value} ({value2}) tried to send message as the server: ({chatMessage})"); } } } public void SetShipLeaveEarlyServerRpc(TimeOfDay instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[SetShipLeaveEarlyServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); } else if (!votedToLeaveEarlyPlayers.Contains(senderClientId) && StartOfRound.Instance.allPlayerScripts[value].isPlayerDead) { votedToLeaveEarlyPlayers.Add(senderClientId); int val = StartOfRound.Instance.connectedPlayersAmount + 1 - StartOfRound.Instance.livingPlayers; if (votedToLeaveEarlyPlayers.Count >= Math.Max(val, configMinimumVotesToLeaveEarly.Value)) { instance.votesForShipToLeaveEarly = votedToLeaveEarlyPlayers.Count; instance.SetShipLeaveEarlyClientRpc(instance.normalizedTimeOfDay + 0.1f, instance.votesForShipToLeaveEarly); } else { instance.votesForShipToLeaveEarly++; instance.AddVoteForShipToLeaveEarlyClientRpc(); } } else { string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to force the vote to leave."); } } public void PlaceShipObjectServerRpc(Vector3 newPosition, Vector3 newRotation, NetworkObjectReference objectRef, int playerWhoMoved, ShipBuildModeManager instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[PlaceShipObjectServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); } else { if (playerMovedShipObject.TryGetValue(value, out var value2) && value2) { return; } ((MonoBehaviour)Instance).StartCoroutine(PlaceShipObjectCooldown(value)); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (playerWhoMoved != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to place a ship object while spoofing another player."); return; } if (val.isPlayerDead) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to place a ship object while dead on the server."); return; } if (configShipObjectRotationCheck.Value) { try { PlaceableShipObject val2 = NetworkObjectReference.op_Implicit(objectRef).GetComponentInChildren<PlaceableShipObject>() ?? throw new Exception("PlaceableShipObject Not Found"); if (Mathf.RoundToInt(newRotation.x) != Mathf.RoundToInt(((Component)val2.mainMesh).transform.eulerAngles.x) || Mathf.RoundToInt(newRotation.z) != Mathf.RoundToInt(((Component)val2.mainMesh).transform.eulerAngles.z)) { Log.LogWarning((object)($"Player #{value} ({val.playerUsername}) " + "tried to place a ship object (" + ((Object)val2).name + ") with the wrong rotation. " + $"x: ({newRotation.x}) ({((Component)val2.mainMesh).transform.eulerAngles.x}) " + $"z: ({newRotation.z}) ({((Component)val2.mainMesh).transform.eulerAngles.z})")); return; } } catch (Exception ex) { Log.LogWarning((object)ex); if (newRotation.x != 270f || newRotation.z != 0f) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to place a ship object with the wrong rotation."); return; } } } Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (!((Bounds)(ref bounds)).Contains(newPosition)) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to place a ship object ouside of the ship."); } else { instance.PlaceShipObjectServerRpc(newPosition, newRotation, objectRef, playerWhoMoved); } } } public void DespawnEnemyServerRpc(NetworkObjectReference enemyNetworkObject, RoundManager instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[DespawnEnemyServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } NetworkObject val = NetworkObjectReference.op_Implicit(enemyNetworkObject); GameObject val2 = NetworkObjectReference.op_Implicit(enemyNetworkObject); if (senderClientId == 0L) { instance.DespawnEnemyServerRpc(enemyNetworkObject); return; } string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; Log.LogWarning((object)($"Player #{value} ({playerUsername}) attemped to despawn an enemy on the server: " + $"{((val != null) ? ((Object)val).name : null)} {((val2 != null) ? ((Object)val2).name : null)} {((NetworkObjectReference)(ref enemyNetworkObject)).NetworkObjectId}")); } public void EndGameServerRpc(int playerClientId, StartOfRound instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_00da: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[EndGameServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } if (senderClientId == 0L) { instance.EndGameServerRpc(playerClientId); return; } if (endGameOnCoolown.TryGetValue(value, out var value2) && value2) { ((MonoBehaviour)Instance).StartCoroutine(EndGameCooldown(value)); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (playerClientId != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to end the game while spoofing another player."); return; } if (val.isPlayerDead) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to end the game while dead on the server."); return; } float num = Vector3.Distance(((Component)Object.FindFirstObjectByType<StartMatchLever>()).transform.position, ((Component)val).transform.position); if ((float)configLimitShipLeverDistance.Value > 1f && num > (float)configLimitShipLeverDistance.Value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to end the game while too far away ({num})."); } else { instance.EndGameServerRpc(playerClientId); } } public void PlayerLoadedServerRpc(ulong clientId, StartOfRound instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (senderClientId == 0L) { instance.PlayerLoadedServerRpc(clientId); return; } if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[PlayerLoadedServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (clientId != senderClientId) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to call PlayerLoadedServerRpc for another client."); } else if (!instance.fullyLoadedPlayers.Contains(clientId)) { instance.PlayerLoadedServerRpc(clientId); } } public void FinishedGeneratingLevelServerRpc(ulong clientId, RoundManager instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (senderClientId == 0L) { instance.FinishedGeneratingLevelServerRpc(clientId); return; } if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[FinishedGeneratingLevelServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (clientId != senderClientId) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to call FinishedGeneratingLevelServerRpc for another client."); } else if (!instance.playersFinishedGeneratingFloor.Contains(clientId)) { instance.FinishedGeneratingLevelServerRpc(clientId); } } public void SendNewPlayerValuesServerRpc(ulong newPlayerSteamId, PlayerControllerB instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[SendNewPlayerValuesServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (instance.actualClientId != senderClientId) { Log.LogWarning((object)($"Player #{value} ({val.playerUsername}) " + $"tried to call SendNewPlayerValuesServerRpc with input value ({newPlayerSteamId}) " + $"on player #{instance.playerClientId} ({instance.playerUsername}).")); return; } if (GameNetworkManager.Instance.disableSteam) { instance.SendNewPlayerValuesServerRpc(newPlayerSteamId); return; } if (!ClientIdToSteamIdMap.TryGetValue(senderClientId, out var value2)) { Log.LogError((object)$"[SendNewPlayerValuesServerRpc] Could not get steamId ({value2}) in steamIdtoClientIdMap"); return; } if (value2 != newPlayerSteamId) { Log.LogWarning((object)$"Client sent incorrect steamId. Player's steamId: ({value2}) Sent steamId: ({newPlayerSteamId})"); } instance.SendNewPlayerValuesServerRpc(value2); } public void DamagePlayerFromOtherClientServerRpc(int damageAmount, Vector3 hitDirection, int playerWhoHit, PlayerControllerB instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_0249: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[DamagePlayerFromOtherClientServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (senderClientId == 0L && playerWhoHit == -1) { instance.DamagePlayerFromOtherClientServerRpc(damageAmount, hitDirection, playerWhoHit); } else { if (damagePlayerFromOtherClientOnCooldown.TryGetValue(value, out var value2) && value2) { return; } ((MonoBehaviour)instance).StartCoroutine(DamageOtherPlayerCooldown(value)); if (playerWhoHit != value) { Log.LogWarning((object)($"Player #{value} ({playerUsername}) tried to spoof ({damageAmount}) damage from player #{playerWhoHit} " + "on (" + instance.playerUsername + ").")); return; } if (val.isPlayerDead) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to damage ({instance.playerUsername}) while they are dead on the server."); return; } if (Vector3.Distance(((Component)val).transform.position, ((Component)instance).transform.position) > 10f) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to damage ({instance.playerUsername}) from too far away."); return; } Shovel obj = Object.FindFirstObjectByType<Shovel>((FindObjectsInactive)1); if (obj != null && obj.shovelHitForce == 1 && damageAmount > 20) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to damage ({instance.playerUsername}) for extra damage ({damageAmount})"); return; } if (configDisablePvpInShip.Value) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(((Component)instance).transform.position)) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to damage ({instance.playerUsername}) inside the ship."); return; } } if (configLogPvp.Value) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) damaged ({instance.playerUsername}) for ({damageAmount}) damage."); } instance.DamagePlayerFromOtherClientServerRpc(damageAmount, hitDirection, playerWhoHit); } } public void ShootGunServerRpc(Vector3 shotgunPosition, Vector3 shotgunForward, ShotgunItem instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[ShootGunServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (Vector3.Distance(((Component)instance).transform.position, shotgunPosition) > val.grabDistance + 7f) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to shoot shotgun from too far away from shotgun position."); } else if (instance.shellsLoaded < 1) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to shoot shotgun with no ammo."); } else { instance.ShootGunClientRpc(shotgunPosition, shotgunForward); } } public void ReloadGunEffectsServerRpc(bool start, ShotgunItem instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[ReloadGunEffectsServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (!reloadGunEffectsOnCooldown.TryGetValue(value, out var value2) || !value2) { ((MonoBehaviour)Instance).StartCoroutine(ReloadGunEffectsCooldown(value)); int num = instance.FindAmmoInInventory(); if (num != -1 && instance.shellsLoaded < 2) { val.DestroyItemInSlot(num); instance.shellsLoaded++; instance.ReloadGunEffectsServerRpc(start); } } } public void GrabObjectServerRpc(NetworkObjectReference grabbedObject, PlayerControllerB instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[GrabObjectServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (val.isPlayerDead) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to pickup an object while they are dead on the server."); return; } if (!configLimitGrabDistance.Value) { instance.GrabObjectServerRpc(grabbedObject); return; } try { GameObject val2 = NetworkObjectReference.op_Implicit(grabbedObject); float num = Vector3.Distance(val2.transform.position, ((Component)val).transform.position); bool flag = val2.GetComponent<RagdollGrabbableObject>() == null; if (num > instance.grabDistance + 7f && flag) { Log.LogWarning((object)($"Player #{value} ({playerUsername}) " + $"Object ({((Object)val2).name}) pickup distance ({num}) is too far away. Could be desync.")); instance.GrabObjectClientRpc(false, grabbedObject); } else { instance.GrabObjectServerRpc(grabbedObject); } } catch (Exception arg) { Log.LogError((object)$"Couldn't do grab distance check. Exception: {arg}"); } } public void ThrowObjectServerRpc(NetworkObjectReference grabbedObject, bool droppedInElevator, bool droppedInShipRoom, Vector3 targetFloorPosition, int floorYRot, PlayerControllerB instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00a9: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[ThrowObjectServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } if (!configExperimentalChanges.Value) { instance.ThrowObjectServerRpc(grabbedObject, droppedInElevator, droppedInShipRoom, targetFloorPosition, floorYRot); return; } string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; GameObject val = NetworkObjectReference.op_Implicit(grabbedObject); if (val == null) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to throw an object that doesn't exist. ({grabbedObject.m_NetworkObjectId})"); return; } StunGrenadeItem val2 = default(StunGrenadeItem); if (val.TryGetComponent<StunGrenadeItem>(ref val2)) { instance.ThrowObjectServerRpc(grabbedObject, droppedInElevator, droppedInShipRoom, targetFloorPosition, floorYRot); return; } GrabbableObject val3 = default(GrabbableObject); if (!val.TryGetComponent<GrabbableObject>(ref val3)) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to throw an object that isn't a GrabbleObject. ({((Object)val).name})"); return; } Vector3 val4; Vector3 val5; if (droppedInElevator) { val4 = instance.playersManager.elevatorTransform.TransformPoint(targetFloorPosition); val5 = instance.playersManager.elevatorTransform.InverseTransformPoint(val.transform.position); } else { val4 = instance.playersManager.propsContainer.TransformPoint(targetFloorPosition); val5 = instance.playersManager.propsContainer.InverseTransformPoint(val.transform.position); } float num = Vector3.Distance(new Vector3(((Component)instance).transform.position.x, ((Component)instance).transform.position.z, 0f), new Vector3(val4.x, val4.z, 0f)); if (num > instance.grabDistance + 7f) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) threw an object to far away. ({num}) ({((Object)val).name})"); instance.ThrowObjectServerRpc(grabbedObject, instance.isInElevator, instance.isInHangarShipRoom, val5, floorYRot); } else { instance.ThrowObjectServerRpc(grabbedObject, droppedInElevator, droppedInShipRoom, targetFloorPosition, floorYRot); } } public void PlaceObjectServerRpc(NetworkObjectReference grabbedObject, NetworkObjectReference parentObject, Vector3 placePositionOffset, bool matchRotationOfParent, PlayerControllerB instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_0101: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[ThrowObjectServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } if (!configExperimentalChanges.Value) { instance.PlaceObjectServerRpc(grabbedObject, parentObject, placePositionOffset, matchRotationOfParent); return; } _ = StartOfRound.Instance.allPlayerScripts[value].playerUsername; GameObject val = NetworkObjectReference.op_Implicit(parentObject); GameObject val2 = NetworkObjectReference.op_Implicit(grabbedObject); try { if (Vector3.Distance(((Component)instance).transform.position, val.transform.position) > instance.grabDistance + 7f) { Vector3 val3 = ((!instance.isInElevator) ? instance.playersManager.propsContainer.InverseTransformPoint(val2.transform.position) : instance.playersManager.elevatorTransform.InverseTransformPoint(val2.transform.position)); instance.ThrowObjectServerRpc(grabbedObject, instance.isInElevator, instance.isInHangarShipRoom, val3, (int)((Component)instance).transform.localEulerAngles.x); return; } } catch (Exception ex) { Log.LogError((object)ex); } instance.PlaceObjectServerRpc(grabbedObject, parentObject, placePositionOffset, matchRotationOfParent); } public void AddObjectToDeskServerRpc(NetworkObjectReference grabbableObjectNetObject, DepositItemsDesk instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[ThrowObjectServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } if (!configExperimentalChanges.Value) { instance.AddObjectToDeskServerRpc(grabbableObjectNetObject); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; string playerUsername = val.playerUsername; GameObject val2 = NetworkObjectReference.op_Implicit(grabbableObjectNetObject); if (val2 == null) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) sent a grabbable object that doesn't exist. ({((NetworkObjectReference)(ref grabbableObjectNetObject)).NetworkObjectId})"); return; } float num = Vector3.Distance(((Component)val).transform.position, ((Component)instance.deskObjectsContainer).transform.position); if (num > val.grabDistance + 7f) { ManualLogSource log = Log; string text = $"Player #{value} ({playerUsername}) put item on desk too far away. ({num}) "; GrabbableObject component = val2.GetComponent<GrabbableObject>(); log.LogWarning((object)(text + ((component != null) ? ((Object)component).name : null))); } else { instance.AddObjectToDeskServerRpc(grabbableObjectNetObject); } } public void SetShipLightsServerRpc(bool setLightsOn, ShipLights instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[SetShipLightsServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); } else if (senderClientId == 0L) { StartOfRound.Instance.shipRoomLights.SetShipLightsServerRpc(setLightsOn); } else if (!shipLightsOnCooldown) { ((MonoBehaviour)Instance).StartCoroutine(ShipLightsCooldown()); string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; if (StartOfRound.Instance.allPlayerScripts[value].isPlayerDead) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) tried to toggle ship lights while they are dead on the server."); } else { instance.SetShipLightsServerRpc(setLightsOn); } } } public void UseSignalTranslatorServerRpc(string signalMessage, HUDManager instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[UseSignalTranslatorServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } string playerUsername = StartOfRound.Instance.allPlayerScripts[value].playerUsername; if (StartOfRound.Instance.allPlayerScripts[value].isPlayerDead) { Log.LogWarning((object)($"Player #{value} ({playerUsername}) tried to send a Signal Translator message while they are dead on the server." + " Message: (" + signalMessage + ")")); return; } if (configLogSignalTranslatorMessages.Value) { Log.LogWarning((object)$"Player #{value} ({playerUsername}) sent signal translator message: ({signalMessage})"); } instance.UseSignalTranslatorServerRpc(signalMessage); } public void TeleportPlayerServerRpc(int playerObj, EntranceTeleport instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[TeleportPlayerServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } if (senderClientId == 0L) { instance.TeleportPlayerServerRpc(playerObj); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (playerObj != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to teleport another player using an entrance teleport)"); return; } float num = Vector3.Distance(instance.entrancePoint.position, ((Component)val).transform.position); if (num > 10f) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) too far away from entrance to teleport ({num})"); return; } Transform exitPoint = instance.exitPoint; if ((Object)(object)exitPoint == (Object)null) { instance.FindExitPoint(); exitPoint = instance.exitPoint; } playerPositions[(ulong)value] = exitPoint.position; instance.TeleportPlayerServerRpc(playerObj); } public void PressTeleportButtonServerRpc(ShipTeleporter instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[PressTeleportButtonServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); } else { if (pressTeleportButtonOnCooldown) { return; } ((MonoBehaviour)Instance).StartCoroutine(PressTeleportButtonCooldown()); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (val.isPlayerDead) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to press teleporter button while they are dead on the server."); return; } float num = Vector3.Distance(((Component)val).transform.position, ((Component)instance.buttonTrigger).transform.position); if ((float)configLimitTeleporterButtonDistance.Value > 1f && num > (float)configLimitTeleporterButtonDistance.Value) { Log.LogWarning((object)($"Player #{value} ({val.playerUsername}) tried to press teleporter button from too far away " + $"({num})")); } else { instance.PressTeleportButtonServerRpc(); } } } public void TeleportPlayerOutServerRpc(int playerObj, Vector3 teleportPos, ShipTeleporter instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_008a: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[TeleportPlayerOutServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } if (playerObj != value) { Log.LogWarning((object)$"[TeleportPlayerOutServerRpc] playerObj ({playerObj}) != senderPlayerId ({value})"); } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; playerPositions[val.playerClientId] = ((Component)val).transform.localPosition; instance.TeleportPlayerOutServerRpc(playerObj, teleportPos); } public void UpdatePlayerPositionServerRpc(Vector3 newPos, bool inElevator, bool inShipRoom, bool exhausted, bool isPlayerGrounded, PlayerControllerB instance, ServerRpcParams _) { //IL_01ee: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) if (instance.isPlayerDead) { allowedMovement[instance.playerClientId] = false; return; } try { Vector3 val = (inElevator ? ((Component)instance).transform.localPosition : ((Component)instance).transform.position); if (!onShip.TryGetValue(instance.playerClientId, out var value) || value != inElevator) { playerPositions[instance.playerClientId] = val; positionCacheUpdateTime[instance.playerClientId] = Time.time; onShip[instance.playerClientId] = inElevator; } float time = Time.time; float num3 = positionCacheUpdateTime[instance.playerClientId]; Vector3 val2 = newPos - val; float num = Vector3.Dot(((Vector3)(ref val2)).normalized, Vector3.down); float num2 = instance.movementSpeed * (10f / Mathf.Max(instance.carryWeight, 1f)) / (float)NetworkManager.Singleton.NetworkTickSystem.TickRate; if (num > 0.3f || StartOfRound.Instance.suckingPlayersOutOfShip || StartOfRound.Instance.inShipPhase || !configExperimentalPositionCheck.Value) { instance.UpdatePlayerPositionServerRpc(newPos, inElevator, inShipRoom, exhausted, isPlayerGrounded); allowedMovement[instance.playerClientId] = true; } else if (Vector3.Distance(newPos, val) > num2 * 2f) { Vector3 val3 = Vector3.MoveTowards(val, newPos, instance.movementSpeed * 5f / (float)NetworkManager.Singleton.NetworkTickSystem.TickRate); if (Vector3.Distance(newPos, playerPositions[instance.playerClientId]) > 100f) { allowedMovement[instance.playerClientId] = false; } else { instance.UpdatePlayerPositionServerRpc(val3, inElevator, inShipRoom, exhausted, isPlayerGrounded); } } else { allowedMovement[instance.playerClientId] = true; instance.UpdatePlayerPositionServerRpc(newPos, inElevator, inShipRoom, exhausted, isPlayerGrounded); } } catch (Exception ex) { Log.LogError((object)ex); instance.UpdatePlayerPositionServerRpc(newPos, inElevator, inShipRoom, exhausted, isPlayerGrounded); } } public void UpdatePlayerRotationServerRpc(short newRot, short newYRot, PlayerControllerB instance, ServerRpcParams _) { try { if (allowedMovement[instance.playerClientId]) { instance.UpdatePlayerRotationServerRpc(newRot, newYRot); } } catch { instance.UpdatePlayerRotationServerRpc(newRot, newYRot); } } public void UpdatePlayerRotationFullServerRpc(Vector3 playerEulers, Vector3 cameraRotation, bool syncingCameraRotation, PlayerControllerB instance, ServerRpcParams _) { //IL_0024: 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_0017: 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) try { if (allowedMovement[instance.playerClientId]) { instance.UpdatePlayerRotationFullServerRpc(playerEulers, cameraRotation, syncingCameraRotation); } } catch { instance.UpdatePlayerRotationFullServerRpc(playerEulers, cameraRotation, syncingCameraRotation); } } public void UpdatePlayerAnimationServerRpc(int animationState, float animationSpeed, PlayerControllerB instance, ServerRpcParams _) { try { if (!allowedMovement[instance.playerClientId]) { instance.UpdatePlayerAnimationServerRpc(-1437577361, -1f); } else { instance.UpdatePlayerAnimationServerRpc(animationState, animationSpeed); } } catch { instance.UpdatePlayerAnimationServerRpc(animationState, animationSpeed); } } public void UpdateUsedByPlayerServerRpc(int playerNum, InteractTrigger instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[UpdateUsedByPlayerServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); } else if (senderClientId == 0L) { instance.UpdateUsedByPlayerServerRpc(playerNum); } else if (playerNum != value) { Log.LogWarning((object)$"[UpdateUsedByPlayerServerRpc] playerNum ({playerNum}) != senderPlayerId ({value})"); } else { instance.UpdateUsedByPlayerServerRpc(playerNum); } } public void StopUsingServerRpc(int playerUsing, InteractTrigger instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[StopUsingServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); } else if (senderClientId == 0L) { instance.StopUsingServerRpc(playerUsing); } else if (playerUsing != value) { Log.LogWarning((object)$"[StopUsingServerRpc] playerUsing ({playerUsing}) != senderPlayerId ({value})"); } else { instance.StopUsingServerRpc(playerUsing); } } public void UpdateAnimServerRpc(bool setBool, bool playSecondaryAudios, int playerWhoTriggered, AnimatedObjectTrigger instance, ServerRpcParams serverRpcParams) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)instance).transform; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[UpdateAnimServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } if (senderClientId == 0L) { instance.UpdateAnimServerRpc(setBool, playSecondaryAudios, playerWhoTriggered); return; } PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[value]; if (playerWhoTriggered != value) { Log.LogWarning((object)("[UpdateAnimServerRpc] " + $"playerWhoTriggered ({playerWhoTriggered}) != senderPlayerId ({value}) ({((Object)instance.triggerAnimator).name})")); return; } if (val2.isPlayerDead) { Log.LogWarning((object)($"Player #{value} ({val2.playerUsername}) " + "tried to interact with an animated object (" + ((Object)instance.triggerAnimator).name + ") while they are dead on the server.")); return; } if (((Object)instance.triggerAnimator).name.StartsWith("GarageDoorContainer")) { val = ((Component)instance).transform.Find("LeverSwitchContainer"); } float num = Vector3.Distance(((Component)instance).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[value]).transform.position); if (Vector3.Distance(val.position, ((Component)val2).transform.position) > val2.grabDistance + 7f) { Log.LogWarning((object)($"Player #{value} ({val2.playerUsername}) tried to interact with ({((Object)instance.triggerAnimator).name}) from too far away" + $" ({num})")); ClientRpcParams val3 = default(ClientRpcParams); val3.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(senderClientId) }; ClientRpcParams clientRpcParams = val3; HostFixesServerSendRpcs.Instance.UpdateAnimClientRpc(instance.boolValue, playSecondaryAudios, playerWhoTriggered, instance, clientRpcParams); } else { instance.UpdateAnimServerRpc(setBool, playSecondaryAudios, playerWhoTriggered); } } public void UpdateAnimTriggerServerRpc(AnimatedObjectTrigger instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var _)) { Log.LogError((object)$"[UpdateAnimTriggerServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); } else { instance.UpdateAnimTriggerServerRpc(); } } public void SyncAllPlayerLevelsServerRpc(int newPlayerLevel, int playerClientId, HUDManager instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[SyncAllPlayerLevelsServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (playerClientId != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to temporarily set another players level."); } else { instance.SyncAllPlayerLevelsServerRpc(newPlayerLevel, value); } } public void StartGameServerRpc(StartOfRound instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[StartGameServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } if (startGameOnCoolown.TryGetValue(value, out var value2) && value2) { ((MonoBehaviour)Instance).StartCoroutine(StartGameCooldown(value)); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (val.isPlayerDead) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to start the game while they are dead on the server."); return; } float num = Vector3.Distance(((Component)Object.FindFirstObjectByType<StartMatchLever>()).transform.position, ((Component)val).transform.position); if ((float)configLimitShipLeverDistance.Value > 1f && num > (float)configLimitShipLeverDistance.Value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to start the game while too far away ({num})."); } else if (!GameNetworkManager.Instance.gameHasStarted) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to force start the game."); } else { instance.StartGameServerRpc(); } } public void PlayLeverPullEffectsServerRpc(bool leverPulled, StartMatchLever instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[PlayLeverPullEffectsServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } if (shipLeverAnimationOnCooldown.TryGetValue(value, out var value2) && value2) { ((MonoBehaviour)Instance).StartCoroutine(ShipLeverAnimationCooldown(value)); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (val.isPlayerDead) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to pull ship lever while they are dead on the server."); return; } float num = Vector3.Distance(((Component)instance).transform.position, ((Component)val).transform.position); if ((float)configLimitShipLeverDistance.Value > 1f && num > (float)configLimitShipLeverDistance.Value) { ClientRpcParams val2 = default(ClientRpcParams); val2.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(senderClientId) }; ClientRpcParams clientRpcParams = val2; HostFixesServerSendRpcs.Instance.PlayLeverPullEffectsClientRpc(leverPulled, instance, clientRpcParams); } else { instance.PlayLeverPullEffectsServerRpc(leverPulled); } } public void SyncAlreadyHeldObjectsServerRpc(int joiningClientId, StartOfRound instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var _)) { Log.LogError((object)$"[SyncAlreadyHeldObjectsServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); } else { instance.SyncAlreadyHeldObjectsServerRpc(joiningClientId); } } public void CheckAnimationGrabPlayerServerRpc(int monsterAnimationID, int playerID, DepositItemsDesk instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[CheckAnimationGrabPlayerServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (playerID != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried spoofing CheckAnimationGrabPlayerServerRpc on another player."); } else { instance.CheckAnimationGrabPlayerServerRpc(monsterAnimationID, playerID); } } public void AttackPlayersServerRpc(DepositItemsDesk instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[AttackPlayersServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (senderClientId != 0L) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried calling AttackPlayersServerRpc."); } else { instance.AttackPlayersServerRpc(); } } public void ChangeEnemyOwnerServerRpc(ulong clientId, EnemyAI instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var _)) { Log.LogError((object)$"[ChangeEnemyOwnerServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); } else { instance.ChangeEnemyOwnerServerRpc(clientId); } } public void ActivateItemServerRpc(bool onOff, bool buttonDown, GrabbableObject instance, ServerRpcParams _) { if (!itemOnCooldown.Contains(((NetworkBehaviour)instance).NetworkObjectId)) { RemoteProp val = default(RemoteProp); NoisemakerProp val2 = default(NoisemakerProp); if (((Component)instance).TryGetComponent<RemoteProp>(ref val) || ((Component)instance).TryGetComponent<NoisemakerProp>(ref val2)) { ((MonoBehaviour)Instance).StartCoroutine(ActivateItemCooldown(((NetworkBehaviour)instance).NetworkObjectId)); } instance.ActivateItemServerRpc(onOff, buttonDown); } } public void SetMagnetOnServerRpc(bool on, StartOfRound instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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) //IL_005e: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[SetMagnetOnServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; float num = Vector3.Distance(((Component)val).transform.position, ((Component)instance.magnetLever).transform.position); if (num > val.grabDistance + 7f) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried to toggle magnet from to far away. ({num})"); } instance.SetMagnetOnServerRpc(on); } public void BuyVehicleServerRpc(int vehicleID, int newGroupCredits, bool useWarranty, Terminal instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[BuyVehicleServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (senderClientId == 0L) { instance.BuyVehicleServerRpc(vehicleID, newGroupCredits, useWarranty); return; } if (!configCheckPrices.Value) { instance.BuyVehicleServerRpc(vehicleID, newGroupCredits, useWarranty); return; } if (vehicleCosts == null) { vehicleCosts = (from noun in instance.terminalNodes.allKeywords.First((TerminalKeyword keyword) => ((Object)keyword).name == "Buy").compatibleNouns where noun.result.buyVehicleIndex != -1 group noun by noun.result.buyItemIndex into noun select noun.First()).ToDictionary((CompatibleNoun vehicleNoun) => vehicleNoun.result.buyVehicleIndex, (CompatibleNoun vehicleNoun) => vehicleNoun.result.itemCost); } try { int num = (int)((float)vehicleCosts[vehicleID] * ((float)instance.itemSalesPercentages[vehicleID + instance.buyableItemsList.Length] / 100f)); int num2 = instance.groupCredits - newGroupCredits; if (num != num2 && !instance.hasWarrantyTicket) { Log.LogWarning((object)($"Player #{value} ({val.playerUsername}) credits spent does not equal cost of vehicle. " + $"Current credits: {instance.groupCredits} Vehicle cost: {num} Spent: {num2}.")); return; } } catch (KeyNotFoundException) { Log.LogWarning((object)($"Player #{value} ({val.playerUsername}) tried to buy a vehicle that is not in the buyable vehicles list. " + $"(vehicleID: {vehicleID})")); return; } instance.BuyVehicleServerRpc(vehicleID, newGroupCredits, useWarranty); } public void RemoveKeyFromIgnitionServerRpc(int driverId, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[RemoveKeyFromIgnitionServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (driverId != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried spoofing RemoveKeyFromIgnitionServerRpc on another player. ({driverId})"); } else { instance.RemoveKeyFromIgnitionServerRpc(value); } } public void RevCarServerRpc(int driverId, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[RevCarServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (driverId != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried spoofing RevCarServerRpc on another player. ({driverId})"); } else { instance.RevCarServerRpc(value); } } public void StartIgnitionServerRpc(int driverId, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[StartIgnitionServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (driverId != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried spoofing StartIgnitionServerRpc on another player. ({driverId})"); } else { instance.StartIgnitionServerRpc(value); } } public void CancelTryIgnitionServerRpc(int driverId, bool setKeyInSlot, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[CancelTryIgnitionServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (driverId != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried spoofing CancelTryIgnitionServerRpc on another player. ({driverId})"); } else { instance.CancelTryIgnitionServerRpc(value, setKeyInSlot); } } public void PassengerLeaveVehicleServerRpc(int playerId, Vector3 exitPoint, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[PassengerLeaveVehicleServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (playerId != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried spoofing PassengerLeaveVehicleServerRpc on another player. ({playerId})"); } else { instance.PassengerLeaveVehicleServerRpc(value, exitPoint); } } public void SetPlayerInControlOfVehicleServerRpc(int playerId, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[SetPlayerInControlOfVehicleServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (playerId != value) { Log.LogWarning((object)($"Player #{value} ({val.playerUsername}) tried spoofing SetPlayerInControlOfVehicleServerRpc on another player. " + $"({playerId})")); } else { instance.SetPlayerInControlOfVehicleServerRpc(value); } } public void RemovePlayerControlOfVehicleServerRpc(int playerId, Vector3 carLocation, Quaternion carRotation, bool setKeyInIgnition, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[RemovePlayerControlOfVehicleServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (playerId != value) { Log.LogWarning((object)($"Player #{value} ({val.playerUsername}) tried spoofing RemovePlayerControlOfVehicleServerRpc on another player. " + $"({playerId})")); } else { instance.RemovePlayerControlOfVehicleServerRpc(value, carLocation, carRotation, setKeyInIgnition); } } public void ShiftToGearServerRpc(int setGear, int playerId, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[ShiftToGearServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (playerId != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried spoofing ShiftToGearServerRpc on another player. ({playerId})"); } else { instance.ShiftToGearServerRpc(setGear, value); } } public void SetHonkServerRpc(bool honk, int playerId, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[SetHonkServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (playerId != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried spoofing SetHonkServerRpc on another player. ({playerId})"); } else { instance.SetHonkServerRpc(honk, value); } } public void SetRadioStationServerRpc(int radioStation, int signalQuality, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[SetRadioStationServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (radioStation < 0 || radioStation >= instance.radioClips.Length) { Log.LogWarning((object)($"Player #{value} ({val.playerUsername}) tried to set the radio to a station that doesn't exist. " + $"(radioStation: {radioStation})")); } else { instance.SetRadioStationServerRpc(radioStation, signalQuality); } } public void CarBumpServerRpc(Vector3 vel, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (serverRpcParams.Receive.SenderClientId == 0L) { instance.CarBumpServerRpc(vel); } } public void CarCollisionServerRpc(Vector3 vel, float magn, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (serverRpcParams.Receive.SenderClientId == 0L) { instance.CarCollisionServerRpc(vel, magn); } } public void DestroyCarServerRpc(int sentByClient, VehicleController instance, ServerRpcParams serverRpcParams) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value)) { Log.LogError((object)$"[DestroyCarServerRpc] Failed to get the playerId from senderClientId: {senderClientId}"); return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value]; if (sentByClient != value) { Log.LogWarning((object)$"Player #{value} ({val.playerUsername}) tried spoofing DestroyCarServerRpc on another player. ({sentByClient})"); } else { instance.DestroyCarServerRpc(value);