Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Revive v1.2.1
lethalCompanyRevive.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using InteractiveTerminalAPI.UI; using InteractiveTerminalAPI.UI.Application; using InteractiveTerminalAPI.UI.Cursor; using InteractiveTerminalAPI.UI.Screen; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using lethalCompanyRevive.Helpers; using lethalCompanyRevive.Managers; using lethalCompanyRevive.Misc; using lethalCompanyRevive.NetcodePatcher; using lethalCompanyRevive.UI.Application; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("lethalCompanyRevive")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c93d6e64ce4cfa8adf1ced92af2f7cc6d07b608b")] [assembly: AssemblyProduct("lethalCompanyRevive")] [assembly: AssemblyTitle("lethalCompanyRevive")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 lethalCompanyRevive { [BepInPlugin("com.deja.lethalcompany.lethalCompanyRevive", "Revive Crewmates", "1.2.1")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.deja.lethalcompany.lethalCompanyRevive"); public static Plugin instance; public static ManualLogSource mls; public static PluginConfig cfg { get; private set; } private void Awake() { cfg = new PluginConfig(((BaseUnityPlugin)this).Config); cfg.InitBindings(); mls = ((BaseUnityPlugin)this).Logger; instance = this; if (!cfg.EnableRevive.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Revive functionality is disabled via config."); return; } PatchAllMethods(); NetcodePatch(); InteractiveTerminalManager.RegisterApplication<ReviveApplication>("revive", false); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Revive functionality initialized."); } private void PatchAllMethods() { harmony.PatchAll(Assembly.GetExecutingAssembly()); } private static void NetcodePatch() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } } } namespace lethalCompanyRevive.UI.Application { internal class ReviveApplication : InteractiveTerminalApplication<CursorElement> { private CursorMenu<CursorElement> mainMenu; private IScreen mainScreen; public override void Initialization() { if (!Plugin.cfg.EnableRevive.Value) { CloseUI(); return; } PlayerControllerB[] players = Helper.Players; if (players == null || players.Length == 0) { ShowNoPlayersUI(); return; } PlayerControllerB[] deadPlayers = players.Where((PlayerControllerB val) => (Object)(object)val != (Object)null && val.isPlayerDead).ToArray(); if (deadPlayers.Length == 0) { ShowNoDeadPlayersUI(); return; } int singleCost = ComputeDisplayCost(); CursorElement[] array = (CursorElement[])(object)new CursorElement[deadPlayers.Length + 2]; array[0] = CursorElement.Create($"Revive All ({deadPlayers.Length * singleCost})", "", (Action)delegate { ConfirmReviveAll(deadPlayers); }, (Func<CursorElement, bool>)((CursorElement elem) => CanAffordWithDailyLimit(deadPlayers.Length * singleCost)), true); for (int num = 0; num < deadPlayers.Length; num++) { PlayerControllerB p = deadPlayers[num]; string text = $"Revive {p.playerUsername} ({singleCost})"; array[num + 1] = CursorElement.Create(text, "", (Action)delegate { ConfirmReviveSingle(p, singleCost); }, (Func<CursorElement, bool>)((CursorElement elem) => CanAffordWithDailyLimit(singleCost)), true); } array[^1] = CursorElement.Create("Exit", "", (Action)delegate { CloseUI(); }, (Func<CursorElement, bool>)null, true); mainMenu = CursorMenu<CursorElement>.Create(0, '>', array, (Func<CursorElement, CursorElement, int>[])null); mainScreen = (IScreen)(object)BoxedScreen.Create("Revive", (ITextElement[])(object)new ITextElement[3] { (ITextElement)TextElement.Create("Select a dead player or revive them all."), (ITextElement)TextElement.Create(" "), (ITextElement)mainMenu }); ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(mainScreen, (BaseCursorMenu<CursorElement>)(object)mainMenu, true); } private int ComputeDisplayCost() { string text = Plugin.cfg.ReviveCostAlgorithm.Value.ToLower(); int value = Plugin.cfg.BaseReviveCost.Value; switch (text) { case "flat": return value; case "exponential": return value; default: { if ((Object)(object)TimeOfDay.Instance == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null) { return 100; } float num = TimeOfDay.Instance.profitQuota; int num2 = StartOfRound.Instance.connectedPlayersAmount + 1; int num3 = (int)(num / (float)num2); if (num3 < 1) { num3 = 1; } return num3; } } } private bool CanAffordWithDailyLimit(int neededCredits) { if ((Object)(object)ReviveStore.Instance != (Object)null && !ReviveStore.Instance.CanReviveNow()) { return false; } Terminal terminal = Helper.Terminal; if ((Object)(object)terminal != (Object)null) { return terminal.groupCredits >= neededCredits; } return false; } private void ConfirmReviveSingle(PlayerControllerB p, int cost) { if (!CanAffordWithDailyLimit(cost)) { base.ErrorMessage("Revive", (Action)delegate { ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(mainScreen, (BaseCursorMenu<CursorElement>)(object)mainMenu, true); }, "Not enough credits or daily limit reached."); return; } base.Confirm("Revive", $"Revive {p.playerUsername} for {cost} credits?", (Action)delegate { DoReviveSingle(p); }, (Action)delegate { ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(mainScreen, (BaseCursorMenu<CursorElement>)(object)mainMenu, true); }, ""); } private void DoReviveSingle(PlayerControllerB p) { if ((Object)(object)ReviveStore.Instance == (Object)null) { base.ErrorMessage("Revive", (Action)delegate { ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(mainScreen, (BaseCursorMenu<CursorElement>)(object)mainMenu, true); }, "ReviveStore missing."); return; } ReviveStore.Instance.RequestReviveServerRpc(p.playerClientId); base.ErrorMessage("Revive", (Action)delegate { CloseUI(); }, "Reviving " + p.playerUsername + "..."); } private void ConfirmReviveAll(PlayerControllerB[] players) { int num = ComputeDisplayCost(); int num2 = players.Length * num; if (!CanAffordWithDailyLimit(num2)) { base.ErrorMessage("Revive", (Action)delegate { ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(mainScreen, (BaseCursorMenu<CursorElement>)(object)mainMenu, true); }, "Not enough credits or daily limit reached."); return; } StringBuilder stringBuilder = new StringBuilder("Revive all:\n\n"); PlayerControllerB[] array = players; foreach (PlayerControllerB val in array) { stringBuilder.AppendLine(val.playerUsername); } stringBuilder.AppendLine($"\nTotal Cost: {num2}"); base.Confirm("Revive All", stringBuilder.ToString(), (Action)delegate { DoReviveAll(players); }, (Action)delegate { ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(mainScreen, (BaseCursorMenu<CursorElement>)(object)mainMenu, true); }, ""); } private void DoReviveAll(PlayerControllerB[] players) { if ((Object)(object)ReviveStore.Instance == (Object)null) { base.ErrorMessage("Revive", (Action)delegate { ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(mainScreen, (BaseCursorMenu<CursorElement>)(object)mainMenu, true); }, "ReviveStore missing."); return; } foreach (PlayerControllerB val in players) { if ((Object)(object)val != (Object)null && val.isPlayerDead) { ReviveStore.Instance.RequestReviveServerRpc(val.playerClientId); } } base.ErrorMessage("Revive", (Action)delegate { CloseUI(); }, "Reviving all dead players..."); } private void ShowNoPlayersUI() { CursorMenu<CursorElement> val = CursorMenu<CursorElement>.Create(0, '>', (CursorElement[])(object)new CursorElement[1] { CursorElement.Create("Exit", "", (Action)delegate { CloseUI(); }, (Func<CursorElement, bool>)null, true) }, (Func<CursorElement, CursorElement, int>[])null); mainScreen = (IScreen)(object)BoxedScreen.Create("Revive", (ITextElement[])(object)new ITextElement[3] { (ITextElement)TextElement.Create("No players found."), (ITextElement)TextElement.Create(" "), (ITextElement)val }); ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(mainScreen, (BaseCursorMenu<CursorElement>)(object)val, true); } private void ShowNoDeadPlayersUI() { CursorMenu<CursorElement> val = CursorMenu<CursorElement>.Create(0, '>', (CursorElement[])(object)new CursorElement[1] { CursorElement.Create("Exit", "", (Action)delegate { CloseUI(); }, (Func<CursorElement, bool>)null, true) }, (Func<CursorElement, CursorElement, int>[])null); mainScreen = (IScreen)(object)BoxedScreen.Create("Revive", (ITextElement[])(object)new ITextElement[3] { (ITextElement)TextElement.Create("No dead players to revive."), (ITextElement)TextElement.Create(" "), (ITextElement)val }); ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(mainScreen, (BaseCursorMenu<CursorElement>)(object)val, true); } private void CloseUI() { if ((Object)(object)InteractiveTerminalManager.Instance != (Object)null) { Object.Destroy((Object)(object)((Component)InteractiveTerminalManager.Instance).gameObject); } } } } namespace lethalCompanyRevive.Patches { [HarmonyPatch(typeof(GameNetworkManager))] internal static class DisconnectPatch { [HarmonyPostfix] [HarmonyPatch("Disconnect")] private static void OnGameDisconnect() { if ((Object)(object)ReviveStore.Instance != (Object)null) { ReviveStore.Instance.ResetAllValues(); NetworkObject component = ((Component)ReviveStore.Instance).GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && component.IsSpawned) { component.Despawn(true); } else { Object.Destroy((Object)(object)((Component)ReviveStore.Instance).gameObject); } } } } [HarmonyPatch(typeof(StartOfRound))] [HarmonyPatch("PassTimeToNextDay")] public static class PassTimeResetRevivesPatch { [HarmonyPostfix] public static void Postfix() { if ((Object)(object)ReviveStore.Instance != (Object)null) { ReviveStore.Instance.ResetDailyRevives(); Helper.PrintSystem("[ReviveStore] Daily revives reset at the start of the new day/round."); } } } } namespace lethalCompanyRevive.Network { [HarmonyPatch] public class ReviveNetworkManager { private static GameObject networkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Init() { if (!((Object)(object)networkPrefab != (Object)null)) { networkPrefab = NetworkPrefabs.CreateNetworkPrefab("ReviveStore"); networkPrefab.AddComponent<ReviveStore>(); NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkHandler() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity).GetComponent<NetworkObject>().Spawn(false); } } } } namespace lethalCompanyRevive.Misc { public class CustomTerminalNode { public string Name; public int[] Prices; public int UnlockPrice; public string Description; public GameObject Prefab; public bool Unlocked; public float salePerc = 1f; public CustomTerminalNode(string name, int unlockPrice, string description, GameObject prefab, int[] prices = null) { if (prices == null) { prices = new int[0]; } Name = name; Prices = prices; Description = description; Prefab = prefab; UnlockPrice = unlockPrice; } public static CustomTerminalNode CreateReviveNode() { return new CustomTerminalNode("Revive", 100, "Revive a fallen teammate", null); } public CustomTerminalNode Copy() { return new CustomTerminalNode(Name, UnlockPrice, Description, Prefab, Prices); } } public class PluginConfig { private readonly ConfigFile configFile; public ConfigEntry<bool> EnableRevive; public ConfigEntry<int> BaseReviveCost; public ConfigEntry<string> ReviveCostAlgorithm; public ConfigEntry<bool> EnableMaxRevivesPerDay; public ConfigEntry<int> MaxRevivesPerDay; public PluginConfig(ConfigFile file) { configFile = file; } public void InitBindings() { EnableRevive = configFile.Bind<bool>("General", "EnableRevive", true, "Enable or disable the entire revive feature."); BaseReviveCost = configFile.Bind<int>("Costs", "BaseReviveCost", 100, "Base cost used in the revive formula. Only used for Flat and Exponential"); ReviveCostAlgorithm = configFile.Bind<string>("Costs", "ReviveCostAlgorithm", "Quota", "How the revive cost is calculated: Flat, Exponential, or Quota. Exponential is untested"); EnableMaxRevivesPerDay = configFile.Bind<bool>("Limits", "EnableMaxRevivesPerDay", false, "If true, limits how many revives can happen each real-life day."); MaxRevivesPerDay = configFile.Bind<int>("Limits", "MaxRevivesPerDay", 3, "Max revives allowed per day (if EnableMaxRevivesPerDay is true)."); } } internal static class Metadata { public const string GUID = "com.deja.lethalcompany.lethalCompanyRevive"; public const string NAME = "Revive Crewmates"; public const string VERSION = "1.2.1"; } public class Reflector { private const BindingFlags privateOrInternal = BindingFlags.Instance | BindingFlags.NonPublic; private const BindingFlags internalStatic = BindingFlags.Static | BindingFlags.NonPublic; private const BindingFlags internalField = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField; private const BindingFlags internalStaticField = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetField; private const BindingFlags internalProperty = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty; private const BindingFlags internalMethod = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod; private const BindingFlags internalStaticMethod = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod; private object Obj { get; } private Type ObjType { get; } private Reflector(object obj) { Obj = obj; ObjType = obj.GetType(); } private T GetField<T>(string variableName, BindingFlags flags) { try { return (T)ObjType.GetField(variableName, flags).GetValue(Obj); } catch (InvalidCastException) { return default(T); } } private Reflector GetProperty(string propertyName, BindingFlags flags) { try { return new Reflector(ObjType.GetProperty(propertyName, flags).GetValue(Obj, null)); } catch { return null; } } private Reflector SetField(string variableName, object value, BindingFlags flags) { try { ObjType.GetField(variableName, flags).SetValue(Obj, value); return this; } catch { return null; } } private Reflector SetProperty(string propertyName, object value, BindingFlags flags) { try { ObjType.GetProperty(propertyName, flags).SetValue(Obj, value, null); return this; } catch { return null; } } private T InvokeMethod<T>(string methodName, BindingFlags flags, params object[] args) { try { return (T)ObjType.GetMethod(methodName, flags).Invoke(Obj, args); } catch (InvalidCastException) { return default(T); } } public T GetInternalField<T>(string variableName) { return GetField<T>(variableName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField); } public T GetInternalStaticField<T>(string variableName) { return GetField<T>(variableName, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetField); } public Reflector GetInternalField(string variableName) { object obj = GetInternalField<object>(variableName); if (obj != null) { return new Reflector(obj); } return null; } public Reflector GetInternalStaticField(string variableName) { object obj = GetInternalStaticField<object>(variableName); if (obj != null) { return new Reflector(obj); } return null; } public Reflector SetInternalField(string variableName, object value) { return SetField(variableName, value, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField); } public Reflector SetInternalStaticField(string variableName, object value) { return SetField(variableName, value, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetField); } public Reflector GetInternalProperty(string propertyName) { return GetProperty(propertyName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty); } public Reflector SetInternalProperty(string propertyName, object value) { return SetProperty(propertyName, value, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty); } public T InvokeInternalMethod<T>(string methodName, params object[] args) { return InvokeMethod<T>(methodName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, args); } public Reflector InvokeInternalMethod(string methodName, params object[] args) { object obj = InvokeInternalMethod<object>(methodName, args); if (obj != null) { return new Reflector(obj); } return null; } public static Reflector Target(object obj) { return new Reflector(obj); } } public readonly ref struct Result { public bool Success { get; } public string? Message { get; } public Result(bool success, string? message = null) { Success = success; Message = message; } public Result(string message) : this(success: false, message) { } } } namespace lethalCompanyRevive.Managers { public class ReviveStore : NetworkBehaviour { private int dailyRevivesUsed; public static ReviveStore Instance { get; private set; } public override void OnNetworkSpawn() { if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && (Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { NetworkObject component = ((Component)Instance).GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && component.IsSpawned) { component.Despawn(true); } } Instance = this; ((NetworkBehaviour)this).OnNetworkSpawn(); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } [ServerRpc(RequireOwnership = false)] public void RequestReviveServerRpc(ulong playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1810806528u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1810806528u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!Plugin.cfg.EnableRevive.Value || !CanReviveNow()) { return; } PlayerControllerB playerBySlot = GetPlayerBySlot(playerId); if (!((Object)(object)playerBySlot == (Object)null) && playerBySlot.isPlayerDead) { int cost = ComputeReviveCost(dailyRevivesUsed); if (CanAfford(cost)) { DeductCredits(cost); ReviveSinglePlayer(playerBySlot); dailyRevivesUsed++; } } } public void ResetDailyRevives() { dailyRevivesUsed = 0; } public bool CanReviveNow() { if (!Plugin.cfg.EnableRevive.Value) { return false; } if (Plugin.cfg.EnableMaxRevivesPerDay.Value && dailyRevivesUsed >= Plugin.cfg.MaxRevivesPerDay.Value) { return false; } return true; } private static Terminal GetTerminal() { return Object.FindObjectOfType<Terminal>(); } private static PlayerControllerB GetPlayerBySlot(ulong playerId) { PlayerControllerB[] array = StartOfRound.Instance?.allPlayerScripts; if (array == null || playerId >= (ulong)array.Length) { return null; } return array[playerId]; } private bool CanAfford(int cost) { Terminal terminal = GetTerminal(); if ((Object)(object)terminal != (Object)null) { return terminal.groupCredits >= cost; } return false; } private void DeductCredits(int cost) { Terminal terminal = GetTerminal(); if (!((Object)(object)terminal == (Object)null)) { terminal.groupCredits -= cost; SyncCreditsClientRpc(terminal.groupCredits); } } [ClientRpc] private void SyncCreditsClientRpc(int newCredits) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2107201390u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, newCredits); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2107201390u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Terminal terminal = GetTerminal(); if ((Object)(object)terminal != (Object)null) { terminal.groupCredits = newCredits; } } } private int ComputeReviveCost(int usageIndex) { string text = Plugin.cfg.ReviveCostAlgorithm.Value.ToLower(); int value = Plugin.cfg.BaseReviveCost.Value; switch (text) { case "flat": return value; case "exponential": return (int)((float)value * Mathf.Pow(2f, (float)usageIndex)); default: { if ((Object)(object)TimeOfDay.Instance == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null) { return 100; } int num = StartOfRound.Instance.connectedPlayersAmount + 1; int num2 = (int)((float)TimeOfDay.Instance.profitQuota / (float)num); if (num2 < 1) { num2 = 1; } return num2; } } } private void ReviveSinglePlayer(PlayerControllerB p) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Vector3 playerSpawnPosition = GetPlayerSpawnPosition(GetPlayerIndex(p), simpleTeleport: false); RevivePlayerClientRpc(playerSpawnPosition, new NetworkBehaviourReference((NetworkBehaviour)(object)p)); } [ClientRpc] private void RevivePlayerClientRpc(Vector3 spawnPosition, NetworkBehaviourReference netRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2289497067u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref spawnPosition); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkBehaviourReference>(ref netRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2289497067u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkBehaviour val3 = default(NetworkBehaviour); if (!((NetworkBehaviourReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null)) { return; } PlayerControllerB component = ((Component)val3).GetComponent<PlayerControllerB>(); if ((Object)(object)component == (Object)null) { return; } StartOfRound instance = StartOfRound.Instance; int playerIndex = GetPlayerIndex(component); if (playerIndex < 0) { return; } component.ResetPlayerBloodObjects(component.isPlayerDead); component.isClimbingLadder = false; component.clampLooking = false; component.inVehicleAnimation = false; if ((Object)(object)component.gameplayCamera != (Object)null) { Vector3 localEulerAngles = ((Component)component.gameplayCamera).transform.localEulerAngles; ((Component)component.gameplayCamera).transform.localEulerAngles = new Vector3(localEulerAngles.x, 0f, localEulerAngles.z); } component.overridePoisonValue = false; component.disableMoveInput = false; component.disableLookInput = false; component.disableInteract = false; component.ResetZAndXRotation(); ((Collider)component.thisController).enabled = true; component.health = 100; component.hasBeenCriticallyInjured = false; component.disableSyncInAnimation = false; if ((Object)(object)component.nightVisionRadar != (Object)null) { ((Behaviour)component.nightVisionRadar).enabled = false; } if (component.isPlayerDead) { component.isPlayerDead = false; component.enemyWaitingForBodyRagdoll = null; component.isPlayerControlled = true; component.isInElevator = true; component.isInHangarShipRoom = true; component.isInsideFactory = false; component.parentedToElevatorLastFrame = false; component.overrideGameOverSpectatePivot = null; if (((NetworkBehaviour)component).IsOwner) { instance.SetPlayerObjectExtrapolate(false); } component.TeleportPlayer(spawnPosition, false, 0f, false, true); component.setPositionOfDeadPlayer = false; component.DisablePlayerModel(instance.allPlayerObjects[playerIndex], true, true); ((Behaviour)component.helmetLight).enabled = false; component.Crouch(false); component.criticallyInjured = false; if ((Object)(object)component.playerBodyAnimator != (Object)null) { component.playerBodyAnimator.SetBool("Limp", false); } component.bleedingHeavily = false; component.activatingItem = false; component.twoHanded = false; component.inShockingMinigame = false; component.inSpecialInteractAnimation = false; component.freeRotationInInteractAnimation = false; component.inAnimationWithEnemy = null; component.holdingWalkieTalkie = false; component.speakingToWalkieTalkie = false; component.isSinking = false; component.isUnderwater = false; component.sinkingValue = 0f; component.statusEffectAudio.Stop(); component.DisableJetpackControlsLocally(); component.health = 100; component.mapRadarDotAnimator.SetBool("dead", false); component.externalForceAutoFade = Vector3.zero; component.carryWeight = 1f; if (((NetworkBehaviour)component).IsOwner) { HUDManager.Instance.SetCracksOnVisor(100f); HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false); component.hasBegunSpectating = false; HUDManager.Instance.RemoveSpectateUI(); HUDManager.Instance.gameOverAnimator.SetTrigger("revive"); component.hinderedMultiplier = 1f; component.isMovementHindered = 0; component.sourcesCausingSinking = 0; instance.SendChangedWeightEvent(); component.reverbPreset = instance.shipReverb; } } component.voiceMuffledByEnemy = false; SoundManager.Instance.playerVoicePitchTargets[playerIndex] = 1f; SoundManager.Instance.SetPlayerPitch(1f, playerIndex); if ((Object)(object)component.currentVoiceChatIngameSettings == (Object)null) { instance.RefreshPlayerVoicePlaybackObjects(); } if ((Object)(object)component.currentVoiceChatIngameSettings != (Object)null) { if ((Object)(object)component.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { component.currentVoiceChatIngameSettings.InitializeComponents(); } if ((Object)(object)component.currentVoiceChatIngameSettings.voiceAudio != (Object)null) { ((Component)component.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>().overridingLowPass = false; } } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)(object)component) { HUDManager.Instance.spitOnCameraAlpha = 1f; HUDManager.Instance.cadaverFilter = 0f; SoundManager.Instance.earsRingingTimer = 0f; SoundManager.Instance.alternateEarsRinging = false; localPlayerController.bleedingHeavily = false; localPlayerController.criticallyInjured = false; if ((Object)(object)localPlayerController.playerBodyAnimator != (Object)null) { localPlayerController.playerBodyAnimator.SetBool("Limp", false); } localPlayerController.health = 100; HUDManager.Instance.UpdateHealthUI(100, false); localPlayerController.spectatedPlayerScript = null; ((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false; instance.SetSpectateCameraToGameOverMode(false, localPlayerController); HUDManager.Instance.HideHUD(false); } if ((Object)(object)localPlayerController != (Object)null && ((Object)(object)localPlayerController == (Object)(object)component || localPlayerController.isPlayerDead)) { ResetSpectateUI(); } RemovePlayerBody(component, playerIndex); if (((NetworkBehaviour)this).IsServer) { SyncLivingPlayers(); } instance.UpdatePlayerVoiceEffects(); } private void RemovePlayerBody(PlayerControllerB plr, int playerIndex) { //IL_0063: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) RagdollGrabbableObject[] array = Object.FindObjectsOfType<RagdollGrabbableObject>(); foreach (RagdollGrabbableObject val in array) { if (val.bodyID == playerIndex || ((Object)(object)val.ragdoll != (Object)null && val.ragdoll.playerObjectId == playerIndex)) { if (((GrabbableObject)val).isHeld && (Object)(object)((GrabbableObject)val).playerHeldBy != (Object)null) { ((GrabbableObject)val).playerHeldBy.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); } if (((NetworkBehaviour)this).IsServer && (Object)(object)((NetworkBehaviour)val).NetworkObject != (Object)null && ((NetworkBehaviour)val).NetworkObject.IsSpawned) { ((NetworkBehaviour)val).NetworkObject.Despawn(true); } else if (!Object.op_Implicit((Object)(object)((NetworkBehaviour)val).NetworkObject) || !((NetworkBehaviour)val).NetworkObject.IsSpawned) { Object.Destroy((Object)(object)((Component)val).gameObject); } } } DeadBodyInfo[] array2 = Object.FindObjectsOfType<DeadBodyInfo>(true); foreach (DeadBodyInfo val2 in array2) { if (val2.playerObjectId == playerIndex) { Object.Destroy((Object)(object)((Component)val2).gameObject); } } plr.deadBody = null; } private static void ResetSpectateUI() { HUDManager instance = HUDManager.Instance; instance.RemoveSpectateUI(); Reflector.Target(instance).SetInternalField("boxesAdded", 0); } private void SyncLivingPlayers() { StartOfRound instance = StartOfRound.Instance; int num = 0; PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead) { num++; } } instance.livingPlayers = num; instance.allPlayersDead = num == 0; SyncLivingPlayersClientRpc(num, instance.allPlayersDead); } [ClientRpc] private void SyncLivingPlayersClientRpc(int newLiving, bool allDead) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1421352405u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, newLiving); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref allDead, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1421352405u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; StartOfRound instance = StartOfRound.Instance; instance.livingPlayers = newLiving; instance.allPlayersDead = allDead; } } } private static int GetPlayerIndex(PlayerControllerB player) { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return -1; } return Array.IndexOf(instance.allPlayerScripts, player); } private Vector3 GetPlayerSpawnPosition(int playerNum, bool simpleTeleport) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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_01ec: 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) //IL_0100: 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) //IL_010f: 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_01c8: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.playerSpawnPositions == null) { return Vector3.zero; } Transform[] playerSpawnPositions = instance.playerSpawnPositions; if (playerSpawnPositions.Length == 0) { return Vector3.zero; } if (simpleTeleport || playerNum < 0 || playerNum >= playerSpawnPositions.Length) { return playerSpawnPositions[0].position; } if (!Physics.CheckSphere(playerSpawnPositions[playerNum].position, 0.2f, 67108864, (QueryTriggerInteraction)1)) { return playerSpawnPositions[playerNum].position; } if (!Physics.CheckSphere(playerSpawnPositions[playerNum].position + Vector3.up, 0.2f, 67108864, (QueryTriggerInteraction)1)) { return playerSpawnPositions[playerNum].position + Vector3.up * 0.5f; } for (int i = 0; i < playerSpawnPositions.Length; i++) { if (i != playerNum) { if (!Physics.CheckSphere(playerSpawnPositions[i].position, 0.12f, -67108865, (QueryTriggerInteraction)1)) { return playerSpawnPositions[i].position; } if (!Physics.CheckSphere(playerSpawnPositions[i].position + Vector3.up, 0.12f, 67108864, (QueryTriggerInteraction)1)) { return playerSpawnPositions[i].position + Vector3.up * 0.5f; } } } Random random = new Random(65); float y = playerSpawnPositions[0].position.y; Vector3 val = default(Vector3); for (int j = 0; j < 15; j++) { Bounds bounds = instance.shipInnerRoomBounds.bounds; int minValue = (int)((Bounds)(ref bounds)).min.x; int maxValue = (int)((Bounds)(ref bounds)).max.x; int minValue2 = (int)((Bounds)(ref bounds)).min.z; int maxValue2 = (int)((Bounds)(ref bounds)).max.z; float num = random.Next(minValue, maxValue); float num2 = random.Next(minValue2, maxValue2); ((Vector3)(ref val))..ctor(num, y, num2); if (!Physics.CheckSphere(val, 0.12f, 67108864, (QueryTriggerInteraction)1)) { return val; } } return playerSpawnPositions[0].position + Vector3.up * 0.5f; } public void ResetAllValues() { dailyRevivesUsed = 0; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1810806528u, new RpcReceiveHandler(__rpc_handler_1810806528), "RequestReviveServerRpc"); ((NetworkBehaviour)this).__registerRpc(2107201390u, new RpcReceiveHandler(__rpc_handler_2107201390), "SyncCreditsClientRpc"); ((NetworkBehaviour)this).__registerRpc(2289497067u, new RpcReceiveHandler(__rpc_handler_2289497067), "RevivePlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(1421352405u, new RpcReceiveHandler(__rpc_handler_1421352405), "SyncLivingPlayersClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1810806528(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((ReviveStore)(object)target).RequestReviveServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2107201390(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int newCredits = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newCredits); target.__rpc_exec_stage = (__RpcExecStage)1; ((ReviveStore)(object)target).SyncCreditsClientRpc(newCredits); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2289497067(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 spawnPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnPosition); NetworkBehaviourReference netRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ReviveStore)(object)target).RevivePlayerClientRpc(spawnPosition, netRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1421352405(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int newLiving = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newLiving); bool allDead = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref allDead, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ReviveStore)(object)target).SyncLivingPlayersClientRpc(newLiving, allDead); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ReviveStore"; } } } namespace lethalCompanyRevive.Helpers { public static class Helper { public static HUDManager? HUDManager => HUDManager.Instance; public static RoundManager? RoundManager => RoundManager.Instance; public static PlayerControllerB? LocalPlayer => GameNetworkManager.Instance.localPlayerController; public static PlayerControllerB[]? Players => StartOfRound?.allPlayerScripts; public static StartOfRound? StartOfRound => StartOfRound.Instance; public static Terminal? Terminal { get { if (HUDManager != null) { return Reflector.Target(HUDManager).GetInternalField<Terminal>("terminalScript"); } return null; } } public static void PrintSystem(string? message) { if (message == null) { Console.WriteLine("SYSTEM: [null message]"); } else { Console.WriteLine("SYSTEM: " + message); } } public static Vector3 Copy(this Vector3 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) return new Vector3(vector.x, vector.y, vector.z); } public static Quaternion Copy(this Quaternion quaternion) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0018: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(quaternion.x, quaternion.y, quaternion.z, quaternion.w); } public static GameObject Copy(this Transform transform) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown GameObject val = new GameObject(); val.transform.position = transform.position.Copy(); val.transform.eulerAngles = transform.eulerAngles.Copy(); return val; } public static PlayerControllerB? GetPlayer(string playerNameOrId) { PlayerControllerB[] players = Players; Debug.Log((object)$"Players: {players}"); if (players == null || players.Length == 0) { Debug.Log((object)"No players found."); return null; } Debug.Log((object)("Searching for player with name or ID: " + playerNameOrId)); PlayerControllerB val = ((IEnumerable<PlayerControllerB>)players).FirstOrDefault((Func<PlayerControllerB, bool>)delegate(PlayerControllerB player) { if ((Object)(object)player != (Object)null) { Debug.Log((object)("Checking player: " + player.playerUsername)); return player.playerUsername == playerNameOrId; } return false; }); if ((Object)(object)val != (Object)null) { Debug.Log((object)("Found player by name: " + val.playerUsername)); return val; } PlayerControllerB val2 = ((IEnumerable<PlayerControllerB>)players).FirstOrDefault((Func<PlayerControllerB, bool>)delegate(PlayerControllerB player) { if ((Object)(object)player != (Object)null) { Debug.Log((object)$"Checking player ID: {player.playerClientId}"); return player.playerClientId.ToString() == playerNameOrId; } return false; }); if ((Object)(object)val2 != (Object)null) { Debug.Log((object)("Found player by ID: " + val2.playerUsername)); return val2; } Debug.Log((object)"Player not found."); return null; } public static PlayerControllerB? GetPlayer(int playerId) { return GetPlayer(playerId.ToString()); } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace lethalCompanyRevive.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }