using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TestLCMod.Helpers; using TestLCMod.Patches; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("TestLCMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TestLCMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a47b7a78-c334-49eb-b647-dafe5266f9a2")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace TestLCMod { [BepInPlugin("SneakyDeeCee.TestLCMod", "LC Tutorial Mod", "1.0.0.0")] public class TestLCModeBase : BaseUnityPlugin { private const string modGUID = "SneakyDeeCee.TestLCMod"; private const string modName = "LC Tutorial Mod"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("SneakyDeeCee.TestLCMod"); public static TestLCModeBase Instance; public static ManualLogSource mls; internal static PlayerControllerB playerRef; internal static StartOfRound startOfRoundRef; internal static bool didSpawnTestBody; internal static bool isReviving; internal static bool isTesting; public Reviver reviver; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("SneakyDeeCee.TestLCMod"); mls.LogInfo((object)"The test mod has awoken!!"); reviver = new Reviver(); harmony.PatchAll(typeof(TestLCModeBase)); harmony.PatchAll(typeof(PlayerControllerBPatch)); } public void revivePlayer(int reviverId, int playerId) { if (!isReviving) { isReviving = true; mls.LogInfo((object)("Reviving Player (id:" + playerId + ")")); reviver.revivePlayerServerRpc(reviverId, playerId); isReviving = false; } } } } namespace TestLCMod.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void checkHoldingPlayer(ref PlayerControllerB __instance) { //IL_0065: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < __instance.ItemSlots.Length; i++) { GrabbableObject val = __instance.ItemSlots[i]; if ((Object)(object)val != (Object)null) { if (i == 0 && !TestLCModeBase.didSpawnTestBody && TestLCModeBase.isTesting) { TestLCModeBase.didSpawnTestBody = true; TestLCModeBase.mls.LogInfo((object)"Spawning TEST BODY"); Object.Instantiate(__instance.playersManager.playerRagdolls[0], __instance.thisPlayerBody.position + Vector3.up * 1.32f, __instance.thisPlayerBody.rotation, (Transform)null); GameObject obj = Object.Instantiate(StartOfRound.Instance.ragdollGrabbableObjectPrefab, __instance.thisPlayerBody.position + Vector3.up * 1.32f, __instance.thisPlayerBody.rotation, (Transform)null); obj.GetComponent().testBody = true; obj.GetComponent().Spawn(false); } if (((object)val).GetType() == typeof(RagdollGrabbableObject)) { int playerObjectId = ((Component)val).GetComponent().ragdoll.playerObjectId; TestLCModeBase.Instance.revivePlayer((int)__instance.actualClientId, playerObjectId); } } } } } } namespace TestLCMod.Helpers { public class Reviver : NetworkBehaviour { [ServerRpc(RequireOwnership = false)] public void revivePlayerServerRpc(int reviverId, int toReviveId) { TestLCModeBase.mls.LogInfo((object)("[SERVER]: Player " + reviverId + " is reviving player " + toReviveId)); revivePlayerClientRpc(reviverId, toReviveId); } [ClientRpc] public void revivePlayerClientRpc(int reviverId, int toReviveId) { //IL_0118: Unknown result type (might be due to invalid IL or missing references) TestLCModeBase.mls.LogInfo((object)("[CLIENT]: Player " + reviverId + " is reviving player " + toReviveId)); PlayerControllerB val = null; GameObject val2 = StartOfRound.Instance.allPlayerObjects[toReviveId]; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { if ((int)StartOfRound.Instance.allPlayerScripts[i].playerClientId == toReviveId) { val = StartOfRound.Instance.allPlayerScripts[i]; break; } } TestLCModeBase.mls.LogInfo((object)"After finding player"); if (!val.isPlayerDead) { TestLCModeBase.mls.LogInfo((object)("Player " + toReviveId + " already revived")); return; } val.ResetPlayerBloodObjects(val.isPlayerDead); val.isClimbingLadder = false; val.ResetZAndXRotation(); ((Collider)val.thisController).enabled = true; val.health = 100; val.isPlayerDead = false; val.isPlayerControlled = true; val.isInElevator = true; val.isInHangarShipRoom = true; val.isInsideFactory = false; val.wasInElevatorLastFrame = false; StartOfRound.Instance.SetPlayerObjectExtrapolate(false); val.TeleportPlayer(StartOfRound.Instance.playerSpawnPositions[0].position, false, 0f, false, true); val.setPositionOfDeadPlayer = false; val.DisablePlayerModel(val2, true, true); ((Behaviour)val.helmetLight).enabled = false; val.Crouch(false); val.criticallyInjured = false; if ((Object)(object)val.playerBodyAnimator != (Object)null) { val.playerBodyAnimator.SetBool("Limp", false); } val.bleedingHeavily = false; val.activatingItem = false; val.twoHanded = false; val.inSpecialInteractAnimation = false; val.inAnimationWithEnemy = null; val.holdingWalkieTalkie = false; val.speakingToWalkieTalkie = false; val.isSinking = false; val.isUnderwater = false; val.sinkingValue = 0f; val.statusEffectAudio.Stop(); val.DisableJetpackControlsLocally(); val.health = 100; val.mapRadarDotAnimator.SetBool("dead", false); if (((NetworkBehaviour)val).IsOwner) { HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false); val.hasBegunSpectating = false; HUDManager.Instance.RemoveSpectateUI(); HUDManager.Instance.gameOverAnimator.SetTrigger("revive"); val.hinderedMultiplier = 1f; val.isMovementHindered = 0; val.sourcesCausingSinking = 0; val.reverbPreset = StartOfRound.Instance.shipReverb; } val.voiceMuffledByEnemy = false; SoundManager.Instance.playerVoicePitchTargets[toReviveId] = 1f; SoundManager.Instance.SetPlayerPitch(1f, toReviveId); if ((Object)(object)val.currentVoiceChatIngameSettings == (Object)null) { StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } if ((Object)(object)val.currentVoiceChatIngameSettings != (Object)null) { if ((Object)(object)val.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { val.currentVoiceChatIngameSettings.InitializeComponents(); } if ((Object)(object)val.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { return; } ((Component)val.currentVoiceChatIngameSettings.voiceAudio).GetComponent().overridingLowPass = false; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; localPlayerController.bleedingHeavily = false; localPlayerController.criticallyInjured = false; localPlayerController.playerBodyAnimator.SetBool("Limp", false); localPlayerController.health = 100; HUDManager.Instance.UpdateHealthUI(100, false); localPlayerController.spectatedPlayerScript = null; ((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false; StartOfRound.Instance.SetSpectateCameraToGameOverMode(false, localPlayerController); StartOfRound instance = StartOfRound.Instance; instance.livingPlayers++; StartOfRound.Instance.UpdatePlayerVoiceEffects(); } } }