using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Mod Dev")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Mod Dev")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d02ce5b2-2aba-4217-94fe-197a209d10d4")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace AutoReviveMod; [BepInPlugin("autorevive", "Auto Revive", "1.0.0")] public class AutoRevivePlugin : BaseUnityPlugin { [CompilerGenerated] private sealed class d__15 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public AutoRevivePlugin <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(8f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.ApplyGameFont(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static ManualLogSource log; public static ConfigEntry ReviveTimeConfig; private static float ReviveTime; private static float _deathTimer; private static bool _reviveTriggered; private TextMeshProUGUI reviveText; private TextMeshProUGUI reviveCountdownText; private Canvas canvas; private int _lastRemainingSeconds = -1; private void Awake() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown ReviveTimeConfig = ((BaseUnityPlugin)this).Config.Bind("General", "ReviveTime", 120f, "Time(second) needed to automatically revive player. Minimum 15 seconds, if set below 15, it will be 15 by default."); if (ReviveTimeConfig.Value < 15f) { ReviveTime = 15f; } else { ReviveTime = ReviveTimeConfig.Value; } Harmony val = new Harmony("autorevive"); val.PatchAll(); log = ((BaseUnityPlugin)this).Logger; log.LogInfo((object)"Auto Revive on"); CreateReviveHintUI(); ((MonoBehaviour)this).StartCoroutine(WaitGame2LoadFont()); } private void Update() { //IL_01ea: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Character.localCharacter == (Object)null || (Object)(object)Character.localCharacter.data == (Object)null) { ResetTimerUI(); } else if (Character.localCharacter.data.dead) { _deathTimer += Time.deltaTime; if (!((Behaviour)reviveText).enabled) { ((Behaviour)reviveText).enabled = true; } float num = ReviveTime - _deathTimer; num = Mathf.Max(0f, num); int num2 = Mathf.CeilToInt(num); if (num2 != _lastRemainingSeconds) { _lastRemainingSeconds = num2; int num3 = Mathf.FloorToInt(num / 60f); int num4 = Mathf.FloorToInt(num % 60f); if (num <= 10f) { ((Graphic)reviveText).color = Color.red; ((TMP_Text)reviveText).text = "REVIVE IMMINENT"; } else if (num <= 30f) { ((Graphic)reviveText).color = Color.yellow; ((TMP_Text)reviveText).text = $"REVIVE IN {num3:00}:{num4:00}"; } else { ((Graphic)reviveText).color = Color.white; ((TMP_Text)reviveText).text = $"You Died. {num3:00}:{num4:00} Before Revive"; } } if (num <= 10f) { float num5 = 1f + Mathf.Sin(Time.time * 6f) * 0.05f; ((TMP_Text)reviveText).transform.localScale = Vector3.one * num5; } else { ((TMP_Text)reviveText).transform.localScale = Vector3.one; } if (num <= 10f && num > 0f) { if (!((Behaviour)reviveCountdownText).enabled) { ((Behaviour)reviveCountdownText).enabled = true; } ((TMP_Text)reviveCountdownText).text = num2.ToString(); float num6 = num % 1f; float num7 = Mathf.Lerp(1f, 3f, num6); ((TMP_Text)reviveCountdownText).transform.localScale = Vector3.one * num7; float num8 = Mathf.Lerp(0f, 0.4f, num6); ((Graphic)reviveCountdownText).color = new Color(1f, 0f, 0f, num8); } else if (((Behaviour)reviveCountdownText).enabled) { ((Behaviour)reviveCountdownText).enabled = false; } if (_deathTimer >= ReviveTime && !_reviveTriggered) { _reviveTriggered = true; ReviveLocalPlayer(); } } else { ResetTimerUI(); } } private bool IsValidReviveTarget(Character character, Character local) { if ((Object)(object)character == (Object)null) { return false; } if ((Object)(object)character == (Object)(object)local) { return false; } if ((Object)(object)character.data == (Object)null) { return false; } if (character.data.dead) { return false; } if (character.data.fullyPassedOut) { return false; } return true; } private Character FindReviveTarget(Character local) { if ((Object)(object)local.Ghost != (Object)null && (Object)(object)local.Ghost.m_target != (Object)null) { Character target = local.Ghost.m_target; if (IsValidReviveTarget(target, local)) { return target; } } foreach (Character allCharacter in Character.AllCharacters) { if (IsValidReviveTarget(allCharacter, local)) { return allCharacter; } } return null; } private void ReviveLocalPlayer() { //IL_0046: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null) && ((MonoBehaviourPun)localCharacter).photonView.IsMine) { Character val = FindReviveTarget(localCharacter); if (!((Object)(object)val == (Object)null)) { Vector3 val2 = val.Center + Vector3.up * 1.5f + Vector3.back * 1.5f; ((MonoBehaviourPun)localCharacter).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[3] { val2, true, -1 }); } } } private void ApplyGameFont() { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); TMP_FontAsset[] array2 = array; foreach (TMP_FontAsset val in array2) { if (((Object)val).name == "DarumaDropOne-Regular SDF") { ((TMP_Text)reviveText).font = val; return; } } log.LogWarning((object)"No game font found, use unity built-in font only"); } [IteratorStateMachine(typeof(d__15))] private IEnumerator WaitGame2LoadFont() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__15(0) { <>4__this = this }; } private void CreateReviveHintUI() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_00ac: 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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_00fa: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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) GameObject val = new GameObject("AutoReviveCanvas"); canvas = val.AddComponent(); canvas.renderMode = (RenderMode)0; Object.DontDestroyOnLoad((Object)(object)val); GameObject val2 = new GameObject("ReviveText"); val2.transform.SetParent(val.transform); reviveText = val2.AddComponent(); ((TMP_Text)reviveText).fontSize = 36f; ((TMP_Text)reviveText).alignment = (TextAlignmentOptions)514; ((TMP_Text)reviveText).text = ""; ((Behaviour)reviveText).enabled = false; RectTransform component = ((Component)reviveText).GetComponent(); component.anchorMin = new Vector2(0.5f, 0.8f); component.anchorMax = new Vector2(0.5f, 0.8f); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(600f, 100f); GameObject val3 = new GameObject("CountdownText"); val3.transform.SetParent(val.transform); reviveCountdownText = val3.AddComponent(); ((TMP_Text)reviveCountdownText).fontSize = 250f; ((TMP_Text)reviveCountdownText).alignment = (TextAlignmentOptions)514; ((TMP_Text)reviveCountdownText).fontStyle = (FontStyles)1; ((TMP_Text)reviveCountdownText).text = ""; ((Behaviour)reviveCountdownText).enabled = false; RectTransform component2 = ((Component)reviveCountdownText).GetComponent(); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = new Vector2(0.5f, 0.5f); component2.anchoredPosition = Vector2.zero; component2.sizeDelta = new Vector2(800f, 800f); } private void ResetTimerUI() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) _deathTimer = 0f; _reviveTriggered = false; _lastRemainingSeconds = -1; if ((Object)(object)reviveText != (Object)null && ((Behaviour)reviveText).enabled) { ((TMP_Text)reviveText).text = ""; ((Behaviour)reviveText).enabled = false; ((TMP_Text)reviveText).transform.localScale = Vector3.one; } if ((Object)(object)reviveCountdownText != (Object)null && ((Behaviour)reviveCountdownText).enabled) { ((TMP_Text)reviveCountdownText).text = ""; ((Behaviour)reviveCountdownText).enabled = false; } } [HarmonyPatch(typeof(GlobalEvents), "TriggerRunEnded")] [HarmonyPostfix] public static void OnRunEnded() { _deathTimer = 0f; } }